Socket
Socket
Sign inDemoInstall

@babel/core

Package Overview
Dependencies
15
Maintainers
5
Versions
187
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0-beta.46 to 7.0.0-beta.47

lib/transformation/file/merge-map.js

105

lib/config/caching.js

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

return function cachedFunction(arg, data) {
var cachedValue = callCache.get(arg);
let cachedValue = callCache.get(arg);

@@ -35,11 +35,11 @@ if (cachedValue) {

var _ref3 = _ref2;
var _value = _ref3.value,
_valid = _ref3.valid;
if (_valid(data)) return _value;
const _ref = _ref2;
const value = _ref.value,
valid = _ref.valid;
if (valid(data)) return value;
}
}
var cache = new CacheConfigurator(data);
var value = handler(arg, cache);
const cache = new CacheConfigurator(data);
const value = handler(arg, cache);
if (!cache.configured()) cache.forever();

@@ -51,6 +51,4 @@ cache.deactivate();

cachedValue = [{
value: value,
valid: function valid() {
return true;
}
value,
valid: () => true
}];

@@ -62,3 +60,3 @@ callCache.set(arg, cachedValue);

cachedValue = [{
value: value,
value,
valid: cache.validator()

@@ -72,3 +70,3 @@ }];

cachedValue.push({
value: value,
value,
valid: cache.validator()

@@ -78,3 +76,3 @@ });

cachedValue = [{
value: value,
value,
valid: cache.validator()

@@ -91,4 +89,4 @@ }];

