Socket
Socket
Sign inDemoInstall

babel-core

Package Overview
Dependencies
77
Maintainers
5
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0-alpha.19 to 7.0.0-alpha.20

18

lib/config/build-config-chain.js

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

var _debug = require("debug");
var _debug2 = _interopRequireDefault(_debug);
var _files = require("./loading/files");

@@ -24,2 +28,4 @@

var debug = (0, _debug2.default)("babel:config:config-chain");
function buildConfigChain(opts) {

@@ -67,3 +73,6 @@ if (typeof opts.filename !== "string" && opts.filename != null) {

if (this.matchesPatterns(ignore, dirname)) return true;
if (this.matchesPatterns(ignore, dirname)) {
debug("Ignored %o because it matched one of %O from %o", this.filename, ignore, dirname);
return true;
}
}

@@ -76,3 +85,6 @@

if (!this.matchesPatterns(only, dirname)) return true;
if (!this.matchesPatterns(only, dirname)) {
debug("Ignored %o because it failed to match one of %O from %o", this.filename, only, dirname);
return true;
}
}

@@ -177,3 +189,3 @@

if (envOpts != null && ((typeof envOpts === "undefined" ? "undefined" : _typeof(envOpts)) !== "object" || Array.isArray(envOpts))) {
if (envOpts != null && (_typeof(envOpts) !== "object" || Array.isArray(envOpts))) {
throw new Error(".env[...] block must be an object, null, or undefined");

@@ -180,0 +192,0 @@ }

21

lib/config/caching.js

@@ -15,4 +15,7 @@ "use strict";

function makeCachedFunction(callCache, handler) {
var autoPermacache = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
function makeCachedFunction(callCache, handler, autoPermacache) {
if (autoPermacache === void 0) {
autoPermacache = true;
}
return function cachedFunction(arg) {

@@ -34,6 +37,6 @@ var cachedValue = callCache.get(arg);

var _ref = _ref2;
var _value = _ref[0];
var valid = _ref[1];
if (valid()) return _value;
var _ref3 = _ref2;
var _value2 = _ref3[0];
var _valid = _ref3[1];
if (_valid()) return _value2;
}

@@ -82,5 +85,5 @@ }

valid: function valid() {
return pairs.every(function (_ref3) {
var key = _ref3[0],
fn = _ref3[1];
return pairs.every(function (_ref4) {
var key = _ref4[0],
fn = _ref4[1];
return key === fn();

@@ -87,0 +90,0 @@ });

@@ -6,5 +6,8 @@ "use strict";

function getEnv() {
var defaultValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "development";
function getEnv(defaultValue) {
if (defaultValue === void 0) {
defaultValue = "development";
}
return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
}

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

function loadConfig(opts) {
if (opts != null && (typeof opts === "undefined" ? "undefined" : _typeof(opts)) !== "object") {
if (opts != null && _typeof(opts) !== "object") {
throw new Error("Babel options must be an object, null, or undefined");

@@ -19,0 +19,0 @@ }

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

var _debug = require("debug");
var _debug2 = _interopRequireDefault(_debug);
var _path = require("path");

@@ -33,2 +37,3 @@

var debug = (0, _debug2.default)("babel:config:loading:files:configuration");
var BABELRC_FILENAME = ".babelrc";

@@ -52,2 +57,3 @@ var BABELRC_JS_FILENAME = ".babelrc.js";

if (ignore) {
debug("Found ignore %o from %o.", ignore.filepath, dirname);
confs.push(ignore);

@@ -72,2 +78,3 @@ foundIgnore = true;

if (conf) {
debug("Found configuration %o from %o.", conf.filepath, dirname);
confs.push(conf);

@@ -97,2 +104,3 @@ foundConfig = true;

debug("Loaded config %o from $o.", name, dirname);
return conf;

@@ -105,2 +113,3 @@ }

var LOADING_CONFIGS = new Set();
var readConfigJS = (0, _caching.makeStrongCache)(function (filepath, cache) {

@@ -112,5 +121,17 @@ if (!_fs2.default.existsSync(filepath)) {

if (LOADING_CONFIGS.has(filepath)) {
cache.never();
debug("Auto-ignoring usage of config %o.", filepath);
return {
filepath: filepath,
dirname: _path2.default.dirname(filepath),
options: {}
};
}
var options = void 0;
try {
LOADING_CONFIGS.add(filepath);
var configModule = require(filepath);

@@ -122,2 +143,4 @@

throw err;
} finally {
LOADING_CONFIGS.delete(filepath);
}

@@ -138,3 +161,3 @@

if (!options || (typeof options === "undefined" ? "undefined" : _typeof(options)) !== "object" || Array.isArray(options)) {
if (!options || _typeof(options) !== "object" || Array.isArray(options)) {
throw new Error(filepath + ": Configuration should be an exported JavaScript object.");

@@ -172,4 +195,4 @@ }

if ((typeof options === "undefined" ? "undefined" : _typeof(options)) !== "object") {
throw new Error(filepath + ": Config returned typeof " + (typeof options === "undefined" ? "undefined" : _typeof(options)));
if (_typeof(options) !== "object") {
throw new Error(filepath + ": Config returned typeof " + _typeof(options));
}

@@ -176,0 +199,0 @@

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

var _debug = require("debug");
var _debug2 = _interopRequireDefault(_debug);
var _resolve = require("resolve");

@@ -22,2 +26,3 @@

var debug = (0, _debug2.default)("babel:config:loading:files:plugins");
var EXACT_RE = /^module:/;

@@ -46,5 +51,7 @@ var BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/\/]+[/\/]|babel-plugin-)/;

var value = requireModule("plugin", filepath);
debug("Loaded plugin %o from %o.", name, dirname);
return {
filepath: filepath,
value: requireModule(filepath)
value: value
};

@@ -60,5 +67,7 @@ }

var value = requireModule("preset", filepath);
debug("Loaded preset %o from %o.", name, dirname);
return {
filepath: filepath,
value: requireModule(filepath)
value: value
};

@@ -72,3 +81,3 @@ }

var mod = requireModule(filepath);
var mod = requireModule("parser", filepath);

@@ -83,5 +92,7 @@ if (!mod) {

var value = mod.parse;
debug("Loaded parser %o from %o.", name, dirname);
return {
filepath: filepath,
value: mod.parse
value: value
};

@@ -95,3 +106,3 @@ }

var mod = requireModule(filepath);
var mod = requireModule("generator", filepath);

@@ -106,5 +117,7 @@ if (!mod) {

var value = mod.print;
debug("Loaded generator %o from %o.", name, dirname);
return {
filepath: filepath,
value: mod.print
value: value
};

@@ -119,4 +132,7 @@ }

function resolveStandardizedName(type, name) {
var dirname = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : process.cwd();
function resolveStandardizedName(type, name, dirname) {
if (dirname === void 0) {
dirname = process.cwd();
}
var standardizedName = standardizeName(type, name);

@@ -180,4 +196,15 @@

function requireModule(name) {
return require(name);
var LOADING_MODULES = new Set();
function requireModule(type, name) {
if (LOADING_MODULES.has(name)) {
throw new Error("Reentrant " + type + " detected trying to load \"" + name + "\". This module is not ignored and is trying to load itself while compiling itself, leading to a dependency cycle. We recommend adding it to your \"ignore\" list in your babelrc, or to a .babelignore.");
}
try {
LOADING_MODULES.add(name);
return require(name);
} finally {
LOADING_MODULES.delete(name);
}
}

@@ -130,4 +130,4 @@ "use strict";

var config = _ref;
this.mergeOptions(config);
var _config = _ref;
this.mergeOptions(_config);
}

@@ -261,3 +261,3 @@ } catch (e) {

if (!item || (typeof item === "undefined" ? "undefined" : _typeof(item)) !== "object") {
if (!item || _typeof(item) !== "object") {
throw new Error("Plugin/Preset did not return an object.");

@@ -439,3 +439,3 @@ }

if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" && value.__esModule) {
if (_typeof(value) === "object" && value.__esModule) {
if (value.default) {

@@ -448,7 +448,7 @@ value = value.default;

if ((typeof value === "undefined" ? "undefined" : _typeof(value)) !== "object" && typeof value !== "function") {
throw new Error("Unsupported format: " + (typeof value === "undefined" ? "undefined" : _typeof(value)) + ". Expected an object or a function.");
if (_typeof(value) !== "object" && typeof value !== "function") {
throw new Error("Unsupported format: " + _typeof(value) + ". Expected an object or a function.");
}
if (options != null && (typeof options === "undefined" ? "undefined" : _typeof(options)) !== "object") {
if (options != null && _typeof(options) !== "object") {
throw new Error("Plugin/Preset options must be an object, null, or undefined");

@@ -484,4 +484,5 @@ }

var fn = _ref3;
fn.apply(this, args);
var _fn = _ref3;
_fn.apply(this, args);
}

@@ -488,0 +489,0 @@ };

@@ -5,4 +5,7 @@ "use strict";

exports.default = function (whitelist) {
var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "global";
exports.default = function (whitelist, outputType) {
if (outputType === void 0) {
outputType = "global";
}
var namespace = t.identifier("babelHelpers");

@@ -9,0 +12,0 @@

@@ -121,5 +121,5 @@ "use strict";

var pluginPairs = _ref2;
var _pluginPairs = _ref2;
for (var _iterator2 = pluginPairs, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
for (var _iterator2 = _pluginPairs, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref4;

@@ -136,7 +136,7 @@

var _ref3 = _ref4;
var plugin = _ref3[0];
var _ref5 = _ref4;
var _plugin = _ref5[0];
if (plugin.manipulateOptions) {
plugin.manipulateOptions(_this.opts, _this.parserOpts, _this);
if (_plugin.manipulateOptions) {
_plugin.manipulateOptions(_this.opts, _this.parserOpts, _this);
}

@@ -236,8 +236,13 @@ }

File.prototype.addImport = function addImport(source) {
File.prototype.addImport = function addImport(source, imported, name) {
var _this2 = this;
var imported = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : imported;
if (imported === void 0) {
imported = "";
}
if (name === void 0) {
name = imported;
}
var prependDeclaration = function prependDeclaration(specifiers) {

@@ -335,4 +340,7 @@ var declar = t.importDeclaration(specifiers, t.stringLiteral(source));

File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) {
var Error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SyntaxError;
File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg, Error) {
if (Error === void 0) {
Error = SyntaxError;
}
var loc = node && (node.loc || node._loc);

@@ -440,14 +448,14 @@ var err = new Error(msg);

for (var _iterator3 = this.pluginPasses, _isArray3 = Array.isArray(_iterator3), _i4 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref5;
var _ref6;
if (_isArray3) {
if (_i4 >= _iterator3.length) break;
_ref5 = _iterator3[_i4++];
_ref6 = _iterator3[_i4++];
} else {
_i4 = _iterator3.next();
if (_i4.done) break;
_ref5 = _i4.value;
_ref6 = _i4.value;
}
var pluginPairs = _ref5;
var _pluginPairs2 = _ref6;
var passPairs = [];

@@ -457,28 +465,30 @@ var passes = [];

for (var _iterator4 = pluginPairs.concat(INTERNAL_PLUGINS), _isArray4 = Array.isArray(_iterator4), _i5 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref7;
for (var _iterator4 = _pluginPairs2.concat(INTERNAL_PLUGINS), _isArray4 = Array.isArray(_iterator4), _i5 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
var _ref8;
if (_isArray4) {
if (_i5 >= _iterator4.length) break;
_ref7 = _iterator4[_i5++];
_ref8 = _iterator4[_i5++];
} else {
_i5 = _iterator4.next();
if (_i5.done) break;
_ref7 = _i5.value;
_ref8 = _i5.value;
}
var _ref6 = _ref7;
var plugin = _ref6[0];
var pluginOpts = _ref6[1];
var pass = new _pluginPass2.default(this, plugin.key, pluginOpts);
passPairs.push([plugin, pass]);
passes.push(pass);
visitors.push(plugin.visitor);
var _ref11 = _ref8;
var _plugin4 = _ref11[0];
var _pluginOpts = _ref11[1];
var _pass2 = new _pluginPass2.default(this, _plugin4.key, _pluginOpts);
passPairs.push([_plugin4, _pass2]);
passes.push(_pass2);
visitors.push(_plugin4.visitor);
}
for (var _i6 = 0; _i6 < passPairs.length; _i6++) {
var _ref8 = passPairs[_i6];
var _plugin = _ref8[0];
var pass = _ref8[1];
var fn = _plugin.pre;
var _ref9 = passPairs[_i6];
var _plugin2 = _ref9[0];
var pass = _ref9[1];
var fn = _plugin2.pre;
if (fn) fn.call(pass, this);

@@ -495,6 +505,6 @@ }

for (var _i7 = 0; _i7 < passPairs.length; _i7++) {
var _ref9 = passPairs[_i7];
var _plugin2 = _ref9[0];
var _pass = _ref9[1];
var fn = _plugin2.post;
var _ref10 = passPairs[_i7];
var _plugin3 = _ref10[0];
var _pass = _ref10[1];
var fn = _plugin3.post;
if (fn) fn.call(_pass, this);

@@ -582,7 +592,7 @@ }

File.prototype.makeResult = function makeResult(_ref10) {
var code = _ref10.code,
map = _ref10.map,
ast = _ref10.ast,
ignored = _ref10.ignored;
File.prototype.makeResult = function makeResult(_ref12) {
var code = _ref12.code,
map = _ref12.map,
ast = _ref12.ast,
ignored = _ref12.ignored;
var result = {

@@ -589,0 +599,0 @@ metadata: null,

@@ -30,5 +30,7 @@ "use strict";

function analyse(code) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var visitor = arguments[2];
function analyse(code, opts, visitor) {
if (opts === void 0) {
opts = {};
}
opts.code = false;

@@ -109,4 +111,7 @@

function transformFileSync(filename) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
function transformFileSync(filename, opts) {
if (opts === void 0) {
opts = {};
}
opts.filename = filename;

@@ -113,0 +118,0 @@ var config = (0, _config2.default)(opts);

@@ -21,6 +21,9 @@ "use strict";

function PluginPass(file, key) {
function PluginPass(file, key, options) {
var _this;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (options === void 0) {
options = {};
}
_this = _Store.call(this) || this;

@@ -27,0 +30,0 @@ _this.key = key;

{
"name": "babel-core",
"version": "7.0.0-alpha.19",
"version": "7.0.0-alpha.20",
"description": "Babel compiler core.",

@@ -28,10 +28,10 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"dependencies": {
"babel-code-frame": "7.0.0-alpha.19",
"babel-generator": "7.0.0-alpha.19",
"babel-helpers": "7.0.0-alpha.19",
"babel-messages": "7.0.0-alpha.19",
"babel-template": "7.0.0-alpha.19",
"babel-traverse": "7.0.0-alpha.19",
"babel-types": "7.0.0-alpha.19",
"babylon": "7.0.0-beta.19",
"babel-code-frame": "7.0.0-alpha.20",
"babel-generator": "7.0.0-alpha.20",
"babel-helpers": "7.0.0-alpha.20",
"babel-messages": "7.0.0-alpha.20",
"babel-template": "7.0.0-alpha.20",
"babel-traverse": "7.0.0-alpha.20",
"babel-types": "7.0.0-alpha.20",
"babylon": "7.0.0-beta.22",
"convert-source-map": "^1.1.0",

@@ -46,5 +46,5 @@ "debug": "^2.1.1",

"devDependencies": {
"babel-helper-transform-fixture-test-runner": "7.0.0-alpha.19",
"babel-register": "7.0.0-alpha.19"
"babel-helper-transform-fixture-test-runner": "7.0.0-alpha.20",
"babel-register": "7.0.0-alpha.20"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc