Comparing version 0.3.12 to 0.3.13
@@ -46,6 +46,20 @@ "use strict"; | ||
output.code += `\n//# sourceMappingURL=${(0, _slash.default)((0, _path.relative)(destDir, sourceMapPath))}`; | ||
let dts; | ||
// TODO: Remove once fixed in core | ||
if (output.output) { | ||
const json = JSON.parse(output.output); | ||
if (json.__swc_isolated_declarations__) { | ||
dts = json.__swc_isolated_declarations__; | ||
} | ||
} | ||
let dtsPath; | ||
if (dts) { | ||
dtsPath = (0, _path.join)(destDir, (0, _path.basename)(destFile) + ".d.ts"); | ||
} | ||
return { | ||
sourceMap: output.map, | ||
sourceMapPath, | ||
sourceCode: output.code | ||
sourceCode: output.code, | ||
dts, | ||
dtsPath | ||
}; | ||
@@ -55,3 +69,3 @@ } | ||
const destDir = (0, _path.dirname)(destFile); | ||
const { sourceMap, sourceMapPath, sourceCode } = withSourceMap(output, options, destFile, destDir); | ||
const { sourceMap, sourceMapPath, sourceCode, dts, dtsPath } = withSourceMap(output, options, destFile, destDir); | ||
await mkdir(destDir, { | ||
@@ -61,16 +75,15 @@ recursive: true | ||
const { mode } = await stat(sourceFile); | ||
if (!sourceMapPath) { | ||
await writeFile(destFile, sourceCode, { | ||
const dtsPromise = dts ? writeFile(dtsPath, dts, { | ||
mode | ||
}) : Promise.resolve(); | ||
const sourceMapPromise = sourceMapPath ? writeFile(sourceMapPath, sourceMap, { | ||
mode | ||
}) : Promise.resolve(); | ||
await Promise.all([ | ||
writeFile(destFile, sourceCode, { | ||
mode | ||
}); | ||
} else { | ||
await Promise.all([ | ||
writeFile(destFile, sourceCode, { | ||
mode | ||
}), | ||
writeFile(sourceMapPath, sourceMap, { | ||
mode | ||
}) | ||
]); | ||
} | ||
}), | ||
dtsPromise, | ||
sourceMapPromise | ||
]); | ||
} | ||
@@ -77,0 +90,0 @@ async function compile(filename, opts, sync, outputPath) { |
{ | ||
"name": "@swc/cli", | ||
"version": "0.3.12", | ||
"version": "0.3.13", | ||
"description": "CLI for the swc project", | ||
@@ -46,4 +46,5 @@ "main": "lib/swc/index.js", | ||
"devDependencies": { | ||
"@swc/cli": "=0.3.6", | ||
"@swc/core": "^1.3.107", | ||
"@swc/cli": "=0.3.12", | ||
"@swc/core": "^1.6.4", | ||
"@swc/types": "^0.1.9", | ||
"@types/jest": "^29.5.0", | ||
@@ -50,0 +51,0 @@ "@types/node": "^20.11.5", |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
170720
1728
1
12