@swc-node/register
Advanced tools
Comparing version 1.6.8 to 1.8.0
@@ -43,5 +43,7 @@ "use strict"; | ||
emitDecoratorMetadata: false, | ||
useDefineForClassFields: false, | ||
esModuleInterop: false, | ||
dynamicImport: true, | ||
externalHelpers: false, | ||
ignoreDynamic: false, | ||
jsx: true, | ||
@@ -125,4 +127,6 @@ paths: {}, | ||
emitDecoratorMetadata: options.emitDecoratorMetadata, | ||
useDefineForClassFields: false, | ||
esModuleInterop: options.esModuleInterop, | ||
externalHelpers: true, | ||
ignoreDynamic: false, | ||
dynamicImport: true, | ||
@@ -129,0 +133,0 @@ keepClassNames: true, |
@@ -119,8 +119,17 @@ "use strict"; | ||
} | ||
/** | ||
* The default value for useDefineForClassFields depends on the emit target | ||
* @see https://www.typescriptlang.org/tsconfig#useDefineForClassFields | ||
*/ | ||
function getUseDefineForClassFields(compilerOptions, target) { | ||
var _a; | ||
return (_a = compilerOptions.useDefineForClassFields) !== null && _a !== void 0 ? _a : target >= ts.ScriptTarget.ES2022; | ||
} | ||
function tsCompilerOptionsToSwcConfig(options, filename) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
const isJsx = filename.endsWith('.tsx') || filename.endsWith('.jsx') || Boolean(options.jsx); | ||
const target = (_a = options.target) !== null && _a !== void 0 ? _a : ts.ScriptTarget.ES2018; | ||
return { | ||
module: toModule((_a = options.module) !== null && _a !== void 0 ? _a : ts.ModuleKind.ES2015), | ||
target: toTsTarget((_b = options.target) !== null && _b !== void 0 ? _b : ts.ScriptTarget.ES2018), | ||
module: toModule((_b = options.module) !== null && _b !== void 0 ? _b : ts.ModuleKind.ES2015), | ||
target: toTsTarget(target), | ||
jsx: isJsx, | ||
@@ -130,2 +139,3 @@ sourcemap: options.sourceMap && options.inlineSourceMap ? 'inline' : Boolean(options.sourceMap), | ||
emitDecoratorMetadata: (_d = options.emitDecoratorMetadata) !== null && _d !== void 0 ? _d : false, | ||
useDefineForClassFields: getUseDefineForClassFields(options, target), | ||
esModuleInterop: (_e = options.esModuleInterop) !== null && _e !== void 0 ? _e : false, | ||
@@ -135,13 +145,13 @@ dynamicImport: true, | ||
externalHelpers: Boolean(options.importHelpers), | ||
react: options.jsxFactory || options.jsxFragmentFactory || options.jsx || options.jsxImportSource | ||
react: ((_h = (_g = (_f = options.jsxFactory) !== null && _f !== void 0 ? _f : options.jsxFragmentFactory) !== null && _g !== void 0 ? _g : options.jsx) !== null && _h !== void 0 ? _h : options.jsxImportSource) | ||
? { | ||
pragma: options.jsxFactory, | ||
pragmaFrag: options.jsxFragmentFactory, | ||
importSource: (_f = options.jsxImportSource) !== null && _f !== void 0 ? _f : 'react', | ||
runtime: ((_g = options.jsx) !== null && _g !== void 0 ? _g : 0) >= ts.JsxEmit.ReactJSX ? 'automatic' : 'classic', | ||
importSource: (_j = options.jsxImportSource) !== null && _j !== void 0 ? _j : 'react', | ||
runtime: ((_k = options.jsx) !== null && _k !== void 0 ? _k : 0) >= ts.JsxEmit.ReactJSX ? 'automatic' : 'classic', | ||
useBuiltins: true, | ||
} | ||
: undefined, | ||
baseUrl: (0, path_1.resolve)((_h = options.baseUrl) !== null && _h !== void 0 ? _h : './'), | ||
paths: Object.fromEntries(Object.entries((_j = options.paths) !== null && _j !== void 0 ? _j : {}).map(([aliasKey, aliasPaths]) => { | ||
baseUrl: (0, path_1.resolve)((_l = options.baseUrl) !== null && _l !== void 0 ? _l : './'), | ||
paths: Object.fromEntries(Object.entries((_m = options.paths) !== null && _m !== void 0 ? _m : {}).map(([aliasKey, aliasPaths]) => { | ||
var _a; | ||
@@ -153,2 +163,3 @@ return [ | ||
})), | ||
ignoreDynamic: Boolean(process.env.SWC_NODE_IGNORE_DYNAMIC), | ||
swc: { | ||
@@ -155,0 +166,0 @@ sourceRoot: options.sourceRoot, |
@@ -91,3 +91,3 @@ "use strict"; | ||
if (!process.env.SWCRC) { | ||
options = (0, read_default_tsconfig_1.readDefaultTsConfig)(); | ||
options = Object.keys(options).length ? options : (0, read_default_tsconfig_1.readDefaultTsConfig)(); | ||
} | ||
@@ -94,0 +94,0 @@ options.module = ts.ModuleKind.CommonJS; |
{ | ||
"name": "@swc-node/register", | ||
"version": "1.6.8", | ||
"version": "1.8.0", | ||
"description": "SWC node register", | ||
@@ -43,8 +43,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@swc-node/core": "^1.10.6", | ||
"@swc-node/sourcemap-support": "^0.3.0", | ||
"colorette": "^2.0.19", | ||
"@swc-node/core": "^1.12.0", | ||
"@swc-node/sourcemap-support": "^0.4.0", | ||
"colorette": "^2.0.20", | ||
"debug": "^4.3.4", | ||
"pirates": "^4.0.5", | ||
"tslib": "^2.5.0" | ||
"pirates": "^4.0.6", | ||
"tslib": "^2.6.2" | ||
}, | ||
@@ -56,8 +56,8 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@swc/core": "^1.3.78", | ||
"@swc/helpers": "^0.5.0", | ||
"@types/debug": "^4.1.7", | ||
"@swc/core": "^1.3.107", | ||
"@swc/helpers": "^0.5.3", | ||
"@types/debug": "^4.1.12", | ||
"lodash": "^4.17.21", | ||
"sinon": "^15.0.3", | ||
"typescript": "^5.0.4" | ||
"sinon": "^17.0.1", | ||
"typescript": "^5.3.3" | ||
}, | ||
@@ -80,5 +80,8 @@ "funding": { | ||
"import": "./esm/esm.mjs" | ||
}, | ||
"./esm-register": { | ||
"import": "./esm/esm-register.mjs" | ||
} | ||
}, | ||
"gitHead": "cc3d1da4f732e21c64e749766328705d4f6cfad5" | ||
"gitHead": "28c0a9969942499c2dc9a2883360146de14ef907" | ||
} |
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 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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
32
677
113975
22
+ Added@swc-node/sourcemap-support@0.4.0(transitive)
- Removed@swc-node/sourcemap-support@0.3.0(transitive)
Updated@swc-node/core@^1.12.0
Updatedcolorette@^2.0.20
Updatedpirates@^4.0.6
Updatedtslib@^2.6.2