create-leo-app 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -2
- package/template-extension/README.md +4 -0
- package/template-extension/package.json +15 -0
- package/template-extension/rollup.config.js +21 -0
- package/template-extension/src/offscreen.js +1 -0
- package/template-extension/src/service_worker.js +20 -0
- package/template-extension/src/worker.js +34 -0
- package/template-extension/static/manifest.json +16 -0
- package/template-extension/static/offscreen.html +9 -0
- package/template-nextjs-ts/README.md +19 -0
- package/template-nextjs-ts/_gitignore +35 -0
- package/template-nextjs-ts/next-env.d.ts +5 -0
- package/template-nextjs-ts/next.config.js +32 -0
- package/template-nextjs-ts/node_modules/@types/node/LICENSE +21 -0
- package/template-nextjs-ts/node_modules/@types/node/README.md +15 -0
- package/template-nextjs-ts/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/template-nextjs-ts/node_modules/@types/node/assert.d.ts +1040 -0
- package/template-nextjs-ts/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/template-nextjs-ts/node_modules/@types/node/buffer.d.ts +2301 -0
- package/template-nextjs-ts/node_modules/@types/node/child_process.d.ts +1544 -0
- package/template-nextjs-ts/node_modules/@types/node/cluster.d.ts +578 -0
- package/template-nextjs-ts/node_modules/@types/node/console.d.ts +452 -0
- package/template-nextjs-ts/node_modules/@types/node/constants.d.ts +19 -0
- package/template-nextjs-ts/node_modules/@types/node/crypto.d.ts +4524 -0
- package/template-nextjs-ts/node_modules/@types/node/dgram.d.ts +596 -0
- package/template-nextjs-ts/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/template-nextjs-ts/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/template-nextjs-ts/node_modules/@types/node/dns.d.ts +864 -0
- package/template-nextjs-ts/node_modules/@types/node/dom-events.d.ts +124 -0
- package/template-nextjs-ts/node_modules/@types/node/domain.d.ts +170 -0
- package/template-nextjs-ts/node_modules/@types/node/events.d.ts +931 -0
- package/template-nextjs-ts/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/template-nextjs-ts/node_modules/@types/node/fs.d.ts +4317 -0
- package/template-nextjs-ts/node_modules/@types/node/globals.d.ts +503 -0
- package/template-nextjs-ts/node_modules/@types/node/globals.global.d.ts +1 -0
- package/template-nextjs-ts/node_modules/@types/node/http.d.ts +1908 -0
- package/template-nextjs-ts/node_modules/@types/node/http2.d.ts +2418 -0
- package/template-nextjs-ts/node_modules/@types/node/https.d.ts +550 -0
- package/template-nextjs-ts/node_modules/@types/node/index.d.ts +89 -0
- package/template-nextjs-ts/node_modules/@types/node/inspector.d.ts +3696 -0
- package/template-nextjs-ts/node_modules/@types/node/module.d.ts +315 -0
- package/template-nextjs-ts/node_modules/@types/node/net.d.ts +999 -0
- package/template-nextjs-ts/node_modules/@types/node/os.d.ts +495 -0
- package/template-nextjs-ts/node_modules/@types/node/package.json +217 -0
- package/template-nextjs-ts/node_modules/@types/node/path.d.ts +191 -0
- package/template-nextjs-ts/node_modules/@types/node/perf_hooks.d.ts +934 -0
- package/template-nextjs-ts/node_modules/@types/node/process.d.ts +1879 -0
- package/template-nextjs-ts/node_modules/@types/node/punycode.d.ts +117 -0
- package/template-nextjs-ts/node_modules/@types/node/querystring.d.ts +153 -0
- package/template-nextjs-ts/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/template-nextjs-ts/node_modules/@types/node/readline.d.ts +540 -0
- package/template-nextjs-ts/node_modules/@types/node/repl.d.ts +430 -0
- package/template-nextjs-ts/node_modules/@types/node/sea.d.ts +153 -0
- package/template-nextjs-ts/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/template-nextjs-ts/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/template-nextjs-ts/node_modules/@types/node/stream/web.d.ts +521 -0
- package/template-nextjs-ts/node_modules/@types/node/stream.d.ts +1707 -0
- package/template-nextjs-ts/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/template-nextjs-ts/node_modules/@types/node/test.d.ts +1874 -0
- package/template-nextjs-ts/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/template-nextjs-ts/node_modules/@types/node/timers.d.ts +240 -0
- package/template-nextjs-ts/node_modules/@types/node/tls.d.ts +1217 -0
- package/template-nextjs-ts/node_modules/@types/node/trace_events.d.ts +197 -0
- package/template-nextjs-ts/node_modules/@types/node/tty.d.ts +208 -0
- package/template-nextjs-ts/node_modules/@types/node/url.d.ts +952 -0
- package/template-nextjs-ts/node_modules/@types/node/util.d.ts +2298 -0
- package/template-nextjs-ts/node_modules/@types/node/v8.d.ts +808 -0
- package/template-nextjs-ts/node_modules/@types/node/vm.d.ts +924 -0
- package/template-nextjs-ts/node_modules/@types/node/wasi.d.ts +181 -0
- package/template-nextjs-ts/node_modules/@types/node/worker_threads.d.ts +694 -0
- package/template-nextjs-ts/node_modules/@types/node/zlib.d.ts +539 -0
- package/template-nextjs-ts/package.json +24 -0
- package/template-nextjs-ts/public/aleo.svg +8 -0
- package/template-nextjs-ts/public/next.svg +1 -0
- package/template-nextjs-ts/src/app/favicon.ico +0 -0
- package/template-nextjs-ts/src/app/globals.css +126 -0
- package/template-nextjs-ts/src/app/layout.tsx +22 -0
- package/template-nextjs-ts/src/app/page.module.css +160 -0
- package/template-nextjs-ts/src/app/page.tsx +94 -0
- package/template-nextjs-ts/src/app/worker.ts +47 -0
- package/template-nextjs-ts/tsconfig.json +27 -0
- package/template-node/README.md +5 -0
- package/template-node/_gitignore +24 -0
- package/template-node/package.json +12 -0
- package/template-node-ts/README.md +5 -0
- package/template-node-ts/_gitignore +24 -0
- package/template-node-ts/package.json +19 -0
- package/template-node-ts/rollup.config.js +19 -0
- package/template-node-ts/src/index.ts +65 -0
- package/template-node-ts/tsconfig.json +15 -0
- package/template-offline-public-transaction-ts/README.md +52 -0
- package/template-offline-public-transaction-ts/_gitignore +24 -0
- package/template-offline-public-transaction-ts/package.json +19 -0
- package/template-offline-public-transaction-ts/rollup.config.js +19 -0
- package/template-offline-public-transaction-ts/src/helpers.ts +70 -0
- package/template-offline-public-transaction-ts/src/index.ts +171 -0
- package/template-offline-public-transaction-ts/tsconfig.json +15 -0
- package/template-react-leo/.babelrc +6 -0
- package/template-react-leo/.eslintrc.cjs +20 -0
- package/template-react-leo/README.md +90 -0
- package/template-react-leo/_gitignore +24 -0
- package/template-react-leo/_headers +3 -0
- package/template-react-leo/helloworld/.env.example +2 -0
- package/template-react-leo/helloworld/README.md +13 -0
- package/template-react-leo/helloworld/build/main.aleo +7 -0
- package/template-react-leo/helloworld/build/program.json +6 -0
- package/template-react-leo/helloworld/inputs/helloworld.in +4 -0
- package/template-react-leo/helloworld/program.json +6 -0
- package/template-react-leo/helloworld/src/main.leo +7 -0
- package/template-react-leo/index.html +88 -0
- package/template-react-leo/install.sh +30 -0
- package/template-react-leo/package.json +44 -0
- package/template-react-leo/public/favicon.ico +0 -0
- package/template-react-leo/src/App.css +42 -0
- package/template-react-leo/src/App.jsx +103 -0
- package/template-react-leo/src/assets/aleo.svg +5 -0
- package/template-react-leo/src/assets/react.svg +1 -0
- package/template-react-leo/src/index.css +69 -0
- package/template-react-leo/src/main.jsx +10 -0
- package/template-react-leo/src/workers/AleoWorker.js +20 -0
- package/template-react-leo/src/workers/worker.js +72 -0
- package/template-react-leo/vite.config.js +16 -0
- package/template-react-leo/webpack.config.js +102 -0
- package/template-react-managed-worker/.babelrc +6 -0
- package/template-react-managed-worker/.eslintrc.cjs +20 -0
- package/template-react-managed-worker/README.md +8 -0
- package/template-react-managed-worker/_gitignore +24 -0
- package/template-react-managed-worker/index.html +88 -0
- package/template-react-managed-worker/package.json +41 -0
- package/template-react-managed-worker/public/favicon.ico +0 -0
- package/template-react-managed-worker/src/App.css +42 -0
- package/template-react-managed-worker/src/App.jsx +78 -0
- package/template-react-managed-worker/src/assets/aleo.png +0 -0
- package/template-react-managed-worker/src/assets/react.svg +1 -0
- package/template-react-managed-worker/src/index.css +69 -0
- package/template-react-managed-worker/src/main.jsx +10 -0
- package/template-react-managed-worker/vite.config.js +20 -0
- package/template-react-managed-worker/webpack.config.js +90 -0
- package/template-react-ts/.babelrc +7 -0
- package/template-react-ts/.eslintrc.cjs +20 -0
- package/template-react-ts/README.md +90 -0
- package/template-react-ts/_gitignore +24 -0
- package/template-react-ts/_headers +3 -0
- package/template-react-ts/helloworld/.env.example +2 -0
- package/template-react-ts/helloworld/README.md +13 -0
- package/template-react-ts/helloworld/build/main.aleo +7 -0
- package/template-react-ts/helloworld/build/program.json +6 -0
- package/template-react-ts/helloworld/inputs/helloworld.in +4 -0
- package/template-react-ts/helloworld/program.json +6 -0
- package/template-react-ts/helloworld/src/main.leo +7 -0
- package/template-react-ts/index.html +88 -0
- package/template-react-ts/install.sh +30 -0
- package/template-react-ts/node_modules/@types/node/LICENSE +21 -0
- package/template-react-ts/node_modules/@types/node/README.md +15 -0
- package/template-react-ts/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/template-react-ts/node_modules/@types/node/assert.d.ts +1040 -0
- package/template-react-ts/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/template-react-ts/node_modules/@types/node/buffer.d.ts +2301 -0
- package/template-react-ts/node_modules/@types/node/child_process.d.ts +1544 -0
- package/template-react-ts/node_modules/@types/node/cluster.d.ts +578 -0
- package/template-react-ts/node_modules/@types/node/console.d.ts +452 -0
- package/template-react-ts/node_modules/@types/node/constants.d.ts +19 -0
- package/template-react-ts/node_modules/@types/node/crypto.d.ts +4524 -0
- package/template-react-ts/node_modules/@types/node/dgram.d.ts +596 -0
- package/template-react-ts/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/template-react-ts/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/template-react-ts/node_modules/@types/node/dns.d.ts +864 -0
- package/template-react-ts/node_modules/@types/node/dom-events.d.ts +124 -0
- package/template-react-ts/node_modules/@types/node/domain.d.ts +170 -0
- package/template-react-ts/node_modules/@types/node/events.d.ts +931 -0
- package/template-react-ts/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/template-react-ts/node_modules/@types/node/fs.d.ts +4317 -0
- package/template-react-ts/node_modules/@types/node/globals.d.ts +503 -0
- package/template-react-ts/node_modules/@types/node/globals.global.d.ts +1 -0
- package/template-react-ts/node_modules/@types/node/http.d.ts +1908 -0
- package/template-react-ts/node_modules/@types/node/http2.d.ts +2418 -0
- package/template-react-ts/node_modules/@types/node/https.d.ts +550 -0
- package/template-react-ts/node_modules/@types/node/index.d.ts +89 -0
- package/template-react-ts/node_modules/@types/node/inspector.d.ts +3696 -0
- package/template-react-ts/node_modules/@types/node/module.d.ts +315 -0
- package/template-react-ts/node_modules/@types/node/net.d.ts +999 -0
- package/template-react-ts/node_modules/@types/node/os.d.ts +495 -0
- package/template-react-ts/node_modules/@types/node/package.json +217 -0
- package/template-react-ts/node_modules/@types/node/path.d.ts +191 -0
- package/template-react-ts/node_modules/@types/node/perf_hooks.d.ts +934 -0
- package/template-react-ts/node_modules/@types/node/process.d.ts +1879 -0
- package/template-react-ts/node_modules/@types/node/punycode.d.ts +117 -0
- package/template-react-ts/node_modules/@types/node/querystring.d.ts +153 -0
- package/template-react-ts/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/template-react-ts/node_modules/@types/node/readline.d.ts +540 -0
- package/template-react-ts/node_modules/@types/node/repl.d.ts +430 -0
- package/template-react-ts/node_modules/@types/node/sea.d.ts +153 -0
- package/template-react-ts/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/template-react-ts/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/template-react-ts/node_modules/@types/node/stream/web.d.ts +521 -0
- package/template-react-ts/node_modules/@types/node/stream.d.ts +1707 -0
- package/template-react-ts/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/template-react-ts/node_modules/@types/node/test.d.ts +1874 -0
- package/template-react-ts/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/template-react-ts/node_modules/@types/node/timers.d.ts +240 -0
- package/template-react-ts/node_modules/@types/node/tls.d.ts +1217 -0
- package/template-react-ts/node_modules/@types/node/trace_events.d.ts +197 -0
- package/template-react-ts/node_modules/@types/node/tty.d.ts +208 -0
- package/template-react-ts/node_modules/@types/node/url.d.ts +952 -0
- package/template-react-ts/node_modules/@types/node/util.d.ts +2298 -0
- package/template-react-ts/node_modules/@types/node/v8.d.ts +808 -0
- package/template-react-ts/node_modules/@types/node/vm.d.ts +924 -0
- package/template-react-ts/node_modules/@types/node/wasi.d.ts +181 -0
- package/template-react-ts/node_modules/@types/node/worker_threads.d.ts +694 -0
- package/template-react-ts/node_modules/@types/node/zlib.d.ts +539 -0
- package/template-react-ts/node_modules/diff/CONTRIBUTING.md +39 -0
- package/template-react-ts/node_modules/diff/LICENSE +31 -0
- package/template-react-ts/node_modules/diff/README.md +207 -0
- package/template-react-ts/node_modules/diff/dist/diff.js +1585 -0
- package/template-react-ts/node_modules/diff/dist/diff.min.js +38 -0
- package/template-react-ts/node_modules/diff/lib/convert/dmp.js +32 -0
- package/template-react-ts/node_modules/diff/lib/convert/xml.js +42 -0
- package/template-react-ts/node_modules/diff/lib/diff/array.js +45 -0
- package/template-react-ts/node_modules/diff/lib/diff/base.js +304 -0
- package/template-react-ts/node_modules/diff/lib/diff/character.js +37 -0
- package/template-react-ts/node_modules/diff/lib/diff/css.js +41 -0
- package/template-react-ts/node_modules/diff/lib/diff/json.js +163 -0
- package/template-react-ts/node_modules/diff/lib/diff/line.js +89 -0
- package/template-react-ts/node_modules/diff/lib/diff/sentence.js +41 -0
- package/template-react-ts/node_modules/diff/lib/diff/word.js +107 -0
- package/template-react-ts/node_modules/diff/lib/index.es6.js +1519 -0
- package/template-react-ts/node_modules/diff/lib/index.js +216 -0
- package/template-react-ts/node_modules/diff/lib/patch/apply.js +243 -0
- package/template-react-ts/node_modules/diff/lib/patch/create.js +247 -0
- package/template-react-ts/node_modules/diff/lib/patch/merge.js +609 -0
- package/template-react-ts/node_modules/diff/lib/patch/parse.js +156 -0
- package/template-react-ts/node_modules/diff/lib/util/array.js +32 -0
- package/template-react-ts/node_modules/diff/lib/util/distance-iterator.js +57 -0
- package/template-react-ts/node_modules/diff/lib/util/params.js +24 -0
- package/template-react-ts/node_modules/diff/package.json +73 -0
- package/template-react-ts/node_modules/diff/release-notes.md +261 -0
- package/template-react-ts/node_modules/diff/runtime.js +3 -0
- package/template-react-ts/node_modules/ts-node/LICENSE +21 -0
- package/template-react-ts/node_modules/ts-node/README.md +1442 -0
- package/template-react-ts/node_modules/ts-node/child-loader.mjs +8 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-cwd.d.ts +2 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-cwd.js +6 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-cwd.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-esm.d.ts +2 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-esm.js +6 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-esm.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-script-deprecated.d.ts +2 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-script-deprecated.js +7 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-script-deprecated.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-script.d.ts +2 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-script.js +6 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-script.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-transpile.d.ts +2 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-transpile.js +6 -0
- package/template-react-ts/node_modules/ts-node/dist/bin-transpile.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/bin.d.ts +11 -0
- package/template-react-ts/node_modules/ts-node/dist/bin.js +581 -0
- package/template-react-ts/node_modules/ts-node/dist/bin.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/argv-payload.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/argv-payload.js +19 -0
- package/template-react-ts/node_modules/ts-node/dist/child/argv-payload.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-entrypoint.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-entrypoint.js +24 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-entrypoint.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-loader.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-loader.js +32 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-loader.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-require.d.ts +7 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-require.js +22 -0
- package/template-react-ts/node_modules/ts-node/dist/child/child-require.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/spawn-child.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/child/spawn-child.js +49 -0
- package/template-react-ts/node_modules/ts-node/dist/child/spawn-child.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/cjs-resolve-hooks.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/cjs-resolve-hooks.js +29 -0
- package/template-react-ts/node_modules/ts-node/dist/cjs-resolve-hooks.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/configuration.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/configuration.js +308 -0
- package/template-react-ts/node_modules/ts-node/dist/configuration.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/esm.d.ts +53 -0
- package/template-react-ts/node_modules/ts-node/dist/esm.js +228 -0
- package/template-react-ts/node_modules/ts-node/dist/esm.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/file-extensions.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/file-extensions.js +133 -0
- package/template-react-ts/node_modules/ts-node/dist/file-extensions.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/index.d.ts +332 -0
- package/template-react-ts/node_modules/ts-node/dist/index.js +953 -0
- package/template-react-ts/node_modules/ts-node/dist/index.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/module-type-classifier.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/module-type-classifier.js +64 -0
- package/template-react-ts/node_modules/ts-node/dist/module-type-classifier.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/node-module-type-classifier.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/node-module-type-classifier.js +39 -0
- package/template-react-ts/node_modules/ts-node/dist/node-module-type-classifier.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/repl.d.ts +78 -0
- package/template-react-ts/node_modules/ts-node/dist/repl.js +561 -0
- package/template-react-ts/node_modules/ts-node/dist/repl.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/resolver-functions.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/resolver-functions.js +143 -0
- package/template-react-ts/node_modules/ts-node/dist/resolver-functions.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/transpilers/swc.d.ts +11 -0
- package/template-react-ts/node_modules/ts-node/dist/transpilers/swc.js +218 -0
- package/template-react-ts/node_modules/ts-node/dist/transpilers/swc.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/transpilers/types.d.ts +35 -0
- package/template-react-ts/node_modules/ts-node/dist/transpilers/types.js +3 -0
- package/template-react-ts/node_modules/ts-node/dist/transpilers/types.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-compiler-types.d.ts +63 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-compiler-types.js +3 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-compiler-types.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-internals.d.ts +6 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-internals.js +321 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-internals.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-transpile-module.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-transpile-module.js +100 -0
- package/template-react-ts/node_modules/ts-node/dist/ts-transpile-module.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/tsconfig-schema.d.ts +13 -0
- package/template-react-ts/node_modules/ts-node/dist/tsconfig-schema.js +3 -0
- package/template-react-ts/node_modules/ts-node/dist/tsconfig-schema.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/tsconfigs.d.ts +1 -0
- package/template-react-ts/node_modules/ts-node/dist/tsconfigs.js +36 -0
- package/template-react-ts/node_modules/ts-node/dist/tsconfigs.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist/util.d.ts +4 -0
- package/template-react-ts/node_modules/ts-node/dist/util.js +175 -0
- package/template-react-ts/node_modules/ts-node/dist/util.js.map +1 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/NODE-LICENSE.md +24 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/README.md +36 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-constants.js +4 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-errors.js +82 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-cjs-helpers.js +89 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-cjs-loader.js +593 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-esm-get_format.js +106 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js +962 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-package_json_reader.js +44 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-repl-await.js +254 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-internalBinding-fs.js +58 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-nativemodule.js +9 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-options.js +103 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/node-primordials.js +37 -0
- package/template-react-ts/node_modules/ts-node/dist-raw/runmain-hack.js +9 -0
- package/template-react-ts/node_modules/ts-node/esm/transpile-only.mjs +8 -0
- package/template-react-ts/node_modules/ts-node/esm.mjs +8 -0
- package/template-react-ts/node_modules/ts-node/node10/tsconfig.json +3 -0
- package/template-react-ts/node_modules/ts-node/node12/tsconfig.json +3 -0
- package/template-react-ts/node_modules/ts-node/node14/tsconfig.json +3 -0
- package/template-react-ts/node_modules/ts-node/node16/tsconfig.json +3 -0
- package/template-react-ts/node_modules/ts-node/package.json +182 -0
- package/template-react-ts/node_modules/ts-node/register/files.js +3 -0
- package/template-react-ts/node_modules/ts-node/register/index.js +1 -0
- package/template-react-ts/node_modules/ts-node/register/transpile-only.js +3 -0
- package/template-react-ts/node_modules/ts-node/register/type-check.js +3 -0
- package/template-react-ts/node_modules/ts-node/transpilers/swc-experimental.js +1 -0
- package/template-react-ts/node_modules/ts-node/transpilers/swc.js +1 -0
- package/template-react-ts/node_modules/ts-node/tsconfig.schema.json +183 -0
- package/template-react-ts/node_modules/ts-node/tsconfig.schemastore-schema.json +1326 -0
- package/template-react-ts/package.json +49 -0
- package/template-react-ts/public/favicon.ico +0 -0
- package/template-react-ts/src/App.css +42 -0
- package/template-react-ts/src/App.tsx +103 -0
- package/template-react-ts/src/assets/aleo.svg +5 -0
- package/template-react-ts/src/assets/react.svg +1 -0
- package/template-react-ts/src/custom.d.ts +16 -0
- package/template-react-ts/src/index.css +69 -0
- package/template-react-ts/src/main.tsx +10 -0
- package/template-react-ts/src/workers/AleoWorker.ts +21 -0
- package/template-react-ts/src/workers/worker.ts +73 -0
- package/template-react-ts/tsconfig.json +16 -0
- package/template-react-ts/vite.config.ts +16 -0
- package/template-react-ts/webpack.config.ts +112 -0
- package/template-vanilla/_gitignore +24 -0
- package/template-vanilla/_headers +3 -0
- package/template-vanilla/index.html +13 -0
- package/template-vanilla/javascript.svg +1 -0
- package/template-vanilla/main.js +48 -0
- package/template-vanilla/package.json +16 -0
- package/template-vanilla/public/aleo.svg +76 -0
- package/template-vanilla/public/vite.svg +1 -0
- package/template-vanilla/style.css +97 -0
- package/template-vanilla/vite.config.js +12 -0
- package/template-vanilla/worker.js +95 -0
package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-package_json_reader.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/package_json_reader.js
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { SafeMap } = require('./node-primordials');
|
|
5
|
+
const { internalModuleReadJSON } = require('./node-internalBinding-fs');
|
|
6
|
+
const { pathToFileURL } = require('url');
|
|
7
|
+
const { toNamespacedPath } = require('path');
|
|
8
|
+
// const { getOptionValue } = require('./node-options');
|
|
9
|
+
|
|
10
|
+
const cache = new SafeMap();
|
|
11
|
+
|
|
12
|
+
let manifest;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} jsonPath
|
|
16
|
+
* @return {{string: string, containsKeys: boolean}}
|
|
17
|
+
*/
|
|
18
|
+
function read(jsonPath) {
|
|
19
|
+
if (cache.has(jsonPath)) {
|
|
20
|
+
return cache.get(jsonPath);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const [string, containsKeys] = internalModuleReadJSON(
|
|
24
|
+
toNamespacedPath(jsonPath)
|
|
25
|
+
);
|
|
26
|
+
const result = { string, containsKeys };
|
|
27
|
+
if (string !== undefined) {
|
|
28
|
+
if (manifest === undefined) {
|
|
29
|
+
// manifest = getOptionValue('--experimental-policy') ?
|
|
30
|
+
// require('internal/process/policy').manifest :
|
|
31
|
+
// null;
|
|
32
|
+
// disabled for now. I am not sure if/how we should support this
|
|
33
|
+
manifest = null;
|
|
34
|
+
}
|
|
35
|
+
if (manifest !== null) {
|
|
36
|
+
const jsonURL = pathToFileURL(jsonPath);
|
|
37
|
+
manifest.assertIntegrity(jsonURL, string);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
cache.set(jsonPath, result);
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = { read };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// copied from https://github.com/nodejs/node/blob/88799930794045795e8abac874730f9eba7e2300/lib/internal/repl/await.js
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
ArrayFrom,
|
|
6
|
+
ArrayPrototypeForEach,
|
|
7
|
+
ArrayPrototypeIncludes,
|
|
8
|
+
ArrayPrototypeJoin,
|
|
9
|
+
ArrayPrototypePop,
|
|
10
|
+
ArrayPrototypePush,
|
|
11
|
+
FunctionPrototype,
|
|
12
|
+
ObjectKeys,
|
|
13
|
+
RegExpPrototypeSymbolReplace,
|
|
14
|
+
StringPrototypeEndsWith,
|
|
15
|
+
StringPrototypeIncludes,
|
|
16
|
+
StringPrototypeIndexOf,
|
|
17
|
+
StringPrototypeRepeat,
|
|
18
|
+
StringPrototypeSplit,
|
|
19
|
+
StringPrototypeStartsWith,
|
|
20
|
+
SyntaxError,
|
|
21
|
+
} = require('./node-primordials');
|
|
22
|
+
|
|
23
|
+
const parser = require('acorn').Parser;
|
|
24
|
+
const walk = require('acorn-walk');
|
|
25
|
+
const { Recoverable } = require('repl');
|
|
26
|
+
|
|
27
|
+
function isTopLevelDeclaration(state) {
|
|
28
|
+
return state.ancestors[state.ancestors.length - 2] === state.body;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const noop = FunctionPrototype;
|
|
32
|
+
const visitorsWithoutAncestors = {
|
|
33
|
+
ClassDeclaration(node, state, c) {
|
|
34
|
+
if (isTopLevelDeclaration(state)) {
|
|
35
|
+
state.prepend(node, `${node.id.name}=`);
|
|
36
|
+
ArrayPrototypePush(
|
|
37
|
+
state.hoistedDeclarationStatements,
|
|
38
|
+
`let ${node.id.name}; `
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
walk.base.ClassDeclaration(node, state, c);
|
|
43
|
+
},
|
|
44
|
+
ForOfStatement(node, state, c) {
|
|
45
|
+
if (node.await === true) {
|
|
46
|
+
state.containsAwait = true;
|
|
47
|
+
}
|
|
48
|
+
walk.base.ForOfStatement(node, state, c);
|
|
49
|
+
},
|
|
50
|
+
FunctionDeclaration(node, state, c) {
|
|
51
|
+
state.prepend(node, `${node.id.name}=`);
|
|
52
|
+
ArrayPrototypePush(
|
|
53
|
+
state.hoistedDeclarationStatements,
|
|
54
|
+
`var ${node.id.name}; `
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
FunctionExpression: noop,
|
|
58
|
+
ArrowFunctionExpression: noop,
|
|
59
|
+
MethodDefinition: noop,
|
|
60
|
+
AwaitExpression(node, state, c) {
|
|
61
|
+
state.containsAwait = true;
|
|
62
|
+
walk.base.AwaitExpression(node, state, c);
|
|
63
|
+
},
|
|
64
|
+
ReturnStatement(node, state, c) {
|
|
65
|
+
state.containsReturn = true;
|
|
66
|
+
walk.base.ReturnStatement(node, state, c);
|
|
67
|
+
},
|
|
68
|
+
VariableDeclaration(node, state, c) {
|
|
69
|
+
const variableKind = node.kind;
|
|
70
|
+
const isIterableForDeclaration = ArrayPrototypeIncludes(
|
|
71
|
+
['ForOfStatement', 'ForInStatement'],
|
|
72
|
+
state.ancestors[state.ancestors.length - 2].type
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (variableKind === 'var' || isTopLevelDeclaration(state)) {
|
|
76
|
+
state.replace(
|
|
77
|
+
node.start,
|
|
78
|
+
node.start + variableKind.length + (isIterableForDeclaration ? 1 : 0),
|
|
79
|
+
variableKind === 'var' && isIterableForDeclaration ?
|
|
80
|
+
'' :
|
|
81
|
+
'void' + (node.declarations.length === 1 ? '' : ' (')
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
if (!isIterableForDeclaration) {
|
|
85
|
+
ArrayPrototypeForEach(node.declarations, (decl) => {
|
|
86
|
+
state.prepend(decl, '(');
|
|
87
|
+
state.append(decl, decl.init ? ')' : '=undefined)');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (node.declarations.length !== 1) {
|
|
91
|
+
state.append(node.declarations[node.declarations.length - 1], ')');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const variableIdentifiersToHoist = [
|
|
96
|
+
['var', []],
|
|
97
|
+
['let', []],
|
|
98
|
+
];
|
|
99
|
+
function registerVariableDeclarationIdentifiers(node) {
|
|
100
|
+
switch (node.type) {
|
|
101
|
+
case 'Identifier':
|
|
102
|
+
ArrayPrototypePush(
|
|
103
|
+
variableIdentifiersToHoist[variableKind === 'var' ? 0 : 1][1],
|
|
104
|
+
node.name
|
|
105
|
+
);
|
|
106
|
+
break;
|
|
107
|
+
case 'ObjectPattern':
|
|
108
|
+
ArrayPrototypeForEach(node.properties, (property) => {
|
|
109
|
+
registerVariableDeclarationIdentifiers(property.value);
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
case 'ArrayPattern':
|
|
113
|
+
ArrayPrototypeForEach(node.elements, (element) => {
|
|
114
|
+
registerVariableDeclarationIdentifiers(element);
|
|
115
|
+
});
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
ArrayPrototypeForEach(node.declarations, (decl) => {
|
|
121
|
+
registerVariableDeclarationIdentifiers(decl.id);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
ArrayPrototypeForEach(
|
|
125
|
+
variableIdentifiersToHoist,
|
|
126
|
+
({ 0: kind, 1: identifiers }) => {
|
|
127
|
+
if (identifiers.length > 0) {
|
|
128
|
+
ArrayPrototypePush(
|
|
129
|
+
state.hoistedDeclarationStatements,
|
|
130
|
+
`${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; `
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
walk.base.VariableDeclaration(node, state, c);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const visitors = {};
|
|
142
|
+
for (const nodeType of ObjectKeys(walk.base)) {
|
|
143
|
+
const callback = visitorsWithoutAncestors[nodeType] || walk.base[nodeType];
|
|
144
|
+
visitors[nodeType] = (node, state, c) => {
|
|
145
|
+
const isNew = node !== state.ancestors[state.ancestors.length - 1];
|
|
146
|
+
if (isNew) {
|
|
147
|
+
ArrayPrototypePush(state.ancestors, node);
|
|
148
|
+
}
|
|
149
|
+
callback(node, state, c);
|
|
150
|
+
if (isNew) {
|
|
151
|
+
ArrayPrototypePop(state.ancestors);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function processTopLevelAwait(src) {
|
|
157
|
+
const wrapPrefix = '(async () => { ';
|
|
158
|
+
const wrapped = `${wrapPrefix}${src} })()`;
|
|
159
|
+
const wrappedArray = ArrayFrom(wrapped);
|
|
160
|
+
let root;
|
|
161
|
+
try {
|
|
162
|
+
root = parser.parse(wrapped, { ecmaVersion: 'latest' });
|
|
163
|
+
} catch (e) {
|
|
164
|
+
if (StringPrototypeStartsWith(e.message, 'Unterminated '))
|
|
165
|
+
throw new Recoverable(e);
|
|
166
|
+
// If the parse error is before the first "await", then use the execution
|
|
167
|
+
// error. Otherwise we must emit this parse error, making it look like a
|
|
168
|
+
// proper syntax error.
|
|
169
|
+
const awaitPos = StringPrototypeIndexOf(src, 'await');
|
|
170
|
+
const errPos = e.pos - wrapPrefix.length;
|
|
171
|
+
if (awaitPos > errPos)
|
|
172
|
+
return null;
|
|
173
|
+
// Convert keyword parse errors on await into their original errors when
|
|
174
|
+
// possible.
|
|
175
|
+
if (errPos === awaitPos + 6 &&
|
|
176
|
+
StringPrototypeIncludes(e.message, 'Expecting Unicode escape sequence'))
|
|
177
|
+
return null;
|
|
178
|
+
if (errPos === awaitPos + 7 &&
|
|
179
|
+
StringPrototypeIncludes(e.message, 'Unexpected token'))
|
|
180
|
+
return null;
|
|
181
|
+
const line = e.loc.line;
|
|
182
|
+
const column = line === 1 ? e.loc.column - wrapPrefix.length : e.loc.column;
|
|
183
|
+
let message = '\n' + StringPrototypeSplit(src, '\n')[line - 1] + '\n' +
|
|
184
|
+
StringPrototypeRepeat(' ', column) +
|
|
185
|
+
'^\n\n' + RegExpPrototypeSymbolReplace(/ \([^)]+\)/, e.message, '');
|
|
186
|
+
// V8 unexpected token errors include the token string.
|
|
187
|
+
if (StringPrototypeEndsWith(message, 'Unexpected token'))
|
|
188
|
+
message += " '" +
|
|
189
|
+
// Wrapper end may cause acorn to report error position after the source
|
|
190
|
+
((src.length - 1) >= (e.pos - wrapPrefix.length)
|
|
191
|
+
? src[e.pos - wrapPrefix.length]
|
|
192
|
+
: src[src.length - 1]) +
|
|
193
|
+
"'";
|
|
194
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
195
|
+
throw new SyntaxError(message);
|
|
196
|
+
}
|
|
197
|
+
const body = root.body[0].expression.callee.body;
|
|
198
|
+
const state = {
|
|
199
|
+
body,
|
|
200
|
+
ancestors: [],
|
|
201
|
+
hoistedDeclarationStatements: [],
|
|
202
|
+
replace(from, to, str) {
|
|
203
|
+
for (let i = from; i < to; i++) {
|
|
204
|
+
wrappedArray[i] = '';
|
|
205
|
+
}
|
|
206
|
+
if (from === to) str += wrappedArray[from];
|
|
207
|
+
wrappedArray[from] = str;
|
|
208
|
+
},
|
|
209
|
+
prepend(node, str) {
|
|
210
|
+
wrappedArray[node.start] = str + wrappedArray[node.start];
|
|
211
|
+
},
|
|
212
|
+
append(node, str) {
|
|
213
|
+
wrappedArray[node.end - 1] += str;
|
|
214
|
+
},
|
|
215
|
+
containsAwait: false,
|
|
216
|
+
containsReturn: false
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
walk.recursive(body, state, visitors);
|
|
220
|
+
|
|
221
|
+
// Do not transform if
|
|
222
|
+
// 1. False alarm: there isn't actually an await expression.
|
|
223
|
+
// 2. There is a top-level return, which is not allowed.
|
|
224
|
+
if (!state.containsAwait || state.containsReturn) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const last = body.body[body.body.length - 1];
|
|
229
|
+
if (last.type === 'ExpressionStatement') {
|
|
230
|
+
// For an expression statement of the form
|
|
231
|
+
// ( expr ) ;
|
|
232
|
+
// ^^^^^^^^^^ // last
|
|
233
|
+
// ^^^^ // last.expression
|
|
234
|
+
//
|
|
235
|
+
// We do not want the left parenthesis before the `return` keyword;
|
|
236
|
+
// therefore we prepend the `return (` to `last`.
|
|
237
|
+
//
|
|
238
|
+
// On the other hand, we do not want the right parenthesis after the
|
|
239
|
+
// semicolon. Since there can only be more right parentheses between
|
|
240
|
+
// last.expression.end and the semicolon, appending one more to
|
|
241
|
+
// last.expression should be fine.
|
|
242
|
+
state.prepend(last, 'return (');
|
|
243
|
+
state.append(last.expression, ')');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
ArrayPrototypeJoin(state.hoistedDeclarationStatements, '') +
|
|
248
|
+
ArrayPrototypeJoin(wrappedArray, '')
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
module.exports = {
|
|
253
|
+
processTopLevelAwait
|
|
254
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const {versionGteLt} = require('../dist/util');
|
|
3
|
+
|
|
4
|
+
// In node's core, this is implemented in C
|
|
5
|
+
// https://github.com/nodejs/node/blob/v15.3.0/src/node_file.cc#L891-L985
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} path
|
|
8
|
+
* @returns {[] | [string, boolean]}
|
|
9
|
+
*/
|
|
10
|
+
function internalModuleReadJSON(path) {
|
|
11
|
+
let string
|
|
12
|
+
try {
|
|
13
|
+
string = fs.readFileSync(path, 'utf8')
|
|
14
|
+
} catch (e) {
|
|
15
|
+
if (e.code === 'ENOENT') return []
|
|
16
|
+
throw e
|
|
17
|
+
}
|
|
18
|
+
// Node's implementation checks for the presence of relevant keys: main, name, type, exports, imports
|
|
19
|
+
// Node does this for performance to skip unnecessary parsing.
|
|
20
|
+
// This would slow us down and, based on our usage, we can skip it.
|
|
21
|
+
const containsKeys = true
|
|
22
|
+
return [string, containsKeys]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// In node's core, this is implemented in C
|
|
26
|
+
// https://github.com/nodejs/node/blob/63e7dc1e5c71b70c80ed9eda230991edb00811e2/src/node_file.cc#L987-L1005
|
|
27
|
+
/**
|
|
28
|
+
* @param {string} path
|
|
29
|
+
* @returns {number} 0 = file, 1 = dir, negative = error
|
|
30
|
+
*/
|
|
31
|
+
function internalModuleStat(path) {
|
|
32
|
+
const stat = fs.statSync(path, { throwIfNoEntry: false });
|
|
33
|
+
if(!stat) return -1;
|
|
34
|
+
if(stat.isFile()) return 0;
|
|
35
|
+
if(stat.isDirectory()) return 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} path
|
|
40
|
+
* @returns {number} 0 = file, 1 = dir, negative = error
|
|
41
|
+
*/
|
|
42
|
+
function internalModuleStatInefficient(path) {
|
|
43
|
+
try {
|
|
44
|
+
const stat = fs.statSync(path);
|
|
45
|
+
if(stat.isFile()) return 0;
|
|
46
|
+
if(stat.isDirectory()) return 1;
|
|
47
|
+
} catch(e) {
|
|
48
|
+
return -e.errno || -1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const statSupportsThrowIfNoEntry = versionGteLt(process.versions.node, '15.3.0') ||
|
|
53
|
+
versionGteLt(process.versions.node, '14.17.0', '15.0.0');
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
internalModuleReadJSON,
|
|
57
|
+
internalModuleStat: statSupportsThrowIfNoEntry ? internalModuleStat : internalModuleStatInefficient
|
|
58
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Replacement for node's internal 'internal/options' module
|
|
2
|
+
|
|
3
|
+
exports.getOptionValue = getOptionValue;
|
|
4
|
+
function getOptionValue(opt) {
|
|
5
|
+
parseOptions();
|
|
6
|
+
return options[opt];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let options;
|
|
10
|
+
function parseOptions() {
|
|
11
|
+
if (!options) {
|
|
12
|
+
options = {
|
|
13
|
+
'--preserve-symlinks': false,
|
|
14
|
+
'--preserve-symlinks-main': false,
|
|
15
|
+
'--input-type': undefined,
|
|
16
|
+
'--experimental-specifier-resolution': 'explicit',
|
|
17
|
+
'--experimental-policy': undefined,
|
|
18
|
+
'--conditions': [],
|
|
19
|
+
'--pending-deprecation': false,
|
|
20
|
+
...parseArgv(getNodeOptionsEnvArgv()),
|
|
21
|
+
...parseArgv(process.execArgv),
|
|
22
|
+
...getOptionValuesFromOtherEnvVars()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function parseArgv(argv) {
|
|
28
|
+
return require('arg')({
|
|
29
|
+
'--preserve-symlinks': Boolean,
|
|
30
|
+
'--preserve-symlinks-main': Boolean,
|
|
31
|
+
'--input-type': String,
|
|
32
|
+
'--experimental-specifier-resolution': String,
|
|
33
|
+
// Legacy alias for node versions prior to 12.16
|
|
34
|
+
'--es-module-specifier-resolution': '--experimental-specifier-resolution',
|
|
35
|
+
'--experimental-policy': String,
|
|
36
|
+
'--conditions': [String],
|
|
37
|
+
'--pending-deprecation': Boolean,
|
|
38
|
+
'--experimental-json-modules': Boolean,
|
|
39
|
+
'--experimental-wasm-modules': Boolean,
|
|
40
|
+
}, {
|
|
41
|
+
argv,
|
|
42
|
+
permissive: true
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getNodeOptionsEnvArgv() {
|
|
47
|
+
const errors = [];
|
|
48
|
+
const envArgv = ParseNodeOptionsEnvVar(process.env.NODE_OPTIONS || '', errors);
|
|
49
|
+
if (errors.length !== 0) {
|
|
50
|
+
// TODO: handle errors somehow
|
|
51
|
+
}
|
|
52
|
+
return envArgv;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Direct JS port of C implementation: https://github.com/nodejs/node/blob/67ba825037b4082d5d16f922fb9ce54516b4a869/src/node_options.cc#L1024-L1063
|
|
56
|
+
function ParseNodeOptionsEnvVar(node_options, errors) {
|
|
57
|
+
const env_argv = [];
|
|
58
|
+
|
|
59
|
+
let is_in_string = false;
|
|
60
|
+
let will_start_new_arg = true;
|
|
61
|
+
for (let index = 0; index < node_options.length; ++index) {
|
|
62
|
+
let c = node_options[index];
|
|
63
|
+
|
|
64
|
+
// Backslashes escape the following character
|
|
65
|
+
if (c === '\\' && is_in_string) {
|
|
66
|
+
if (index + 1 === node_options.length) {
|
|
67
|
+
errors.push("invalid value for NODE_OPTIONS " +
|
|
68
|
+
"(invalid escape)\n");
|
|
69
|
+
return env_argv;
|
|
70
|
+
} else {
|
|
71
|
+
c = node_options[++index];
|
|
72
|
+
}
|
|
73
|
+
} else if (c === ' ' && !is_in_string) {
|
|
74
|
+
will_start_new_arg = true;
|
|
75
|
+
continue;
|
|
76
|
+
} else if (c === '"') {
|
|
77
|
+
is_in_string = !is_in_string;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (will_start_new_arg) {
|
|
82
|
+
env_argv.push(c);
|
|
83
|
+
will_start_new_arg = false;
|
|
84
|
+
} else {
|
|
85
|
+
env_argv[env_argv.length - 1] += c;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (is_in_string) {
|
|
90
|
+
errors.push("invalid value for NODE_OPTIONS " +
|
|
91
|
+
"(unterminated string)\n");
|
|
92
|
+
}
|
|
93
|
+
return env_argv;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Get option values that can be specified via env vars besides NODE_OPTIONS
|
|
97
|
+
function getOptionValuesFromOtherEnvVars() {
|
|
98
|
+
const options = {};
|
|
99
|
+
if(process.env.NODE_PENDING_DEPRECATION === '1') {
|
|
100
|
+
options['--pending-deprecation'] = true;
|
|
101
|
+
}
|
|
102
|
+
return options;
|
|
103
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
ArrayFrom: Array.from,
|
|
3
|
+
ArrayIsArray: Array.isArray,
|
|
4
|
+
ArrayPrototypeShift: (obj) => Array.prototype.shift.call(obj),
|
|
5
|
+
ArrayPrototypeForEach: (arr, ...rest) => Array.prototype.forEach.apply(arr, rest),
|
|
6
|
+
ArrayPrototypeIncludes: (arr, ...rest) => Array.prototype.includes.apply(arr, rest),
|
|
7
|
+
ArrayPrototypeJoin: (arr, ...rest) => Array.prototype.join.apply(arr, rest),
|
|
8
|
+
ArrayPrototypePop: (arr, ...rest) => Array.prototype.pop.apply(arr, rest),
|
|
9
|
+
ArrayPrototypePush: (arr, ...rest) => Array.prototype.push.apply(arr, rest),
|
|
10
|
+
FunctionPrototype: Function.prototype,
|
|
11
|
+
JSONParse: JSON.parse,
|
|
12
|
+
JSONStringify: JSON.stringify,
|
|
13
|
+
ObjectFreeze: Object.freeze,
|
|
14
|
+
ObjectKeys: Object.keys,
|
|
15
|
+
ObjectGetOwnPropertyNames: Object.getOwnPropertyNames,
|
|
16
|
+
ObjectDefineProperty: Object.defineProperty,
|
|
17
|
+
ObjectPrototypeHasOwnProperty: (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop),
|
|
18
|
+
RegExpPrototypeExec: (obj, string) => RegExp.prototype.exec.call(obj, string),
|
|
19
|
+
RegExpPrototypeTest: (obj, string) => RegExp.prototype.test.call(obj, string),
|
|
20
|
+
RegExpPrototypeSymbolReplace: (obj, ...rest) => RegExp.prototype[Symbol.replace].apply(obj, rest),
|
|
21
|
+
SafeMap: Map,
|
|
22
|
+
SafeSet: Set,
|
|
23
|
+
SafeWeakMap: WeakMap,
|
|
24
|
+
StringPrototypeEndsWith: (str, ...rest) => String.prototype.endsWith.apply(str, rest),
|
|
25
|
+
StringPrototypeIncludes: (str, ...rest) => String.prototype.includes.apply(str, rest),
|
|
26
|
+
StringPrototypeLastIndexOf: (str, ...rest) => String.prototype.lastIndexOf.apply(str, rest),
|
|
27
|
+
StringPrototypeIndexOf: (str, ...rest) => String.prototype.indexOf.apply(str, rest),
|
|
28
|
+
StringPrototypeRepeat: (str, ...rest) => String.prototype.repeat.apply(str, rest),
|
|
29
|
+
StringPrototypeReplace: (str, ...rest) => String.prototype.replace.apply(str, rest),
|
|
30
|
+
StringPrototypeSlice: (str, ...rest) => String.prototype.slice.apply(str, rest),
|
|
31
|
+
StringPrototypeSplit: (str, ...rest) => String.prototype.split.apply(str, rest),
|
|
32
|
+
StringPrototypeStartsWith: (str, ...rest) => String.prototype.startsWith.apply(str, rest),
|
|
33
|
+
StringPrototypeSubstr: (str, ...rest) => String.prototype.substr.apply(str, rest),
|
|
34
|
+
StringPrototypeCharCodeAt: (str, ...rest) => String.prototype.charCodeAt.apply(str, rest),
|
|
35
|
+
StringPrototypeMatch: (str, ...rest) => String.prototype.match.apply(str, rest),
|
|
36
|
+
SyntaxError: SyntaxError
|
|
37
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const {pathToFileURL} = require('url');
|
|
2
|
+
|
|
3
|
+
// Hack to avoid Module.runMain on node 18.6.0
|
|
4
|
+
// Keeping it simple for now, isolated in this file.
|
|
5
|
+
// Could theoretically probe `getFormat` impl to determine if `import()` or `Module._load()` is best
|
|
6
|
+
// Note that I attempted a try-catch around `Module._load`, but it poisons some sort of cache such that subsequent `import()` is impossible.
|
|
7
|
+
exports.run = function(entryPointPath) {
|
|
8
|
+
import(pathToFileURL(entryPointPath));
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
const require = createRequire(fileURLToPath(import.meta.url));
|
|
4
|
+
|
|
5
|
+
/** @type {import('../dist/esm')} */
|
|
6
|
+
const esm = require('../dist/esm');
|
|
7
|
+
export const { resolve, load, getFormat, transformSource } =
|
|
8
|
+
esm.registerAndCreateEsmHooks({ transpileOnly: true });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
const require = createRequire(fileURLToPath(import.meta.url));
|
|
4
|
+
|
|
5
|
+
/** @type {import('./dist/esm')} */
|
|
6
|
+
const esm = require('./dist/esm');
|
|
7
|
+
export const { resolve, load, getFormat, transformSource } =
|
|
8
|
+
esm.registerAndCreateEsmHooks();
|