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E,EAAE;;QACJ,OAAA,CAAC,CAAC,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,MAAA,CAAC,CAAC,IAAI,0CAAE,QAAS,CAAC,KAAK,CAAC,CAAC,CAAC;YACxD,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;KAAA,CAC9C,CACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,kBAAkB,CACzB,EAAY,EACZ,UAA0B,EAC1B,QAAgB;IAEhB,IAAI,OAAO,GAAa,UAAU,CAAC;IAEnC,KAAK,EAAE,OAAO,IAAI,EAAE;QAClB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;YACnD,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;YACnC,IAAI,KAAK,GAAG,QAAQ;gBAAE,MAAM;YAE5B,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC3B,IAAI,QAAQ,IAAI,GAAG,EAAE;gBACnB,OAAO,GAAG,KAAK,CAAC;gBAChB,SAAS,KAAK,CAAC;aAChB;SACF;QAED,OAAO,OAAO,CAAC;KAChB;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACI,MAAM,cAAc,GAA4B,CACrD,aAAsB,EACtB,EAAE,CAAE,OAAO,CAAC,OAAO,CAA4B,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;AAFnE,QAAA,cAAc,kBAEqD","sourcesContent":["import { relative, basename, extname, dirname, join } from 'path';\nimport { Module } from 'module';\nimport * as util from 'util';\nimport { fileURLToPath } from 'url';\n\nimport type * as _sourceMapSupport from '@cspotcode/source-map-support';\nimport { BaseError } from 'make-error';\nimport type * as _ts from 'typescript';\n\nimport type { Transpiler, TranspilerFactory } from './transpilers/types';\nimport {\n cachedLookup,\n createProjectLocalResolveHelper,\n hasOwnProperty,\n normalizeSlashes,\n once,\n parse,\n ProjectLocalResolveHelper,\n split,\n versionGteLt,\n yn,\n} from './util';\nimport { findAndReadConfig, loadCompiler } from './configuration';\nimport type { TSCommon, TSInternal } from './ts-compiler-types';\nimport {\n createModuleTypeClassifier,\n ModuleTypeClassifier,\n} from './module-type-classifier';\nimport { createResolverFunctions } from './resolver-functions';\nimport type { createEsmHooks as createEsmHooksFn } from './esm';\nimport {\n installCommonjsResolveHooksIfNecessary,\n ModuleConstructorWithInternals,\n} from './cjs-resolve-hooks';\nimport { classifyModule } from './node-module-type-classifier';\nimport type * as _nodeInternalModulesEsmResolve from '../dist-raw/node-internal-modules-esm-resolve';\nimport type * as _nodeInternalModulesEsmGetFormat from '../dist-raw/node-internal-modules-esm-get_format';\nimport type * as _nodeInternalModulesCjsLoader from '../dist-raw/node-internal-modules-cjs-loader';\nimport { Extensions, getExtensions } from './file-extensions';\nimport { createTsTranspileModule } from './ts-transpile-module';\n\nexport { TSCommon };\nexport {\n createRepl,\n CreateReplOptions,\n ReplService,\n EvalAwarePartialHost,\n} from './repl';\nexport type {\n TranspilerModule,\n TranspilerFactory,\n CreateTranspilerOptions,\n TranspileOutput,\n TranspileOptions,\n Transpiler,\n} from './transpilers/types';\nexport type {\n NodeLoaderHooksAPI1,\n NodeLoaderHooksAPI2,\n NodeLoaderHooksFormat,\n} from './esm';\n\n/**\n * Does this version of node obey the package.json \"type\" field\n * and throw ERR_REQUIRE_ESM when attempting to require() an ESM modules.\n */\nconst engineSupportsPackageTypeField =\n parseInt(process.versions.node.split('.')[0], 10) >= 12;\n\n/**\n * Assert that script can be loaded as CommonJS when we attempt to require it.\n * If it should be loaded as ESM, throw ERR_REQUIRE_ESM like node does.\n *\n * Loaded conditionally so we don't need to support older node versions\n */\nlet assertScriptCanLoadAsCJS: (\n service: Service,\n module: NodeJS.Module,\n filename: string\n) => void = engineSupportsPackageTypeField\n ? (\n require('../dist-raw/node-internal-modules-cjs-loader') as typeof _nodeInternalModulesCjsLoader\n ).assertScriptCanLoadAsCJSImpl\n : () => {\n /* noop */\n };\n\n/**\n * Registered `ts-node` instance information.\n */\nexport const REGISTER_INSTANCE = Symbol.for('ts-node.register.instance');\n\n/**\n * Expose `REGISTER_INSTANCE` information on node.js `process`.\n */\ndeclare global {\n namespace NodeJS {\n interface Process {\n [REGISTER_INSTANCE]?: Service;\n }\n }\n}\n\n/** @internal */\nexport const env = process.env as ProcessEnv;\n/**\n * Declare all env vars, to aid discoverability.\n * If an env var affects ts-node's behavior, it should not be buried somewhere in our codebase.\n * @internal\n */\nexport interface ProcessEnv {\n TS_NODE_DEBUG?: string;\n TS_NODE_CWD?: string;\n /** @deprecated */\n TS_NODE_DIR?: string;\n TS_NODE_EMIT?: string;\n TS_NODE_SCOPE?: string;\n TS_NODE_SCOPE_DIR?: string;\n TS_NODE_FILES?: string;\n TS_NODE_PRETTY?: string;\n TS_NODE_COMPILER?: string;\n TS_NODE_COMPILER_OPTIONS?: string;\n TS_NODE_IGNORE?: string;\n TS_NODE_PROJECT?: string;\n TS_NODE_SKIP_PROJECT?: string;\n TS_NODE_SKIP_IGNORE?: string;\n TS_NODE_PREFER_TS_EXTS?: string;\n TS_NODE_IGNORE_DIAGNOSTICS?: string;\n TS_NODE_TRANSPILE_ONLY?: string;\n TS_NODE_TYPE_CHECK?: string;\n TS_NODE_COMPILER_HOST?: string;\n TS_NODE_LOG_ERROR?: string;\n TS_NODE_HISTORY?: string;\n TS_NODE_EXPERIMENTAL_REPL_AWAIT?: string;\n\n NODE_NO_READLINE?: string;\n}\n\n/**\n * @internal\n */\nexport const INSPECT_CUSTOM = util.inspect.custom || 'inspect';\n\n/**\n * Debugging `ts-node`.\n */\nconst shouldDebug = yn(env.TS_NODE_DEBUG);\n/** @internal */\nexport const debug = shouldDebug\n ? (...args: any) =>\n console.log(`[ts-node ${new Date().toISOString()}]`, ...args)\n : () => undefined;\nconst debugFn = shouldDebug\n ? <T, U>(key: string, fn: (arg: T) => U) => {\n let i = 0;\n return (x: T) => {\n debug(key, x, ++i);\n return fn(x);\n };\n }\n : <T, U>(_: string, fn: (arg: T) => U) => fn;\n\n/**\n * Export the current version.\n */\nexport const VERSION = require('../package.json').version;\n\n/**\n * Options for creating a new TypeScript compiler instance.\n\n * @category Basic\n */\nexport interface CreateOptions {\n /**\n * Behave as if invoked within this working directory. Roughly equivalent to `cd $dir && ts-node ...`\n *\n * @default process.cwd()\n */\n cwd?: string;\n /**\n * Legacy alias for `cwd`\n *\n * @deprecated use `projectSearchDir` or `cwd`\n */\n dir?: string;\n /**\n * Emit output files into `.ts-node` directory.\n *\n * @default false\n */\n emit?: boolean;\n /**\n * Scope compiler to files within `scopeDir`.\n *\n * @default false\n */\n scope?: boolean;\n /**\n * @default First of: `tsconfig.json` \"rootDir\" if specified, directory containing `tsconfig.json`, or cwd if no `tsconfig.json` is loaded.\n */\n scopeDir?: string;\n /**\n * Use pretty diagnostic formatter.\n *\n * @default false\n */\n pretty?: boolean;\n /**\n * Use TypeScript's faster `transpileModule`.\n *\n * @default false\n */\n transpileOnly?: boolean;\n /**\n * **DEPRECATED** Specify type-check is enabled (e.g. `transpileOnly == false`).\n *\n * @default true\n */\n typeCheck?: boolean;\n /**\n * Use TypeScript's compiler host API instead of the language service API.\n *\n * @default false\n */\n compilerHost?: boolean;\n /**\n * Logs TypeScript errors to stderr instead of throwing exceptions.\n *\n * @default false\n */\n logError?: boolean;\n /**\n * Load \"files\" and \"include\" from `tsconfig.json` on startup.\n *\n * Default is to override `tsconfig.json` \"files\" and \"include\" to only include the entrypoint script.\n *\n * @default false\n */\n files?: boolean;\n /**\n * Specify a custom TypeScript compiler.\n *\n * @default \"typescript\"\n */\n compiler?: string;\n /**\n * Specify a custom transpiler for use with transpileOnly\n */\n transpiler?: string | [string, object];\n /**\n * Transpile with swc instead of the TypeScript compiler, and skip typechecking.\n *\n * Equivalent to setting both `transpileOnly: true` and `transpiler: 'ts-node/transpilers/swc'`\n *\n * For complete instructions: https://typestrong.org/ts-node/docs/transpilers\n */\n swc?: boolean;\n /**\n * Paths which should not be compiled.\n *\n * Each string in the array is converted to a regular expression via `new RegExp()` and tested against source paths prior to compilation.\n *\n * Source paths are normalized to posix-style separators, relative to the directory containing `tsconfig.json` or to cwd if no `tsconfig.json` is loaded.\n *\n * Default is to ignore all node_modules subdirectories.\n *\n * @default [\"(?:^|/)node_modules/\"]\n */\n ignore?: string[];\n /**\n * Path to TypeScript config file or directory containing a `tsconfig.json`.\n * Similar to the `tsc --project` flag: https://www.typescriptlang.org/docs/handbook/compiler-options.html\n */\n project?: string;\n /**\n * Search for TypeScript config file (`tsconfig.json`) in this or parent directories.\n */\n projectSearchDir?: string;\n /**\n * Skip project config resolution and loading.\n *\n * @default false\n */\n skipProject?: boolean;\n /**\n * Skip ignore check, so that compilation will be attempted for all files with matching extensions.\n *\n * @default false\n */\n skipIgnore?: boolean;\n /**\n * JSON object to merge with TypeScript `compilerOptions`.\n *\n * @allOf [{\"$ref\": \"https://schemastore.azurewebsites.net/schemas/json/tsconfig.json#definitions/compilerOptionsDefinition/properties/compilerOptions\"}]\n */\n compilerOptions?: object;\n /**\n * Ignore TypeScript warnings by diagnostic code.\n */\n ignoreDiagnostics?: Array<number | string>;\n /**\n * Modules to require, like node's `--require` flag.\n *\n * If specified in `tsconfig.json`, the modules will be resolved relative to the `tsconfig.json` file.\n *\n * If specified programmatically, each input string should be pre-resolved to an absolute path for\n * best results.\n */\n require?: Array<string>;\n readFile?: (path: string) => string | undefined;\n fileExists?: (path: string) => boolean;\n transformers?:\n | _ts.CustomTransformers\n | ((p: _ts.Program) => _ts.CustomTransformers);\n /**\n * Allows the usage of top level await in REPL.\n *\n * Uses node's implementation which accomplishes this with an AST syntax transformation.\n *\n * Enabled by default when tsconfig target is es2018 or above. Set to false to disable.\n *\n * **Note**: setting to `true` when tsconfig target is too low will throw an Error. Leave as `undefined`\n * to get default, automatic behavior.\n */\n experimentalReplAwait?: boolean;\n /**\n * Override certain paths to be compiled and executed as CommonJS or ECMAScript modules.\n * When overridden, the tsconfig \"module\" and package.json \"type\" fields are overridden, and\n * the file extension is ignored.\n * This is useful if you cannot use .mts, .cts, .mjs, or .cjs file extensions;\n * it achieves the same effect.\n *\n * Each key is a glob pattern following the same rules as tsconfig's \"include\" array.\n * When multiple patterns match the same file, the last pattern takes precedence.\n *\n * `cjs` overrides matches files to compile and execute as CommonJS.\n * `esm` overrides matches files to compile and execute as native ECMAScript modules.\n * `package` overrides either of the above to default behavior, which obeys package.json \"type\" and\n * tsconfig.json \"module\" options.\n */\n moduleTypes?: ModuleTypes;\n /**\n * @internal\n * Set by our configuration loader whenever a config file contains options that\n * are relative to the config file they came from, *and* when other logic needs\n * to know this. Some options can be eagerly resolved to absolute paths by\n * the configuration loader, so it is *not* necessary for their source to be set here.\n */\n optionBasePaths?: OptionBasePaths;\n /**\n * A function to collect trace messages from the TypeScript compiler, for example when `traceResolution` is enabled.\n *\n * @default console.log\n */\n tsTrace?: (str: string) => void;\n /**\n * Enable native ESM support.\n *\n * For details, see https://typestrong.org/ts-node/docs/imports#native-ecmascript-modules\n */\n esm?: boolean;\n /**\n * Re-order file extensions so that TypeScript imports are preferred.\n *\n * For example, when both `index.js` and `index.ts` exist, enabling this option causes `require('./index')` to resolve to `index.ts` instead of `index.js`\n *\n * @default false\n */\n preferTsExts?: boolean;\n /**\n * Like node's `--experimental-specifier-resolution`, , but can also be set in your `tsconfig.json` for convenience.\n *\n * For details, see https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#customizing-esm-specifier-resolution-algorithm\n */\n experimentalSpecifierResolution?: 'node' | 'explicit';\n /**\n * Allow using voluntary `.ts` file extension in import specifiers.\n *\n * Typically, in ESM projects, import specifiers must have an emit extension, `.js`, `.cjs`, or `.mjs`,\n * and we automatically map to the corresponding `.ts`, `.cts`, or `.mts` source file. This is the\n * recommended approach.\n *\n * However, if you really want to use `.ts` in import specifiers, and are aware that this may\n * break tooling, you can enable this flag.\n */\n experimentalTsImportSpecifiers?: boolean;\n}\n\nexport type ModuleTypes = Record<string, ModuleTypeOverride>;\nexport type ModuleTypeOverride = 'cjs' | 'esm' | 'package';\n\n/** @internal */\nexport interface OptionBasePaths {\n moduleTypes?: string;\n transpiler?: string;\n compiler?: string;\n swc?: string;\n}\n\n/**\n * Options for registering a TypeScript compiler instance globally.\n\n * @category Basic\n */\nexport interface RegisterOptions extends CreateOptions {\n /**\n * Enable experimental features that re-map imports and require calls to support:\n * `baseUrl`, `paths`, `rootDirs`, `.js` to `.ts` file extension mappings,\n * `outDir` to `rootDir` mappings for composite projects and monorepos.\n *\n * For details, see https://github.com/TypeStrong/ts-node/issues/1514\n */\n experimentalResolver?: boolean;\n}\n\nexport type ExperimentalSpecifierResolution = 'node' | 'explicit';\n\n/**\n * Must be an interface to support `typescript-json-schema`.\n */\nexport interface TsConfigOptions\n extends Omit<\n RegisterOptions,\n | 'transformers'\n | 'readFile'\n | 'fileExists'\n | 'skipProject'\n | 'project'\n | 'dir'\n | 'cwd'\n | 'projectSearchDir'\n | 'optionBasePaths'\n | 'tsTrace'\n > {}\n\n/**\n * Information retrieved from type info check.\n */\nexport interface TypeInfo {\n name: string;\n comment: string;\n}\n\n/**\n * Default register options, including values specified via environment\n * variables.\n * @internal\n */\nexport const DEFAULTS: RegisterOptions = {\n cwd: env.TS_NODE_CWD ?? env.TS_NODE_DIR,\n emit: yn(env.TS_NODE_EMIT),\n scope: yn(env.TS_NODE_SCOPE),\n scopeDir: env.TS_NODE_SCOPE_DIR,\n files: yn(env.TS_NODE_FILES),\n pretty: yn(env.TS_NODE_PRETTY),\n compiler: env.TS_NODE_COMPILER,\n compilerOptions: parse(env.TS_NODE_COMPILER_OPTIONS),\n ignore: split(env.TS_NODE_IGNORE),\n project: env.TS_NODE_PROJECT,\n skipProject: yn(env.TS_NODE_SKIP_PROJECT),\n skipIgnore: yn(env.TS_NODE_SKIP_IGNORE),\n preferTsExts: yn(env.TS_NODE_PREFER_TS_EXTS),\n ignoreDiagnostics: split(env.TS_NODE_IGNORE_DIAGNOSTICS),\n transpileOnly: yn(env.TS_NODE_TRANSPILE_ONLY),\n typeCheck: yn(env.TS_NODE_TYPE_CHECK),\n compilerHost: yn(env.TS_NODE_COMPILER_HOST),\n logError: yn(env.TS_NODE_LOG_ERROR),\n experimentalReplAwait: yn(env.TS_NODE_EXPERIMENTAL_REPL_AWAIT) ?? undefined,\n tsTrace: console.log.bind(console),\n};\n\n/**\n * TypeScript diagnostics error.\n */\nexport class TSError extends BaseError {\n name = 'TSError';\n diagnosticText!: string;\n diagnostics!: ReadonlyArray<_ts.Diagnostic>;\n\n constructor(\n diagnosticText: string,\n public diagnosticCodes: number[],\n diagnostics: ReadonlyArray<_ts.Diagnostic> = []\n ) {\n super(`⨯ Unable to compile TypeScript:\\n${diagnosticText}`);\n Object.defineProperty(this, 'diagnosticText', {\n configurable: true,\n writable: true,\n value: diagnosticText,\n });\n Object.defineProperty(this, 'diagnostics', {\n configurable: true,\n writable: true,\n value: diagnostics,\n });\n }\n\n /**\n * @internal\n */\n [INSPECT_CUSTOM]() {\n return this.diagnosticText;\n }\n}\n\nconst TS_NODE_SERVICE_BRAND = Symbol('TS_NODE_SERVICE_BRAND');\n\n/**\n * Primary ts-node service, which wraps the TypeScript API and can compile TypeScript to JavaScript\n */\nexport interface Service {\n /** @internal */\n [TS_NODE_SERVICE_BRAND]: true;\n ts: TSCommon;\n /** @internal */\n compilerPath: string;\n config: _ts.ParsedCommandLine;\n options: RegisterOptions;\n enabled(enabled?: boolean): boolean;\n ignored(fileName: string): boolean;\n compile(code: string, fileName: string, lineOffset?: number): string;\n getTypeInfo(code: string, fileName: string, position: number): TypeInfo;\n /** @internal */\n configFilePath: string | undefined;\n /** @internal */\n moduleTypeClassifier: ModuleTypeClassifier;\n /** @internal */\n readonly shouldReplAwait: boolean;\n /** @internal */\n addDiagnosticFilter(filter: DiagnosticFilter): void;\n /** @internal */\n installSourceMapSupport(): void;\n /** @internal */\n enableExperimentalEsmLoaderInterop(): void;\n /** @internal */\n transpileOnly: boolean;\n /** @internal */\n projectLocalResolveHelper: ProjectLocalResolveHelper;\n /** @internal */\n getNodeEsmResolver: () => ReturnType<\n typeof import('../dist-raw/node-internal-modules-esm-resolve').createResolve\n >;\n /** @internal */\n getNodeEsmGetFormat: () => ReturnType<\n typeof import('../dist-raw/node-internal-modules-esm-get_format').createGetFormat\n >;\n /** @internal */\n getNodeCjsLoader: () => ReturnType<\n typeof import('../dist-raw/node-internal-modules-cjs-loader').createCjsLoader\n >;\n /** @internal */\n extensions: Extensions;\n}\n\n/**\n * Re-export of `Service` interface for backwards-compatibility\n * @deprecated use `Service` instead\n * @see {Service}\n */\nexport type Register = Service;\n\n/** @internal */\nexport interface DiagnosticFilter {\n /** if true, filter applies to all files */\n appliesToAllFiles: boolean;\n /** Filter applies onto to these filenames. Only used if appliesToAllFiles is false */\n filenamesAbsolute: string[];\n /** these diagnostic codes are ignored */\n diagnosticsIgnored: number[];\n}\n\n/**\n * Create a new TypeScript compiler instance and register it onto node.js\n *\n * @category Basic\n */\nexport function register(opts?: RegisterOptions): Service;\n/**\n * Register TypeScript compiler instance onto node.js\n\n * @category Basic\n */\nexport function register(service: Service): Service;\nexport function register(\n serviceOrOpts: Service | RegisterOptions | undefined\n): Service {\n // Is this a Service or a RegisterOptions?\n let service = serviceOrOpts as Service;\n if (!(serviceOrOpts as Service)?.[TS_NODE_SERVICE_BRAND]) {\n // Not a service; is options\n service = create((serviceOrOpts ?? {}) as RegisterOptions);\n }\n\n const originalJsHandler = require.extensions['.js'];\n\n // Expose registered instance globally.\n process[REGISTER_INSTANCE] = service;\n\n // Register the extensions.\n registerExtensions(\n service.options.preferTsExts,\n service.extensions.compiled,\n service,\n originalJsHandler\n );\n\n installCommonjsResolveHooksIfNecessary(service);\n\n // Require specified modules before start-up.\n (Module as ModuleConstructorWithInternals)._preloadModules(\n service.options.require\n );\n\n return service;\n}\n\n/**\n * Create TypeScript compiler instance.\n *\n * @category Basic\n */\nexport function create(rawOptions: CreateOptions = {}): Service {\n const foundConfigResult = findAndReadConfig(rawOptions);\n return createFromPreloadedConfig(foundConfigResult);\n}\n\n/** @internal */\nexport function createFromPreloadedConfig(\n foundConfigResult: ReturnType<typeof findAndReadConfig>\n): Service {\n const {\n configFilePath,\n cwd,\n options,\n config,\n compiler,\n projectLocalResolveDir,\n optionBasePaths,\n } = foundConfigResult;\n\n const projectLocalResolveHelper = createProjectLocalResolveHelper(\n projectLocalResolveDir\n );\n\n const ts = loadCompiler(compiler);\n\n // Experimental REPL await is not compatible targets lower than ES2018\n const targetSupportsTla = config.options.target! >= ts.ScriptTarget.ES2018;\n if (options.experimentalReplAwait === true && !targetSupportsTla) {\n throw new Error(\n 'Experimental REPL await is not compatible with targets lower than ES2018'\n );\n }\n // Top-level await was added in TS 3.8\n const tsVersionSupportsTla = versionGteLt(ts.version, '3.8.0');\n if (options.experimentalReplAwait === true && !tsVersionSupportsTla) {\n throw new Error(\n 'Experimental REPL await is not compatible with TypeScript versions older than 3.8'\n );\n }\n\n const shouldReplAwait =\n options.experimentalReplAwait !== false &&\n tsVersionSupportsTla &&\n targetSupportsTla;\n\n // swc implies two other options\n // typeCheck option was implemented specifically to allow overriding tsconfig transpileOnly from the command-line\n // So we should allow using typeCheck to override swc\n if (options.swc && !options.typeCheck) {\n if (options.transpileOnly === false) {\n throw new Error(\n \"Cannot enable 'swc' option with 'transpileOnly: false'. 'swc' implies 'transpileOnly'.\"\n );\n }\n if (options.transpiler) {\n throw new Error(\n \"Cannot specify both 'swc' and 'transpiler' options. 'swc' uses the built-in swc transpiler.\"\n );\n }\n }\n\n const readFile = options.readFile || ts.sys.readFile;\n const fileExists = options.fileExists || ts.sys.fileExists;\n // typeCheck can override transpileOnly, useful for CLI flag to override config file\n const transpileOnly =\n (options.transpileOnly === true || options.swc === true) &&\n options.typeCheck !== true;\n let transpiler: RegisterOptions['transpiler'] | undefined = undefined;\n let transpilerBasePath: string | undefined = undefined;\n if (options.transpiler) {\n transpiler = options.transpiler;\n transpilerBasePath = optionBasePaths.transpiler;\n } else if (options.swc) {\n transpiler = require.resolve('./transpilers/swc.js');\n transpilerBasePath = optionBasePaths.swc;\n }\n const transformers = options.transformers || undefined;\n const diagnosticFilters: Array<DiagnosticFilter> = [\n {\n appliesToAllFiles: true,\n filenamesAbsolute: [],\n diagnosticsIgnored: [\n 6059, // \"'rootDir' is expected to contain all source files.\"\n 18002, // \"The 'files' list in config file is empty.\"\n 18003, // \"No inputs were found in config file.\"\n ...(options.experimentalTsImportSpecifiers\n ? [\n 2691, // \"An import path cannot end with a '.ts' extension. Consider importing '<specifier without ext>' instead.\"\n ]\n : []),\n ...(options.ignoreDiagnostics || []),\n ].map(Number),\n },\n ];\n\n const configDiagnosticList = filterDiagnostics(\n config.errors,\n diagnosticFilters\n );\n const outputCache = new Map<\n string,\n {\n content: string;\n }\n >();\n\n const configFileDirname = configFilePath ? dirname(configFilePath) : null;\n const scopeDir =\n options.scopeDir ?? config.options.rootDir ?? configFileDirname ?? cwd;\n const ignoreBaseDir = configFileDirname ?? cwd;\n const isScoped = options.scope\n ? (fileName: string) => relative(scopeDir, fileName).charAt(0) !== '.'\n : () => true;\n const shouldIgnore = createIgnore(\n ignoreBaseDir,\n options.skipIgnore\n ? []\n : (options.ignore || ['(?:^|/)node_modules/']).map(\n (str) => new RegExp(str)\n )\n );\n\n const diagnosticHost: _ts.FormatDiagnosticsHost = {\n getNewLine: () => ts.sys.newLine,\n getCurrentDirectory: () => cwd,\n // TODO switch to getCanonicalFileName we already create later in scope\n getCanonicalFileName: ts.sys.useCaseSensitiveFileNames\n ? (x) => x\n : (x) => x.toLowerCase(),\n };\n\n if (options.transpileOnly && typeof transformers === 'function') {\n throw new TypeError(\n 'Transformers function is unavailable in \"--transpile-only\"'\n );\n }\n let createTranspiler = initializeTranspilerFactory();\n function initializeTranspilerFactory() {\n if (transpiler) {\n if (!transpileOnly)\n throw new Error(\n 'Custom transpiler can only be used when transpileOnly is enabled.'\n );\n const transpilerName =\n typeof transpiler === 'string' ? transpiler : transpiler[0];\n const transpilerOptions =\n typeof transpiler === 'string' ? {} : transpiler[1] ?? {};\n const transpilerConfigLocalResolveHelper = transpilerBasePath\n ? createProjectLocalResolveHelper(transpilerBasePath)\n : projectLocalResolveHelper;\n const transpilerPath = transpilerConfigLocalResolveHelper(\n transpilerName,\n true\n );\n const transpilerFactory = require(transpilerPath)\n .create as TranspilerFactory;\n return createTranspiler;\n\n function createTranspiler(\n compilerOptions: TSCommon.CompilerOptions,\n nodeModuleEmitKind?: NodeModuleEmitKind\n ) {\n return transpilerFactory?.({\n service: {\n options,\n config: {\n ...config,\n options: compilerOptions,\n },\n projectLocalResolveHelper,\n },\n transpilerConfigLocalResolveHelper,\n nodeModuleEmitKind,\n ...transpilerOptions,\n });\n }\n }\n }\n\n /**\n * True if require() hooks should interop with experimental ESM loader.\n * Enabled explicitly via a flag since it is a breaking change.\n */\n let experimentalEsmLoader = false;\n function enableExperimentalEsmLoaderInterop() {\n experimentalEsmLoader = true;\n }\n\n // Install source map support and read from memory cache.\n installSourceMapSupport();\n function installSourceMapSupport() {\n const sourceMapSupport =\n require('@cspotcode/source-map-support') as typeof _sourceMapSupport;\n sourceMapSupport.install({\n environment: 'node',\n retrieveFile(pathOrUrl: string) {\n let path = pathOrUrl;\n // If it's a file URL, convert to local path\n // Note: fileURLToPath does not exist on early node v10\n // I could not find a way to handle non-URLs except to swallow an error\n if (experimentalEsmLoader && path.startsWith('file://')) {\n try {\n path = fileURLToPath(path);\n } catch (e) {\n /* swallow error */\n }\n }\n path = normalizeSlashes(path);\n return outputCache.get(path)?.content || '';\n },\n redirectConflictingLibrary: true,\n onConflictingLibraryRedirect(\n request,\n parent,\n isMain,\n options,\n redirectedRequest\n ) {\n debug(\n `Redirected an attempt to require source-map-support to instead receive @cspotcode/source-map-support. \"${\n (parent as NodeJS.Module).filename\n }\" attempted to require or resolve \"${request}\" and was redirected to \"${redirectedRequest}\".`\n );\n },\n });\n }\n\n const shouldHavePrettyErrors =\n options.pretty === undefined ? process.stdout.isTTY : options.pretty;\n\n const formatDiagnostics = shouldHavePrettyErrors\n ? ts.formatDiagnosticsWithColorAndContext || ts.formatDiagnostics\n : ts.formatDiagnostics;\n\n function createTSError(diagnostics: ReadonlyArray<_ts.Diagnostic>) {\n const diagnosticText = formatDiagnostics(diagnostics, diagnosticHost);\n const diagnosticCodes = diagnostics.map((x) => x.code);\n return new TSError(diagnosticText, diagnosticCodes, diagnostics);\n }\n\n function reportTSError(configDiagnosticList: _ts.Diagnostic[]) {\n const error = createTSError(configDiagnosticList);\n if (options.logError) {\n // Print error in red color and continue execution.\n console.error('\\x1b[31m%s\\x1b[0m', error);\n } else {\n // Throw error and exit the script.\n throw error;\n }\n }\n\n // Render the configuration errors.\n if (configDiagnosticList.length) reportTSError(configDiagnosticList);\n\n const jsxEmitPreserve = config.options.jsx === ts.JsxEmit.Preserve;\n /**\n * Get the extension for a transpiled file.\n * [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS]\n */\n function getEmitExtension(path: string) {\n const lastDotIndex = path.lastIndexOf('.');\n if (lastDotIndex >= 0) {\n const ext = path.slice(lastDotIndex);\n switch (ext) {\n case '.js':\n case '.ts':\n return '.js';\n case '.jsx':\n case '.tsx':\n return jsxEmitPreserve ? '.jsx' : '.js';\n case '.mjs':\n case '.mts':\n return '.mjs';\n case '.cjs':\n case '.cts':\n return '.cjs';\n }\n }\n return '.js';\n }\n\n type GetOutputFunction = (code: string, fileName: string) => SourceOutput;\n /**\n * Get output from TS compiler w/typechecking. `undefined` in `transpileOnly`\n * mode.\n */\n let getOutput: GetOutputFunction | undefined;\n let getTypeInfo: (\n _code: string,\n _fileName: string,\n _position: number\n ) => TypeInfo;\n\n const getCanonicalFileName = (\n ts as unknown as TSInternal\n ).createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames);\n\n const moduleTypeClassifier = createModuleTypeClassifier({\n basePath: options.optionBasePaths?.moduleTypes,\n patterns: options.moduleTypes,\n });\n\n const extensions = getExtensions(config, options, ts.version);\n\n // Use full language services when the fast option is disabled.\n if (!transpileOnly) {\n const fileContents = new Map<string, string>();\n const rootFileNames = new Set(config.fileNames);\n const cachedReadFile = cachedLookup(debugFn('readFile', readFile));\n\n // Use language services by default\n if (!options.compilerHost) {\n let projectVersion = 1;\n const fileVersions = new Map(\n Array.from(rootFileNames).map((fileName) => [fileName, 0])\n );\n\n const getCustomTransformers = () => {\n if (typeof transformers === 'function') {\n const program = service.getProgram();\n return program ? transformers(program) : undefined;\n }\n\n return transformers;\n };\n\n // Create the compiler host for type checking.\n const serviceHost: _ts.LanguageServiceHost &\n Required<Pick<_ts.LanguageServiceHost, 'fileExists' | 'readFile'>> = {\n getProjectVersion: () => String(projectVersion),\n getScriptFileNames: () => Array.from(rootFileNames),\n getScriptVersion: (fileName: string) => {\n const version = fileVersions.get(fileName);\n return version ? version.toString() : '';\n },\n getScriptSnapshot(fileName: string) {\n // TODO ordering of this with getScriptVersion? Should they sync up?\n let contents = fileContents.get(fileName);\n\n // Read contents into TypeScript memory cache.\n if (contents === undefined) {\n contents = cachedReadFile(fileName);\n if (contents === undefined) return;\n\n fileVersions.set(fileName, 1);\n fileContents.set(fileName, contents);\n projectVersion++;\n }\n\n return ts.ScriptSnapshot.fromString(contents);\n },\n readFile: cachedReadFile,\n readDirectory: ts.sys.readDirectory,\n getDirectories: cachedLookup(\n debugFn('getDirectories', ts.sys.getDirectories)\n ),\n fileExists: cachedLookup(debugFn('fileExists', fileExists)),\n directoryExists: cachedLookup(\n debugFn('directoryExists', ts.sys.directoryExists)\n ),\n realpath: ts.sys.realpath\n ? cachedLookup(debugFn('realpath', ts.sys.realpath))\n : undefined,\n getNewLine: () => ts.sys.newLine,\n useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,\n getCurrentDirectory: () => cwd,\n getCompilationSettings: () => config.options,\n getDefaultLibFileName: () => ts.getDefaultLibFilePath(config.options),\n getCustomTransformers: getCustomTransformers,\n trace: options.tsTrace,\n };\n const {\n resolveModuleNames,\n getResolvedModuleWithFailedLookupLocationsFromCache,\n resolveTypeReferenceDirectives,\n isFileKnownToBeInternal,\n markBucketOfFilenameInternal,\n } = createResolverFunctions({\n host: serviceHost,\n getCanonicalFileName,\n ts,\n cwd,\n config,\n projectLocalResolveHelper,\n options,\n extensions,\n });\n serviceHost.resolveModuleNames = resolveModuleNames;\n serviceHost.getResolvedModuleWithFailedLookupLocationsFromCache =\n getResolvedModuleWithFailedLookupLocationsFromCache;\n serviceHost.resolveTypeReferenceDirectives =\n resolveTypeReferenceDirectives;\n\n const registry = ts.createDocumentRegistry(\n ts.sys.useCaseSensitiveFileNames,\n cwd\n );\n const service = ts.createLanguageService(serviceHost, registry);\n\n const updateMemoryCache = (contents: string, fileName: string) => {\n // Add to `rootFiles` as necessary, either to make TS include a file it has not seen,\n // or to trigger a re-classification of files from external to internal.\n if (\n !rootFileNames.has(fileName) &&\n !isFileKnownToBeInternal(fileName)\n ) {\n markBucketOfFilenameInternal(fileName);\n rootFileNames.add(fileName);\n // Increment project version for every change to rootFileNames.\n projectVersion++;\n }\n\n const previousVersion = fileVersions.get(fileName) || 0;\n const previousContents = fileContents.get(fileName);\n // Avoid incrementing cache when nothing has changed.\n if (contents !== previousContents) {\n fileVersions.set(fileName, previousVersion + 1);\n fileContents.set(fileName, contents);\n // Increment project version for every file change.\n projectVersion++;\n }\n };\n\n let previousProgram: _ts.Program | undefined = undefined;\n\n getOutput = (code: string, fileName: string) => {\n updateMemoryCache(code, fileName);\n\n const programBefore = service.getProgram();\n if (programBefore !== previousProgram) {\n debug(\n `compiler rebuilt Program instance when getting output for ${fileName}`\n );\n }\n\n const output = service.getEmitOutput(fileName);\n\n // Get the relevant diagnostics - this is 3x faster than `getPreEmitDiagnostics`.\n const diagnostics = service\n .getSemanticDiagnostics(fileName)\n .concat(service.getSyntacticDiagnostics(fileName));\n\n const programAfter = service.getProgram();\n\n debug(\n 'invariant: Is service.getProject() identical before and after getting emit output and diagnostics? (should always be true) ',\n programBefore === programAfter\n );\n\n previousProgram = programAfter;\n\n const diagnosticList = filterDiagnostics(\n diagnostics,\n diagnosticFilters\n );\n if (diagnosticList.length) reportTSError(diagnosticList);\n\n if (output.emitSkipped) {\n return [undefined, undefined, true];\n }\n\n // Throw an error when requiring `.d.ts` files.\n if (output.outputFiles.length === 0) {\n throw new TypeError(\n `Unable to require file: ${relative(cwd, fileName)}\\n` +\n 'This is usually the result of a faulty configuration or import. ' +\n 'Make sure there is a `.js`, `.json` or other executable extension with ' +\n 'loader attached before `ts-node` available.'\n );\n }\n\n return [output.outputFiles[1].text, output.outputFiles[0].text, false];\n };\n\n getTypeInfo = (code: string, fileName: string, position: number) => {\n const normalizedFileName = normalizeSlashes(fileName);\n updateMemoryCache(code, normalizedFileName);\n\n const info = service.getQuickInfoAtPosition(\n normalizedFileName,\n position\n );\n const name = ts.displayPartsToString(info ? info.displayParts : []);\n const comment = ts.displayPartsToString(info ? info.documentation : []);\n\n return { name, comment };\n };\n } else {\n const sys: _ts.System & _ts.FormatDiagnosticsHost = {\n ...ts.sys,\n ...diagnosticHost,\n readFile: (fileName: string) => {\n const cacheContents = fileContents.get(fileName);\n if (cacheContents !== undefined) return cacheContents;\n const contents = cachedReadFile(fileName);\n if (contents) fileContents.set(fileName, contents);\n return contents;\n },\n readDirectory: ts.sys.readDirectory,\n getDirectories: cachedLookup(\n debugFn('getDirectories', ts.sys.getDirectories)\n ),\n fileExists: cachedLookup(debugFn('fileExists', fileExists)),\n directoryExists: cachedLookup(\n debugFn('directoryExists', ts.sys.directoryExists)\n ),\n resolvePath: cachedLookup(debugFn('resolvePath', ts.sys.resolvePath)),\n realpath: ts.sys.realpath\n ? cachedLookup(debugFn('realpath', ts.sys.realpath))\n : undefined,\n };\n\n const host: _ts.CompilerHost = ts.createIncrementalCompilerHost\n ? ts.createIncrementalCompilerHost(config.options, sys)\n : {\n ...sys,\n getSourceFile: (fileName, languageVersion) => {\n const contents = sys.readFile(fileName);\n if (contents === undefined) return;\n return ts.createSourceFile(fileName, contents, languageVersion);\n },\n getDefaultLibLocation: () => normalizeSlashes(dirname(compiler)),\n getDefaultLibFileName: () =>\n normalizeSlashes(\n join(\n dirname(compiler),\n ts.getDefaultLibFileName(config.options)\n )\n ),\n useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,\n };\n host.trace = options.tsTrace;\n const {\n resolveModuleNames,\n resolveTypeReferenceDirectives,\n isFileKnownToBeInternal,\n markBucketOfFilenameInternal,\n } = createResolverFunctions({\n host,\n cwd,\n config,\n ts,\n getCanonicalFileName,\n projectLocalResolveHelper,\n options,\n extensions,\n });\n host.resolveModuleNames = resolveModuleNames;\n host.resolveTypeReferenceDirectives = resolveTypeReferenceDirectives;\n\n // Fallback for older TypeScript releases without incremental API.\n let builderProgram = ts.createIncrementalProgram\n ? ts.createIncrementalProgram({\n rootNames: Array.from(rootFileNames),\n options: config.options,\n host,\n configFileParsingDiagnostics: config.errors,\n projectReferences: config.projectReferences,\n })\n : ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n Array.from(rootFileNames),\n config.options,\n host,\n undefined,\n config.errors,\n config.projectReferences\n );\n\n // Read and cache custom transformers.\n const customTransformers =\n typeof transformers === 'function'\n ? transformers(builderProgram.getProgram())\n : transformers;\n\n // Set the file contents into cache manually.\n const updateMemoryCache = (contents: string, fileName: string) => {\n const previousContents = fileContents.get(fileName);\n const contentsChanged = previousContents !== contents;\n if (contentsChanged) {\n fileContents.set(fileName, contents);\n }\n\n // Add to `rootFiles` when discovered by compiler for the first time.\n let addedToRootFileNames = false;\n if (\n !rootFileNames.has(fileName) &&\n !isFileKnownToBeInternal(fileName)\n ) {\n markBucketOfFilenameInternal(fileName);\n rootFileNames.add(fileName);\n addedToRootFileNames = true;\n }\n\n // Update program when file changes.\n if (addedToRootFileNames || contentsChanged) {\n builderProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n Array.from(rootFileNames),\n config.options,\n host,\n builderProgram,\n config.errors,\n config.projectReferences\n );\n }\n };\n\n getOutput = (code: string, fileName: string) => {\n let outText = '';\n let outMap = '';\n\n updateMemoryCache(code, fileName);\n\n const sourceFile = builderProgram.getSourceFile(fileName);\n if (!sourceFile)\n throw new TypeError(`Unable to read file: ${fileName}`);\n\n const program = builderProgram.getProgram();\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n const diagnosticList = filterDiagnostics(\n diagnostics,\n diagnosticFilters\n );\n if (diagnosticList.length) reportTSError(diagnosticList);\n\n const result = builderProgram.emit(\n sourceFile,\n (path, file, writeByteOrderMark) => {\n if (path.endsWith('.map')) {\n outMap = file;\n } else {\n outText = file;\n }\n\n if (options.emit) sys.writeFile(path, file, writeByteOrderMark);\n },\n undefined,\n undefined,\n customTransformers\n );\n\n if (result.emitSkipped) {\n return [undefined, undefined, true];\n }\n\n // Throw an error when requiring files that cannot be compiled.\n if (outText === '') {\n if (program.isSourceFileFromExternalLibrary(sourceFile)) {\n throw new TypeError(\n `Unable to compile file from external library: ${relative(\n cwd,\n fileName\n )}`\n );\n }\n\n throw new TypeError(\n `Unable to require file: ${relative(cwd, fileName)}\\n` +\n 'This is usually the result of a faulty configuration or import. ' +\n 'Make sure there is a `.js`, `.json` or other executable extension with ' +\n 'loader attached before `ts-node` available.'\n );\n }\n\n return [outText, outMap, false];\n };\n\n getTypeInfo = (code: string, fileName: string, position: number) => {\n const normalizedFileName = normalizeSlashes(fileName);\n updateMemoryCache(code, normalizedFileName);\n\n const sourceFile = builderProgram.getSourceFile(normalizedFileName);\n if (!sourceFile)\n throw new TypeError(`Unable to read file: ${fileName}`);\n\n const node = getTokenAtPosition(ts, sourceFile, position);\n const checker = builderProgram.getProgram().getTypeChecker();\n const symbol = checker.getSymbolAtLocation(node);\n\n if (!symbol) return { name: '', comment: '' };\n\n const type = checker.getTypeOfSymbolAtLocation(symbol, node);\n const signatures = [\n ...type.getConstructSignatures(),\n ...type.getCallSignatures(),\n ];\n\n return {\n name: signatures.length\n ? signatures.map((x) => checker.signatureToString(x)).join('\\n')\n : checker.typeToString(type),\n comment: ts.displayPartsToString(\n symbol ? symbol.getDocumentationComment(checker) : []\n ),\n };\n };\n\n // Write `.tsbuildinfo` when `--build` is enabled.\n if (options.emit && config.options.incremental) {\n process.on('exit', () => {\n // Emits `.tsbuildinfo` to filesystem.\n (builderProgram.getProgram() as any).emitBuildInfo();\n });\n }\n }\n } else {\n getTypeInfo = () => {\n throw new TypeError(\n 'Type information is unavailable in \"--transpile-only\"'\n );\n };\n }\n\n function createTranspileOnlyGetOutputFunction(\n overrideModuleType?: _ts.ModuleKind,\n nodeModuleEmitKind?: NodeModuleEmitKind\n ): GetOutputFunction {\n const compilerOptions = { ...config.options };\n if (overrideModuleType !== undefined)\n compilerOptions.module = overrideModuleType;\n let customTranspiler = createTranspiler?.(\n compilerOptions,\n nodeModuleEmitKind\n );\n let tsTranspileModule = versionGteLt(ts.version, '4.7.0')\n ? createTsTranspileModule(ts, {\n compilerOptions,\n reportDiagnostics: true,\n transformers: transformers as _ts.CustomTransformers | undefined,\n })\n : undefined;\n return (code: string, fileName: string): SourceOutput => {\n let result: _ts.TranspileOutput;\n if (customTranspiler) {\n result = customTranspiler.transpile(code, {\n fileName,\n });\n } else if (tsTranspileModule) {\n result = tsTranspileModule(\n code,\n {\n fileName,\n },\n nodeModuleEmitKind === 'nodeesm' ? 'module' : 'commonjs'\n );\n } else {\n result = ts.transpileModule(code, {\n fileName,\n compilerOptions,\n reportDiagnostics: true,\n transformers: transformers as _ts.CustomTransformers | undefined,\n });\n }\n\n const diagnosticList = filterDiagnostics(\n result.diagnostics || [],\n diagnosticFilters\n );\n if (diagnosticList.length) reportTSError(diagnosticList);\n\n return [result.outputText, result.sourceMapText as string, false];\n };\n }\n\n // When true, these mean that a `moduleType` override will cause a different emit\n // than the TypeScript compiler, so we *must* overwrite the emit.\n const shouldOverwriteEmitWhenForcingCommonJS =\n config.options.module !== ts.ModuleKind.CommonJS;\n // [MUST_UPDATE_FOR_NEW_MODULEKIND]\n const shouldOverwriteEmitWhenForcingEsm = !(\n config.options.module === ts.ModuleKind.ES2015 ||\n (ts.ModuleKind.ES2020 && config.options.module === ts.ModuleKind.ES2020) ||\n (ts.ModuleKind.ES2022 && config.options.module === ts.ModuleKind.ES2022) ||\n config.options.module === ts.ModuleKind.ESNext\n );\n /**\n * node16 or nodenext\n * [MUST_UPDATE_FOR_NEW_MODULEKIND]\n */\n const isNodeModuleType =\n (ts.ModuleKind.Node16 && config.options.module === ts.ModuleKind.Node16) ||\n (ts.ModuleKind.NodeNext &&\n config.options.module === ts.ModuleKind.NodeNext);\n const getOutputForceCommonJS = createTranspileOnlyGetOutputFunction(\n ts.ModuleKind.CommonJS\n );\n const getOutputForceNodeCommonJS = createTranspileOnlyGetOutputFunction(\n ts.ModuleKind.NodeNext,\n 'nodecjs'\n );\n const getOutputForceNodeESM = createTranspileOnlyGetOutputFunction(\n ts.ModuleKind.NodeNext,\n 'nodeesm'\n );\n // [MUST_UPDATE_FOR_NEW_MODULEKIND]\n const getOutputForceESM = createTranspileOnlyGetOutputFunction(\n ts.ModuleKind.ES2022 || ts.ModuleKind.ES2020 || ts.ModuleKind.ES2015\n );\n const getOutputTranspileOnly = createTranspileOnlyGetOutputFunction();\n\n // Create a simple TypeScript compiler proxy.\n function compile(code: string, fileName: string, lineOffset = 0) {\n const normalizedFileName = normalizeSlashes(fileName);\n const classification =\n moduleTypeClassifier.classifyModuleByModuleTypeOverrides(\n normalizedFileName\n );\n let value: string | undefined = '';\n let sourceMap: string | undefined = '';\n let emitSkipped = true;\n if (getOutput) {\n // Must always call normal getOutput to throw typechecking errors\n [value, sourceMap, emitSkipped] = getOutput(code, normalizedFileName);\n }\n // If module classification contradicts the above, call the relevant transpiler\n if (\n classification.moduleType === 'cjs' &&\n (shouldOverwriteEmitWhenForcingCommonJS || emitSkipped)\n ) {\n [value, sourceMap] = getOutputForceCommonJS(code, normalizedFileName);\n } else if (\n classification.moduleType === 'esm' &&\n (shouldOverwriteEmitWhenForcingEsm || emitSkipped)\n ) {\n [value, sourceMap] = getOutputForceESM(code, normalizedFileName);\n } else if (emitSkipped) {\n // Happens when ts compiler skips emit or in transpileOnly mode\n const classification = classifyModule(fileName, isNodeModuleType);\n [value, sourceMap] =\n classification === 'nodecjs'\n ? getOutputForceNodeCommonJS(code, normalizedFileName)\n : classification === 'nodeesm'\n ? getOutputForceNodeESM(code, normalizedFileName)\n : classification === 'cjs'\n ? getOutputForceCommonJS(code, normalizedFileName)\n : classification === 'esm'\n ? getOutputForceESM(code, normalizedFileName)\n : getOutputTranspileOnly(code, normalizedFileName);\n }\n const output = updateOutput(\n value!,\n normalizedFileName,\n sourceMap!,\n getEmitExtension\n );\n outputCache.set(normalizedFileName, { content: output });\n return output;\n }\n\n let active = true;\n const enabled = (enabled?: boolean) =>\n enabled === undefined ? active : (active = !!enabled);\n const ignored = (fileName: string) => {\n if (!active) return true;\n const ext = extname(fileName);\n if (extensions.compiled.includes(ext)) {\n return !isScoped(fileName) || shouldIgnore(fileName);\n }\n return true;\n };\n\n function addDiagnosticFilter(filter: DiagnosticFilter) {\n diagnosticFilters.push({\n ...filter,\n filenamesAbsolute: filter.filenamesAbsolute.map((f) =>\n normalizeSlashes(f)\n ),\n });\n }\n\n const getNodeEsmResolver = once(() =>\n (\n require('../dist-raw/node-internal-modules-esm-resolve') as typeof _nodeInternalModulesEsmResolve\n ).createResolve({\n extensions,\n preferTsExts: options.preferTsExts,\n tsNodeExperimentalSpecifierResolution:\n options.experimentalSpecifierResolution,\n })\n );\n const getNodeEsmGetFormat = once(() =>\n (\n require('../dist-raw/node-internal-modules-esm-get_format') as typeof _nodeInternalModulesEsmGetFormat\n ).createGetFormat(\n options.experimentalSpecifierResolution,\n getNodeEsmResolver()\n )\n );\n const getNodeCjsLoader = once(() =>\n (\n require('../dist-raw/node-internal-modules-cjs-loader') as typeof _nodeInternalModulesCjsLoader\n ).createCjsLoader({\n extensions,\n preferTsExts: options.preferTsExts,\n nodeEsmResolver: getNodeEsmResolver(),\n })\n );\n\n return {\n [TS_NODE_SERVICE_BRAND]: true,\n ts,\n compilerPath: compiler,\n config,\n compile,\n getTypeInfo,\n ignored,\n enabled,\n options,\n configFilePath,\n moduleTypeClassifier,\n shouldReplAwait,\n addDiagnosticFilter,\n installSourceMapSupport,\n enableExperimentalEsmLoaderInterop,\n transpileOnly,\n projectLocalResolveHelper,\n getNodeEsmResolver,\n getNodeEsmGetFormat,\n getNodeCjsLoader,\n extensions,\n };\n}\n\n/**\n * Check if the filename should be ignored.\n */\nfunction createIgnore(ignoreBaseDir: string, ignore: RegExp[]) {\n return (fileName: string) => {\n const relname = relative(ignoreBaseDir, fileName);\n const path = normalizeSlashes(relname);\n\n return ignore.some((x) => x.test(path));\n };\n}\n\n/**\n * Register the extensions to support when importing files.\n */\nfunction registerExtensions(\n preferTsExts: boolean | null | undefined,\n extensions: string[],\n service: Service,\n originalJsHandler: (m: NodeModule, filename: string) => any\n) {\n const exts = new Set(extensions);\n // Can't add these extensions cuz would allow omitting file extension; node requires ext for .cjs and .mjs\n // Unless they're already registered by something else (nyc does this):\n // then we *must* hook them or else our transformer will not be called.\n for (const cannotAdd of ['.mts', '.cts', '.mjs', '.cjs']) {\n if (exts.has(cannotAdd) && !hasOwnProperty(require.extensions, cannotAdd)) {\n // Unrecognized file exts can be transformed via the `.js` handler.\n exts.add('.js');\n exts.delete(cannotAdd);\n }\n }\n\n // Register new extensions.\n for (const ext of exts) {\n registerExtension(ext, service, originalJsHandler);\n }\n\n if (preferTsExts) {\n const preferredExtensions = new Set([\n ...exts,\n ...Object.keys(require.extensions),\n ]);\n\n // Re-sort iteration order of Object.keys()\n for (const ext of preferredExtensions) {\n const old = Object.getOwnPropertyDescriptor(require.extensions, ext);\n delete require.extensions[ext];\n Object.defineProperty(require.extensions, ext, old!);\n }\n }\n}\n\n/**\n * Register the extension for node.\n */\nfunction registerExtension(\n ext: string,\n service: Service,\n originalHandler: (m: NodeModule, filename: string) => any\n) {\n const old = require.extensions[ext] || originalHandler;\n\n require.extensions[ext] = function (m: any, filename) {\n if (service.ignored(filename)) return old(m, filename);\n\n assertScriptCanLoadAsCJS(service, m, filename);\n\n const _compile = m._compile;\n\n m._compile = function (code: string, fileName: string) {\n debug('module._compile', fileName);\n\n const result = service.compile(code, fileName);\n return _compile.call(this, result, fileName);\n };\n\n return old(m, filename);\n };\n}\n\n/**\n * Internal source output.\n */\ntype SourceOutput = [string, string, false] | [undefined, undefined, true];\n\n/**\n * Update the output remapping the source map.\n */\nfunction updateOutput(\n outputText: string,\n fileName: string,\n sourceMap: string,\n getEmitExtension: (fileName: string) => string\n) {\n const base64Map = Buffer.from(\n updateSourceMap(sourceMap, fileName),\n 'utf8'\n ).toString('base64');\n const sourceMapContent = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${base64Map}`;\n // Expected form: `//# sourceMappingURL=foo bar.js.map` or `//# sourceMappingURL=foo%20bar.js.map` for input file \"foo bar.tsx\"\n // Percent-encoding behavior added in TS 4.1.1: https://github.com/microsoft/TypeScript/issues/40951\n const prefix = '//# sourceMappingURL=';\n const prefixLength = prefix.length;\n const baseName = /*foo.tsx*/ basename(fileName);\n const extName = /*.tsx*/ extname(fileName);\n const extension = /*.js*/ getEmitExtension(fileName);\n const sourcemapFilename =\n baseName.slice(0, -extName.length) + extension + '.map';\n const sourceMapLengthWithoutPercentEncoding =\n prefixLength + sourcemapFilename.length;\n /*\n * Only rewrite if existing directive exists at the location we expect, to support:\n * a) compilers that do not append a sourcemap directive\n * b) situations where we did the math wrong\n * Not ideal, but appending our sourcemap *after* a pre-existing sourcemap still overrides, so the end-user is happy.\n */\n if (\n outputText.substr(-sourceMapLengthWithoutPercentEncoding, prefixLength) ===\n prefix\n ) {\n return (\n outputText.slice(0, -sourceMapLengthWithoutPercentEncoding) +\n sourceMapContent\n );\n }\n // If anyone asks why we're not using URL, the URL equivalent is: `u = new URL('http://d'); u.pathname = \"/\" + sourcemapFilename; return u.pathname.slice(1);\n const sourceMapLengthWithPercentEncoding =\n prefixLength + encodeURI(sourcemapFilename).length;\n if (\n outputText.substr(-sourceMapLengthWithPercentEncoding, prefixLength) ===\n prefix\n ) {\n return (\n outputText.slice(0, -sourceMapLengthWithPercentEncoding) +\n sourceMapContent\n );\n }\n\n return `${outputText}\\n${sourceMapContent}`;\n}\n\n/**\n * Update the source map contents for improved output.\n */\nfunction updateSourceMap(sourceMapText: string, fileName: string) {\n const sourceMap = JSON.parse(sourceMapText);\n sourceMap.file = fileName;\n sourceMap.sources = [fileName];\n delete sourceMap.sourceRoot;\n return JSON.stringify(sourceMap);\n}\n\n/**\n * Filter diagnostics.\n */\nfunction filterDiagnostics(\n diagnostics: readonly _ts.Diagnostic[],\n filters: DiagnosticFilter[]\n) {\n return diagnostics.filter((d) =>\n filters.every(\n (f) =>\n (!f.appliesToAllFiles &&\n f.filenamesAbsolute.indexOf(d.file?.fileName!) === -1) ||\n f.diagnosticsIgnored.indexOf(d.code) === -1\n )\n );\n}\n\n/**\n * Get token at file position.\n *\n * Reference: https://github.com/microsoft/TypeScript/blob/fcd9334f57d85b73dd66ad2d21c02e84822f4841/src/services/utilities.ts#L705-L731\n */\nfunction getTokenAtPosition(\n ts: TSCommon,\n sourceFile: _ts.SourceFile,\n position: number\n): _ts.Node {\n let current: _ts.Node = sourceFile;\n\n outer: while (true) {\n for (const child of current.getChildren(sourceFile)) {\n const start = child.getFullStart();\n if (start > position) break;\n\n const end = child.getEnd();\n if (position <= end) {\n current = child;\n continue outer;\n }\n }\n\n return current;\n }\n}\n\n/**\n * Create an implementation of node's ESM loader hooks.\n *\n * This may be useful if you\n * want to wrap or compose the loader hooks to add additional functionality or\n * combine with another loader.\n *\n * Node changed the hooks API, so there are two possible APIs. This function\n * detects your node version and returns the appropriate API.\n *\n * @category ESM Loader\n */\nexport const createEsmHooks: typeof createEsmHooksFn = (\n tsNodeService: Service\n) => (require('./esm') as typeof import('./esm')).createEsmHooks(tsNodeService);\n\n/**\n * When using `module: nodenext` or `module: node12`, there are two possible styles of emit depending in file extension or package.json \"type\":\n *\n * - CommonJS with dynamic imports preserved (not transformed into `require()` calls)\n * - ECMAScript modules with `import foo = require()` transformed into `require = createRequire(); const foo = require()`\n */\nexport type NodeModuleEmitKind = 'nodeesm' | 'nodecjs';\n"]} |