Comparing version 10.9.1 to 10.9.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createSwcOptions = exports.targetMapping = exports.create = void 0; | ||
const ts_internals_1 = require("../ts-internals"); | ||
function create(createOptions) { | ||
@@ -38,5 +39,3 @@ const { swc, service: { config, projectLocalResolveHelper }, transpilerConfigLocalResolveHelper, nodeModuleEmitKind, } = createOptions; | ||
const { fileName } = transpileOptions; | ||
const swcOptions = fileName.endsWith('.tsx') || fileName.endsWith('.jsx') | ||
? tsxOptions | ||
: nonTsxOptions; | ||
const swcOptions = fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? tsxOptions : nonTsxOptions; | ||
const { code, map } = swcInstance.transformSync(input, { | ||
@@ -65,3 +64,3 @@ ...swcOptions, | ||
exports.targetMapping.set(/* ts.ScriptTarget.ES2022 */ 9, 'es2022'); | ||
exports.targetMapping.set(/* ts.ScriptTarget.ESNext */ 99, 'es2022'); | ||
exports.targetMapping.set(/* ts.ScriptTarget.ESNext */ 99, 'esnext'); | ||
/** | ||
@@ -82,2 +81,3 @@ * @internal | ||
'es2022', | ||
'esnext', | ||
]; | ||
@@ -106,3 +106,3 @@ const ModuleKind = { | ||
var _a; | ||
const { esModuleInterop, sourceMap, importHelpers, experimentalDecorators, emitDecoratorMetadata, target, module, jsx, jsxFactory, jsxFragmentFactory, strict, alwaysStrict, noImplicitUseStrict, } = compilerOptions; | ||
const { esModuleInterop, sourceMap, importHelpers, experimentalDecorators, emitDecoratorMetadata, target, module, jsx, jsxFactory, jsxFragmentFactory, strict, alwaysStrict, noImplicitUseStrict, jsxImportSource, } = compilerOptions; | ||
let swcTarget = (_a = exports.targetMapping.get(target)) !== null && _a !== void 0 ? _a : 'es3'; | ||
@@ -152,6 +152,5 @@ // Downgrade to lower target if swc does not support the selected target. | ||
: true; | ||
const jsxRuntime = jsx === JsxEmit.ReactJSX || jsx === JsxEmit.ReactJSXDev | ||
? 'automatic' | ||
: undefined; | ||
const jsxRuntime = jsx === JsxEmit.ReactJSX || jsx === JsxEmit.ReactJSXDev ? 'automatic' : undefined; | ||
const jsxDevelopment = jsx === JsxEmit.ReactJSXDev ? true : undefined; | ||
const useDefineForClassFields = (0, ts_internals_1.getUseDefineForClassFields)(compilerOptions); | ||
const nonTsxOptions = createVariant(false); | ||
@@ -166,7 +165,11 @@ const tsxOptions = createVariant(true); | ||
? { | ||
noInterop: !esModuleInterop, | ||
type: moduleType, | ||
strictMode, | ||
// For NodeNext and Node12, emit as CJS but do not transform dynamic imports | ||
ignoreDynamic: nodeModuleEmitKind === 'nodecjs', | ||
...(moduleType === 'amd' || moduleType === 'commonjs' || moduleType === 'umd' | ||
? { | ||
noInterop: !esModuleInterop, | ||
strictMode, | ||
// For NodeNext and Node12, emit as CJS but do not transform dynamic imports | ||
ignoreDynamic: nodeModuleEmitKind === 'nodecjs', | ||
} | ||
: {}), | ||
} | ||
@@ -195,7 +198,10 @@ : undefined, | ||
runtime: jsxRuntime, | ||
importSource: jsxImportSource, | ||
}, | ||
useDefineForClassFields, | ||
}, | ||
keepClassNames, | ||
experimental: { | ||
keepImportAssertions: true, | ||
keepImportAttributes: true, | ||
emitAssertForImportAttributes: true, | ||
}, | ||
@@ -202,0 +208,0 @@ }, |
@@ -1,1 +0,6 @@ | ||
export {}; | ||
import type * as _ts from 'typescript'; | ||
export declare function getUseDefineForClassFields(compilerOptions: _ts.CompilerOptions): boolean; | ||
export declare function getEmitScriptTarget(compilerOptions: { | ||
module?: _ts.CompilerOptions['module']; | ||
target?: _ts.CompilerOptions['target']; | ||
}): _ts.ScriptTarget; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPatternFromSpec = exports.createTsInternals = void 0; | ||
exports.getEmitScriptTarget = exports.getUseDefineForClassFields = exports.getPatternFromSpec = exports.createTsInternals = void 0; | ||
const path_1 = require("path"); | ||
@@ -40,6 +40,8 @@ const util_1 = require("./util"); | ||
// If the path isn't a rooted or relative path, resolve like a module | ||
const tsGte5_3_0 = (0, util_1.versionGteLt)(ts.version, '5.3.0'); | ||
const resolved = ts.nodeModuleNameResolver(extendedConfig, combinePaths(basePath, 'tsconfig.json'), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, | ||
/*cache*/ undefined, | ||
/*projectRefs*/ undefined, | ||
/*lookupConfig*/ true); | ||
/*conditionsOrIsConfigLookup*/ tsGte5_3_0 ? undefined : true, | ||
/*isConfigLookup*/ tsGte5_3_0 ? true : undefined); | ||
if (resolved.resolvedModule) { | ||
@@ -300,2 +302,22 @@ return resolved.resolvedModule.resolvedFileName; | ||
} | ||
const ts_ScriptTarget_ES5 = 1; | ||
const ts_ScriptTarget_ES2022 = 9; | ||
const ts_ScriptTarget_ESNext = 99; | ||
const ts_ModuleKind_Node16 = 100; | ||
const ts_ModuleKind_NodeNext = 199; | ||
// https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8761 | ||
function getUseDefineForClassFields(compilerOptions) { | ||
return compilerOptions.useDefineForClassFields === undefined | ||
? getEmitScriptTarget(compilerOptions) >= ts_ScriptTarget_ES2022 | ||
: compilerOptions.useDefineForClassFields; | ||
} | ||
exports.getUseDefineForClassFields = getUseDefineForClassFields; | ||
// https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8556 | ||
function getEmitScriptTarget(compilerOptions) { | ||
var _a; | ||
return ((_a = compilerOptions.target) !== null && _a !== void 0 ? _a : ((compilerOptions.module === ts_ModuleKind_Node16 && ts_ScriptTarget_ES2022) || | ||
(compilerOptions.module === ts_ModuleKind_NodeNext && ts_ScriptTarget_ESNext) || | ||
ts_ScriptTarget_ES5)); | ||
} | ||
exports.getEmitScriptTarget = getEmitScriptTarget; | ||
//# sourceMappingURL=ts-internals.js.map |
{ | ||
"name": "ts-node", | ||
"version": "10.9.1", | ||
"version": "10.9.2", | ||
"description": "TypeScript execution environment and REPL for node.js, with source map support", | ||
@@ -115,4 +115,4 @@ "main": "dist/index.js", | ||
"@microsoft/api-extractor": "^7.19.4", | ||
"@swc/core": ">=1.2.205", | ||
"@swc/wasm": ">=1.2.205", | ||
"@swc/core": "^1.3.100", | ||
"@swc/wasm": "^1.3.100", | ||
"@types/diff": "^4.0.2", | ||
@@ -119,0 +119,0 @@ "@types/lodash": "^4.14.151", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
757333
8379