@babel/cli
Advanced tools
Comparing version 7.18.10 to 7.19.3
@@ -43,2 +43,4 @@ "use strict"; | ||
console.log((0, _core().buildExternalHelpers)(_commander().whitelist, _commander().outputType)); | ||
console.log((0, _core().buildExternalHelpers)(_commander().whitelist, _commander().outputType)); | ||
//# sourceMappingURL=babel-external-helpers.js.map |
@@ -91,7 +91,21 @@ "use strict"; | ||
if (res.map && babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") { | ||
const mapLoc = dest + ".map"; | ||
res.code = util.addSourceMappingUrl(res.code, mapLoc); | ||
res.map.file = _path().basename(relative); | ||
outputFileSync(mapLoc, JSON.stringify(res.map)); | ||
if (res.map) { | ||
let outputMap = false; | ||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") { | ||
outputMap = "external"; | ||
} else if (babelOptions.sourceMaps == undefined) { | ||
outputMap = util.hasDataSourcemap(res.code) ? "external" : "both"; | ||
} | ||
if (outputMap) { | ||
const mapLoc = dest + ".map"; | ||
if (outputMap === "external") { | ||
res.code = util.addSourceMappingUrl(res.code, mapLoc); | ||
} | ||
res.map.file = _path().basename(relative); | ||
outputFileSync(mapLoc, JSON.stringify(res.map)); | ||
} | ||
} | ||
@@ -286,2 +300,4 @@ | ||
return _ref.apply(this, arguments); | ||
} | ||
} | ||
//# sourceMappingURL=dir.js.map |
@@ -79,5 +79,7 @@ "use strict"; | ||
let offset = 0; | ||
let hasRawMap = false; | ||
for (const result of fileResults) { | ||
if (!result) continue; | ||
hasRawMap = !!result.map; | ||
mapSections.push({ | ||
@@ -88,3 +90,8 @@ offset: { | ||
}, | ||
map: result.map || emptyMap() | ||
map: result.map || { | ||
version: 3, | ||
names: [], | ||
sources: [], | ||
mappings: [] | ||
} | ||
}); | ||
@@ -108,3 +115,4 @@ code += result.code + "\n"; | ||
map: map, | ||
code: code | ||
code: code, | ||
hasRawMap: hasRawMap | ||
}; | ||
@@ -124,11 +132,2 @@ } | ||
function emptyMap() { | ||
return { | ||
version: 3, | ||
names: [], | ||
sources: [], | ||
mappings: [] | ||
}; | ||
} | ||
function output(fileResults) { | ||
@@ -141,7 +140,17 @@ const result = buildResult(fileResults); | ||
}); | ||
let outputMap = false; | ||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") { | ||
outputMap = "external"; | ||
} else if (babelOptions.sourceMaps == undefined && result.hasRawMap) { | ||
outputMap = util.hasDataSourcemap(result.code) ? "external" : "both"; | ||
} | ||
if (outputMap) { | ||
const mapLoc = cliOptions.outFile + ".map"; | ||
result.code = util.addSourceMappingUrl(result.code, mapLoc); | ||
if (outputMap === "external") { | ||
result.code = util.addSourceMappingUrl(result.code, mapLoc); | ||
} | ||
_fs().writeFileSync(mapLoc, JSON.stringify((0, _traceMapping().encodedMap)(result.map))); | ||
@@ -278,2 +287,4 @@ } | ||
return _ref.apply(this, arguments); | ||
} | ||
} | ||
//# sourceMappingURL=file.js.map |
@@ -20,2 +20,4 @@ #!/usr/bin/env node | ||
process.exitCode = 2; | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -82,3 +82,3 @@ "use strict"; | ||
_commander().option("-s, --source-maps [true|false|inline|both]", "", booleanify); | ||
_commander().option("-s, --source-maps [true|false|inline|both]", "", booleanify, undefined); | ||
@@ -127,3 +127,3 @@ _commander().option("--source-map-target [string]", "Set `file` on returned source map."); | ||
_commander().version("7.18.10" + " (@babel/core " + _core().version + ")"); | ||
_commander().version("7.19.3" + " (@babel/core " + _core().version + ")"); | ||
@@ -266,2 +266,4 @@ _commander().usage("[options] <files ...>"); | ||
function booleanify(val) { | ||
if (val === undefined) return undefined; | ||
if (val === "true" || val == 1) { | ||
@@ -288,2 +290,4 @@ return true; | ||
return values; | ||
} | ||
} | ||
//# sourceMappingURL=options.js.map |
@@ -11,2 +11,3 @@ "use strict"; | ||
exports.deleteDir = deleteDir; | ||
exports.hasDataSourcemap = hasDataSourcemap; | ||
exports.isCompilableExtension = isCompilableExtension; | ||
@@ -99,2 +100,7 @@ exports.readdir = readdir; | ||
function hasDataSourcemap(code) { | ||
const pos = code.lastIndexOf("\n", code.length - 2); | ||
return pos != -1 && code.lastIndexOf("//# sourceMappingURL") < pos; | ||
} | ||
const CALLER = { | ||
@@ -183,2 +189,4 @@ name: "@babel/cli" | ||
return debounced; | ||
} | ||
} | ||
//# sourceMappingURL=util.js.map |
@@ -168,2 +168,4 @@ "use strict"; | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=watcher.js.map |
{ | ||
"name": "@babel/cli", | ||
"version": "7.18.10", | ||
"version": "7.19.3", | ||
"description": "Babel command line.", | ||
@@ -43,7 +43,8 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"devDependencies": { | ||
"@babel/core": "^7.18.10", | ||
"@babel/core": "^7.19.3", | ||
"@babel/helper-fixtures": "^7.18.6", | ||
"@types/fs-readdir-recursive": "^1.1.0", | ||
"@types/glob": "^7.2.0", | ||
"rimraf": "^3.0.0" | ||
"rimraf": "^3.0.0", | ||
"semver": "^6.3.0" | ||
}, | ||
@@ -50,0 +51,0 @@ "bin": { |
106447
20
1006
6