@babel/cli
Advanced tools
Comparing version 7.0.0-beta.40 to 7.0.0-beta.41
@@ -22,2 +22,4 @@ "use strict"; | ||
var compiledFiles = 0; | ||
function _default(commander, filenames, opts) { | ||
@@ -37,4 +39,3 @@ function write(src, relative, base, callback) { | ||
util.compile(src, (0, _defaults.default)({ | ||
sourceFileName: (0, _slash.default)(_path.default.relative(dest + "/..", src)), | ||
sourceMapTarget: _path.default.basename(relative) | ||
sourceFileName: (0, _slash.default)(_path.default.relative(dest + "/..", src)) | ||
}, opts), function (err, res) { | ||
@@ -47,2 +48,3 @@ if (err) return callback(err); | ||
res.code = util.addSourceMappingUrl(res.code, mapLoc); | ||
res.map.file = _path.default.basename(relative); | ||
(0, _outputFileSync.default)(mapLoc, JSON.stringify(res.map)); | ||
@@ -53,2 +55,3 @@ } | ||
util.chmod(src, dest); | ||
compiledFiles += 1; | ||
util.log(src + " -> " + dest); | ||
@@ -64,2 +67,10 @@ return callback(null, true); | ||
function outputDestFolder(outDir) { | ||
var outDirPath = _path.default.resolve(outDir); | ||
if (!_fs.default.existsSync(outDirPath)) { | ||
_fs.default.mkdirSync(outDirPath); | ||
} | ||
} | ||
function handleFile(src, filename, base, callback) { | ||
@@ -85,2 +96,7 @@ if (typeof base === "function") { | ||
function sequentialHandleFile(files, dirname, index, callback) { | ||
if (files.length === 0) { | ||
outputDestFolder(commander.outDir); | ||
return; | ||
} | ||
if (typeof index === "function") { | ||
@@ -133,3 +149,3 @@ callback = index; | ||
handle(filename, function (err) { | ||
if (err) throw err; | ||
if (err) throw new Error(err); | ||
index++; | ||
@@ -139,2 +155,4 @@ | ||
sequentialHandle(filenames, index); | ||
} else { | ||
util.log("\uD83C\uDF89 Successfully compiled " + compiledFiles + " " + (compiledFiles > 1 ? "files" : "file") + " with Babel.", true); | ||
} | ||
@@ -141,0 +159,0 @@ }); |
@@ -33,3 +33,3 @@ "use strict"; | ||
var map = new _sourceMap.default.SourceMapGenerator({ | ||
file: _path.default.basename(commander.outFile || "") || "stdout", | ||
file: commander.sourceMapTarget || _path.default.basename(commander.outFile || "") || "stdout", | ||
sourceRoot: opts.sourceRoot | ||
@@ -36,0 +36,0 @@ }); |
@@ -104,3 +104,3 @@ #!/usr/bin/env node | ||
_commander.default.option("-q, --quiet", "Don't log anything"); | ||
_commander.default.option("--verbose", "Log everything"); | ||
@@ -161,2 +161,6 @@ _commander.default.option("--delete-dir-on-start", "Delete the out directory before compilation"); | ||
if (!_commander.default.outDir && filenames.length === 0 && typeof _commander.default.filename !== "string" && _commander.default.babelrc !== false) { | ||
errors.push("stdin compilation requires either -f/--filename [filename] or --no-babelrc"); | ||
} | ||
if (errors.length) { | ||
@@ -181,3 +185,3 @@ console.error(errors.join(". ")); | ||
delete opts.includeDotfiles; | ||
delete opts.quiet; | ||
delete opts.verbose; | ||
delete opts.configFile; | ||
@@ -187,2 +191,3 @@ delete opts.deleteDirOnStart; | ||
delete opts.relative; | ||
delete opts.sourceMapTarget; | ||
if (opts.babelrc === true) opts.babelrc = undefined; | ||
@@ -189,0 +194,0 @@ if (opts.comments === true) opts.comments = undefined; |
@@ -58,4 +58,4 @@ "use strict"; | ||
function log(msg) { | ||
if (!_commander.default.quiet) console.log(msg); | ||
function log(msg, force) { | ||
if (force === true || _commander.default.verbose) console.log(msg); | ||
} | ||
@@ -62,0 +62,0 @@ |
{ | ||
"name": "@babel/cli", | ||
"version": "7.0.0-beta.40", | ||
"version": "7.0.0-beta.41", | ||
"description": "Babel command line.", | ||
@@ -32,7 +32,7 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"peerDependencies": { | ||
"@babel/core": "7.0.0-beta.40" | ||
"@babel/core": "7.0.0-beta.41" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.40", | ||
"@babel/helper-fixtures": "7.0.0-beta.40" | ||
"@babel/core": "7.0.0-beta.41", | ||
"@babel/helper-fixtures": "7.0.0-beta.41" | ||
}, | ||
@@ -39,0 +39,0 @@ "bin": { |
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
24468
540
0