Comparing version 7.0.0-beta.2 to 7.0.0-beta.3
"use strict"; | ||
var _commander = require("commander"); | ||
var _commander = _interopRequireDefault(require("commander")); | ||
var _commander2 = _interopRequireDefault(_commander); | ||
var _babelCore = require("babel-core"); | ||
@@ -17,10 +15,10 @@ | ||
_commander2.default.option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect); | ||
_commander.default.option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect); | ||
_commander2.default.option("-t, --output-type [type]", "Type of output (global|umd|var)", "global"); | ||
_commander.default.option("-t, --output-type [type]", "Type of output (global|umd|var)", "global"); | ||
_commander2.default.usage("[options]"); | ||
_commander.default.usage("[options]"); | ||
_commander2.default.parse(process.argv); | ||
_commander.default.parse(process.argv); | ||
console.log((0, _babelCore.buildExternalHelpers)(_commander2.default.whitelist, _commander2.default.outputType)); | ||
console.log((0, _babelCore.buildExternalHelpers)(_commander.default.whitelist, _commander.default.outputType)); |
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = _default; | ||
exports.default = function (commander, filenames, opts) { | ||
var _defaults = _interopRequireDefault(require("lodash/defaults")); | ||
var _outputFileSync = _interopRequireDefault(require("output-file-sync")); | ||
var _slash = _interopRequireDefault(require("slash")); | ||
var _path = _interopRequireDefault(require("path")); | ||
var _fs = _interopRequireDefault(require("fs")); | ||
var util = _interopRequireWildcard(require("./util")); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _default(commander, filenames, opts) { | ||
function write(src, relative, base) { | ||
@@ -13,5 +30,5 @@ if (!util.isCompilableExtension(relative, commander.extensions)) { | ||
var dest = getDest(commander, relative, base); | ||
var data = util.compile(src, (0, _defaults2.default)({ | ||
sourceFileName: (0, _slash2.default)(_path2.default.relative(dest + "/..", src)), | ||
sourceMapTarget: _path2.default.basename(relative) | ||
var data = util.compile(src, (0, _defaults.default)({ | ||
sourceFileName: (0, _slash.default)(_path.default.relative(dest + "/..", src)), | ||
sourceMapTarget: _path.default.basename(relative) | ||
}, opts)); | ||
@@ -23,6 +40,6 @@ if (!data) return false; | ||
data.code = util.addSourceMappingUrl(data.code, mapLoc); | ||
(0, _outputFileSync2.default)(mapLoc, JSON.stringify(data.map)); | ||
(0, _outputFileSync.default)(mapLoc, JSON.stringify(data.map)); | ||
} | ||
(0, _outputFileSync2.default)(dest, data.code); | ||
(0, _outputFileSync.default)(dest, data.code); | ||
util.chmod(src, dest); | ||
@@ -34,4 +51,4 @@ util.log(src + " -> " + dest); | ||
function getDest(commander, filename, base) { | ||
if (commander.relative) return _path2.default.join(base, commander.outDir, filename); | ||
return _path2.default.join(commander.outDir, filename); | ||
if (commander.relative) return _path.default.join(base, commander.outDir, filename); | ||
return _path.default.join(commander.outDir, filename); | ||
} | ||
@@ -44,3 +61,3 @@ | ||
var dest = getDest(commander, filename, base); | ||
(0, _outputFileSync2.default)(dest, _fs2.default.readFileSync(src)); | ||
(0, _outputFileSync.default)(dest, _fs.default.readFileSync(src)); | ||
util.chmod(src, dest); | ||
@@ -51,5 +68,5 @@ } | ||
function handle(filename) { | ||
if (!_fs2.default.existsSync(filename)) return; | ||
if (!_fs.default.existsSync(filename)) return; | ||
var stat = _fs2.default.statSync(filename); | ||
var stat = _fs.default.statSync(filename); | ||
@@ -63,4 +80,4 @@ if (stat.isDirectory(filename)) { | ||
util.readdir(dirname).forEach(function (filename) { | ||
var src = _path2.default.join(dirname, filename); | ||
util.readdir(dirname, commander.includeDotfiles).forEach(function (filename) { | ||
var src = _path.default.join(dirname, filename); | ||
@@ -70,3 +87,3 @@ handleFile(src, filename, dirname); | ||
} else { | ||
write(filename, _path2.default.basename(filename), _path2.default.dirname(filename)); | ||
write(filename, _path.default.basename(filename), _path.default.dirname(filename)); | ||
} | ||
@@ -92,3 +109,3 @@ } | ||
watcher.on(type, function (filename) { | ||
var relative = _path2.default.relative(dirname, filename) || filename; | ||
var relative = _path.default.relative(dirname, filename) || filename; | ||
@@ -104,30 +121,2 @@ try { | ||
} | ||
}; | ||
var _defaults = require("lodash/defaults"); | ||
var _defaults2 = _interopRequireDefault(_defaults); | ||
var _outputFileSync = require("output-file-sync"); | ||
var _outputFileSync2 = _interopRequireDefault(_outputFileSync); | ||
var _slash = require("slash"); | ||
var _slash2 = _interopRequireDefault(_slash); | ||
var _path = require("path"); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _fs = require("fs"); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _util = require("./util"); | ||
var util = _interopRequireWildcard(_util); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
} |
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = _default; | ||
exports.default = function (commander, filenames, opts) { | ||
var _convertSourceMap = _interopRequireDefault(require("convert-source-map")); | ||
var _defaults = _interopRequireDefault(require("lodash/defaults")); | ||
var _sourceMap = _interopRequireDefault(require("source-map")); | ||
var _slash = _interopRequireDefault(require("slash")); | ||
var _path = _interopRequireDefault(require("path")); | ||
var _fs = _interopRequireDefault(require("fs")); | ||
var util = _interopRequireWildcard(require("./util")); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _default(commander, filenames, opts) { | ||
if (commander.sourceMaps === "inline") { | ||
@@ -13,4 +32,4 @@ opts.sourceMaps = true; | ||
var buildResult = function buildResult() { | ||
var map = new _sourceMap2.default.SourceMapGenerator({ | ||
file: _path2.default.basename(commander.outFile || "") || "stdout", | ||
var map = new _sourceMap.default.SourceMapGenerator({ | ||
file: _path.default.basename(commander.outFile || "") || "stdout", | ||
sourceRoot: opts.sourceRoot | ||
@@ -24,3 +43,3 @@ }); | ||
if (result.map) { | ||
var consumer = new _sourceMap2.default.SourceMapConsumer(result.map); | ||
var consumer = new _sourceMap.default.SourceMapConsumer(result.map); | ||
var sources = new Set(); | ||
@@ -53,3 +72,3 @@ consumer.eachMapping(function (mapping) { | ||
if (commander.sourceMaps === "inline" || !commander.outFile && commander.sourceMaps) { | ||
code += "\n" + _convertSourceMap2.default.fromObject(map).toComment(); | ||
code += "\n" + _convertSourceMap.default.fromObject(map).toComment(); | ||
} | ||
@@ -71,6 +90,6 @@ | ||
_fs2.default.writeFileSync(mapLoc, JSON.stringify(result.map)); | ||
_fs.default.writeFileSync(mapLoc, JSON.stringify(result.map)); | ||
} | ||
_fs2.default.writeFileSync(commander.outFile, result.code); | ||
_fs.default.writeFileSync(commander.outFile, result.code); | ||
} else { | ||
@@ -89,3 +108,3 @@ process.stdout.write(result.code + "\n"); | ||
process.stdin.on("end", function () { | ||
results.push(util.transform(commander.filename, code, (0, _defaults2.default)({ | ||
results.push(util.transform(commander.filename, code, (0, _defaults.default)({ | ||
sourceFileName: "stdin" | ||
@@ -101,10 +120,10 @@ }, opts))); | ||
filenames.forEach(function (filename) { | ||
if (!_fs2.default.existsSync(filename)) return; | ||
if (!_fs.default.existsSync(filename)) return; | ||
var stat = _fs2.default.statSync(filename); | ||
var stat = _fs.default.statSync(filename); | ||
if (stat.isDirectory()) { | ||
var dirname = filename; | ||
util.readdirFilter(filename).forEach(function (filename) { | ||
_filenames.push(_path2.default.join(dirname, filename)); | ||
util.readdirForCompilable(filename, commander.includeDotfiles).forEach(function (filename) { | ||
_filenames.push(_path.default.join(dirname, filename)); | ||
}); | ||
@@ -120,7 +139,7 @@ } else { | ||
if (commander.outFile) { | ||
sourceFilename = _path2.default.relative(_path2.default.dirname(commander.outFile), sourceFilename); | ||
sourceFilename = _path.default.relative(_path.default.dirname(commander.outFile), sourceFilename); | ||
} | ||
sourceFilename = (0, _slash2.default)(sourceFilename); | ||
var data = util.compile(filename, (0, _defaults2.default)({ | ||
sourceFilename = (0, _slash.default)(sourceFilename); | ||
var data = util.compile(filename, (0, _defaults.default)({ | ||
sourceFileName: sourceFilename | ||
@@ -172,34 +191,2 @@ }, opts)); | ||
} | ||
}; | ||
var _convertSourceMap = require("convert-source-map"); | ||
var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap); | ||
var _defaults = require("lodash/defaults"); | ||
var _defaults2 = _interopRequireDefault(_defaults); | ||
var _sourceMap = require("source-map"); | ||
var _sourceMap2 = _interopRequireDefault(_sourceMap); | ||
var _slash = require("slash"); | ||
var _slash2 = _interopRequireDefault(_slash); | ||
var _path = require("path"); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _fs = require("fs"); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _util = require("./util"); | ||
var util = _interopRequireWildcard(_util); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
} |
#!/usr/bin/env node | ||
"use strict"; | ||
var _fs = require("fs"); | ||
var _fs = _interopRequireDefault(require("fs")); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _commander = _interopRequireDefault(require("commander")); | ||
var _commander = require("commander"); | ||
var _commander2 = _interopRequireDefault(_commander); | ||
var _babelCore = require("babel-core"); | ||
var _uniq = require("lodash/uniq"); | ||
var _uniq = _interopRequireDefault(require("lodash/uniq")); | ||
var _uniq2 = _interopRequireDefault(_uniq); | ||
var _glob = _interopRequireDefault(require("glob")); | ||
var _glob = require("glob"); | ||
var _dir = _interopRequireDefault(require("./dir")); | ||
var _glob2 = _interopRequireDefault(_glob); | ||
var _file = _interopRequireDefault(require("./file")); | ||
var _dir = require("./dir"); | ||
var _package = _interopRequireDefault(require("../../package.json")); | ||
var _dir2 = _interopRequireDefault(_dir); | ||
var _file = require("./file"); | ||
var _file2 = _interopRequireDefault(_file); | ||
var _package = require("../../package.json"); | ||
var _package2 = _interopRequireDefault(_package); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -54,76 +40,78 @@ | ||
_commander2.default.option("-f, --filename [filename]", "filename to use when reading from stdin - this will be used in source-maps, errors etc"); | ||
_commander.default.option("-f, --filename [filename]", "filename to use when reading from stdin - this will be used in source-maps, errors etc"); | ||
_commander2.default.option("--presets [list]", "comma-separated list of preset names", collect); | ||
_commander.default.option("--presets [list]", "comma-separated list of preset names", collect); | ||
_commander2.default.option("--plugins [list]", "comma-separated list of plugin names", collect); | ||
_commander.default.option("--plugins [list]", "comma-separated list of plugin names", collect); | ||
_commander2.default.option("--config-file [path]", "Path a to .babelrc file to use"); | ||
_commander.default.option("--config-file [path]", "Path a to .babelrc file to use"); | ||
_commander2.default.option("--source-type [script|module]", ""); | ||
_commander.default.option("--source-type [script|module]", ""); | ||
_commander2.default.option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files"); | ||
_commander.default.option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files"); | ||
_commander2.default.option("--ignore [list]", "list of glob paths to **not** compile", collect); | ||
_commander.default.option("--ignore [list]", "list of glob paths to **not** compile", collect); | ||
_commander2.default.option("--only [list]", "list of glob paths to **only** compile", collect); | ||
_commander.default.option("--only [list]", "list of glob paths to **only** compile", collect); | ||
_commander2.default.option("--no-highlight-code", "enable/disable ANSI syntax highlighting of code frames (on by default)"); | ||
_commander.default.option("--no-highlight-code", "enable/disable ANSI syntax highlighting of code frames (on by default)"); | ||
_commander2.default.option("--no-comments", "write comments to generated output (true by default)"); | ||
_commander.default.option("--no-comments", "write comments to generated output (true by default)"); | ||
_commander2.default.option("--retain-lines", "retain line numbers - will result in really ugly code"); | ||
_commander.default.option("--retain-lines", "retain line numbers - will result in really ugly code"); | ||
_commander2.default.option("--compact [true|false|auto]", "do not include superfluous whitespace characters and line terminators", booleanify); | ||
_commander.default.option("--compact [true|false|auto]", "do not include superfluous whitespace characters and line terminators", booleanify); | ||
_commander2.default.option("--minified", "save as much bytes when printing [true|false]"); | ||
_commander.default.option("--minified", "save as much bytes when printing [true|false]"); | ||
_commander2.default.option("--auxiliary-comment-before [string]", "print a comment before any injected non-user code"); | ||
_commander.default.option("--auxiliary-comment-before [string]", "print a comment before any injected non-user code"); | ||
_commander2.default.option("--auxiliary-comment-after [string]", "print a comment after any injected non-user code"); | ||
_commander.default.option("--auxiliary-comment-after [string]", "print a comment after any injected non-user code"); | ||
_commander2.default.option("-s, --source-maps [true|false|inline|both]", "", booleanify); | ||
_commander.default.option("-s, --source-maps [true|false|inline|both]", "", booleanify); | ||
_commander2.default.option("--source-map-target [string]", "set `file` on returned source map"); | ||
_commander.default.option("--source-map-target [string]", "set `file` on returned source map"); | ||
_commander2.default.option("--source-file-name [string]", "set `sources[0]` on returned source map"); | ||
_commander.default.option("--source-file-name [string]", "set `sources[0]` on returned source map"); | ||
_commander2.default.option("--source-root [filename]", "the root from which all sources are relative"); | ||
_commander.default.option("--source-root [filename]", "the root from which all sources are relative"); | ||
_commander2.default.option("--module-root [filename]", "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"); | ||
_commander.default.option("--module-root [filename]", "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"); | ||
_commander2.default.option("-M, --module-ids", "insert an explicit id for modules"); | ||
_commander.default.option("-M, --module-ids", "insert an explicit id for modules"); | ||
_commander2.default.option("--module-id [string]", "specify a custom name for module ids"); | ||
_commander.default.option("--module-id [string]", "specify a custom name for module ids"); | ||
_commander2.default.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", collect); | ||
_commander.default.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", collect); | ||
_commander2.default.option("--keep-file-extension", "Preserve the file extensions of the input files"); | ||
_commander.default.option("--keep-file-extension", "Preserve the file extensions of the input files"); | ||
_commander2.default.option("-w, --watch", "Recompile files on changes"); | ||
_commander.default.option("-w, --watch", "Recompile files on changes"); | ||
_commander2.default.option("--skip-initial-build", "Do not compile files before watching"); | ||
_commander.default.option("--skip-initial-build", "Do not compile files before watching"); | ||
_commander2.default.option("-o, --out-file [out]", "Compile all input files into a single file"); | ||
_commander.default.option("-o, --out-file [out]", "Compile all input files into a single file"); | ||
_commander2.default.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory"); | ||
_commander.default.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory"); | ||
_commander2.default.option("--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]"); | ||
_commander.default.option("--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]"); | ||
_commander2.default.option("-D, --copy-files", "When compiling a directory copy over non-compilable files"); | ||
_commander.default.option("-D, --copy-files", "When compiling a directory copy over non-compilable files"); | ||
_commander2.default.option("-q, --quiet", "Don't log anything"); | ||
_commander.default.option("--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files"); | ||
_commander2.default.option("--delete-dir-on-start", "Delete's the out directory before compilation"); | ||
_commander.default.option("-q, --quiet", "Don't log anything"); | ||
_commander2.default.version(_package2.default.version + " (babel-core " + _babelCore.version + ")"); | ||
_commander.default.option("--delete-dir-on-start", "Delete the out directory before compilation"); | ||
_commander2.default.usage("[options] <files ...>"); | ||
_commander.default.version(_package.default.version + " (babel-core " + _babelCore.version + ")"); | ||
_commander2.default.parse(process.argv); | ||
_commander.default.usage("[options] <files ...>"); | ||
_commander.default.parse(process.argv); | ||
var errors = []; | ||
var filenames = _commander2.default.args.reduce(function (globbed, input) { | ||
var files = _glob2.default.sync(input); | ||
var filenames = _commander.default.args.reduce(function (globbed, input) { | ||
var files = _glob.default.sync(input); | ||
@@ -134,5 +122,5 @@ if (!files.length) files = [input]; | ||
filenames = (0, _uniq2.default)(filenames); | ||
filenames = (0, _uniq.default)(filenames); | ||
filenames.forEach(function (filename) { | ||
if (!_fs2.default.existsSync(filename)) { | ||
if (!_fs.default.existsSync(filename)) { | ||
errors.push(filename + " doesn't exist"); | ||
@@ -142,16 +130,16 @@ } | ||
if (_commander2.default.outDir && !filenames.length) { | ||
if (_commander.default.outDir && !filenames.length) { | ||
errors.push("filenames required for --out-dir"); | ||
} | ||
if (_commander2.default.outFile && _commander2.default.outDir) { | ||
if (_commander.default.outFile && _commander.default.outDir) { | ||
errors.push("cannot have --out-file and --out-dir"); | ||
} | ||
if (_commander2.default.relative && !_commander2.default.outDir) { | ||
if (_commander.default.relative && !_commander.default.outDir) { | ||
errors.push("output directory required for --relative"); | ||
} | ||
if (_commander2.default.watch) { | ||
if (!_commander2.default.outFile && !_commander2.default.outDir) { | ||
if (_commander.default.watch) { | ||
if (!_commander.default.outFile && !_commander.default.outDir) { | ||
errors.push("--watch requires --out-file or --out-dir"); | ||
@@ -165,7 +153,7 @@ } | ||
if (_commander2.default.skipInitialBuild && !_commander2.default.watch) { | ||
if (_commander.default.skipInitialBuild && !_commander.default.watch) { | ||
errors.push("--skip-initial-build requires --watch"); | ||
} | ||
if (_commander2.default.deleteDirOnStart && !_commander2.default.outDir) { | ||
if (_commander.default.deleteDirOnStart && !_commander.default.outDir) { | ||
errors.push("--delete-dir-on-start requires --out-dir"); | ||
@@ -179,3 +167,3 @@ } | ||
var opts = _commander2.default.opts(); | ||
var opts = _commander.default.opts(); | ||
@@ -193,2 +181,3 @@ if (opts.configFile) { | ||
delete opts.copyFiles; | ||
delete opts.includeDotfiles; | ||
delete opts.quiet; | ||
@@ -201,3 +190,3 @@ delete opts.configFile; | ||
if (opts.highlightCode === true) opts.highlightCode = undefined; | ||
var fn = _commander2.default.outDir ? _dir2.default : _file2.default; | ||
fn(_commander2.default, filenames, opts); | ||
var fn = _commander.default.outDir ? _dir.default : _file.default; | ||
fn(_commander.default, filenames, opts); |
"use strict"; | ||
exports.__esModule = true; | ||
exports.readdir = undefined; | ||
exports.chmod = chmod; | ||
exports.readdirFilter = readdirFilter; | ||
exports.readdir = readdir; | ||
exports.readdirForCompilable = readdirForCompilable; | ||
exports.isCompilableExtension = isCompilableExtension; | ||
@@ -16,26 +16,14 @@ exports.addSourceMappingUrl = addSourceMappingUrl; | ||
var _commander = require("commander"); | ||
var _commander = _interopRequireDefault(require("commander")); | ||
var _commander2 = _interopRequireDefault(_commander); | ||
var _fsReaddirRecursive = _interopRequireDefault(require("fs-readdir-recursive")); | ||
var _fsReaddirRecursive = require("fs-readdir-recursive"); | ||
var babel = _interopRequireWildcard(require("babel-core")); | ||
var _fsReaddirRecursive2 = _interopRequireDefault(_fsReaddirRecursive); | ||
var _includes = _interopRequireDefault(require("lodash/includes")); | ||
var _babelCore = require("babel-core"); | ||
var _path = _interopRequireDefault(require("path")); | ||
var babel = _interopRequireWildcard(_babelCore); | ||
var _fs = _interopRequireDefault(require("fs")); | ||
var _includes = require("lodash/includes"); | ||
var _includes2 = _interopRequireDefault(_includes); | ||
var _path = require("path"); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _fs = require("fs"); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -46,12 +34,14 @@ | ||
function chmod(src, dest) { | ||
_fs2.default.chmodSync(dest, _fs2.default.statSync(src).mode); | ||
_fs.default.chmodSync(dest, _fs.default.statSync(src).mode); | ||
} | ||
function readdirFilter(filename) { | ||
return (0, _fsReaddirRecursive2.default)(filename).filter(function (filename) { | ||
return isCompilableExtension(filename); | ||
function readdir(dirname, includeDotfiles, filter) { | ||
return (0, _fsReaddirRecursive.default)(dirname, function (filename) { | ||
return (includeDotfiles || filename[0] !== ".") && (!filter || filter(filename)); | ||
}); | ||
} | ||
exports.readdir = _fsReaddirRecursive2.default; | ||
function readdirForCompilable(dirname, includeDotfiles) { | ||
return readdir(dirname, includeDotfiles, isCompilableExtension); | ||
} | ||
@@ -61,13 +51,13 @@ function isCompilableExtension(filename, altExts) { | ||
var ext = _path2.default.extname(filename); | ||
var ext = _path.default.extname(filename); | ||
return (0, _includes2.default)(exts, ext); | ||
return (0, _includes.default)(exts, ext); | ||
} | ||
function addSourceMappingUrl(code, loc) { | ||
return code + "\n//# sourceMappingURL=" + _path2.default.basename(loc); | ||
return code + "\n//# sourceMappingURL=" + _path.default.basename(loc); | ||
} | ||
function log(msg) { | ||
if (!_commander2.default.quiet) console.log(msg); | ||
if (!_commander.default.quiet) console.log(msg); | ||
} | ||
@@ -86,4 +76,4 @@ | ||
} catch (err) { | ||
if (_commander2.default.watch) { | ||
console.error(toErrorStack(err)); | ||
if (_commander.default.watch) { | ||
console.error(err); | ||
return { | ||
@@ -99,27 +89,19 @@ ignored: true | ||
function deleteDir(path) { | ||
if (_fs2.default.existsSync(path)) { | ||
_fs2.default.readdirSync(path).forEach(function (file) { | ||
if (_fs.default.existsSync(path)) { | ||
_fs.default.readdirSync(path).forEach(function (file) { | ||
var curPath = path + "/" + file; | ||
if (_fs2.default.lstatSync(curPath).isDirectory()) { | ||
if (_fs.default.lstatSync(curPath).isDirectory()) { | ||
deleteDir(curPath); | ||
} else { | ||
_fs2.default.unlinkSync(curPath); | ||
_fs.default.unlinkSync(curPath); | ||
} | ||
}); | ||
_fs2.default.rmdirSync(path); | ||
_fs.default.rmdirSync(path); | ||
} | ||
} | ||
function toErrorStack(err) { | ||
if (err._babel && err instanceof SyntaxError) { | ||
return err.name + ": " + err.message + "\n" + err.codeFrame; | ||
} else { | ||
return err.stack; | ||
} | ||
} | ||
process.on("uncaughtException", function (err) { | ||
console.error(toErrorStack(err)); | ||
console.error(err); | ||
process.exit(1); | ||
@@ -126,0 +108,0 @@ }); |
{ | ||
"name": "babel-cli", | ||
"version": "7.0.0-beta.2", | ||
"version": "7.0.0-beta.3", | ||
"description": "Babel command line.", | ||
@@ -19,5 +19,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"dependencies": { | ||
"babel-core": "7.0.0-beta.2", | ||
"babel-polyfill": "7.0.0-beta.2", | ||
"babel-register": "7.0.0-beta.2", | ||
"babel-core": "7.0.0-beta.3", | ||
"commander": "^2.8.1", | ||
@@ -36,3 +34,3 @@ "convert-source-map": "^1.1.0", | ||
"devDependencies": { | ||
"babel-helper-fixtures": "7.0.0-beta.2" | ||
"babel-helper-fixtures": "7.0.0-beta.3" | ||
}, | ||
@@ -39,0 +37,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
10
21333
469
+ Addedbabel-code-frame@7.0.0-beta.3(transitive)
+ Addedbabel-core@7.0.0-beta.3(transitive)
+ Addedbabel-generator@7.0.0-beta.3(transitive)
+ Addedbabel-helper-function-name@7.0.0-beta.3(transitive)
+ Addedbabel-helper-get-function-arity@7.0.0-beta.3(transitive)
+ Addedbabel-helpers@7.0.0-beta.3(transitive)
+ Addedbabel-template@7.0.0-beta.3(transitive)
+ Addedbabel-traverse@7.0.0-beta.3(transitive)
+ Addedbabel-types@7.0.0-beta.3(transitive)
+ Addedbabylon@7.0.0-beta.27(transitive)
- Removedbabel-polyfill@7.0.0-beta.2
- Removedbabel-register@7.0.0-beta.2
- Removedbabel-code-frame@7.0.0-beta.2(transitive)
- Removedbabel-core@7.0.0-beta.2(transitive)
- Removedbabel-generator@7.0.0-beta.2(transitive)
- Removedbabel-helper-function-name@7.0.0-beta.2(transitive)
- Removedbabel-helper-get-function-arity@7.0.0-beta.2(transitive)
- Removedbabel-helpers@7.0.0-beta.2(transitive)
- Removedbabel-messages@7.0.0-beta.2(transitive)
- Removedbabel-polyfill@7.0.0-beta.2(transitive)
- Removedbabel-register@7.0.0-beta.2(transitive)
- Removedbabel-template@7.0.0-beta.2(transitive)
- Removedbabel-traverse@7.0.0-beta.2(transitive)
- Removedbabel-types@7.0.0-beta.2(transitive)
- Removedbabylon@7.0.0-beta.25(transitive)
- Removedcommondir@1.0.1(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedfind-cache-dir@1.0.0(transitive)
- Removedfind-up@2.1.0(transitive)
- Removedhome-or-tmp@3.0.0(transitive)
- Removedlocate-path@2.0.0(transitive)
- Removedmake-dir@1.3.0(transitive)
- Removednode-modules-regexp@1.0.0(transitive)
- Removedp-limit@1.3.0(transitive)
- Removedp-locate@2.0.0(transitive)
- Removedp-try@1.0.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedpirates@3.0.2(transitive)
- Removedpkg-dir@2.0.0(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedsource-map-support@0.4.18(transitive)
Updatedbabel-core@7.0.0-beta.3