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
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEmitScriptTarget = exports.getUseDefineForClassFields = exports.getPatternFromSpec = exports.createTsInternals = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const util_1 = require("./util");
|
|
6
|
+
/** @internal */
|
|
7
|
+
exports.createTsInternals = (0, util_1.cachedLookup)(createTsInternalsUncached);
|
|
8
|
+
/**
|
|
9
|
+
* Given a reference to the TS compiler, return some TS internal functions that we
|
|
10
|
+
* could not or did not want to grab off the `ts` object.
|
|
11
|
+
* These have been copy-pasted from TS's source and tweaked as necessary.
|
|
12
|
+
*
|
|
13
|
+
* NOTE: This factory returns *only* functions which need a reference to the TS
|
|
14
|
+
* compiler. Other functions do not need a reference to the TS compiler so are
|
|
15
|
+
* exported directly from this file.
|
|
16
|
+
*/
|
|
17
|
+
function createTsInternalsUncached(_ts) {
|
|
18
|
+
const ts = _ts;
|
|
19
|
+
/**
|
|
20
|
+
* Copied from:
|
|
21
|
+
* https://github.com/microsoft/TypeScript/blob/v4.3.2/src/compiler/commandLineParser.ts#L2821-L2846
|
|
22
|
+
*/
|
|
23
|
+
function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) {
|
|
24
|
+
extendedConfig = (0, util_1.normalizeSlashes)(extendedConfig);
|
|
25
|
+
if (isRootedDiskPath(extendedConfig) ||
|
|
26
|
+
startsWith(extendedConfig, './') ||
|
|
27
|
+
startsWith(extendedConfig, '../')) {
|
|
28
|
+
let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
|
|
29
|
+
if (!host.fileExists(extendedConfigPath) &&
|
|
30
|
+
!endsWith(extendedConfigPath, ts.Extension.Json)) {
|
|
31
|
+
extendedConfigPath = `${extendedConfigPath}.json`;
|
|
32
|
+
if (!host.fileExists(extendedConfigPath)) {
|
|
33
|
+
errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return extendedConfigPath;
|
|
38
|
+
}
|
|
39
|
+
// If the path isn't a rooted or relative path, resolve like a module
|
|
40
|
+
const tsGte5_3_0 = (0, util_1.versionGteLt)(ts.version, '5.3.0');
|
|
41
|
+
const resolved = ts.nodeModuleNameResolver(extendedConfig, combinePaths(basePath, 'tsconfig.json'), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host,
|
|
42
|
+
/*cache*/ undefined,
|
|
43
|
+
/*projectRefs*/ undefined,
|
|
44
|
+
/*conditionsOrIsConfigLookup*/ tsGte5_3_0 ? undefined : true,
|
|
45
|
+
/*isConfigLookup*/ tsGte5_3_0 ? true : undefined);
|
|
46
|
+
if (resolved.resolvedModule) {
|
|
47
|
+
return resolved.resolvedModule.resolvedFileName;
|
|
48
|
+
}
|
|
49
|
+
errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return { getExtendsConfigPath };
|
|
53
|
+
}
|
|
54
|
+
// These functions have alternative implementation to avoid copying too much from TS
|
|
55
|
+
function isRootedDiskPath(path) {
|
|
56
|
+
return (0, path_1.isAbsolute)(path);
|
|
57
|
+
}
|
|
58
|
+
function combinePaths(path, ...paths) {
|
|
59
|
+
return (0, util_1.normalizeSlashes)((0, path_1.resolve)(path, ...paths.filter((path) => path)));
|
|
60
|
+
}
|
|
61
|
+
function getNormalizedAbsolutePath(fileName, currentDirectory) {
|
|
62
|
+
return (0, util_1.normalizeSlashes)(currentDirectory != null
|
|
63
|
+
? (0, path_1.resolve)(currentDirectory, fileName)
|
|
64
|
+
: (0, path_1.resolve)(fileName));
|
|
65
|
+
}
|
|
66
|
+
function startsWith(str, prefix) {
|
|
67
|
+
return str.lastIndexOf(prefix, 0) === 0;
|
|
68
|
+
}
|
|
69
|
+
function endsWith(str, suffix) {
|
|
70
|
+
const expectedPos = str.length - suffix.length;
|
|
71
|
+
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
|
72
|
+
}
|
|
73
|
+
// Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.
|
|
74
|
+
// It may be inefficient (we could just match (/[-[\]{}()*+?.,\\^$|#\s]/g), but this is future
|
|
75
|
+
// proof.
|
|
76
|
+
const reservedCharacterPattern = /[^\w\s\/]/g;
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
* See also: getRegularExpressionForWildcard, which seems to do almost the same thing
|
|
80
|
+
*/
|
|
81
|
+
function getPatternFromSpec(spec, basePath) {
|
|
82
|
+
const pattern = spec && getSubPatternFromSpec(spec, basePath, excludeMatcher);
|
|
83
|
+
return pattern && `^(${pattern})${'($|/)'}`;
|
|
84
|
+
}
|
|
85
|
+
exports.getPatternFromSpec = getPatternFromSpec;
|
|
86
|
+
function getSubPatternFromSpec(spec, basePath, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter, }) {
|
|
87
|
+
let subpattern = '';
|
|
88
|
+
let hasWrittenComponent = false;
|
|
89
|
+
const components = getNormalizedPathComponents(spec, basePath);
|
|
90
|
+
const lastComponent = last(components);
|
|
91
|
+
// getNormalizedPathComponents includes the separator for the root component.
|
|
92
|
+
// We need to remove to create our regex correctly.
|
|
93
|
+
components[0] = removeTrailingDirectorySeparator(components[0]);
|
|
94
|
+
if (isImplicitGlob(lastComponent)) {
|
|
95
|
+
components.push('**', '*');
|
|
96
|
+
}
|
|
97
|
+
let optionalCount = 0;
|
|
98
|
+
for (let component of components) {
|
|
99
|
+
if (component === '**') {
|
|
100
|
+
subpattern += doubleAsteriskRegexFragment;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
if (hasWrittenComponent) {
|
|
104
|
+
subpattern += directorySeparator;
|
|
105
|
+
}
|
|
106
|
+
subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
|
|
107
|
+
}
|
|
108
|
+
hasWrittenComponent = true;
|
|
109
|
+
}
|
|
110
|
+
while (optionalCount > 0) {
|
|
111
|
+
subpattern += ')?';
|
|
112
|
+
optionalCount--;
|
|
113
|
+
}
|
|
114
|
+
return subpattern;
|
|
115
|
+
}
|
|
116
|
+
const directoriesMatcher = {
|
|
117
|
+
singleAsteriskRegexFragment: '[^/]*',
|
|
118
|
+
/**
|
|
119
|
+
* Regex for the ** wildcard. Matches any num of subdirectories. When used for including
|
|
120
|
+
* files or directories, does not match subdirectories that start with a . character
|
|
121
|
+
*/
|
|
122
|
+
doubleAsteriskRegexFragment: `(/[^/.][^/]*)*?`,
|
|
123
|
+
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment),
|
|
124
|
+
};
|
|
125
|
+
const excludeMatcher = {
|
|
126
|
+
singleAsteriskRegexFragment: '[^/]*',
|
|
127
|
+
doubleAsteriskRegexFragment: '(/.+?)?',
|
|
128
|
+
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment),
|
|
129
|
+
};
|
|
130
|
+
function getNormalizedPathComponents(path, currentDirectory) {
|
|
131
|
+
return reducePathComponents(getPathComponents(path, currentDirectory));
|
|
132
|
+
}
|
|
133
|
+
function getPathComponents(path, currentDirectory = '') {
|
|
134
|
+
path = combinePaths(currentDirectory, path);
|
|
135
|
+
return pathComponents(path, getRootLength(path));
|
|
136
|
+
}
|
|
137
|
+
function reducePathComponents(components) {
|
|
138
|
+
if (!some(components))
|
|
139
|
+
return [];
|
|
140
|
+
const reduced = [components[0]];
|
|
141
|
+
for (let i = 1; i < components.length; i++) {
|
|
142
|
+
const component = components[i];
|
|
143
|
+
if (!component)
|
|
144
|
+
continue;
|
|
145
|
+
if (component === '.')
|
|
146
|
+
continue;
|
|
147
|
+
if (component === '..') {
|
|
148
|
+
if (reduced.length > 1) {
|
|
149
|
+
if (reduced[reduced.length - 1] !== '..') {
|
|
150
|
+
reduced.pop();
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if (reduced[0])
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
reduced.push(component);
|
|
158
|
+
}
|
|
159
|
+
return reduced;
|
|
160
|
+
}
|
|
161
|
+
function getRootLength(path) {
|
|
162
|
+
const rootLength = getEncodedRootLength(path);
|
|
163
|
+
return rootLength < 0 ? ~rootLength : rootLength;
|
|
164
|
+
}
|
|
165
|
+
function getEncodedRootLength(path) {
|
|
166
|
+
if (!path)
|
|
167
|
+
return 0;
|
|
168
|
+
const ch0 = path.charCodeAt(0);
|
|
169
|
+
// POSIX or UNC
|
|
170
|
+
if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
|
|
171
|
+
if (path.charCodeAt(1) !== ch0)
|
|
172
|
+
return 1; // POSIX: "/" (or non-normalized "\")
|
|
173
|
+
const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? directorySeparator : altDirectorySeparator, 2);
|
|
174
|
+
if (p1 < 0)
|
|
175
|
+
return path.length; // UNC: "//server" or "\\server"
|
|
176
|
+
return p1 + 1; // UNC: "//server/" or "\\server\"
|
|
177
|
+
}
|
|
178
|
+
// DOS
|
|
179
|
+
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
|
|
180
|
+
const ch2 = path.charCodeAt(2);
|
|
181
|
+
if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
|
|
182
|
+
return 3; // DOS: "c:/" or "c:\"
|
|
183
|
+
if (path.length === 2)
|
|
184
|
+
return 2; // DOS: "c:" (but not "c:d")
|
|
185
|
+
}
|
|
186
|
+
// URL
|
|
187
|
+
const schemeEnd = path.indexOf(urlSchemeSeparator);
|
|
188
|
+
if (schemeEnd !== -1) {
|
|
189
|
+
const authorityStart = schemeEnd + urlSchemeSeparator.length;
|
|
190
|
+
const authorityEnd = path.indexOf(directorySeparator, authorityStart);
|
|
191
|
+
if (authorityEnd !== -1) {
|
|
192
|
+
// URL: "file:///", "file://server/", "file://server/path"
|
|
193
|
+
// For local "file" URLs, include the leading DOS volume (if present).
|
|
194
|
+
// Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a
|
|
195
|
+
// special case interpreted as "the machine from which the URL is being interpreted".
|
|
196
|
+
const scheme = path.slice(0, schemeEnd);
|
|
197
|
+
const authority = path.slice(authorityStart, authorityEnd);
|
|
198
|
+
if (scheme === 'file' &&
|
|
199
|
+
(authority === '' || authority === 'localhost') &&
|
|
200
|
+
isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
|
|
201
|
+
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
|
|
202
|
+
if (volumeSeparatorEnd !== -1) {
|
|
203
|
+
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
|
|
204
|
+
// URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
|
|
205
|
+
return ~(volumeSeparatorEnd + 1);
|
|
206
|
+
}
|
|
207
|
+
if (volumeSeparatorEnd === path.length) {
|
|
208
|
+
// URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a"
|
|
209
|
+
// but not "file:///c:d" or "file:///c%3ad"
|
|
210
|
+
return ~volumeSeparatorEnd;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return ~(authorityEnd + 1); // URL: "file://server/", "http://server/"
|
|
215
|
+
}
|
|
216
|
+
return ~path.length; // URL: "file://server", "http://server"
|
|
217
|
+
}
|
|
218
|
+
// relative
|
|
219
|
+
return 0;
|
|
220
|
+
}
|
|
221
|
+
function ensureTrailingDirectorySeparator(path) {
|
|
222
|
+
if (!hasTrailingDirectorySeparator(path)) {
|
|
223
|
+
return path + directorySeparator;
|
|
224
|
+
}
|
|
225
|
+
return path;
|
|
226
|
+
}
|
|
227
|
+
function hasTrailingDirectorySeparator(path) {
|
|
228
|
+
return (path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1)));
|
|
229
|
+
}
|
|
230
|
+
function isAnyDirectorySeparator(charCode) {
|
|
231
|
+
return (charCode === 47 /* CharacterCodes.slash */ || charCode === 92 /* CharacterCodes.backslash */);
|
|
232
|
+
}
|
|
233
|
+
function removeTrailingDirectorySeparator(path) {
|
|
234
|
+
if (hasTrailingDirectorySeparator(path)) {
|
|
235
|
+
return path.substr(0, path.length - 1);
|
|
236
|
+
}
|
|
237
|
+
return path;
|
|
238
|
+
}
|
|
239
|
+
const directorySeparator = '/';
|
|
240
|
+
const altDirectorySeparator = '\\';
|
|
241
|
+
const urlSchemeSeparator = '://';
|
|
242
|
+
function isVolumeCharacter(charCode) {
|
|
243
|
+
return ((charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
|
|
244
|
+
(charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */));
|
|
245
|
+
}
|
|
246
|
+
function getFileUrlVolumeSeparatorEnd(url, start) {
|
|
247
|
+
const ch0 = url.charCodeAt(start);
|
|
248
|
+
if (ch0 === 58 /* CharacterCodes.colon */)
|
|
249
|
+
return start + 1;
|
|
250
|
+
if (ch0 === 37 /* CharacterCodes.percent */ &&
|
|
251
|
+
url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
|
|
252
|
+
const ch2 = url.charCodeAt(start + 2);
|
|
253
|
+
if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
|
|
254
|
+
return start + 3;
|
|
255
|
+
}
|
|
256
|
+
return -1;
|
|
257
|
+
}
|
|
258
|
+
function some(array, predicate) {
|
|
259
|
+
if (array) {
|
|
260
|
+
if (predicate) {
|
|
261
|
+
for (const v of array) {
|
|
262
|
+
if (predicate(v)) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
return array.length > 0;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
function pathComponents(path, rootLength) {
|
|
274
|
+
const root = path.substring(0, rootLength);
|
|
275
|
+
const rest = path.substring(rootLength).split(directorySeparator);
|
|
276
|
+
if (rest.length && !lastOrUndefined(rest))
|
|
277
|
+
rest.pop();
|
|
278
|
+
return [root, ...rest];
|
|
279
|
+
}
|
|
280
|
+
function lastOrUndefined(array) {
|
|
281
|
+
return array.length === 0 ? undefined : array[array.length - 1];
|
|
282
|
+
}
|
|
283
|
+
function last(array) {
|
|
284
|
+
// Debug.assert(array.length !== 0);
|
|
285
|
+
return array[array.length - 1];
|
|
286
|
+
}
|
|
287
|
+
function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
|
|
288
|
+
return match === '*'
|
|
289
|
+
? singleAsteriskRegexFragment
|
|
290
|
+
: match === '?'
|
|
291
|
+
? '[^/]'
|
|
292
|
+
: '\\' + match;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension,
|
|
296
|
+
* and does not contain any glob characters itself.
|
|
297
|
+
*/
|
|
298
|
+
function isImplicitGlob(lastPathComponent) {
|
|
299
|
+
return !/[.*?]/.test(lastPathComponent);
|
|
300
|
+
}
|
|
301
|
+
const ts_ScriptTarget_ES5 = 1;
|
|
302
|
+
const ts_ScriptTarget_ES2022 = 9;
|
|
303
|
+
const ts_ScriptTarget_ESNext = 99;
|
|
304
|
+
const ts_ModuleKind_Node16 = 100;
|
|
305
|
+
const ts_ModuleKind_NodeNext = 199;
|
|
306
|
+
// https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8761
|
|
307
|
+
function getUseDefineForClassFields(compilerOptions) {
|
|
308
|
+
return compilerOptions.useDefineForClassFields === undefined
|
|
309
|
+
? getEmitScriptTarget(compilerOptions) >= ts_ScriptTarget_ES2022
|
|
310
|
+
: compilerOptions.useDefineForClassFields;
|
|
311
|
+
}
|
|
312
|
+
exports.getUseDefineForClassFields = getUseDefineForClassFields;
|
|
313
|
+
// https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8556
|
|
314
|
+
function getEmitScriptTarget(compilerOptions) {
|
|
315
|
+
var _a;
|
|
316
|
+
return ((_a = compilerOptions.target) !== null && _a !== void 0 ? _a : ((compilerOptions.module === ts_ModuleKind_Node16 && ts_ScriptTarget_ES2022) ||
|
|
317
|
+
(compilerOptions.module === ts_ModuleKind_NodeNext && ts_ScriptTarget_ESNext) ||
|
|
318
|
+
ts_ScriptTarget_ES5));
|
|
319
|
+
}
|
|
320
|
+
exports.getEmitScriptTarget = getEmitScriptTarget;
|
|
321
|
+
//# sourceMappingURL=ts-internals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-internals.js","sourceRoot":"","sources":["../src/ts-internals.ts"],"names":[],"mappings":";;;AAAA,+BAA2C;AAC3C,iCAAsE;AAItE,gBAAgB;AACH,QAAA,iBAAiB,GAAG,IAAA,mBAAY,EAAC,yBAAyB,CAAC,CAAC;AACzE;;;;;;;;GAQG;AACH,SAAS,yBAAyB,CAAC,GAAa;IAC9C,MAAM,EAAE,GAAG,GAA4B,CAAC;IACxC;;;OAGG;IACH,SAAS,oBAAoB,CAC3B,cAAsB,EACtB,IAAyB,EACzB,QAAgB,EAChB,MAAgC,EAChC,gBAGmB;QAEnB,cAAc,GAAG,IAAA,uBAAgB,EAAC,cAAc,CAAC,CAAC;QAClD,IACE,gBAAgB,CAAC,cAAc,CAAC;YAChC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC;YAChC,UAAU,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ACpC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC;AACD,SAAS,wBAAwB,CAC/B,KAAa,EACb,2BAAmC;IAEnC,OAAO,KAAK,KAAK,GAAG;QAClB,CAAC,CAAC,2BAA2B;QAC7B,CAAC,CAAC,KAAK,KAAK,GAAG;YACf,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;AACnB,CAAC;AACD;;;GAGG;AACH,SAAS,cAAc,CAAC,iBAAyB;IAC/C,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,wHAAwH;AACxH,SAAgB,0BAA0B,CAAC,eAAoC;IAC7E,OAAO,eAAe,CAAC,uBAAuB,KAAK,SAAS;QAC1D,CAAC,CAAC,mBAAmB,CAAC,eAAe,CAAC,IAAI,sBAAsB;QAChE,CAAC,CAAC,eAAe,CAAC,uBAAuB,CAAC;AAC9C,CAAC;AAJD,gEAIC;AAED,wHAAwH;AACxH,SAAgB,mBAAmB,CAAC,eAGnC;;IACC,OAAO,CACL,MAAA,eAAe,CAAC,MAAM,mCACtB,CAAC,CAAC,eAAe,CAAC,MAAM,KAAK,oBAAoB,IAAI,sBAAsB,CAAC;QAC1E,CAAC,eAAe,CAAC,MAAM,KAAK,sBAAsB,IAAI,sBAAsB,CAAC;QAC7E,mBAAmB,CAAC,CACvB,CAAC;AACJ,CAAC;AAVD,kDAUC","sourcesContent":["import { isAbsolute, resolve } from 'path';\nimport { cachedLookup, normalizeSlashes, versionGteLt } from './util';\nimport type * as _ts from 'typescript';\nimport type { TSCommon, TSInternal } from './ts-compiler-types';\n\n/** @internal */\nexport const createTsInternals = cachedLookup(createTsInternalsUncached);\n/**\n * Given a reference to the TS compiler, return some TS internal functions that we\n * could not or did not want to grab off the `ts` object.\n * These have been copy-pasted from TS's source and tweaked as necessary.\n *\n * NOTE: This factory returns *only* functions which need a reference to the TS\n * compiler. Other functions do not need a reference to the TS compiler so are\n * exported directly from this file.\n */\nfunction createTsInternalsUncached(_ts: TSCommon) {\n const ts = _ts as TSCommon & TSInternal;\n /**\n * Copied from:\n * https://github.com/microsoft/TypeScript/blob/v4.3.2/src/compiler/commandLineParser.ts#L2821-L2846\n */\n function getExtendsConfigPath(\n extendedConfig: string,\n host: _ts.ParseConfigHost,\n basePath: string,\n errors: _ts.Push<_ts.Diagnostic>,\n createDiagnostic: (\n message: _ts.DiagnosticMessage,\n arg1?: string\n ) => _ts.Diagnostic\n ) {\n extendedConfig = normalizeSlashes(extendedConfig);\n if (\n isRootedDiskPath(extendedConfig) ||\n startsWith(extendedConfig, './') ||\n startsWith(extendedConfig, '../')\n ) {\n let extendedConfigPath = getNormalizedAbsolutePath(\n extendedConfig,\n basePath\n );\n if (\n !host.fileExists(extendedConfigPath) &&\n !endsWith(extendedConfigPath, ts.Extension.Json)\n ) {\n extendedConfigPath = `${extendedConfigPath}.json`;\n if (!host.fileExists(extendedConfigPath)) {\n errors.push(\n createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig)\n );\n return undefined;\n }\n }\n return extendedConfigPath;\n }\n // If the path isn't a rooted or relative path, resolve like a module\n const tsGte5_3_0 = versionGteLt(ts.version, '5.3.0');\n const resolved = ts.nodeModuleNameResolver(\n extendedConfig,\n combinePaths(basePath, 'tsconfig.json'),\n { moduleResolution: ts.ModuleResolutionKind.NodeJs },\n host,\n /*cache*/ undefined,\n /*projectRefs*/ undefined,\n /*conditionsOrIsConfigLookup*/ tsGte5_3_0 ? undefined : true,\n /*isConfigLookup*/ tsGte5_3_0 ? true : undefined\n );\n if (resolved.resolvedModule) {\n return resolved.resolvedModule.resolvedFileName;\n }\n errors.push(\n createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig)\n );\n return undefined;\n }\n\n return { getExtendsConfigPath };\n}\n\n// These functions have alternative implementation to avoid copying too much from TS\nfunction isRootedDiskPath(path: string) {\n return isAbsolute(path);\n}\nfunction combinePaths(path: string, ...paths: (string | undefined)[]): string {\n return normalizeSlashes(\n resolve(path, ...(paths.filter((path) => path) as string[]))\n );\n}\nfunction getNormalizedAbsolutePath(\n fileName: string,\n currentDirectory: string | undefined\n) {\n return normalizeSlashes(\n currentDirectory != null\n ? resolve(currentDirectory!, fileName)\n : resolve(fileName)\n );\n}\n\nfunction startsWith(str: string, prefix: string): boolean {\n return str.lastIndexOf(prefix, 0) === 0;\n}\n\nfunction endsWith(str: string, suffix: string): boolean {\n const expectedPos = str.length - suffix.length;\n return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;\n}\n// Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.\n// It may be inefficient (we could just match (/[-[\\]{}()*+?.,\\\\^$|#\\s]/g), but this is future\n// proof.\nconst reservedCharacterPattern = /[^\\w\\s\\/]/g;\n\n/**\n * @internal\n * See also: getRegularExpressionForWildcard, which seems to do almost the same thing\n */\nexport function getPatternFromSpec(spec: string, basePath: string) {\n const pattern = spec && getSubPatternFromSpec(spec, basePath, excludeMatcher);\n return pattern && `^(${pattern})${'($|/)'}`;\n}\nfunction getSubPatternFromSpec(\n spec: string,\n basePath: string,\n {\n singleAsteriskRegexFragment,\n doubleAsteriskRegexFragment,\n replaceWildcardCharacter,\n }: WildcardMatcher\n): string {\n let subpattern = '';\n let hasWrittenComponent = false;\n const components = getNormalizedPathComponents(spec, basePath);\n const lastComponent = last(components);\n\n // getNormalizedPathComponents includes the separator for the root component.\n // We need to remove to create our regex correctly.\n components[0] = removeTrailingDirectorySeparator(components[0]);\n\n if (isImplicitGlob(lastComponent)) {\n components.push('**', '*');\n }\n\n let optionalCount = 0;\n for (let component of components) {\n if (component === '**') {\n subpattern += doubleAsteriskRegexFragment;\n } else {\n if (hasWrittenComponent) {\n subpattern += directorySeparator;\n }\n subpattern += component.replace(\n reservedCharacterPattern,\n replaceWildcardCharacter\n );\n }\n\n hasWrittenComponent = true;\n }\n\n while (optionalCount > 0) {\n subpattern += ')?';\n optionalCount--;\n }\n\n return subpattern;\n}\ninterface WildcardMatcher {\n singleAsteriskRegexFragment: string;\n doubleAsteriskRegexFragment: string;\n replaceWildcardCharacter: (match: string) => string;\n}\nconst directoriesMatcher: WildcardMatcher = {\n singleAsteriskRegexFragment: '[^/]*',\n /**\n * Regex for the ** wildcard. Matches any num of subdirectories. When used for including\n * files or directories, does not match subdirectories that start with a . character\n */\n doubleAsteriskRegexFragment: `(/[^/.][^/]*)*?`,\n replaceWildcardCharacter: (match) =>\n replaceWildcardCharacter(\n match,\n directoriesMatcher.singleAsteriskRegexFragment\n ),\n};\nconst excludeMatcher: WildcardMatcher = {\n singleAsteriskRegexFragment: '[^/]*',\n doubleAsteriskRegexFragment: '(/.+?)?',\n replaceWildcardCharacter: (match) =>\n replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment),\n};\nfunction getNormalizedPathComponents(\n path: string,\n currentDirectory: string | undefined\n) {\n return reducePathComponents(getPathComponents(path, currentDirectory));\n}\nfunction getPathComponents(path: string, currentDirectory = '') {\n path = combinePaths(currentDirectory, path);\n return pathComponents(path, getRootLength(path));\n}\nfunction reducePathComponents(components: readonly string[]) {\n if (!some(components)) return [];\n const reduced = [components[0]];\n for (let i = 1; i < components.length; i++) {\n const component = components[i];\n if (!component) continue;\n if (component === '.') continue;\n if (component === '..') {\n if (reduced.length > 1) {\n if (reduced[reduced.length - 1] !== '..') {\n reduced.pop();\n continue;\n }\n } else if (reduced[0]) continue;\n }\n reduced.push(component);\n }\n return reduced;\n}\nfunction getRootLength(path: string) {\n const rootLength = getEncodedRootLength(path);\n return rootLength < 0 ? ~rootLength : rootLength;\n}\nfunction getEncodedRootLength(path: string): number {\n if (!path) return 0;\n const ch0 = path.charCodeAt(0);\n\n // POSIX or UNC\n if (ch0 === CharacterCodes.slash || ch0 === CharacterCodes.backslash) {\n if (path.charCodeAt(1) !== ch0) return 1; // POSIX: \"/\" (or non-normalized \"\\\")\n\n const p1 = path.indexOf(\n ch0 === CharacterCodes.slash ? directorySeparator : altDirectorySeparator,\n 2\n );\n if (p1 < 0) return path.length; // UNC: \"//server\" or \"\\\\server\"\n\n return p1 + 1; // UNC: \"//server/\" or \"\\\\server\\\"\n }\n\n // DOS\n if (isVolumeCharacter(ch0) && path.charCodeAt(1) === CharacterCodes.colon) {\n const ch2 = path.charCodeAt(2);\n if (ch2 === CharacterCodes.slash || ch2 === CharacterCodes.backslash)\n return 3; // DOS: \"c:/\" or \"c:\\\"\n if (path.length === 2) return 2; // DOS: \"c:\" (but not \"c:d\")\n }\n\n // URL\n const schemeEnd = path.indexOf(urlSchemeSeparator);\n if (schemeEnd !== -1) {\n const authorityStart = schemeEnd + urlSchemeSeparator.length;\n const authorityEnd = path.indexOf(directorySeparator, authorityStart);\n if (authorityEnd !== -1) {\n // URL: \"file:///\", \"file://server/\", \"file://server/path\"\n // For local \"file\" URLs, include the leading DOS volume (if present).\n // Per https://www.ietf.org/rfc/rfc1738.txt, a host of \"\" or \"localhost\" is a\n // special case interpreted as \"the machine from which the URL is being interpreted\".\n const scheme = path.slice(0, schemeEnd);\n const authority = path.slice(authorityStart, authorityEnd);\n if (\n scheme === 'file' &&\n (authority === '' || authority === 'localhost') &&\n isVolumeCharacter(path.charCodeAt(authorityEnd + 1))\n ) {\n const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(\n path,\n authorityEnd + 2\n );\n if (volumeSeparatorEnd !== -1) {\n if (path.charCodeAt(volumeSeparatorEnd) === CharacterCodes.slash) {\n // URL: \"file:///c:/\", \"file://localhost/c:/\", \"file:///c%3a/\", \"file://localhost/c%3a/\"\n return ~(volumeSeparatorEnd + 1);\n }\n if (volumeSeparatorEnd === path.length) {\n // URL: \"file:///c:\", \"file://localhost/c:\", \"file:///c$3a\", \"file://localhost/c%3a\"\n // but not \"file:///c:d\" or \"file:///c%3ad\"\n return ~volumeSeparatorEnd;\n }\n }\n }\n return ~(authorityEnd + 1); // URL: \"file://server/\", \"http://server/\"\n }\n return ~path.length; // URL: \"file://server\", \"http://server\"\n }\n\n // relative\n return 0;\n}\nfunction ensureTrailingDirectorySeparator(path: string) {\n if (!hasTrailingDirectorySeparator(path)) {\n return path + directorySeparator;\n }\n\n return path;\n}\nfunction hasTrailingDirectorySeparator(path: string) {\n return (\n path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1))\n );\n}\nfunction isAnyDirectorySeparator(charCode: number): boolean {\n return (\n charCode === CharacterCodes.slash || charCode === CharacterCodes.backslash\n );\n}\nfunction removeTrailingDirectorySeparator(path: string) {\n if (hasTrailingDirectorySeparator(path)) {\n return path.substr(0, path.length - 1);\n }\n\n return path;\n}\nconst directorySeparator = '/';\nconst altDirectorySeparator = '\\\\';\nconst urlSchemeSeparator = '://';\nfunction isVolumeCharacter(charCode: number) {\n return (\n (charCode >= CharacterCodes.a && charCode <= CharacterCodes.z) ||\n (charCode >= CharacterCodes.A && charCode <= CharacterCodes.Z)\n );\n}\nfunction getFileUrlVolumeSeparatorEnd(url: string, start: number) {\n const ch0 = url.charCodeAt(start);\n if (ch0 === CharacterCodes.colon) return start + 1;\n if (\n ch0 === CharacterCodes.percent &&\n url.charCodeAt(start + 1) === CharacterCodes._3\n ) {\n const ch2 = url.charCodeAt(start + 2);\n if (ch2 === CharacterCodes.a || ch2 === CharacterCodes.A) return start + 3;\n }\n return -1;\n}\nfunction some<T>(array: readonly T[] | undefined): array is readonly T[];\nfunction some<T>(\n array: readonly T[] | undefined,\n predicate: (value: T) => boolean\n): boolean;\nfunction some<T>(\n array: readonly T[] | undefined,\n predicate?: (value: T) => boolean\n): boolean {\n if (array) {\n if (predicate) {\n for (const v of array) {\n if (predicate(v)) {\n return true;\n }\n }\n } else {\n return array.length > 0;\n }\n }\n return false;\n}\n/* @internal */\nconst enum CharacterCodes {\n _3 = 0x33,\n a = 0x61,\n z = 0x7a,\n A = 0x41,\n Z = 0x5a,\n asterisk = 0x2a, // *\n backslash = 0x5c, // \\\n colon = 0x3a, // :\n percent = 0x25, // %\n question = 0x3f, // ?\n slash = 0x2f, // /\n}\nfunction pathComponents(path: string, rootLength: number) {\n const root = path.substring(0, rootLength);\n const rest = path.substring(rootLength).split(directorySeparator);\n if (rest.length && !lastOrUndefined(rest)) rest.pop();\n return [root, ...rest];\n}\nfunction lastOrUndefined<T>(array: readonly T[]): T | undefined {\n return array.length === 0 ? undefined : array[array.length - 1];\n}\nfunction last<T>(array: readonly T[]): T {\n // Debug.assert(array.length !== 0);\n return array[array.length - 1];\n}\nfunction replaceWildcardCharacter(\n match: string,\n singleAsteriskRegexFragment: string\n) {\n return match === '*'\n ? singleAsteriskRegexFragment\n : match === '?'\n ? '[^/]'\n : '\\\\' + match;\n}\n/**\n * An \"includes\" path \"foo\" is implicitly a glob \"foo/** /*\" (without the space) if its last component has no extension,\n * and does not contain any glob characters itself.\n */\nfunction isImplicitGlob(lastPathComponent: string): boolean {\n return !/[.*?]/.test(lastPathComponent);\n}\n\nconst ts_ScriptTarget_ES5 = 1;\nconst ts_ScriptTarget_ES2022 = 9;\nconst ts_ScriptTarget_ESNext = 99;\nconst ts_ModuleKind_Node16 = 100;\nconst ts_ModuleKind_NodeNext = 199;\n// https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8761\nexport function getUseDefineForClassFields(compilerOptions: _ts.CompilerOptions): boolean {\n return compilerOptions.useDefineForClassFields === undefined\n ? getEmitScriptTarget(compilerOptions) >= ts_ScriptTarget_ES2022\n : compilerOptions.useDefineForClassFields;\n}\n\n// https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8556\nexport function getEmitScriptTarget(compilerOptions: {\n module?: _ts.CompilerOptions['module'];\n target?: _ts.CompilerOptions['target'];\n}): _ts.ScriptTarget {\n return (\n compilerOptions.target ??\n ((compilerOptions.module === ts_ModuleKind_Node16 && ts_ScriptTarget_ES2022) ||\n (compilerOptions.module === ts_ModuleKind_NodeNext && ts_ScriptTarget_ESNext) ||\n ts_ScriptTarget_ES5)\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTsTranspileModule = void 0;
|
|
4
|
+
/** @internal */
|
|
5
|
+
function createTsTranspileModule(ts, transpileOptions) {
|
|
6
|
+
const { createProgram, createSourceFile, getDefaultCompilerOptions, getImpliedNodeFormatForFile, fixupCompilerOptions, transpileOptionValueCompilerOptions, getNewLineCharacter, fileExtensionIs, normalizePath, Debug, toPath, getSetExternalModuleIndicator, getEntries, addRange, hasProperty, getEmitScriptTarget, getDirectoryPath, } = ts;
|
|
7
|
+
const compilerOptionsDiagnostics = [];
|
|
8
|
+
const options = transpileOptions.compilerOptions
|
|
9
|
+
? fixupCompilerOptions(transpileOptions.compilerOptions, compilerOptionsDiagnostics)
|
|
10
|
+
: {};
|
|
11
|
+
// mix in default options
|
|
12
|
+
const defaultOptions = getDefaultCompilerOptions();
|
|
13
|
+
for (const key in defaultOptions) {
|
|
14
|
+
if (hasProperty(defaultOptions, key) && options[key] === undefined) {
|
|
15
|
+
options[key] = defaultOptions[key];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
for (const option of transpileOptionValueCompilerOptions) {
|
|
19
|
+
options[option.name] = option.transpileOptionValue;
|
|
20
|
+
}
|
|
21
|
+
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
|
|
22
|
+
options.suppressOutputPathCheck = true;
|
|
23
|
+
// Filename can be non-ts file.
|
|
24
|
+
options.allowNonTsExtensions = true;
|
|
25
|
+
const newLine = getNewLineCharacter(options);
|
|
26
|
+
// Create a compilerHost object to allow the compiler to read and write files
|
|
27
|
+
const compilerHost = {
|
|
28
|
+
getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : undefined,
|
|
29
|
+
writeFile: (name, text) => {
|
|
30
|
+
if (fileExtensionIs(name, '.map')) {
|
|
31
|
+
Debug.assertEqual(sourceMapText, undefined, 'Unexpected multiple source map outputs, file:', name);
|
|
32
|
+
sourceMapText = text;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
Debug.assertEqual(outputText, undefined, 'Unexpected multiple outputs, file:', name);
|
|
36
|
+
outputText = text;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
getDefaultLibFileName: () => 'lib.d.ts',
|
|
40
|
+
useCaseSensitiveFileNames: () => true,
|
|
41
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
42
|
+
getCurrentDirectory: () => '',
|
|
43
|
+
getNewLine: () => newLine,
|
|
44
|
+
fileExists: (fileName) => fileName === inputFileName || fileName === packageJsonFileName,
|
|
45
|
+
readFile: (fileName) => fileName === packageJsonFileName ? `{"type": "${_packageJsonType}"}` : '',
|
|
46
|
+
directoryExists: () => true,
|
|
47
|
+
getDirectories: () => [],
|
|
48
|
+
};
|
|
49
|
+
let inputFileName;
|
|
50
|
+
let packageJsonFileName;
|
|
51
|
+
let _packageJsonType;
|
|
52
|
+
let sourceFile;
|
|
53
|
+
let outputText;
|
|
54
|
+
let sourceMapText;
|
|
55
|
+
return transpileModule;
|
|
56
|
+
function transpileModule(input, transpileOptions2, packageJsonType = 'commonjs') {
|
|
57
|
+
// if jsx is specified then treat file as .tsx
|
|
58
|
+
inputFileName =
|
|
59
|
+
transpileOptions2.fileName ||
|
|
60
|
+
(transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx
|
|
61
|
+
? 'module.tsx'
|
|
62
|
+
: 'module.ts');
|
|
63
|
+
packageJsonFileName = getDirectoryPath(inputFileName) + '/package.json';
|
|
64
|
+
_packageJsonType = packageJsonType;
|
|
65
|
+
sourceFile = createSourceFile(inputFileName, input, {
|
|
66
|
+
languageVersion: getEmitScriptTarget(options),
|
|
67
|
+
impliedNodeFormat: getImpliedNodeFormatForFile(toPath(inputFileName, '', compilerHost.getCanonicalFileName),
|
|
68
|
+
/*cache*/ undefined, compilerHost, options),
|
|
69
|
+
setExternalModuleIndicator: getSetExternalModuleIndicator(options),
|
|
70
|
+
});
|
|
71
|
+
if (transpileOptions2.moduleName) {
|
|
72
|
+
sourceFile.moduleName = transpileOptions2.moduleName;
|
|
73
|
+
}
|
|
74
|
+
if (transpileOptions2.renamedDependencies) {
|
|
75
|
+
sourceFile.renamedDependencies = new Map(getEntries(transpileOptions2.renamedDependencies));
|
|
76
|
+
}
|
|
77
|
+
// Output
|
|
78
|
+
outputText = undefined;
|
|
79
|
+
sourceMapText = undefined;
|
|
80
|
+
const program = createProgram([inputFileName], options, compilerHost);
|
|
81
|
+
const diagnostics = compilerOptionsDiagnostics.slice();
|
|
82
|
+
if (transpileOptions.reportDiagnostics) {
|
|
83
|
+
addRange(
|
|
84
|
+
/*to*/ diagnostics,
|
|
85
|
+
/*from*/ program.getSyntacticDiagnostics(sourceFile));
|
|
86
|
+
addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics());
|
|
87
|
+
}
|
|
88
|
+
// Emit
|
|
89
|
+
program.emit(
|
|
90
|
+
/*targetSourceFile*/ undefined,
|
|
91
|
+
/*writeFile*/ undefined,
|
|
92
|
+
/*cancellationToken*/ undefined,
|
|
93
|
+
/*emitOnlyDtsFiles*/ undefined, transpileOptions.transformers);
|
|
94
|
+
if (outputText === undefined)
|
|
95
|
+
return Debug.fail('Output generation failed');
|
|
96
|
+
return { outputText, diagnostics, sourceMapText };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.createTsTranspileModule = createTsTranspileModule;
|
|
100
|
+
//# sourceMappingURL=ts-transpile-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-transpile-module.js","sourceRoot":"","sources":["../src/ts-transpile-module.ts"],"names":[],"mappings":";;;AAUA,gBAAgB;AAChB,SAAgB,uBAAuB,CACrC,EAAY,EACZ,gBAGC;IAED,MAAM,EACJ,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,mCAAmC,EACnC,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,KAAK,EACL,MAAM,EACN,6BAA6B,EAC7B,UAAU,EACV,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,gBAAgB,GACjB,GAAG,EAAS,CAAC;IAEd,MAAM,0BAA0B,GAAiB,EAAE,CAAC;IAEpD,MAAM,OAAO,GAAoB,gBAAgB,CAAC,eAAe;QAC/D,CAAC,CAAC,oBAAoB,CAClB,gBAAgB,CAAC,eAAe,EAChC,0BAA0B,CAC3B;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,yBAAyB;IACzB,MAAM,cAAc,GAAG,yBAAyB,EAAE,CAAC;IACnD,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE;QAChC,IAAI,WAAW,CAAC,cAAc,EAAE,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YAClE,OAAO,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;SACpC;KACF;IAED,KAAK,MAAM,MAAM,IAAI,mCAAmC,EAAE;QACxD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC;KACpD;IAED,4IAA4I;IAC5I,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAEvC,+BAA+B;IAC/B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAEpC,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7C,6EAA6E;IAC7E,MAAM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AAM,CAAC,WAAW;YAClB,QAAQ,CAAC,OAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,CACrD,CAAC;YACF,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;SACxE;QACD,OAAO;QACP,OAAO,CAAC,IAAI;QACV,oBAAoB,CAAC,SAAS;QAC9B,aAAa,CAAC,SAAS;QACvB,qBAAqB,CAAC,SAAS;QAC/B,oBAAoB,CAAC,SAAS,EAC9B,gBAAgB,CAAC,YAAY,CAC9B,CAAC;QAEF,IAAI,UAAU,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAE5E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;IACpD,CAAC;AACH,CAAC;AArKD,0DAqKC","sourcesContent":["import type {\n CompilerHost,\n CompilerOptions,\n Diagnostic,\n SourceFile,\n TranspileOptions,\n TranspileOutput,\n} from 'typescript';\nimport type { TSCommon } from './ts-compiler-types';\n\n/** @internal */\nexport function createTsTranspileModule(\n ts: TSCommon,\n transpileOptions: Pick<\n TranspileOptions,\n 'compilerOptions' | 'reportDiagnostics' | 'transformers'\n >\n) {\n const {\n createProgram,\n createSourceFile,\n getDefaultCompilerOptions,\n getImpliedNodeFormatForFile,\n fixupCompilerOptions,\n transpileOptionValueCompilerOptions,\n getNewLineCharacter,\n fileExtensionIs,\n normalizePath,\n Debug,\n toPath,\n getSetExternalModuleIndicator,\n getEntries,\n addRange,\n hasProperty,\n getEmitScriptTarget,\n getDirectoryPath,\n } = ts as any;\n\n const compilerOptionsDiagnostics: Diagnostic[] = [];\n\n const options: CompilerOptions = transpileOptions.compilerOptions\n ? fixupCompilerOptions(\n transpileOptions.compilerOptions,\n compilerOptionsDiagnostics\n )\n : {};\n\n // mix in default options\n const defaultOptions = getDefaultCompilerOptions();\n for (const key in defaultOptions) {\n if (hasProperty(defaultOptions, key) && options[key] === undefined) {\n options[key] = defaultOptions[key];\n }\n }\n\n for (const option of transpileOptionValueCompilerOptions) {\n options[option.name] = option.transpileOptionValue;\n }\n\n // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.\n options.suppressOutputPathCheck = true;\n\n // Filename can be non-ts file.\n options.allowNonTsExtensions = true;\n\n const newLine = getNewLineCharacter(options);\n // Create a compilerHost object to allow the compiler to read and write files\n const compilerHost: CompilerHost = {\n getSourceFile: (fileName) =>\n fileName === normalizePath(inputFileName) ? sourceFile : undefined,\n writeFile: (name, text) => {\n if (fileExtensionIs(name, '.map')) {\n Debug.assertEqual(\n sourceMapText,\n undefined,\n 'Unexpected multiple source map outputs, file:',\n name\n );\n sourceMapText = text;\n } else {\n Debug.assertEqual(\n outputText,\n undefined,\n 'Unexpected multiple outputs, file:',\n name\n );\n outputText = text;\n }\n },\n getDefaultLibFileName: () => 'lib.d.ts',\n useCaseSensitiveFileNames: () => true,\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: () => '',\n getNewLine: () => newLine,\n fileExists: (fileName): boolean =>\n fileName === inputFileName || fileName === packageJsonFileName,\n readFile: (fileName) =>\n fileName === packageJsonFileName ? `{\"type\": \"${_packageJsonType}\"}` : '',\n directoryExists: () => true,\n getDirectories: () => [],\n };\n\n let inputFileName: string;\n let packageJsonFileName: string;\n let _packageJsonType: 'module' | 'commonjs';\n let sourceFile: SourceFile;\n let outputText: string | undefined;\n let sourceMapText: string | undefined;\n\n return transpileModule;\n\n function transpileModule(\n input: string,\n transpileOptions2: Pick<\n TranspileOptions,\n 'fileName' | 'moduleName' | 'renamedDependencies'\n >,\n packageJsonType: 'module' | 'commonjs' = 'commonjs'\n ): TranspileOutput {\n // if jsx is specified then treat file as .tsx\n inputFileName =\n transpileOptions2.fileName ||\n (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx\n ? 'module.tsx'\n : 'module.ts');\n packageJsonFileName = getDirectoryPath(inputFileName) + '/package.json';\n _packageJsonType = packageJsonType;\n\n sourceFile = createSourceFile(inputFileName, input, {\n languageVersion: getEmitScriptTarget(options),\n impliedNodeFormat: getImpliedNodeFormatForFile(\n toPath(inputFileName, '', compilerHost.getCanonicalFileName),\n /*cache*/ undefined,\n compilerHost,\n options\n ),\n setExternalModuleIndicator: getSetExternalModuleIndicator(options),\n });\n if (transpileOptions2.moduleName) {\n sourceFile.moduleName = transpileOptions2.moduleName;\n }\n\n if (transpileOptions2.renamedDependencies) {\n (sourceFile as any).renamedDependencies = new Map(\n getEntries(transpileOptions2.renamedDependencies)\n );\n }\n\n // Output\n outputText = undefined;\n sourceMapText = undefined;\n\n const program = createProgram([inputFileName], options, compilerHost);\n\n const diagnostics = compilerOptionsDiagnostics.slice();\n\n if (transpileOptions.reportDiagnostics) {\n addRange(\n /*to*/ diagnostics,\n /*from*/ program.getSyntacticDiagnostics(sourceFile)\n );\n addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics());\n }\n // Emit\n program.emit(\n /*targetSourceFile*/ undefined,\n /*writeFile*/ undefined,\n /*cancellationToken*/ undefined,\n /*emitOnlyDtsFiles*/ undefined,\n transpileOptions.transformers\n );\n\n if (outputText === undefined) return Debug.fail('Output generation failed');\n\n return { outputText, diagnostics, sourceMapText };\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TsConfigOptions } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* tsconfig schema which includes "ts-node" options.
|
|
4
|
+
* @allOf [{"$ref": "https://schemastore.azurewebsites.net/schemas/json/tsconfig.json"}]
|
|
5
|
+
*/
|
|
6
|
+
export interface TsConfigSchema {
|
|
7
|
+
/**
|
|
8
|
+
* ts-node options. See also: https://typestrong.org/ts-node/docs/configuration
|
|
9
|
+
*
|
|
10
|
+
* ts-node offers TypeScript execution and REPL for node.js, with source map support.
|
|
11
|
+
*/
|
|
12
|
+
'ts-node': TsConfigOptions;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig-schema.js","sourceRoot":"","sources":["../src/tsconfig-schema.ts"],"names":[],"mappings":"","sourcesContent":["import type { TsConfigOptions } from './index';\n\n/*\n * This interface exists solely for generating a JSON schema for tsconfig.json.\n * We do *not* extend the compiler's tsconfig interface. Instead we handle that\n * on a schema level, via \"allOf\", so we pull in the same schema that VSCode\n * already uses.\n */\n/**\n * tsconfig schema which includes \"ts-node\" options.\n * @allOf [{\"$ref\": \"https://schemastore.azurewebsites.net/schemas/json/tsconfig.json\"}]\n */\nexport interface TsConfigSchema {\n /**\n * ts-node options. See also: https://typestrong.org/ts-node/docs/configuration\n *\n * ts-node offers TypeScript execution and REPL for node.js, with source map support.\n */\n 'ts-node': TsConfigOptions;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultTsconfigJsonForNodeVersion = void 0;
|
|
4
|
+
const nodeMajor = parseInt(process.versions.node.split('.')[0], 10);
|
|
5
|
+
/**
|
|
6
|
+
* return parsed JSON of the bundled @tsconfig/bases config appropriate for the
|
|
7
|
+
* running version of nodejs
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function getDefaultTsconfigJsonForNodeVersion(ts) {
|
|
11
|
+
const tsInternal = ts;
|
|
12
|
+
if (nodeMajor >= 16) {
|
|
13
|
+
const config = require('@tsconfig/node16/tsconfig.json');
|
|
14
|
+
if (configCompatible(config))
|
|
15
|
+
return config;
|
|
16
|
+
}
|
|
17
|
+
if (nodeMajor >= 14) {
|
|
18
|
+
const config = require('@tsconfig/node14/tsconfig.json');
|
|
19
|
+
if (configCompatible(config))
|
|
20
|
+
return config;
|
|
21
|
+
}
|
|
22
|
+
if (nodeMajor >= 12) {
|
|
23
|
+
const config = require('@tsconfig/node12/tsconfig.json');
|
|
24
|
+
if (configCompatible(config))
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
return require('@tsconfig/node10/tsconfig.json');
|
|
28
|
+
// Verify that tsconfig target and lib options are compatible with TypeScript compiler
|
|
29
|
+
function configCompatible(config) {
|
|
30
|
+
return (typeof ts.ScriptTarget[config.compilerOptions.target.toUpperCase()] === 'number' &&
|
|
31
|
+
tsInternal.libs &&
|
|
32
|
+
config.compilerOptions.lib.every((lib) => tsInternal.libs.includes(lib)));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.getDefaultTsconfigJsonForNodeVersion = getDefaultTsconfigJsonForNodeVersion;
|
|
36
|
+
//# sourceMappingURL=tsconfigs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfigs.js","sourceRoot":"","sources":["../src/tsconfigs.ts"],"names":[],"mappings":";;;AAEA,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACpE;;;;GAIG;AACH,SAAgB,oCAAoC,CAAC,EAAY;IAC/D,MAAM,UAAU,GAAG,EAAuB,CAAC;IAC3C,IAAI,SAAS,IAAI,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;QACzD,IAAI,gBAAgB,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;KAC7C;IACD,IAAI,SAAS,IAAI,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;QACzD,IAAI,gBAAgB,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;KAC7C;IACD,IAAI,SAAS,IAAI,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;QACzD,IAAI,gBAAgB,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;KAC7C;IACD,OAAO,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAEjD,sFAAsF;IACtF,SAAS,gBAAgB,CAAC,MAKzB;QACC,OAAO,CACL,OAAQ,EAAE,CAAC,YAAoB,CAC7B,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,CAC5C,KAAK,QAAQ;YACd,UAAU,CAAC,IAAI;YACf,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,IAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAC1E,CAAC;IACJ,CAAC;AACH,CAAC;AA/BD,oFA+BC","sourcesContent":["import type { TSCommon, TSInternal } from './ts-compiler-types';\n\nconst nodeMajor = parseInt(process.versions.node.split('.')[0], 10);\n/**\n * return parsed JSON of the bundled @tsconfig/bases config appropriate for the\n * running version of nodejs\n * @internal\n */\nexport function getDefaultTsconfigJsonForNodeVersion(ts: TSCommon): any {\n const tsInternal = ts as any as TSInternal;\n if (nodeMajor >= 16) {\n const config = require('@tsconfig/node16/tsconfig.json');\n if (configCompatible(config)) return config;\n }\n if (nodeMajor >= 14) {\n const config = require('@tsconfig/node14/tsconfig.json');\n if (configCompatible(config)) return config;\n }\n if (nodeMajor >= 12) {\n const config = require('@tsconfig/node12/tsconfig.json');\n if (configCompatible(config)) return config;\n }\n return require('@tsconfig/node10/tsconfig.json');\n\n // Verify that tsconfig target and lib options are compatible with TypeScript compiler\n function configCompatible(config: {\n compilerOptions: {\n lib: string[];\n target: string;\n };\n }) {\n return (\n typeof (ts.ScriptTarget as any)[\n config.compilerOptions.target.toUpperCase()\n ] === 'number' &&\n tsInternal.libs &&\n config.compilerOptions.lib.every((lib) => tsInternal.libs!.includes(lib))\n );\n }\n}\n"]}
|