var CacheConfigurator = function () {
function CacheConfigurator(data) {
class CacheConfigurator {
constructor(data) {
this._active = true;

@@ -103,9 +101,7 @@ this._never = false;

var _proto = CacheConfigurator.prototype;
_proto.simple = function simple() {
simple() {
return makeSimpleConfigurator(this);
};
}
_proto.mode = function mode() {
mode() {
if (this._never) return "never";

@@ -115,5 +111,5 @@ if (this._forever) return "forever";

return "valid";
};
}
_proto.forever = function forever() {
forever() {
if (!this._active) {

@@ -129,5 +125,5 @@ throw new Error("Cannot change caching after evaluation has completed.");

this._configured = true;
};
}
_proto.never = function never() {
never() {
if (!this._active) {

@@ -143,5 +139,5 @@ throw new Error("Cannot change caching after evaluation has completed.");

this._configured = true;
};
}
_proto.using = function using(handler) {
using(handler) {
if (!this._active) {

@@ -156,3 +152,3 @@ throw new Error("Cannot change caching after evaluation has completed.");

this._configured = true;
var key = handler(this._data);
const key = handler(this._data);

@@ -162,5 +158,5 @@ this._pairs.push([key, handler]);

return key;
};
}
_proto.invalidate = function invalidate(handler) {
invalidate(handler) {
if (!this._active) {

@@ -176,3 +172,3 @@ throw new Error("Cannot change caching after evaluation has completed.");

this._configured = true;
var key = handler(this._data);
const key = handler(this._data);

@@ -182,25 +178,18 @@ this._pairs.push([key, handler]);

return key;
};
}
_proto.validator = function validator() {
var pairs = this._pairs;
return function (data) {
return pairs.every(function (_ref4) {
var key = _ref4[0],
fn = _ref4[1];
return key === fn(data);
});
};
};
validator() {
const pairs = this._pairs;
return data => pairs.every(([key, fn]) => key === fn(data));
}
_proto.deactivate = function deactivate() {
deactivate() {
this._active = false;
};
}
_proto.configured = function configured() {
configured() {
return this._configured;
};
}
return CacheConfigurator;
}();
}

@@ -217,23 +206,11 @@ function makeSimpleConfigurator(cache) {

cacheFn.forever = function () {
return cache.forever();
};
cacheFn.forever = () => cache.forever();
cacheFn.never = function () {
return cache.never();
};
cacheFn.never = () => cache.never();
cacheFn.using = function (cb) {
return cache.using(function () {
return cb();
});
};
cacheFn.using = cb => cache.using(() => cb());
cacheFn.invalidate = function (cb) {
return cache.invalidate(function () {
return cb();
});
};
cacheFn.invalidate = cb => cache.invalidate(() => cb());
return cacheFn;
}

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

function _path() {
var data = _interopRequireDefault(require("path"));
const data = _interopRequireDefault(require("path"));

@@ -21,3 +21,3 @@ _path = function _path() {

function _micromatch() {
var data = _interopRequireDefault(require("micromatch"));
const data = _interopRequireDefault(require("micromatch"));

@@ -32,3 +32,3 @@ _micromatch = function _micromatch() {

function _debug() {
var data = _interopRequireDefault(require("debug"));
const data = _interopRequireDefault(require("debug"));

@@ -52,44 +52,18 @@ _debug = function _debug() {

var debug = (0, _debug().default)("babel:config:config-chain");
var buildPresetChain = makeChainWalker({
init: function init(arg) {
return arg;
},
root: function root(preset) {
return loadPresetDescriptors(preset);
},
env: function env(preset, envName) {
return loadPresetEnvDescriptors(preset)(envName);
},
overrides: function overrides(preset, index) {
return loadPresetOverridesDescriptors(preset)(index);
},
overridesEnv: function overridesEnv(preset, index, envName) {
return loadPresetOverridesEnvDescriptors(preset)(index)(envName);
}
const debug = (0, _debug().default)("babel:config:config-chain");
const buildPresetChain = makeChainWalker({
init: arg => arg,
root: preset => loadPresetDescriptors(preset),
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName)
});
exports.buildPresetChain = buildPresetChain;
var loadPresetDescriptors = (0, _caching.makeWeakCache)(function (preset) {
return buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors);
});
var loadPresetEnvDescriptors = (0, _caching.makeWeakCache)(function (preset) {
return (0, _caching.makeStrongCache)(function (envName) {
return buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName);
});
});
var loadPresetOverridesDescriptors = (0, _caching.makeWeakCache)(function (preset) {
return (0, _caching.makeStrongCache)(function (index) {
return buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index);
});
});
var loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCache)(function (preset) {
return (0, _caching.makeStrongCache)(function (index) {
return (0, _caching.makeStrongCache)(function (envName) {
return buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName);
});
});
});
const loadPresetDescriptors = (0, _caching.makeWeakCache)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
const loadPresetEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
function buildRootChain(opts, context) {
var programmaticChain = loadProgrammaticChain({
const programmaticChain = loadProgrammaticChain({
options: opts,

@@ -99,13 +73,12 @@ dirname: context.cwd

if (!programmaticChain) return null;
var _opts$root = opts.root,
rootDir = _opts$root === void 0 ? "." : _opts$root,
_opts$babelrc = opts.babelrc,
babelrc = _opts$babelrc === void 0 ? true : _opts$babelrc,
babelrcRoots = opts.babelrcRoots,
_opts$configFile = opts.configFile,
configFileName = _opts$configFile === void 0 ? true : _opts$configFile;
const _opts$root = opts.root,
rootDir = _opts$root === void 0 ? "." : _opts$root,
_opts$configFile = opts.configFile,
configFileName = _opts$configFile === void 0 ? true : _opts$configFile;
let babelrc = opts.babelrc,
babelrcRoots = opts.babelrcRoots;
var absoluteRoot = _path().default.resolve(context.cwd, rootDir);
const absoluteRoot = _path().default.resolve(context.cwd, rootDir);
var configFile;
let configFile;

@@ -118,15 +91,25 @@ if (typeof configFileName === "string") {

var configFileChain = emptyChain();
const configFileChain = emptyChain();
if (configFile) {
var result = loadFileChain(configFile, context);
const validatedFile = validateConfigFile(configFile);
const result = loadFileChain(validatedFile, context);
if (!result) return null;
if (babelrc === undefined) {
babelrc = validatedFile.options.babelrc;
}
if (babelrcRoots === undefined) {
babelrcRoots = validatedFile.options.babelrcRoots;
}
mergeChain(configFileChain, result);
}
var pkgData = typeof context.filename === "string" ? (0, _files.findPackageData)(context.filename) : null;
var ignoreFile, babelrcFile;
var fileChain = emptyChain();
const pkgData = typeof context.filename === "string" ? (0, _files.findPackageData)(context.filename) : null;
let ignoreFile, babelrcFile;
const fileChain = emptyChain();
if (babelrc && pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, absoluteRoot)) {
if ((babelrc === true || babelrc === undefined) && pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, absoluteRoot)) {
var _findRelativeConfig = (0, _files.findRelativeConfig)(pkgData, context.envName);

@@ -142,16 +125,13 @@

if (babelrcFile) {
var _result = loadFileChain(babelrcFile, context);
if (!_result) return null;
mergeChain(fileChain, _result);
const result = loadFileChain(validateBabelrcFile(babelrcFile), context);
if (!result) return null;
mergeChain(fileChain, result);
}
}
var chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
return {
plugins: dedupDescriptors(chain.plugins),
presets: dedupDescriptors(chain.presets),
options: chain.options.map(function (o) {
return normalizeOptions(o);
}),
options: chain.options.map(o => normalizeOptions(o)),
ignore: ignoreFile || undefined,

@@ -170,7 +150,5 @@ babelrc: babelrcFile || undefined,

var babelrcPatterns = babelrcRoots;
let babelrcPatterns = babelrcRoots;
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
babelrcPatterns = babelrcPatterns.map(function (pat) {
return _path().default.resolve(context.cwd, pat);
});
babelrcPatterns = babelrcPatterns.map(pat => _path().default.resolve(context.cwd, pat));

@@ -184,113 +162,82 @@ if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {

var loadProgrammaticChain = makeChainWalker({
init: function init(arg) {
return arg;
},
root: function root(input) {
return buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors);
},
env: function env(input, envName) {
return buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName);
},
overrides: function overrides(input, index) {
return buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index);
},
overridesEnv: function overridesEnv(input, index, envName) {
return buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName);
}
const validateConfigFile = (0, _caching.makeWeakCache)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("configfile", file.options)
}));
const validateBabelrcFile = (0, _caching.makeWeakCache)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("babelrcfile", file.options)
}));
const validateExtendFile = (0, _caching.makeWeakCache)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("extendsfile", file.options)
}));
const loadProgrammaticChain = makeChainWalker({
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName)
});
var loadFileChain = makeChainWalker({
init: function init(input) {
return validateFile(input);
},
root: function root(file) {
return loadFileDescriptors(file);
},
env: function env(file, envName) {
return loadFileEnvDescriptors(file)(envName);
},
overrides: function overrides(file, index) {
return loadFileOverridesDescriptors(file)(index);
},
overridesEnv: function overridesEnv(file, index, envName) {
return loadFileOverridesEnvDescriptors(file)(index)(envName);
}
const loadFileChain = makeChainWalker({
root: file => loadFileDescriptors(file),
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName)
});
var validateFile = (0, _caching.makeWeakCache)(function (file) {
return {
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("file", file.options)
};
});
var loadFileDescriptors = (0, _caching.makeWeakCache)(function (file) {
return buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors);
});
var loadFileEnvDescriptors = (0, _caching.makeWeakCache)(function (file) {
return (0, _caching.makeStrongCache)(function (envName) {
return buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName);
});
});
var loadFileOverridesDescriptors = (0, _caching.makeWeakCache)(function (file) {
return (0, _caching.makeStrongCache)(function (index) {
return buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index);
});
});
var loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCache)(function (file) {
return (0, _caching.makeStrongCache)(function (index) {
return (0, _caching.makeStrongCache)(function (envName) {
return buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName);
});
});
});
const loadFileDescriptors = (0, _caching.makeWeakCache)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
const loadFileEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
const loadFileOverridesDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
function buildRootDescriptors(_ref, alias, descriptors) {
var dirname = _ref.dirname,
options = _ref.options;
function buildRootDescriptors({
dirname,
options
}, alias, descriptors) {
return descriptors(dirname, options, alias);
}
function buildEnvDescriptors(_ref2, alias, descriptors, envName) {
var dirname = _ref2.dirname,
options = _ref2.options;
var opts = options.env && options.env[envName];
return opts ? descriptors(dirname, opts, alias + ".env[\"" + envName + "\"]") : null;
function buildEnvDescriptors({
dirname,
options
}, alias, descriptors, envName) {
const opts = options.env && options.env[envName];
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null;
}
function buildOverrideDescriptors(_ref3, alias, descriptors, index) {
var dirname = _ref3.dirname,
options = _ref3.options;
var opts = options.overrides && options.overrides[index];
function buildOverrideDescriptors({
dirname,
options
}, alias, descriptors, index) {
const opts = options.overrides && options.overrides[index];
if (!opts) throw new Error("Assertion failure - missing override");
return descriptors(dirname, opts, alias + ".overrides[" + index + "]");
return descriptors(dirname, opts, `${alias}.overrides[${index}]`);
}
function buildOverrideEnvDescriptors(_ref4, alias, descriptors, index, envName) {
var dirname = _ref4.dirname,
options = _ref4.options;
var override = options.overrides && options.overrides[index];
function buildOverrideEnvDescriptors({
dirname,
options
}, alias, descriptors, index, envName) {
const override = options.overrides && options.overrides[index];
if (!override) throw new Error("Assertion failure - missing override");
var opts = override.env && override.env[envName];
return opts ? descriptors(dirname, opts, alias + ".overrides[" + index + "].env[\"" + envName + "\"]") : null;
const opts = override.env && override.env[envName];
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null;
}
function makeChainWalker(_ref5) {
var init = _ref5.init,
root = _ref5.root,
env = _ref5.env,
overrides = _ref5.overrides,
overridesEnv = _ref5.overridesEnv;
return function (arg, context, files) {
if (files === void 0) {
files = new Set();
}
function makeChainWalker({
root,
env,
overrides,
overridesEnv
}) {
return (input, context, files = new Set()) => {
const dirname = input.dirname;
const flattenedConfigs = [];
const rootOpts = root(input);
var input = init(arg);
var dirname = input.dirname;
var flattenedConfigs = [];
var rootOpts = root(input);
if (configIsApplicable(rootOpts, dirname, context)) {
flattenedConfigs.push(rootOpts);
var envOpts = env(input, context.envName);
const envOpts = env(input, context.envName);

@@ -301,8 +248,8 @@ if (envOpts && configIsApplicable(envOpts, dirname, context)) {

(rootOpts.options.overrides || []).forEach(function (_, index) {
var overrideOps = overrides(input, index);
(rootOpts.options.overrides || []).forEach((_, index) => {
const overrideOps = overrides(input, index);
if (configIsApplicable(overrideOps, dirname, context)) {
flattenedConfigs.push(overrideOps);
var overrideEnvOpts = overridesEnv(input, index, context.envName);
const overrideEnvOpts = overridesEnv(input, index, context.envName);

@@ -316,15 +263,15 @@ if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) {

if (flattenedConfigs.some(function (_ref6) {
var _ref6$options = _ref6.options,
ignore = _ref6$options.ignore,
only = _ref6$options.only;
return shouldIgnore(context, ignore, only, dirname);
})) {
if (flattenedConfigs.some(({
options: {
ignore,
only
}
}) => shouldIgnore(context, ignore, only, dirname))) {
return null;
}
var chain = emptyChain();
const chain = emptyChain();
for (var _i = 0; _i < flattenedConfigs.length; _i++) {
var op = flattenedConfigs[_i];
const op = flattenedConfigs[_i];

@@ -344,12 +291,10 @@ if (!mergeExtendsChain(chain, op.options, dirname, context, files)) {

if (opts.extends === undefined) return true;
var file = (0, _files.loadConfig)(opts.extends, dirname, context.envName);
const file = (0, _files.loadConfig)(opts.extends, dirname, context.envName);
if (files.has(file)) {
throw new Error("Configuration cycle detected loading " + file.filepath + ".\n" + "File already loaded following the config chain:\n" + Array.from(files, function (file) {
return " - " + file.filepath;
}).join("\n"));
throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n"));
}
files.add(file);
var fileChain = loadFileChain(file, context, files);
const fileChain = loadFileChain(validateExtendFile(file), context, files);
files.delete(file);

@@ -362,25 +307,16 @@ if (!fileChain) return false;

function mergeChain(target, source) {
var _target$options, _target$plugins, _target$presets;
(_target$options = target.options).push.apply(_target$options, source.options);
(_target$plugins = target.plugins).push.apply(_target$plugins, source.plugins);
(_target$presets = target.presets).push.apply(_target$presets, source.presets);
target.options.push(...source.options);
target.plugins.push(...source.plugins);
target.presets.push(...source.presets);
return target;
}
function mergeChainOpts(target, _ref7) {
var _target$plugins2, _target$presets2;
var options = _ref7.options,
plugins = _ref7.plugins,
presets = _ref7.presets;
function mergeChainOpts(target, {
options,
plugins,
presets
}) {
target.options.push(options);
(_target$plugins2 = target.plugins).push.apply(_target$plugins2, plugins());
(_target$presets2 = target.presets).push.apply(_target$presets2, presets());
target.plugins.push(...plugins());
target.presets.push(...presets());
return target;

@@ -398,3 +334,3 @@ }

function normalizeOptions(opts) {
var options = Object.assign({}, opts);
const options = Object.assign({}, opts);
delete options.extends;

@@ -417,22 +353,22 @@ delete options.env;

function dedupDescriptors(items) {
var map = new Map();
var descriptors = [];
const map = new Map();
const descriptors = [];
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref8;
var _ref;
if (_isArray) {
if (_i2 >= _iterator.length) break;
_ref8 = _iterator[_i2++];
_ref = _iterator[_i2++];
} else {
_i2 = _iterator.next();
if (_i2.done) break;
_ref8 = _i2.value;
_ref = _i2.value;
}
var item = _ref8;
const item = _ref;
if (typeof item.value === "function") {
var fnKey = item.value;
var nameMap = map.get(fnKey);
const fnKey = item.value;
let nameMap = map.get(fnKey);

@@ -444,3 +380,3 @@ if (!nameMap) {

var desc = nameMap.get(item.name);
let desc = nameMap.get(item.name);

@@ -467,3 +403,3 @@ if (!desc) {

return descriptors.reduce(function (acc, desc) {
return descriptors.reduce((acc, desc) => {
if (desc.value) acc.push(desc.value);

@@ -474,4 +410,5 @@ return acc;

function configIsApplicable(_ref9, dirname, context) {
var options = _ref9.options;
function configIsApplicable({
options
}, dirname, context) {
return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname));

@@ -482,7 +419,7 @@ }

if (context.filename === null) {
throw new Error("Configuration contains explicit test/include/exclude checks, but no filename was passed to Babel");
throw new Error(`Configuration contains explicit test/include/exclude checks, but no filename was passed to Babel`);
}
var ctx = context;
var patterns = Array.isArray(test) ? test : [test];
const ctx = context;
const patterns = Array.isArray(test) ? test : [test];
return matchesPatterns(ctx, patterns, dirname, false);

@@ -494,6 +431,6 @@ }

if (context.filename === null) {
throw new Error("Configuration contains ignore checks, but no filename was passed to Babel");
throw new Error(`Configuration contains ignore checks, but no filename was passed to Babel`);
}
var ctx = context;
const ctx = context;

@@ -508,8 +445,8 @@ if (matchesPatterns(ctx, ignore, dirname)) {

if (context.filename === null) {
throw new Error("Configuration contains ignore checks, but no filename was passed to Babel");
throw new Error(`Configuration contains ignore checks, but no filename was passed to Babel`);
}
var _ctx = context;
const ctx = context;
if (!matchesPatterns(_ctx, only, dirname)) {
if (!matchesPatterns(ctx, only, dirname)) {
debug("Ignored %o because it failed to match one of %O from %o", context.filename, only, dirname);

@@ -523,28 +460,20 @@ return true;

function matchesPatterns(context, patterns, dirname, allowNegation) {
if (allowNegation === void 0) {
allowNegation = true;
}
var res = [];
var strings = [];
var fns = [];
patterns.forEach(function (pattern) {
function matchesPatterns(context, patterns, dirname, allowNegation = true) {
const res = [];
const strings = [];
const fns = [];
patterns.forEach(pattern => {
if (typeof pattern === "string") strings.push(pattern);else if (typeof pattern === "function") fns.push(pattern);else res.push(pattern);
});
var filename = context.filename;
if (res.some(function (re) {
return re.test(context.filename);
})) return true;
if (fns.some(function (fn) {
return fn(filename);
})) return true;
const filename = context.filename;
if (res.some(re => re.test(context.filename))) return true;
if (fns.some(fn => fn(filename))) return true;
if (strings.length > 0) {
var possibleDirs = getPossibleDirs(context);
var absolutePatterns = strings.map(function (pattern) {
var negate = pattern[0] === "!";
const possibleDirs = getPossibleDirs(context);
const absolutePatterns = strings.map(pattern => {
const negate = pattern[0] === "!";
if (negate && !allowNegation) {
throw new Error("Negation of file paths is not supported.");
throw new Error(`Negation of file paths is not supported.`);
}

@@ -567,9 +496,9 @@

var getPossibleDirs = (0, _caching.makeWeakCache)(function (context) {
var current = context.filename;
const getPossibleDirs = (0, _caching.makeWeakCache)(context => {
let current = context.filename;
if (current === null) return [];
var possibleDirs = [current];
const possibleDirs = [current];
while (true) {
var previous = current;
const previous = current;
current = _path().default.dirname(current);

@@ -576,0 +505,0 @@ if (previous === current) break;

@@ -17,17 +17,9 @@ "use strict";

function createCachedDescriptors(dirname, options, alias) {
var plugins = options.plugins,
presets = options.presets,
passPerPreset = options.passPerPreset;
const plugins = options.plugins,
presets = options.presets,
passPerPreset = options.passPerPreset;
return {
options: options,
plugins: plugins ? function () {
return createCachedPluginDescriptors(plugins, dirname)(alias);
} : function () {
return [];
},
presets: presets ? function () {
return createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset);
} : function () {
return [];
}
options,
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => [],
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => []
};

@@ -37,6 +29,6 @@ }

function createUncachedDescriptors(dirname, options, alias) {
var plugins;
var presets;
let plugins;
let presets;
return {
options: options,
options,
plugins: function (_plugins) {

@@ -52,3 +44,3 @@ function plugins() {

return plugins;
}(function () {
}(() => {
if (!plugins) {

@@ -70,3 +62,3 @@ plugins = createPluginDescriptors(options.plugins || [], dirname, alias);

return presets;
}(function () {
}(() => {
if (!presets) {

@@ -81,19 +73,9 @@ presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);

var createCachedPresetDescriptors = (0, _caching.makeWeakCache)(function (items, cache) {
var dirname = cache.using(function (dir) {
return dir;
});
return (0, _caching.makeStrongCache)(function (alias) {
return (0, _caching.makeStrongCache)(function (passPerPreset) {
return createPresetDescriptors(items, dirname, alias, passPerPreset);
});
});
const createCachedPresetDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCache)(alias => (0, _caching.makeStrongCache)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset)));
});
var createCachedPluginDescriptors = (0, _caching.makeWeakCache)(function (items, cache) {
var dirname = cache.using(function (dir) {
return dir;
});
return (0, _caching.makeStrongCache)(function (alias) {
return createPluginDescriptors(items, dirname, alias);
});
const createCachedPluginDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCache)(alias => createPluginDescriptors(items, dirname, alias));
});

@@ -110,9 +92,7 @@

function createDescriptors(type, items, dirname, alias, ownPass) {
var descriptors = items.map(function (item, index) {
return createDescriptor(item, dirname, {
type: type,
alias: alias + "$" + index,
ownPass: !!ownPass
});
});
const descriptors = items.map((item, index) => createDescriptor(item, dirname, {
type,
alias: `${alias}$${index}`,
ownPass: !!ownPass
}));
assertNoDuplicates(descriptors);

@@ -122,7 +102,8 @@ return descriptors;

function createDescriptor(pair, dirname, _ref) {
var type = _ref.type,
alias = _ref.alias,
ownPass = _ref.ownPass;
var desc = (0, _item.getItemDescriptor)(pair);
function createDescriptor(pair, dirname, {
type,
alias,
ownPass
}) {
const desc = (0, _item.getItemDescriptor)(pair);

@@ -133,5 +114,5 @@ if (desc) {

var name;
var options;
var value = pair;
let name;
let options;
let value = pair;

@@ -151,4 +132,4 @@ if (Array.isArray(value)) {

var file = undefined;
var filepath = null;
let file = undefined;
let filepath = null;

@@ -160,4 +141,4 @@ if (typeof value === "string") {

var resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset;
var _request = value;
const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset;
const request = value;

@@ -169,3 +150,3 @@ var _resolver = resolver(value, dirname);

file = {
request: _request,
request,
resolved: filepath

@@ -176,3 +157,3 @@ };

if (!value) {
throw new Error("Unexpected falsy value: " + String(value));
throw new Error(`Unexpected falsy value: ${String(value)}`);
}

@@ -189,17 +170,17 @@

if (typeof value !== "object" && typeof value !== "function") {
throw new Error("Unsupported format: " + typeof value + ". Expected an object or a function.");
throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`);
}
if (filepath !== null && typeof value === "object" && value) {
throw new Error("Plugin/Preset files are not allowed to export objects, only functions. In " + filepath);
throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);
}
return {
name: name,
name,
alias: filepath || alias,
value: value,
options: options,
dirname: dirname,
ownPass: ownPass,
file: file
value,
options,
dirname,
ownPass,
file
};

@@ -209,19 +190,19 @@ }

function assertNoDuplicates(items) {
var map = new Map();
const map = new Map();
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref2;
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref2 = _iterator[_i++];
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref2 = _i.value;
_ref = _i.value;
}
var item = _ref2;
const item = _ref;
if (typeof item.value !== "function") continue;
var nameMap = map.get(item.value);
let nameMap = map.get(item.value);

@@ -234,3 +215,3 @@ if (!nameMap) {

if (nameMap.has(item.name)) {
throw new Error(["Duplicate plugin/preset detected.", "If you'd like to use two separate instances of a plugin,", "they neen separate names, e.g.", "", " plugins: [", " ['some-plugin', {}],", " ['some-plugin', {}, 'some unique name'],", " ]"].join("\n"));
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they neen separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`].join("\n"));
}

@@ -237,0 +218,0 @@

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

function _debug() {
var data = _interopRequireDefault(require("debug"));
const data = _interopRequireDefault(require("debug"));

@@ -22,3 +22,3 @@ _debug = function _debug() {

function _path() {
var data = _interopRequireDefault(require("path"));
const data = _interopRequireDefault(require("path"));

@@ -33,3 +33,3 @@ _path = function _path() {

function _fs() {
var data = _interopRequireDefault(require("fs"));
const data = _interopRequireDefault(require("fs"));

@@ -44,3 +44,3 @@ _fs = function _fs() {

function _json() {
var data = _interopRequireDefault(require("json5"));
const data = _interopRequireDefault(require("json5"));

@@ -55,3 +55,3 @@ _json = function _json() {

function _resolve() {
var data = _interopRequireDefault(require("resolve"));
const data = _interopRequireDefault(require("resolve"));

@@ -73,34 +73,36 @@ _resolve = function _resolve() {

var debug = (0, _debug().default)("babel:config:loading:files:configuration");
var BABEL_CONFIG_JS_FILENAME = "babel.config.js";
var BABELRC_FILENAME = ".babelrc";
var BABELRC_JS_FILENAME = ".babelrc.js";
var BABELIGNORE_FILENAME = ".babelignore";
const debug = (0, _debug().default)("babel:config:loading:files:configuration");
const BABEL_CONFIG_JS_FILENAME = "babel.config.js";
const BABELRC_FILENAME = ".babelrc";
const BABELRC_JS_FILENAME = ".babelrc.js";
const BABELIGNORE_FILENAME = ".babelignore";
function findRelativeConfig(packageData, envName) {
var config = null;
var ignore = null;
let config = null;
let ignore = null;
var dirname = _path().default.dirname(packageData.filepath);
const dirname = _path().default.dirname(packageData.filepath);
var _loop = function _loop() {
for (var _iterator = packageData.directories, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) return "break";
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) return "break";
if (_i.done) break;
_ref = _i.value;
}
var loc = _ref;
const loc = _ref;
if (!config) {
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce(function (previousConfig, name) {
var filepath = _path().default.join(loc, name);
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce((previousConfig, name) => {
const filepath = _path().default.join(loc, name);
var config = readConfig(filepath, envName);
const config = readConfig(filepath, envName);
if (config && previousConfig) {
throw new Error("Multiple configuration files found. Please remove one:\n" + (" - " + _path().default.basename(previousConfig.filepath) + "\n") + (" - " + name + "\n") + ("from " + loc));
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${name}\n` + `from ${loc}`);
}

@@ -110,7 +112,7 @@

}, null);
var pkgConfig = packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) : null;
const pkgConfig = packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) : null;
if (pkgConfig) {
if (config) {
throw new Error("Multiple configuration files found. Please remove one:\n" + (" - " + _path().default.basename(pkgConfig.filepath) + "#babel\n") + (" - " + _path().default.basename(config.filepath) + "\n") + ("from " + loc));
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(pkgConfig.filepath)}#babel\n` + ` - ${_path().default.basename(config.filepath)}\n` + `from ${loc}`);
}

@@ -127,3 +129,3 @@

if (!ignore) {
var ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);

@@ -136,15 +138,7 @@ ignore = readIgnoreConfig(ignoreLoc);

}
};
for (var _iterator = packageData.directories, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var _ret = _loop();
if (_ret === "break") break;
}
return {
config: config,
ignore: ignore
config,
ignore
};

@@ -154,5 +148,5 @@ }

function findRootConfig(dirname, envName) {
var filepath = _path().default.resolve(dirname, BABEL_CONFIG_JS_FILENAME);
const filepath = _path().default.resolve(dirname, BABEL_CONFIG_JS_FILENAME);
var conf = readConfig(filepath, envName);
const conf = readConfig(filepath, envName);

@@ -167,10 +161,10 @@ if (conf) {

function loadConfig(name, dirname, envName) {
var filepath = _resolve().default.sync(name, {
const filepath = _resolve().default.sync(name, {
basedir: dirname
});
var conf = readConfig(filepath, envName);
const conf = readConfig(filepath, envName);
if (!conf) {
throw new Error("Config file " + filepath + " contains no configuration data");
throw new Error(`Config file ${filepath} contains no configuration data`);
}

@@ -184,8 +178,8 @@

return _path().default.extname(filepath) === ".js" ? readConfigJS(filepath, {
envName: envName
envName
}) : readConfigJSON5(filepath);
}
var LOADING_CONFIGS = new Set();
var readConfigJS = (0, _caching.makeStrongCache)(function (filepath, cache) {
const LOADING_CONFIGS = new Set();
const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
if (!_fs().default.existsSync(filepath)) {

@@ -200,3 +194,3 @@ cache.forever();

return {
filepath: filepath,
filepath,
dirname: _path().default.dirname(filepath),

@@ -207,3 +201,3 @@ options: {}

var options;
let options;

@@ -213,7 +207,7 @@ try {

var configModule = require(filepath);
const configModule = require(filepath);
options = configModule && configModule.__esModule ? configModule.default || undefined : configModule;
} catch (err) {
err.message = filepath + ": Error while loading config - " + err.message;
err.message = `${filepath}: Error while loading config - ${err.message}`;
throw err;

@@ -230,21 +224,21 @@ } finally {

if (!options || typeof options !== "object" || Array.isArray(options)) {
throw new Error(filepath + ": Configuration should be an exported JavaScript object.");
throw new Error(`${filepath}: Configuration should be an exported JavaScript object.`);
}
if (typeof options.then === "function") {
throw new Error("You appear to be using an async configuration, " + "which your current version of Babel does not support. " + "We may add support for this in the future, " + "but if you're on the most recent version of @babel/core and still " + "seeing this error, then you'll need to synchronously return your config.");
throw new Error(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`);
}
return {
filepath: filepath,
filepath,
dirname: _path().default.dirname(filepath),
options: options
options
};
});
var packageToBabelConfig = (0, _caching.makeWeakCache)(function (file) {
const packageToBabelConfig = (0, _caching.makeWeakCache)(file => {
if (typeof file.options.babel === "undefined") return null;
var babel = file.options.babel;
const babel = file.options.babel;
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
throw new Error(file.filepath + ": .babel property must be an object");
throw new Error(`${file.filepath}: .babel property must be an object`);
}

@@ -258,4 +252,4 @@

});
var readConfigJSON5 = (0, _utils.makeStaticFileCache)(function (filepath, content) {
var options;
const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
let options;

@@ -265,32 +259,28 @@ try {

} catch (err) {
err.message = filepath + ": Error while parsing config - " + err.message;
err.message = `${filepath}: Error while parsing config - ${err.message}`;
throw err;
}
if (!options) throw new Error(filepath + ": No config detected");
if (!options) throw new Error(`${filepath}: No config detected`);
if (typeof options !== "object") {
throw new Error(filepath + ": Config returned typeof " + typeof options);
throw new Error(`${filepath}: Config returned typeof ${typeof options}`);
}
if (Array.isArray(options)) {
throw new Error(filepath + ": Expected config object but found array");
throw new Error(`${filepath}: Expected config object but found array`);
}
return {
filepath: filepath,
filepath,
dirname: _path().default.dirname(filepath),
options: options
options
};
});
var readIgnoreConfig = (0, _utils.makeStaticFileCache)(function (filepath, content) {
var ignore = content.split("\n").map(function (line) {
return line.replace(/#(.*?)$/, "").trim();
}).filter(function (line) {
return !!line;
});
const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => {
const ignore = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line);
return {
filepath: filepath,
filepath,
dirname: _path().default.dirname(filepath),
ignore: ignore
ignore
};

@@ -300,3 +290,36 @@ });

function throwConfigError() {
throw new Error("Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured\nfor various types of caching, using the first param of their handler functions:\n\nmodule.exports = function(api) {\n // The API exposes the following:\n\n // Cache the returned value forever and don't call this function again.\n api.cache(true);\n\n // Don't cache at all. Not recommended because it will be very slow.\n api.cache(false);\n\n // Cached based on the value of some function. If this function returns a value different from\n // a previously-encountered value, the plugins will re-evaluate.\n var env = api.cache(() => process.env.NODE_ENV);\n\n // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for\n // any possible NODE_ENV value that might come up during plugin execution.\n var isProd = api.cache(() => process.env.NODE_ENV === \"production\");\n\n // .cache(fn) will perform a linear search though instances to find the matching plugin based\n // based on previous instantiated plugins. If you want to recreate the plugin and discard the\n // previous instance whenever something changes, you may use:\n var isProd = api.cache.invalidate(() => process.env.NODE_ENV === \"production\");\n\n // Note, we also expose the following more-verbose versions of the above examples:\n api.cache.forever(); // api.cache(true)\n api.cache.never(); // api.cache(false)\n api.cache.using(fn); // api.cache(fn)\n\n // Return the value that will be cached.\n return { };\n};");
throw new Error(`\
Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
for various types of caching, using the first param of their handler functions:
module.exports = function(api) {
// The API exposes the following:
// Cache the returned value forever and don't call this function again.
api.cache(true);
// Don't cache at all. Not recommended because it will be very slow.
api.cache(false);
// Cached based on the value of some function. If this function returns a value different from
// a previously-encountered value, the plugins will re-evaluate.
var env = api.cache(() => process.env.NODE_ENV);
// If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
// any possible NODE_ENV value that might come up during plugin execution.
var isProd = api.cache(() => process.env.NODE_ENV === "production");
// .cache(fn) will perform a linear search though instances to find the matching plugin based
// based on previous instantiated plugins. If you want to recreate the plugin and discard the
// previous instance whenever something changes, you may use:
var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");
// Note, we also expose the following more-verbose versions of the above examples:
api.cache.forever(); // api.cache(true)
api.cache.never(); // api.cache(false)
api.cache.using(fn); // api.cache(fn)
// Return the value that will be cached.
return { };
};`);
}

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

return {
filepath: filepath,
filepath,
directories: [],

@@ -38,3 +38,3 @@ pkg: null,

function loadConfig(name, dirname, envName) {
throw new Error("Cannot load " + name + " relative to " + dirname + " in a browser");
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
}

@@ -51,7 +51,7 @@

function loadPlugin(name, dirname) {
throw new Error("Cannot load plugin " + name + " relative to " + dirname + " in a browser");
throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`);
}
function loadPreset(name, dirname) {
throw new Error("Cannot load preset " + name + " relative to " + dirname + " in a browser");
throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
}

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

function _path() {
var data = _interopRequireDefault(require("path"));
const data = _interopRequireDefault(require("path"));

@@ -23,10 +23,10 @@ _path = function _path() {

var PACKAGE_FILENAME = "package.json";
const PACKAGE_FILENAME = "package.json";
function findPackageData(filepath) {
var pkg = null;
var directories = [];
var isPackage = true;
let pkg = null;
const directories = [];
let isPackage = true;
var dirname = _path().default.dirname(filepath);
let dirname = _path().default.dirname(filepath);

@@ -37,3 +37,3 @@ while (!pkg && _path().default.basename(dirname) !== "node_modules") {

var nextLoc = _path().default.dirname(dirname);
const nextLoc = _path().default.dirname(dirname);

@@ -49,11 +49,11 @@ if (dirname === nextLoc) {

return {
filepath: filepath,
directories: directories,
pkg: pkg,
isPackage: isPackage
filepath,
directories,
pkg,
isPackage
};
}
var readConfigPackage = (0, _utils.makeStaticFileCache)(function (filepath, content) {
var options;
const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => {
let options;

@@ -63,3 +63,3 @@ try {

} catch (err) {
err.message = filepath + ": Error while parsing JSON - " + err.message;
err.message = `${filepath}: Error while parsing JSON - ${err.message}`;
throw err;

@@ -69,14 +69,14 @@ }

if (typeof options !== "object") {
throw new Error(filepath + ": Config returned typeof " + typeof options);
throw new Error(`${filepath}: Config returned typeof ${typeof options}`);
}
if (Array.isArray(options)) {
throw new Error(filepath + ": Expected config object but found array");
throw new Error(`${filepath}: Expected config object but found array`);
}
return {
filepath: filepath,
filepath,
dirname: _path().default.dirname(filepath),
options: options
options
};
});

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

function _debug() {
var data = _interopRequireDefault(require("debug"));
const data = _interopRequireDefault(require("debug"));

@@ -23,3 +23,3 @@ _debug = function _debug() {

function _resolve() {
var data = _interopRequireDefault(require("resolve"));
const data = _interopRequireDefault(require("resolve"));

@@ -34,3 +34,3 @@ _resolve = function _resolve() {

function _path() {
var data = _interopRequireDefault(require("path"));
const data = _interopRequireDefault(require("path"));

@@ -46,10 +46,10 @@ _path = function _path() {

var debug = (0, _debug().default)("babel:config:loading:files:plugins");
var EXACT_RE = /^module:/;
var BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
var BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
var BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
var BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
var OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-plugin-|[^/]+\/)/;
var OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-preset-|[^/]+\/)/;
const debug = (0, _debug().default)("babel:config:loading:files:plugins");
const EXACT_RE = /^module:/;
const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-plugin-|[^/]+\/)/;
const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-preset-|[^/]+\/)/;

@@ -65,13 +65,13 @@ function resolvePlugin(name, dirname) {

function loadPlugin(name, dirname) {
var filepath = resolvePlugin(name, dirname);
const filepath = resolvePlugin(name, dirname);
if (!filepath) {
throw new Error("Plugin " + name + " not found relative to " + dirname);
throw new Error(`Plugin ${name} not found relative to ${dirname}`);
}
var value = requireModule("plugin", filepath);
const value = requireModule("plugin", filepath);
debug("Loaded plugin %o from %o.", name, dirname);
return {
filepath: filepath,
value: value
filepath,
value
};

@@ -81,13 +81,13 @@ }

function loadPreset(name, dirname) {
var filepath = resolvePreset(name, dirname);
const filepath = resolvePreset(name, dirname);
if (!filepath) {
throw new Error("Preset " + name + " not found relative to " + dirname);
throw new Error(`Preset ${name} not found relative to ${dirname}`);
}
var value = requireModule("preset", filepath);
const value = requireModule("preset", filepath);
debug("Loaded preset %o from %o.", name, dirname);
return {
filepath: filepath,
value: value
filepath,
value
};

@@ -98,13 +98,9 @@ }

if (_path().default.isAbsolute(name)) return name;
var isPreset = type === "preset";
return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, "babel-" + type + "-").replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, "$1" + type + "-").replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, "$1babel-" + type + "-").replace(EXACT_RE, "");
const isPreset = type === "preset";
return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(EXACT_RE, "");
}
function resolveStandardizedName(type, name, dirname) {
if (dirname === void 0) {
dirname = process.cwd();
}
function resolveStandardizedName(type, name, dirname = process.cwd()) {
const standardizedName = standardizeName(type, name);
var standardizedName = standardizeName(type, name);
try {

@@ -118,3 +114,3 @@ return _resolve().default.sync(standardizedName, {

if (standardizedName !== name) {
var resolvedOriginal = false;
let resolvedOriginal = false;

@@ -130,7 +126,7 @@ try {

if (resolvedOriginal) {
e.message += "\n- If you want to resolve \"" + name + "\", use \"module:" + name + "\"";
e.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
}
}
var resolvedBabel = false;
let resolvedBabel = false;

@@ -146,7 +142,7 @@ try {

if (resolvedBabel) {
e.message += "\n- Did you mean \"@babel/" + name + "\"?";
e.message += `\n- Did you mean "@babel/${name}"?`;
}
var resolvedOppositeType = false;
var oppositeType = type === "preset" ? "plugin" : "preset";
let resolvedOppositeType = false;
const oppositeType = type === "preset" ? "plugin" : "preset";

@@ -162,3 +158,3 @@ try {

if (resolvedOppositeType) {
e.message += "\n- Did you accidentally pass a " + type + " as a " + oppositeType + "?";
e.message += `\n- Did you accidentally pass a ${type} as a ${oppositeType}?`;
}

@@ -170,7 +166,7 @@

var LOADING_MODULES = new Set();
const 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.');
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.');
}

@@ -177,0 +173,0 @@

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

function _fs() {
var data = _interopRequireDefault(require("fs"));
const data = _interopRequireDefault(require("fs"));

@@ -24,6 +24,4 @@ _fs = function _fs() {

function makeStaticFileCache(fn) {
return (0, _caching.makeStrongCache)(function (filepath, cache) {
if (cache.invalidate(function () {
return fileMtime(filepath);
}) === null) {
return (0, _caching.makeStrongCache)((filepath, cache) => {
if (cache.invalidate(() => fileMtime(filepath)) === null) {
cache.forever();

@@ -30,0 +28,0 @@ return null;

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

function _traverse() {
var data = _interopRequireDefault(require("@babel/traverse"));
const data = _interopRequireDefault(require("@babel/traverse"));

@@ -44,3 +44,3 @@ _traverse = function _traverse() {

function loadFullConfig(inputOpts) {
var result = (0, _partial.default)(inputOpts);
const result = (0, _partial.default)(inputOpts);

@@ -51,10 +51,10 @@ if (!result) {

var options = result.options,
context = result.context;
var optionDefaults = {};
var passes = [[]];
const options = result.options,
context = result.context;
const optionDefaults = {};
const passes = [[]];
try {
var plugins = options.plugins,
presets = options.presets;
const plugins = options.plugins,
presets = options.presets;

@@ -65,7 +65,7 @@ if (!plugins || !presets) {

var ignored = function recurseDescriptors(config, pass) {
var plugins = config.plugins.map(function (descriptor) {
const ignored = function recurseDescriptors(config, pass) {
const plugins = config.plugins.map(descriptor => {
return loadPluginDescriptor(descriptor, context);
});
var presets = config.presets.map(function (descriptor) {
const presets = config.presets.map(descriptor => {
return {

@@ -78,7 +78,3 @@ preset: loadPresetDescriptor(descriptor, context),

if (presets.length > 0) {
passes.splice.apply(passes, [1, 0].concat(presets.map(function (o) {
return o.pass;
}).filter(function (p) {
return p !== pass;
})));
passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass));

@@ -97,14 +93,12 @@ for (var _iterator = presets, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

var _ref3 = _ref2;
var preset = _ref3.preset,
_pass = _ref3.pass;
const _ref = _ref2;
const preset = _ref.preset,
pass = _ref.pass;
if (!preset) return true;
var _ignored = recurseDescriptors({
const ignored = recurseDescriptors({
plugins: preset.plugins,
presets: preset.presets
}, _pass);
if (_ignored) return true;
preset.options.forEach(function (opts) {
}, pass);
if (ignored) return true;
preset.options.forEach(opts => {
(0, _util.mergeOptions)(optionDefaults, opts);

@@ -116,7 +110,7 @@ });

if (plugins.length > 0) {
pass.unshift.apply(pass, plugins);
pass.unshift(...plugins);
}
}({
plugins: plugins.map(function (item) {
var desc = (0, _item.getItemDescriptor)(item);
plugins: plugins.map(item => {
const desc = (0, _item.getItemDescriptor)(item);

@@ -129,4 +123,4 @@ if (!desc) {

}),
presets: presets.map(function (item) {
var desc = (0, _item.getItemDescriptor)(item);
presets: presets.map(item => {
const desc = (0, _item.getItemDescriptor)(item);

@@ -144,3 +138,3 @@ if (!desc) {

if (!/^\[BABEL\]/.test(e.message)) {
e.message = "[BABEL] " + (context.filename || "unknown") + ": " + e.message;
e.message = `[BABEL] ${context.filename || "unknown"}: ${e.message}`;
}

@@ -151,12 +145,8 @@

var opts = optionDefaults;
const opts = optionDefaults;
(0, _util.mergeOptions)(opts, options);
opts.plugins = passes[0];
opts.presets = passes.slice(1).filter(function (plugins) {
return plugins.length > 0;
}).map(function (plugins) {
return {
plugins: plugins
};
});
opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({
plugins
}));
opts.passPerPreset = opts.presets.length > 0;

@@ -169,13 +159,14 @@ return {

var loadDescriptor = (0, _caching.makeWeakCache)(function (_ref4, cache) {
var value = _ref4.value,
options = _ref4.options,
dirname = _ref4.dirname,
alias = _ref4.alias;
const loadDescriptor = (0, _caching.makeWeakCache)(({
value,
options,
dirname,
alias
}, cache) => {
if (options === false) throw new Error("Assertion failure");
options = options || {};
var item = value;
let item = value;
if (typeof value === "function") {
var api = Object.assign({}, context, (0, _configApi.default)(cache));
const api = Object.assign({}, context, (0, _configApi.default)(cache));

@@ -186,3 +177,3 @@ try {

if (alias) {
e.message += " (While processing: " + JSON.stringify(alias) + ")";
e.message += ` (While processing: ${JSON.stringify(alias)})`;
}

@@ -199,3 +190,3 @@

if (typeof item.then === "function") {
throw new Error("You appear to be using an async plugin, " + "which your current version of Babel does not support." + "If you're using a published plugin, " + "you may need to upgrade your @babel/core version.");
throw new Error(`You appear to be using an async plugin, ` + `which your current version of Babel does not support.` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
}

@@ -205,5 +196,5 @@

value: item,
options: options,
dirname: dirname,
alias: alias
options,
dirname,
alias
};

@@ -224,9 +215,10 @@ });

var instantiatePlugin = (0, _caching.makeWeakCache)(function (_ref5, cache) {
var value = _ref5.value,
options = _ref5.options,
dirname = _ref5.dirname,
alias = _ref5.alias;
var pluginObj = (0, _plugins.validatePluginObject)(value);
var plugin = Object.assign({}, pluginObj);
const instantiatePlugin = (0, _caching.makeWeakCache)(({
value,
options,
dirname,
alias
}, cache) => {
const pluginObj = (0, _plugins.validatePluginObject)(value);
const plugin = Object.assign({}, pluginObj);

@@ -238,12 +230,10 @@ if (plugin.visitor) {

if (plugin.inherits) {
var inheritsDescriptor = {
const inheritsDescriptor = {
name: undefined,
alias: alias + "$inherits",
alias: `${alias}$inherits`,
value: plugin.inherits,
options: options,
dirname: dirname
options,
dirname
};
var inherits = cache.invalidate(function (data) {
return loadPluginDescriptor(inheritsDescriptor, data);
});
const inherits = cache.invalidate(data => loadPluginDescriptor(inheritsDescriptor, data));
plugin.pre = chain(inherits.pre, plugin.pre);

@@ -258,14 +248,15 @@ plugin.post = chain(inherits.post, plugin.post);

var loadPresetDescriptor = function loadPresetDescriptor(descriptor, context) {
const loadPresetDescriptor = (descriptor, context) => {
return (0, _configChain.buildPresetChain)(instantiatePreset(loadDescriptor(descriptor, context)), context);
};
var instantiatePreset = (0, _caching.makeWeakCache)(function (_ref6) {
var value = _ref6.value,
dirname = _ref6.dirname,
alias = _ref6.alias;
const instantiatePreset = (0, _caching.makeWeakCache)(({
value,
dirname,
alias
}) => {
return {
options: (0, _options.validate)("preset", value),
alias: alias,
dirname: dirname
alias,
dirname
};

@@ -275,22 +266,18 @@ });

function chain(a, b) {
var fns = [a, b].filter(Boolean);
const fns = [a, b].filter(Boolean);
if (fns.length <= 1) return fns[0];
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return function (...args) {
for (var _iterator2 = fns, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref7;
var _ref3;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref7 = _iterator2[_i2++];
_ref3 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref7 = _i2.value;
_ref3 = _i2.value;
}
var fn = _ref7;
const fn = _ref3;
fn.apply(this, args);

@@ -297,0 +284,0 @@ }

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

function _semver() {
var data = _interopRequireDefault(require("semver"));
const data = _interopRequireDefault(require("semver"));

@@ -24,16 +24,14 @@ _semver = function _semver() {

function makeAPI(cache) {
var env = function env(value) {
return cache.using(function (data) {
if (typeof value === "undefined") return data.envName;
if (typeof value === "function") return value(data.envName);
if (!Array.isArray(value)) value = [value];
return value.some(function (entry) {
if (typeof entry !== "string") {
throw new Error("Unexpected non-string value");
}
const env = value => cache.using(data => {
if (typeof value === "undefined") return data.envName;
if (typeof value === "function") return value(data.envName);
if (!Array.isArray(value)) value = [value];
return value.some(entry => {
if (typeof entry !== "string") {
throw new Error("Unexpected non-string value");
}
return entry === data.envName;
});
return entry === data.envName;
});
};
});

@@ -43,7 +41,5 @@ return {

cache: cache.simple(),
env: env,
async: function async() {
return false;
},
assertVersion: assertVersion
env,
async: () => false,
assertVersion
};

@@ -58,3 +54,3 @@ }

range = "^" + range + ".0.0-0";
range = `^${range}.0.0-0`;
}

@@ -67,3 +63,3 @@

if (_semver().default.satisfies(_.version, range)) return;
var limit = Error.stackTraceLimit;
const limit = Error.stackTraceLimit;

@@ -74,3 +70,3 @@ if (typeof limit === "number" && limit < 25) {

var err = new Error("Requires Babel \"" + range + "\", but was loaded with \"" + _.version + "\". " + "If you are sure you have a compatible version of @babel/core, " + "it is likely that something in your build process is loading the " + "wrong version. Inspect the stack trace of this error to look for " + "the first entry that doesn't mention \"@babel/core\" or \"babel-core\" " + "to see what is calling Babel.");
const err = new Error(`Requires Babel "${range}", but was loaded with "${_.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`);

@@ -84,4 +80,4 @@ if (typeof limit === "number") {

version: _.version,
range: range
range
});
}

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

function getEnv(defaultValue) {
if (defaultValue === void 0) {
defaultValue = "development";
}
function getEnv(defaultValue = "development") {
return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
}

@@ -28,18 +28,13 @@ "use strict";

function loadOptions(opts) {
var config = (0, _full.default)(opts);
const config = (0, _full.default)(opts);
return config ? config.options : null;
}
var OptionManager = function () {
function OptionManager() {}
var _proto = OptionManager.prototype;
_proto.init = function init(opts) {
class OptionManager {
init(opts) {
return loadOptions(opts);
};
}
return OptionManager;
}();
}
exports.OptionManager = OptionManager;

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

function _path() {
var data = _interopRequireDefault(require("path"));
const data = _interopRequireDefault(require("path"));

@@ -29,10 +29,8 @@ _path = function _path() {

function createConfigItem(value, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$dirname = _ref.dirname,
dirname = _ref$dirname === void 0 ? "." : _ref$dirname,
type = _ref.type;
var descriptor = (0, _configDescriptors.createDescriptor)(value, _path().default.resolve(dirname), {
type: type,
function createConfigItem(value, {
dirname = ".",
type
} = {}) {
const descriptor = (0, _configDescriptors.createDescriptor)(value, _path().default.resolve(dirname), {
type,
alias: "programmatic item"

@@ -51,23 +49,26 @@ });

var ConfigItem = function ConfigItem(descriptor) {
this._descriptor = descriptor;
Object.defineProperty(this, "_descriptor", {
enumerable: false
});
class ConfigItem {
constructor(descriptor) {
this._descriptor = descriptor;
Object.defineProperty(this, "_descriptor", {
enumerable: false
});
if (this._descriptor.options === false) {
throw new Error("Assertion failure - unexpected false options");
if (this._descriptor.options === false) {
throw new Error("Assertion failure - unexpected false options");
}
this.value = this._descriptor.value;
this.options = this._descriptor.options;
this.dirname = this._descriptor.dirname;
this.name = this._descriptor.name;
this.file = this._descriptor.file ? {
request: this._descriptor.file.request,
resolved: this._descriptor.file.resolved
} : undefined;
Object.freeze(this);
}
this.value = this._descriptor.value;
this.options = this._descriptor.options;
this.dirname = this._descriptor.dirname;
this.name = this._descriptor.name;
this.file = this._descriptor.file ? {
request: this._descriptor.file.request,
resolved: this._descriptor.file.resolved
} : undefined;
Object.freeze(this);
};
}
Object.freeze(ConfigItem.prototype);

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

function _path() {
var data = _interopRequireDefault(require("path"));
const data = _interopRequireDefault(require("path"));

@@ -39,34 +39,31 @@ _path = function _path() {

var args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {};
var _args$envName = args.envName,
envName = _args$envName === void 0 ? (0, _environment.getEnv)() : _args$envName,
_args$cwd = args.cwd,
cwd = _args$cwd === void 0 ? "." : _args$cwd;
const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {};
const _args$envName = args.envName,
envName = _args$envName === void 0 ? (0, _environment.getEnv)() : _args$envName,
_args$cwd = args.cwd,
cwd = _args$cwd === void 0 ? "." : _args$cwd;
var absoluteCwd = _path().default.resolve(cwd);
const absoluteCwd = _path().default.resolve(cwd);
var context = {
const context = {
filename: args.filename ? _path().default.resolve(cwd, args.filename) : null,
cwd: absoluteCwd,
envName: envName
envName
};
var configChain = (0, _configChain.buildRootChain)(args, context);
const configChain = (0, _configChain.buildRootChain)(args, context);
if (!configChain) return null;
var options = {};
configChain.options.forEach(function (opts) {
const options = {};
configChain.options.forEach(opts => {
(0, _util.mergeOptions)(options, opts);
});
options.babelrc = false;
options.configFile = false;
options.envName = envName;
options.cwd = absoluteCwd;
options.passPerPreset = false;
options.plugins = configChain.plugins.map(function (descriptor) {
return (0, _item.createItemFromDescriptor)(descriptor);
});
options.presets = configChain.presets.map(function (descriptor) {
return (0, _item.createItemFromDescriptor)(descriptor);
});
options.plugins = configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
options.presets = configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
return {
options: options,
context: context,
options,
context,
ignore: configChain.ignore,

@@ -79,9 +76,9 @@ babelrc: configChain.babelrc,

function loadPartialConfig(inputOpts) {
var result = loadPrivatePartialConfig(inputOpts);
const result = loadPrivatePartialConfig(inputOpts);
if (!result) return null;
var options = result.options,
babelrc = result.babelrc,
ignore = result.ignore,
config = result.config;
(options.plugins || []).forEach(function (item) {
const options = result.options,
babelrc = result.babelrc,
ignore = result.ignore,
config = result.config;
(options.plugins || []).forEach(item => {
if (item.value instanceof _plugin.default) {

@@ -94,4 +91,4 @@ throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()");

var PartialConfig = function () {
function PartialConfig(options, babelrc, ignore, config) {
class PartialConfig {
constructor(options, babelrc, ignore, config) {
this.options = options;

@@ -104,11 +101,8 @@ this.babelignore = ignore;

var _proto = PartialConfig.prototype;
_proto.hasFilesystemConfig = function hasFilesystemConfig() {
hasFilesystemConfig() {
return this.babelrc !== undefined || this.config !== undefined;
};
}
return PartialConfig;
}();
}
Object.freeze(PartialConfig.prototype);

@@ -8,13 +8,16 @@ "use strict";

var Plugin = function Plugin(plugin, options, key) {
this.key = plugin.name || key;
this.manipulateOptions = plugin.manipulateOptions;
this.post = plugin.post;
this.pre = plugin.pre;
this.visitor = plugin.visitor || {};
this.parserOverride = plugin.parserOverride;
this.generatorOverride = plugin.generatorOverride;
this.options = options;
};
class Plugin {
constructor(plugin, options, key) {
this.key = plugin.name || key;
this.manipulateOptions = plugin.manipulateOptions;
this.post = plugin.post;
this.pre = plugin.pre;
this.visitor = plugin.visitor || {};
this.parserOverride = plugin.parserOverride;
this.generatorOverride = plugin.generatorOverride;
this.options = options;
}
}
exports.default = Plugin;

@@ -12,16 +12,14 @@ "use strict";

for (var _i = 0; _i < _arr.length; _i++) {
var k = _arr[_i];
const k = _arr[_i];
if (k === "parserOpts" && source.parserOpts) {
var parserOpts = source.parserOpts;
var targetObj = target.parserOpts = target.parserOpts || {};
const parserOpts = source.parserOpts;
const targetObj = target.parserOpts = target.parserOpts || {};
mergeDefaultFields(targetObj, parserOpts);
} else if (k === "generatorOpts" && source.generatorOpts) {
var generatorOpts = source.generatorOpts;
var _targetObj = target.generatorOpts = target.generatorOpts || {};
mergeDefaultFields(_targetObj, generatorOpts);
const generatorOpts = source.generatorOpts;
const targetObj = target.generatorOpts = target.generatorOpts || {};
mergeDefaultFields(targetObj, generatorOpts);
} else {
var val = source[k];
const val = source[k];
if (val !== undefined) target[k] = val;

@@ -36,6 +34,6 @@ }

for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var k = _arr2[_i2];
var val = source[k];
const k = _arr2[_i2];
const val = source[k];
if (val !== undefined) target[k] = val;
}
}

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

if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") {
throw new Error("." + key + " must be a boolean, \"inline\", \"both\", or undefined");
throw new Error(`.${key} must be a boolean, "inline", "both", or undefined`);
}

@@ -32,3 +32,3 @@

if (value !== undefined && typeof value !== "boolean" && value !== "auto") {
throw new Error("." + key + " must be a boolean, \"auto\", or undefined");
throw new Error(`.${key} must be a boolean, "auto", or undefined`);
}

@@ -41,3 +41,3 @@

if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") {
throw new Error("." + key + " must be \"module\", \"script\", \"unambiguous\", or undefined");
throw new Error(`.${key} must be "module", "script", "unambiguous", or undefined`);
}

@@ -58,3 +58,3 @@

if (value !== undefined && typeof value !== "string") {
throw new Error("." + key + " must be a string, or undefined");
throw new Error(`.${key} must be a string, or undefined`);
}

@@ -67,3 +67,3 @@

if (value !== undefined && typeof value !== "function") {
throw new Error("." + key + " must be a function, or undefined");
throw new Error(`.${key} must be a function, or undefined`);
}

@@ -76,3 +76,3 @@

if (value !== undefined && typeof value !== "boolean") {
throw new Error("." + key + " must be a boolean, or undefined");
throw new Error(`.${key} must be a boolean, or undefined`);
}

@@ -85,3 +85,3 @@

if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) {
throw new Error("." + key + " must be an object, or undefined");
throw new Error(`.${key} must be an object, or undefined`);
}

@@ -94,3 +94,3 @@

if (value != null && !Array.isArray(value)) {
throw new Error("." + key + " must be an array, or undefined");
throw new Error(`.${key} must be an array, or undefined`);
}

@@ -102,8 +102,6 @@

function assertIgnoreList(key, value) {
var arr = assertArray(key, value);
const arr = assertArray(key, value);
if (arr) {
arr.forEach(function (item, i) {
return assertIgnoreItem(key, i, item);
});
arr.forEach((item, i) => assertIgnoreItem(key, i, item));
}

@@ -116,3 +114,3 @@

if (typeof value !== "string" && typeof value !== "function" && !(value instanceof RegExp)) {
throw new Error("." + key + "[" + index + "] must be an array of string/Funtion/RegExp values, or undefined");
throw new Error(`.${key}[${index}] must be an array of string/Funtion/RegExp values, or undefined`);
}

@@ -127,9 +125,9 @@

if (Array.isArray(value)) {
value.forEach(function (item, i) {
value.forEach((item, i) => {
if (!checkValidTest(item)) {
throw new Error("." + key + "[" + i + "] must be a string/Function/RegExp.");
throw new Error(`.${key}[${i}] must be a string/Function/RegExp.`);
}
});
} else if (!checkValidTest(value)) {
throw new Error("." + key + " must be a string/Function/RegExp, or an array of those");
throw new Error(`.${key} must be a string/Function/RegExp, or an array of those`);
}

@@ -146,3 +144,3 @@

if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") {
throw new Error("." + key + " must be a undefined, a boolean, a string, " + ("got " + JSON.stringify(value)));
throw new Error(`.${key} must be a undefined, a boolean, a string, ` + `got ${JSON.stringify(value)}`);
}

@@ -157,9 +155,9 @@

if (Array.isArray(value)) {
value.forEach(function (item, i) {
value.forEach((item, i) => {
if (typeof item !== "string") {
throw new Error("." + key + "[" + i + "] must be a string.");
throw new Error(`.${key}[${i}] must be a string.`);
}
});
} else if (typeof value !== "string") {
throw new Error("." + key + " must be a undefined, a boolean, a string, " + ("or an array of strings, got " + JSON.stringify(value)));
throw new Error(`.${key} must be a undefined, a boolean, a string, ` + `or an array of strings, got ${JSON.stringify(value)}`);
}

@@ -171,8 +169,6 @@

function assertPluginList(key, value) {
var arr = assertArray(key, value);
const arr = assertArray(key, value);
if (arr) {
arr.forEach(function (item, i) {
return assertPluginItem(key, i, item);
});
arr.forEach((item, i) => assertPluginItem(key, i, item));
}

@@ -186,7 +182,7 @@

if (value.length === 0) {
throw new Error("." + key + "[" + index + "] must include an object");
throw new Error(`.${key}[${index}] must include an object`);
}
if (value.length > 3) {
throw new Error("." + key + "[" + index + "] may only be a two-tuple or three-tuple");
throw new Error(`.${key}[${index}] may only be a two-tuple or three-tuple`);
}

@@ -197,6 +193,6 @@

if (value.length > 1) {
var opts = value[1];
const opts = value[1];
if (opts !== undefined && opts !== false && (typeof opts !== "object" || Array.isArray(opts))) {
throw new Error("." + key + "[" + index + "][1] must be an object, false, or undefined");
throw new Error(`.${key}[${index}][1] must be an object, false, or undefined`);
}

@@ -206,6 +202,6 @@ }

if (value.length === 3) {
var name = value[2];
const name = value[2];
if (name !== undefined && typeof name !== "string") {
throw new Error("." + key + "[" + index + "][2] must be a string, or undefined");
throw new Error(`.${key}[${index}][2] must be a string, or undefined`);
}

@@ -222,3 +218,3 @@ }

if ((typeof value !== "object" || !value) && typeof value !== "string" && typeof value !== "function") {
throw new Error("." + key + "[" + index + "]" + (inArray ? "[0]" : "") + " must be a string, object, function");
throw new Error(`.${key}[${index}]${inArray ? `[0]` : ""} must be a string, object, function`);
}

@@ -225,0 +221,0 @@

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

var ROOT_VALIDATORS = {
const ROOT_VALIDATORS = {
cwd: _optionAssertions.assertString,

@@ -23,4 +23,2 @@ root: _optionAssertions.assertString,

filenameRelative: _optionAssertions.assertString,
babelrc: _optionAssertions.assertBoolean,
babelrcRoots: _optionAssertions.assertBabelrcSearch,
code: _optionAssertions.assertBoolean,

@@ -30,3 +28,7 @@ ast: _optionAssertions.assertBoolean,

};
var NONPRESET_VALIDATORS = {
const BABELRC_VALIDATORS = {
babelrc: _optionAssertions.assertBoolean,
babelrcRoots: _optionAssertions.assertBabelrcSearch
};
const NONPRESET_VALIDATORS = {
extends: _optionAssertions.assertString,

@@ -41,3 +43,3 @@ env: assertEnvSet,

};
var COMMON_VALIDATORS = {
const COMMON_VALIDATORS = {
inputSourceMap: _optionAssertions.assertInputSourceMap,

@@ -71,24 +73,32 @@ presets: _optionAssertions.assertPluginList,

assertNoDuplicateSourcemap(opts);
Object.keys(opts).forEach(function (key) {
Object.keys(opts).forEach(key => {
if (type === "preset" && NONPRESET_VALIDATORS[key]) {
throw new Error("." + key + " is not allowed in preset options");
throw new Error(`.${key} is not allowed in preset options`);
}
if (type !== "arguments" && ROOT_VALIDATORS[key]) {
throw new Error("." + key + " is only allowed in root programmatic options");
throw new Error(`.${key} is only allowed in root programmatic options`);
}
if (type !== "arguments" && type !== "configfile" && BABELRC_VALIDATORS[key]) {
if (type === "babelrcfile" || type === "extendsfile") {
throw new Error(`.${key} is not allowed in .babelrc or "extend"ed files, only in root programmatic options, ` + `or babel.config.js/config file options`);
}
throw new Error(`.${key} is only allowed in root programmatic options, or babel.config.js/config file options`);
}
if (type === "env" && key === "env") {
throw new Error("." + key + " is not allowed inside another env block");
throw new Error(`.${key} is not allowed inside another env block`);
}
if (type === "env" && key === "overrides") {
throw new Error("." + key + " is not allowed inside an env block");
throw new Error(`.${key} is not allowed inside an env block`);
}
if (type === "override" && key === "overrides") {
throw new Error("." + key + " is not allowed inside an overrides block");
throw new Error(`.${key} is not allowed inside an overrides block`);
}
var validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || ROOT_VALIDATORS[key];
const validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || BABELRC_VALIDATORS[key] || ROOT_VALIDATORS[key];
if (validator) validator(key, opts[key]);else throw buildUnknownError(key);

@@ -101,9 +111,9 @@ });

if (_removed.default[key]) {
var _removed$key = _removed.default[key],
message = _removed$key.message,
_removed$key$version = _removed$key.version,
version = _removed$key$version === void 0 ? 5 : _removed$key$version;
throw new ReferenceError("Using removed Babel " + version + " option: ." + key + " - " + message);
const _removed$key = _removed.default[key],
message = _removed$key.message,
_removed$key$version = _removed$key.version,
version = _removed$key$version === void 0 ? 5 : _removed$key$version;
throw new ReferenceError(`Using removed Babel ${version} option: .${key} - ${message}`);
} else {
var unknownOptErr = "Unknown option: ." + key + ". Check out http://babeljs.io/docs/usage/options/ for more information about options.";
const unknownOptErr = `Unknown option: .${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`;
throw new ReferenceError(unknownOptErr);

@@ -124,3 +134,3 @@ }

function assertEnvSet(key, value) {
var obj = (0, _optionAssertions.assertObject)(key, value);
const obj = (0, _optionAssertions.assertObject)(key, value);

@@ -131,7 +141,5 @@ if (obj) {

for (var _i = 0; _i < _arr.length; _i++) {
var _key = _arr[_i];
var _env = (0, _optionAssertions.assertObject)(_key, obj[_key]);
if (_env) validate("env", _env);
const key = _arr[_i];
const env = (0, _optionAssertions.assertObject)(key, obj[key]);
if (env) validate("env", env);
}

@@ -144,3 +152,3 @@ }

function assertOverridesList(key, value) {
var arr = (0, _optionAssertions.assertArray)(key, value);
const arr = (0, _optionAssertions.assertArray)(key, value);

@@ -160,10 +168,8 @@ if (arr) {

var _ref2 = _ref,
index = _ref2[0],
item = _ref2[1];
var _env2 = (0, _optionAssertions.assertObject)("" + index, item);
if (!_env2) throw new Error("." + key + "[" + index + "] must be an object");
validate("override", _env2);
const _ref2 = _ref,
index = _ref2[0],
item = _ref2[1];
const env = (0, _optionAssertions.assertObject)(`${index}`, item);
if (!env) throw new Error(`.${key}[${index}] must be an object`);
validate("override", env);
}

@@ -170,0 +176,0 @@ }

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

var VALIDATORS = {
const VALIDATORS = {
name: _optionAssertions.assertString,

@@ -23,11 +23,9 @@ manipulateOptions: _optionAssertions.assertFunction,

function assertVisitorMap(key, value) {
var obj = (0, _optionAssertions.assertObject)(key, value);
const obj = (0, _optionAssertions.assertObject)(key, value);
if (obj) {
Object.keys(obj).forEach(function (prop) {
return assertVisitorHandler(prop, obj[prop]);
});
Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop]));
if (obj.enter || obj.exit) {
throw new Error("." + key + " cannot contain catch-all \"enter\" or \"exit\" handlers. Please target individual nodes.");
throw new Error(`.${key} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`);
}

@@ -41,9 +39,9 @@ }

if (value && typeof value === "object") {
Object.keys(value).forEach(function (handler) {
Object.keys(value).forEach(handler => {
if (handler !== "enter" && handler !== "exit") {
throw new Error(".visitor[\"" + key + "\"] may only have .enter and/or .exit handlers.");
throw new Error(`.visitor["${key}"] may only have .enter and/or .exit handlers.`);
}
});
} else if (typeof value !== "function") {
throw new Error(".visitor[\"" + key + "\"] must be a function");
throw new Error(`.visitor["${key}"] must be a function`);
}

@@ -55,7 +53,7 @@

function validatePluginObject(obj) {
Object.keys(obj).forEach(function (key) {
var validator = VALIDATORS[key];
if (validator) validator(key, obj[key]);else throw new Error("." + key + " is not a valid Plugin property");
Object.keys(obj).forEach(key => {
const validator = VALIDATORS[key];
if (validator) validator(key, obj[key]);else throw new Error(`.${key} is not a valid Plugin property`);
});
return obj;
}

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

function _types() {
var data = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));

@@ -152,3 +152,3 @@ _types = function _types() {

function _traverse() {
var data = _interopRequireDefault(require("@babel/traverse"));
const data = _interopRequireDefault(require("@babel/traverse"));

@@ -163,3 +163,3 @@ _traverse = function _traverse() {

function _template() {
var data = _interopRequireDefault(require("@babel/template"));
const data = _interopRequireDefault(require("@babel/template"));

@@ -196,6 +196,6 @@ _template = function _template() {

function Plugin(alias) {
throw new Error("The (" + alias + ") Babel 5 plugin is being run with an unsupported Babel version.");
throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`);
}
var DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;

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

function parse(code, opts) {
var config = (0, _config.default)(opts);
const config = (0, _config.default)(opts);

@@ -24,4 +24,4 @@ if (config === null) {

var file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code);
const file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code);
return file.ast;
}

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

function helpers() {
var data = _interopRequireWildcard(require("@babel/helpers"));
const data = _interopRequireWildcard(require("@babel/helpers"));

@@ -20,3 +20,3 @@ helpers = function helpers() {

function _generator() {
var data = _interopRequireDefault(require("@babel/generator"));
const data = _interopRequireDefault(require("@babel/generator"));

@@ -31,3 +31,3 @@ _generator = function _generator() {

function _template() {
var data = _interopRequireDefault(require("@babel/template"));
const data = _interopRequireDefault(require("@babel/template"));

@@ -42,3 +42,3 @@ _template = function _template() {

function t() {
var data = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));

@@ -52,4 +52,2 @@ t = function t() {

var _templateObject = _taggedTemplateLiteralLoose(["\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n "]);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -59,13 +57,21 @@

function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
const buildUmdWrapper = replacements => _template().default`
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(AMD_ARGUMENTS, factory);
} else if (typeof exports === "object") {
factory(COMMON_ARGUMENTS);
} else {
factory(BROWSER_ARGUMENTS);
}
})(UMD_ROOT, function (FACTORY_PARAMETERS) {
FACTORY_BODY
});
`(replacements);
var buildUmdWrapper = function buildUmdWrapper(replacements) {
return (0, _template().default)(_templateObject)(replacements);
};
function buildGlobal(whitelist) {
var namespace = t().identifier("babelHelpers");
var body = [];
var container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
var tree = t().program([t().expressionStatement(t().callExpression(container, [t().conditionalExpression(t().binaryExpression("===", t().unaryExpression("typeof", t().identifier("global")), t().stringLiteral("undefined")), t().identifier("self"), t().identifier("global"))]))]);
const namespace = t().identifier("babelHelpers");
const body = [];
const container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
const tree = t().program([t().expressionStatement(t().callExpression(container, [t().conditionalExpression(t().binaryExpression("===", t().unaryExpression("typeof", t().identifier("global")), t().stringLiteral("undefined")), t().identifier("self"), t().identifier("global"))]))]);
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().assignmentExpression("=", t().memberExpression(t().identifier("global"), namespace), t().objectExpression([])))]));

@@ -77,5 +83,5 @@ buildHelpers(body, namespace, whitelist);

function buildModule(whitelist) {
var body = [];
var refs = buildHelpers(body, null, whitelist);
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(function (name) {
const body = [];
const refs = buildHelpers(body, null, whitelist);
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(name => {
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name));

@@ -87,4 +93,4 @@ })));

function buildUmd(whitelist) {
var namespace = t().identifier("babelHelpers");
var body = [];
const namespace = t().identifier("babelHelpers");
const body = [];
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))]));

@@ -103,6 +109,6 @@ buildHelpers(body, namespace, whitelist);

function buildVar(whitelist) {
var namespace = t().identifier("babelHelpers");
var body = [];
const namespace = t().identifier("babelHelpers");
const body = [];
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))]));
var tree = t().program(body);
const tree = t().program(body);
buildHelpers(body, namespace, whitelist);

@@ -114,15 +120,15 @@ body.push(t().expressionStatement(namespace));

function buildHelpers(body, namespace, whitelist) {
var getHelperReference = function getHelperReference(name) {
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier("_" + name);
const getHelperReference = name => {
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier(`_${name}`);
};
var refs = {};
const refs = {};
helpers().list.forEach(function (name) {
if (whitelist && whitelist.indexOf(name) < 0) return;
var ref = refs[name] = getHelperReference(name);
const ref = refs[name] = getHelperReference(name);
var _helpers$get = helpers().get(name, getHelperReference, ref),
nodes = _helpers$get.nodes;
const _helpers$get = helpers().get(name, getHelperReference, ref),
nodes = _helpers$get.nodes;
body.push.apply(body, nodes);
body.push(...nodes);
});

@@ -132,9 +138,5 @@ return refs;

function _default(whitelist, outputType) {
if (outputType === void 0) {
outputType = "global";
}
var tree;
var build = {
function _default(whitelist, outputType = "global") {
let tree;
const build = {
global: buildGlobal,

@@ -149,3 +151,3 @@ module: buildModule,

} else {
throw new Error("Unsupported output type " + outputType);
throw new Error(`Unsupported output type ${outputType}`);
}

@@ -152,0 +154,0 @@

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

function transformFromAstSync(ast, code, opts) {
var config = (0, _config.default)(opts);
const config = (0, _config.default)(opts);
if (config === null) return null;

@@ -18,0 +18,0 @@ if (!ast) throw new Error("No AST given");

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

if (callback === undefined) return (0, _transformAstSync.default)(ast, code, opts);
var cb = callback;
process.nextTick(function () {
var cfg;
const cb = callback;
process.nextTick(() => {
let cfg;

@@ -28,0 +28,0 @@ try {

@@ -8,7 +8,3 @@ "use strict";

function transformFile(filename, opts, callback) {
if (opts === void 0) {
opts = {};
}
function transformFile(filename, opts = {}, callback) {
if (typeof opts === "function") {

@@ -15,0 +11,0 @@ callback = opts;

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

function _fs() {
var data = _interopRequireDefault(require("fs"));
const data = _interopRequireDefault(require("fs"));

@@ -26,17 +26,17 @@ _fs = function _fs() {

function transformFileSync(filename, opts) {
var options;
let options;
if (opts == null) {
options = {
filename: filename
filename
};
} else if (opts && typeof opts === "object") {
options = Object.assign({}, opts, {
filename: filename
filename
});
}
var config = (0, _config.default)(options);
const config = (0, _config.default)(options);
if (config === null) return null;
return (0, _transformation.runSync)(config, _fs().default.readFileSync(filename, "utf8"));
}

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

function _fs() {
var data = _interopRequireDefault(require("fs"));
const data = _interopRequireDefault(require("fs"));

@@ -26,3 +26,3 @@ _fs = function _fs() {

var transformFile = function transformFile(filename, opts, callback) {
var options;
let options;

@@ -36,12 +36,12 @@ if (typeof opts === "function") {

options = {
filename: filename
filename
};
} else if (opts && typeof opts === "object") {
options = Object.assign({}, opts, {
filename: filename
filename
});
}
process.nextTick(function () {
var cfg;
process.nextTick(() => {
let cfg;

@@ -55,3 +55,3 @@ try {

var config = cfg;
const config = cfg;

@@ -58,0 +58,0 @@ _fs().default.readFile(filename, "utf8", function (err, code) {

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

function transformSync(code, opts) {
var config = (0, _config.default)(opts);
const config = (0, _config.default)(opts);
if (config === null) return null;
return (0, _transformation.runSync)(config, code);
}

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

if (callback === undefined) return (0, _transformSync.default)(code, opts);
var cb = callback;
process.nextTick(function () {
var cfg;
const cb = callback;
process.nextTick(() => {
let cfg;

@@ -28,0 +28,0 @@ try {

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

function _sortBy() {
var data = _interopRequireDefault(require("lodash/sortBy"));
const data = _interopRequireDefault(require("lodash/sortBy"));

@@ -23,7 +23,7 @@ _sortBy = function _sortBy() {

var LOADED_PLUGIN;
let LOADED_PLUGIN;
function loadBlockHoistPlugin() {
if (!LOADED_PLUGIN) {
var config = (0, _config.default)({
const config = (0, _config.default)({
babelrc: false,

@@ -40,12 +40,13 @@ configFile: false,

var blockHoistPlugin = {
const blockHoistPlugin = {
name: "internal.blockHoist",
visitor: {
Block: {
exit: function exit(_ref) {
var node = _ref.node;
var hasChange = false;
exit({
node
}) {
let hasChange = false;
for (var i = 0; i < node.body.length; i++) {
var bodyNode = node.body[i];
for (let i = 0; i < node.body.length; i++) {
const bodyNode = node.body[i];

@@ -60,3 +61,3 @@ if (bodyNode && bodyNode._blockHoist != null) {

node.body = (0, _sortBy().default)(node.body, function (bodyNode) {
var priority = bodyNode && bodyNode._blockHoist;
let priority = bodyNode && bodyNode._blockHoist;
if (priority == null) priority = 1;

@@ -67,4 +68,5 @@ if (priority === true) priority = 2;

}
}
}
};

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

function helpers() {
var data = _interopRequireWildcard(require("@babel/helpers"));
const data = _interopRequireWildcard(require("@babel/helpers"));

@@ -20,3 +20,3 @@ helpers = function helpers() {

function _traverse() {
var data = _interopRequireWildcard(require("@babel/traverse"));
const data = _interopRequireWildcard(require("@babel/traverse"));

@@ -31,3 +31,3 @@ _traverse = function _traverse() {

function _codeFrame() {
var data = require("@babel/code-frame");
const data = require("@babel/code-frame");

@@ -42,3 +42,3 @@ _codeFrame = function _codeFrame() {

function t() {
var data = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));

@@ -54,5 +54,5 @@ t = function t() {

var errorVisitor = {
enter: function enter(path, state) {
var loc = path.node.loc;
const errorVisitor = {
enter(path, state) {
const loc = path.node.loc;

@@ -64,10 +64,12 @@ if (loc) {

}
};
var File = function () {
function File(options, _ref) {
var code = _ref.code,
ast = _ref.ast,
shebang = _ref.shebang,
inputMap = _ref.inputMap;
class File {
constructor(options, {
code,
ast,
shebang,
inputMap
}) {
this._map = new Map();

@@ -97,30 +99,28 @@ this.declarations = {};

var _proto = File.prototype;
_proto.set = function set(key, val) {
set(key, val) {
this._map.set(key, val);
};
}
_proto.get = function get(key) {
get(key) {
return this._map.get(key);
};
}
_proto.has = function has(key) {
has(key) {
return this._map.has(key);
};
}
_proto.getModuleName = function getModuleName() {
var _opts = this.opts,
filename = _opts.filename,
_opts$filenameRelativ = _opts.filenameRelative,
filenameRelative = _opts$filenameRelativ === void 0 ? filename : _opts$filenameRelativ,
moduleId = _opts.moduleId,
_opts$moduleIds = _opts.moduleIds,
moduleIds = _opts$moduleIds === void 0 ? !!moduleId : _opts$moduleIds,
getModuleId = _opts.getModuleId,
sourceRootTmp = _opts.sourceRoot,
_opts$moduleRoot = _opts.moduleRoot,
moduleRoot = _opts$moduleRoot === void 0 ? sourceRootTmp : _opts$moduleRoot,
_opts$sourceRoot = _opts.sourceRoot,
sourceRoot = _opts$sourceRoot === void 0 ? moduleRoot : _opts$sourceRoot;
getModuleName() {
const _this$opts = this.opts,
filename = _this$opts.filename,
_this$opts$filenameRe = _this$opts.filenameRelative,
filenameRelative = _this$opts$filenameRe === void 0 ? filename : _this$opts$filenameRe,
moduleId = _this$opts.moduleId,
_this$opts$moduleIds = _this$opts.moduleIds,
moduleIds = _this$opts$moduleIds === void 0 ? !!moduleId : _this$opts$moduleIds,
getModuleId = _this$opts.getModuleId,
sourceRootTmp = _this$opts.sourceRoot,
_this$opts$moduleRoot = _this$opts.moduleRoot,
moduleRoot = _this$opts$moduleRoot === void 0 ? sourceRootTmp : _this$opts$moduleRoot,
_this$opts$sourceRoot = _this$opts.sourceRoot,
sourceRoot = _this$opts$sourceRoot === void 0 ? moduleRoot : _this$opts$sourceRoot;
if (!moduleIds) return null;

@@ -132,6 +132,6 @@

var moduleName = moduleRoot != null ? moduleRoot + "/" : "";
let moduleName = moduleRoot != null ? moduleRoot + "/" : "";
if (filenameRelative) {
var sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : "";
const sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : "";
moduleName += filenameRelative.replace(sourceRootReplacer, "").replace(/\.(\w*?)$/, "");

@@ -147,22 +147,20 @@ }

}
};
}
_proto.resolveModuleSource = function resolveModuleSource(source) {
resolveModuleSource(source) {
return source;
};
}
_proto.addImport = function addImport() {
addImport() {
throw new Error("This API has been removed. If you're looking for this " + "functionality in Babel 7, you should import the " + "'@babel/helper-module-imports' module and use the functions exposed " + " from that module, such as 'addNamed' or 'addDefault'.");
};
}
_proto.addHelper = function addHelper(name) {
var _this = this;
var declar = this.declarations[name];
addHelper(name) {
const declar = this.declarations[name];
if (declar) return t().cloneNode(declar);
var generator = this.get("helperGenerator");
var runtime = this.get("helpersNamespace");
const generator = this.get("helperGenerator");
const runtime = this.get("helpersNamespace");
if (generator) {
var res = generator(name);
const res = generator(name);
if (res) return res;

@@ -173,57 +171,51 @@ } else if (runtime) {

var uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
var dependencies = {};
const uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
const dependencies = {};
for (var _iterator = helpers().getDependencies(name), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref2;
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref2 = _iterator[_i++];
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref2 = _i.value;
_ref = _i.value;
}
var dep = _ref2;
const dep = _ref;
dependencies[dep] = this.addHelper(dep);
}
var _helpers$get = helpers().get(name, function (dep) {
return dependencies[dep];
}, uid, Object.keys(this.scope.getAllBindings())),
nodes = _helpers$get.nodes,
globals = _helpers$get.globals;
const _helpers$get = helpers().get(name, dep => dependencies[dep], uid, Object.keys(this.scope.getAllBindings())),
nodes = _helpers$get.nodes,
globals = _helpers$get.globals;
globals.forEach(function (name) {
if (_this.path.scope.hasBinding(name, true)) {
_this.path.scope.rename(name);
globals.forEach(name => {
if (this.path.scope.hasBinding(name, true)) {
this.path.scope.rename(name);
}
});
nodes.forEach(function (node) {
nodes.forEach(node => {
node._compact = true;
});
this.path.unshiftContainer("body", nodes);
this.path.get("body").forEach(function (path) {
this.path.get("body").forEach(path => {
if (nodes.indexOf(path.node) === -1) return;
if (path.isVariableDeclaration()) _this.scope.registerDeclaration(path);
if (path.isVariableDeclaration()) this.scope.registerDeclaration(path);
});
return uid;
};
}
_proto.addTemplateObject = function addTemplateObject() {
addTemplateObject() {
throw new Error("This function has been moved into the template literal transform itself.");
};
}
_proto.buildCodeFrameError = function buildCodeFrameError(node, msg, Error) {
if (Error === void 0) {
Error = SyntaxError;
}
buildCodeFrameError(node, msg, Error = SyntaxError) {
let loc = node && (node.loc || node._loc);
msg = `${this.opts.filename}: ${msg}`;
var loc = node && (node.loc || node._loc);
msg = this.opts.filename + ": " + msg;
if (!loc && node) {
var state = {
const state = {
loc: null

@@ -233,10 +225,10 @@ };

loc = state.loc;
var txt = "This is an error on an internal node. Probably an internal error.";
let txt = "This is an error on an internal node. Probably an internal error.";
if (loc) txt += " Location has been estimated.";
msg += " (" + txt + ")";
msg += ` (${txt})`;
}
if (loc) {
var _opts$highlightCode = this.opts.highlightCode,
highlightCode = _opts$highlightCode === void 0 ? true : _opts$highlightCode;
const _this$opts$highlightC = this.opts.highlightCode,
highlightCode = _this$opts$highlightC === void 0 ? true : _this$opts$highlightC;
msg += "\n" + (0, _codeFrame().codeFrameColumns)(this.code, {

@@ -248,3 +240,3 @@ start: {

}, {
highlightCode: highlightCode
highlightCode
});

@@ -254,7 +246,6 @@ }

return new Error(msg);
};
}
return File;
}();
}
exports.default = File;

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

function _convertSourceMap() {
var data = _interopRequireDefault(require("convert-source-map"));
const data = _interopRequireDefault(require("convert-source-map"));

@@ -19,14 +19,4 @@ _convertSourceMap = function _convertSourceMap() {

function _sourceMap() {
var data = _interopRequireDefault(require("source-map"));
_sourceMap = function _sourceMap() {
return data;
};
return data;
}
function _generator() {
var data = _interopRequireDefault(require("@babel/generator"));
const data = _interopRequireDefault(require("@babel/generator"));

@@ -40,11 +30,13 @@ _generator = function _generator() {

var _mergeMap = _interopRequireDefault(require("./merge-map"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function generateCode(pluginPasses, file) {
var opts = file.opts,
ast = file.ast,
shebang = file.shebang,
code = file.code,
inputMap = file.inputMap;
var results = [];
const opts = file.opts,
ast = file.ast,
shebang = file.shebang,
code = file.code,
inputMap = file.inputMap;
const results = [];

@@ -63,3 +55,3 @@ for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

var plugins = _ref;
const plugins = _ref;

@@ -78,9 +70,8 @@ for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {

var plugin = _ref2;
var generatorOverride = plugin.generatorOverride;
const plugin = _ref2;
const generatorOverride = plugin.generatorOverride;
if (generatorOverride) {
var _result2 = generatorOverride(ast, opts.generatorOpts, code, _generator().default);
if (_result2 !== undefined) results.push(_result2);
const result = generatorOverride(ast, opts.generatorOpts, code, _generator().default);
if (result !== undefined) results.push(result);
}

@@ -90,3 +81,3 @@ }

var result;
let result;

@@ -99,3 +90,3 @@ if (results.length === 0) {

if (typeof result.then === "function") {
throw new Error("You appear to be using an async parser plugin, " + "which your current version of Babel does not support. " + "If you're using a published plugin, " + "you may need to upgrade your @babel/core version.");
throw new Error(`You appear to be using an async parser plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
}

@@ -106,3 +97,3 @@ } else {

var _result = result,
let _result = result,
outputCode = _result.code,

@@ -112,7 +103,7 @@ outputMap = _result.map;

if (shebang) {
outputCode = shebang + "\n" + outputCode;
outputCode = `${shebang}\n${outputCode}`;
}
if (outputMap && inputMap) {
outputMap = mergeSourceMap(inputMap.toObject(), outputMap);
outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap);
}

@@ -129,37 +120,5 @@

return {
outputCode: outputCode,
outputMap: outputMap
outputCode,
outputMap
};
}
function mergeSourceMap(inputMap, map) {
var inputMapConsumer = new (_sourceMap().default.SourceMapConsumer)(inputMap);
var outputMapConsumer = new (_sourceMap().default.SourceMapConsumer)(map);
var mergedGenerator = new (_sourceMap().default.SourceMapGenerator)({
file: inputMapConsumer.file,
sourceRoot: inputMapConsumer.sourceRoot
});
var source = outputMapConsumer.sources[0];
inputMapConsumer.eachMapping(function (mapping) {
var generatedPosition = outputMapConsumer.generatedPositionFor({
line: mapping.generatedLine,
column: mapping.generatedColumn,
source: source
});
if (generatedPosition.column != null) {
mergedGenerator.addMapping({
source: mapping.source,
original: mapping.source == null ? null : {
line: mapping.originalLine,
column: mapping.originalColumn
},
generated: generatedPosition,
name: mapping.name
});
}
});
var mergedMap = mergedGenerator.toJSON();
inputMap.mappings = mergedMap.mappings;
return inputMap;
}

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

function _traverse() {
var data = _interopRequireDefault(require("@babel/traverse"));
const data = _interopRequireDefault(require("@babel/traverse"));

@@ -33,3 +33,3 @@ _traverse = function _traverse() {

function runAsync(config, code, ast, callback) {
var result;
let result;

@@ -46,9 +46,9 @@ try {

function runSync(config, code, ast) {
var file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
const file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
transformFile(file, config.passes);
var opts = file.opts;
const opts = file.opts;
var _ref = opts.code !== false ? (0, _generate.default)(config.passes, file) : {},
outputCode = _ref.outputCode,
outputMap = _ref.outputMap;
const _ref = opts.code !== false ? (0, _generate.default)(config.passes, file) : {},
outputCode = _ref.outputCode,
outputMap = _ref.outputMap;

@@ -78,6 +78,6 @@ return {

var pluginPairs = _ref2;
var passPairs = [];
var passes = [];
var visitors = [];
const pluginPairs = _ref2;
const passPairs = [];
const passes = [];
const visitors = [];

@@ -96,4 +96,4 @@ for (var _iterator2 = pluginPairs.concat([(0, _blockHoistPlugin.default)()]), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {

var plugin = _ref3;
var pass = new _pluginPass.default(file, plugin.key, plugin.options);
const plugin = _ref3;
const pass = new _pluginPass.default(file, plugin.key, plugin.options);
passPairs.push([plugin, pass]);

@@ -105,12 +105,12 @@ passes.push(pass);

for (var _i3 = 0; _i3 < passPairs.length; _i3++) {
var _passPairs$_i = passPairs[_i3],
_plugin = _passPairs$_i[0],
_pass = _passPairs$_i[1];
var fn = _plugin.pre;
const _passPairs$_i = passPairs[_i3],
plugin = _passPairs$_i[0],
pass = _passPairs$_i[1];
const fn = plugin.pre;
if (fn) {
var result = fn.call(_pass, file);
const result = fn.call(pass, file);
if (isThenable(result)) {
throw new Error("You appear to be using an plugin with an async .pre, " + "which your current version of Babel does not support." + "If you're using a published plugin, you may need to upgrade " + "your @babel/core version.");
throw new Error(`You appear to be using an plugin with an async .pre, ` + `which your current version of Babel does not support.` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
}

@@ -120,3 +120,3 @@ }

var visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod);
const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod);

@@ -126,12 +126,12 @@ (0, _traverse().default)(file.ast, visitor, file.scope);

for (var _i4 = 0; _i4 < passPairs.length; _i4++) {
var _passPairs$_i2 = passPairs[_i4],
_plugin2 = _passPairs$_i2[0],
_pass2 = _passPairs$_i2[1];
var _fn = _plugin2.post;
const _passPairs$_i2 = passPairs[_i4],
plugin = _passPairs$_i2[0],
pass = _passPairs$_i2[1];
const fn = plugin.post;
if (_fn) {
var _result = _fn.call(_pass2, file);
if (fn) {
const result = fn.call(pass, file);
if (isThenable(_result)) {
throw new Error("You appear to be using an plugin with an async .post, " + "which your current version of Babel does not support." + "If you're using a published plugin, you may need to upgrade " + "your @babel/core version.");
if (isThenable(result)) {
throw new Error(`You appear to be using an plugin with an async .post, ` + `which your current version of Babel does not support.` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
}

@@ -138,0 +138,0 @@ }

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

function t() {
var data = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));

@@ -20,3 +20,3 @@ t = function t() {

function _convertSourceMap() {
var data = _interopRequireDefault(require("convert-source-map"));
const data = _interopRequireDefault(require("convert-source-map"));

@@ -31,3 +31,3 @@ _convertSourceMap = function _convertSourceMap() {

function _babylon() {
var data = require("babylon");
const data = require("babylon");

@@ -42,3 +42,3 @@ _babylon = function _babylon() {

function _codeFrame() {
var data = require("@babel/code-frame");
const data = require("@babel/code-frame");

@@ -60,8 +60,8 @@ _codeFrame = function _codeFrame() {

var shebangRegex = /^#!.*/;
const shebangRegex = /^#!.*/;
function normalizeFile(pluginPasses, options, code, ast) {
code = "" + (code || "");
var shebang = null;
var inputMap = null;
code = `${code || ""}`;
let shebang = null;
let inputMap = null;

@@ -78,3 +78,3 @@ if (options.inputSourceMap !== false) {

var shebangMatch = shebangRegex.exec(code);
const shebangMatch = shebangRegex.exec(code);

@@ -97,6 +97,6 @@ if (shebangMatch) {

return new _file.default(options, {
code: code,
ast: ast,
shebang: shebang,
inputMap: inputMap
code,
ast,
shebang,
inputMap
});

@@ -107,3 +107,3 @@ }

try {
var results = [];
const results = [];

@@ -122,3 +122,3 @@ for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

var plugins = _ref;
const plugins = _ref;

@@ -137,9 +137,8 @@ for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {

var plugin = _ref2;
var parserOverride = plugin.parserOverride;
const plugin = _ref2;
const parserOverride = plugin.parserOverride;
if (parserOverride) {
var _ast = parserOverride(code, options.parserOpts, _babylon().parse);
if (_ast !== undefined) results.push(_ast);
const ast = parserOverride(code, options.parserOpts, _babylon().parse);
if (ast !== undefined) results.push(ast);
}

@@ -153,3 +152,3 @@ }

if (typeof results[0].then === "function") {
throw new Error("You appear to be using an async codegen plugin, " + "which your current version of Babel does not support. " + "If you're using a published plugin, you may need to upgrade " + "your @babel/core version.");
throw new Error(`You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
}

@@ -166,7 +165,7 @@

var loc = err.loc,
missingPlugin = err.missingPlugin;
const loc = err.loc,
missingPlugin = err.missingPlugin;
if (loc) {
var codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
const codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
start: {

@@ -179,5 +178,5 @@ line: loc.line,

if (missingPlugin) {
err.message = (options.filename || "unknown") + ": " + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
err.message = `${options.filename || "unknown"}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
} else {
err.message = (options.filename || "unknown") + ": " + err.message + "\n\n" + codeFrame;
err.message = `${options.filename || "unknown"}: ${err.message}\n\n` + codeFrame;
}

@@ -184,0 +183,0 @@

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

function _path() {
var data = _interopRequireDefault(require("path"));
const data = _interopRequireDefault(require("path"));

@@ -22,22 +22,23 @@ _path = function _path() {

function normalizeOptions(config) {
var _config$options = config.options,
filename = _config$options.filename,
_config$options$filen = _config$options.filenameRelative,
filenameRelative = _config$options$filen === void 0 ? filename || "unknown" : _config$options$filen,
_config$options$sourc = _config$options.sourceType,
sourceType = _config$options$sourc === void 0 ? "module" : _config$options$sourc,
inputSourceMap = _config$options.inputSourceMap,
_config$options$sourc2 = _config$options.sourceMaps,
sourceMaps = _config$options$sourc2 === void 0 ? !!inputSourceMap : _config$options$sourc2,
moduleRoot = _config$options.moduleRoot,
_config$options$sourc3 = _config$options.sourceRoot,
sourceRoot = _config$options$sourc3 === void 0 ? moduleRoot : _config$options$sourc3,
_config$options$sourc4 = _config$options.sourceFileName,
sourceFileName = _config$options$sourc4 === void 0 ? filenameRelative : _config$options$sourc4,
_config$options$comme = _config$options.comments,
comments = _config$options$comme === void 0 ? true : _config$options$comme,
_config$options$compa = _config$options.compact,
compact = _config$options$compa === void 0 ? "auto" : _config$options$compa;
var opts = config.options;
var options = Object.assign({}, opts, {
const _config$options = config.options,
filename = _config$options.filename,
cwd = _config$options.cwd,
_config$options$filen = _config$options.filenameRelative,
filenameRelative = _config$options$filen === void 0 ? typeof filename === "string" ? _path().default.relative(cwd, filename) : "unknown" : _config$options$filen,
_config$options$sourc = _config$options.sourceType,
sourceType = _config$options$sourc === void 0 ? "module" : _config$options$sourc,
inputSourceMap = _config$options.inputSourceMap,
_config$options$sourc2 = _config$options.sourceMaps,
sourceMaps = _config$options$sourc2 === void 0 ? !!inputSourceMap : _config$options$sourc2,
moduleRoot = _config$options.moduleRoot,
_config$options$sourc3 = _config$options.sourceRoot,
sourceRoot = _config$options$sourc3 === void 0 ? moduleRoot : _config$options$sourc3,
_config$options$sourc4 = _config$options.sourceFileName,
sourceFileName = _config$options$sourc4 === void 0 ? _path().default.basename(filenameRelative) : _config$options$sourc4,
_config$options$comme = _config$options.comments,
comments = _config$options$comme === void 0 ? true : _config$options$comme,
_config$options$compa = _config$options.compact,
compact = _config$options$compa === void 0 ? "auto" : _config$options$compa;
const opts = config.options;
const options = Object.assign({}, opts, {
parserOpts: Object.assign({

@@ -49,13 +50,13 @@ sourceType: _path().default.extname(filenameRelative) === ".mjs" ? "module" : sourceType,

generatorOpts: Object.assign({
filename: filename,
filename,
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
retainLines: opts.retainLines,
comments: comments,
comments,
shouldPrintComment: opts.shouldPrintComment,
compact: compact,
compact,
minified: opts.minified,
sourceMaps: sourceMaps,
sourceRoot: sourceRoot,
sourceFileName: sourceFileName
sourceMaps,
sourceRoot,
sourceFileName
}, opts.generatorOpts)

@@ -76,3 +77,3 @@ });

var plugins = _ref;
const plugins = _ref;

@@ -91,3 +92,3 @@ for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {

var plugin = _ref2;
const plugin = _ref2;

@@ -94,0 +95,0 @@ if (plugin.manipulateOptions) {

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

var PluginPass = function () {
function PluginPass(file, key, options) {
class PluginPass {
constructor(file, key, options) {
this._map = new Map();

@@ -18,31 +18,28 @@ this.key = key;

var _proto = PluginPass.prototype;
_proto.set = function set(key, val) {
set(key, val) {
this._map.set(key, val);
};
}
_proto.get = function get(key) {
get(key) {
return this._map.get(key);
};
}
_proto.addHelper = function addHelper(name) {
addHelper(name) {
return this.file.addHelper(name);
};
}
_proto.addImport = function addImport() {
addImport() {
return this.file.addImport();
};
}
_proto.getModuleName = function getModuleName() {
getModuleName() {
return this.file.getModuleName();
};
}
_proto.buildCodeFrameError = function buildCodeFrameError(node, msg, Error) {
buildCodeFrameError(node, msg, Error) {
return this.file.buildCodeFrameError(node, msg, Error);
};
}
return PluginPass;
}();
}
exports.default = PluginPass;

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

exports.default = generateMissingPluginMessage;
var pluginNameMap = {
const pluginNameMap = {
asyncGenerators: {

@@ -213,23 +213,22 @@ syntax: {

var getNameURLCombination = function getNameURLCombination(_ref) {
var name = _ref.name,
url = _ref.url;
return name + " (" + url + ")";
};
const getNameURLCombination = ({
name,
url
}) => `${name} (${url})`;
function generateMissingPluginMessage(missingPluginName, loc, codeFrame) {
var helpMessage = "Support for the experimental syntax '" + missingPluginName + "' isn't currently enabled " + ("(" + loc.line + ":" + (loc.column + 1) + "):\n\n") + codeFrame;
var pluginInfo = pluginNameMap[missingPluginName];
let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame;
const pluginInfo = pluginNameMap[missingPluginName];
if (pluginInfo) {
var syntaxPlugin = pluginInfo.syntax,
transformPlugin = pluginInfo.transform;
const syntaxPlugin = pluginInfo.syntax,
transformPlugin = pluginInfo.transform;
if (syntaxPlugin) {
if (transformPlugin) {
var transformPluginInfo = getNameURLCombination(transformPlugin);
helpMessage += "\n\nAdd " + transformPluginInfo + " to the 'plugins' section of your Babel config " + "to enable transformation.";
const transformPluginInfo = getNameURLCombination(transformPlugin);
helpMessage += `\n\nAdd ${transformPluginInfo} to the 'plugins' section of your Babel config ` + `to enable transformation.`;
} else {
var syntaxPluginInfo = getNameURLCombination(syntaxPlugin);
helpMessage += "\n\nAdd " + syntaxPluginInfo + " to the 'plugins' section of your Babel config " + "to enable parsing.";
const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);
helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`;
}

@@ -236,0 +235,0 @@ }

{
"name": "@babel/core",
"version": "7.0.0-beta.46",
"version": "7.0.0-beta.47",
"description": "Babel compiler core.",
"main": "./lib/index.js",
"main": "lib/index.js",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

@@ -31,13 +31,13 @@ "homepage": "https://babeljs.io/",

"dependencies": {
"@babel/code-frame": "7.0.0-beta.46",
"@babel/generator": "7.0.0-beta.46",
"@babel/helpers": "7.0.0-beta.46",
"@babel/template": "7.0.0-beta.46",
"@babel/traverse": "7.0.0-beta.46",
"@babel/types": "7.0.0-beta.46",
"babylon": "7.0.0-beta.46",
"@babel/code-frame": "7.0.0-beta.47",
"@babel/generator": "7.0.0-beta.47",
"@babel/helpers": "7.0.0-beta.47",
"@babel/template": "7.0.0-beta.47",
"@babel/traverse": "7.0.0-beta.47",
"@babel/types": "7.0.0-beta.47",
"babylon": "7.0.0-beta.47",
"convert-source-map": "^1.1.0",
"debug": "^3.1.0",
"json5": "^0.5.0",
"lodash": "^4.2.0",
"lodash": "^4.17.5",
"micromatch": "^2.3.11",

@@ -49,5 +49,5 @@ "resolve": "^1.3.2",

"devDependencies": {
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.46",
"@babel/register": "7.0.0-beta.46"
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.47",
"@babel/register": "7.0.0-beta.47"
}
}

@@ -208,3 +208,3 @@ # @babel/core

<p>
<code>babel --name<span class="o">=</span>value</code>
<code>babel --option-name<span class="o">=</span>value</code>
</p>

@@ -211,0 +211,0 @@ </blockquote>

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc