Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-cli

Package Overview
Dependencies
Maintainers
5
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-cli - npm Package Compare versions

Comparing version 7.0.0-alpha.20 to 7.0.0-beta.0

4

lib/babel-node.js

@@ -54,2 +54,6 @@ "use strict";

case "--expose-http2":
args.unshift("--expose-http2");
break;
case "--nolazy":

@@ -56,0 +60,0 @@ args.unshift(flag);

29

lib/babel/dir.js

@@ -6,3 +6,3 @@ "use strict";

exports.default = function (commander, filenames, opts) {
function write(src, relative) {
function write(src, relative, base) {
if (!util.isCompilableExtension(relative, commander.extensions)) {

@@ -12,6 +12,4 @@ return false;

relative = relative.replace(/\.(\w*?)$/, "") + ".js";
var dest = _path2.default.join(commander.outDir, relative);
relative = util.adjustRelative(relative, commander.keepFileExtension);
var dest = getDest(commander, relative, base);
var data = util.compile(src, (0, _defaults2.default)({

@@ -35,8 +33,12 @@ sourceFileName: (0, _slash2.default)(_path2.default.relative(dest + "/..", src)),

function handleFile(src, filename) {
var didWrite = write(src, filename);
function getDest(commander, filename, base) {
if (commander.relative) return _path2.default.join(base, commander.outDir, filename);
return _path2.default.join(commander.outDir, filename);
}
function handleFile(src, filename, base) {
var didWrite = write(src, filename, base);
if (!didWrite && commander.copyFiles) {
var dest = _path2.default.join(commander.outDir, filename);
var dest = getDest(commander, filename, base);
(0, _outputFileSync2.default)(dest, _fs2.default.readFileSync(src));

@@ -54,9 +56,14 @@ util.chmod(src, dest);

var dirname = filename;
if (commander.deleteDirOnStart) {
util.deleteDir(commander.outDir);
}
util.readdir(dirname).forEach(function (filename) {
var src = _path2.default.join(dirname, filename);
handleFile(src, filename);
handleFile(src, filename, dirname);
});
} else {
write(filename, filename);
write(filename, _path2.default.basename(filename), _path2.default.dirname(filename));
}

@@ -63,0 +70,0 @@ }

@@ -100,2 +100,4 @@ #!/usr/bin/env node

_commander2.default.option("--keep-file-extension", "Preserve the file extensions of the input files");
_commander2.default.option("-w, --watch", "Recompile files on changes");

@@ -109,2 +111,4 @@

_commander2.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");

@@ -114,2 +118,4 @@

_commander2.default.option("--delete-dir-on-start", "Delete's the out directory before compilation");
_commander2.default.version(_package2.default.version + " (babel-core " + _babelCore.version + ")");

@@ -145,2 +151,6 @@

if (_commander2.default.relative && !_commander2.default.outDir) {
errors.push("output directory required for --relative");
}
if (_commander2.default.watch) {

@@ -160,2 +170,6 @@ if (!_commander2.default.outFile && !_commander2.default.outDir) {

if (_commander2.default.deleteDirOnStart && !_commander2.default.outDir) {
errors.push("--delete-dir-on-start requires --out-dir");
}
if (errors.length) {

@@ -181,2 +195,4 @@ console.error(errors.join(". "));

delete opts.configFile;
delete opts.deleteDirOnStart;
delete opts.keepFileExtension;
if (opts.babelrc === true) opts.babelrc = undefined;

@@ -183,0 +199,0 @@ if (opts.comments === true) opts.comments = undefined;

@@ -12,3 +12,5 @@ "use strict";

exports.compile = compile;
exports.deleteDir = deleteDir;
exports.requireChokidar = requireChokidar;
exports.adjustRelative = adjustRelative;

@@ -93,2 +95,18 @@ var _commander = require("commander");

function deleteDir(path) {
if (_fs2.default.existsSync(path)) {
_fs2.default.readdirSync(path).forEach(function (file) {
var curPath = path + "/" + file;
if (_fs2.default.lstatSync(curPath).isDirectory()) {
deleteDir(curPath);
} else {
_fs2.default.unlinkSync(curPath);
}
});
_fs2.default.rmdirSync(path);
}
}
function toErrorStack(err) {

@@ -114,2 +132,10 @@ if (err._babel && err instanceof SyntaxError) {

}
}
function adjustRelative(relative, keepFileExtension) {
if (keepFileExtension) {
return relative;
}
return relative.replace(/\.(\w*?)$/, "") + ".js";
}
{
"name": "babel-cli",
"version": "7.0.0-alpha.20",
"version": "7.0.0-beta.0",
"description": "Babel command line.",

@@ -19,5 +19,5 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"dependencies": {
"babel-core": "7.0.0-alpha.20",
"babel-polyfill": "7.0.0-alpha.20",
"babel-register": "7.0.0-alpha.20",
"babel-core": "7.0.0-beta.0",
"babel-polyfill": "7.0.0-beta.0",
"babel-register": "7.0.0-beta.0",
"commander": "^2.8.1",

@@ -37,3 +37,3 @@ "convert-source-map": "^1.1.0",

"devDependencies": {
"babel-helper-fixtures": "7.0.0-alpha.20"
"babel-helper-fixtures": "7.0.0-beta.0"
},

@@ -40,0 +40,0 @@ "bin": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc