@swc-node/register
Advanced tools
Comparing version 1.6.6 to 1.6.7
@@ -38,2 +38,3 @@ "use strict"; | ||
const expected = { | ||
baseUrl: process.cwd(), | ||
module: 'es6', | ||
@@ -118,2 +119,3 @@ sourcemap: false, | ||
const expected = { | ||
baseUrl: (0, path_1.join)(process.cwd(), options.baseUrl), | ||
module: 'commonjs', | ||
@@ -120,0 +122,0 @@ sourcemap: 'inline', |
@@ -120,3 +120,3 @@ "use strict"; | ||
function tsCompilerOptionsToSwcConfig(options, filename) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
const isJsx = filename.endsWith('.tsx') || filename.endsWith('.jsx') || Boolean(options.jsx); | ||
@@ -143,3 +143,4 @@ return { | ||
: undefined, | ||
paths: Object.fromEntries(Object.entries((_h = options.paths) !== null && _h !== void 0 ? _h : {}).map(([aliasKey, aliasPaths]) => { | ||
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]) => { | ||
var _a; | ||
@@ -146,0 +147,0 @@ return [ |
@@ -66,4 +66,16 @@ "use strict"; | ||
} | ||
else if (async) { | ||
return (0, core_1.transform)(sourcecode, filename, (0, read_default_tsconfig_1.tsCompilerOptionsToSwcConfig)(options, filename)).then(({ code, map }) => { | ||
let swcRegisterConfig; | ||
if (process.env.SWCRC) { | ||
// when SWCRC environment variable is set to true it will use swcrc file | ||
swcRegisterConfig = { | ||
swc: { | ||
swcrc: true, | ||
}, | ||
}; | ||
} | ||
else { | ||
swcRegisterConfig = (0, read_default_tsconfig_1.tsCompilerOptionsToSwcConfig)(options, filename); | ||
} | ||
if (async) { | ||
return (0, core_1.transform)(sourcecode, filename, swcRegisterConfig).then(({ code, map }) => { | ||
return injectInlineSourceMap({ filename, code, map }); | ||
@@ -73,14 +85,2 @@ }); | ||
else { | ||
let swcRegisterConfig; | ||
if (process.env.SWCRC) { | ||
// when SWCRC environment variable is set to true it will use swcrc file | ||
swcRegisterConfig = { | ||
swc: { | ||
swcrc: true, | ||
}, | ||
}; | ||
} | ||
else { | ||
swcRegisterConfig = (0, read_default_tsconfig_1.tsCompilerOptionsToSwcConfig)(options, filename); | ||
} | ||
const { code, map } = (0, core_1.transformSync)(sourcecode, filename, swcRegisterConfig); | ||
@@ -87,0 +87,0 @@ return injectInlineSourceMap({ filename, code, map }); |
{ | ||
"name": "@swc-node/register", | ||
"version": "1.6.6", | ||
"version": "1.6.7", | ||
"description": "SWC node register", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@swc-node/core": "^1.10.4", | ||
"@swc-node/core": "^1.10.5", | ||
"@swc-node/sourcemap-support": "^0.3.0", | ||
@@ -56,3 +56,3 @@ "colorette": "^2.0.19", | ||
"devDependencies": { | ||
"@swc/core": "^1.3.49", | ||
"@swc/core": "^1.3.78", | ||
"@swc/helpers": "^0.5.0", | ||
@@ -82,3 +82,3 @@ "@types/debug": "^4.1.7", | ||
}, | ||
"gitHead": "ba8f60db2106a84ee02b79a8b0b71ae8e1e43069" | ||
"gitHead": "9f674cd67091192b1fe62befd13cf4b61a6377e5" | ||
} |
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
Sorry, the diff of this file is not supported yet
143212
722
Updated@swc-node/core@^1.10.5