From 590a856e0adad2440dfaadc4bae6564e26586e78 Mon Sep 17 00:00:00 2001 From: Ryan Vandersmith Date: Mon, 15 Apr 2024 15:28:44 -0500 Subject: [PATCH] Remove experimental HMR server (#61) * Bump npm dependencies * 0.12.1 * Remove experimental HMR server * 0.13.0 --- package-lock.json | 231 +++++++++++++++++++++++++---------------- package.json | 30 +++--- src/app.ts | 33 ------ src/commands/mo-dev.ts | 12 --- src/index.ts | 3 - src/routes/canister.ts | 74 ------------- src/routes/index.ts | 6 -- src/server.ts | 20 ---- 8 files changed, 159 insertions(+), 250 deletions(-) delete mode 100644 src/app.ts delete mode 100644 src/routes/canister.ts delete mode 100644 src/routes/index.ts delete mode 100644 src/server.ts diff --git a/package-lock.json b/package-lock.json index ffbe33b..7eefc72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,29 +1,29 @@ { "name": "mo-dev", - "version": "0.12.0", + "version": "0.13.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mo-dev", - "version": "0.12.0", + "version": "0.13.0", "license": "Apache-2.0", "dependencies": { - "@dfinity/candid": "0.15.4", - "@dfinity/principal": "0.15.4", - "body-parser": "1.20.2", - "chokidar": "3.5.3", - "commander": "10.0.0", - "cookie-parser": "1.4.6", - "cors": "2.8.5", - "debug": "4.3.4", - "execa": "5.1.1", - "express": "4.19.2", - "fast-glob": "3.2.12", - "morgan": "1.10.0", - "motoko": "3.6.1", + "@dfinity/candid": "^1.2.0", + "@dfinity/principal": "^1.2.0", + "body-parser": "^1.20.2", + "chokidar": "^3.5.3", + "commander": "^10.0.0", + "cookie-parser": "^1.4.6", + "cors": "^2.8.5", + "debug": "^4.3.4", + "execa": "^5.1.1", + "express": "^4.19.2", + "fast-glob": "^3.2.12", + "morgan": "^1.10.0", + "motoko": "^3.6.16", "node-cleanup": "^2.1.2", - "picocolors": "1.0.0", + "picocolors": "^1.0.0", "shell-escape": "^0.2.0" }, "bin": { @@ -747,6 +747,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -758,26 +759,26 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "node_modules/@dfinity/candid": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-0.15.4.tgz", - "integrity": "sha512-ImoZ18i95DDstn+EXm/Y1ms7RqF1KVS7+KqZLNvpHFTlcOgfAQc5Bq8W6l1nfkOqeh7wcehDYdjFJwLxBoeTlw==", - "dependencies": { - "ts-node": "^10.8.2" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-1.2.0.tgz", + "integrity": "sha512-L6gV3ODIFC9qNenq3zuRvHrTwH36IM5utVH2wMS5f5eIUeG9fNe+avYLRPBUJwdeX7cM7xhvDgE/m/aN2cZvKQ==", + "peerDependencies": { + "@dfinity/principal": "^1.2.0" } }, "node_modules/@dfinity/principal": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-0.15.4.tgz", - "integrity": "sha512-ZH0InIXaIQqXfUDgkSa0S+9VlkAduhu2JJ984KtRs3BSHUyxG32OGnRcvxfJDdm6GHXWndTWoQUraHPoA3RplQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-1.2.0.tgz", + "integrity": "sha512-7eurqPDL5ptlTTLMJPeiO75FAumXHsWEWDVQaN6XpA3aZtmofNK4Sb5g5Ne9syeuoCJcW3mFBbbFtFNxggxu+g==", "dependencies": { - "js-sha256": "^0.9.0", - "ts-node": "^10.8.2" + "@noble/hashes": "^1.3.1" } }, "node_modules/@eslint/eslintrc": { @@ -1243,6 +1244,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, "engines": { "node": ">=6.0.0" } @@ -1259,7 +1261,8 @@ "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.17", @@ -1271,6 +1274,17 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, + "node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1330,22 +1344,26 @@ "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true }, "node_modules/@tsconfig/node16": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true }, "node_modules/@types/babel__core": { "version": "7.20.0", @@ -1524,7 +1542,8 @@ "node_modules/@types/node": { "version": "18.11.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", - "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==" + "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==", + "dev": true }, "node_modules/@types/node-cleanup": { "version": "2.1.2", @@ -1640,6 +1659,7 @@ "version": "8.8.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -1661,6 +1681,7 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, "engines": { "node": ">=0.4.0" } @@ -1773,7 +1794,8 @@ "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "node_modules/argparse": { "version": "2.0.1", @@ -2522,7 +2544,8 @@ "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true }, "node_modules/cross-env": { "version": "7.0.3", @@ -2703,6 +2726,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, "engines": { "node": ">=0.3.1" } @@ -4926,11 +4950,6 @@ "dev": true, "peer": true }, - "node_modules/js-sha256": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", - "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5420,7 +5439,8 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "node_modules/makeerror": { "version": "1.0.12", @@ -5640,9 +5660,9 @@ } }, "node_modules/motoko": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/motoko/-/motoko-3.6.1.tgz", - "integrity": "sha512-qLPSYKEN9+9zO9DGFOdNNEvssm8Ma5pQl7QcGJtDYTgfa6FAHOPTLGNn/isHlGRdUW/AdhKszXjs/sPKvEgCPw==", + "version": "3.6.16", + "resolved": "https://registry.npmjs.org/motoko/-/motoko-3.6.16.tgz", + "integrity": "sha512-BNjeRuXrdtvz8NG8nmv7px/j60bn6jv3FGMJlR4HhXoc64xEMKSufUW2GjiV4uMPqUZ38TJ9i54kumBuwQFjQQ==", "dependencies": { "cross-fetch": "3.1.5", "debug": "4.3.4", @@ -7566,14 +7586,14 @@ } }, "node_modules/tar": { - "version": "6.1.12", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.12.tgz", - "integrity": "sha512-jU4TdemS31uABHd+Lt5WEYJuzn+TJTCBLljvIAHZOz6M9Os5pJ4dD+vRFLxPa/n3T0iEFzpi+0x1UfuDZYbRMw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" @@ -7630,6 +7650,15 @@ "node": ">= 6" } }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -7766,6 +7795,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -7873,6 +7903,7 @@ "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -7985,7 +8016,8 @@ "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true }, "node_modules/v8-to-istanbul": { "version": "9.1.0", @@ -8236,6 +8268,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, "engines": { "node": ">=6" } @@ -8786,6 +8819,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -8794,6 +8828,7 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -8802,20 +8837,17 @@ } }, "@dfinity/candid": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-0.15.4.tgz", - "integrity": "sha512-ImoZ18i95DDstn+EXm/Y1ms7RqF1KVS7+KqZLNvpHFTlcOgfAQc5Bq8W6l1nfkOqeh7wcehDYdjFJwLxBoeTlw==", - "requires": { - "ts-node": "^10.8.2" - } + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-1.2.0.tgz", + "integrity": "sha512-L6gV3ODIFC9qNenq3zuRvHrTwH36IM5utVH2wMS5f5eIUeG9fNe+avYLRPBUJwdeX7cM7xhvDgE/m/aN2cZvKQ==", + "requires": {} }, "@dfinity/principal": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-0.15.4.tgz", - "integrity": "sha512-ZH0InIXaIQqXfUDgkSa0S+9VlkAduhu2JJ984KtRs3BSHUyxG32OGnRcvxfJDdm6GHXWndTWoQUraHPoA3RplQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-1.2.0.tgz", + "integrity": "sha512-7eurqPDL5ptlTTLMJPeiO75FAumXHsWEWDVQaN6XpA3aZtmofNK4Sb5g5Ne9syeuoCJcW3mFBbbFtFNxggxu+g==", "requires": { - "js-sha256": "^0.9.0", - "ts-node": "^10.8.2" + "@noble/hashes": "^1.3.1" } }, "@eslint/eslintrc": { @@ -9178,7 +9210,8 @@ "@jridgewell/resolve-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true }, "@jridgewell/set-array": { "version": "1.1.2", @@ -9189,7 +9222,8 @@ "@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true }, "@jridgewell/trace-mapping": { "version": "0.3.17", @@ -9201,6 +9235,11 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, + "@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -9251,22 +9290,26 @@ "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true }, "@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true }, "@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true }, "@tsconfig/node16": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true }, "@types/babel__core": { "version": "7.20.0", @@ -9445,7 +9488,8 @@ "@types/node": { "version": "18.11.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", - "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==" + "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==", + "dev": true }, "@types/node-cleanup": { "version": "2.1.2", @@ -9557,7 +9601,8 @@ "acorn": { "version": "8.8.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==" + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "dev": true }, "acorn-jsx": { "version": "5.3.2", @@ -9570,7 +9615,8 @@ "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true }, "agent-base": { "version": "6.0.2", @@ -9648,7 +9694,8 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "argparse": { "version": "2.0.1", @@ -10194,7 +10241,8 @@ "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true }, "cross-env": { "version": "7.0.3", @@ -10316,7 +10364,8 @@ "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true }, "diff-sequences": { "version": "29.4.3", @@ -11947,11 +11996,6 @@ "dev": true, "peer": true }, - "js-sha256": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", - "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -12313,7 +12357,8 @@ "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "makeerror": { "version": "1.0.12", @@ -12475,9 +12520,9 @@ } }, "motoko": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/motoko/-/motoko-3.6.1.tgz", - "integrity": "sha512-qLPSYKEN9+9zO9DGFOdNNEvssm8Ma5pQl7QcGJtDYTgfa6FAHOPTLGNn/isHlGRdUW/AdhKszXjs/sPKvEgCPw==", + "version": "3.6.16", + "resolved": "https://registry.npmjs.org/motoko/-/motoko-3.6.16.tgz", + "integrity": "sha512-BNjeRuXrdtvz8NG8nmv7px/j60bn6jv3FGMJlR4HhXoc64xEMKSufUW2GjiV4uMPqUZ38TJ9i54kumBuwQFjQQ==", "requires": { "cross-fetch": "3.1.5", "debug": "4.3.4", @@ -13871,17 +13916,25 @@ "dev": true }, "tar": { - "version": "6.1.12", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.12.tgz", - "integrity": "sha512-jU4TdemS31uABHd+Lt5WEYJuzn+TJTCBLljvIAHZOz6M9Os5pJ4dD+vRFLxPa/n3T0iEFzpi+0x1UfuDZYbRMw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" + }, + "dependencies": { + "minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true + } } }, "tar-fs": { @@ -14023,6 +14076,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -14089,7 +14143,8 @@ "typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true }, "unbox-primitive": { "version": "1.0.2", @@ -14169,7 +14224,8 @@ "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true }, "v8-to-istanbul": { "version": "9.1.0", @@ -14376,7 +14432,8 @@ "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true }, "yocto-queue": { "version": "0.1.0", diff --git a/package.json b/package.json index 8660d0d..9afad72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mo-dev", - "version": "0.12.0", + "version": "0.13.0", "description": "A live reload development server for Motoko smart contracts.", "author": "DFINITY Foundation (https://dfinity.org)", "license": "Apache-2.0", @@ -30,21 +30,21 @@ "prepublishOnly": "run-s build test" }, "dependencies": { - "@dfinity/candid": "0.15.4", - "@dfinity/principal": "0.15.4", - "body-parser": "1.20.2", - "chokidar": "3.5.3", - "commander": "10.0.0", - "cookie-parser": "1.4.6", - "cors": "2.8.5", - "debug": "4.3.4", - "execa": "5.1.1", - "express": "4.19.2", - "fast-glob": "3.2.12", - "morgan": "1.10.0", - "motoko": "3.6.1", + "@dfinity/candid": "^1.2.0", + "@dfinity/principal": "^1.2.0", + "body-parser": "^1.20.2", + "chokidar": "^3.5.3", + "commander": "^10.0.0", + "cookie-parser": "^1.4.6", + "cors": "^2.8.5", + "debug": "^4.3.4", + "execa": "^5.1.1", + "express": "^4.19.2", + "fast-glob": "^3.2.12", + "morgan": "^1.10.0", + "motoko": "^3.6.16", "node-cleanup": "^2.1.2", - "picocolors": "1.0.0", + "picocolors": "^1.0.0", "shell-escape": "^0.2.0" }, "devDependencies": { diff --git a/src/app.ts b/src/app.ts deleted file mode 100644 index 75d6492..0000000 --- a/src/app.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Settings } from './settings'; -import compression from 'compression'; -import cookieParser from 'cookie-parser'; -import cors from 'cors'; -import express from 'express'; -// import helmet from 'helmet'; -// import hpp from 'hpp'; -import morgan from 'morgan'; -import routes from './routes'; - -export default function createApp(settings: Settings) { - const app = express(); - - app.use(morgan('dev')); - app.use(cors()); - // app.use(hpp()); - // app.use(helmet({ contentSecurityPolicy: false })); - // app.use(compression()); - // app.use(express.json()); - app.use(express.urlencoded({ extended: true })); - app.use(cookieParser()); - - routes.forEach((route) => route(app, settings)); - - app.use((err: any, _req: any, res: any, _next: any) => { - console.error(err); - res.status(500).end(); - }); - - // app.use(express.static(join(__dirname, '../public'))); - - return app; -} diff --git a/src/commands/mo-dev.ts b/src/commands/mo-dev.ts index 1fa1bed..f9a4060 100644 --- a/src/commands/mo-dev.ts +++ b/src/commands/mo-dev.ts @@ -82,18 +82,6 @@ const { .option('-g, --generate', `run \`dfx generate\` on file change`) .option('-x, --exec ', `execute command on file change`) .option('-v, --verbose', `show more details in console`, increaseVerbosity) - .addOption( - new Option( - '--hot-reload', - `hot module replacement server (experimental)`, - ).hideHelp(), - ) - .addOption( - new Option( - '--port ', - `hot module replacement server port (default: ${defaultSettings.port})`, - ).hideHelp(), - ) .parse() .opts(); diff --git a/src/index.ts b/src/index.ts index fdc1ad6..9c7acf7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,3 @@ -import { serve } from './server'; import { Settings, defaultSettings, validateSettings } from './settings'; import wasm from './wasm'; import { watch } from './watch'; @@ -12,10 +11,8 @@ export default async function devServer(options: Partial = {}) { const output = { watcher: await watch(settings), - server: settings.hotReload ? await serve(settings) : null, close() { output.watcher.close(); - output.server?.close(); }, }; return output; diff --git a/src/routes/canister.ts b/src/routes/canister.ts deleted file mode 100644 index 3baa318..0000000 --- a/src/routes/canister.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { json } from 'body-parser'; -import express from 'express'; -import { Settings } from '../settings'; -import { getVirtualFile } from '../utils/motoko'; -import wasm from '../wasm'; -import { findCanister } from '../watch'; -import { IDL } from '@dfinity/candid'; - -export default (app: express.Application, { delay }: Settings) => { - app.post('/call/:alias([^/]+)/:method', json(), async (req, res, next) => { - try { - const { alias, method } = req.params; - const message = req.body; - - console.log(`${alias}.${method}`, message); - - const args = message?.args || []; - if (!Array.isArray(args)) { - return res - .status(400) - .json({ message: '`args` must be an array' }); - } - - const canister = findCanister(alias); - if (!canister) { - return res - .status(400) - .json({ message: `Unknown canister: ${canister}` }); - } - const candidSource = getVirtualFile(canister.file).candid(); - const candidJs = wasm.candid_to_js(candidSource); - if (!candidJs) { - return res.status(400).json({ - message: `Unable to parse Candid for canister: ${alias}`, - }); - } - const idlFactory: IDL.InterfaceFactory = ( - await eval( - `import(${JSON.stringify( - `data:text/javascript;charset=utf-8,${encodeURIComponent( - candidJs, - )}`, - )})`, - ) - ).idlFactory; - const service = idlFactory({ IDL }); - - const field = service._fields.find(([m]) => m === method)?.[1]; - if (!field) { - return res.status(400).json({ - message: `Unknown canister method: ${alias}.${method}`, - }); - } - - const candid = IDL.encode(field.argTypes, args); - - const value = wasm.call_canister( - alias, - method, - new Uint8Array(candid), - ); - - console.log('Result:', JSON.stringify(value)); - - res.json({ - value, - }); - } catch (err) { - next(err); - } - }); -}; - -// export default router; diff --git a/src/routes/index.ts b/src/routes/index.ts deleted file mode 100644 index eb5b66e..0000000 --- a/src/routes/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import canister from './canister'; - -const routes = [ - canister, -]; -export default routes; diff --git a/src/server.ts b/src/server.ts deleted file mode 100644 index c15a50d..0000000 --- a/src/server.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { createServer } from 'http'; -import createApp from './app'; -import { Settings } from './settings'; -import pc from 'picocolors'; - -export async function serve(settings: Settings) { - if (settings.verbosity >= 1 && settings.delay) { - console.log(pc.gray('Adding artificial delay')); - } - - const devServerPort = +process.env.PORT || settings.port; - - const app = createApp(settings); - const server = createServer(app); - - server.listen(devServerPort); - console.log(`HMR server listening on port ${pc.bold(devServerPort)}`); - - return server; -}