@babel/core
Advanced tools
Comparing version 7.0.0-beta.43 to 7.0.0-beta.44
@@ -19,16 +19,26 @@ "use strict"; | ||
return function cachedFunction(arg, data) { | ||
let cachedValue = callCache.get(arg); | ||
var cachedValue = callCache.get(arg); | ||
if (cachedValue) { | ||
for (const _ref of cachedValue) { | ||
const { | ||
value, | ||
valid | ||
} = _ref; | ||
if (valid(data)) return value; | ||
for (var _iterator = cachedValue, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref2 = _i.value; | ||
} | ||
var _ref3 = _ref2; | ||
var _value = _ref3.value, | ||
_valid = _ref3.valid; | ||
if (_valid(data)) return _value; | ||
} | ||
} | ||
const cache = new CacheConfigurator(data); | ||
const value = handler(arg, cache); | ||
var cache = new CacheConfigurator(data); | ||
var value = handler(arg, cache); | ||
if (!cache.configured()) cache.forever(); | ||
@@ -40,4 +50,6 @@ cache.deactivate(); | ||
cachedValue = [{ | ||
value, | ||
valid: () => true | ||
value: value, | ||
valid: function valid() { | ||
return true; | ||
} | ||
}]; | ||
@@ -49,3 +61,3 @@ callCache.set(arg, cachedValue); | ||
cachedValue = [{ | ||
value, | ||
value: value, | ||
valid: cache.validator() | ||
@@ -59,3 +71,3 @@ }]; | ||
cachedValue.push({ | ||
value, | ||
value: value, | ||
valid: cache.validator() | ||
@@ -65,3 +77,3 @@ }); | ||
cachedValue = [{ | ||
value, | ||
value: value, | ||
valid: cache.validator() | ||
@@ -78,4 +90,4 @@ }]; | ||
class CacheConfigurator { | ||
constructor(data) { | ||
var CacheConfigurator = function () { | ||
function CacheConfigurator(data) { | ||
this._active = true; | ||
@@ -90,7 +102,9 @@ this._never = false; | ||
simple() { | ||
var _proto = CacheConfigurator.prototype; | ||
_proto.simple = function simple() { | ||
return makeSimpleConfigurator(this); | ||
} | ||
}; | ||
mode() { | ||
_proto.mode = function mode() { | ||
if (this._never) return "never"; | ||
@@ -100,5 +114,5 @@ if (this._forever) return "forever"; | ||
return "valid"; | ||
} | ||
}; | ||
forever() { | ||
_proto.forever = function forever() { | ||
if (!this._active) { | ||
@@ -114,5 +128,5 @@ throw new Error("Cannot change caching after evaluation has completed."); | ||
this._configured = true; | ||
} | ||
}; | ||
never() { | ||
_proto.never = function never() { | ||
if (!this._active) { | ||
@@ -128,5 +142,5 @@ throw new Error("Cannot change caching after evaluation has completed."); | ||
this._configured = true; | ||
} | ||
}; | ||
using(handler) { | ||
_proto.using = function using(handler) { | ||
if (!this._active) { | ||
@@ -141,3 +155,3 @@ throw new Error("Cannot change caching after evaluation has completed."); | ||
this._configured = true; | ||
const key = handler(this._data); | ||
var key = handler(this._data); | ||
@@ -147,5 +161,5 @@ this._pairs.push([key, handler]); | ||
return key; | ||
} | ||
}; | ||
invalidate(handler) { | ||
_proto.invalidate = function invalidate(handler) { | ||
if (!this._active) { | ||
@@ -161,3 +175,3 @@ throw new Error("Cannot change caching after evaluation has completed."); | ||
this._configured = true; | ||
const key = handler(this._data); | ||
var key = handler(this._data); | ||
@@ -167,18 +181,25 @@ this._pairs.push([key, handler]); | ||
return key; | ||
} | ||
}; | ||
validator() { | ||
const pairs = this._pairs; | ||
return data => pairs.every(([key, fn]) => key === fn(data)); | ||
} | ||
_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); | ||
}); | ||
}; | ||
}; | ||
deactivate() { | ||
_proto.deactivate = function deactivate() { | ||
this._active = false; | ||
} | ||
}; | ||
configured() { | ||
_proto.configured = function configured() { | ||
return this._configured; | ||
} | ||
}; | ||
} | ||
return CacheConfigurator; | ||
}(); | ||
@@ -195,11 +216,23 @@ function makeSimpleConfigurator(cache) { | ||
cacheFn.forever = () => cache.forever(); | ||
cacheFn.forever = function () { | ||
return cache.forever(); | ||
}; | ||
cacheFn.never = () => cache.never(); | ||
cacheFn.never = function () { | ||
return cache.never(); | ||
}; | ||
cacheFn.using = cb => cache.using(() => cb()); | ||
cacheFn.using = function (cb) { | ||
return cache.using(function () { | ||
return cb(); | ||
}); | ||
}; | ||
cacheFn.invalidate = cb => cache.invalidate(() => cb()); | ||
cacheFn.invalidate = function (cb) { | ||
return cache.invalidate(function () { | ||
return cb(); | ||
}); | ||
}; | ||
return cacheFn; | ||
} |
@@ -10,5 +10,5 @@ "use strict"; | ||
function _path() { | ||
const data = _interopRequireDefault(require("path")); | ||
var data = _interopRequireDefault(require("path")); | ||
_path = function () { | ||
_path = function _path() { | ||
return data; | ||
@@ -21,5 +21,5 @@ }; | ||
function _micromatch() { | ||
const data = _interopRequireDefault(require("micromatch")); | ||
var data = _interopRequireDefault(require("micromatch")); | ||
_micromatch = function () { | ||
_micromatch = function _micromatch() { | ||
return data; | ||
@@ -32,5 +32,5 @@ }; | ||
function _debug() { | ||
const data = _interopRequireDefault(require("debug")); | ||
var data = _interopRequireDefault(require("debug")); | ||
_debug = function () { | ||
_debug = function _debug() { | ||
return data; | ||
@@ -52,18 +52,44 @@ }; | ||
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) | ||
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); | ||
} | ||
}); | ||
exports.buildPresetChain = buildPresetChain; | ||
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)))); | ||
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); | ||
}); | ||
}); | ||
}); | ||
function buildRootChain(opts, context) { | ||
const programmaticChain = loadProgrammaticChain({ | ||
var programmaticChain = loadProgrammaticChain({ | ||
options: opts, | ||
@@ -73,12 +99,13 @@ dirname: context.cwd | ||
if (!programmaticChain) return null; | ||
let ignore, babelrc; | ||
const fileChain = emptyChain(); | ||
var ignore, babelrc; | ||
var fileChain = emptyChain(); | ||
if (opts.babelrc !== false && context.filename !== null) { | ||
const filename = context.filename; | ||
({ | ||
ignore, | ||
config: babelrc | ||
} = (0, _files.findRelativeConfig)(filename, context.envName)); | ||
var _filename = context.filename; | ||
var _findRelativeConfig = (0, _files.findRelativeConfig)(_filename, context.envName); | ||
ignore = _findRelativeConfig.ignore; | ||
babelrc = _findRelativeConfig.config; | ||
if (ignore && shouldIgnore(context, ignore.ignore, null, ignore.dirname)) { | ||
@@ -89,3 +116,3 @@ return null; | ||
if (babelrc) { | ||
const result = loadFileChain(babelrc, context); | ||
var result = loadFileChain(babelrc, context); | ||
if (!result) return null; | ||
@@ -96,7 +123,9 @@ mergeChain(fileChain, result); | ||
const chain = mergeChain(mergeChain(emptyChain(), fileChain), programmaticChain); | ||
var chain = mergeChain(mergeChain(emptyChain(), fileChain), programmaticChain); | ||
return { | ||
plugins: dedupDescriptors(chain.plugins), | ||
presets: dedupDescriptors(chain.presets), | ||
options: chain.options.map(o => normalizeOptions(o)), | ||
options: chain.options.map(function (o) { | ||
return normalizeOptions(o); | ||
}), | ||
ignore: ignore || undefined, | ||
@@ -107,78 +136,113 @@ babelrc: babelrc || undefined | ||
const loadProgrammaticChain = makeChainWalker({ | ||
init: arg => arg, | ||
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 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 loadFileChain = makeChainWalker({ | ||
init: input => validateFile(input), | ||
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 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 validateFile = (0, _caching.makeWeakCache)(file => ({ | ||
filepath: file.filepath, | ||
dirname: file.dirname, | ||
options: (0, _options.validate)("file", file.options) | ||
})); | ||
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)))); | ||
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); | ||
}); | ||
}); | ||
}); | ||
function buildRootDescriptors({ | ||
dirname, | ||
options | ||
}, alias, descriptors) { | ||
function buildRootDescriptors(_ref, alias, descriptors) { | ||
var dirname = _ref.dirname, | ||
options = _ref.options; | ||
return descriptors(dirname, options, alias); | ||
} | ||
function buildEnvDescriptors({ | ||
dirname, | ||
options | ||
}, alias, descriptors, envName) { | ||
const opts = options.env && options.env[envName]; | ||
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null; | ||
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 buildOverrideDescriptors({ | ||
dirname, | ||
options | ||
}, alias, descriptors, index) { | ||
const opts = options.overrides && options.overrides[index]; | ||
function buildOverrideDescriptors(_ref3, alias, descriptors, index) { | ||
var dirname = _ref3.dirname, | ||
options = _ref3.options; | ||
var 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({ | ||
dirname, | ||
options | ||
}, alias, descriptors, index, envName) { | ||
const override = options.overrides && options.overrides[index]; | ||
function buildOverrideEnvDescriptors(_ref4, alias, descriptors, index, envName) { | ||
var dirname = _ref4.dirname, | ||
options = _ref4.options; | ||
var override = options.overrides && options.overrides[index]; | ||
if (!override) throw new Error("Assertion failure - missing override"); | ||
const opts = override.env && override.env[envName]; | ||
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null; | ||
var opts = override.env && override.env[envName]; | ||
return opts ? descriptors(dirname, opts, alias + ".overrides[" + index + "].env[\"" + envName + "\"]") : null; | ||
} | ||
function makeChainWalker({ | ||
init, | ||
root, | ||
env, | ||
overrides, | ||
overridesEnv | ||
}) { | ||
return (arg, context, files = new Set()) => { | ||
const input = init(arg); | ||
const { | ||
dirname | ||
} = input; | ||
const flattenedConfigs = []; | ||
const rootOpts = root(input); | ||
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(); | ||
} | ||
var input = init(arg); | ||
var dirname = input.dirname; | ||
var flattenedConfigs = []; | ||
var rootOpts = root(input); | ||
if (configIsApplicable(rootOpts, dirname, context)) { | ||
flattenedConfigs.push(rootOpts); | ||
const envOpts = env(input, context.envName); | ||
var envOpts = env(input, context.envName); | ||
@@ -189,8 +253,8 @@ if (envOpts && configIsApplicable(envOpts, dirname, context)) { | ||
(rootOpts.options.overrides || []).forEach((_, index) => { | ||
const overrideOps = overrides(input, index); | ||
(rootOpts.options.overrides || []).forEach(function (_, index) { | ||
var overrideOps = overrides(input, index); | ||
if (configIsApplicable(overrideOps, dirname, context)) { | ||
flattenedConfigs.push(overrideOps); | ||
const overrideEnvOpts = overridesEnv(input, index, context.envName); | ||
var overrideEnvOpts = overridesEnv(input, index, context.envName); | ||
@@ -204,14 +268,16 @@ if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) { | ||
if (flattenedConfigs.some(({ | ||
options: { | ||
ignore, | ||
only | ||
} | ||
}) => shouldIgnore(context, ignore, only, dirname))) { | ||
if (flattenedConfigs.some(function (_ref6) { | ||
var _ref6$options = _ref6.options, | ||
ignore = _ref6$options.ignore, | ||
only = _ref6$options.only; | ||
return shouldIgnore(context, ignore, only, dirname); | ||
})) { | ||
return null; | ||
} | ||
const chain = emptyChain(); | ||
var chain = emptyChain(); | ||
for (const op of flattenedConfigs) { | ||
for (var _i = 0; _i < flattenedConfigs.length; _i++) { | ||
var op = flattenedConfigs[_i]; | ||
if (!mergeExtendsChain(chain, op.options, dirname, context, files)) { | ||
@@ -230,10 +296,12 @@ return null; | ||
if (opts.extends === undefined) return true; | ||
const file = (0, _files.loadConfig)(opts.extends, dirname, context.envName); | ||
var 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, file => ` - ${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, function (file) { | ||
return " - " + file.filepath; | ||
}).join("\n")); | ||
} | ||
files.add(file); | ||
const fileChain = loadFileChain(file, context, files); | ||
var fileChain = loadFileChain(file, context, files); | ||
files.delete(file); | ||
@@ -246,16 +314,25 @@ if (!fileChain) return false; | ||
function mergeChain(target, source) { | ||
target.options.push(...source.options); | ||
target.plugins.push(...source.plugins); | ||
target.presets.push(...source.presets); | ||
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); | ||
return target; | ||
} | ||
function mergeChainOpts(target, { | ||
options, | ||
plugins, | ||
presets | ||
}) { | ||
function mergeChainOpts(target, _ref7) { | ||
var _target$plugins2, _target$presets2; | ||
var options = _ref7.options, | ||
plugins = _ref7.plugins, | ||
presets = _ref7.presets; | ||
target.options.push(options); | ||
target.plugins.push(...plugins()); | ||
target.presets.push(...presets()); | ||
(_target$plugins2 = target.plugins).push.apply(_target$plugins2, plugins()); | ||
(_target$presets2 = target.presets).push.apply(_target$presets2, presets()); | ||
return target; | ||
@@ -273,3 +350,3 @@ } | ||
function normalizeOptions(opts) { | ||
const options = Object.assign({}, opts); | ||
var options = Object.assign({}, opts); | ||
delete options.extends; | ||
@@ -292,9 +369,22 @@ delete options.env; | ||
function dedupDescriptors(items) { | ||
const map = new Map(); | ||
const descriptors = []; | ||
var map = new Map(); | ||
var descriptors = []; | ||
for (const item of items) { | ||
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref8; | ||
if (_isArray) { | ||
if (_i2 >= _iterator.length) break; | ||
_ref8 = _iterator[_i2++]; | ||
} else { | ||
_i2 = _iterator.next(); | ||
if (_i2.done) break; | ||
_ref8 = _i2.value; | ||
} | ||
var item = _ref8; | ||
if (typeof item.value === "function") { | ||
const fnKey = item.value; | ||
let nameMap = map.get(fnKey); | ||
var fnKey = item.value; | ||
var nameMap = map.get(fnKey); | ||
@@ -306,3 +396,3 @@ if (!nameMap) { | ||
let desc = nameMap.get(item.name); | ||
var desc = nameMap.get(item.name); | ||
@@ -329,3 +419,3 @@ if (!desc) { | ||
return descriptors.reduce((acc, desc) => { | ||
return descriptors.reduce(function (acc, desc) { | ||
if (desc.value) acc.push(desc.value); | ||
@@ -336,5 +426,4 @@ return acc; | ||
function configIsApplicable({ | ||
options | ||
}, dirname, context) { | ||
function configIsApplicable(_ref9, dirname, context) { | ||
var options = _ref9.options; | ||
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)); | ||
@@ -345,7 +434,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"); | ||
} | ||
const ctx = context; | ||
const patterns = Array.isArray(test) ? test : [test]; | ||
var ctx = context; | ||
var patterns = Array.isArray(test) ? test : [test]; | ||
return matchesPatterns(ctx, patterns, dirname, false); | ||
@@ -357,6 +446,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"); | ||
} | ||
const ctx = context; | ||
var ctx = context; | ||
@@ -371,8 +460,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"); | ||
} | ||
const ctx = context; | ||
var _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); | ||
@@ -386,20 +475,28 @@ return true; | ||
function matchesPatterns(context, patterns, dirname, allowNegation = true) { | ||
const res = []; | ||
const strings = []; | ||
const fns = []; | ||
patterns.forEach(pattern => { | ||
function matchesPatterns(context, patterns, dirname, allowNegation) { | ||
if (allowNegation === void 0) { | ||
allowNegation = true; | ||
} | ||
var res = []; | ||
var strings = []; | ||
var fns = []; | ||
patterns.forEach(function (pattern) { | ||
if (typeof pattern === "string") strings.push(pattern);else if (typeof pattern === "function") fns.push(pattern);else res.push(pattern); | ||
}); | ||
const filename = context.filename; | ||
if (res.some(re => re.test(context.filename))) return true; | ||
if (fns.some(fn => fn(filename))) return true; | ||
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; | ||
if (strings.length > 0) { | ||
const possibleDirs = getPossibleDirs(context); | ||
const absolutePatterns = strings.map(pattern => { | ||
const negate = pattern[0] === "!"; | ||
var possibleDirs = getPossibleDirs(context); | ||
var absolutePatterns = strings.map(function (pattern) { | ||
var 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."); | ||
} | ||
@@ -422,9 +519,9 @@ | ||
const getPossibleDirs = (0, _caching.makeWeakCache)(context => { | ||
let current = context.filename; | ||
var getPossibleDirs = (0, _caching.makeWeakCache)(function (context) { | ||
var current = context.filename; | ||
if (current === null) return []; | ||
const possibleDirs = [current]; | ||
var possibleDirs = [current]; | ||
while (true) { | ||
const previous = current; | ||
var previous = current; | ||
current = _path().default.dirname(current); | ||
@@ -431,0 +528,0 @@ if (previous === current) break; |
@@ -17,11 +17,17 @@ "use strict"; | ||
function createCachedDescriptors(dirname, options, alias) { | ||
const { | ||
plugins, | ||
presets, | ||
passPerPreset | ||
} = options; | ||
var plugins = options.plugins, | ||
presets = options.presets, | ||
passPerPreset = options.passPerPreset; | ||
return { | ||
options, | ||
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => [], | ||
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => [] | ||
options: options, | ||
plugins: plugins ? function () { | ||
return createCachedPluginDescriptors(plugins, dirname)(alias); | ||
} : function () { | ||
return []; | ||
}, | ||
presets: presets ? function () { | ||
return createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset); | ||
} : function () { | ||
return []; | ||
} | ||
}; | ||
@@ -31,7 +37,17 @@ } | ||
function createUncachedDescriptors(dirname, options, alias) { | ||
let plugins; | ||
let presets; | ||
var plugins; | ||
var presets; | ||
return { | ||
options, | ||
plugins: () => { | ||
options: options, | ||
plugins: function (_plugins) { | ||
function plugins() { | ||
return _plugins.apply(this, arguments); | ||
} | ||
plugins.toString = function () { | ||
return _plugins.toString(); | ||
}; | ||
return plugins; | ||
}(function () { | ||
if (!plugins) { | ||
@@ -42,4 +58,14 @@ plugins = createPluginDescriptors(options.plugins || [], dirname, alias); | ||
return plugins; | ||
}, | ||
presets: () => { | ||
}), | ||
presets: function (_presets) { | ||
function presets() { | ||
return _presets.apply(this, arguments); | ||
} | ||
presets.toString = function () { | ||
return _presets.toString(); | ||
}; | ||
return presets; | ||
}(function () { | ||
if (!presets) { | ||
@@ -50,13 +76,23 @@ presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset); | ||
return presets; | ||
} | ||
}) | ||
}; | ||
} | ||
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 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 createCachedPluginDescriptors = (0, _caching.makeWeakCache)((items, cache) => { | ||
const dirname = cache.using(dir => dir); | ||
return (0, _caching.makeStrongCache)(alias => createPluginDescriptors(items, dirname, alias)); | ||
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); | ||
}); | ||
}); | ||
@@ -73,7 +109,9 @@ | ||
function createDescriptors(type, items, dirname, alias, ownPass) { | ||
const descriptors = items.map((item, index) => createDescriptor(item, dirname, { | ||
type, | ||
alias: `${alias}$${index}`, | ||
ownPass: !!ownPass | ||
})); | ||
var descriptors = items.map(function (item, index) { | ||
return createDescriptor(item, dirname, { | ||
type: type, | ||
alias: alias + "$" + index, | ||
ownPass: !!ownPass | ||
}); | ||
}); | ||
assertNoDuplicates(descriptors); | ||
@@ -83,8 +121,7 @@ return descriptors; | ||
function createDescriptor(pair, dirname, { | ||
type, | ||
alias, | ||
ownPass | ||
}) { | ||
const desc = (0, _item.getItemDescriptor)(pair); | ||
function createDescriptor(pair, dirname, _ref) { | ||
var type = _ref.type, | ||
alias = _ref.alias, | ||
ownPass = _ref.ownPass; | ||
var desc = (0, _item.getItemDescriptor)(pair); | ||
@@ -95,16 +132,21 @@ if (desc) { | ||
let name; | ||
let options; | ||
let value = pair; | ||
var name; | ||
var options; | ||
var value = pair; | ||
if (Array.isArray(value)) { | ||
if (value.length === 3) { | ||
[value, options, name] = value; | ||
var _value = value; | ||
value = _value[0]; | ||
options = _value[1]; | ||
name = _value[2]; | ||
} else { | ||
[value, options] = value; | ||
var _value2 = value; | ||
value = _value2[0]; | ||
options = _value2[1]; | ||
} | ||
} | ||
let file = undefined; | ||
let filepath = null; | ||
var file = undefined; | ||
var filepath = null; | ||
@@ -116,10 +158,11 @@ if (typeof value === "string") { | ||
const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset; | ||
const request = value; | ||
({ | ||
filepath, | ||
value | ||
} = resolver(value, dirname)); | ||
var resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset; | ||
var _request = value; | ||
var _resolver = resolver(value, dirname); | ||
filepath = _resolver.filepath; | ||
value = _resolver.value; | ||
file = { | ||
request, | ||
request: _request, | ||
resolved: filepath | ||
@@ -130,3 +173,3 @@ }; | ||
if (!value) { | ||
throw new Error(`Unexpected falsy value: ${String(value)}`); | ||
throw new Error("Unexpected falsy value: " + String(value)); | ||
} | ||
@@ -143,17 +186,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, | ||
options, | ||
dirname, | ||
ownPass, | ||
file | ||
value: value, | ||
options: options, | ||
dirname: dirname, | ||
ownPass: ownPass, | ||
file: file | ||
}; | ||
@@ -163,7 +206,19 @@ } | ||
function assertNoDuplicates(items) { | ||
const map = new Map(); | ||
var map = new Map(); | ||
for (const item of items) { | ||
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref2 = _i.value; | ||
} | ||
var item = _ref2; | ||
if (typeof item.value !== "function") continue; | ||
let nameMap = map.get(item.value); | ||
var nameMap = map.get(item.value); | ||
@@ -176,3 +231,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")); | ||
} | ||
@@ -179,0 +234,0 @@ |
@@ -10,5 +10,5 @@ "use strict"; | ||
function _debug() { | ||
const data = _interopRequireDefault(require("debug")); | ||
var data = _interopRequireDefault(require("debug")); | ||
_debug = function () { | ||
_debug = function _debug() { | ||
return data; | ||
@@ -21,5 +21,5 @@ }; | ||
function _path() { | ||
const data = _interopRequireDefault(require("path")); | ||
var data = _interopRequireDefault(require("path")); | ||
_path = function () { | ||
_path = function _path() { | ||
return data; | ||
@@ -32,5 +32,5 @@ }; | ||
function _fs() { | ||
const data = _interopRequireDefault(require("fs")); | ||
var data = _interopRequireDefault(require("fs")); | ||
_fs = function () { | ||
_fs = function _fs() { | ||
return data; | ||
@@ -43,5 +43,5 @@ }; | ||
function _json() { | ||
const data = _interopRequireDefault(require("json5")); | ||
var data = _interopRequireDefault(require("json5")); | ||
_json = function () { | ||
_json = function _json() { | ||
return data; | ||
@@ -54,5 +54,5 @@ }; | ||
function _resolve() { | ||
const data = _interopRequireDefault(require("resolve")); | ||
var data = _interopRequireDefault(require("resolve")); | ||
_resolve = function () { | ||
_resolve = function _resolve() { | ||
return data; | ||
@@ -70,25 +70,25 @@ }; | ||
const debug = (0, _debug().default)("babel:config:loading:files:configuration"); | ||
const BABELRC_FILENAME = ".babelrc"; | ||
const BABELRC_JS_FILENAME = ".babelrc.js"; | ||
const PACKAGE_FILENAME = "package.json"; | ||
const BABELIGNORE_FILENAME = ".babelignore"; | ||
var debug = (0, _debug().default)("babel:config:loading:files:configuration"); | ||
var BABELRC_FILENAME = ".babelrc"; | ||
var BABELRC_JS_FILENAME = ".babelrc.js"; | ||
var PACKAGE_FILENAME = "package.json"; | ||
var BABELIGNORE_FILENAME = ".babelignore"; | ||
function findRelativeConfig(filepath, envName) { | ||
let config = null; | ||
let ignore = null; | ||
var config = null; | ||
var ignore = null; | ||
const dirname = _path().default.dirname(filepath); | ||
var dirname = _path().default.dirname(filepath); | ||
let loc = dirname; | ||
var loc = dirname; | ||
while (true) { | ||
if (!config) { | ||
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME, PACKAGE_FILENAME].reduce((previousConfig, name) => { | ||
const filepath = _path().default.join(loc, name); | ||
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME, PACKAGE_FILENAME].reduce(function (previousConfig, name) { | ||
var filepath = _path().default.join(loc, name); | ||
const config = readConfig(filepath, envName); | ||
var 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)); | ||
} | ||
@@ -105,3 +105,3 @@ | ||
if (!ignore) { | ||
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME); | ||
var ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME); | ||
@@ -115,3 +115,3 @@ ignore = readIgnoreConfig(ignoreLoc); | ||
const nextLoc = _path().default.dirname(loc); | ||
var nextLoc = _path().default.dirname(loc); | ||
@@ -123,4 +123,4 @@ if (loc === nextLoc) break; | ||
return { | ||
config, | ||
ignore | ||
config: config, | ||
ignore: ignore | ||
}; | ||
@@ -130,10 +130,10 @@ } | ||
function loadConfig(name, dirname, envName) { | ||
const filepath = _resolve().default.sync(name, { | ||
var filepath = _resolve().default.sync(name, { | ||
basedir: dirname | ||
}); | ||
const conf = readConfig(filepath, envName); | ||
var 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"); | ||
} | ||
@@ -147,8 +147,8 @@ | ||
return _path().default.extname(filepath) === ".js" ? readConfigJS(filepath, { | ||
envName | ||
envName: envName | ||
}) : readConfigFile(filepath); | ||
} | ||
const LOADING_CONFIGS = new Set(); | ||
const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => { | ||
var LOADING_CONFIGS = new Set(); | ||
var readConfigJS = (0, _caching.makeStrongCache)(function (filepath, cache) { | ||
if (!_fs().default.existsSync(filepath)) { | ||
@@ -163,3 +163,3 @@ cache.forever(); | ||
return { | ||
filepath, | ||
filepath: filepath, | ||
dirname: _path().default.dirname(filepath), | ||
@@ -170,3 +170,3 @@ options: {} | ||
let options; | ||
var options; | ||
@@ -176,7 +176,7 @@ try { | ||
const configModule = require(filepath); | ||
var 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; | ||
@@ -193,17 +193,17 @@ } 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 | ||
}; | ||
}); | ||
const readConfigFile = makeStaticFileCache((filepath, content) => { | ||
let options; | ||
var readConfigFile = makeStaticFileCache(function (filepath, content) { | ||
var options; | ||
@@ -214,3 +214,3 @@ if (_path().default.basename(filepath) === PACKAGE_FILENAME) { | ||
} catch (err) { | ||
err.message = `${filepath}: Error while parsing JSON - ${err.message}`; | ||
err.message = filepath + ": Error while parsing JSON - " + err.message; | ||
throw err; | ||
@@ -224,29 +224,33 @@ } | ||
} 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 | ||
}; | ||
}); | ||
const readIgnoreConfig = makeStaticFileCache((filepath, content) => { | ||
const ignore = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line); | ||
var readIgnoreConfig = makeStaticFileCache(function (filepath, content) { | ||
var ignore = content.split("\n").map(function (line) { | ||
return line.replace(/#(.*?)$/, "").trim(); | ||
}).filter(function (line) { | ||
return !!line; | ||
}); | ||
return { | ||
filepath, | ||
filepath: filepath, | ||
dirname: _path().default.dirname(filepath), | ||
ignore | ||
ignore: ignore | ||
}; | ||
@@ -256,4 +260,6 @@ }); | ||
function makeStaticFileCache(fn) { | ||
return (0, _caching.makeStrongCache)((filepath, cache) => { | ||
if (cache.invalidate(() => fileMtime(filepath)) === null) { | ||
return (0, _caching.makeStrongCache)(function (filepath, cache) { | ||
if (cache.invalidate(function () { | ||
return fileMtime(filepath); | ||
}) === null) { | ||
cache.forever(); | ||
@@ -278,36 +284,3 @@ return null; | ||
function throwConfigError() { | ||
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 { }; | ||
};`); | ||
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};"); | ||
} |
@@ -21,3 +21,3 @@ "use strict"; | ||
function loadConfig(name, dirname) { | ||
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); | ||
throw new Error("Cannot load " + name + " relative to " + dirname + " in a browser"); | ||
} | ||
@@ -34,7 +34,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"); | ||
} |
@@ -13,3 +13,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _configuration[key]; | ||
@@ -26,3 +26,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _plugins[key]; | ||
@@ -29,0 +29,0 @@ } |
@@ -12,5 +12,5 @@ "use strict"; | ||
function _debug() { | ||
const data = _interopRequireDefault(require("debug")); | ||
var data = _interopRequireDefault(require("debug")); | ||
_debug = function () { | ||
_debug = function _debug() { | ||
return data; | ||
@@ -23,5 +23,5 @@ }; | ||
function _resolve() { | ||
const data = _interopRequireDefault(require("resolve")); | ||
var data = _interopRequireDefault(require("resolve")); | ||
_resolve = function () { | ||
_resolve = function _resolve() { | ||
return data; | ||
@@ -34,5 +34,5 @@ }; | ||
function _path() { | ||
const data = _interopRequireDefault(require("path")); | ||
var data = _interopRequireDefault(require("path")); | ||
_path = function () { | ||
_path = function _path() { | ||
return data; | ||
@@ -46,10 +46,10 @@ }; | ||
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-|[^/]+\/)/; | ||
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-|[^/]+\/)/; | ||
@@ -65,13 +65,13 @@ function resolvePlugin(name, dirname) { | ||
function loadPlugin(name, dirname) { | ||
const filepath = resolvePlugin(name, dirname); | ||
var 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); | ||
} | ||
const value = requireModule("plugin", filepath); | ||
var value = requireModule("plugin", filepath); | ||
debug("Loaded plugin %o from %o.", name, dirname); | ||
return { | ||
filepath, | ||
value | ||
filepath: filepath, | ||
value: value | ||
}; | ||
@@ -81,13 +81,13 @@ } | ||
function loadPreset(name, dirname) { | ||
const filepath = resolvePreset(name, dirname); | ||
var 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); | ||
} | ||
const value = requireModule("preset", filepath); | ||
var value = requireModule("preset", filepath); | ||
debug("Loaded preset %o from %o.", name, dirname); | ||
return { | ||
filepath, | ||
value | ||
filepath: filepath, | ||
value: value | ||
}; | ||
@@ -98,9 +98,13 @@ } | ||
if (_path().default.isAbsolute(name)) return name; | ||
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, ""); | ||
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, ""); | ||
} | ||
function resolveStandardizedName(type, name, dirname = process.cwd()) { | ||
const standardizedName = standardizeName(type, name); | ||
function resolveStandardizedName(type, name, dirname) { | ||
if (dirname === void 0) { | ||
dirname = process.cwd(); | ||
} | ||
var standardizedName = standardizeName(type, name); | ||
try { | ||
@@ -114,3 +118,3 @@ return _resolve().default.sync(standardizedName, { | ||
if (standardizedName !== name) { | ||
let resolvedOriginal = false; | ||
var resolvedOriginal = false; | ||
@@ -126,7 +130,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 + "\""; | ||
} | ||
} | ||
let resolvedBabel = false; | ||
var resolvedBabel = false; | ||
@@ -142,7 +146,7 @@ try { | ||
if (resolvedBabel) { | ||
e.message += `\n- Did you mean "@babel/${name}"?`; | ||
e.message += "\n- Did you mean \"@babel/" + name + "\"?"; | ||
} | ||
let resolvedOppositeType = false; | ||
const oppositeType = type === "preset" ? "plugin" : "preset"; | ||
var resolvedOppositeType = false; | ||
var oppositeType = type === "preset" ? "plugin" : "preset"; | ||
@@ -158,3 +162,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 + "?"; | ||
} | ||
@@ -166,7 +170,7 @@ | ||
const LOADING_MODULES = new Set(); | ||
var LOADING_MODULES = new Set(); | ||
function requireModule(type, name) { | ||
if (LOADING_MODULES.has(name)) { | ||
throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.'); | ||
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.'); | ||
} | ||
@@ -173,0 +177,0 @@ |
@@ -19,5 +19,5 @@ "use strict"; | ||
function _traverse() { | ||
const data = _interopRequireDefault(require("@babel/traverse")); | ||
var data = _interopRequireDefault(require("@babel/traverse")); | ||
_traverse = function () { | ||
_traverse = function _traverse() { | ||
return data; | ||
@@ -44,3 +44,3 @@ }; | ||
function loadFullConfig(inputOpts) { | ||
const result = (0, _partial.default)(inputOpts); | ||
var result = (0, _partial.default)(inputOpts); | ||
@@ -51,14 +51,10 @@ if (!result) { | ||
const { | ||
options, | ||
context | ||
} = result; | ||
const optionDefaults = {}; | ||
const passes = [[]]; | ||
var options = result.options, | ||
context = result.context; | ||
var optionDefaults = {}; | ||
var passes = [[]]; | ||
try { | ||
const { | ||
plugins, | ||
presets | ||
} = options; | ||
var plugins = options.plugins, | ||
presets = options.presets; | ||
@@ -69,7 +65,7 @@ if (!plugins || !presets) { | ||
const ignored = function recurseDescriptors(config, pass) { | ||
const plugins = config.plugins.map(descriptor => { | ||
var ignored = function recurseDescriptors(config, pass) { | ||
var plugins = config.plugins.map(function (descriptor) { | ||
return loadPluginDescriptor(descriptor, context); | ||
}); | ||
const presets = config.presets.map(descriptor => { | ||
var presets = config.presets.map(function (descriptor) { | ||
return { | ||
@@ -82,16 +78,32 @@ preset: loadPresetDescriptor(descriptor, context), | ||
if (presets.length > 0) { | ||
passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass)); | ||
passes.splice.apply(passes, [1, 0].concat(presets.map(function (o) { | ||
return o.pass; | ||
}).filter(function (p) { | ||
return p !== pass; | ||
}))); | ||
for (const _ref of presets) { | ||
const { | ||
preset, | ||
pass | ||
} = _ref; | ||
for (var _iterator = presets, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref2 = _i.value; | ||
} | ||
var _ref3 = _ref2; | ||
var preset = _ref3.preset, | ||
_pass = _ref3.pass; | ||
if (!preset) return true; | ||
const ignored = recurseDescriptors({ | ||
var _ignored = recurseDescriptors({ | ||
plugins: preset.plugins, | ||
presets: preset.presets | ||
}, pass); | ||
if (ignored) return true; | ||
preset.options.forEach(opts => { | ||
}, _pass); | ||
if (_ignored) return true; | ||
preset.options.forEach(function (opts) { | ||
(0, _util.mergeOptions)(optionDefaults, opts); | ||
@@ -103,7 +115,7 @@ }); | ||
if (plugins.length > 0) { | ||
pass.unshift(...plugins); | ||
pass.unshift.apply(pass, plugins); | ||
} | ||
}({ | ||
plugins: plugins.map(item => { | ||
const desc = (0, _item.getItemDescriptor)(item); | ||
plugins: plugins.map(function (item) { | ||
var desc = (0, _item.getItemDescriptor)(item); | ||
@@ -116,4 +128,4 @@ if (!desc) { | ||
}), | ||
presets: presets.map(item => { | ||
const desc = (0, _item.getItemDescriptor)(item); | ||
presets: presets.map(function (item) { | ||
var desc = (0, _item.getItemDescriptor)(item); | ||
@@ -131,3 +143,3 @@ if (!desc) { | ||
if (!/^\[BABEL\]/.test(e.message)) { | ||
e.message = `[BABEL] ${context.filename || "unknown"}: ${e.message}`; | ||
e.message = "[BABEL] " + (context.filename || "unknown") + ": " + e.message; | ||
} | ||
@@ -138,8 +150,12 @@ | ||
const opts = optionDefaults; | ||
var opts = optionDefaults; | ||
(0, _util.mergeOptions)(opts, options); | ||
opts.plugins = passes[0]; | ||
opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({ | ||
plugins | ||
})); | ||
opts.presets = passes.slice(1).filter(function (plugins) { | ||
return plugins.length > 0; | ||
}).map(function (plugins) { | ||
return { | ||
plugins: plugins | ||
}; | ||
}); | ||
opts.passPerPreset = opts.presets.length > 0; | ||
@@ -152,14 +168,13 @@ return { | ||
const loadDescriptor = (0, _caching.makeWeakCache)(({ | ||
value, | ||
options, | ||
dirname, | ||
alias | ||
}, cache) => { | ||
var loadDescriptor = (0, _caching.makeWeakCache)(function (_ref4, cache) { | ||
var value = _ref4.value, | ||
options = _ref4.options, | ||
dirname = _ref4.dirname, | ||
alias = _ref4.alias; | ||
if (options === false) throw new Error("Assertion failure"); | ||
options = options || {}; | ||
let item = value; | ||
var item = value; | ||
if (typeof value === "function") { | ||
const api = Object.assign({}, context, (0, _configApi.default)(cache)); | ||
var api = Object.assign({}, context, (0, _configApi.default)(cache)); | ||
@@ -170,3 +185,3 @@ try { | ||
if (alias) { | ||
e.message += ` (While processing: ${JSON.stringify(alias)})`; | ||
e.message += " (While processing: " + JSON.stringify(alias) + ")"; | ||
} | ||
@@ -183,3 +198,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."); | ||
} | ||
@@ -189,5 +204,5 @@ | ||
value: item, | ||
options, | ||
dirname, | ||
alias | ||
options: options, | ||
dirname: dirname, | ||
alias: alias | ||
}; | ||
@@ -208,10 +223,9 @@ }); | ||
const instantiatePlugin = (0, _caching.makeWeakCache)(({ | ||
value, | ||
options, | ||
dirname, | ||
alias | ||
}, cache) => { | ||
const pluginObj = (0, _plugins.validatePluginObject)(value); | ||
const plugin = Object.assign({}, pluginObj); | ||
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); | ||
@@ -223,10 +237,12 @@ if (plugin.visitor) { | ||
if (plugin.inherits) { | ||
const inheritsDescriptor = { | ||
var inheritsDescriptor = { | ||
name: undefined, | ||
alias: `${alias}$inherits`, | ||
alias: alias + "$inherits", | ||
value: plugin.inherits, | ||
options, | ||
dirname | ||
options: options, | ||
dirname: dirname | ||
}; | ||
const inherits = cache.invalidate(data => loadPluginDescriptor(inheritsDescriptor, data)); | ||
var inherits = cache.invalidate(function (data) { | ||
return loadPluginDescriptor(inheritsDescriptor, data); | ||
}); | ||
plugin.pre = chain(inherits.pre, plugin.pre); | ||
@@ -241,15 +257,14 @@ plugin.post = chain(inherits.post, plugin.post); | ||
const loadPresetDescriptor = (descriptor, context) => { | ||
var loadPresetDescriptor = function loadPresetDescriptor(descriptor, context) { | ||
return (0, _configChain.buildPresetChain)(instantiatePreset(loadDescriptor(descriptor, context)), context); | ||
}; | ||
const instantiatePreset = (0, _caching.makeWeakCache)(({ | ||
value, | ||
dirname, | ||
alias | ||
}) => { | ||
var instantiatePreset = (0, _caching.makeWeakCache)(function (_ref6) { | ||
var value = _ref6.value, | ||
dirname = _ref6.dirname, | ||
alias = _ref6.alias; | ||
return { | ||
options: (0, _options.validate)("preset", value), | ||
alias, | ||
dirname | ||
alias: alias, | ||
dirname: dirname | ||
}; | ||
@@ -259,6 +274,22 @@ }); | ||
function chain(a, b) { | ||
const fns = [a, b].filter(Boolean); | ||
var fns = [a, b].filter(Boolean); | ||
if (fns.length <= 1) return fns[0]; | ||
return function (...args) { | ||
for (const fn of fns) { | ||
return function () { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
for (var _iterator2 = fns, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref7; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref7 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref7 = _i2.value; | ||
} | ||
var fn = _ref7; | ||
fn.apply(this, args); | ||
@@ -265,0 +296,0 @@ } |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _semver() { | ||
const data = _interopRequireDefault(require("semver")); | ||
var data = _interopRequireDefault(require("semver")); | ||
_semver = function () { | ||
_semver = function _semver() { | ||
return data; | ||
@@ -24,14 +24,16 @@ }; | ||
function makeAPI(cache) { | ||
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"); | ||
} | ||
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"); | ||
} | ||
return entry === data.envName; | ||
return entry === data.envName; | ||
}); | ||
}); | ||
}); | ||
}; | ||
@@ -41,5 +43,7 @@ return { | ||
cache: cache.simple(), | ||
env, | ||
async: () => false, | ||
assertVersion | ||
env: env, | ||
async: function async() { | ||
return false; | ||
}, | ||
assertVersion: assertVersion | ||
}; | ||
@@ -54,3 +58,3 @@ } | ||
range = `^${range}.0.0-0`; | ||
range = "^" + range + ".0.0-0"; | ||
} | ||
@@ -63,3 +67,3 @@ | ||
if (_semver().default.satisfies(_.version, range)) return; | ||
const limit = Error.stackTraceLimit; | ||
var limit = Error.stackTraceLimit; | ||
@@ -70,3 +74,3 @@ if (typeof limit === "number" && limit < 25) { | ||
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.`); | ||
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."); | ||
@@ -80,4 +84,4 @@ if (typeof limit === "number") { | ||
version: _.version, | ||
range | ||
range: range | ||
}); | ||
} |
@@ -8,4 +8,8 @@ "use strict"; | ||
function getEnv(defaultValue = "development") { | ||
function getEnv(defaultValue) { | ||
if (defaultValue === void 0) { | ||
defaultValue = "development"; | ||
} | ||
return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue; | ||
} |
@@ -9,3 +9,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _full.default; | ||
@@ -16,3 +16,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _partial.loadPartialConfig; | ||
@@ -30,13 +30,18 @@ } | ||
function loadOptions(opts) { | ||
const config = (0, _full.default)(opts); | ||
var config = (0, _full.default)(opts); | ||
return config ? config.options : null; | ||
} | ||
class OptionManager { | ||
init(opts) { | ||
var OptionManager = function () { | ||
function OptionManager() {} | ||
var _proto = OptionManager.prototype; | ||
_proto.init = function init(opts) { | ||
return loadOptions(opts); | ||
} | ||
}; | ||
} | ||
return OptionManager; | ||
}(); | ||
exports.OptionManager = OptionManager; |
@@ -11,5 +11,5 @@ "use strict"; | ||
function _path() { | ||
const data = _interopRequireDefault(require("path")); | ||
var data = _interopRequireDefault(require("path")); | ||
_path = function () { | ||
_path = function _path() { | ||
return data; | ||
@@ -29,8 +29,10 @@ }; | ||
function createConfigItem(value, { | ||
dirname = ".", | ||
type | ||
} = {}) { | ||
const descriptor = (0, _configDescriptors.createDescriptor)(value, _path().default.resolve(dirname), { | ||
type, | ||
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, | ||
alias: "programmatic item" | ||
@@ -49,26 +51,23 @@ }); | ||
class ConfigItem { | ||
constructor(descriptor) { | ||
this._descriptor = descriptor; | ||
Object.defineProperty(this, "_descriptor", { | ||
enumerable: false | ||
}); | ||
var ConfigItem = function ConfigItem(descriptor) { | ||
this._descriptor = descriptor; | ||
Object.defineProperty(this, "_descriptor", { | ||
enumerable: false | ||
}); | ||
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); | ||
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); | ||
}; | ||
Object.freeze(ConfigItem.prototype); |
@@ -10,5 +10,5 @@ "use strict"; | ||
function _path() { | ||
const data = _interopRequireDefault(require("path")); | ||
var data = _interopRequireDefault(require("path")); | ||
_path = function () { | ||
_path = function _path() { | ||
return data; | ||
@@ -39,19 +39,19 @@ }; | ||
const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {}; | ||
const { | ||
envName = (0, _environment.getEnv)(), | ||
cwd = "." | ||
} = args; | ||
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 absoluteCwd = _path().default.resolve(cwd); | ||
var absoluteCwd = _path().default.resolve(cwd); | ||
const context = { | ||
var context = { | ||
filename: args.filename ? _path().default.resolve(cwd, args.filename) : null, | ||
cwd: absoluteCwd, | ||
envName | ||
envName: envName | ||
}; | ||
const configChain = (0, _configChain.buildRootChain)(args, context); | ||
var configChain = (0, _configChain.buildRootChain)(args, context); | ||
if (!configChain) return null; | ||
const options = {}; | ||
configChain.options.forEach(opts => { | ||
var options = {}; | ||
configChain.options.forEach(function (opts) { | ||
(0, _util.mergeOptions)(options, opts); | ||
@@ -63,7 +63,11 @@ }); | ||
options.passPerPreset = false; | ||
options.plugins = configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)); | ||
options.presets = configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)); | ||
options.plugins = configChain.plugins.map(function (descriptor) { | ||
return (0, _item.createItemFromDescriptor)(descriptor); | ||
}); | ||
options.presets = configChain.presets.map(function (descriptor) { | ||
return (0, _item.createItemFromDescriptor)(descriptor); | ||
}); | ||
return { | ||
options, | ||
context, | ||
options: options, | ||
context: context, | ||
ignore: configChain.ignore, | ||
@@ -75,10 +79,8 @@ babelrc: configChain.babelrc | ||
function loadPartialConfig(inputOpts) { | ||
const result = loadPrivatePartialConfig(inputOpts); | ||
var result = loadPrivatePartialConfig(inputOpts); | ||
if (!result) return null; | ||
const { | ||
options, | ||
babelrc, | ||
ignore | ||
} = result; | ||
(options.plugins || []).forEach(item => { | ||
var options = result.options, | ||
babelrc = result.babelrc, | ||
ignore = result.ignore; | ||
(options.plugins || []).forEach(function (item) { | ||
if (item.value instanceof _plugin.default) { | ||
@@ -91,4 +93,4 @@ throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()"); | ||
class PartialConfig { | ||
constructor(options, babelrc, ignore) { | ||
var PartialConfig = function () { | ||
function PartialConfig(options, babelrc, ignore) { | ||
this.options = options; | ||
@@ -100,8 +102,11 @@ this.babelignore = ignore; | ||
hasFilesystemConfig() { | ||
var _proto = PartialConfig.prototype; | ||
_proto.hasFilesystemConfig = function hasFilesystemConfig() { | ||
return this.babelrc !== undefined; | ||
} | ||
}; | ||
} | ||
return PartialConfig; | ||
}(); | ||
Object.freeze(PartialConfig.prototype); |
@@ -8,16 +8,13 @@ "use strict"; | ||
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; | ||
} | ||
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; | ||
}; | ||
} | ||
exports.default = Plugin; |
@@ -9,13 +9,19 @@ "use strict"; | ||
function mergeOptions(target, source) { | ||
for (const k of Object.keys(source)) { | ||
var _arr = Object.keys(source); | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var k = _arr[_i]; | ||
if (k === "parserOpts" && source.parserOpts) { | ||
const parserOpts = source.parserOpts; | ||
const targetObj = target.parserOpts = target.parserOpts || {}; | ||
var parserOpts = source.parserOpts; | ||
var targetObj = target.parserOpts = target.parserOpts || {}; | ||
mergeDefaultFields(targetObj, parserOpts); | ||
} else if (k === "generatorOpts" && source.generatorOpts) { | ||
const generatorOpts = source.generatorOpts; | ||
const targetObj = target.generatorOpts = target.generatorOpts || {}; | ||
mergeDefaultFields(targetObj, generatorOpts); | ||
var generatorOpts = source.generatorOpts; | ||
var _targetObj = target.generatorOpts = target.generatorOpts || {}; | ||
mergeDefaultFields(_targetObj, generatorOpts); | ||
} else { | ||
const val = source[k]; | ||
var val = source[k]; | ||
if (val !== undefined) target[k] = val; | ||
@@ -27,6 +33,9 @@ } | ||
function mergeDefaultFields(target, source) { | ||
for (const k of Object.keys(source)) { | ||
const val = source[k]; | ||
var _arr2 = Object.keys(source); | ||
for (var _i2 = 0; _i2 < _arr2.length; _i2++) { | ||
var k = _arr2[_i2]; | ||
var val = source[k]; | ||
if (val !== undefined) target[k] = val; | ||
} | ||
} |
@@ -21,3 +21,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"); | ||
} | ||
@@ -30,3 +30,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"); | ||
} | ||
@@ -39,3 +39,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"); | ||
} | ||
@@ -56,3 +56,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"); | ||
} | ||
@@ -65,3 +65,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"); | ||
} | ||
@@ -74,3 +74,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"); | ||
} | ||
@@ -83,3 +83,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"); | ||
} | ||
@@ -92,3 +92,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"); | ||
} | ||
@@ -100,6 +100,8 @@ | ||
function assertIgnoreList(key, value) { | ||
const arr = assertArray(key, value); | ||
var arr = assertArray(key, value); | ||
if (arr) { | ||
arr.forEach((item, i) => assertIgnoreItem(key, i, item)); | ||
arr.forEach(function (item, i) { | ||
return assertIgnoreItem(key, i, item); | ||
}); | ||
} | ||
@@ -112,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"); | ||
} | ||
@@ -123,9 +125,9 @@ | ||
if (Array.isArray(value)) { | ||
value.forEach((item, i) => { | ||
value.forEach(function (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"); | ||
} | ||
@@ -141,6 +143,8 @@ | ||
function assertPluginList(key, value) { | ||
const arr = assertArray(key, value); | ||
var arr = assertArray(key, value); | ||
if (arr) { | ||
arr.forEach((item, i) => assertPluginItem(key, i, item)); | ||
arr.forEach(function (item, i) { | ||
return assertPluginItem(key, i, item); | ||
}); | ||
} | ||
@@ -154,7 +158,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"); | ||
} | ||
@@ -165,6 +169,6 @@ | ||
if (value.length > 1) { | ||
const opts = value[1]; | ||
var 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"); | ||
} | ||
@@ -174,6 +178,6 @@ } | ||
if (value.length === 3) { | ||
const name = value[2]; | ||
var 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"); | ||
} | ||
@@ -190,3 +194,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"); | ||
} | ||
@@ -193,0 +197,0 @@ |
@@ -16,3 +16,3 @@ "use strict"; | ||
const ROOT_VALIDATORS = { | ||
var ROOT_VALIDATORS = { | ||
cwd: _optionAssertions.assertString, | ||
@@ -26,3 +26,3 @@ filename: _optionAssertions.assertString, | ||
}; | ||
const NONPRESET_VALIDATORS = { | ||
var NONPRESET_VALIDATORS = { | ||
extends: _optionAssertions.assertString, | ||
@@ -37,3 +37,3 @@ env: assertEnvSet, | ||
}; | ||
const COMMON_VALIDATORS = { | ||
var COMMON_VALIDATORS = { | ||
inputSourceMap: _optionAssertions.assertInputSourceMap, | ||
@@ -67,24 +67,24 @@ presets: _optionAssertions.assertPluginList, | ||
assertNoDuplicateSourcemap(opts); | ||
Object.keys(opts).forEach(key => { | ||
Object.keys(opts).forEach(function (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 === "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"); | ||
} | ||
const validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || ROOT_VALIDATORS[key]; | ||
var validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || ROOT_VALIDATORS[key]; | ||
if (validator) validator(key, opts[key]);else throw buildUnknownError(key); | ||
@@ -97,9 +97,9 @@ }); | ||
if (_removed.default[key]) { | ||
const { | ||
message, | ||
version = 5 | ||
} = _removed.default[key]; | ||
throw new ReferenceError(`Using removed Babel ${version} option: .${key} - ${message}`); | ||
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); | ||
} else { | ||
const unknownOptErr = `Unknown option: .${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`; | ||
var unknownOptErr = "Unknown option: ." + key + ". Check out http://babeljs.io/docs/usage/options/ for more information about options."; | ||
throw new ReferenceError(unknownOptErr); | ||
@@ -120,8 +120,13 @@ } | ||
function assertEnvSet(key, value) { | ||
const obj = (0, _optionAssertions.assertObject)(key, value); | ||
var obj = (0, _optionAssertions.assertObject)(key, value); | ||
if (obj) { | ||
for (const key of Object.keys(obj)) { | ||
const env = (0, _optionAssertions.assertObject)(key, obj[key]); | ||
if (env) validate("env", env); | ||
var _arr = Object.keys(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); | ||
} | ||
@@ -134,9 +139,25 @@ } | ||
function assertOverridesList(key, value) { | ||
const arr = (0, _optionAssertions.assertArray)(key, value); | ||
var arr = (0, _optionAssertions.assertArray)(key, value); | ||
if (arr) { | ||
for (const [index, item] of arr.entries()) { | ||
const env = (0, _optionAssertions.assertObject)(`${index}`, item); | ||
if (!env) throw new Error(`.${key}[${index}] must be an object`); | ||
validate("override", env); | ||
for (var _iterator = arr.entries(), _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i2 >= _iterator.length) break; | ||
_ref = _iterator[_i2++]; | ||
} else { | ||
_i2 = _iterator.next(); | ||
if (_i2.done) break; | ||
_ref = _i2.value; | ||
} | ||
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); | ||
} | ||
@@ -143,0 +164,0 @@ } |
@@ -10,3 +10,3 @@ "use strict"; | ||
const VALIDATORS = { | ||
var VALIDATORS = { | ||
name: _optionAssertions.assertString, | ||
@@ -23,9 +23,11 @@ manipulateOptions: _optionAssertions.assertFunction, | ||
function assertVisitorMap(key, value) { | ||
const obj = (0, _optionAssertions.assertObject)(key, value); | ||
var obj = (0, _optionAssertions.assertObject)(key, value); | ||
if (obj) { | ||
Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop])); | ||
Object.keys(obj).forEach(function (prop) { | ||
return 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."); | ||
} | ||
@@ -39,9 +41,9 @@ } | ||
if (value && typeof value === "object") { | ||
Object.keys(value).forEach(handler => { | ||
Object.keys(value).forEach(function (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"); | ||
} | ||
@@ -53,7 +55,7 @@ | ||
function validatePluginObject(obj) { | ||
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`); | ||
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"); | ||
}); | ||
return obj; | ||
} |
@@ -9,3 +9,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _file.default; | ||
@@ -16,3 +16,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _buildExternalHelpers.default; | ||
@@ -23,3 +23,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _files.resolvePlugin; | ||
@@ -30,3 +30,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _files.resolvePreset; | ||
@@ -37,3 +37,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _package.version; | ||
@@ -44,3 +44,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _environment.getEnv; | ||
@@ -51,3 +51,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _traverse().default; | ||
@@ -58,3 +58,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _template().default; | ||
@@ -65,3 +65,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _config.loadPartialConfig; | ||
@@ -72,3 +72,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _config.loadOptions; | ||
@@ -79,3 +79,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _config.OptionManager; | ||
@@ -86,3 +86,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _item.createConfigItem; | ||
@@ -93,3 +93,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _transform.default; | ||
@@ -100,3 +100,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _transformSync.default; | ||
@@ -107,3 +107,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _transformFile.default; | ||
@@ -114,3 +114,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _transformFileSync.default; | ||
@@ -121,3 +121,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _transformAst.default; | ||
@@ -128,3 +128,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _transformAstSync.default; | ||
@@ -135,3 +135,3 @@ } | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _parse.default; | ||
@@ -153,5 +153,5 @@ } | ||
function _types() { | ||
const data = _interopRequireWildcard(require("@babel/types")); | ||
var data = _interopRequireWildcard(require("@babel/types")); | ||
_types = function () { | ||
_types = function _types() { | ||
return data; | ||
@@ -165,3 +165,3 @@ }; | ||
enumerable: true, | ||
get: function () { | ||
get: function get() { | ||
return _types(); | ||
@@ -172,5 +172,5 @@ } | ||
function _traverse() { | ||
const data = _interopRequireDefault(require("@babel/traverse")); | ||
var data = _interopRequireDefault(require("@babel/traverse")); | ||
_traverse = function () { | ||
_traverse = function _traverse() { | ||
return data; | ||
@@ -183,5 +183,5 @@ }; | ||
function _template() { | ||
const data = _interopRequireDefault(require("@babel/template")); | ||
var data = _interopRequireDefault(require("@babel/template")); | ||
_template = function () { | ||
_template = function _template() { | ||
return data; | ||
@@ -216,6 +216,6 @@ }; | ||
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."); | ||
} | ||
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]); | ||
var DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]); | ||
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS; |
@@ -17,3 +17,3 @@ "use strict"; | ||
function parse(code, opts) { | ||
const config = (0, _config.default)(opts); | ||
var config = (0, _config.default)(opts); | ||
@@ -24,4 +24,4 @@ if (config === null) { | ||
const file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code); | ||
var file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code); | ||
return file.ast; | ||
} |
@@ -9,5 +9,5 @@ "use strict"; | ||
function helpers() { | ||
const data = _interopRequireWildcard(require("@babel/helpers")); | ||
var data = _interopRequireWildcard(require("@babel/helpers")); | ||
helpers = function () { | ||
helpers = function helpers() { | ||
return data; | ||
@@ -20,5 +20,5 @@ }; | ||
function _generator() { | ||
const data = _interopRequireDefault(require("@babel/generator")); | ||
var data = _interopRequireDefault(require("@babel/generator")); | ||
_generator = function () { | ||
_generator = function _generator() { | ||
return data; | ||
@@ -31,5 +31,5 @@ }; | ||
function _template() { | ||
const data = _interopRequireDefault(require("@babel/template")); | ||
var data = _interopRequireDefault(require("@babel/template")); | ||
_template = function () { | ||
_template = function _template() { | ||
return data; | ||
@@ -42,5 +42,5 @@ }; | ||
function t() { | ||
const data = _interopRequireWildcard(require("@babel/types")); | ||
var data = _interopRequireWildcard(require("@babel/types")); | ||
t = function () { | ||
t = function t() { | ||
return data; | ||
@@ -52,2 +52,4 @@ }; | ||
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 }; } | ||
@@ -57,21 +59,13 @@ | ||
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); | ||
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; } | ||
var buildUmdWrapper = function buildUmdWrapper(replacements) { | ||
return (0, _template().default)(_templateObject)(replacements); | ||
}; | ||
function buildGlobal(whitelist) { | ||
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"))]))]); | ||
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"))]))]); | ||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().assignmentExpression("=", t().memberExpression(t().identifier("global"), namespace), t().objectExpression([])))])); | ||
@@ -83,5 +77,5 @@ buildHelpers(body, namespace, whitelist); | ||
function buildModule(whitelist) { | ||
const body = []; | ||
const refs = buildHelpers(body, null, whitelist); | ||
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(name => { | ||
var body = []; | ||
var refs = buildHelpers(body, null, whitelist); | ||
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(function (name) { | ||
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name)); | ||
@@ -93,4 +87,4 @@ }))); | ||
function buildUmd(whitelist) { | ||
const namespace = t().identifier("babelHelpers"); | ||
const body = []; | ||
var namespace = t().identifier("babelHelpers"); | ||
var body = []; | ||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))])); | ||
@@ -109,6 +103,6 @@ buildHelpers(body, namespace, whitelist); | ||
function buildVar(whitelist) { | ||
const namespace = t().identifier("babelHelpers"); | ||
const body = []; | ||
var namespace = t().identifier("babelHelpers"); | ||
var body = []; | ||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))])); | ||
const tree = t().program(body); | ||
var tree = t().program(body); | ||
buildHelpers(body, namespace, whitelist); | ||
@@ -120,14 +114,15 @@ body.push(t().expressionStatement(namespace)); | ||
function buildHelpers(body, namespace, whitelist) { | ||
const getHelperReference = name => { | ||
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier(`_${name}`); | ||
var getHelperReference = function getHelperReference(name) { | ||
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier("_" + name); | ||
}; | ||
const refs = {}; | ||
var refs = {}; | ||
helpers().list.forEach(function (name) { | ||
if (whitelist && whitelist.indexOf(name) < 0) return; | ||
const ref = refs[name] = getHelperReference(name); | ||
const { | ||
nodes | ||
} = helpers().get(name, getHelperReference, ref); | ||
body.push(...nodes); | ||
var ref = refs[name] = getHelperReference(name); | ||
var _helpers$get = helpers().get(name, getHelperReference, ref), | ||
nodes = _helpers$get.nodes; | ||
body.push.apply(body, nodes); | ||
}); | ||
@@ -137,5 +132,9 @@ return refs; | ||
function _default(whitelist, outputType = "global") { | ||
let tree; | ||
const build = { | ||
function _default(whitelist, outputType) { | ||
if (outputType === void 0) { | ||
outputType = "global"; | ||
} | ||
var tree; | ||
var build = { | ||
global: buildGlobal, | ||
@@ -150,3 +149,3 @@ module: buildModule, | ||
} else { | ||
throw new Error(`Unsupported output type ${outputType}`); | ||
throw new Error("Unsupported output type " + outputType); | ||
} | ||
@@ -153,0 +152,0 @@ |
@@ -15,3 +15,3 @@ "use strict"; | ||
function transformFromAstSync(ast, code, opts) { | ||
const config = (0, _config.default)(opts); | ||
var 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); | ||
const cb = callback; | ||
process.nextTick(() => { | ||
let cfg; | ||
var cb = callback; | ||
process.nextTick(function () { | ||
var cfg; | ||
@@ -28,0 +28,0 @@ try { |
@@ -8,3 +8,7 @@ "use strict"; | ||
function transformFile(filename, opts = {}, callback) { | ||
function transformFile(filename, opts, callback) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
if (typeof opts === "function") { | ||
@@ -11,0 +15,0 @@ callback = opts; |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _fs() { | ||
const data = _interopRequireDefault(require("fs")); | ||
var data = _interopRequireDefault(require("fs")); | ||
_fs = function () { | ||
_fs = function _fs() { | ||
return data; | ||
@@ -26,17 +26,17 @@ }; | ||
function transformFileSync(filename, opts) { | ||
let options; | ||
var options; | ||
if (opts == null) { | ||
options = { | ||
filename | ||
filename: filename | ||
}; | ||
} else if (opts && typeof opts === "object") { | ||
options = Object.assign({}, opts, { | ||
filename | ||
filename: filename | ||
}); | ||
} | ||
const config = (0, _config.default)(options); | ||
var config = (0, _config.default)(options); | ||
if (config === null) return null; | ||
return (0, _transformation.runSync)(config, _fs().default.readFileSync(filename, "utf8")); | ||
} |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _fs() { | ||
const data = _interopRequireDefault(require("fs")); | ||
var data = _interopRequireDefault(require("fs")); | ||
_fs = function () { | ||
_fs = function _fs() { | ||
return data; | ||
@@ -26,3 +26,3 @@ }; | ||
var transformFile = function transformFile(filename, opts, callback) { | ||
let options; | ||
var 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(() => { | ||
let cfg; | ||
process.nextTick(function () { | ||
var cfg; | ||
@@ -55,3 +55,3 @@ try { | ||
const config = cfg; | ||
var config = cfg; | ||
@@ -58,0 +58,0 @@ _fs().default.readFile(filename, "utf8", function (err, code) { |
@@ -15,5 +15,5 @@ "use strict"; | ||
function transformSync(code, opts) { | ||
const config = (0, _config.default)(opts); | ||
var 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); | ||
const cb = callback; | ||
process.nextTick(() => { | ||
let cfg; | ||
var cb = callback; | ||
process.nextTick(function () { | ||
var cfg; | ||
@@ -28,0 +28,0 @@ try { |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _sortBy() { | ||
const data = _interopRequireDefault(require("lodash/sortBy")); | ||
var data = _interopRequireDefault(require("lodash/sortBy")); | ||
_sortBy = function () { | ||
_sortBy = function _sortBy() { | ||
return data; | ||
@@ -23,7 +23,7 @@ }; | ||
let LOADED_PLUGIN; | ||
var LOADED_PLUGIN; | ||
function loadBlockHoistPlugin() { | ||
if (!LOADED_PLUGIN) { | ||
const config = (0, _config.default)({ | ||
var config = (0, _config.default)({ | ||
babelrc: false, | ||
@@ -39,13 +39,12 @@ plugins: [blockHoistPlugin] | ||
const blockHoistPlugin = { | ||
var blockHoistPlugin = { | ||
name: "internal.blockHoist", | ||
visitor: { | ||
Block: { | ||
exit({ | ||
node | ||
}) { | ||
let hasChange = false; | ||
exit: function exit(_ref) { | ||
var node = _ref.node; | ||
var hasChange = false; | ||
for (let i = 0; i < node.body.length; i++) { | ||
const bodyNode = node.body[i]; | ||
for (var i = 0; i < node.body.length; i++) { | ||
var bodyNode = node.body[i]; | ||
@@ -60,3 +59,3 @@ if (bodyNode && bodyNode._blockHoist != null) { | ||
node.body = (0, _sortBy().default)(node.body, function (bodyNode) { | ||
let priority = bodyNode && bodyNode._blockHoist; | ||
var priority = bodyNode && bodyNode._blockHoist; | ||
if (priority == null) priority = 1; | ||
@@ -67,5 +66,4 @@ if (priority === true) priority = 2; | ||
} | ||
} | ||
} | ||
}; |
@@ -9,5 +9,5 @@ "use strict"; | ||
function helpers() { | ||
const data = _interopRequireWildcard(require("@babel/helpers")); | ||
var data = _interopRequireWildcard(require("@babel/helpers")); | ||
helpers = function () { | ||
helpers = function helpers() { | ||
return data; | ||
@@ -20,5 +20,5 @@ }; | ||
function _traverse() { | ||
const data = _interopRequireWildcard(require("@babel/traverse")); | ||
var data = _interopRequireWildcard(require("@babel/traverse")); | ||
_traverse = function () { | ||
_traverse = function _traverse() { | ||
return data; | ||
@@ -31,5 +31,5 @@ }; | ||
function _codeFrame() { | ||
const data = require("@babel/code-frame"); | ||
var data = require("@babel/code-frame"); | ||
_codeFrame = function () { | ||
_codeFrame = function _codeFrame() { | ||
return data; | ||
@@ -42,5 +42,5 @@ }; | ||
function t() { | ||
const data = _interopRequireWildcard(require("@babel/types")); | ||
var data = _interopRequireWildcard(require("@babel/types")); | ||
t = function () { | ||
t = function t() { | ||
return data; | ||
@@ -54,5 +54,5 @@ }; | ||
const errorVisitor = { | ||
enter(path, state) { | ||
const loc = path.node.loc; | ||
var errorVisitor = { | ||
enter: function enter(path, state) { | ||
var loc = path.node.loc; | ||
@@ -64,12 +64,10 @@ if (loc) { | ||
} | ||
}; | ||
class File { | ||
constructor(options, { | ||
code, | ||
ast, | ||
shebang, | ||
inputMap | ||
}) { | ||
var File = function () { | ||
function File(options, _ref) { | ||
var code = _ref.code, | ||
ast = _ref.ast, | ||
shebang = _ref.shebang, | ||
inputMap = _ref.inputMap; | ||
this._map = new Map(); | ||
@@ -99,25 +97,30 @@ this.declarations = {}; | ||
set(key, val) { | ||
var _proto = File.prototype; | ||
_proto.set = function set(key, val) { | ||
this._map.set(key, val); | ||
} | ||
}; | ||
get(key) { | ||
_proto.get = function get(key) { | ||
return this._map.get(key); | ||
} | ||
}; | ||
has(key) { | ||
_proto.has = function has(key) { | ||
return this._map.has(key); | ||
} | ||
}; | ||
getModuleName() { | ||
const { | ||
filename, | ||
filenameRelative = filename, | ||
moduleId, | ||
moduleIds = !!moduleId, | ||
getModuleId, | ||
sourceRoot: sourceRootTmp, | ||
moduleRoot = sourceRootTmp, | ||
sourceRoot = moduleRoot | ||
} = this.opts; | ||
_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; | ||
if (!moduleIds) return null; | ||
@@ -129,6 +132,6 @@ | ||
let moduleName = moduleRoot != null ? moduleRoot + "/" : ""; | ||
var moduleName = moduleRoot != null ? moduleRoot + "/" : ""; | ||
if (filenameRelative) { | ||
const sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : ""; | ||
var sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : ""; | ||
moduleName += filenameRelative.replace(sourceRootReplacer, "").replace(/\.(\w*?)$/, ""); | ||
@@ -144,20 +147,22 @@ } | ||
} | ||
} | ||
}; | ||
resolveModuleSource(source) { | ||
_proto.resolveModuleSource = function resolveModuleSource(source) { | ||
return source; | ||
} | ||
}; | ||
addImport() { | ||
_proto.addImport = function 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'."); | ||
} | ||
}; | ||
addHelper(name) { | ||
const declar = this.declarations[name]; | ||
_proto.addHelper = function addHelper(name) { | ||
var _this = this; | ||
var declar = this.declarations[name]; | ||
if (declar) return t().cloneNode(declar); | ||
const generator = this.get("helperGenerator"); | ||
const runtime = this.get("helpersNamespace"); | ||
var generator = this.get("helperGenerator"); | ||
var runtime = this.get("helpersNamespace"); | ||
if (generator) { | ||
const res = generator(name); | ||
var res = generator(name); | ||
if (res) return res; | ||
@@ -168,39 +173,57 @@ } else if (runtime) { | ||
const uid = this.declarations[name] = this.scope.generateUidIdentifier(name); | ||
const dependencies = {}; | ||
var uid = this.declarations[name] = this.scope.generateUidIdentifier(name); | ||
var dependencies = {}; | ||
for (const dep of helpers().getDependencies(name)) { | ||
for (var _iterator = helpers().getDependencies(name), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref2 = _i.value; | ||
} | ||
var dep = _ref2; | ||
dependencies[dep] = this.addHelper(dep); | ||
} | ||
const { | ||
nodes, | ||
globals | ||
} = helpers().get(name, dep => dependencies[dep], uid, Object.keys(this.scope.getAllBindings())); | ||
globals.forEach(name => { | ||
if (this.path.scope.hasBinding(name, true)) { | ||
this.path.scope.rename(name); | ||
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; | ||
globals.forEach(function (name) { | ||
if (_this.path.scope.hasBinding(name, true)) { | ||
_this.path.scope.rename(name); | ||
} | ||
}); | ||
nodes.forEach(node => { | ||
nodes.forEach(function (node) { | ||
node._compact = true; | ||
}); | ||
this.path.unshiftContainer("body", nodes); | ||
this.path.get("body").forEach(path => { | ||
this.path.get("body").forEach(function (path) { | ||
if (nodes.indexOf(path.node) === -1) return; | ||
if (path.isVariableDeclaration()) this.scope.registerDeclaration(path); | ||
if (path.isVariableDeclaration()) _this.scope.registerDeclaration(path); | ||
}); | ||
return uid; | ||
} | ||
}; | ||
addTemplateObject() { | ||
_proto.addTemplateObject = function addTemplateObject() { | ||
throw new Error("This function has been moved into the template literal transform itself."); | ||
} | ||
}; | ||
buildCodeFrameError(node, msg, Error = SyntaxError) { | ||
let loc = node && (node.loc || node._loc); | ||
msg = `${this.opts.filename}: ${msg}`; | ||
_proto.buildCodeFrameError = function buildCodeFrameError(node, msg, Error) { | ||
if (Error === void 0) { | ||
Error = SyntaxError; | ||
} | ||
var loc = node && (node.loc || node._loc); | ||
msg = this.opts.filename + ": " + msg; | ||
if (!loc && node) { | ||
const state = { | ||
var state = { | ||
loc: null | ||
@@ -210,11 +233,10 @@ }; | ||
loc = state.loc; | ||
let txt = "This is an error on an internal node. Probably an internal error."; | ||
var 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) { | ||
const { | ||
highlightCode = true | ||
} = this.opts; | ||
var _opts$highlightCode = this.opts.highlightCode, | ||
highlightCode = _opts$highlightCode === void 0 ? true : _opts$highlightCode; | ||
msg += "\n" + (0, _codeFrame().codeFrameColumns)(this.code, { | ||
@@ -226,3 +248,3 @@ start: { | ||
}, { | ||
highlightCode | ||
highlightCode: highlightCode | ||
}); | ||
@@ -232,6 +254,7 @@ } | ||
return new Error(msg); | ||
} | ||
}; | ||
} | ||
return File; | ||
}(); | ||
exports.default = File; |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _convertSourceMap() { | ||
const data = _interopRequireDefault(require("convert-source-map")); | ||
var data = _interopRequireDefault(require("convert-source-map")); | ||
_convertSourceMap = function () { | ||
_convertSourceMap = function _convertSourceMap() { | ||
return data; | ||
@@ -20,5 +20,5 @@ }; | ||
function _sourceMap() { | ||
const data = _interopRequireDefault(require("source-map")); | ||
var data = _interopRequireDefault(require("source-map")); | ||
_sourceMap = function () { | ||
_sourceMap = function _sourceMap() { | ||
return data; | ||
@@ -31,5 +31,5 @@ }; | ||
function _generator() { | ||
const data = _interopRequireDefault(require("@babel/generator")); | ||
var data = _interopRequireDefault(require("@babel/generator")); | ||
_generator = function () { | ||
_generator = function _generator() { | ||
return data; | ||
@@ -44,20 +44,42 @@ }; | ||
function generateCode(pluginPasses, file) { | ||
const { | ||
opts, | ||
ast, | ||
shebang, | ||
code, | ||
inputMap | ||
} = file; | ||
const results = []; | ||
var opts = file.opts, | ||
ast = file.ast, | ||
shebang = file.shebang, | ||
code = file.code, | ||
inputMap = file.inputMap; | ||
var results = []; | ||
for (const plugins of pluginPasses) { | ||
for (const plugin of plugins) { | ||
const { | ||
generatorOverride | ||
} = plugin; | ||
for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var plugins = _ref; | ||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var plugin = _ref2; | ||
var generatorOverride = plugin.generatorOverride; | ||
if (generatorOverride) { | ||
const result = generatorOverride(ast, opts.generatorOpts, code, _generator().default); | ||
if (result !== undefined) results.push(result); | ||
var _result2 = generatorOverride(ast, opts.generatorOpts, code, _generator().default); | ||
if (_result2 !== undefined) results.push(_result2); | ||
} | ||
@@ -67,3 +89,3 @@ } | ||
let result; | ||
var result; | ||
@@ -76,3 +98,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."); | ||
} | ||
@@ -83,9 +105,8 @@ } else { | ||
let { | ||
code: outputCode, | ||
map: outputMap | ||
} = result; | ||
var _result = result, | ||
outputCode = _result.code, | ||
outputMap = _result.map; | ||
if (shebang) { | ||
outputCode = `${shebang}\n${outputCode}`; | ||
outputCode = shebang + "\n" + outputCode; | ||
} | ||
@@ -106,4 +127,4 @@ | ||
return { | ||
outputCode, | ||
outputMap | ||
outputCode: outputCode, | ||
outputMap: outputMap | ||
}; | ||
@@ -113,11 +134,11 @@ } | ||
function mergeSourceMap(inputMap, map) { | ||
const inputMapConsumer = new (_sourceMap().default.SourceMapConsumer)(inputMap); | ||
const outputMapConsumer = new (_sourceMap().default.SourceMapConsumer)(map); | ||
const mergedGenerator = new (_sourceMap().default.SourceMapGenerator)({ | ||
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 | ||
}); | ||
const source = outputMapConsumer.sources[0]; | ||
var source = outputMapConsumer.sources[0]; | ||
inputMapConsumer.eachMapping(function (mapping) { | ||
const generatedPosition = outputMapConsumer.generatedPositionFor({ | ||
var generatedPosition = outputMapConsumer.generatedPositionFor({ | ||
line: mapping.generatedLine, | ||
@@ -140,5 +161,5 @@ column: mapping.generatedColumn, | ||
}); | ||
const mergedMap = mergedGenerator.toJSON(); | ||
var mergedMap = mergedGenerator.toJSON(); | ||
inputMap.mappings = mergedMap.mappings; | ||
return inputMap; | ||
} |
@@ -10,5 +10,5 @@ "use strict"; | ||
function _traverse() { | ||
const data = _interopRequireDefault(require("@babel/traverse")); | ||
var data = _interopRequireDefault(require("@babel/traverse")); | ||
_traverse = function () { | ||
_traverse = function _traverse() { | ||
return data; | ||
@@ -33,3 +33,3 @@ }; | ||
function runAsync(config, code, ast, callback) { | ||
let result; | ||
var result; | ||
@@ -46,9 +46,10 @@ try { | ||
function runSync(config, code, ast) { | ||
const file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast); | ||
var file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast); | ||
transformFile(file, config.passes); | ||
const opts = file.opts; | ||
const { | ||
outputCode, | ||
outputMap | ||
} = opts.code !== false ? (0, _generate.default)(config.passes, file) : {}; | ||
var opts = file.opts; | ||
var _ref = opts.code !== false ? (0, _generate.default)(config.passes, file) : {}, | ||
outputCode = _ref.outputCode, | ||
outputMap = _ref.outputMap; | ||
return { | ||
@@ -65,9 +66,33 @@ metadata: file.metadata, | ||
function transformFile(file, pluginPasses) { | ||
for (const pluginPairs of pluginPasses) { | ||
const passPairs = []; | ||
const passes = []; | ||
const visitors = []; | ||
for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref2; | ||
for (const plugin of pluginPairs.concat([(0, _blockHoistPlugin.default)()])) { | ||
const pass = new _pluginPass.default(file, plugin.key, plugin.options); | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref2 = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref2 = _i.value; | ||
} | ||
var pluginPairs = _ref2; | ||
var passPairs = []; | ||
var passes = []; | ||
var visitors = []; | ||
for (var _iterator2 = pluginPairs.concat([(0, _blockHoistPlugin.default)()]), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref3 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref3 = _i2.value; | ||
} | ||
var plugin = _ref3; | ||
var pass = new _pluginPass.default(file, plugin.key, plugin.options); | ||
passPairs.push([plugin, pass]); | ||
@@ -78,10 +103,13 @@ passes.push(pass); | ||
for (const [plugin, pass] of passPairs) { | ||
const fn = plugin.pre; | ||
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; | ||
if (fn) { | ||
const result = fn.call(pass, file); | ||
var 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."); | ||
} | ||
@@ -91,14 +119,17 @@ } | ||
const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod); | ||
var visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod); | ||
(0, _traverse().default)(file.ast, visitor, file.scope); | ||
for (const [plugin, pass] of passPairs) { | ||
const fn = plugin.post; | ||
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; | ||
if (fn) { | ||
const result = fn.call(pass, file); | ||
if (_fn) { | ||
var _result = _fn.call(_pass2, 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."); | ||
} | ||
@@ -105,0 +136,0 @@ } |
@@ -9,5 +9,5 @@ "use strict"; | ||
function t() { | ||
const data = _interopRequireWildcard(require("@babel/types")); | ||
var data = _interopRequireWildcard(require("@babel/types")); | ||
t = function () { | ||
t = function t() { | ||
return data; | ||
@@ -20,5 +20,5 @@ }; | ||
function _convertSourceMap() { | ||
const data = _interopRequireDefault(require("convert-source-map")); | ||
var data = _interopRequireDefault(require("convert-source-map")); | ||
_convertSourceMap = function () { | ||
_convertSourceMap = function _convertSourceMap() { | ||
return data; | ||
@@ -31,5 +31,5 @@ }; | ||
function _babylon() { | ||
const data = require("babylon"); | ||
var data = require("babylon"); | ||
_babylon = function () { | ||
_babylon = function _babylon() { | ||
return data; | ||
@@ -42,5 +42,5 @@ }; | ||
function _codeFrame() { | ||
const data = require("@babel/code-frame"); | ||
var data = require("@babel/code-frame"); | ||
_codeFrame = function () { | ||
_codeFrame = function _codeFrame() { | ||
return data; | ||
@@ -60,8 +60,8 @@ }; | ||
const shebangRegex = /^#!.*/; | ||
var shebangRegex = /^#!.*/; | ||
function normalizeFile(pluginPasses, options, code, ast) { | ||
code = `${code || ""}`; | ||
let shebang = null; | ||
let inputMap = null; | ||
code = "" + (code || ""); | ||
var shebang = null; | ||
var inputMap = null; | ||
@@ -78,3 +78,3 @@ if (options.inputSourceMap !== false) { | ||
const shebangMatch = shebangRegex.exec(code); | ||
var shebangMatch = shebangRegex.exec(code); | ||
@@ -97,6 +97,6 @@ if (shebangMatch) { | ||
return new _file.default(options, { | ||
code, | ||
ast, | ||
shebang, | ||
inputMap | ||
code: code, | ||
ast: ast, | ||
shebang: shebang, | ||
inputMap: inputMap | ||
}); | ||
@@ -107,13 +107,37 @@ } | ||
try { | ||
const results = []; | ||
var results = []; | ||
for (const plugins of pluginPasses) { | ||
for (const plugin of plugins) { | ||
const { | ||
parserOverride | ||
} = plugin; | ||
for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var plugins = _ref; | ||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var plugin = _ref2; | ||
var parserOverride = plugin.parserOverride; | ||
if (parserOverride) { | ||
const ast = parserOverride(code, options.parserOpts, _babylon().parse); | ||
if (ast !== undefined) results.push(ast); | ||
var _ast = parserOverride(code, options.parserOpts, _babylon().parse); | ||
if (_ast !== undefined) results.push(_ast); | ||
} | ||
@@ -127,3 +151,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."); | ||
} | ||
@@ -140,9 +164,7 @@ | ||
const { | ||
loc, | ||
missingPlugin | ||
} = err; | ||
var loc = err.loc, | ||
missingPlugin = err.missingPlugin; | ||
if (loc) { | ||
const codeFrame = (0, _codeFrame().codeFrameColumns)(code, { | ||
var codeFrame = (0, _codeFrame().codeFrameColumns)(code, { | ||
start: { | ||
@@ -155,5 +177,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; | ||
} | ||
@@ -160,0 +182,0 @@ |
@@ -9,5 +9,5 @@ "use strict"; | ||
function _path() { | ||
const data = _interopRequireDefault(require("path")); | ||
var data = _interopRequireDefault(require("path")); | ||
_path = function () { | ||
_path = function _path() { | ||
return data; | ||
@@ -22,16 +22,22 @@ }; | ||
function normalizeOptions(config) { | ||
const { | ||
filename, | ||
filenameRelative = filename || "unknown", | ||
sourceType = "module", | ||
inputSourceMap, | ||
sourceMaps = !!inputSourceMap, | ||
moduleRoot, | ||
sourceRoot = moduleRoot, | ||
sourceFileName = filenameRelative, | ||
comments = true, | ||
compact = "auto" | ||
} = config.options; | ||
const opts = config.options; | ||
const options = Object.assign({}, opts, { | ||
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, { | ||
parserOpts: Object.assign({ | ||
@@ -43,18 +49,44 @@ 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, | ||
sourceRoot, | ||
sourceFileName | ||
sourceMaps: sourceMaps, | ||
sourceRoot: sourceRoot, | ||
sourceFileName: sourceFileName | ||
}, opts.generatorOpts) | ||
}); | ||
for (const plugins of config.passes) { | ||
for (const plugin of plugins) { | ||
for (var _iterator = config.passes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var plugins = _ref; | ||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var plugin = _ref2; | ||
if (plugin.manipulateOptions) { | ||
@@ -61,0 +93,0 @@ plugin.manipulateOptions(options, options.parserOpts); |
@@ -8,4 +8,4 @@ "use strict"; | ||
class PluginPass { | ||
constructor(file, key, options) { | ||
var PluginPass = function () { | ||
function PluginPass(file, key, options) { | ||
this._map = new Map(); | ||
@@ -18,28 +18,31 @@ this.key = key; | ||
set(key, val) { | ||
var _proto = PluginPass.prototype; | ||
_proto.set = function set(key, val) { | ||
this._map.set(key, val); | ||
} | ||
}; | ||
get(key) { | ||
_proto.get = function get(key) { | ||
return this._map.get(key); | ||
} | ||
}; | ||
addHelper(name) { | ||
_proto.addHelper = function addHelper(name) { | ||
return this.file.addHelper(name); | ||
} | ||
}; | ||
addImport() { | ||
_proto.addImport = function addImport() { | ||
return this.file.addImport(); | ||
} | ||
}; | ||
getModuleName() { | ||
_proto.getModuleName = function getModuleName() { | ||
return this.file.getModuleName(); | ||
} | ||
}; | ||
buildCodeFrameError(node, msg, Error) { | ||
_proto.buildCodeFrameError = function 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; | ||
const pluginNameMap = { | ||
var pluginNameMap = { | ||
asyncGenerators: { | ||
@@ -213,24 +213,23 @@ syntax: { | ||
const getNameURLCombination = ({ | ||
name, | ||
url | ||
}) => `${name} (${url})`; | ||
var getNameURLCombination = function getNameURLCombination(_ref) { | ||
var name = _ref.name, | ||
url = _ref.url; | ||
return name + " (" + url + ")"; | ||
}; | ||
function generateMissingPluginMessage(missingPluginName, loc, codeFrame) { | ||
let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame; | ||
const pluginInfo = pluginNameMap[missingPluginName]; | ||
var helpMessage = "Support for the experimental syntax '" + missingPluginName + "' isn't currently enabled " + ("(" + loc.line + ":" + (loc.column + 1) + "):\n\n") + codeFrame; | ||
var pluginInfo = pluginNameMap[missingPluginName]; | ||
if (pluginInfo) { | ||
const { | ||
syntax: syntaxPlugin, | ||
transform: transformPlugin | ||
} = pluginInfo; | ||
var syntaxPlugin = pluginInfo.syntax, | ||
transformPlugin = pluginInfo.transform; | ||
if (syntaxPlugin) { | ||
if (transformPlugin) { | ||
const transformPluginInfo = getNameURLCombination(transformPlugin); | ||
helpMessage += `\n\nAdd ${transformPluginInfo} to the 'plugins' section of your Babel config ` + `to enable transformation.`; | ||
var transformPluginInfo = getNameURLCombination(transformPlugin); | ||
helpMessage += "\n\nAdd " + transformPluginInfo + " to the 'plugins' section of your Babel config " + "to enable transformation."; | ||
} else { | ||
const syntaxPluginInfo = getNameURLCombination(syntaxPlugin); | ||
helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`; | ||
var syntaxPluginInfo = getNameURLCombination(syntaxPlugin); | ||
helpMessage += "\n\nAdd " + syntaxPluginInfo + " to the 'plugins' section of your Babel config " + "to enable parsing."; | ||
} | ||
@@ -237,0 +236,0 @@ } |
{ | ||
"name": "@babel/core", | ||
"version": "7.0.0-beta.43", | ||
"version": "7.0.0-beta.44", | ||
"description": "Babel compiler core.", | ||
@@ -31,9 +31,9 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@babel/code-frame": "7.0.0-beta.43", | ||
"@babel/generator": "7.0.0-beta.43", | ||
"@babel/helpers": "7.0.0-beta.43", | ||
"@babel/template": "7.0.0-beta.43", | ||
"@babel/traverse": "7.0.0-beta.43", | ||
"@babel/types": "7.0.0-beta.43", | ||
"babylon": "7.0.0-beta.43", | ||
"@babel/code-frame": "7.0.0-beta.44", | ||
"@babel/generator": "7.0.0-beta.44", | ||
"@babel/helpers": "7.0.0-beta.44", | ||
"@babel/template": "7.0.0-beta.44", | ||
"@babel/traverse": "7.0.0-beta.44", | ||
"@babel/types": "7.0.0-beta.44", | ||
"babylon": "7.0.0-beta.44", | ||
"convert-source-map": "^1.1.0", | ||
@@ -49,5 +49,5 @@ "debug": "^3.1.0", | ||
"devDependencies": { | ||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.43", | ||
"@babel/register": "7.0.0-beta.43" | ||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.44", | ||
"@babel/register": "7.0.0-beta.44" | ||
} | ||
} |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
136297
3514
7
+ Added@babel/code-frame@7.0.0-beta.44(transitive)
+ Added@babel/generator@7.0.0-beta.44(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.44(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.44(transitive)
+ Added@babel/helper-split-export-declaration@7.0.0-beta.44(transitive)
+ Added@babel/helpers@7.0.0-beta.44(transitive)
+ Added@babel/highlight@7.0.0-beta.44(transitive)
+ Added@babel/template@7.0.0-beta.44(transitive)
+ Added@babel/traverse@7.0.0-beta.44(transitive)
+ Added@babel/types@7.0.0-beta.44(transitive)
+ Addedbabylon@7.0.0-beta.44(transitive)
- Removed@babel/code-frame@7.0.0-beta.43(transitive)
- Removed@babel/generator@7.0.0-beta.43(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.43(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.43(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-beta.43(transitive)
- Removed@babel/helpers@7.0.0-beta.43(transitive)
- Removed@babel/highlight@7.0.0-beta.43(transitive)
- Removed@babel/template@7.0.0-beta.43(transitive)
- Removed@babel/traverse@7.0.0-beta.43(transitive)
- Removed@babel/types@7.0.0-beta.43(transitive)
- Removedbabylon@7.0.0-beta.43(transitive)
Updated@babel/helpers@7.0.0-beta.44
Updated@babel/types@7.0.0-beta.44
Updatedbabylon@7.0.0-beta.44