From 43dce19d77c6fda0527a6d5c026af05470892689 Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Sat, 18 Feb 2023 19:54:30 +0800 Subject: [PATCH] feat: Support `.cts` as configuration file (#15283) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nicolò Ribaudo --- babel.config.js | 47 +++++- packages/babel-core/package.json | 3 +- .../src/config/files/configuration.ts | 20 ++- .../src/config/files/module-types.ts | 120 ++++++++++++--- .../babel-core/src/config/files/plugins.ts | 4 +- .../babel-core/src/errors/config-error.ts | 4 +- .../src/errors/rewrite-stack-trace.ts | 22 +-- packages/babel-core/test/config-ts.js | 91 +++++++++++ .../invalid-cts-register/babel.config.cts | 2 + .../simple-cts-with-ts-node/babel.config.cts | 2 + .../config-ts/simple-cts/babel.config.cts | 2 + yarn.lock | 145 +++++++++++++++++- 12 files changed, 408 insertions(+), 54 deletions(-) create mode 100644 packages/babel-core/test/config-ts.js create mode 100644 packages/babel-core/test/fixtures/config-ts/invalid-cts-register/babel.config.cts create mode 100644 packages/babel-core/test/fixtures/config-ts/simple-cts-with-ts-node/babel.config.cts create mode 100644 packages/babel-core/test/fixtures/config-ts/simple-cts/babel.config.cts diff --git a/babel.config.js b/babel.config.js index 206537d9417d..5e74efcf1d51 100644 --- a/babel.config.js +++ b/babel.config.js @@ -464,17 +464,30 @@ function pluginPolyfillsOldNode({ template, types: t }) { }, }; } + +/** + * @param {import("@babel/core")} pluginAPI + * @returns {import("@babel/core").PluginObj} + */ function pluginToggleBooleanFlag({ types: t }, { name, value }) { + function check(test) { + let keepConsequent = value; + + if (test.isUnaryExpression({ operator: "!" })) { + test = test.get("argument"); + keepConsequent = !keepConsequent; + } + return { + test, + keepConsequent, + }; + } + return { visitor: { "IfStatement|ConditionalExpression"(path) { - let test = path.get("test"); - let keepConsequent = value; - - if (test.isUnaryExpression({ operator: "!" })) { - test = test.get("argument"); - keepConsequent = !keepConsequent; - } + // eslint-disable-next-line prefer-const + let { test, keepConsequent } = check(path.get("test")); // yarn-plugin-conditions injects bool(process.env.BABEL_8_BREAKING) // tests, to properly cast the env variable to a boolean. @@ -494,6 +507,26 @@ function pluginToggleBooleanFlag({ types: t }, { name, value }) { : path.node.alternate || t.emptyStatement() ); }, + LogicalExpression(path) { + const { test, keepConsequent } = check(path.get("left")); + + if (!test.matchesPattern(name)) return; + + switch (path.node.operator) { + case "&&": + path.replaceWith( + keepConsequent ? path.node.right : t.booleanLiteral(false) + ); + break; + case "||": + path.replaceWith( + keepConsequent ? t.booleanLiteral(true) : path.node.right + ); + break; + default: + throw path.buildCodeFrameError("This check could not be stripped."); + } + }, MemberExpression(path) { if (path.matchesPattern(name)) { throw path.buildCodeFrameError("This check could not be stripped."); diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 3ae060070ccd..060d58b0906a 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -74,7 +74,8 @@ "@types/gensync": "^1.0.0", "@types/resolve": "^1.3.2", "@types/semver": "^5.4.0", - "rimraf": "^3.0.0" + "rimraf": "^3.0.0", + "ts-node": "^10.9.1" }, "conditions": { "BABEL_8_BREAKING": [ diff --git a/packages/babel-core/src/config/files/configuration.ts b/packages/babel-core/src/config/files/configuration.ts index d74eca86a733..c6c8370405c9 100644 --- a/packages/babel-core/src/config/files/configuration.ts +++ b/packages/babel-core/src/config/files/configuration.ts @@ -9,7 +9,7 @@ import type { CacheConfigurator } from "../caching"; import { makeConfigAPI } from "../helpers/config-api"; import type { ConfigAPI } from "../helpers/config-api"; import { makeStaticFileCache } from "./utils"; -import loadCjsOrMjsDefault from "./module-types"; +import loadCodeDefault from "./module-types"; import pathPatternToRegex from "../pattern-to-regex"; import type { FilePackageData, RelativeConfig, ConfigFile } from "./types"; import type { CallerMetadata } from "../validation/options"; @@ -28,6 +28,7 @@ export const ROOT_CONFIG_FILENAMES = [ "babel.config.cjs", "babel.config.mjs", "babel.config.json", + "babel.config.cts", ]; const RELATIVE_CONFIG_FILENAMES = [ ".babelrc", @@ -35,13 +36,14 @@ const RELATIVE_CONFIG_FILENAMES = [ ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json", + ".babelrc.cts", ]; const BABELIGNORE_FILENAME = ".babelignore"; const LOADING_CONFIGS = new Set(); -const readConfigJS = makeStrongCache(function* readConfigJS( +const readConfigCode = makeStrongCache(function* readConfigCode( filepath: string, cache: CacheConfigurator<{ envName: string; @@ -70,7 +72,7 @@ const readConfigJS = makeStrongCache(function* readConfigJS( let options: unknown; try { LOADING_CONFIGS.add(filepath); - options = yield* loadCjsOrMjsDefault( + options = yield* loadCodeDefault( filepath, "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously.", @@ -313,9 +315,15 @@ function readConfig( caller: CallerMetadata | undefined, ): Handler { const ext = path.extname(filepath); - return ext === ".js" || ext === ".cjs" || ext === ".mjs" - ? readConfigJS(filepath, { envName, caller }) - : readConfigJSON5(filepath); + switch (ext) { + case ".js": + case ".cjs": + case ".mjs": + case ".cts": + return readConfigCode(filepath, { envName, caller }); + default: + return readConfigJSON5(filepath); + } } export function* resolveShowConfigPath( diff --git a/packages/babel-core/src/config/files/module-types.ts b/packages/babel-core/src/config/files/module-types.ts index ab662927fda0..25ffe6c429ef 100644 --- a/packages/babel-core/src/config/files/module-types.ts +++ b/packages/babel-core/src/config/files/module-types.ts @@ -8,6 +8,9 @@ import semver from "semver"; import { endHiddenCallStack } from "../../errors/rewrite-stack-trace"; import ConfigError from "../../errors/config-error"; +import type { InputOptions } from ".."; +import { transformFileSync } from "../../transform-file"; + const require = createRequire(import.meta.url); let import_: ((specifier: string | URL) => any) | undefined; @@ -23,38 +26,87 @@ export const supportsESM = semver.satisfies( "^12.17 || >=13.2", ); -export default function* loadCjsOrMjsDefault( +export default function* loadCodeDefault( filepath: string, asyncError: string, // TODO(Babel 8): Remove this fallbackToTranspiledModule: boolean = false, ): Handler { - switch (guessJSModuleType(filepath)) { - case "cjs": + switch (path.extname(filepath)) { + case ".cjs": return loadCjsDefault(filepath, fallbackToTranspiledModule); - case "unknown": + case ".mjs": + break; + case ".cts": + return loadCtsDefault(filepath); + default: try { return loadCjsDefault(filepath, fallbackToTranspiledModule); } catch (e) { if (e.code !== "ERR_REQUIRE_ESM") throw e; } - // fall through - case "mjs": - if (yield* isAsync()) { - return yield* waitFor(loadMjsDefault(filepath)); - } - throw new ConfigError(asyncError, filepath); } + if (yield* isAsync()) { + return yield* waitFor(loadMjsDefault(filepath)); + } + throw new ConfigError(asyncError, filepath); } -function guessJSModuleType(filename: string): "cjs" | "mjs" | "unknown" { - switch (path.extname(filename)) { - case ".cjs": - return "cjs"; - case ".mjs": - return "mjs"; - default: - return "unknown"; +function loadCtsDefault(filepath: string) { + const ext = ".cts"; + const hasTsSupport = !!( + require.extensions[".ts"] || + require.extensions[".cts"] || + require.extensions[".mts"] + ); + + let handler: NodeJS.RequireExtensions[""]; + + if (!hasTsSupport) { + const opts: InputOptions = { + babelrc: false, + configFile: false, + sourceType: "script", + sourceMaps: "inline", + presets: [ + [ + getTSPreset(filepath), + { + disallowAmbiguousJSXLike: true, + allExtensions: true, + onlyRemoveTypeImports: true, + optimizeConstEnums: true, + ...(!process.env.BABEL_8_BREAKING && { + allowDeclareFields: true, + }), + }, + ], + ], + }; + + handler = function (m, filename) { + // If we want to support `.ts`, `.d.ts` must be handled specially. + if (handler && filename.endsWith(ext)) { + // @ts-expect-error Undocumented API + return m._compile( + transformFileSync(filename, { + ...opts, + filename, + }).code, + filename, + ); + } + return require.extensions[".js"](m, filename); + }; + require.extensions[ext] = handler; + } + try { + return endHiddenCallStack(require)(filepath); + } finally { + if (!hasTsSupport) { + if (require.extensions[ext] === handler) delete require.extensions[ext]; + handler = undefined; + } } } @@ -69,8 +121,7 @@ function loadCjsDefault(filepath: string, fallbackToTranspiledModule: boolean) { async function loadMjsDefault(filepath: string) { if (!import_) { throw new ConfigError( - "Internal error: Native ECMAScript modules aren't supported" + - " by this platform.\n", + "Internal error: Native ECMAScript modules aren't supported by this platform.\n", filepath, ); } @@ -80,3 +131,32 @@ async function loadMjsDefault(filepath: string) { const module = await endHiddenCallStack(import_)(pathToFileURL(filepath)); return module.default; } + +function getTSPreset(filepath: string) { + try { + // eslint-disable-next-line import/no-extraneous-dependencies + return require("@babel/preset-typescript"); + } catch (error) { + if (error.code !== "MODULE_NOT_FOUND") throw error; + + let message = + "You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!"; + + if (process.versions.pnp) { + // Using Yarn PnP, which doesn't allow requiring packages that are not + // explicitly specified as dependencies. + // TODO(Babel 8): Explicitly add `@babel/preset-typescript` as an + // optional peer dependency of `@babel/core`. + message += ` +If you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file: + +packageExtensions: +\t"@babel/core@*": +\t\tpeerDependencies: +\t\t\t"@babel/preset-typescript": "*" +`; + } + + throw new ConfigError(message, filepath); + } +} diff --git a/packages/babel-core/src/config/files/plugins.ts b/packages/babel-core/src/config/files/plugins.ts index ae9a70f230ca..9a7b4b64411e 100644 --- a/packages/babel-core/src/config/files/plugins.ts +++ b/packages/babel-core/src/config/files/plugins.ts @@ -6,7 +6,7 @@ import buildDebug from "debug"; import path from "path"; import gensync, { type Handler } from "gensync"; import { isAsync } from "../../gensync-utils/async"; -import loadCjsOrMjsDefault, { supportsESM } from "./module-types"; +import loadCodeDefault, { supportsESM } from "./module-types"; import { fileURLToPath, pathToFileURL } from "url"; import importMetaResolve from "./import-meta-resolve"; @@ -217,7 +217,7 @@ function* requireModule(type: string, name: string): Handler { if (!process.env.BABEL_8_BREAKING) { LOADING_MODULES.add(name); } - return yield* loadCjsOrMjsDefault( + return yield* loadCodeDefault( name, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously.", diff --git a/packages/babel-core/src/errors/config-error.ts b/packages/babel-core/src/errors/config-error.ts index 01c0cb16aaeb..52efcb85079b 100644 --- a/packages/babel-core/src/errors/config-error.ts +++ b/packages/babel-core/src/errors/config-error.ts @@ -1,9 +1,9 @@ -import { injcectVirtualStackFrame, expectedError } from "./rewrite-stack-trace"; +import { injectVirtualStackFrame, expectedError } from "./rewrite-stack-trace"; export default class ConfigError extends Error { constructor(message: string, filename?: string) { super(message); expectedError(this); - if (filename) injcectVirtualStackFrame(this, filename); + if (filename) injectVirtualStackFrame(this, filename); } } diff --git a/packages/babel-core/src/errors/rewrite-stack-trace.ts b/packages/babel-core/src/errors/rewrite-stack-trace.ts index 93fb66e38d1b..e47dc9ea0b90 100644 --- a/packages/babel-core/src/errors/rewrite-stack-trace.ts +++ b/packages/babel-core/src/errors/rewrite-stack-trace.ts @@ -1,5 +1,5 @@ /** - * This file uses the iternal V8 Stack Trace API (https://v8.dev/docs/stack-trace-api) + * This file uses the internal V8 Stack Trace API (https://v8.dev/docs/stack-trace-api) * to provide utilities to rewrite the stack trace. * When this API is not present, all the functions in this file become noops. * @@ -33,10 +33,10 @@ * - If e() throws an error, then its shown call stack will be "e, f" * * Additionally, an error can inject additional "virtual" stack frames using the - * injcectVirtualStackFrame(error, filename) function: those are injected as a + * injectVirtualStackFrame(error, filename) function: those are injected as a * replacement of the hidden frames. - * In the example above, if we called injcectVirtualStackFrame(err, "h") and - * injcectVirtualStackFrame(err, "i") on the expected error thrown by c(), its + * In the example above, if we called injectVirtualStackFrame(err, "h") and + * injectVirtualStackFrame(err, "i") on the expected error thrown by c(), its * shown call stack would have been "h, i, e, f". * This can be useful, for example, to report config validation errors as if they * were directly thrown in the config file. @@ -46,8 +46,8 @@ const ErrorToString = Function.call.bind(Error.prototype.toString); const SUPPORTED = !!Error.captureStackTrace; -const START_HIDNG = "startHiding - secret - don't use this - v1"; -const STOP_HIDNG = "stopHiding - secret - don't use this - v1"; +const START_HIDING = "startHiding - secret - don't use this - v1"; +const STOP_HIDING = "stopHiding - secret - don't use this - v1"; type CallSite = Parameters[1][number]; @@ -70,7 +70,7 @@ function CallSite(filename: string): CallSite { } as CallSite); } -export function injcectVirtualStackFrame(error: Error, filename: string) { +export function injectVirtualStackFrame(error: Error, filename: string) { if (!SUPPORTED) return; let frames = virtualFrames.get(error); @@ -97,7 +97,7 @@ export function beginHiddenCallStack( return fn(...args); }, "name", - { value: STOP_HIDNG }, + { value: STOP_HIDING }, ); } @@ -111,7 +111,7 @@ export function endHiddenCallStack( return fn(...args); }, "name", - { value: START_HIDNG }, + { value: START_HIDING }, ); } @@ -144,9 +144,9 @@ function setupPrepareStackTrace() { : "unknown"; for (let i = 0; i < trace.length; i++) { const name = trace[i].getFunctionName(); - if (name === START_HIDNG) { + if (name === START_HIDING) { status = "hiding"; - } else if (name === STOP_HIDNG) { + } else if (name === STOP_HIDING) { if (status === "hiding") { status = "showing"; if (virtualFrames.has(err)) { diff --git a/packages/babel-core/test/config-ts.js b/packages/babel-core/test/config-ts.js new file mode 100644 index 000000000000..a497c49b5060 --- /dev/null +++ b/packages/babel-core/test/config-ts.js @@ -0,0 +1,91 @@ +import { loadPartialConfigSync } from "../lib/index.js"; +import path from "path"; +import { fileURLToPath } from "url"; +import { createRequire } from "module"; +import semver from "semver"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); + +// We skip older versions of node testing for two reasons. +// 1. ts-node does not support the old version of node. +// 2. In the old version of node, jest has been registered in `require.extensions`, which will cause babel to disable the transforming as expected. + +const LessThanNode12 = semver.lt(process.version, "12.0.0"); + +!LessThanNode12 + ? describe + : describe.skip("@babel/core config with ts [dummy]", () => { + it("dummy", () => { + expect(1).toBe(1); + }); + }); + +LessThanNode12 + ? describe + : describe.skip("@babel/core config with ts", () => { + it("should work with simple .cts", () => { + const config = loadPartialConfigSync({ + configFile: path.join( + __dirname, + "fixtures/config-ts/simple-cts/babel.config.cts", + ), + }); + + expect(config.options.targets).toMatchInlineSnapshot(` + Object { + "node": "12.0.0", + } + `); + }); + + it("should throw with invalid .ts register", () => { + require.extensions[".ts"] = () => { + throw new Error("Not support .ts."); + }; + try { + expect(() => { + loadPartialConfigSync({ + configFile: path.join( + __dirname, + "fixtures/config-ts/invalid-cts-register/babel.config.cts", + ), + }); + }).toThrow(/Unexpected identifier.*/); + } finally { + delete require.extensions[".ts"]; + } + }); + + it("should work with ts-node", async () => { + const service = require("ts-node").register({ + experimentalResolver: true, + compilerOptions: { + module: "CommonJS", + }, + }); + service.enabled(true); + + try { + require(path.join( + __dirname, + "fixtures/config-ts/simple-cts-with-ts-node/babel.config.cts", + )); + + const config = loadPartialConfigSync({ + configFile: path.join( + __dirname, + "fixtures/config-ts/simple-cts-with-ts-node/babel.config.cts", + ), + }); + + expect(config.options.targets).toMatchInlineSnapshot(` + Object { + "node": "12.0.0", + } + `); + } finally { + service.enabled(false); + } + }); + }); diff --git a/packages/babel-core/test/fixtures/config-ts/invalid-cts-register/babel.config.cts b/packages/babel-core/test/fixtures/config-ts/invalid-cts-register/babel.config.cts new file mode 100644 index 000000000000..9817b4f090cd --- /dev/null +++ b/packages/babel-core/test/fixtures/config-ts/invalid-cts-register/babel.config.cts @@ -0,0 +1,2 @@ +type config = any; +module.exports = { targets: "node 12.0.0" } as config; diff --git a/packages/babel-core/test/fixtures/config-ts/simple-cts-with-ts-node/babel.config.cts b/packages/babel-core/test/fixtures/config-ts/simple-cts-with-ts-node/babel.config.cts new file mode 100644 index 000000000000..9817b4f090cd --- /dev/null +++ b/packages/babel-core/test/fixtures/config-ts/simple-cts-with-ts-node/babel.config.cts @@ -0,0 +1,2 @@ +type config = any; +module.exports = { targets: "node 12.0.0" } as config; diff --git a/packages/babel-core/test/fixtures/config-ts/simple-cts/babel.config.cts b/packages/babel-core/test/fixtures/config-ts/simple-cts/babel.config.cts new file mode 100644 index 000000000000..9817b4f090cd --- /dev/null +++ b/packages/babel-core/test/fixtures/config-ts/simple-cts/babel.config.cts @@ -0,0 +1,2 @@ +type config = any; +module.exports = { targets: "node 12.0.0" } as config; diff --git a/yarn.lock b/yarn.lock index edf145ed308e..d204ed7224ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -369,6 +369,7 @@ __metadata: json5: ^2.2.2 rimraf: ^3.0.0 semver: "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0" + ts-node: ^10.9.1 languageName: unknown linkType: soft @@ -3858,6 +3859,15 @@ __metadata: languageName: node linkType: hard +"@cspotcode/source-map-support@npm:^0.8.0": + version: 0.8.1 + resolution: "@cspotcode/source-map-support@npm:0.8.1" + dependencies: + "@jridgewell/trace-mapping": 0.3.9 + checksum: 5718f267085ed8edb3e7ef210137241775e607ee18b77d95aa5bd7514f47f5019aa2d82d96b3bf342ef7aa890a346fa1044532ff7cc3009e7d24fce3ce6200fa + languageName: node + linkType: hard + "@discoveryjs/json-ext@npm:^0.5.0": version: 0.5.2 resolution: "@discoveryjs/json-ext@npm:0.5.2" @@ -4169,7 +4179,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:3.1.0": +"@jridgewell/resolve-uri@npm:3.1.0, @jridgewell/resolve-uri@npm:^3.0.3": version: 3.1.0 resolution: "@jridgewell/resolve-uri@npm:3.1.0" checksum: b5ceaaf9a110fcb2780d1d8f8d4a0bfd216702f31c988d8042e5f8fbe353c55d9b0f55a1733afdc64806f8e79c485d2464680ac48a0d9fcadb9548ee6b81d267 @@ -4200,6 +4210,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:0.3.9": + version: 0.3.9 + resolution: "@jridgewell/trace-mapping@npm:0.3.9" + dependencies: + "@jridgewell/resolve-uri": ^3.0.3 + "@jridgewell/sourcemap-codec": ^1.4.10 + checksum: d89597752fd88d3f3480845691a05a44bd21faac18e2185b6f436c3b0fd0c5a859fbbd9aaa92050c4052caf325ad3e10e2e1d1b64327517471b7d51babc0ddef + languageName: node + linkType: hard + "@jridgewell/trace-mapping@npm:^0.3.0, @jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.14, @jridgewell/trace-mapping@npm:^0.3.15, @jridgewell/trace-mapping@npm:^0.3.8, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.17 resolution: "@jridgewell/trace-mapping@npm:0.3.17" @@ -4402,6 +4422,34 @@ __metadata: languageName: node linkType: hard +"@tsconfig/node10@npm:^1.0.7": + version: 1.0.9 + resolution: "@tsconfig/node10@npm:1.0.9" + checksum: a33ae4dc2a621c0678ac8ac4bceb8e512ae75dac65417a2ad9b022d9b5411e863c4c198b6ba9ef659e14b9fb609bbec680841a2e84c1172df7a5ffcf076539df + languageName: node + linkType: hard + +"@tsconfig/node12@npm:^1.0.7": + version: 1.0.11 + resolution: "@tsconfig/node12@npm:1.0.11" + checksum: 5ce29a41b13e7897a58b8e2df11269c5395999e588b9a467386f99d1d26f6c77d1af2719e407621412520ea30517d718d5192a32403b8dfcc163bf33e40a338a + languageName: node + linkType: hard + +"@tsconfig/node14@npm:^1.0.0": + version: 1.0.3 + resolution: "@tsconfig/node14@npm:1.0.3" + checksum: 19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d + languageName: node + linkType: hard + +"@tsconfig/node16@npm:^1.0.2": + version: 1.0.3 + resolution: "@tsconfig/node16@npm:1.0.3" + checksum: 3a8b657dd047495b7ad23437d6afd20297ce90380ff0bdee93fc7d39a900dbd8d9e26e53ff6b465e7967ce2adf0b218782590ce9013285121e6a5928fbd6819f + languageName: node + linkType: hard + "@types/babel__core@link:./nope::locator=babel%40workspace%3A.": version: 0.0.0-use.local resolution: "@types/babel__core@link:./nope::locator=babel%40workspace%3A." @@ -5232,6 +5280,13 @@ __metadata: languageName: node linkType: hard +"acorn-walk@npm:^8.1.1": + version: 8.2.0 + resolution: "acorn-walk@npm:8.2.0" + checksum: 1715e76c01dd7b2d4ca472f9c58968516a4899378a63ad5b6c2d668bba8da21a71976c14ec5f5b75f887b6317c4ae0b897ab141c831d741dc76024d8745f1ad1 + languageName: node + linkType: hard + "acorn@npm:^4.0.3": version: 4.0.13 resolution: "acorn@npm:4.0.13" @@ -5268,12 +5323,12 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.5.0, acorn@npm:^8.7.0, acorn@npm:^8.7.1, acorn@npm:^8.8.0": - version: 8.8.0 - resolution: "acorn@npm:8.8.0" +"acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.7.0, acorn@npm:^8.7.1, acorn@npm:^8.8.0": + version: 8.8.1 + resolution: "acorn@npm:8.8.1" bin: acorn: bin/acorn - checksum: 7270ca82b242eafe5687a11fea6e088c960af712683756abf0791b68855ea9cace3057bd5e998ffcef50c944810c1e0ca1da526d02b32110e13c722aa959afdc + checksum: 4079b67283b94935157698831967642f24a075c52ce3feaaaafe095776dfbe15d86a1b33b1e53860fc0d062ed6c83f4284a5c87c85b9ad51853a01173da6097f languageName: node linkType: hard @@ -5501,6 +5556,13 @@ __metadata: languageName: node linkType: hard +"arg@npm:^4.1.0": + version: 4.1.3 + resolution: "arg@npm:4.1.3" + checksum: 544af8dd3f60546d3e4aff084d451b96961d2267d668670199692f8d054f0415d86fc5497d0e641e91546f0aa920e7c29e5250e99fc89f5552a34b5d93b77f43 + languageName: node + linkType: hard + "argparse@npm:^1.0.7": version: 1.0.10 resolution: "argparse@npm:1.0.10" @@ -7140,6 +7202,13 @@ __metadata: languageName: node linkType: hard +"create-require@npm:^1.1.0": + version: 1.1.1 + resolution: "create-require@npm:1.1.1" + checksum: a9a1503d4390d8b59ad86f4607de7870b39cad43d929813599a23714831e81c520bddf61bcdd1f8e30f05fd3a2b71ae8538e946eb2786dc65c2bbc520f692eff + languageName: node + linkType: hard + "cross-spawn@npm:^5.0.1": version: 5.1.0 resolution: "cross-spawn@npm:5.1.0" @@ -7419,6 +7488,13 @@ __metadata: languageName: node linkType: hard +"diff@npm:^4.0.1": + version: 4.0.2 + resolution: "diff@npm:4.0.2" + checksum: f2c09b0ce4e6b301c221addd83bf3f454c0bc00caa3dd837cf6c127d6edf7223aa2bbe3b688feea110b7f262adbfc845b757c44c8a9f8c0c5b15d8fa9ce9d20d + languageName: node + linkType: hard + "diffie-hellman@npm:^5.0.0": version: 5.0.3 resolution: "diffie-hellman@npm:5.0.3" @@ -11277,6 +11353,13 @@ fsevents@^1.2.7: languageName: node linkType: hard +"make-error@npm:^1.1.1": + version: 1.3.6 + resolution: "make-error@npm:1.3.6" + checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 + languageName: node + linkType: hard + "make-iterator@npm:^1.0.0": version: 1.0.1 resolution: "make-iterator@npm:1.0.1" @@ -14619,6 +14702,44 @@ fsevents@^1.2.7: languageName: node linkType: hard +"ts-node@npm:^10.9.1": + version: 10.9.1 + resolution: "ts-node@npm:10.9.1" + dependencies: + "@cspotcode/source-map-support": ^0.8.0 + "@tsconfig/node10": ^1.0.7 + "@tsconfig/node12": ^1.0.7 + "@tsconfig/node14": ^1.0.0 + "@tsconfig/node16": ^1.0.2 + acorn: ^8.4.1 + acorn-walk: ^8.1.1 + arg: ^4.1.0 + create-require: ^1.1.0 + diff: ^4.0.1 + make-error: ^1.1.1 + v8-compile-cache-lib: ^3.0.1 + yn: 3.1.1 + peerDependencies: + "@swc/core": ">=1.2.50" + "@swc/wasm": ">=1.2.50" + "@types/node": "*" + typescript: ">=2.7" + peerDependenciesMeta: + "@swc/core": + optional: true + "@swc/wasm": + optional: true + bin: + ts-node: dist/bin.js + ts-node-cwd: dist/bin-cwd.js + ts-node-esm: dist/bin-esm.js + ts-node-script: dist/bin-script.js + ts-node-transpile-only: dist/bin-transpile.js + ts-script: dist/bin-script-deprecated.js + checksum: 090adff1302ab20bd3486e6b4799e90f97726ed39e02b39e566f8ab674fd5bd5f727f43615debbfc580d33c6d9d1c6b1b3ce7d8e3cca3e20530a145ffa232c35 + languageName: node + linkType: hard + "tsconfig-paths@npm:^3.14.1": version: 3.14.1 resolution: "tsconfig-paths@npm:3.14.1" @@ -15055,6 +15176,13 @@ fsevents@^1.2.7: languageName: node linkType: hard +"v8-compile-cache-lib@npm:^3.0.1": + version: 3.0.1 + resolution: "v8-compile-cache-lib@npm:3.0.1" + checksum: 78089ad549e21bcdbfca10c08850022b22024cdcc2da9b168bcf5a73a6ed7bf01a9cebb9eac28e03cd23a684d81e0502797e88f3ccd27a32aeab1cfc44c39da0 + languageName: node + linkType: hard + "v8-compile-cache@npm:^2.0.3": version: 2.2.0 resolution: "v8-compile-cache@npm:2.2.0" @@ -15700,6 +15828,13 @@ fsevents@^1.2.7: languageName: node linkType: hard +"yn@npm:3.1.1": + version: 3.1.1 + resolution: "yn@npm:3.1.1" + checksum: 2c487b0e149e746ef48cda9f8bad10fc83693cd69d7f9dcd8be4214e985de33a29c9e24f3c0d6bcf2288427040a8947406ab27f7af67ee9456e6b84854f02dd6 + languageName: node + linkType: hard + "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0"