@babel/core
Advanced tools
Comparing version 7.0.0-beta.5 to 7.0.0-beta.31
@@ -14,2 +14,4 @@ "use strict"; | ||
var _options = require("./options"); | ||
var _files = require("./loading/files"); | ||
@@ -21,3 +23,3 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -27,6 +29,2 @@ var debug = (0, _debug.default)("babel:config:config-chain"); | ||
function buildConfigChain(opts) { | ||
if (typeof opts.filename !== "string" && opts.filename != null) { | ||
throw new Error(".filename must be a string, null, or undefined"); | ||
} | ||
var filename = opts.filename ? _path.default.resolve(opts.filename) : null; | ||
@@ -54,8 +52,5 @@ var builder = new ConfigChainBuilder(filename ? new LoadedFile(filename) : null); | ||
function ConfigChainBuilder(file) { | ||
Object.defineProperty(this, "configs", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: [] | ||
}); | ||
this.file = void 0; | ||
this.configs = []; | ||
this.seenFiles = new Set(); | ||
this.file = file; | ||
@@ -77,5 +72,12 @@ } | ||
flattenFileOptionsParts(file)(envKey).forEach(function (part) { | ||
if (this.seenFiles.has(file)) { | ||
throw new Error("Cycle detected in Babel configuration file through \"" + file.filepath + "\"."); | ||
} | ||
var parts = flattenFileOptionsParts(file)(envKey); | ||
this.seenFiles.add(file); | ||
parts.forEach(function (part) { | ||
return _this2._processConfigPart(part, envKey); | ||
}); | ||
this.seenFiles.delete(file); | ||
}; | ||
@@ -96,10 +98,3 @@ | ||
} else { | ||
var extendsConfig = (0, _files.loadConfig)(part.path, part.dirname); | ||
var existingConfig = this.configs.some(function (config) { | ||
return config.alias === extendsConfig.filepath; | ||
}); | ||
if (!existingConfig) { | ||
this.mergeConfigFile(extendsConfig, envKey); | ||
} | ||
this.mergeConfigFile((0, _files.loadConfig)(part.path, part.dirname), envKey); | ||
} | ||
@@ -112,7 +107,10 @@ }; | ||
function flattenArgumentsOptionsParts(opts, dirname, envKey) { | ||
var env = opts.env, | ||
plugins = opts.plugins, | ||
presets = opts.presets, | ||
passPerPreset = opts.passPerPreset, | ||
extendsPath = opts.extends, | ||
options = _objectWithoutProperties(opts, ["env", "plugins", "presets", "passPerPreset", "extends"]); | ||
var raw = []; | ||
var env = _typeof(opts.env) === "object" ? opts.env : null; | ||
var plugins = Array.isArray(opts.plugins) ? opts.plugins : null; | ||
var presets = Array.isArray(opts.presets) ? opts.presets : null; | ||
var passPerPreset = typeof opts.passPerPreset === "boolean" ? opts.passPerPreset : false; | ||
@@ -123,22 +121,6 @@ if (env) { | ||
var innerOpts = Object.assign({}, opts); | ||
if (env) delete innerOpts.env; | ||
if (plugins) delete innerOpts.plugins; | ||
if (presets) { | ||
delete innerOpts.presets; | ||
delete innerOpts.passPerPreset; | ||
if (Object.keys(options).length > 0) { | ||
raw.push.apply(raw, flattenOptionsParts(buildArgumentsItem(options, dirname))); | ||
} | ||
delete innerOpts.extends; | ||
if (Object.keys(innerOpts).length > 0) { | ||
raw.push.apply(raw, flattenOptionsParts({ | ||
type: "arguments", | ||
options: innerOpts, | ||
alias: "base", | ||
dirname: dirname | ||
})); | ||
} | ||
if (plugins) { | ||
@@ -149,8 +131,8 @@ raw.push.apply(raw, flattenArgumentsPluginsOptionsParts(plugins)(dirname)); | ||
if (presets) { | ||
raw.push.apply(raw, flattenArgumentsPresetsOptionsParts(presets)(passPerPreset)(dirname)); | ||
raw.push.apply(raw, flattenArgumentsPresetsOptionsParts(presets)(!!passPerPreset)(dirname)); | ||
} | ||
if (opts.extends != null) { | ||
raw.push.apply(raw, flattenOptionsParts(buildArgumentsRawConfig({ | ||
extends: opts.extends | ||
if (extendsPath != null) { | ||
raw.push.apply(raw, flattenOptionsParts(buildArgumentsItem({ | ||
extends: extendsPath | ||
}, dirname))); | ||
@@ -167,3 +149,3 @@ } | ||
return (0, _caching.makeStrongCache)(function (dirname) { | ||
return flattenOptionsPartsLookup(buildArgumentsRawConfig(options, dirname)); | ||
return flattenOptionsPartsLookup(buildArgumentsItem(options, dirname)); | ||
}); | ||
@@ -176,3 +158,3 @@ }); | ||
return (0, _caching.makeStrongCache)(function (dirname) { | ||
return flattenOptionsParts(buildArgumentsRawConfig(options, dirname)); | ||
return flattenOptionsParts(buildArgumentsItem(options, dirname)); | ||
}); | ||
@@ -187,3 +169,3 @@ }); | ||
return (0, _caching.makeStrongCache)(function (dirname) { | ||
return flattenOptionsParts(buildArgumentsRawConfig(options, dirname)); | ||
return flattenOptionsParts(buildArgumentsItem(options, dirname)); | ||
}); | ||
@@ -193,3 +175,3 @@ }); | ||
function buildArgumentsRawConfig(options, dirname) { | ||
function buildArgumentsItem(options, dirname) { | ||
return { | ||
@@ -205,4 +187,4 @@ type: "arguments", | ||
return flattenOptionsPartsLookup({ | ||
type: "options", | ||
options: file.options, | ||
type: "file", | ||
options: (0, _options.validate)("file", file.options), | ||
alias: file.filepath, | ||
@@ -255,3 +237,3 @@ dirname: file.dirname | ||
function flattenOptionsParts(rawConfig, activeEnv) { | ||
function flattenOptionsParts(config, activeEnv) { | ||
if (activeEnv === void 0) { | ||
@@ -261,58 +243,29 @@ activeEnv = null; | ||
var type = rawConfig.type, | ||
rawOpts = rawConfig.options, | ||
alias = rawConfig.alias, | ||
dirname = rawConfig.dirname; | ||
if (rawOpts.ignore != null && !Array.isArray(rawOpts.ignore)) { | ||
throw new Error(".ignore should be an array, " + JSON.stringify(rawOpts.ignore) + " given"); | ||
} | ||
if (rawOpts.only != null && !Array.isArray(rawOpts.only)) { | ||
throw new Error(".only should be an array, " + JSON.stringify(rawOpts.only) + " given"); | ||
} | ||
var ignore = rawOpts.ignore || null; | ||
var only = rawOpts.only || null; | ||
var rawOpts = config.options, | ||
alias = config.alias, | ||
dirname = config.dirname; | ||
var parts = []; | ||
if (rawOpts.env != null && (_typeof(rawOpts.env) !== "object" || Array.isArray(rawOpts.env))) { | ||
throw new Error(".env block must be an object, null, or undefined"); | ||
} | ||
if (rawOpts.env) { | ||
var _arr = Object.keys(rawOpts.env); | ||
var rawEnv = rawOpts.env || {}; | ||
Object.keys(rawEnv).forEach(function (envKey) { | ||
var envOpts = rawEnv[envKey]; | ||
for (var _i2 = 0; _i2 < _arr.length; _i2++) { | ||
var envKey = _arr[_i2]; | ||
if (envOpts !== undefined && activeEnv !== null && activeEnv !== envKey) { | ||
throw new Error("Unreachable .env[" + envKey + "] block detected"); | ||
if (rawOpts.env[envKey]) { | ||
parts.push.apply(parts, flattenOptionsParts({ | ||
type: "env", | ||
options: rawOpts.env[envKey], | ||
alias: alias + (".env." + envKey), | ||
dirname: dirname | ||
}, envKey)); | ||
} | ||
} | ||
} | ||
if (envOpts != null && (_typeof(envOpts) !== "object" || Array.isArray(envOpts))) { | ||
throw new Error(".env[...] block must be an object, null, or undefined"); | ||
} | ||
if (envOpts) { | ||
parts.push.apply(parts, flattenOptionsParts({ | ||
type: type, | ||
options: envOpts, | ||
alias: alias + (".env." + envKey), | ||
dirname: dirname | ||
}, envKey)); | ||
} | ||
}); | ||
var options = Object.assign({}, rawOpts); | ||
delete options.env; | ||
delete options.extends; | ||
parts.push({ | ||
part: "config", | ||
config: { | ||
type: type, | ||
options: options, | ||
alias: alias, | ||
loc: alias, | ||
dirname: dirname | ||
}, | ||
ignore: ignore, | ||
only: only, | ||
config: config, | ||
ignore: rawOpts.ignore, | ||
only: rawOpts.only, | ||
activeEnv: activeEnv | ||
@@ -322,6 +275,2 @@ }); | ||
if (rawOpts.extends != null) { | ||
if (typeof rawOpts.extends !== "string") { | ||
throw new Error(".extends must be a string"); | ||
} | ||
parts.push({ | ||
@@ -340,8 +289,4 @@ part: "extends", | ||
function LoadedFile(filename) { | ||
Object.defineProperty(this, "possibleDirs", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: null | ||
}); | ||
this.filename = void 0; | ||
this.possibleDirs = null; | ||
this.filename = filename; | ||
@@ -375,5 +320,3 @@ } | ||
patterns.forEach(function (pattern) { | ||
if (typeof pattern === "string") strings.push(pattern);else if (typeof pattern === "function") fns.push(pattern);else if (pattern instanceof RegExp) res.push(pattern);else { | ||
throw new Error("Patterns must be a string, function, or regular expression"); | ||
} | ||
if (typeof pattern === "string") strings.push(pattern);else if (typeof pattern === "function") fns.push(pattern);else res.push(pattern); | ||
}); | ||
@@ -380,0 +323,0 @@ var filename = this.filename; |
@@ -10,6 +10,4 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function loadConfig(opts) { | ||
if (opts != null && _typeof(opts) !== "object") { | ||
if (opts != null && (typeof opts !== "object" || Array.isArray(opts))) { | ||
throw new Error("Babel options must be an object, null, or undefined"); | ||
@@ -16,0 +14,0 @@ } |
@@ -23,4 +23,2 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var debug = (0, _debug.default)("babel:config:loading:files:configuration"); | ||
@@ -143,3 +141,3 @@ var BABELRC_FILENAME = ".babelrc"; | ||
if (!options || _typeof(options) !== "object" || Array.isArray(options)) { | ||
if (!options || typeof options !== "object" || Array.isArray(options)) { | ||
throw new Error(filepath + ": Configuration should be an exported JavaScript object."); | ||
@@ -177,4 +175,4 @@ } | ||
if (_typeof(options) !== "object") { | ||
throw new Error(filepath + ": Config returned typeof " + _typeof(options)); | ||
if (typeof options !== "object") { | ||
throw new Error(filepath + ": Config returned typeof " + typeof options); | ||
} | ||
@@ -181,0 +179,0 @@ |
@@ -14,4 +14,2 @@ "use strict"; | ||
var _removed = _interopRequireDefault(require("./removed")); | ||
var _buildConfigChain = _interopRequireDefault(require("./build-config-chain")); | ||
@@ -29,2 +27,4 @@ | ||
var _options = require("./options"); | ||
var _files = require("./loading/files"); | ||
@@ -36,5 +36,2 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var optionNames = new Set(["relative", "filename", "filenameRelative", "inputSourceMap", "env", "mode", "retainLines", "highlightCode", "suppressDeprecationMessages", "presets", "plugins", "ignore", "only", "code", "ast", "extends", "comments", "shouldPrintComment", "wrapPluginVisitorMethod", "compact", "minified", "sourceMaps", "sourceMapTarget", "sourceFileName", "sourceRoot", "babelrc", "sourceType", "auxiliaryCommentBefore", "auxiliaryCommentAfter", "getModuleId", "moduleRoot", "moduleIds", "moduleId", "passPerPreset", "parserOpts", "generatorOpts"]); | ||
var ALLOWED_PLUGIN_KEYS = new Set(["name", "manipulateOptions", "pre", "post", "visitor", "inherits"]); | ||
@@ -48,3 +45,5 @@ | ||
function OptionManager() { | ||
this.options = createInitialOptions(); | ||
this.options = void 0; | ||
this.passes = void 0; | ||
this.options = {}; | ||
this.passes = [[]]; | ||
@@ -65,7 +64,2 @@ } | ||
}); | ||
if (config.options.passPerPreset != null && typeof config.options.passPerPreset !== "boolean") { | ||
throw new Error(".passPerPreset must be a boolean or undefined"); | ||
} | ||
var passPerPreset = config.options.passPerPreset; | ||
@@ -98,7 +92,20 @@ pass = pass || this.passes[0]; | ||
(0, _merge.default)(this.options, result.options); | ||
var options = Object.assign({}, result.options); | ||
delete options.extends; | ||
delete options.env; | ||
delete options.plugins; | ||
delete options.presets; | ||
delete options.passPerPreset; | ||
if (options.sourceMap) { | ||
options.sourceMaps = options.sourceMap; | ||
delete options.sourceMap; | ||
} | ||
(0, _merge.default)(this.options, options); | ||
}; | ||
_proto.init = function init(opts) { | ||
var configChain = (0, _buildConfigChain.default)(opts); | ||
_proto.init = function init(inputOpts) { | ||
var args = (0, _options.validate)("arguments", inputOpts); | ||
var configChain = (0, _buildConfigChain.default)(args); | ||
if (!configChain) return null; | ||
@@ -124,4 +131,3 @@ | ||
if (!/^\[BABEL\]/.test(e.message)) { | ||
var filename = typeof opts.filename === "string" ? opts.filename : null; | ||
e.message = "[BABEL] " + (filename || "unknown") + ": " + e.message; | ||
e.message = "[BABEL] " + (args.filename || "unknown") + ": " + e.message; | ||
} | ||
@@ -132,3 +138,3 @@ | ||
opts = this.options; | ||
var opts = (0, _merge.default)(createInitialOptions(), this.options); | ||
opts.plugins = this.passes[0]; | ||
@@ -142,2 +148,3 @@ opts.presets = this.passes.slice(1).filter(function (plugins) { | ||
}); | ||
opts.passPerPreset = opts.presets.length > 0; | ||
@@ -183,39 +190,13 @@ if (opts.inputSourceMap) { | ||
var options = normalizeOptions(config); | ||
if (config.options.plugins != null && !Array.isArray(config.options.plugins)) { | ||
throw new Error(".plugins should be an array, null, or undefined"); | ||
} | ||
var plugins = (config.options.plugins || []).map(function (plugin, index) { | ||
var _normalizePair = normalizePair(plugin, _files.loadPlugin, config.dirname), | ||
filepath = _normalizePair.filepath, | ||
value = _normalizePair.value, | ||
options = _normalizePair.options; | ||
return { | ||
alias: filepath || config.loc + "$" + index, | ||
loc: filepath || config.loc, | ||
value: value, | ||
options: options, | ||
dirname: config.dirname | ||
}; | ||
return createDescriptor(plugin, _files.loadPlugin, config.dirname, { | ||
index: index, | ||
alias: config.alias | ||
}); | ||
}); | ||
if (config.options.presets != null && !Array.isArray(config.options.presets)) { | ||
throw new Error(".presets should be an array, null, or undefined"); | ||
} | ||
var presets = (config.options.presets || []).map(function (preset, index) { | ||
var _normalizePair2 = normalizePair(preset, _files.loadPreset, config.dirname), | ||
filepath = _normalizePair2.filepath, | ||
value = _normalizePair2.value, | ||
options = _normalizePair2.options; | ||
return { | ||
alias: filepath || config.loc + "$" + index, | ||
loc: filepath || config.loc, | ||
value: value, | ||
options: options, | ||
dirname: config.dirname | ||
}; | ||
return createDescriptor(preset, _files.loadPreset, config.dirname, { | ||
index: index, | ||
alias: config.alias | ||
}); | ||
}); | ||
@@ -233,4 +214,3 @@ return { | ||
dirname = _ref2.dirname, | ||
alias = _ref2.alias, | ||
loc = _ref2.loc; | ||
alias = _ref2.alias; | ||
var item = value; | ||
@@ -259,3 +239,3 @@ | ||
if (!item || _typeof(item) !== "object") { | ||
if (!item || typeof item !== "object") { | ||
throw new Error("Plugin/Preset did not return an object."); | ||
@@ -268,4 +248,3 @@ } | ||
dirname: dirname, | ||
alias: alias, | ||
loc: loc | ||
alias: alias | ||
}; | ||
@@ -290,4 +269,3 @@ }); | ||
dirname = _ref3.dirname, | ||
alias = _ref3.alias, | ||
loc = _ref3.loc; | ||
alias = _ref3.alias; | ||
Object.keys(pluginObj).forEach(function (key) { | ||
@@ -314,4 +292,3 @@ if (!ALLOWED_PLUGIN_KEYS.has(key)) { | ||
inheritsDescriptor = { | ||
alias: loc + "$inherits", | ||
loc: loc, | ||
alias: alias + "$inherits", | ||
value: plugin.inherits, | ||
@@ -340,9 +317,7 @@ options: options, | ||
dirname = _ref4.dirname, | ||
alias = _ref4.alias, | ||
loc = _ref4.loc; | ||
alias = _ref4.alias; | ||
return { | ||
type: "preset", | ||
options: value, | ||
options: (0, _options.validate)("preset", value), | ||
alias: alias, | ||
loc: loc, | ||
dirname: dirname | ||
@@ -353,63 +328,4 @@ }; | ||
function normalizeOptions(config) { | ||
var alias = config.alias || "foreign"; | ||
var type = config.type; | ||
if (_typeof(config.options) !== "object" || Array.isArray(config.options)) { | ||
throw new TypeError("Invalid options type for " + alias); | ||
} | ||
var options = Object.assign({}, config.options); | ||
if (type !== "arguments") { | ||
if (options.filename !== undefined) { | ||
throw new Error(alias + ".filename is only allowed as a root argument"); | ||
} | ||
if (options.babelrc !== undefined) { | ||
throw new Error(alias + ".babelrc is only allowed as a root argument"); | ||
} | ||
} | ||
if (type === "preset") { | ||
if (options.only !== undefined) { | ||
throw new Error(alias + ".only is not supported in a preset"); | ||
} | ||
if (options.ignore !== undefined) { | ||
throw new Error(alias + ".ignore is not supported in a preset"); | ||
} | ||
if (options.extends !== undefined) { | ||
throw new Error(alias + ".extends is not supported in a preset"); | ||
} | ||
if (options.env !== undefined) { | ||
throw new Error(alias + ".env is not supported in a preset"); | ||
} | ||
} | ||
if (options.sourceMap !== undefined) { | ||
if (options.sourceMaps !== undefined) { | ||
throw new Error("Both " + alias + ".sourceMap and .sourceMaps have been set"); | ||
} | ||
options.sourceMaps = options.sourceMap; | ||
delete options.sourceMap; | ||
} | ||
for (var key in options) { | ||
if (!optionNames.has(key)) { | ||
if (_removed.default[key]) { | ||
var _removed$key = _removed.default[key], | ||
message = _removed$key.message, | ||
_removed$key$version = _removed$key.version, | ||
version = _removed$key$version === void 0 ? 5 : _removed$key$version; | ||
throw new ReferenceError("Using removed Babel " + version + " option: " + alias + "." + key + " - " + message); | ||
} else { | ||
var unknownOptErr = "Unknown option: " + alias + "." + key + ". Check out http://babeljs.io/docs/usage/options/ for more information about options."; | ||
throw new ReferenceError(unknownOptErr); | ||
} | ||
} | ||
} | ||
if (options.parserOpts && typeof options.parserOpts.parser === "string") { | ||
@@ -425,19 +341,15 @@ options.parserOpts = Object.assign({}, options.parserOpts); | ||
delete options.passPerPreset; | ||
delete options.plugins; | ||
delete options.presets; | ||
return options; | ||
} | ||
function normalizePair(pair, resolver, dirname) { | ||
function createDescriptor(pair, resolver, dirname, _ref5) { | ||
var index = _ref5.index, | ||
alias = _ref5.alias; | ||
var options; | ||
var value = pair; | ||
if (Array.isArray(pair)) { | ||
if (pair.length > 2) { | ||
throw new Error("Unexpected extra options " + JSON.stringify(pair.slice(2)) + "."); | ||
} | ||
value = pair[0]; | ||
options = pair[1]; | ||
if (Array.isArray(value)) { | ||
var _value = value; | ||
value = _value[0]; | ||
options = _value[1]; | ||
} | ||
@@ -458,3 +370,3 @@ | ||
if (_typeof(value) === "object" && value.__esModule) { | ||
if (typeof value === "object" && value.__esModule) { | ||
if (value.default) { | ||
@@ -467,11 +379,11 @@ value = value.default; | ||
if (_typeof(value) !== "object" && typeof value !== "function") { | ||
throw new Error("Unsupported format: " + _typeof(value) + ". Expected an object or a function."); | ||
if (typeof value !== "object" && typeof value !== "function") { | ||
throw new Error("Unsupported format: " + typeof value + ". Expected an object or a function."); | ||
} | ||
if (filepath !== null && _typeof(value) === "object" && value) { | ||
if (filepath !== null && typeof value === "object" && value) { | ||
throw new Error("Plugin/Preset files are not allowed to export objects, only functions."); | ||
} | ||
if (options != null && _typeof(options) !== "object") { | ||
if (options != null && typeof options !== "object") { | ||
throw new Error("Plugin/Preset options must be an object, null, or undefined"); | ||
@@ -482,5 +394,6 @@ } | ||
return { | ||
filepath: filepath, | ||
alias: filepath || alias + "$" + index, | ||
value: value, | ||
options: options | ||
options: options, | ||
dirname: dirname | ||
}; | ||
@@ -498,14 +411,14 @@ } | ||
for (var _iterator2 = fns, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref5; | ||
var _ref6; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref5 = _iterator2[_i2++]; | ||
_ref6 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref5 = _i2.value; | ||
_ref6 = _i2.value; | ||
} | ||
var _fn = _ref5; | ||
var _fn = _ref6; | ||
@@ -512,0 +425,0 @@ _fn.apply(this, args); |
@@ -6,5 +6,10 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var Plugin = function Plugin(plugin, options, key) { | ||
this.key = void 0; | ||
this.manipulateOptions = void 0; | ||
this.post = void 0; | ||
this.pre = void 0; | ||
this.visitor = void 0; | ||
this.options = void 0; | ||
var Plugin = function Plugin(plugin, options, key) { | ||
if (plugin.name != null && typeof plugin.name !== "string") { | ||
@@ -26,3 +31,3 @@ throw new Error("Plugin .name must be a string, null, or undefined"); | ||
if (plugin.visitor != null && _typeof(plugin.visitor) !== "object") { | ||
if (plugin.visitor != null && typeof plugin.visitor !== "object") { | ||
throw new Error("Plugin .visitor must be an object, null, or undefined"); | ||
@@ -29,0 +34,0 @@ } |
@@ -33,56 +33,13 @@ "use strict"; | ||
inputMap = _ref.inputMap; | ||
Object.defineProperty(this, "_map", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: new Map() | ||
}); | ||
Object.defineProperty(this, "declarations", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: {} | ||
}); | ||
Object.defineProperty(this, "path", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: null | ||
}); | ||
Object.defineProperty(this, "ast", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: {} | ||
}); | ||
Object.defineProperty(this, "metadata", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: {} | ||
}); | ||
Object.defineProperty(this, "hub", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: new _traverse.Hub(this) | ||
}); | ||
Object.defineProperty(this, "code", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: "" | ||
}); | ||
Object.defineProperty(this, "shebang", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: "" | ||
}); | ||
Object.defineProperty(this, "inputMap", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: null | ||
}); | ||
this._map = new Map(); | ||
this.opts = void 0; | ||
this.declarations = {}; | ||
this.path = null; | ||
this.ast = {}; | ||
this.scope = void 0; | ||
this.metadata = {}; | ||
this.hub = new _traverse.Hub(this); | ||
this.code = ""; | ||
this.shebang = ""; | ||
this.inputMap = null; | ||
this.opts = options; | ||
@@ -89,0 +46,0 @@ this.code = code; |
@@ -14,4 +14,2 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var shebangRegex = /^#!.*/; | ||
@@ -29,3 +27,3 @@ | ||
code = _convertSourceMap.default.removeComments(code); | ||
} else if (_typeof(options.inputSourceMap) === "object") { | ||
} else if (typeof options.inputSourceMap === "object") { | ||
inputMap = _convertSourceMap.default.fromObject(options.inputSourceMap); | ||
@@ -32,0 +30,0 @@ } |
@@ -8,8 +8,6 @@ "use strict"; | ||
function PluginPass(file, key, options) { | ||
Object.defineProperty(this, "_map", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: new Map() | ||
}); | ||
this._map = new Map(); | ||
this.key = void 0; | ||
this.file = void 0; | ||
this.opts = void 0; | ||
this.key = key; | ||
@@ -16,0 +14,0 @@ this.file = file; |
{ | ||
"name": "@babel/core", | ||
"version": "7.0.0-beta.5", | ||
"version": "7.0.0-beta.31", | ||
"description": "Babel compiler core.", | ||
@@ -31,9 +31,9 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@babel/code-frame": "7.0.0-beta.5", | ||
"@babel/generator": "7.0.0-beta.5", | ||
"@babel/helpers": "7.0.0-beta.5", | ||
"@babel/template": "7.0.0-beta.5", | ||
"@babel/traverse": "7.0.0-beta.5", | ||
"@babel/types": "7.0.0-beta.5", | ||
"babylon": "7.0.0-beta.30", | ||
"@babel/code-frame": "7.0.0-beta.31", | ||
"@babel/generator": "7.0.0-beta.31", | ||
"@babel/helpers": "7.0.0-beta.31", | ||
"@babel/template": "7.0.0-beta.31", | ||
"@babel/traverse": "7.0.0-beta.31", | ||
"@babel/types": "7.0.0-beta.31", | ||
"babylon": "7.0.0-beta.31", | ||
"convert-source-map": "^1.1.0", | ||
@@ -48,5 +48,5 @@ "debug": "^3.0.1", | ||
"devDependencies": { | ||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.5", | ||
"@babel/register": "7.0.0-beta.5" | ||
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.31", | ||
"@babel/register": "7.0.0-beta.31" | ||
} | ||
} |
88684
30
2219
+ Added@babel/code-frame@7.0.0-beta.31(transitive)
+ Added@babel/generator@7.0.0-beta.31(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.31(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.31(transitive)
+ Added@babel/helpers@7.0.0-beta.31(transitive)
+ Added@babel/template@7.0.0-beta.31(transitive)
+ Added@babel/traverse@7.0.0-beta.31(transitive)
+ Added@babel/types@7.0.0-beta.31(transitive)
+ Addedbabylon@7.0.0-beta.31(transitive)
- Removed@babel/code-frame@7.0.0-beta.5(transitive)
- Removed@babel/generator@7.0.0-beta.5(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.5(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.5(transitive)
- Removed@babel/helpers@7.0.0-beta.5(transitive)
- Removed@babel/template@7.0.0-beta.5(transitive)
- Removed@babel/traverse@7.0.0-beta.5(transitive)
- Removed@babel/types@7.0.0-beta.5(transitive)
- Removedbabylon@7.0.0-beta.30(transitive)
Updated@babel/helpers@7.0.0-beta.31
Updated@babel/types@7.0.0-beta.31
Updatedbabylon@7.0.0-beta.31