From c10528254b21269df19831e677602b8733c6353a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 31 Mar 2017 15:34:39 -0400 Subject: [PATCH 01/14] create add-used-built-ins option --- experimental/babel-preset-env/README.md | 49 ++++ .../src/add-used-built-ins-plugin.js | 212 ++++++++++++++++++ .../src/built-in-definitions.js | 108 +++++++++ experimental/babel-preset-env/src/index.js | 12 +- .../babel-preset-env/src/normalize-options.js | 1 + .../builtins-used-native-support/actual.js | 26 +++ .../builtins-used-native-support/expected.js | 26 +++ .../builtins-used-native-support/options.json | 11 + .../builtins-used/actual.js | 24 ++ .../builtins-used/expected.js | 32 +++ .../builtins-used/options.json | 9 + .../no-builtins-used/actual.js | 1 + .../no-builtins-used/expected.js | 1 + .../no-builtins-used/options.json | 8 + .../actual.js | 1 + .../expected.js | 1 + .../options.json | 6 +- .../regenerator-used-async/actual.js | 1 + .../regenerator-used-async/expected.js | 20 ++ .../regenerator-used-async/options.json | 8 + .../actual.js | 1 + .../expected.js | 1 + .../options.json | 11 + .../regenerator-used-generator/actual.js | 1 + .../regenerator-used-generator/expected.js | 15 ++ .../regenerator-used-generator/options.json | 8 + .../test-modules-tranform/actual.js | 1 + .../test-modules-tranform/expected.js | 4 + .../test-modules-tranform/options.json | 7 + .../use-builtins-multiple-imports/actual.js | 3 - .../use-builtins-multiple-imports/expected.js | 7 - 31 files changed, 599 insertions(+), 17 deletions(-) create mode 100644 experimental/babel-preset-env/src/add-used-built-ins-plugin.js create mode 100644 experimental/babel-preset-env/src/built-in-definitions.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/expected.js rename experimental/babel-preset-env/test/fixtures/{preset-options/use-builtins-multiple-imports => preset-options-add-used-built-ins/regenerator-used-async-native-support}/options.json (75%) create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json delete mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/actual.js delete mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/expected.js diff --git a/experimental/babel-preset-env/README.md b/experimental/babel-preset-env/README.md index dff2eaeb2b..4aa0490e95 100644 --- a/experimental/babel-preset-env/README.md +++ b/experimental/babel-preset-env/README.md @@ -213,6 +213,55 @@ This will also work for `core-js` directly (`import "core-js";`) npm install core-js --save ``` +### `addUsedBuiltIns` + +`boolean`, defaults to `false`. + +Adds imports for polyfills when they are used in each file. You need to have core-js as a dependency (and regeneratorRuntime if necessary). + +> This option is different than `useBuiltIns` in that instead of only adding polyfills at the entry point, the plugin adds a specific import for each polyfill that is used in each file. We take advantage of the fact that the bundler will load the same polyfill only once. + +```sh +npm install core-js regenerator-runtime --save +``` + +**In** + +a.js + +```js +var a = new Promise(); +``` + +b.js + +```js +var b = new Map(); +``` + +**Out (if environment doesn't support it)** + +```js +import "core-js/modules/es6.promise"; +var a = new Promise(); +``` + +```js +import "core-js/modules/es6.map"; +var b = new Map(); +``` + +**Out (if environment supports it)** + +```js +var a = new Promise(); +``` + +```js +import "core-js/modules/es6.map"; +var b = new Map(); +``` + --- ## Examples diff --git a/experimental/babel-preset-env/src/add-used-built-ins-plugin.js b/experimental/babel-preset-env/src/add-used-built-ins-plugin.js new file mode 100644 index 0000000000..fa402dc730 --- /dev/null +++ b/experimental/babel-preset-env/src/add-used-built-ins-plugin.js @@ -0,0 +1,212 @@ +import { definitions } from "./built-in-definitions"; + +function isPolyfillSource(value) { + return value === "babel-polyfill" || value === "core-js"; +} + +function warnOnInstanceMethod(details) { + console.warn(`Adding a polyfill: An instance method may have been used: ${details}`); +} + +function getRuntimeModuleName(opts) { + return opts.moduleName || "babel-runtime"; +} + +function has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +function getObjectString(node) { + if (node.type === "Identifier") { + return node.name; + } else if (node.type === "MemberExpression") { + return `${getObjectString(node.object)}.${getObjectString(node.property)}`; + } else { + return ""; + } +} + +const HELPER_BLACKLIST = ["interopRequireWildcard", "interopRequireDefault"]; + +export default function ({ types: t }) { + function addImport(path, builtIn) { + if (builtIn) { + const importDec = t.importDeclaration([], + t.stringLiteral(builtIn) + ); + importDec._blockHoist = 3; + path.unshiftContainer("body", importDec); + } + } + + function isRequire(path) { + return t.isExpressionStatement(path.node) && + t.isCallExpression(path.node.expression) && + t.isIdentifier(path.node.expression.callee) && + path.node.expression.callee.name === "require" && + path.node.expression.arguments.length === 1 && + t.isStringLiteral(path.node.expression.arguments[0]) && + isPolyfillSource(path.node.expression.arguments[0].value); + } + + const addAndRemovePolyfillImports = { + ImportDeclaration(path, state) { + if (path.node.specifiers.length === 0 && isPolyfillSource(path.node.source.value)) { + state.opts.addUsedBuiltIns && console.warn(` +Adding "import 'babel-polyfill' (or 'core-js')" isn't necessary with the addUsedBuiltIns option anymore. +Please remove the call. +`); + path.remove(); + } + }, + Program: { + enter(path, state) { + if (!state.opts.polyfills) { + throw path.buildCodeFrameError(` +There was an issue in "babel-preset-env" such that +the "polyfills" option was not correctly passed +to the "transform-polyfill-require" plugin +`); + } + path.get("body").forEach((bodyPath) => { + if (isRequire(bodyPath)) { + state.opts.addUsedBuiltIns && console.warn(` +Adding "require('babel-polyfill') (or 'core-js')" isn't necessary with the addUsedBuiltIns option anymore. +Please remove the call. +`); + path.remove(); + } + }); + }, + // add polyfills + exit(path, state) { + for (const builtIn of Array.from(this.builtIns.keys()).reverse()) { + if (Array.isArray(builtIn)) { + for (const i of builtIn) { + console.warn(i); + if (state.opts.polyfills.indexOf(i) !== -1) { + addImport(path, `core-js/modules/${i}`); + } + } + } else { + console.warn(builtIn); + if (state.opts.polyfills.indexOf(builtIn) !== -1) { + addImport(path, `core-js/modules/${builtIn}`); + } + } + } + if (state.opts.regenerator && this.usesRegenerator) { + addImport(path, "regenerator-runtime/runtime"); + } + } + }, + + // Symbol() -> _core.Symbol(); + // new Promise -> new _core.Promise + ReferencedIdentifier(path) { + const { node, parent, scope } = path; + + if (t.isMemberExpression(parent)) return; + if (!has(definitions.builtins, node.name)) return; + if (scope.getBindingIdentifier(node.name)) return; + + this.builtIns.add(definitions.builtins[node.name]); + }, + + // Array.from -> _core.Array.from + MemberExpression: { + enter(path) { + if (!path.isReferenced()) return; + + const { node } = path; + const obj = node.object; + const prop = node.property; + + if (!t.isReferenced(obj, node)) return; + + // doesn't reference the global + if (path.scope.getBindingIdentifier(obj.name)) return; + + if (has(definitions.staticMethods, obj.name)) { + const staticMethods = definitions.staticMethods[obj.name]; + if (has(staticMethods, prop.name)) { + this.builtIns.add(`${staticMethods[prop.name]}`); + } + } + + if (!node.computed && t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name)) { + warnOnInstanceMethod(getObjectString(node)); + this.builtIns.add(definitions.instanceMethods[prop.name]); + } else if (node.computed && t.isStringLiteral(prop) && has(definitions.instanceMethods, prop.value)) { + warnOnInstanceMethod(`${obj.name}['${prop.value}']`); + this.builtIns.add(definitions.instanceMethods[prop.value]); + } + }, + + // Symbol.match + exit(path) { + if (!path.isReferenced()) return; + + const { node } = path; + const obj = node.object; + + if (!has(definitions.builtins, obj.name)) return; + if (path.scope.getBindingIdentifier(obj.name)) return; + + this.builtIns.add(definitions.builtins[obj.name]); + } + }, + + // var { repeat, startsWith } = String + VariableDeclarator(path) { + if (!path.isReferenced()) return; + + const { node } = path; + const obj = node.init; + + if (!t.isObjectPattern(node.id)) return; + const props = node.id.properties; + + if (!t.isReferenced(obj, node)) return; + + // doesn't reference the global + if (path.scope.getBindingIdentifier(obj.name)) return; + + for (let prop of props) { + prop = prop.key; + if (!node.computed && t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name)) { + warnOnInstanceMethod(`${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`); + + this.builtIns.add(definitions.instanceMethods[prop.name]); + } + } + }, + + Function(path) { + if (path.node.generator || path.node.async) { + this.usesRegenerator = true; + } + } + }; + + return { + name: "add-used-built-ins", + pre(file) { + const moduleName = getRuntimeModuleName(this.opts); + + if (this.opts.helpers !== false) { + const baseHelpersDir = this.opts.useBuiltIns ? "helpers/builtin" : "helpers"; + const helpersDir = this.opts.useESModules ? `${baseHelpersDir}/es6` : baseHelpersDir; + file.set("helperGenerator", function (name) { + if (HELPER_BLACKLIST.indexOf(name) < 0) { + return file.addImport(`${moduleName}/${helpersDir}/${name}`, "default", name); + } + }); + } + + this.builtIns = new Set(); + this.usesRegenerator = false; + }, + visitor: addAndRemovePolyfillImports, + }; +} diff --git a/experimental/babel-preset-env/src/built-in-definitions.js b/experimental/babel-preset-env/src/built-in-definitions.js new file mode 100644 index 0000000000..4c1ce04cf7 --- /dev/null +++ b/experimental/babel-preset-env/src/built-in-definitions.js @@ -0,0 +1,108 @@ +export const definitions = { + builtins: { + DataView: "es6.typed.data-view", + Int8Array: "es6.typed.int8-array", + Uint8Array: "es6.typed.uint8-array", + Uint8ClampedArray: "es6.typed.uint8-clamped-array", + Int16Array: "es6.typed.int16-array", + Uint16Array: "es6.typed.uint16-array", + Int32Array: "es6.typed.int32-array", + Uint32Array: "es6.typed.uint32-array", + Float32Array: "es6.typed.float32-array", + Float64Array: "es6.typed.float64-array", + Map: "es6.map", + Set: "es6.set", + WeakMap: "es6.weak-map", + WeakSet: "es6.weak-set", + Promise: "es6.promise", + Symbol: "es6.symbol", + }, + + instanceMethods: { + name: ["es6.function.name"], + fromCodePoint: ["es6.string.from-code-point"], + codePointAt: ["es6.string.code-point-at"], + repeat: ["es6.string.repeat"], + startsWith: ["es6.string.starts-with"], + endsWith: ["es6.string.ends-with"], + includes: ["es6.string.includes", "es7.array.includes"], + flags: ["es6.regexp.flags"], + match: ["es6.regexp.match"], + replace: ["es6.regexp.replace"], + split: ["es6.regexp.split"], + search: ["es6.regexp.search"], + copyWithin: ["es6.array.copy-within"], + find: ["es6.array.find"], + findIndex: ["es6.array.find-index"], + fill: ["es6.array.fill"], + padStart: ["es7.string.pad-start"], + padEnd: ["es7.string.pad-end"], + }, + + staticMethods: { + Array: { + from: "es6.array.from", + of: "es6.array.of", + }, + + Object: { + assign: "es6.object.assign", + is: "es6.object.is", + getOwnPropertySymbols: "es6.object.get-own-property-symbols", + setPrototypeOf: "es6.object.set-prototype-of", + values: "es7.object.values", + entries: "es7.object.entries", + getOwnPropertyDescriptors: "es7.object.get-own-property-descriptors", + }, + + Math: { + acosh: "es6.math.acosh", + asinh: "es6.math.asinh", + atanh: "es6.math.atanh", + cbrt: "es6.math.cbrt", + clz32: "es6.math.clz32", + cosh: "es6.math.cosh", + expm1: "es6.math.expm1", + fround: "es6.math.fround", + hypot: "es6.math.hypot", + imul: "es6.math.imul", + log1p: "es6.math.log1p", + log10: "es6.math.log10", + log2: "es6.math.log2", + sign: "es6.math.sign", + sinh: "es6.math.sinh", + tanh: "es6.math.tanh", + trunc: "es6.math.trunc", + }, + + String: { + raw: "es6.string.raw", + }, + + Number: { + isFinite: "es6.number.is-finite", + isInteger: "es6.number.is-integer", + isSafeInteger: "es6.number.is-safe-integer", + isNaN: "es6.number.is-nan", + EPSILON: "es6.number.epsilon", + MIN_SAFE_INTEGER: "es6.number.min-safe-integer", + MAX_SAFE_INTEGER: "es6.number.max-safe-integer", + }, + + Reflect: { + apply: "es6.reflect.apply", + construct: "es6.reflect.construct", + defineProperty: "es6.reflect.define-property", + deleteProperty: "es6.reflect.delete-property", + get: "es6.reflect.get", + getOwnPropertyDescriptor: "es6.reflect.get-own-property-descriptor", + getPrototypeOf: "es6.reflect.get-prototype-of", + has: "es6.reflect.has", + isExtensible: "es6.reflect.is-extensible", + ownKeys: "es6.reflect.own-keys", + preventExtensions: "es6.reflect.prevent-extensions", + set: "es6.reflect.set", + setPrototypeOf: "es6.reflect.set-prototype-of", + }, + }, +}; diff --git a/experimental/babel-preset-env/src/index.js b/experimental/babel-preset-env/src/index.js index b041494e88..0aa00360c7 100644 --- a/experimental/babel-preset-env/src/index.js +++ b/experimental/babel-preset-env/src/index.js @@ -6,6 +6,7 @@ import normalizeOptions from "./normalize-options.js"; import pluginList from "../data/plugins.json"; import transformPolyfillRequirePlugin from "./transform-polyfill-require-plugin"; +import addUsedBuiltInsPlugin from "./add-used-built-ins-plugin"; /** * Determine if a transformation is required @@ -177,7 +178,7 @@ function getPlatformSpecificDefaultFor(targets) { export default function buildPreset(context, opts = {}) { const validatedOptions = normalizeOptions(opts); - const { debug, loose, moduleType, useBuiltIns } = validatedOptions; + const { debug, loose, moduleType, useBuiltIns, addUsedBuiltIns } = validatedOptions; const targets = getTargets(validatedOptions.targets); const include = transformIncludesAndExcludes(validatedOptions.include); @@ -195,7 +196,7 @@ export default function buildPreset(context, opts = {}) { let polyfills; let polyfillTargets; - if (useBuiltIns) { + if (useBuiltIns || addUsedBuiltIns) { polyfillTargets = getBuiltInTargets(targets); const filterBuiltIns = filterItem.bind( null, @@ -219,7 +220,7 @@ export default function buildPreset(context, opts = {}) { transformations.forEach(transform => { logPlugin(transform, targets, pluginList); }); - if (useBuiltIns && polyfills.length) { + if ((useBuiltIns || addUsedBuiltIns) && polyfills.length) { console.log("\nUsing polyfills:"); polyfills.forEach(polyfill => { logPlugin(polyfill, polyfillTargets, builtInsList); @@ -242,8 +243,11 @@ export default function buildPreset(context, opts = {}) { ]), ); - useBuiltIns && + if (useBuiltIns) { plugins.push([transformPolyfillRequirePlugin, { polyfills, regenerator }]); + } else if (addUsedBuiltIns) { + plugins.push([addUsedBuiltInsPlugin, { polyfills, regenerator }]); + } return { plugins, diff --git a/experimental/babel-preset-env/src/normalize-options.js b/experimental/babel-preset-env/src/normalize-options.js index 6fb20bb763..5ed54f82f8 100644 --- a/experimental/babel-preset-env/src/normalize-options.js +++ b/experimental/babel-preset-env/src/normalize-options.js @@ -77,5 +77,6 @@ export default function normalizeOptions(opts) { moduleType: validateModulesOption(opts.modules), targets: opts.targets, useBuiltIns: opts.useBuiltIns, + addUsedBuiltIns: opts.addUsedBuiltIns, }; } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/actual.js new file mode 100644 index 0000000000..e434437b9e --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/actual.js @@ -0,0 +1,26 @@ +Array.from; // static method +Map; // built-in +new Promise(); // new builtin +Symbol.match; // as member expression +_arr[Symbol.iterator](); // Symbol.iterator + +// no import +Array.asdf; +Array2.from; +Map2; +new Promise2(); +Symbol.asdf; +Symbol2.match; +_arr9[Symbol2.iterator](); +_arr9[Symbol.iterator2](); + +G.assign; // static method +function H(WeakMap) { + var blah = new WeakMap(); +} // shadowed + +// not covered by this plugin +var asdf = 'copyWithin'; +i[asdf]; // computed with identifier +j[`copyWithin`]; // computed with template +var { [asdf]: _a } = k; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/expected.js new file mode 100644 index 0000000000..e434437b9e --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/expected.js @@ -0,0 +1,26 @@ +Array.from; // static method +Map; // built-in +new Promise(); // new builtin +Symbol.match; // as member expression +_arr[Symbol.iterator](); // Symbol.iterator + +// no import +Array.asdf; +Array2.from; +Map2; +new Promise2(); +Symbol.asdf; +Symbol2.match; +_arr9[Symbol2.iterator](); +_arr9[Symbol.iterator2](); + +G.assign; // static method +function H(WeakMap) { + var blah = new WeakMap(); +} // shadowed + +// not covered by this plugin +var asdf = 'copyWithin'; +i[asdf]; // computed with identifier +j[`copyWithin`]; // computed with template +var { [asdf]: _a } = k; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json new file mode 100644 index 0000000000..a32d3fe353 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json @@ -0,0 +1,11 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false, + "targets": { + "chrome": 58 + } + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js new file mode 100644 index 0000000000..45366a4fcb --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js @@ -0,0 +1,24 @@ +Array.from; // static method +Map; // built-in +new Promise(); // new builtin +Symbol.match; // as member expression +_arr[Symbol.iterator](); // Symbol.iterator + +// no import +Array.asdf; +Array2.from; +Map2; +new Promise2(); +Symbol.asdf; +Symbol2.match; +_arr9[Symbol2.iterator](); +_arr9[Symbol.iterator2](); + +G.assign; // static method +function H(WeakMap) { var blah = new WeakMap(); } // shadowed + +// not covered by this plugin +var asdf = 'copyWithin'; +i[asdf] // computed with identifier +j[`copyWithin`] // computed with template +var { [asdf]: _a } = k; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js new file mode 100644 index 0000000000..7ac06f1451 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js @@ -0,0 +1,32 @@ +import 'core-js/modules/es6.array.from'; +import 'core-js/modules/es6.map'; +import 'core-js/modules/es6.promise'; +import 'core-js/modules/es6.regexp.match'; +import 'core-js/modules/es6.symbol'; +Array.from; // static method +Map; // built-in +new Promise(); // new builtin +Symbol.match; // as member expression +_arr[Symbol.iterator](); // Symbol.iterator + +// no import +Array.asdf; +Array2.from; +Map2; +new Promise2(); +Symbol.asdf; +Symbol2.match; +_arr9[Symbol2.iterator](); +_arr9[Symbol.iterator2](); + +G.assign; // static method +function H(WeakMap) { + var blah = new WeakMap(); +} // shadowed + +// not covered by this plugin +var asdf = 'copyWithin'; +i[asdf]; // computed with identifier +j['copyWithin']; // computed with template +var _k = k, + _a = _k[asdf]; // computed \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json new file mode 100644 index 0000000000..bfdc4ffcca --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json @@ -0,0 +1,9 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false, + "debug": true + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/actual.js new file mode 100644 index 0000000000..f688910ec0 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/actual.js @@ -0,0 +1 @@ +var a = 1; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/expected.js new file mode 100644 index 0000000000..16a62bc21d --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/expected.js @@ -0,0 +1 @@ +var a = 1; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json new file mode 100644 index 0000000000..85bd6a927f --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json @@ -0,0 +1,8 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/actual.js new file mode 100644 index 0000000000..8f6724b27f --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/actual.js @@ -0,0 +1 @@ +async function a(){} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/expected.js new file mode 100644 index 0000000000..988bf3c6d1 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/expected.js @@ -0,0 +1 @@ +async function a() {} \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/options.json similarity index 75% rename from experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/options.json rename to experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/options.json index de09fa3f05..052559c60c 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/options.json @@ -1,11 +1,11 @@ { "presets": [ ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false, "targets": { "chrome": 55 - }, - "modules": false, - "useBuiltIns": true + } }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/actual.js new file mode 100644 index 0000000000..8f6724b27f --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/actual.js @@ -0,0 +1 @@ +async function a(){} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js new file mode 100644 index 0000000000..bfcc1da871 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js @@ -0,0 +1,20 @@ +import "regenerator-runtime/runtime"; +import _asyncToGenerator from "babel-runtime/helpers/asyncToGenerator"; + +var a = function () { + var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + return function a() { + return _ref.apply(this, arguments); + }; +}(); \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json new file mode 100644 index 0000000000..85bd6a927f --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json @@ -0,0 +1,8 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/actual.js new file mode 100644 index 0000000000..4df46943d2 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/actual.js @@ -0,0 +1 @@ +function* a() {} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/expected.js new file mode 100644 index 0000000000..835e1f47c7 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/expected.js @@ -0,0 +1 @@ +function* a() {} \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json new file mode 100644 index 0000000000..a44bb5b817 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json @@ -0,0 +1,11 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false, + "targets": { + "node": 6 + } + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/actual.js new file mode 100644 index 0000000000..74604e9198 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/actual.js @@ -0,0 +1 @@ +function* a(){} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js new file mode 100644 index 0000000000..5e04f20a36 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js @@ -0,0 +1,15 @@ +import "regenerator-runtime/runtime"; + +var _marked = [a].map(regeneratorRuntime.mark); + +function a() { + return regeneratorRuntime.wrap(function a$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + case "end": + return _context.stop(); + } + } + }, _marked[0], this); +} \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json new file mode 100644 index 0000000000..85bd6a927f --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json @@ -0,0 +1,8 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/actual.js new file mode 100644 index 0000000000..a2b81d72e3 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/actual.js @@ -0,0 +1 @@ +Promise; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js new file mode 100644 index 0000000000..ba3fdf06cf --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js @@ -0,0 +1,4 @@ +"use strict"; + +import "core-js/modules/es6.promise"; +Promise; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json new file mode 100644 index 0000000000..49f571fffc --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json @@ -0,0 +1,7 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/actual.js deleted file mode 100644 index 0ceedeffbd..0000000000 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/actual.js +++ /dev/null @@ -1,3 +0,0 @@ -import "babel-polyfill"; -import "babel-polyfill"; -1 ** 2; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/expected.js deleted file mode 100644 index 9e8a5ca09d..0000000000 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-multiple-imports/expected.js +++ /dev/null @@ -1,7 +0,0 @@ -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; - -1 ** 2; \ No newline at end of file From 7df557a269952c4698eef880791b95c8d721bcfc Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 31 Mar 2017 16:16:59 -0400 Subject: [PATCH 02/14] add instance method tests --- .../actual.js | 12 +++++++++ .../expected.js | 12 +++++++++ .../options.json | 11 ++++++++ .../builtins-used-instance-methods/actual.js | 12 +++++++++ .../expected.js | 26 +++++++++++++++++++ .../options.json | 8 ++++++ 6 files changed, 81 insertions(+) create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/actual.js new file mode 100644 index 0000000000..35cd0f9960 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/actual.js @@ -0,0 +1,12 @@ +Array.from; // static function +Map; // top level built-in + +// instance methods may have false positives (which is ok) +a.includes(); // method call +b['find'] // computed string? +c.prototype.findIndex(); // .prototype +d.fill.bind(); //.bind +e.padStart.apply(); // .apply +f.padEnd.call(); // .call +String.prototype.startsWith.call; // prototype.call +var { codePointAt, endsWith } = k; // destructuring diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/expected.js new file mode 100644 index 0000000000..dfd6871646 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/expected.js @@ -0,0 +1,12 @@ +Array.from; // static function +Map; // top level built-in + +// instance methods may have false positives (which is ok) +a.includes(); // method call +b['find']; // computed string? +c.prototype.findIndex(); // .prototype +d.fill.bind(); //.bind +e.padStart.apply(); // .apply +f.padEnd.call(); // .call +String.prototype.startsWith.call; // prototype.call +var { codePointAt, endsWith } = k; // destructuring diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json new file mode 100644 index 0000000000..a32d3fe353 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json @@ -0,0 +1,11 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false, + "targets": { + "chrome": 58 + } + }] + ] +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js new file mode 100644 index 0000000000..35cd0f9960 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js @@ -0,0 +1,12 @@ +Array.from; // static function +Map; // top level built-in + +// instance methods may have false positives (which is ok) +a.includes(); // method call +b['find'] // computed string? +c.prototype.findIndex(); // .prototype +d.fill.bind(); //.bind +e.padStart.apply(); // .apply +f.padEnd.call(); // .call +String.prototype.startsWith.call; // prototype.call +var { codePointAt, endsWith } = k; // destructuring diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js new file mode 100644 index 0000000000..277b6c4eb4 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js @@ -0,0 +1,26 @@ +import 'core-js/modules/es6.array.from'; +import 'core-js/modules/es6.map'; +import 'core-js/modules/es7.array.includes'; +import 'core-js/modules/es6.string.includes'; +import 'core-js/modules/es6.array.find'; +import 'core-js/modules/es6.array.find-index'; +import 'core-js/modules/es6.array.fill'; +import 'core-js/modules/es7.string.pad-start'; +import 'core-js/modules/es7.string.pad-end'; +import 'core-js/modules/es6.string.starts-with'; +import 'core-js/modules/es6.string.code-point-at'; +import 'core-js/modules/es6.string.ends-with'; +Array.from; // static function +Map; // top level built-in + +// instance methods may have false positives (which is ok) +a.includes(); // method call +b['find']; // computed string? +c.prototype.findIndex(); // .prototype +d.fill.bind(); //.bind +e.padStart.apply(); // .apply +f.padEnd.call(); // .call +String.prototype.startsWith.call; // prototype.call +var _k = k, + codePointAt = _k.codePointAt, + endsWith = _k.endsWith; // destructuring \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json new file mode 100644 index 0000000000..85bd6a927f --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json @@ -0,0 +1,8 @@ +{ + "presets": [ + ["../../../../lib", { + "addUsedBuiltIns": true, + "modules": false + }] + ] +} From f33bea1363dc05cccefd8aef686b27a9cb1d05a6 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 31 Mar 2017 16:35:01 -0400 Subject: [PATCH 03/14] remove unncessary check --- .../src/transform-polyfill-require-plugin.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js b/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js index 6ca42eb49c..66c42c6e03 100644 --- a/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js +++ b/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js @@ -50,16 +50,8 @@ export default function({ types: t }) { const isPolyfillImport = { ImportDeclaration(path, state) { - if ( - path.node.specifiers.length === 0 && - isPolyfillSource(path.node.source.value) - ) { - this.numPolyfillImports++; - if (this.numPolyfillImports > 1) { - path.remove(); - return; - } - + if (path.node.specifiers.length === 0 && + isPolyfillSource(path.node.source.value)) { path.replaceWithMultiple( createImports(state.opts.polyfills, "import", state.opts.regenerator), ); @@ -77,12 +69,6 @@ to the "transform-polyfill-require" plugin } path.get("body").forEach(bodyPath => { if (isRequire(bodyPath)) { - this.numPolyfillImports++; - if (this.numPolyfillImports > 1) { - path.remove(); - return; - } - bodyPath.replaceWithMultiple( createImports( state.opts.polyfills, From 016c9ad94cf84e21aafbbefb526a5557260eb30a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 4 Apr 2017 17:42:10 -0400 Subject: [PATCH 04/14] Breaking: account for https://github.com/babel/babel/pull/5584, only run on babel-polyfill not core-js return babel-polyfill require instead of core-js --- experimental/babel-preset-env/README.md | 73 +++----- .../src/add-used-built-ins-plugin.js | 87 ++++++--- .../src/transform-polyfill-require-plugin.js | 10 +- .../filters-duplicates/expected.js | 4 +- .../preset-options/core-js/expected.js | 6 +- .../preset-options/electron/expected.js | 18 +- .../exclude-built-ins/expected.js | 0 .../exclude-include/expected.js | 12 +- .../exclude-regenerator/expected.js | 172 ++++++++--------- .../ie-11-built-ins/expected.js | 170 ++++++++--------- .../include-built-ins/expected.js | 14 +- .../preset-options/ios-10/expected.js | 2 +- .../fixtures/preset-options/ios-6/expected.js | 87 +-------- .../preset-options/uglify/expected.js | 12 +- .../use-builtins-all/expected.js | 174 +++++++++--------- .../use-builtins-chrome-48/expected.js | 90 ++++----- .../use-builtins-chrome-49/expected.js | 62 +++---- .../use-builtins-ie-9/expected.js | 172 ++++++++--------- .../use-builtins-import/expected.js | 10 +- .../use-builtins-node-web/expected.js | 13 +- .../use-builtins-node/expected.js | 7 +- .../use-builtins-require/expected.js | 10 +- 22 files changed, 564 insertions(+), 641 deletions(-) delete mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/expected.js diff --git a/experimental/babel-preset-env/README.md b/experimental/babel-preset-env/README.md index 4aa0490e95..d7bfdd4856 100644 --- a/experimental/babel-preset-env/README.md +++ b/experimental/babel-preset-env/README.md @@ -18,8 +18,6 @@ npm install babel-preset-env --save-dev } ``` -Check out the many options (especially `useBuiltIns` to polyfill less)! - - [How it Works](#how-it-works) - [Install](#install) - [Usage](#usage) @@ -176,54 +174,17 @@ This option is useful for "blacklisting" a transform like `transform-regenerator ### `useBuiltIns` -`boolean`, defaults to `false`. +`boolean`, defaults to `true`. -A way to apply `babel-preset-env` for polyfills (via "babel-polyfill"). +A way to apply `babel-preset-env` for polyfills (via `babel-polyfill`). -> NOTE: This does not currently polyfill experimental/stage-x built-ins like the regular "babel-polyfill" does. -> This will only work with npm >= 3 (which should be used with Babel 6 anyway) - -``` +```sh npm install babel-polyfill --save ``` -This option enables a new plugin that replaces the statement `import "babel-polyfill"` or `require("babel-polyfill")` with individual requires for `babel-polyfill` based on environment. +#### `useBuiltIns: true` -> NOTE: Only use `require("babel-polyfill");` once in your whole app. One option is to create a single entry file that only contains the require statement. - -**In** - -```js -import "babel-polyfill"; -``` - -**Out (different based on environment)** - -```js -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; -``` - -This will also work for `core-js` directly (`import "core-js";`) - -``` -npm install core-js --save -``` - -### `addUsedBuiltIns` - -`boolean`, defaults to `false`. - -Adds imports for polyfills when they are used in each file. You need to have core-js as a dependency (and regeneratorRuntime if necessary). - -> This option is different than `useBuiltIns` in that instead of only adding polyfills at the entry point, the plugin adds a specific import for each polyfill that is used in each file. We take advantage of the fact that the bundler will load the same polyfill only once. - -```sh -npm install core-js regenerator-runtime --save -``` +Adds specific imports for polyfills when they are used in each file. We take advantage of the fact that a bundler will load the same polyfill only once. **In** @@ -242,12 +203,12 @@ var b = new Map(); **Out (if environment doesn't support it)** ```js -import "core-js/modules/es6.promise"; +import "babel-polyfill/core-js/modules/es6.promise"; var a = new Promise(); ``` ```js -import "core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.map"; var b = new Map(); ``` @@ -258,10 +219,28 @@ var a = new Promise(); ``` ```js -import "core-js/modules/es6.map"; var b = new Map(); ``` +#### `useBuiltIns: 'entry'` + +> NOTE: Only use `require("babel-polyfill");` once in your whole app. One option is to create a single entry file that only contains the require statement. + +This option enables a new plugin that replaces the statement `import "babel-polyfill"` or `require("babel-polyfill")` with individual requires for `babel-polyfill` based on environment. + +**In** + +```js +import "babel-polyfill"; +``` + +**Out (different based on environment)** + +```js +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +``` + --- ## Examples diff --git a/experimental/babel-preset-env/src/add-used-built-ins-plugin.js b/experimental/babel-preset-env/src/add-used-built-ins-plugin.js index fa402dc730..73d3b032ff 100644 --- a/experimental/babel-preset-env/src/add-used-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/add-used-built-ins-plugin.js @@ -1,11 +1,13 @@ import { definitions } from "./built-in-definitions"; function isPolyfillSource(value) { - return value === "babel-polyfill" || value === "core-js"; + return value === "babel-polyfill"; } function warnOnInstanceMethod(details) { - console.warn(`Adding a polyfill: An instance method may have been used: ${details}`); + console.warn( + `Adding a polyfill: An instance method may have been used: ${details}`, + ); } function getRuntimeModuleName(opts) { @@ -28,12 +30,10 @@ function getObjectString(node) { const HELPER_BLACKLIST = ["interopRequireWildcard", "interopRequireDefault"]; -export default function ({ types: t }) { +export default function({ types: t }) { function addImport(path, builtIn) { if (builtIn) { - const importDec = t.importDeclaration([], - t.stringLiteral(builtIn) - ); + const importDec = t.importDeclaration([], t.stringLiteral(builtIn)); importDec._blockHoist = 3; path.unshiftContainer("body", importDec); } @@ -51,29 +51,40 @@ export default function ({ types: t }) { const addAndRemovePolyfillImports = { ImportDeclaration(path, state) { - if (path.node.specifiers.length === 0 && isPolyfillSource(path.node.source.value)) { - state.opts.addUsedBuiltIns && console.warn(` -Adding "import 'babel-polyfill' (or 'core-js')" isn't necessary with the addUsedBuiltIns option anymore. + if ( + path.node.specifiers.length === 0 && + isPolyfillSource(path.node.source.value) + ) { + state.opts.addUsedBuiltIns && + console.warn( + ` +Adding "import 'babel-polyfill'" isn't necessary with the addUsedBuiltIns option anymore. Please remove the call. -`); +`, + ); path.remove(); } }, Program: { enter(path, state) { if (!state.opts.polyfills) { - throw path.buildCodeFrameError(` + throw path.buildCodeFrameError( + ` There was an issue in "babel-preset-env" such that the "polyfills" option was not correctly passed to the "transform-polyfill-require" plugin -`); +`, + ); } - path.get("body").forEach((bodyPath) => { + path.get("body").forEach(bodyPath => { if (isRequire(bodyPath)) { - state.opts.addUsedBuiltIns && console.warn(` -Adding "require('babel-polyfill') (or 'core-js')" isn't necessary with the addUsedBuiltIns option anymore. + state.opts.addUsedBuiltIns && + console.warn( + ` +Adding "require('babel-polyfill')" isn't necessary with the addUsedBuiltIns option anymore. Please remove the call. -`); +`, + ); path.remove(); } }); @@ -98,7 +109,7 @@ Please remove the call. if (state.opts.regenerator && this.usesRegenerator) { addImport(path, "regenerator-runtime/runtime"); } - } + }, }, // Symbol() -> _core.Symbol(); @@ -134,10 +145,18 @@ Please remove the call. } } - if (!node.computed && t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name)) { + if ( + !node.computed && + t.isIdentifier(prop) && + has(definitions.instanceMethods, prop.name) + ) { warnOnInstanceMethod(getObjectString(node)); this.builtIns.add(definitions.instanceMethods[prop.name]); - } else if (node.computed && t.isStringLiteral(prop) && has(definitions.instanceMethods, prop.value)) { + } else if ( + node.computed && + t.isStringLiteral(prop) && + has(definitions.instanceMethods, prop.value) + ) { warnOnInstanceMethod(`${obj.name}['${prop.value}']`); this.builtIns.add(definitions.instanceMethods[prop.value]); } @@ -154,7 +173,7 @@ Please remove the call. if (path.scope.getBindingIdentifier(obj.name)) return; this.builtIns.add(definitions.builtins[obj.name]); - } + }, }, // var { repeat, startsWith } = String @@ -174,8 +193,14 @@ Please remove the call. for (let prop of props) { prop = prop.key; - if (!node.computed && t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name)) { - warnOnInstanceMethod(`${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`); + if ( + !node.computed && + t.isIdentifier(prop) && + has(definitions.instanceMethods, prop.name) + ) { + warnOnInstanceMethod( + `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`, + ); this.builtIns.add(definitions.instanceMethods[prop.name]); } @@ -186,7 +211,7 @@ Please remove the call. if (path.node.generator || path.node.async) { this.usesRegenerator = true; } - } + }, }; return { @@ -195,11 +220,19 @@ Please remove the call. const moduleName = getRuntimeModuleName(this.opts); if (this.opts.helpers !== false) { - const baseHelpersDir = this.opts.useBuiltIns ? "helpers/builtin" : "helpers"; - const helpersDir = this.opts.useESModules ? `${baseHelpersDir}/es6` : baseHelpersDir; - file.set("helperGenerator", function (name) { + const baseHelpersDir = this.opts.useBuiltIns + ? "helpers/builtin" + : "helpers"; + const helpersDir = this.opts.useESModules + ? `${baseHelpersDir}/es6` + : baseHelpersDir; + file.set("helperGenerator", function(name) { if (HELPER_BLACKLIST.indexOf(name) < 0) { - return file.addImport(`${moduleName}/${helpersDir}/${name}`, "default", name); + return file.addImport( + `${moduleName}/${helpersDir}/${name}`, + "default", + name, + ); } }); } diff --git a/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js b/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js index 66c42c6e03..ab66d3779b 100644 --- a/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js +++ b/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js @@ -1,5 +1,5 @@ function isPolyfillSource(value) { - return value === "babel-polyfill" || value === "core-js"; + return value === "babel-polyfill"; } export default function({ types: t }) { @@ -27,7 +27,7 @@ export default function({ types: t }) { function createImport(polyfill, requireType, core) { if (core) { - polyfill = `core-js/modules/${polyfill}`; + polyfill = `babel-polyfill/core-js/modules/${polyfill}`; } if (requireType === "import") { @@ -50,8 +50,10 @@ export default function({ types: t }) { const isPolyfillImport = { ImportDeclaration(path, state) { - if (path.node.specifiers.length === 0 && - isPolyfillSource(path.node.source.value)) { + if ( + path.node.specifiers.length === 0 && + isPolyfillSource(path.node.source.value) + ) { path.replaceWithMultiple( createImports(state.opts.polyfills, "import", state.opts.regenerator), ); diff --git a/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/expected.js b/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/expected.js index 6a01cbb4c3..bc4d52081c 100644 --- a/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/expected.js +++ b/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/expected.js @@ -1,2 +1,2 @@ -import "core-js/modules/es6.typed.data-view"; -import "core-js/modules/es6.reflect.apply"; +import "babel-polyfill/core-js/modules/es6.typed.data-view"; +import "babel-polyfill/core-js/modules/es6.reflect.apply"; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js index 2f3d87c876..bd6332b8ba 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js @@ -1,5 +1 @@ -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; \ No newline at end of file +import "core-js"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/electron/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/electron/expected.js index 72f578621c..4513be1903 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/electron/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/electron/expected.js @@ -1,11 +1,11 @@ -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es7.object.values"; +import "babel-polyfill/core-js/modules/es7.object.entries"; +import "babel-polyfill/core-js/modules/es7.object.get-own-property-descriptors"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; -a ** b; +a ** b; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/expected.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/expected.js index 5d0fe180df..cde1f68df6 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/expected.js @@ -1,12 +1,12 @@ -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; -import "core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es6.map"; async function a() { await 1; } -(function () {}); +(function () {}); \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/expected.js index 0a6d1c0670..adb706c6c3 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/expected.js @@ -1,86 +1,86 @@ -import "core-js/modules/es6.typed.array-buffer"; -import "core-js/modules/es6.typed.data-view"; -import "core-js/modules/es6.typed.int8-array"; -import "core-js/modules/es6.typed.uint8-array"; -import "core-js/modules/es6.typed.uint8-clamped-array"; -import "core-js/modules/es6.typed.int16-array"; -import "core-js/modules/es6.typed.uint16-array"; -import "core-js/modules/es6.typed.int32-array"; -import "core-js/modules/es6.typed.uint32-array"; -import "core-js/modules/es6.typed.float32-array"; -import "core-js/modules/es6.typed.float64-array"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; -import "core-js/modules/es6.weak-map"; -import "core-js/modules/es6.weak-set"; -import "core-js/modules/es6.reflect.apply"; -import "core-js/modules/es6.reflect.construct"; -import "core-js/modules/es6.reflect.define-property"; -import "core-js/modules/es6.reflect.delete-property"; -import "core-js/modules/es6.reflect.get"; -import "core-js/modules/es6.reflect.get-own-property-descriptor"; -import "core-js/modules/es6.reflect.get-prototype-of"; -import "core-js/modules/es6.reflect.has"; -import "core-js/modules/es6.reflect.is-extensible"; -import "core-js/modules/es6.reflect.own-keys"; -import "core-js/modules/es6.reflect.prevent-extensions"; -import "core-js/modules/es6.reflect.set"; -import "core-js/modules/es6.reflect.set-prototype-of"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.symbol"; -import "core-js/modules/es6.object.assign"; -import "core-js/modules/es6.object.is"; -import "core-js/modules/es6.object.set-prototype-of"; -import "core-js/modules/es6.function.name"; -import "core-js/modules/es6.string.raw"; -import "core-js/modules/es6.string.from-code-point"; -import "core-js/modules/es6.string.code-point-at"; -import "core-js/modules/es6.string.repeat"; -import "core-js/modules/es6.string.starts-with"; -import "core-js/modules/es6.string.ends-with"; -import "core-js/modules/es6.string.includes"; -import "core-js/modules/es6.regexp.flags"; -import "core-js/modules/es6.regexp.match"; -import "core-js/modules/es6.regexp.replace"; -import "core-js/modules/es6.regexp.split"; -import "core-js/modules/es6.regexp.search"; -import "core-js/modules/es6.array.from"; -import "core-js/modules/es6.array.of"; -import "core-js/modules/es6.array.copy-within"; -import "core-js/modules/es6.array.find"; -import "core-js/modules/es6.array.find-index"; -import "core-js/modules/es6.array.fill"; -import "core-js/modules/es6.array.iterator"; -import "core-js/modules/es6.number.is-finite"; -import "core-js/modules/es6.number.is-integer"; -import "core-js/modules/es6.number.is-safe-integer"; -import "core-js/modules/es6.number.is-nan"; -import "core-js/modules/es6.number.epsilon"; -import "core-js/modules/es6.number.min-safe-integer"; -import "core-js/modules/es6.number.max-safe-integer"; -import "core-js/modules/es6.math.acosh"; -import "core-js/modules/es6.math.asinh"; -import "core-js/modules/es6.math.atanh"; -import "core-js/modules/es6.math.cbrt"; -import "core-js/modules/es6.math.clz32"; -import "core-js/modules/es6.math.cosh"; -import "core-js/modules/es6.math.expm1"; -import "core-js/modules/es6.math.fround"; -import "core-js/modules/es6.math.hypot"; -import "core-js/modules/es6.math.imul"; -import "core-js/modules/es6.math.log1p"; -import "core-js/modules/es6.math.log10"; -import "core-js/modules/es6.math.log2"; -import "core-js/modules/es6.math.sign"; -import "core-js/modules/es6.math.sinh"; -import "core-js/modules/es6.math.tanh"; -import "core-js/modules/es6.math.trunc"; -import "core-js/modules/es7.array.includes"; -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es6.typed.array-buffer"; +import "babel-polyfill/core-js/modules/es6.typed.data-view"; +import "babel-polyfill/core-js/modules/es6.typed.int8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-clamped-array"; +import "babel-polyfill/core-js/modules/es6.typed.int16-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint16-array"; +import "babel-polyfill/core-js/modules/es6.typed.int32-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float64-array"; +import "babel-polyfill/core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.set"; +import "babel-polyfill/core-js/modules/es6.weak-map"; +import "babel-polyfill/core-js/modules/es6.weak-set"; +import "babel-polyfill/core-js/modules/es6.reflect.apply"; +import "babel-polyfill/core-js/modules/es6.reflect.construct"; +import "babel-polyfill/core-js/modules/es6.reflect.define-property"; +import "babel-polyfill/core-js/modules/es6.reflect.delete-property"; +import "babel-polyfill/core-js/modules/es6.reflect.get"; +import "babel-polyfill/core-js/modules/es6.reflect.get-own-property-descriptor"; +import "babel-polyfill/core-js/modules/es6.reflect.get-prototype-of"; +import "babel-polyfill/core-js/modules/es6.reflect.has"; +import "babel-polyfill/core-js/modules/es6.reflect.is-extensible"; +import "babel-polyfill/core-js/modules/es6.reflect.own-keys"; +import "babel-polyfill/core-js/modules/es6.reflect.prevent-extensions"; +import "babel-polyfill/core-js/modules/es6.reflect.set"; +import "babel-polyfill/core-js/modules/es6.reflect.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.promise"; +import "babel-polyfill/core-js/modules/es6.symbol"; +import "babel-polyfill/core-js/modules/es6.object.assign"; +import "babel-polyfill/core-js/modules/es6.object.is"; +import "babel-polyfill/core-js/modules/es6.object.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.function.name"; +import "babel-polyfill/core-js/modules/es6.string.raw"; +import "babel-polyfill/core-js/modules/es6.string.from-code-point"; +import "babel-polyfill/core-js/modules/es6.string.code-point-at"; +import "babel-polyfill/core-js/modules/es6.string.repeat"; +import "babel-polyfill/core-js/modules/es6.string.starts-with"; +import "babel-polyfill/core-js/modules/es6.string.ends-with"; +import "babel-polyfill/core-js/modules/es6.string.includes"; +import "babel-polyfill/core-js/modules/es6.regexp.flags"; +import "babel-polyfill/core-js/modules/es6.regexp.match"; +import "babel-polyfill/core-js/modules/es6.regexp.replace"; +import "babel-polyfill/core-js/modules/es6.regexp.split"; +import "babel-polyfill/core-js/modules/es6.regexp.search"; +import "babel-polyfill/core-js/modules/es6.array.from"; +import "babel-polyfill/core-js/modules/es6.array.of"; +import "babel-polyfill/core-js/modules/es6.array.copy-within"; +import "babel-polyfill/core-js/modules/es6.array.find"; +import "babel-polyfill/core-js/modules/es6.array.find-index"; +import "babel-polyfill/core-js/modules/es6.array.fill"; +import "babel-polyfill/core-js/modules/es6.array.iterator"; +import "babel-polyfill/core-js/modules/es6.number.is-finite"; +import "babel-polyfill/core-js/modules/es6.number.is-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-nan"; +import "babel-polyfill/core-js/modules/es6.number.epsilon"; +import "babel-polyfill/core-js/modules/es6.number.min-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.max-safe-integer"; +import "babel-polyfill/core-js/modules/es6.math.acosh"; +import "babel-polyfill/core-js/modules/es6.math.asinh"; +import "babel-polyfill/core-js/modules/es6.math.atanh"; +import "babel-polyfill/core-js/modules/es6.math.cbrt"; +import "babel-polyfill/core-js/modules/es6.math.clz32"; +import "babel-polyfill/core-js/modules/es6.math.cosh"; +import "babel-polyfill/core-js/modules/es6.math.expm1"; +import "babel-polyfill/core-js/modules/es6.math.fround"; +import "babel-polyfill/core-js/modules/es6.math.hypot"; +import "babel-polyfill/core-js/modules/es6.math.imul"; +import "babel-polyfill/core-js/modules/es6.math.log1p"; +import "babel-polyfill/core-js/modules/es6.math.log10"; +import "babel-polyfill/core-js/modules/es6.math.log2"; +import "babel-polyfill/core-js/modules/es6.math.sign"; +import "babel-polyfill/core-js/modules/es6.math.sinh"; +import "babel-polyfill/core-js/modules/es6.math.tanh"; +import "babel-polyfill/core-js/modules/es6.math.trunc"; +import "babel-polyfill/core-js/modules/es7.array.includes"; +import "babel-polyfill/core-js/modules/es7.object.values"; +import "babel-polyfill/core-js/modules/es7.object.entries"; +import "babel-polyfill/core-js/modules/es7.object.get-own-property-descriptors"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js index 90d772a42e..c2982b3a4b 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js @@ -1,85 +1,85 @@ -import "core-js/modules/es6.typed.array-buffer"; -import "core-js/modules/es6.typed.int8-array"; -import "core-js/modules/es6.typed.uint8-array"; -import "core-js/modules/es6.typed.uint8-clamped-array"; -import "core-js/modules/es6.typed.int16-array"; -import "core-js/modules/es6.typed.uint16-array"; -import "core-js/modules/es6.typed.int32-array"; -import "core-js/modules/es6.typed.uint32-array"; -import "core-js/modules/es6.typed.float32-array"; -import "core-js/modules/es6.typed.float64-array"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; -import "core-js/modules/es6.weak-map"; -import "core-js/modules/es6.weak-set"; -import "core-js/modules/es6.reflect.apply"; -import "core-js/modules/es6.reflect.construct"; -import "core-js/modules/es6.reflect.define-property"; -import "core-js/modules/es6.reflect.delete-property"; -import "core-js/modules/es6.reflect.get"; -import "core-js/modules/es6.reflect.get-own-property-descriptor"; -import "core-js/modules/es6.reflect.get-prototype-of"; -import "core-js/modules/es6.reflect.has"; -import "core-js/modules/es6.reflect.is-extensible"; -import "core-js/modules/es6.reflect.own-keys"; -import "core-js/modules/es6.reflect.prevent-extensions"; -import "core-js/modules/es6.reflect.set"; -import "core-js/modules/es6.reflect.set-prototype-of"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.symbol"; -import "core-js/modules/es6.object.assign"; -import "core-js/modules/es6.object.is"; -import "core-js/modules/es6.function.name"; -import "core-js/modules/es6.string.raw"; -import "core-js/modules/es6.string.from-code-point"; -import "core-js/modules/es6.string.code-point-at"; -import "core-js/modules/es6.string.repeat"; -import "core-js/modules/es6.string.starts-with"; -import "core-js/modules/es6.string.ends-with"; -import "core-js/modules/es6.string.includes"; -import "core-js/modules/es6.regexp.flags"; -import "core-js/modules/es6.regexp.match"; -import "core-js/modules/es6.regexp.replace"; -import "core-js/modules/es6.regexp.split"; -import "core-js/modules/es6.regexp.search"; -import "core-js/modules/es6.array.from"; -import "core-js/modules/es6.array.of"; -import "core-js/modules/es6.array.copy-within"; -import "core-js/modules/es6.array.find"; -import "core-js/modules/es6.array.find-index"; -import "core-js/modules/es6.array.fill"; -import "core-js/modules/es6.array.iterator"; -import "core-js/modules/es6.number.is-finite"; -import "core-js/modules/es6.number.is-integer"; -import "core-js/modules/es6.number.is-safe-integer"; -import "core-js/modules/es6.number.is-nan"; -import "core-js/modules/es6.number.epsilon"; -import "core-js/modules/es6.number.min-safe-integer"; -import "core-js/modules/es6.number.max-safe-integer"; -import "core-js/modules/es6.math.acosh"; -import "core-js/modules/es6.math.asinh"; -import "core-js/modules/es6.math.atanh"; -import "core-js/modules/es6.math.cbrt"; -import "core-js/modules/es6.math.clz32"; -import "core-js/modules/es6.math.cosh"; -import "core-js/modules/es6.math.expm1"; -import "core-js/modules/es6.math.fround"; -import "core-js/modules/es6.math.hypot"; -import "core-js/modules/es6.math.imul"; -import "core-js/modules/es6.math.log1p"; -import "core-js/modules/es6.math.log10"; -import "core-js/modules/es6.math.log2"; -import "core-js/modules/es6.math.sign"; -import "core-js/modules/es6.math.sinh"; -import "core-js/modules/es6.math.tanh"; -import "core-js/modules/es6.math.trunc"; -import "core-js/modules/es7.array.includes"; -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; +import "babel-polyfill/core-js/modules/es6.typed.array-buffer"; +import "babel-polyfill/core-js/modules/es6.typed.int8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-clamped-array"; +import "babel-polyfill/core-js/modules/es6.typed.int16-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint16-array"; +import "babel-polyfill/core-js/modules/es6.typed.int32-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float64-array"; +import "babel-polyfill/core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.set"; +import "babel-polyfill/core-js/modules/es6.weak-map"; +import "babel-polyfill/core-js/modules/es6.weak-set"; +import "babel-polyfill/core-js/modules/es6.reflect.apply"; +import "babel-polyfill/core-js/modules/es6.reflect.construct"; +import "babel-polyfill/core-js/modules/es6.reflect.define-property"; +import "babel-polyfill/core-js/modules/es6.reflect.delete-property"; +import "babel-polyfill/core-js/modules/es6.reflect.get"; +import "babel-polyfill/core-js/modules/es6.reflect.get-own-property-descriptor"; +import "babel-polyfill/core-js/modules/es6.reflect.get-prototype-of"; +import "babel-polyfill/core-js/modules/es6.reflect.has"; +import "babel-polyfill/core-js/modules/es6.reflect.is-extensible"; +import "babel-polyfill/core-js/modules/es6.reflect.own-keys"; +import "babel-polyfill/core-js/modules/es6.reflect.prevent-extensions"; +import "babel-polyfill/core-js/modules/es6.reflect.set"; +import "babel-polyfill/core-js/modules/es6.reflect.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.promise"; +import "babel-polyfill/core-js/modules/es6.symbol"; +import "babel-polyfill/core-js/modules/es6.object.assign"; +import "babel-polyfill/core-js/modules/es6.object.is"; +import "babel-polyfill/core-js/modules/es6.function.name"; +import "babel-polyfill/core-js/modules/es6.string.raw"; +import "babel-polyfill/core-js/modules/es6.string.from-code-point"; +import "babel-polyfill/core-js/modules/es6.string.code-point-at"; +import "babel-polyfill/core-js/modules/es6.string.repeat"; +import "babel-polyfill/core-js/modules/es6.string.starts-with"; +import "babel-polyfill/core-js/modules/es6.string.ends-with"; +import "babel-polyfill/core-js/modules/es6.string.includes"; +import "babel-polyfill/core-js/modules/es6.regexp.flags"; +import "babel-polyfill/core-js/modules/es6.regexp.match"; +import "babel-polyfill/core-js/modules/es6.regexp.replace"; +import "babel-polyfill/core-js/modules/es6.regexp.split"; +import "babel-polyfill/core-js/modules/es6.regexp.search"; +import "babel-polyfill/core-js/modules/es6.array.from"; +import "babel-polyfill/core-js/modules/es6.array.of"; +import "babel-polyfill/core-js/modules/es6.array.copy-within"; +import "babel-polyfill/core-js/modules/es6.array.find"; +import "babel-polyfill/core-js/modules/es6.array.find-index"; +import "babel-polyfill/core-js/modules/es6.array.fill"; +import "babel-polyfill/core-js/modules/es6.array.iterator"; +import "babel-polyfill/core-js/modules/es6.number.is-finite"; +import "babel-polyfill/core-js/modules/es6.number.is-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-nan"; +import "babel-polyfill/core-js/modules/es6.number.epsilon"; +import "babel-polyfill/core-js/modules/es6.number.min-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.max-safe-integer"; +import "babel-polyfill/core-js/modules/es6.math.acosh"; +import "babel-polyfill/core-js/modules/es6.math.asinh"; +import "babel-polyfill/core-js/modules/es6.math.atanh"; +import "babel-polyfill/core-js/modules/es6.math.cbrt"; +import "babel-polyfill/core-js/modules/es6.math.clz32"; +import "babel-polyfill/core-js/modules/es6.math.cosh"; +import "babel-polyfill/core-js/modules/es6.math.expm1"; +import "babel-polyfill/core-js/modules/es6.math.fround"; +import "babel-polyfill/core-js/modules/es6.math.hypot"; +import "babel-polyfill/core-js/modules/es6.math.imul"; +import "babel-polyfill/core-js/modules/es6.math.log1p"; +import "babel-polyfill/core-js/modules/es6.math.log10"; +import "babel-polyfill/core-js/modules/es6.math.log2"; +import "babel-polyfill/core-js/modules/es6.math.sign"; +import "babel-polyfill/core-js/modules/es6.math.sinh"; +import "babel-polyfill/core-js/modules/es6.math.tanh"; +import "babel-polyfill/core-js/modules/es6.math.trunc"; +import "babel-polyfill/core-js/modules/es7.array.includes"; +import "babel-polyfill/core-js/modules/es7.object.values"; +import "babel-polyfill/core-js/modules/es7.object.entries"; +import "babel-polyfill/core-js/modules/es7.object.get-own-property-descriptors"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; +import "regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/expected.js index cfa4e9f3c4..605636ce61 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/expected.js @@ -1,7 +1,7 @@ -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.set"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/ios-10/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/ios-10/expected.js index 02d939c57f..b7ca4a8586 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/ios-10/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/ios-10/expected.js @@ -1 +1 @@ -const a = () => 1; +const a = () => 1; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/ios-6/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/ios-6/expected.js index 08cdf3a526..bd6332b8ba 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/ios-6/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/ios-6/expected.js @@ -1,86 +1 @@ -import "core-js/modules/es6.typed.array-buffer"; -import "core-js/modules/es6.typed.int8-array"; -import "core-js/modules/es6.typed.uint8-array"; -import "core-js/modules/es6.typed.uint8-clamped-array"; -import "core-js/modules/es6.typed.int16-array"; -import "core-js/modules/es6.typed.uint16-array"; -import "core-js/modules/es6.typed.int32-array"; -import "core-js/modules/es6.typed.uint32-array"; -import "core-js/modules/es6.typed.float32-array"; -import "core-js/modules/es6.typed.float64-array"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; -import "core-js/modules/es6.weak-map"; -import "core-js/modules/es6.weak-set"; -import "core-js/modules/es6.reflect.apply"; -import "core-js/modules/es6.reflect.construct"; -import "core-js/modules/es6.reflect.define-property"; -import "core-js/modules/es6.reflect.delete-property"; -import "core-js/modules/es6.reflect.get"; -import "core-js/modules/es6.reflect.get-own-property-descriptor"; -import "core-js/modules/es6.reflect.get-prototype-of"; -import "core-js/modules/es6.reflect.has"; -import "core-js/modules/es6.reflect.is-extensible"; -import "core-js/modules/es6.reflect.own-keys"; -import "core-js/modules/es6.reflect.prevent-extensions"; -import "core-js/modules/es6.reflect.set"; -import "core-js/modules/es6.reflect.set-prototype-of"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.symbol"; -import "core-js/modules/es6.object.assign"; -import "core-js/modules/es6.object.is"; -import "core-js/modules/es6.object.set-prototype-of"; -import "core-js/modules/es6.function.name"; -import "core-js/modules/es6.string.raw"; -import "core-js/modules/es6.string.from-code-point"; -import "core-js/modules/es6.string.code-point-at"; -import "core-js/modules/es6.string.repeat"; -import "core-js/modules/es6.string.starts-with"; -import "core-js/modules/es6.string.ends-with"; -import "core-js/modules/es6.string.includes"; -import "core-js/modules/es6.regexp.flags"; -import "core-js/modules/es6.regexp.match"; -import "core-js/modules/es6.regexp.replace"; -import "core-js/modules/es6.regexp.split"; -import "core-js/modules/es6.regexp.search"; -import "core-js/modules/es6.array.from"; -import "core-js/modules/es6.array.of"; -import "core-js/modules/es6.array.copy-within"; -import "core-js/modules/es6.array.find"; -import "core-js/modules/es6.array.find-index"; -import "core-js/modules/es6.array.fill"; -import "core-js/modules/es6.array.iterator"; -import "core-js/modules/es6.number.is-finite"; -import "core-js/modules/es6.number.is-integer"; -import "core-js/modules/es6.number.is-safe-integer"; -import "core-js/modules/es6.number.is-nan"; -import "core-js/modules/es6.number.epsilon"; -import "core-js/modules/es6.number.min-safe-integer"; -import "core-js/modules/es6.number.max-safe-integer"; -import "core-js/modules/es6.math.acosh"; -import "core-js/modules/es6.math.asinh"; -import "core-js/modules/es6.math.atanh"; -import "core-js/modules/es6.math.cbrt"; -import "core-js/modules/es6.math.clz32"; -import "core-js/modules/es6.math.cosh"; -import "core-js/modules/es6.math.expm1"; -import "core-js/modules/es6.math.fround"; -import "core-js/modules/es6.math.hypot"; -import "core-js/modules/es6.math.imul"; -import "core-js/modules/es6.math.log1p"; -import "core-js/modules/es6.math.log10"; -import "core-js/modules/es6.math.log2"; -import "core-js/modules/es6.math.sign"; -import "core-js/modules/es6.math.sinh"; -import "core-js/modules/es6.math.tanh"; -import "core-js/modules/es6.math.trunc"; -import "core-js/modules/es7.array.includes"; -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; +import "core-js"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js index 1b6f966662..1ae83df5b3 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js @@ -1,9 +1,9 @@ -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; import "regenerator-runtime/runtime"; -var a = 1; +var a = 1; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js index 66f8810cb2..77df9700ca 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js @@ -1,87 +1,87 @@ -import "core-js/modules/es6.typed.array-buffer"; -import "core-js/modules/es6.typed.data-view"; -import "core-js/modules/es6.typed.int8-array"; -import "core-js/modules/es6.typed.uint8-array"; -import "core-js/modules/es6.typed.uint8-clamped-array"; -import "core-js/modules/es6.typed.int16-array"; -import "core-js/modules/es6.typed.uint16-array"; -import "core-js/modules/es6.typed.int32-array"; -import "core-js/modules/es6.typed.uint32-array"; -import "core-js/modules/es6.typed.float32-array"; -import "core-js/modules/es6.typed.float64-array"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; -import "core-js/modules/es6.weak-map"; -import "core-js/modules/es6.weak-set"; -import "core-js/modules/es6.reflect.apply"; -import "core-js/modules/es6.reflect.construct"; -import "core-js/modules/es6.reflect.define-property"; -import "core-js/modules/es6.reflect.delete-property"; -import "core-js/modules/es6.reflect.get"; -import "core-js/modules/es6.reflect.get-own-property-descriptor"; -import "core-js/modules/es6.reflect.get-prototype-of"; -import "core-js/modules/es6.reflect.has"; -import "core-js/modules/es6.reflect.is-extensible"; -import "core-js/modules/es6.reflect.own-keys"; -import "core-js/modules/es6.reflect.prevent-extensions"; -import "core-js/modules/es6.reflect.set"; -import "core-js/modules/es6.reflect.set-prototype-of"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.symbol"; -import "core-js/modules/es6.object.assign"; -import "core-js/modules/es6.object.is"; -import "core-js/modules/es6.object.set-prototype-of"; -import "core-js/modules/es6.function.name"; -import "core-js/modules/es6.string.raw"; -import "core-js/modules/es6.string.from-code-point"; -import "core-js/modules/es6.string.code-point-at"; -import "core-js/modules/es6.string.repeat"; -import "core-js/modules/es6.string.starts-with"; -import "core-js/modules/es6.string.ends-with"; -import "core-js/modules/es6.string.includes"; -import "core-js/modules/es6.regexp.flags"; -import "core-js/modules/es6.regexp.match"; -import "core-js/modules/es6.regexp.replace"; -import "core-js/modules/es6.regexp.split"; -import "core-js/modules/es6.regexp.search"; -import "core-js/modules/es6.array.from"; -import "core-js/modules/es6.array.of"; -import "core-js/modules/es6.array.copy-within"; -import "core-js/modules/es6.array.find"; -import "core-js/modules/es6.array.find-index"; -import "core-js/modules/es6.array.fill"; -import "core-js/modules/es6.array.iterator"; -import "core-js/modules/es6.number.is-finite"; -import "core-js/modules/es6.number.is-integer"; -import "core-js/modules/es6.number.is-safe-integer"; -import "core-js/modules/es6.number.is-nan"; -import "core-js/modules/es6.number.epsilon"; -import "core-js/modules/es6.number.min-safe-integer"; -import "core-js/modules/es6.number.max-safe-integer"; -import "core-js/modules/es6.math.acosh"; -import "core-js/modules/es6.math.asinh"; -import "core-js/modules/es6.math.atanh"; -import "core-js/modules/es6.math.cbrt"; -import "core-js/modules/es6.math.clz32"; -import "core-js/modules/es6.math.cosh"; -import "core-js/modules/es6.math.expm1"; -import "core-js/modules/es6.math.fround"; -import "core-js/modules/es6.math.hypot"; -import "core-js/modules/es6.math.imul"; -import "core-js/modules/es6.math.log1p"; -import "core-js/modules/es6.math.log10"; -import "core-js/modules/es6.math.log2"; -import "core-js/modules/es6.math.sign"; -import "core-js/modules/es6.math.sinh"; -import "core-js/modules/es6.math.tanh"; -import "core-js/modules/es6.math.trunc"; -import "core-js/modules/es7.array.includes"; -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; +import "babel-polyfill/core-js/modules/es6.typed.array-buffer"; +import "babel-polyfill/core-js/modules/es6.typed.data-view"; +import "babel-polyfill/core-js/modules/es6.typed.int8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-clamped-array"; +import "babel-polyfill/core-js/modules/es6.typed.int16-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint16-array"; +import "babel-polyfill/core-js/modules/es6.typed.int32-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float64-array"; +import "babel-polyfill/core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.set"; +import "babel-polyfill/core-js/modules/es6.weak-map"; +import "babel-polyfill/core-js/modules/es6.weak-set"; +import "babel-polyfill/core-js/modules/es6.reflect.apply"; +import "babel-polyfill/core-js/modules/es6.reflect.construct"; +import "babel-polyfill/core-js/modules/es6.reflect.define-property"; +import "babel-polyfill/core-js/modules/es6.reflect.delete-property"; +import "babel-polyfill/core-js/modules/es6.reflect.get"; +import "babel-polyfill/core-js/modules/es6.reflect.get-own-property-descriptor"; +import "babel-polyfill/core-js/modules/es6.reflect.get-prototype-of"; +import "babel-polyfill/core-js/modules/es6.reflect.has"; +import "babel-polyfill/core-js/modules/es6.reflect.is-extensible"; +import "babel-polyfill/core-js/modules/es6.reflect.own-keys"; +import "babel-polyfill/core-js/modules/es6.reflect.prevent-extensions"; +import "babel-polyfill/core-js/modules/es6.reflect.set"; +import "babel-polyfill/core-js/modules/es6.reflect.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.promise"; +import "babel-polyfill/core-js/modules/es6.symbol"; +import "babel-polyfill/core-js/modules/es6.object.assign"; +import "babel-polyfill/core-js/modules/es6.object.is"; +import "babel-polyfill/core-js/modules/es6.object.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.function.name"; +import "babel-polyfill/core-js/modules/es6.string.raw"; +import "babel-polyfill/core-js/modules/es6.string.from-code-point"; +import "babel-polyfill/core-js/modules/es6.string.code-point-at"; +import "babel-polyfill/core-js/modules/es6.string.repeat"; +import "babel-polyfill/core-js/modules/es6.string.starts-with"; +import "babel-polyfill/core-js/modules/es6.string.ends-with"; +import "babel-polyfill/core-js/modules/es6.string.includes"; +import "babel-polyfill/core-js/modules/es6.regexp.flags"; +import "babel-polyfill/core-js/modules/es6.regexp.match"; +import "babel-polyfill/core-js/modules/es6.regexp.replace"; +import "babel-polyfill/core-js/modules/es6.regexp.split"; +import "babel-polyfill/core-js/modules/es6.regexp.search"; +import "babel-polyfill/core-js/modules/es6.array.from"; +import "babel-polyfill/core-js/modules/es6.array.of"; +import "babel-polyfill/core-js/modules/es6.array.copy-within"; +import "babel-polyfill/core-js/modules/es6.array.find"; +import "babel-polyfill/core-js/modules/es6.array.find-index"; +import "babel-polyfill/core-js/modules/es6.array.fill"; +import "babel-polyfill/core-js/modules/es6.array.iterator"; +import "babel-polyfill/core-js/modules/es6.number.is-finite"; +import "babel-polyfill/core-js/modules/es6.number.is-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-nan"; +import "babel-polyfill/core-js/modules/es6.number.epsilon"; +import "babel-polyfill/core-js/modules/es6.number.min-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.max-safe-integer"; +import "babel-polyfill/core-js/modules/es6.math.acosh"; +import "babel-polyfill/core-js/modules/es6.math.asinh"; +import "babel-polyfill/core-js/modules/es6.math.atanh"; +import "babel-polyfill/core-js/modules/es6.math.cbrt"; +import "babel-polyfill/core-js/modules/es6.math.clz32"; +import "babel-polyfill/core-js/modules/es6.math.cosh"; +import "babel-polyfill/core-js/modules/es6.math.expm1"; +import "babel-polyfill/core-js/modules/es6.math.fround"; +import "babel-polyfill/core-js/modules/es6.math.hypot"; +import "babel-polyfill/core-js/modules/es6.math.imul"; +import "babel-polyfill/core-js/modules/es6.math.log1p"; +import "babel-polyfill/core-js/modules/es6.math.log10"; +import "babel-polyfill/core-js/modules/es6.math.log2"; +import "babel-polyfill/core-js/modules/es6.math.sign"; +import "babel-polyfill/core-js/modules/es6.math.sinh"; +import "babel-polyfill/core-js/modules/es6.math.tanh"; +import "babel-polyfill/core-js/modules/es6.math.trunc"; +import "babel-polyfill/core-js/modules/es7.array.includes"; +import "babel-polyfill/core-js/modules/es7.object.values"; +import "babel-polyfill/core-js/modules/es7.object.entries"; +import "babel-polyfill/core-js/modules/es7.object.get-own-property-descriptors"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; +import "regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js index 3a73a58704..289e6057fb 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js @@ -1,47 +1,47 @@ -import "core-js/modules/es6.typed.array-buffer"; -import "core-js/modules/es6.typed.int8-array"; -import "core-js/modules/es6.typed.uint8-array"; -import "core-js/modules/es6.typed.uint8-clamped-array"; -import "core-js/modules/es6.typed.int16-array"; -import "core-js/modules/es6.typed.uint16-array"; -import "core-js/modules/es6.typed.int32-array"; -import "core-js/modules/es6.typed.uint32-array"; -import "core-js/modules/es6.typed.float32-array"; -import "core-js/modules/es6.typed.float64-array"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; -import "core-js/modules/es6.weak-map"; -import "core-js/modules/es6.weak-set"; -import "core-js/modules/es6.reflect.apply"; -import "core-js/modules/es6.reflect.construct"; -import "core-js/modules/es6.reflect.define-property"; -import "core-js/modules/es6.reflect.delete-property"; -import "core-js/modules/es6.reflect.get"; -import "core-js/modules/es6.reflect.get-own-property-descriptor"; -import "core-js/modules/es6.reflect.get-prototype-of"; -import "core-js/modules/es6.reflect.has"; -import "core-js/modules/es6.reflect.is-extensible"; -import "core-js/modules/es6.reflect.own-keys"; -import "core-js/modules/es6.reflect.prevent-extensions"; -import "core-js/modules/es6.reflect.set"; -import "core-js/modules/es6.reflect.set-prototype-of"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.symbol"; -import "core-js/modules/es6.function.name"; -import "core-js/modules/es6.regexp.flags"; -import "core-js/modules/es6.regexp.match"; -import "core-js/modules/es6.regexp.replace"; -import "core-js/modules/es6.regexp.split"; -import "core-js/modules/es6.regexp.search"; -import "core-js/modules/es6.array.from"; -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es6.typed.array-buffer"; +import "babel-polyfill/core-js/modules/es6.typed.int8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-clamped-array"; +import "babel-polyfill/core-js/modules/es6.typed.int16-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint16-array"; +import "babel-polyfill/core-js/modules/es6.typed.int32-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float64-array"; +import "babel-polyfill/core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.set"; +import "babel-polyfill/core-js/modules/es6.weak-map"; +import "babel-polyfill/core-js/modules/es6.weak-set"; +import "babel-polyfill/core-js/modules/es6.reflect.apply"; +import "babel-polyfill/core-js/modules/es6.reflect.construct"; +import "babel-polyfill/core-js/modules/es6.reflect.define-property"; +import "babel-polyfill/core-js/modules/es6.reflect.delete-property"; +import "babel-polyfill/core-js/modules/es6.reflect.get"; +import "babel-polyfill/core-js/modules/es6.reflect.get-own-property-descriptor"; +import "babel-polyfill/core-js/modules/es6.reflect.get-prototype-of"; +import "babel-polyfill/core-js/modules/es6.reflect.has"; +import "babel-polyfill/core-js/modules/es6.reflect.is-extensible"; +import "babel-polyfill/core-js/modules/es6.reflect.own-keys"; +import "babel-polyfill/core-js/modules/es6.reflect.prevent-extensions"; +import "babel-polyfill/core-js/modules/es6.reflect.set"; +import "babel-polyfill/core-js/modules/es6.reflect.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.promise"; +import "babel-polyfill/core-js/modules/es6.symbol"; +import "babel-polyfill/core-js/modules/es6.function.name"; +import "babel-polyfill/core-js/modules/es6.regexp.flags"; +import "babel-polyfill/core-js/modules/es6.regexp.match"; +import "babel-polyfill/core-js/modules/es6.regexp.replace"; +import "babel-polyfill/core-js/modules/es6.regexp.split"; +import "babel-polyfill/core-js/modules/es6.regexp.search"; +import "babel-polyfill/core-js/modules/es6.array.from"; +import "babel-polyfill/core-js/modules/es7.object.values"; +import "babel-polyfill/core-js/modules/es7.object.entries"; +import "babel-polyfill/core-js/modules/es7.object.get-own-property-descriptors"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; import "regenerator-runtime/runtime"; -Math.pow(1, 2); +Math.pow(1, 2); \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js index d4efb4056f..feb308c936 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js @@ -1,33 +1,33 @@ -import "core-js/modules/es6.typed.array-buffer"; -import "core-js/modules/es6.typed.int8-array"; -import "core-js/modules/es6.typed.uint8-array"; -import "core-js/modules/es6.typed.uint8-clamped-array"; -import "core-js/modules/es6.typed.int16-array"; -import "core-js/modules/es6.typed.uint16-array"; -import "core-js/modules/es6.typed.int32-array"; -import "core-js/modules/es6.typed.uint32-array"; -import "core-js/modules/es6.typed.float32-array"; -import "core-js/modules/es6.typed.float64-array"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; -import "core-js/modules/es6.weak-map"; -import "core-js/modules/es6.weak-set"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.symbol"; -import "core-js/modules/es6.function.name"; -import "core-js/modules/es6.regexp.match"; -import "core-js/modules/es6.regexp.replace"; -import "core-js/modules/es6.regexp.split"; -import "core-js/modules/es6.regexp.search"; -import "core-js/modules/es6.array.from"; -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es6.typed.array-buffer"; +import "babel-polyfill/core-js/modules/es6.typed.int8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-clamped-array"; +import "babel-polyfill/core-js/modules/es6.typed.int16-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint16-array"; +import "babel-polyfill/core-js/modules/es6.typed.int32-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float64-array"; +import "babel-polyfill/core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.set"; +import "babel-polyfill/core-js/modules/es6.weak-map"; +import "babel-polyfill/core-js/modules/es6.weak-set"; +import "babel-polyfill/core-js/modules/es6.promise"; +import "babel-polyfill/core-js/modules/es6.symbol"; +import "babel-polyfill/core-js/modules/es6.function.name"; +import "babel-polyfill/core-js/modules/es6.regexp.match"; +import "babel-polyfill/core-js/modules/es6.regexp.replace"; +import "babel-polyfill/core-js/modules/es6.regexp.split"; +import "babel-polyfill/core-js/modules/es6.regexp.search"; +import "babel-polyfill/core-js/modules/es6.array.from"; +import "babel-polyfill/core-js/modules/es7.object.values"; +import "babel-polyfill/core-js/modules/es7.object.entries"; +import "babel-polyfill/core-js/modules/es7.object.get-own-property-descriptors"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; import "regenerator-runtime/runtime"; -Math.pow(1, 2); +Math.pow(1, 2); \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js index abdda365ad..77df9700ca 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js @@ -1,87 +1,87 @@ -import "core-js/modules/es6.typed.array-buffer"; -import "core-js/modules/es6.typed.data-view"; -import "core-js/modules/es6.typed.int8-array"; -import "core-js/modules/es6.typed.uint8-array"; -import "core-js/modules/es6.typed.uint8-clamped-array"; -import "core-js/modules/es6.typed.int16-array"; -import "core-js/modules/es6.typed.uint16-array"; -import "core-js/modules/es6.typed.int32-array"; -import "core-js/modules/es6.typed.uint32-array"; -import "core-js/modules/es6.typed.float32-array"; -import "core-js/modules/es6.typed.float64-array"; -import "core-js/modules/es6.map"; -import "core-js/modules/es6.set"; -import "core-js/modules/es6.weak-map"; -import "core-js/modules/es6.weak-set"; -import "core-js/modules/es6.reflect.apply"; -import "core-js/modules/es6.reflect.construct"; -import "core-js/modules/es6.reflect.define-property"; -import "core-js/modules/es6.reflect.delete-property"; -import "core-js/modules/es6.reflect.get"; -import "core-js/modules/es6.reflect.get-own-property-descriptor"; -import "core-js/modules/es6.reflect.get-prototype-of"; -import "core-js/modules/es6.reflect.has"; -import "core-js/modules/es6.reflect.is-extensible"; -import "core-js/modules/es6.reflect.own-keys"; -import "core-js/modules/es6.reflect.prevent-extensions"; -import "core-js/modules/es6.reflect.set"; -import "core-js/modules/es6.reflect.set-prototype-of"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.symbol"; -import "core-js/modules/es6.object.assign"; -import "core-js/modules/es6.object.is"; -import "core-js/modules/es6.object.set-prototype-of"; -import "core-js/modules/es6.function.name"; -import "core-js/modules/es6.string.raw"; -import "core-js/modules/es6.string.from-code-point"; -import "core-js/modules/es6.string.code-point-at"; -import "core-js/modules/es6.string.repeat"; -import "core-js/modules/es6.string.starts-with"; -import "core-js/modules/es6.string.ends-with"; -import "core-js/modules/es6.string.includes"; -import "core-js/modules/es6.regexp.flags"; -import "core-js/modules/es6.regexp.match"; -import "core-js/modules/es6.regexp.replace"; -import "core-js/modules/es6.regexp.split"; -import "core-js/modules/es6.regexp.search"; -import "core-js/modules/es6.array.from"; -import "core-js/modules/es6.array.of"; -import "core-js/modules/es6.array.copy-within"; -import "core-js/modules/es6.array.find"; -import "core-js/modules/es6.array.find-index"; -import "core-js/modules/es6.array.fill"; -import "core-js/modules/es6.array.iterator"; -import "core-js/modules/es6.number.is-finite"; -import "core-js/modules/es6.number.is-integer"; -import "core-js/modules/es6.number.is-safe-integer"; -import "core-js/modules/es6.number.is-nan"; -import "core-js/modules/es6.number.epsilon"; -import "core-js/modules/es6.number.min-safe-integer"; -import "core-js/modules/es6.number.max-safe-integer"; -import "core-js/modules/es6.math.acosh"; -import "core-js/modules/es6.math.asinh"; -import "core-js/modules/es6.math.atanh"; -import "core-js/modules/es6.math.cbrt"; -import "core-js/modules/es6.math.clz32"; -import "core-js/modules/es6.math.cosh"; -import "core-js/modules/es6.math.expm1"; -import "core-js/modules/es6.math.fround"; -import "core-js/modules/es6.math.hypot"; -import "core-js/modules/es6.math.imul"; -import "core-js/modules/es6.math.log1p"; -import "core-js/modules/es6.math.log10"; -import "core-js/modules/es6.math.log2"; -import "core-js/modules/es6.math.sign"; -import "core-js/modules/es6.math.sinh"; -import "core-js/modules/es6.math.tanh"; -import "core-js/modules/es6.math.trunc"; -import "core-js/modules/es7.array.includes"; -import "core-js/modules/es7.object.values"; -import "core-js/modules/es7.object.entries"; -import "core-js/modules/es7.object.get-own-property-descriptors"; -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es6.typed.array-buffer"; +import "babel-polyfill/core-js/modules/es6.typed.data-view"; +import "babel-polyfill/core-js/modules/es6.typed.int8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint8-clamped-array"; +import "babel-polyfill/core-js/modules/es6.typed.int16-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint16-array"; +import "babel-polyfill/core-js/modules/es6.typed.int32-array"; +import "babel-polyfill/core-js/modules/es6.typed.uint32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float32-array"; +import "babel-polyfill/core-js/modules/es6.typed.float64-array"; +import "babel-polyfill/core-js/modules/es6.map"; +import "babel-polyfill/core-js/modules/es6.set"; +import "babel-polyfill/core-js/modules/es6.weak-map"; +import "babel-polyfill/core-js/modules/es6.weak-set"; +import "babel-polyfill/core-js/modules/es6.reflect.apply"; +import "babel-polyfill/core-js/modules/es6.reflect.construct"; +import "babel-polyfill/core-js/modules/es6.reflect.define-property"; +import "babel-polyfill/core-js/modules/es6.reflect.delete-property"; +import "babel-polyfill/core-js/modules/es6.reflect.get"; +import "babel-polyfill/core-js/modules/es6.reflect.get-own-property-descriptor"; +import "babel-polyfill/core-js/modules/es6.reflect.get-prototype-of"; +import "babel-polyfill/core-js/modules/es6.reflect.has"; +import "babel-polyfill/core-js/modules/es6.reflect.is-extensible"; +import "babel-polyfill/core-js/modules/es6.reflect.own-keys"; +import "babel-polyfill/core-js/modules/es6.reflect.prevent-extensions"; +import "babel-polyfill/core-js/modules/es6.reflect.set"; +import "babel-polyfill/core-js/modules/es6.reflect.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.promise"; +import "babel-polyfill/core-js/modules/es6.symbol"; +import "babel-polyfill/core-js/modules/es6.object.assign"; +import "babel-polyfill/core-js/modules/es6.object.is"; +import "babel-polyfill/core-js/modules/es6.object.set-prototype-of"; +import "babel-polyfill/core-js/modules/es6.function.name"; +import "babel-polyfill/core-js/modules/es6.string.raw"; +import "babel-polyfill/core-js/modules/es6.string.from-code-point"; +import "babel-polyfill/core-js/modules/es6.string.code-point-at"; +import "babel-polyfill/core-js/modules/es6.string.repeat"; +import "babel-polyfill/core-js/modules/es6.string.starts-with"; +import "babel-polyfill/core-js/modules/es6.string.ends-with"; +import "babel-polyfill/core-js/modules/es6.string.includes"; +import "babel-polyfill/core-js/modules/es6.regexp.flags"; +import "babel-polyfill/core-js/modules/es6.regexp.match"; +import "babel-polyfill/core-js/modules/es6.regexp.replace"; +import "babel-polyfill/core-js/modules/es6.regexp.split"; +import "babel-polyfill/core-js/modules/es6.regexp.search"; +import "babel-polyfill/core-js/modules/es6.array.from"; +import "babel-polyfill/core-js/modules/es6.array.of"; +import "babel-polyfill/core-js/modules/es6.array.copy-within"; +import "babel-polyfill/core-js/modules/es6.array.find"; +import "babel-polyfill/core-js/modules/es6.array.find-index"; +import "babel-polyfill/core-js/modules/es6.array.fill"; +import "babel-polyfill/core-js/modules/es6.array.iterator"; +import "babel-polyfill/core-js/modules/es6.number.is-finite"; +import "babel-polyfill/core-js/modules/es6.number.is-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.is-nan"; +import "babel-polyfill/core-js/modules/es6.number.epsilon"; +import "babel-polyfill/core-js/modules/es6.number.min-safe-integer"; +import "babel-polyfill/core-js/modules/es6.number.max-safe-integer"; +import "babel-polyfill/core-js/modules/es6.math.acosh"; +import "babel-polyfill/core-js/modules/es6.math.asinh"; +import "babel-polyfill/core-js/modules/es6.math.atanh"; +import "babel-polyfill/core-js/modules/es6.math.cbrt"; +import "babel-polyfill/core-js/modules/es6.math.clz32"; +import "babel-polyfill/core-js/modules/es6.math.cosh"; +import "babel-polyfill/core-js/modules/es6.math.expm1"; +import "babel-polyfill/core-js/modules/es6.math.fround"; +import "babel-polyfill/core-js/modules/es6.math.hypot"; +import "babel-polyfill/core-js/modules/es6.math.imul"; +import "babel-polyfill/core-js/modules/es6.math.log1p"; +import "babel-polyfill/core-js/modules/es6.math.log10"; +import "babel-polyfill/core-js/modules/es6.math.log2"; +import "babel-polyfill/core-js/modules/es6.math.sign"; +import "babel-polyfill/core-js/modules/es6.math.sinh"; +import "babel-polyfill/core-js/modules/es6.math.tanh"; +import "babel-polyfill/core-js/modules/es6.math.trunc"; +import "babel-polyfill/core-js/modules/es7.array.includes"; +import "babel-polyfill/core-js/modules/es7.object.values"; +import "babel-polyfill/core-js/modules/es7.object.entries"; +import "babel-polyfill/core-js/modules/es7.object.get-own-property-descriptors"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; import "regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/expected.js index 9e8a5ca09d..ea206645eb 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/expected.js @@ -1,7 +1,7 @@ -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; 1 ** 2; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js index 66f45200d6..d6437b66b7 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js @@ -1,7 +1,6 @@ -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "core-js/modules/web.timers"; -import "core-js/modules/web.immediate"; -import "core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; - +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "babel-polyfill/core-js/modules/web.timers"; +import "babel-polyfill/core-js/modules/web.immediate"; +import "babel-polyfill/core-js/modules/web.dom.iterable"; +import "regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js index 5f61c3daf8..bbb140cfcb 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js @@ -1,4 +1,3 @@ -import "core-js/modules/es7.string.pad-start"; -import "core-js/modules/es7.string.pad-end"; -import "regenerator-runtime/runtime"; - +import "babel-polyfill/core-js/modules/es7.string.pad-start"; +import "babel-polyfill/core-js/modules/es7.string.pad-end"; +import "regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/expected.js index 5b1e24da7e..fa607bb1dc 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/expected.js @@ -1,11 +1,11 @@ -require("core-js/modules/es7.string.pad-start"); +require("babel-polyfill/core-js/modules/es7.string.pad-start"); -require("core-js/modules/es7.string.pad-end"); +require("babel-polyfill/core-js/modules/es7.string.pad-end"); -require("core-js/modules/web.timers"); +require("babel-polyfill/core-js/modules/web.timers"); -require("core-js/modules/web.immediate"); +require("babel-polyfill/core-js/modules/web.immediate"); -require("core-js/modules/web.dom.iterable"); +require("babel-polyfill/core-js/modules/web.dom.iterable"); 1 ** 2; \ No newline at end of file From f1bf68364ce815e247b6e979198018c11344ec51 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 4 Apr 2017 18:17:07 -0400 Subject: [PATCH 05/14] useBuiltIns: true is now useBuiltIns: entry, and turn on useBuiltIns: true on default --- experimental/babel-preset-env/src/index.js | 17 +++++---- .../babel-preset-env/src/normalize-options.js | 3 +- ...lugin.js => use-built-ins-entry-plugin.js} | 3 +- ...-ins-plugin.js => use-built-ins-plugin.js} | 36 +++---------------- .../builtins-uglify/options.json | 2 +- .../test/debug-fixtures/builtins/options.json | 2 +- .../test/debug-fixtures/electron/options.json | 2 +- .../debug-fixtures/plugins-only/options.json | 3 +- .../specific-targets/options.json | 2 +- .../filters-duplicates/options.json | 2 +- .../regenerator-false/options.json | 2 +- .../regenerator-true/expected.js | 2 +- .../regenerator-true/options.json | 2 +- .../options.json | 2 +- .../options.json | 2 +- .../builtins-used-native-support/options.json | 2 +- .../builtins-used/options.json | 2 +- .../no-builtins-used/options.json | 2 +- .../options.json | 2 +- .../regenerator-used-async/expected.js | 8 +++-- .../regenerator-used-async/options.json | 2 +- .../options.json | 2 +- .../regenerator-used-generator/expected.js | 4 +-- .../regenerator-used-generator/options.json | 2 +- .../test-modules-tranform/options.json | 2 +- .../fixtures/preset-options/core-js/actual.js | 1 - .../preset-options/core-js/expected.js | 1 - .../preset-options/core-js/options.json | 11 ------ .../preset-options/electron/options.json | 2 +- .../exclude-include/options.json | 2 +- .../exclude-regenerator/options.json | 2 +- .../ie-11-built-ins/expected.js | 2 +- .../ie-11-built-ins/options.json | 2 +- .../include-built-ins/options.json | 2 +- .../preset-options/uglify/expected.js | 2 +- .../preset-options/uglify/options.json | 2 +- .../use-builtins-all/expected.js | 2 +- .../use-builtins-all/options.json | 2 +- .../use-builtins-chrome-48/expected.js | 2 +- .../use-builtins-chrome-48/options.json | 2 +- .../use-builtins-chrome-49/expected.js | 2 +- .../use-builtins-chrome-49/options.json | 2 +- .../use-builtins-ie-9/expected.js | 2 +- .../use-builtins-ie-9/options.json | 2 +- .../use-builtins-import/options.json | 2 +- .../use-builtins-node-web/expected.js | 2 +- .../use-builtins-node-web/options.json | 2 +- .../use-builtins-node/expected.js | 2 +- .../use-builtins-node/options.json | 2 +- .../use-builtins-require/options.json | 2 +- 50 files changed, 65 insertions(+), 102 deletions(-) rename experimental/babel-preset-env/src/{transform-polyfill-require-plugin.js => use-built-ins-entry-plugin.js} (96%) rename experimental/babel-preset-env/src/{add-used-built-ins-plugin.js => use-built-ins-plugin.js} (86%) delete mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/core-js/actual.js delete mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js delete mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/core-js/options.json diff --git a/experimental/babel-preset-env/src/index.js b/experimental/babel-preset-env/src/index.js index 0aa00360c7..ed4b7f8bc0 100644 --- a/experimental/babel-preset-env/src/index.js +++ b/experimental/babel-preset-env/src/index.js @@ -4,9 +4,8 @@ import { defaultWebIncludes } from "./default-includes"; import moduleTransformations from "./module-transformations"; import normalizeOptions from "./normalize-options.js"; import pluginList from "../data/plugins.json"; -import transformPolyfillRequirePlugin - from "./transform-polyfill-require-plugin"; -import addUsedBuiltInsPlugin from "./add-used-built-ins-plugin"; +import useBuiltInsEntryPlugin from "./use-built-ins-entry-plugin"; +import addUsedBuiltInsPlugin from "./use-built-ins-plugin"; /** * Determine if a transformation is required @@ -178,7 +177,7 @@ function getPlatformSpecificDefaultFor(targets) { export default function buildPreset(context, opts = {}) { const validatedOptions = normalizeOptions(opts); - const { debug, loose, moduleType, useBuiltIns, addUsedBuiltIns } = validatedOptions; + const { debug, loose, moduleType, useBuiltIns } = validatedOptions; const targets = getTargets(validatedOptions.targets); const include = transformIncludesAndExcludes(validatedOptions.include); @@ -196,7 +195,7 @@ export default function buildPreset(context, opts = {}) { let polyfills; let polyfillTargets; - if (useBuiltIns || addUsedBuiltIns) { + if (useBuiltIns) { polyfillTargets = getBuiltInTargets(targets); const filterBuiltIns = filterItem.bind( null, @@ -220,7 +219,7 @@ export default function buildPreset(context, opts = {}) { transformations.forEach(transform => { logPlugin(transform, targets, pluginList); }); - if ((useBuiltIns || addUsedBuiltIns) && polyfills.length) { + if (useBuiltIns && polyfills.length) { console.log("\nUsing polyfills:"); polyfills.forEach(polyfill => { logPlugin(polyfill, polyfillTargets, builtInsList); @@ -243,10 +242,10 @@ export default function buildPreset(context, opts = {}) { ]), ); - if (useBuiltIns) { - plugins.push([transformPolyfillRequirePlugin, { polyfills, regenerator }]); - } else if (addUsedBuiltIns) { + if (useBuiltIns === true) { plugins.push([addUsedBuiltInsPlugin, { polyfills, regenerator }]); + } else if (useBuiltIns === "entry") { + plugins.push([useBuiltInsEntryPlugin, { polyfills, regenerator }]); } return { diff --git a/experimental/babel-preset-env/src/normalize-options.js b/experimental/babel-preset-env/src/normalize-options.js index 5ed54f82f8..2b413936ca 100644 --- a/experimental/babel-preset-env/src/normalize-options.js +++ b/experimental/babel-preset-env/src/normalize-options.js @@ -76,7 +76,6 @@ export default function normalizeOptions(opts) { loose: validateLooseOption(opts.loose), moduleType: validateModulesOption(opts.modules), targets: opts.targets, - useBuiltIns: opts.useBuiltIns, - addUsedBuiltIns: opts.addUsedBuiltIns, + useBuiltIns: opts.useBuiltIns === undefined ? true : opts.useBuiltIns, }; } diff --git a/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js b/experimental/babel-preset-env/src/use-built-ins-entry-plugin.js similarity index 96% rename from experimental/babel-preset-env/src/transform-polyfill-require-plugin.js rename to experimental/babel-preset-env/src/use-built-ins-entry-plugin.js index ab66d3779b..73f4eef11d 100644 --- a/experimental/babel-preset-env/src/transform-polyfill-require-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-entry-plugin.js @@ -44,7 +44,8 @@ export default function({ types: t }) { return [ ...imports, - regenerator && createImport("regenerator-runtime/runtime", requireType), + regenerator && + createImport("babel-polyfill/regenerator-runtime/runtime", requireType), ].filter(Boolean); } diff --git a/experimental/babel-preset-env/src/add-used-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js similarity index 86% rename from experimental/babel-preset-env/src/add-used-built-ins-plugin.js rename to experimental/babel-preset-env/src/use-built-ins-plugin.js index 73d3b032ff..d9e6e8d3c7 100644 --- a/experimental/babel-preset-env/src/add-used-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -10,10 +10,6 @@ function warnOnInstanceMethod(details) { ); } -function getRuntimeModuleName(opts) { - return opts.moduleName || "babel-runtime"; -} - function has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } @@ -28,8 +24,6 @@ function getObjectString(node) { } } -const HELPER_BLACKLIST = ["interopRequireWildcard", "interopRequireDefault"]; - export default function({ types: t }) { function addImport(path, builtIn) { if (builtIn) { @@ -94,20 +88,20 @@ Please remove the call. for (const builtIn of Array.from(this.builtIns.keys()).reverse()) { if (Array.isArray(builtIn)) { for (const i of builtIn) { - console.warn(i); + // console.warn(i); if (state.opts.polyfills.indexOf(i) !== -1) { addImport(path, `core-js/modules/${i}`); } } } else { - console.warn(builtIn); + // console.warn(builtIn); if (state.opts.polyfills.indexOf(builtIn) !== -1) { addImport(path, `core-js/modules/${builtIn}`); } } } if (state.opts.regenerator && this.usesRegenerator) { - addImport(path, "regenerator-runtime/runtime"); + addImport(path, "babel-polyfill/regenerator-runtime/runtime"); } }, }, @@ -215,28 +209,8 @@ Please remove the call. }; return { - name: "add-used-built-ins", - pre(file) { - const moduleName = getRuntimeModuleName(this.opts); - - if (this.opts.helpers !== false) { - const baseHelpersDir = this.opts.useBuiltIns - ? "helpers/builtin" - : "helpers"; - const helpersDir = this.opts.useESModules - ? `${baseHelpersDir}/es6` - : baseHelpersDir; - file.set("helperGenerator", function(name) { - if (HELPER_BLACKLIST.indexOf(name) < 0) { - return file.addImport( - `${moduleName}/${helpersDir}/${name}`, - "default", - name, - ); - } - }); - } - + name: "use-built-ins", + pre() { this.builtIns = new Set(); this.usesRegenerator = false; }, diff --git a/experimental/babel-preset-env/test/debug-fixtures/builtins-uglify/options.json b/experimental/babel-preset-env/test/debug-fixtures/builtins-uglify/options.json index 9a5b6d27ba..99859f1e9d 100644 --- a/experimental/babel-preset-env/test/debug-fixtures/builtins-uglify/options.json +++ b/experimental/babel-preset-env/test/debug-fixtures/builtins-uglify/options.json @@ -6,7 +6,7 @@ "chrome": 55, "uglify": true }, - "useBuiltIns": true, + "useBuiltIns": "entry", "modules": false }] ] diff --git a/experimental/babel-preset-env/test/debug-fixtures/builtins/options.json b/experimental/babel-preset-env/test/debug-fixtures/builtins/options.json index aca549d50c..8a1de9062d 100644 --- a/experimental/babel-preset-env/test/debug-fixtures/builtins/options.json +++ b/experimental/babel-preset-env/test/debug-fixtures/builtins/options.json @@ -6,7 +6,7 @@ "browsers": "chrome >= 54, ie 10", "node": 6 }, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/debug-fixtures/electron/options.json b/experimental/babel-preset-env/test/debug-fixtures/electron/options.json index 28520558ba..b07199a014 100644 --- a/experimental/babel-preset-env/test/debug-fixtures/electron/options.json +++ b/experimental/babel-preset-env/test/debug-fixtures/electron/options.json @@ -5,7 +5,7 @@ "targets": { "electron": 0.36 }, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/debug-fixtures/plugins-only/options.json b/experimental/babel-preset-env/test/debug-fixtures/plugins-only/options.json index c04dc1ba87..e34ba84885 100644 --- a/experimental/babel-preset-env/test/debug-fixtures/plugins-only/options.json +++ b/experimental/babel-preset-env/test/debug-fixtures/plugins-only/options.json @@ -9,7 +9,8 @@ "targets": { "firefox": 52, "node": 7.4 - } + }, + "useBuiltIns": false }] ] } diff --git a/experimental/babel-preset-env/test/debug-fixtures/specific-targets/options.json b/experimental/babel-preset-env/test/debug-fixtures/specific-targets/options.json index fb03d94b1a..ae57604c0a 100644 --- a/experimental/babel-preset-env/test/debug-fixtures/specific-targets/options.json +++ b/experimental/babel-preset-env/test/debug-fixtures/specific-targets/options.json @@ -5,7 +5,7 @@ "targets": { "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" }, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/options.json b/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/options.json index 95f82a3b30..f8b18da618 100644 --- a/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/options.json +++ b/experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["../../../../lib/transform-polyfill-require-plugin", { + ["../../../../lib/use-built-ins-entry-plugin", { "polyfills": [ "es6.typed.data-view", "es6.typed.data-view", diff --git a/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/options.json b/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/options.json index 26df2c6813..e46957a874 100644 --- a/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/options.json +++ b/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["../../../../lib/transform-polyfill-require-plugin", { + ["../../../../lib/use-built-ins-entry-plugin", { "regenerator": false, "polyfills": [] }] diff --git a/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/expected.js b/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/expected.js index 50dec607ef..44ba5cae54 100644 --- a/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/expected.js +++ b/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/expected.js @@ -1 +1 @@ -import "regenerator-runtime/runtime"; +import "babel-polyfill/regenerator-runtime/runtime"; diff --git a/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/options.json b/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/options.json index ecbc61164e..e274811992 100644 --- a/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/options.json +++ b/experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-true/options.json @@ -1,6 +1,6 @@ { "plugins": [ - ["../../../../lib/transform-polyfill-require-plugin", { + ["../../../../lib/use-built-ins-entry-plugin", { "regenerator": true, "polyfills": [] }] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json index a32d3fe353..2bdb3e7756 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods-native-support/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false, "targets": { "chrome": 58 diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json index 85bd6a927f..b6301eb2a2 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false }] ] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json index a32d3fe353..2bdb3e7756 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-native-support/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false, "targets": { "chrome": 58 diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json index bfdc4ffcca..5d5e4fdd7a 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false, "debug": true }] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json index 85bd6a927f..b6301eb2a2 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/no-builtins-used/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false }] ] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/options.json index 052559c60c..b27da48581 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async-native-support/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false, "targets": { "chrome": 55 diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js index bfcc1da871..6a37297086 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js @@ -1,5 +1,5 @@ -import "regenerator-runtime/runtime"; -import _asyncToGenerator from "babel-runtime/helpers/asyncToGenerator"; +import "babel-polyfill/regenerator-runtime/runtime"; +import "core-js/modules/es6.promise"; var a = function () { var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() { @@ -17,4 +17,6 @@ var a = function () { return function a() { return _ref.apply(this, arguments); }; -}(); \ No newline at end of file +}(); + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json index 85bd6a927f..b6301eb2a2 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false }] ] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json index a44bb5b817..6a7c844351 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator-native-support/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false, "targets": { "node": 6 diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js index 5e04f20a36..8c476a8b06 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/expected.js @@ -1,4 +1,4 @@ -import "regenerator-runtime/runtime"; +import "babel-polyfill/regenerator-runtime/runtime"; var _marked = [a].map(regeneratorRuntime.mark); @@ -12,4 +12,4 @@ function a() { } } }, _marked[0], this); -} \ No newline at end of file +} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json index 85bd6a927f..b6301eb2a2 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-generator/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true, + "useBuiltIns": true, "modules": false }] ] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json index 49f571fffc..9d6951bd70 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/options.json @@ -1,7 +1,7 @@ { "presets": [ ["../../../../lib", { - "addUsedBuiltIns": true + "useBuiltIns": true }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options/core-js/actual.js deleted file mode 100644 index c3fee8a175..0000000000 --- a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/actual.js +++ /dev/null @@ -1 +0,0 @@ -import "core-js"; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js deleted file mode 100644 index bd6332b8ba..0000000000 --- a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/expected.js +++ /dev/null @@ -1 +0,0 @@ -import "core-js"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/core-js/options.json deleted file mode 100644 index de09fa3f05..0000000000 --- a/experimental/babel-preset-env/test/fixtures/preset-options/core-js/options.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": [ - ["../../../../lib", { - "targets": { - "chrome": 55 - }, - "modules": false, - "useBuiltIns": true - }] - ] -} diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/electron/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/electron/options.json index 281c0fd3eb..ea936ce251 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/electron/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/electron/options.json @@ -5,7 +5,7 @@ "electron": 1.4 }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/options.json index ba0e52da56..a67b72c183 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-include/options.json @@ -5,7 +5,7 @@ "chrome": 55 }, "modules": false, - "useBuiltIns": true, + "useBuiltIns": "entry", "exclude": [ "transform-async-to-generator", "transform-regenerator", diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/options.json index ba73a45cce..514d13251d 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-regenerator/options.json @@ -2,7 +2,7 @@ "presets": [ ["../../../../lib", { "modules": false, - "useBuiltIns": true, + "useBuiltIns": "entry", "exclude": ["transform-regenerator"] }] ] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js index c2982b3a4b..ed388e3b13 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/expected.js @@ -82,4 +82,4 @@ import "babel-polyfill/core-js/modules/es7.string.pad-end"; import "babel-polyfill/core-js/modules/web.timers"; import "babel-polyfill/core-js/modules/web.immediate"; import "babel-polyfill/core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; \ No newline at end of file +import "babel-polyfill/regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/options.json index 593a23c579..cebe1cb0d4 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/ie-11-built-ins/options.json @@ -5,7 +5,7 @@ "ie": 11 }, "modules": false, - "useBuiltIns": true, + "useBuiltIns": "entry", "modules": false }] ] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/options.json index 5d1b06b86b..74a59214cd 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/include-built-ins/options.json @@ -9,7 +9,7 @@ "es6.set" ], "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js index 1ae83df5b3..6b61206694 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/uglify/expected.js @@ -3,7 +3,7 @@ import "babel-polyfill/core-js/modules/es7.string.pad-end"; import "babel-polyfill/core-js/modules/web.timers"; import "babel-polyfill/core-js/modules/web.immediate"; import "babel-polyfill/core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; +import "babel-polyfill/regenerator-runtime/runtime"; var a = 1; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/uglify/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/uglify/options.json index dd788b3dc2..63bd00a05c 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/uglify/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/uglify/options.json @@ -6,7 +6,7 @@ "uglify": true }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js index 77df9700ca..91577e5f38 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/expected.js @@ -84,4 +84,4 @@ import "babel-polyfill/core-js/modules/es7.string.pad-end"; import "babel-polyfill/core-js/modules/web.timers"; import "babel-polyfill/core-js/modules/web.immediate"; import "babel-polyfill/core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; \ No newline at end of file +import "babel-polyfill/regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/options.json index 717506a540..21eec2f1a1 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-all/options.json @@ -2,7 +2,7 @@ "presets": [ ["../../../../lib", { "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js index 289e6057fb..28d59b0538 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/expected.js @@ -42,6 +42,6 @@ import "babel-polyfill/core-js/modules/es7.string.pad-end"; import "babel-polyfill/core-js/modules/web.timers"; import "babel-polyfill/core-js/modules/web.immediate"; import "babel-polyfill/core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; +import "babel-polyfill/regenerator-runtime/runtime"; Math.pow(1, 2); \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/options.json index 4ada141379..c975d957a6 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-48/options.json @@ -5,7 +5,7 @@ "chrome": 48 }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js index feb308c936..e2a5c08b74 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/expected.js @@ -28,6 +28,6 @@ import "babel-polyfill/core-js/modules/es7.string.pad-end"; import "babel-polyfill/core-js/modules/web.timers"; import "babel-polyfill/core-js/modules/web.immediate"; import "babel-polyfill/core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; +import "babel-polyfill/regenerator-runtime/runtime"; Math.pow(1, 2); \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/options.json index 66930156ff..0570d4dc43 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-chrome-49/options.json @@ -5,7 +5,7 @@ "chrome": 49 }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js index 77df9700ca..91577e5f38 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/expected.js @@ -84,4 +84,4 @@ import "babel-polyfill/core-js/modules/es7.string.pad-end"; import "babel-polyfill/core-js/modules/web.timers"; import "babel-polyfill/core-js/modules/web.immediate"; import "babel-polyfill/core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; \ No newline at end of file +import "babel-polyfill/regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/options.json index 90a95efcfb..9f6cf02b9a 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-ie-9/options.json @@ -5,7 +5,7 @@ "ie": 9 }, "modules": false, - "useBuiltIns": true, + "useBuiltIns": "entry", "modules": false }] ] diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/options.json index de09fa3f05..7c15d7db40 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-import/options.json @@ -5,7 +5,7 @@ "chrome": 55 }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js index d6437b66b7..e71a8d8b66 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/expected.js @@ -3,4 +3,4 @@ import "babel-polyfill/core-js/modules/es7.string.pad-end"; import "babel-polyfill/core-js/modules/web.timers"; import "babel-polyfill/core-js/modules/web.immediate"; import "babel-polyfill/core-js/modules/web.dom.iterable"; -import "regenerator-runtime/runtime"; \ No newline at end of file +import "babel-polyfill/regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/options.json index 7d156cdc08..701076ff3e 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node-web/options.json @@ -7,7 +7,7 @@ "uglify": true }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js index bbb140cfcb..678bbf85df 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/expected.js @@ -1,3 +1,3 @@ import "babel-polyfill/core-js/modules/es7.string.pad-start"; import "babel-polyfill/core-js/modules/es7.string.pad-end"; -import "regenerator-runtime/runtime"; \ No newline at end of file +import "babel-polyfill/regenerator-runtime/runtime"; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/options.json index cc2666d58a..8536be8292 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-node/options.json @@ -6,7 +6,7 @@ "uglify": true }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/options.json index de09fa3f05..7c15d7db40 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/use-builtins-require/options.json @@ -5,7 +5,7 @@ "chrome": 55 }, "modules": false, - "useBuiltIns": true + "useBuiltIns": "entry" }] ] } From 38fa457a880c1e855b8dd851a758da1df0d84c0d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 5 Apr 2017 17:58:54 -0400 Subject: [PATCH 06/14] use error messages, only log instance methods in debug --- experimental/babel-preset-env/src/index.js | 2 +- .../src/use-built-ins-plugin.js | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/experimental/babel-preset-env/src/index.js b/experimental/babel-preset-env/src/index.js index ed4b7f8bc0..5400dad9ff 100644 --- a/experimental/babel-preset-env/src/index.js +++ b/experimental/babel-preset-env/src/index.js @@ -243,7 +243,7 @@ export default function buildPreset(context, opts = {}) { ); if (useBuiltIns === true) { - plugins.push([addUsedBuiltInsPlugin, { polyfills, regenerator }]); + plugins.push([addUsedBuiltInsPlugin, { polyfills, regenerator, debug }]); } else if (useBuiltIns === "entry") { plugins.push([useBuiltInsEntryPlugin, { polyfills, regenerator }]); } diff --git a/experimental/babel-preset-env/src/use-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js index d9e6e8d3c7..098a344346 100644 --- a/experimental/babel-preset-env/src/use-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -44,18 +44,17 @@ export default function({ types: t }) { } const addAndRemovePolyfillImports = { - ImportDeclaration(path, state) { + ImportDeclaration(path) { if ( path.node.specifiers.length === 0 && isPolyfillSource(path.node.source.value) ) { - state.opts.addUsedBuiltIns && - console.warn( - ` -Adding "import 'babel-polyfill'" isn't necessary with the addUsedBuiltIns option anymore. + console.warn( + ` +Adding "import 'babel-polyfill'" isn't necessary with the useBuiltIns option anymore. Please remove the call. `, - ); + ); path.remove(); } }, @@ -72,13 +71,12 @@ to the "transform-polyfill-require" plugin } path.get("body").forEach(bodyPath => { if (isRequire(bodyPath)) { - state.opts.addUsedBuiltIns && - console.warn( - ` -Adding "require('babel-polyfill')" isn't necessary with the addUsedBuiltIns option anymore. + console.warn( + ` +Adding "require('babel-polyfill')" isn't necessary with the useBuiltIns option anymore. Please remove the call. `, - ); + ); path.remove(); } }); @@ -120,7 +118,7 @@ Please remove the call. // Array.from -> _core.Array.from MemberExpression: { - enter(path) { + enter(path, state) { if (!path.isReferenced()) return; const { node } = path; @@ -144,14 +142,15 @@ Please remove the call. t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name) ) { - warnOnInstanceMethod(getObjectString(node)); + state.opts.debug && warnOnInstanceMethod(getObjectString(node)); this.builtIns.add(definitions.instanceMethods[prop.name]); } else if ( node.computed && t.isStringLiteral(prop) && has(definitions.instanceMethods, prop.value) ) { - warnOnInstanceMethod(`${obj.name}['${prop.value}']`); + state.opts.debug && + warnOnInstanceMethod(`${obj.name}['${prop.value}']`); this.builtIns.add(definitions.instanceMethods[prop.value]); } }, @@ -171,7 +170,7 @@ Please remove the call. }, // var { repeat, startsWith } = String - VariableDeclarator(path) { + VariableDeclarator(path, state) { if (!path.isReferenced()) return; const { node } = path; @@ -192,9 +191,10 @@ Please remove the call. t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name) ) { - warnOnInstanceMethod( - `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`, - ); + state.opts.debug && + warnOnInstanceMethod( + `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`, + ); this.builtIns.add(definitions.instanceMethods[prop.name]); } From bf31fff83ed0b090c3f5f3fd3273f1993bc9a702 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 5 Apr 2017 19:35:02 -0400 Subject: [PATCH 07/14] add imports as built-ins are found instead of at program exit --- .../src/use-built-ins-plugin.js | 76 ++++++++++--------- .../expected.js | 20 ++--- .../builtins-used/expected.js | 8 +- .../builtins-used/options.json | 3 +- .../regenerator-used-async/expected.js | 2 +- .../test-modules-tranform/expected.js | 3 +- .../exclude-built-ins/options.json | 4 +- 7 files changed, 62 insertions(+), 54 deletions(-) diff --git a/experimental/babel-preset-env/src/use-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js index 098a344346..62c5f3246c 100644 --- a/experimental/babel-preset-env/src/use-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -25,11 +25,27 @@ function getObjectString(node) { } export default function({ types: t }) { - function addImport(path, builtIn) { - if (builtIn) { + function addImport(path, builtIn, builtIns) { + if (builtIn && !builtIns.has(builtIn)) { + builtIns.add(builtIn); const importDec = t.importDeclaration([], t.stringLiteral(builtIn)); importDec._blockHoist = 3; - path.unshiftContainer("body", importDec); + const programPath = path.find(path => path.isProgram()); + programPath.unshiftContainer("body", importDec); + } + } + + function addUnsupported(path, polyfills, builtIn, builtIns) { + if (Array.isArray(builtIn)) { + for (const i of builtIn) { + if (polyfills.indexOf(i) !== -1) { + addImport(path, `core-js/modules/${i}`, builtIns); + } + } + } else { + if (polyfills.indexOf(builtIn) !== -1) { + addImport(path, `core-js/modules/${builtIn}`, builtIns); + } } } @@ -81,39 +97,19 @@ Please remove the call. } }); }, - // add polyfills - exit(path, state) { - for (const builtIn of Array.from(this.builtIns.keys()).reverse()) { - if (Array.isArray(builtIn)) { - for (const i of builtIn) { - // console.warn(i); - if (state.opts.polyfills.indexOf(i) !== -1) { - addImport(path, `core-js/modules/${i}`); - } - } - } else { - // console.warn(builtIn); - if (state.opts.polyfills.indexOf(builtIn) !== -1) { - addImport(path, `core-js/modules/${builtIn}`); - } - } - } - if (state.opts.regenerator && this.usesRegenerator) { - addImport(path, "babel-polyfill/regenerator-runtime/runtime"); - } - }, }, // Symbol() -> _core.Symbol(); // new Promise -> new _core.Promise - ReferencedIdentifier(path) { + ReferencedIdentifier(path, state) { const { node, parent, scope } = path; if (t.isMemberExpression(parent)) return; if (!has(definitions.builtins, node.name)) return; if (scope.getBindingIdentifier(node.name)) return; - this.builtIns.add(definitions.builtins[node.name]); + const builtIn = definitions.builtins[node.name]; + addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); }, // Array.from -> _core.Array.from @@ -133,7 +129,8 @@ Please remove the call. if (has(definitions.staticMethods, obj.name)) { const staticMethods = definitions.staticMethods[obj.name]; if (has(staticMethods, prop.name)) { - this.builtIns.add(`${staticMethods[prop.name]}`); + const builtIn = staticMethods[prop.name]; + addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); } } @@ -143,7 +140,8 @@ Please remove the call. has(definitions.instanceMethods, prop.name) ) { state.opts.debug && warnOnInstanceMethod(getObjectString(node)); - this.builtIns.add(definitions.instanceMethods[prop.name]); + const builtIn = definitions.instanceMethods[prop.name]; + addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); } else if ( node.computed && t.isStringLiteral(prop) && @@ -151,12 +149,13 @@ Please remove the call. ) { state.opts.debug && warnOnInstanceMethod(`${obj.name}['${prop.value}']`); - this.builtIns.add(definitions.instanceMethods[prop.value]); + const builtIn = definitions.instanceMethods[prop.value]; + addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); } }, // Symbol.match - exit(path) { + exit(path, state) { if (!path.isReferenced()) return; const { node } = path; @@ -165,7 +164,8 @@ Please remove the call. if (!has(definitions.builtins, obj.name)) return; if (path.scope.getBindingIdentifier(obj.name)) return; - this.builtIns.add(definitions.builtins[obj.name]); + const builtIn = definitions.builtins[obj.name]; + addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); }, }, @@ -196,14 +196,22 @@ Please remove the call. `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`, ); - this.builtIns.add(definitions.instanceMethods[prop.name]); + const builtIn = definitions.instanceMethods[prop.name]; + addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); } } }, - Function(path) { - if (path.node.generator || path.node.async) { + Function(path, state) { + if (!this.usesRegenerator && (path.node.generator || path.node.async)) { this.usesRegenerator = true; + if (state.opts.regenerator) { + addImport( + path, + "babel-polyfill/regenerator-runtime/runtime", + this.builtIns, + ); + } } }, }; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js index 277b6c4eb4..0d40369620 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js @@ -1,15 +1,15 @@ -import 'core-js/modules/es6.array.from'; -import 'core-js/modules/es6.map'; +import 'core-js/modules/es6.string.ends-with'; +import 'core-js/modules/es6.string.code-point-at'; +import 'core-js/modules/es6.string.starts-with'; +import 'core-js/modules/es7.string.pad-end'; +import 'core-js/modules/es7.string.pad-start'; +import 'core-js/modules/es6.array.fill'; +import 'core-js/modules/es6.array.find-index'; +import 'core-js/modules/es6.array.find'; import 'core-js/modules/es7.array.includes'; import 'core-js/modules/es6.string.includes'; -import 'core-js/modules/es6.array.find'; -import 'core-js/modules/es6.array.find-index'; -import 'core-js/modules/es6.array.fill'; -import 'core-js/modules/es7.string.pad-start'; -import 'core-js/modules/es7.string.pad-end'; -import 'core-js/modules/es6.string.starts-with'; -import 'core-js/modules/es6.string.code-point-at'; -import 'core-js/modules/es6.string.ends-with'; +import 'core-js/modules/es6.map'; +import 'core-js/modules/es6.array.from'; Array.from; // static function Map; // top level built-in diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js index 7ac06f1451..270ecc6055 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js @@ -1,8 +1,8 @@ -import 'core-js/modules/es6.array.from'; -import 'core-js/modules/es6.map'; -import 'core-js/modules/es6.promise'; -import 'core-js/modules/es6.regexp.match'; import 'core-js/modules/es6.symbol'; +import 'core-js/modules/es6.regexp.match'; +import 'core-js/modules/es6.promise'; +import 'core-js/modules/es6.map'; +import 'core-js/modules/es6.array.from'; Array.from; // static method Map; // built-in new Promise(); // new builtin diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json index 5d5e4fdd7a..b6301eb2a2 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/options.json @@ -2,8 +2,7 @@ "presets": [ ["../../../../lib", { "useBuiltIns": true, - "modules": false, - "debug": true + "modules": false }] ] } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js index 6a37297086..f344c60e6e 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/regenerator-used-async/expected.js @@ -1,5 +1,5 @@ -import "babel-polyfill/regenerator-runtime/runtime"; import "core-js/modules/es6.promise"; +import "babel-polyfill/regenerator-runtime/runtime"; var a = function () { var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee() { diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js index ba3fdf06cf..870ce94f5b 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/test-modules-tranform/expected.js @@ -1,4 +1,5 @@ "use strict"; -import "core-js/modules/es6.promise"; +require("core-js/modules/es6.promise"); + Promise; \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/options.json index bed44453eb..b05901e3e9 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/options.json +++ b/experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/options.json @@ -5,7 +5,7 @@ "chrome": 55 }, "modules": false, - "useBuiltIns": true, + "useBuiltIns": "entry", "exclude": [ "es7.string.pad-start", "es7.string.pad-end", @@ -15,4 +15,4 @@ ] }] ] -} \ No newline at end of file +} From cb1c5eaf97b5e868696f130e99a878db6b5473f5 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 6 Apr 2017 11:21:06 -0400 Subject: [PATCH 08/14] validate useBuiltIns against true,false,entry and test --- .../src/built-in-definitions.js | 1 + .../babel-preset-env/src/normalize-options.js | 14 +++++++++- .../builtins-false/actual.js | 24 +++++++++++++++++ .../builtins-false/expected.js | 27 +++++++++++++++++++ .../builtins-false/options.json | 8 ++++++ 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/options.json diff --git a/experimental/babel-preset-env/src/built-in-definitions.js b/experimental/babel-preset-env/src/built-in-definitions.js index 4c1ce04cf7..af2c3c1417 100644 --- a/experimental/babel-preset-env/src/built-in-definitions.js +++ b/experimental/babel-preset-env/src/built-in-definitions.js @@ -1,3 +1,4 @@ +// TODO: this is the opposite of built-in-features so maybe generate one from the other? export const definitions = { builtins: { DataView: "es6.typed.data-view", diff --git a/experimental/babel-preset-env/src/normalize-options.js b/experimental/babel-preset-env/src/normalize-options.js index 2b413936ca..59304cd312 100644 --- a/experimental/babel-preset-env/src/normalize-options.js +++ b/experimental/babel-preset-env/src/normalize-options.js @@ -66,6 +66,18 @@ export const validateModulesOption = (modulesOpt = "commonjs") => { return modulesOpt; }; +export const validateUseBuiltInsOption = (builtInsOpt = true) => { + invariant( + builtInsOpt === true || builtInsOpt === false || builtInsOpt === "entry", + `Invalid Option: The 'useBuiltIns' option must be either + 'false' to indicate no polyfill, + '"entry"' to indicate replacing the entry polyfill, or + 'true' (default) to import only used polyfills per file`, + ); + + return builtInsOpt; +}; + export default function normalizeOptions(opts) { checkDuplicateIncludeExcludes(opts.include, opts.exclude); @@ -76,6 +88,6 @@ export default function normalizeOptions(opts) { loose: validateLooseOption(opts.loose), moduleType: validateModulesOption(opts.modules), targets: opts.targets, - useBuiltIns: opts.useBuiltIns === undefined ? true : opts.useBuiltIns, + useBuiltIns: validateUseBuiltInsOption(opts.useBuiltIns), }; } diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/actual.js new file mode 100644 index 0000000000..45366a4fcb --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/actual.js @@ -0,0 +1,24 @@ +Array.from; // static method +Map; // built-in +new Promise(); // new builtin +Symbol.match; // as member expression +_arr[Symbol.iterator](); // Symbol.iterator + +// no import +Array.asdf; +Array2.from; +Map2; +new Promise2(); +Symbol.asdf; +Symbol2.match; +_arr9[Symbol2.iterator](); +_arr9[Symbol.iterator2](); + +G.assign; // static method +function H(WeakMap) { var blah = new WeakMap(); } // shadowed + +// not covered by this plugin +var asdf = 'copyWithin'; +i[asdf] // computed with identifier +j[`copyWithin`] // computed with template +var { [asdf]: _a } = k; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/expected.js new file mode 100644 index 0000000000..70092ed944 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/expected.js @@ -0,0 +1,27 @@ +Array.from; // static method +Map; // built-in +new Promise(); // new builtin +Symbol.match; // as member expression +_arr[Symbol.iterator](); // Symbol.iterator + +// no import +Array.asdf; +Array2.from; +Map2; +new Promise2(); +Symbol.asdf; +Symbol2.match; +_arr9[Symbol2.iterator](); +_arr9[Symbol.iterator2](); + +G.assign; // static method +function H(WeakMap) { + var blah = new WeakMap(); +} // shadowed + +// not covered by this plugin +var asdf = 'copyWithin'; +i[asdf]; // computed with identifier +j['copyWithin']; // computed with template +var _k = k, + _a = _k[asdf]; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/options.json b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/options.json new file mode 100644 index 0000000000..33eed36353 --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-false/options.json @@ -0,0 +1,8 @@ +{ + "presets": [ + ["../../../../lib", { + "useBuiltIns": false, + "modules": false + }] + ] +} From a48cf8b53f667f96eb6b88a2712753164814da05 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 6 Apr 2017 11:38:29 -0400 Subject: [PATCH 09/14] fix warning + readme [skip ci] --- experimental/babel-preset-env/README.md | 4 ++++ experimental/babel-preset-env/src/use-built-ins-plugin.js | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/experimental/babel-preset-env/README.md b/experimental/babel-preset-env/README.md index d7bfdd4856..794630c861 100644 --- a/experimental/babel-preset-env/README.md +++ b/experimental/babel-preset-env/README.md @@ -241,6 +241,10 @@ import "babel-polyfill/core-js/modules/es7.string.pad-start"; import "babel-polyfill/core-js/modules/es7.string.pad-end"; ``` +#### `useBuiltIns: false` + +Don't add polyfills automatically per file, or transform `import "babel-polyfill"` to individual polyfills. + --- ## Examples diff --git a/experimental/babel-preset-env/src/use-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js index 62c5f3246c..6861264fc4 100644 --- a/experimental/babel-preset-env/src/use-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -67,8 +67,8 @@ export default function({ types: t }) { ) { console.warn( ` -Adding "import 'babel-polyfill'" isn't necessary with the useBuiltIns option anymore. -Please remove the call. +When setting 'useBuiltIns: true', polyfills are automatically imported when needed. +Please remove the call or use 'useBuiltIns: "entry"' instead. `, ); path.remove(); @@ -89,8 +89,8 @@ to the "transform-polyfill-require" plugin if (isRequire(bodyPath)) { console.warn( ` -Adding "require('babel-polyfill')" isn't necessary with the useBuiltIns option anymore. -Please remove the call. +When setting 'useBuiltIns: true', polyfills are automatically imported when needed. +Please remove the call or use 'useBuiltIns: "entry"' instead. `, ); path.remove(); From 88d4df437ef35ebe1f8118aeaa18b5a13d3d73b9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 6 Apr 2017 11:59:41 -0400 Subject: [PATCH 10/14] use a Set --- experimental/babel-preset-env/src/index.js | 5 ++++- experimental/babel-preset-env/src/use-built-ins-plugin.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/experimental/babel-preset-env/src/index.js b/experimental/babel-preset-env/src/index.js index 5400dad9ff..b1c8842094 100644 --- a/experimental/babel-preset-env/src/index.js +++ b/experimental/babel-preset-env/src/index.js @@ -243,7 +243,10 @@ export default function buildPreset(context, opts = {}) { ); if (useBuiltIns === true) { - plugins.push([addUsedBuiltInsPlugin, { polyfills, regenerator, debug }]); + plugins.push([ + addUsedBuiltInsPlugin, + { polyfills: new Set(polyfills), regenerator, debug }, + ]); } else if (useBuiltIns === "entry") { plugins.push([useBuiltInsEntryPlugin, { polyfills, regenerator }]); } diff --git a/experimental/babel-preset-env/src/use-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js index 6861264fc4..c4f7a3b7fa 100644 --- a/experimental/babel-preset-env/src/use-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -38,12 +38,12 @@ export default function({ types: t }) { function addUnsupported(path, polyfills, builtIn, builtIns) { if (Array.isArray(builtIn)) { for (const i of builtIn) { - if (polyfills.indexOf(i) !== -1) { + if (polyfills.has(i)) { addImport(path, `core-js/modules/${i}`, builtIns); } } } else { - if (polyfills.indexOf(builtIn) !== -1) { + if (polyfills.has(builtIn)) { addImport(path, `core-js/modules/${builtIn}`, builtIns); } } From 200edc8e8cf7421521cad10a20ae2b031b45ec14 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 6 Apr 2017 12:02:21 -0400 Subject: [PATCH 11/14] move debug check --- .../src/use-built-ins-plugin.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/experimental/babel-preset-env/src/use-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js index c4f7a3b7fa..8b4ce3ce0b 100644 --- a/experimental/babel-preset-env/src/use-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -4,10 +4,11 @@ function isPolyfillSource(value) { return value === "babel-polyfill"; } -function warnOnInstanceMethod(details) { - console.warn( - `Adding a polyfill: An instance method may have been used: ${details}`, - ); +function warnOnInstanceMethod(state, details) { + state.opts.debug && + console.warn( + `Adding a polyfill: An instance method may have been used: ${details}`, + ); } function has(obj, key) { @@ -139,7 +140,7 @@ Please remove the call or use 'useBuiltIns: "entry"' instead. t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name) ) { - state.opts.debug && warnOnInstanceMethod(getObjectString(node)); + warnOnInstanceMethod(state, getObjectString(node)); const builtIn = definitions.instanceMethods[prop.name]; addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); } else if ( @@ -147,8 +148,7 @@ Please remove the call or use 'useBuiltIns: "entry"' instead. t.isStringLiteral(prop) && has(definitions.instanceMethods, prop.value) ) { - state.opts.debug && - warnOnInstanceMethod(`${obj.name}['${prop.value}']`); + warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`); const builtIn = definitions.instanceMethods[prop.value]; addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); } @@ -191,10 +191,10 @@ Please remove the call or use 'useBuiltIns: "entry"' instead. t.isIdentifier(prop) && has(definitions.instanceMethods, prop.name) ) { - state.opts.debug && - warnOnInstanceMethod( - `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`, - ); + warnOnInstanceMethod( + state, + `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`, + ); const builtIn = definitions.instanceMethods[prop.name]; addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); From 5cbe963ddef43c703a3edafa02c0da646546ebc2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 6 Apr 2017 14:28:13 -0400 Subject: [PATCH 12/14] account for computed variables in properties --- .../src/use-built-ins-plugin.js | 29 ++++++++++---- .../builtins-used-instance-methods/actual.js | 8 ++++ .../expected.js | 39 ++++++++++++------- .../builtins-used/actual.js | 6 --- .../builtins-used/expected.js | 17 +++----- 5 files changed, 60 insertions(+), 39 deletions(-) diff --git a/experimental/babel-preset-env/src/use-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js index 8b4ce3ce0b..a764d44d8f 100644 --- a/experimental/babel-preset-env/src/use-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -143,14 +143,27 @@ Please remove the call or use 'useBuiltIns: "entry"' instead. warnOnInstanceMethod(state, getObjectString(node)); const builtIn = definitions.instanceMethods[prop.name]; addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); - } else if ( - node.computed && - t.isStringLiteral(prop) && - has(definitions.instanceMethods, prop.value) - ) { - warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`); - const builtIn = definitions.instanceMethods[prop.value]; - addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); + } else if (node.computed) { + if ( + t.isStringLiteral(prop) && + has(definitions.instanceMethods, prop.value) + ) { + const builtIn = definitions.instanceMethods[prop.value]; + warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`); + addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns); + } else { + const res = path.get("property").evaluate(); + if (res.confident) { + const builtIn = definitions.instanceMethods[res.value]; + warnOnInstanceMethod(state, `${obj.name}['${res.value}']`); + addUnsupported( + path.get("property"), + state.opts.polyfills, + builtIn, + this.builtIns, + ); + } + } } }, diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js index 35cd0f9960..4528eff880 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/actual.js @@ -10,3 +10,11 @@ e.padStart.apply(); // .apply f.padEnd.call(); // .call String.prototype.startsWith.call; // prototype.call var { codePointAt, endsWith } = k; // destructuring + +var asdf = "copyWithin"; +var asdf2 = "split"; +var asdf3 = "re" + "place"; +i[asdf]; // computed with identifier +j[`search`]; // computed with template +k[asdf3] // computed with concat strings +var { [asdf2]: _a } = k; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js index 0d40369620..056234f92d 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used-instance-methods/expected.js @@ -1,15 +1,19 @@ -import 'core-js/modules/es6.string.ends-with'; -import 'core-js/modules/es6.string.code-point-at'; -import 'core-js/modules/es6.string.starts-with'; -import 'core-js/modules/es7.string.pad-end'; -import 'core-js/modules/es7.string.pad-start'; -import 'core-js/modules/es6.array.fill'; -import 'core-js/modules/es6.array.find-index'; -import 'core-js/modules/es6.array.find'; -import 'core-js/modules/es7.array.includes'; -import 'core-js/modules/es6.string.includes'; -import 'core-js/modules/es6.map'; -import 'core-js/modules/es6.array.from'; +import "core-js/modules/es6.regexp.split"; +import "core-js/modules/es6.regexp.replace"; +import "core-js/modules/es6.regexp.search"; +import "core-js/modules/es6.array.copy-within"; +import "core-js/modules/es6.string.ends-with"; +import "core-js/modules/es6.string.code-point-at"; +import "core-js/modules/es6.string.starts-with"; +import "core-js/modules/es7.string.pad-end"; +import "core-js/modules/es7.string.pad-start"; +import "core-js/modules/es6.array.fill"; +import "core-js/modules/es6.array.find-index"; +import "core-js/modules/es6.array.find"; +import "core-js/modules/es7.array.includes"; +import "core-js/modules/es6.string.includes"; +import "core-js/modules/es6.map"; +import "core-js/modules/es6.array.from"; Array.from; // static function Map; // top level built-in @@ -23,4 +27,13 @@ f.padEnd.call(); // .call String.prototype.startsWith.call; // prototype.call var _k = k, codePointAt = _k.codePointAt, - endsWith = _k.endsWith; // destructuring \ No newline at end of file + endsWith = _k.endsWith; // destructuring + +var asdf = "copyWithin"; +var asdf2 = "split"; +var asdf3 = "re" + "place"; +i[asdf]; // computed with identifier +j["search"]; // computed with template +k[asdf3]; // computed with concat strings +var _k2 = k, + _a = _k2[asdf2]; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js index 45366a4fcb..fff74225a2 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/actual.js @@ -16,9 +16,3 @@ _arr9[Symbol.iterator2](); G.assign; // static method function H(WeakMap) { var blah = new WeakMap(); } // shadowed - -// not covered by this plugin -var asdf = 'copyWithin'; -i[asdf] // computed with identifier -j[`copyWithin`] // computed with template -var { [asdf]: _a } = k; // computed diff --git a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js index 270ecc6055..67cbc7094f 100644 --- a/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js +++ b/experimental/babel-preset-env/test/fixtures/preset-options-add-used-built-ins/builtins-used/expected.js @@ -1,8 +1,8 @@ -import 'core-js/modules/es6.symbol'; -import 'core-js/modules/es6.regexp.match'; -import 'core-js/modules/es6.promise'; -import 'core-js/modules/es6.map'; -import 'core-js/modules/es6.array.from'; +import "core-js/modules/es6.symbol"; +import "core-js/modules/es6.regexp.match"; +import "core-js/modules/es6.promise"; +import "core-js/modules/es6.map"; +import "core-js/modules/es6.array.from"; Array.from; // static method Map; // built-in new Promise(); // new builtin @@ -23,10 +23,3 @@ G.assign; // static method function H(WeakMap) { var blah = new WeakMap(); } // shadowed - -// not covered by this plugin -var asdf = 'copyWithin'; -i[asdf]; // computed with identifier -j['copyWithin']; // computed with template -var _k = k, - _a = _k[asdf]; // computed \ No newline at end of file From afa3ad97d10c1406a98a481252139652b673e55c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 6 Apr 2017 14:36:01 -0400 Subject: [PATCH 13/14] update plugins to latest alpha --- experimental/babel-preset-env/package.json | 60 +-- experimental/babel-preset-env/yarn.lock | 486 +++++++++++++-------- 2 files changed, 324 insertions(+), 222 deletions(-) diff --git a/experimental/babel-preset-env/package.json b/experimental/babel-preset-env/package.json index 19a3c1a1f0..4e040e8ee7 100644 --- a/experimental/babel-preset-env/package.json +++ b/experimental/babel-preset-env/package.json @@ -24,33 +24,33 @@ "test-only": "mocha ./test --compilers js:babel-register -t 10000" }, "dependencies": { - "babel-plugin-check-es2015-constants": "7.0.0-alpha.3", - "babel-plugin-syntax-trailing-function-commas": "7.0.0-alpha.3", - "babel-plugin-transform-async-to-generator": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-arrow-functions": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-block-scoped-functions": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-block-scoping": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-classes": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-computed-properties": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-destructuring": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-duplicate-keys": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-for-of": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-function-name": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-literals": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-modules-amd": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-modules-commonjs": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-modules-systemjs": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-modules-umd": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-object-super": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-parameters": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-shorthand-properties": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-spread": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-sticky-regex": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-template-literals": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-typeof-symbol": "7.0.0-alpha.3", - "babel-plugin-transform-es2015-unicode-regex": "7.0.0-alpha.3", - "babel-plugin-transform-exponentiation-operator": "7.0.0-alpha.3", - "babel-plugin-transform-regenerator": "7.0.0-alpha.3", + "babel-plugin-check-es2015-constants": "7.0.0-alpha.7", + "babel-plugin-syntax-trailing-function-commas": "7.0.0-alpha.7", + "babel-plugin-transform-async-to-generator": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-arrow-functions": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-block-scoped-functions": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-block-scoping": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-classes": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-computed-properties": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-destructuring": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-duplicate-keys": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-for-of": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-function-name": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-literals": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-modules-amd": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-modules-commonjs": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-modules-systemjs": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-modules-umd": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-object-super": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-parameters": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-shorthand-properties": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-spread": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-sticky-regex": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-template-literals": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-typeof-symbol": "7.0.0-alpha.7", + "babel-plugin-transform-es2015-unicode-regex": "7.0.0-alpha.7", + "babel-plugin-transform-exponentiation-operator": "7.0.0-alpha.7", + "babel-plugin-transform-regenerator": "7.0.0-alpha.7", "browserslist": "^1.4.0", "invariant": "^2.2.2" }, @@ -58,11 +58,11 @@ "babel-cli": "7.0.0-alpha.6", "babel-eslint": "^7.1.1", "babel-helper-fixtures": "7.0.0-alpha.3", - "babel-helper-plugin-test-runner": "7.0.0-alpha.6", + "babel-helper-plugin-test-runner": "7.0.0-alpha.7", "babel-plugin-istanbul": "^4.0.0", - "babel-plugin-transform-flow-strip-types": "7.0.0-alpha.3", + "babel-plugin-transform-flow-strip-types": "7.0.0-alpha.7", "babel-preset-env": "2.0.0-alpha.1", - "babel-register": "7.0.0-alpha.6", + "babel-register": "7.0.0-alpha.7", "chai": "^3.5.0", "codecov": "^2.0.1", "compat-table": "kangax/compat-table#c38f039b8ea7fadf347d3e300fec3611645e31e9", diff --git a/experimental/babel-preset-env/yarn.lock b/experimental/babel-preset-env/yarn.lock index 4c7d7fc098..a178bb3434 100644 --- a/experimental/babel-preset-env/yarn.lock +++ b/experimental/babel-preset-env/yarn.lock @@ -275,6 +275,28 @@ babel-core@7.0.0-alpha.6: slash "^1.0.0" source-map "^0.5.0" +babel-core@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-alpha.7.tgz#714bde734537de00dce30bae27432ed52cc2aac3" + dependencies: + babel-code-frame "7.0.0-alpha.3" + babel-generator "7.0.0-alpha.7" + babel-helpers "7.0.0-alpha.7" + babel-messages "7.0.0-alpha.3" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" + babylon "7.0.0-beta.8" + convert-source-map "^1.1.0" + debug "^2.1.1" + json5 "^0.5.0" + lodash "^4.2.0" + micromatch "^2.3.11" + private "^0.1.6" + resolve "^1.3.2" + slash "^1.0.0" + source-map "^0.5.0" + babel-core@^6.24.0, babel-core@latest: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" @@ -321,6 +343,18 @@ babel-generator@7.0.0-alpha.3: source-map "^0.5.0" trim-right "^1.0.1" +babel-generator@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-7.0.0-alpha.7.tgz#80f6b833063fe6445c29fa1b38fe6bc057425f0f" + dependencies: + babel-messages "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + babel-generator@^6.18.0, babel-generator@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" @@ -349,12 +383,12 @@ babel-helper-builder-binary-assignment-operator-visitor@7.0.0-alpha.1: babel-helper-explode-assignable-expression "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-helper-builder-binary-assignment-operator-visitor@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-7.0.0-alpha.3.tgz#36d95f05539d19e56a93f52f147c772367c53ca5" +babel-helper-builder-binary-assignment-operator-visitor@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-7.0.0-alpha.7.tgz#5c909122947ac486f1d3a84836327e9cd9553980" dependencies: - babel-helper-explode-assignable-expression "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-explode-assignable-expression "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-helper-builder-binary-assignment-operator-visitor@^6.22.0: version "6.22.0" @@ -372,13 +406,13 @@ babel-helper-call-delegate@7.0.0-alpha.1: babel-traverse "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-helper-call-delegate@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-7.0.0-alpha.3.tgz#23c12acd22ade7ed05b27a51ad2c7d1016929dbf" +babel-helper-call-delegate@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-7.0.0-alpha.7.tgz#694f10551d74fc582394b5372f5386d67bfe0349" dependencies: - babel-helper-hoist-variables "7.0.0-alpha.3" - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-hoist-variables "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-helper-call-delegate@^6.22.0: version "6.22.0" @@ -397,12 +431,12 @@ babel-helper-define-map@7.0.0-alpha.1: babel-types "7.0.0-alpha.1" lodash "^4.2.0" -babel-helper-define-map@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-7.0.0-alpha.3.tgz#1d67803d202440e70ed10ddff74600e143be50fa" +babel-helper-define-map@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-7.0.0-alpha.7.tgz#92971c4cc24426dffe8946fd83a4b994e7e672dd" dependencies: - babel-helper-function-name "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-function-name "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" lodash "^4.2.0" babel-helper-define-map@^6.23.0: @@ -421,12 +455,12 @@ babel-helper-explode-assignable-expression@7.0.0-alpha.1: babel-traverse "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-helper-explode-assignable-expression@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-7.0.0-alpha.3.tgz#ab9bfe22c0409a57d1a3b0bce3bb409a9e8d86e9" +babel-helper-explode-assignable-expression@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-7.0.0-alpha.7.tgz#114b676437f4cb694eeb51afcd4cc9b0bf926c5c" dependencies: - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-helper-explode-assignable-expression@^6.22.0: version "6.22.0" @@ -461,14 +495,14 @@ babel-helper-function-name@7.0.0-alpha.1: babel-traverse "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-helper-function-name@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.3.tgz#c20acaadfff6632b7c7efccab31d60d5e8e59814" +babel-helper-function-name@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.7.tgz#19aecddc5402f941c5726802993077b41ea9832d" dependencies: - babel-helper-get-function-arity "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-get-function-arity "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-helper-function-name@^6.22.0, babel-helper-function-name@^6.23.0: version "6.23.0" @@ -486,11 +520,11 @@ babel-helper-get-function-arity@7.0.0-alpha.1: dependencies: babel-types "7.0.0-alpha.1" -babel-helper-get-function-arity@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.3.tgz#e2c2db48d65300da135cabd91d8e9629b07ca5e8" +babel-helper-get-function-arity@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.7.tgz#16e6526ecefc5537826012365e577de2ccba02f5" dependencies: - babel-types "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" babel-helper-get-function-arity@^6.22.0: version "6.22.0" @@ -505,11 +539,11 @@ babel-helper-hoist-variables@7.0.0-alpha.1: dependencies: babel-types "7.0.0-alpha.1" -babel-helper-hoist-variables@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-7.0.0-alpha.3.tgz#6bd71cdea55d848877acf14c3751b8598c0fd198" +babel-helper-hoist-variables@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-7.0.0-alpha.7.tgz#79251e91183322c656d210677a509b642165b8e8" dependencies: - babel-types "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" babel-helper-hoist-variables@^6.22.0: version "6.22.0" @@ -524,11 +558,11 @@ babel-helper-optimise-call-expression@7.0.0-alpha.1: dependencies: babel-types "7.0.0-alpha.1" -babel-helper-optimise-call-expression@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-7.0.0-alpha.3.tgz#a3c5ba4a5e59c651c74f9e17351ff8d4093f13b2" +babel-helper-optimise-call-expression@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-7.0.0-alpha.7.tgz#87af3403ee4a23e2b5d7800158b67a88ff55004a" dependencies: - babel-types "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" babel-helper-optimise-call-expression@^6.23.0: version "6.23.0" @@ -537,11 +571,11 @@ babel-helper-optimise-call-expression@^6.23.0: babel-runtime "^6.22.0" babel-types "^6.23.0" -babel-helper-plugin-test-runner@7.0.0-alpha.6: - version "7.0.0-alpha.6" - resolved "https://registry.yarnpkg.com/babel-helper-plugin-test-runner/-/babel-helper-plugin-test-runner-7.0.0-alpha.6.tgz#9f5c309f9287df42e8a770642a5e8f0051322e3b" +babel-helper-plugin-test-runner@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-plugin-test-runner/-/babel-helper-plugin-test-runner-7.0.0-alpha.7.tgz#464230613bd2015933147d282737f333dfe8c23e" dependencies: - babel-helper-transform-fixture-test-runner "7.0.0-alpha.6" + babel-helper-transform-fixture-test-runner "7.0.0-alpha.7" babel-helper-regex@7.0.0-alpha.1: version "7.0.0-alpha.1" @@ -550,11 +584,11 @@ babel-helper-regex@7.0.0-alpha.1: babel-types "7.0.0-alpha.1" lodash "^4.2.0" -babel-helper-regex@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-7.0.0-alpha.3.tgz#c74440fc1418b6e92290c4880e15e3738f31a366" +babel-helper-regex@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-7.0.0-alpha.7.tgz#fbf219c2a79a08a360525e3048a44ba53d163575" dependencies: - babel-types "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" lodash "^4.2.0" babel-helper-regex@^6.22.0: @@ -574,14 +608,14 @@ babel-helper-remap-async-to-generator@7.0.0-alpha.1: babel-traverse "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-helper-remap-async-to-generator@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-7.0.0-alpha.3.tgz#9b137a1222a186f1cfb6fa292af5d302085e1aa7" +babel-helper-remap-async-to-generator@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-7.0.0-alpha.7.tgz#c1436c4cb0d8c01f65f0a055098a05df24d53c7c" dependencies: - babel-helper-function-name "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-function-name "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-helper-remap-async-to-generator@^6.22.0: version "6.22.0" @@ -603,15 +637,15 @@ babel-helper-replace-supers@7.0.0-alpha.1: babel-traverse "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-helper-replace-supers@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-7.0.0-alpha.3.tgz#04c701909509867fa84bceeb2b0e51b34cf2d657" +babel-helper-replace-supers@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-7.0.0-alpha.7.tgz#73ceb5bfeb597ff2c2772a75f0aa013be58e78fe" dependencies: - babel-helper-optimise-call-expression "7.0.0-alpha.3" + babel-helper-optimise-call-expression "7.0.0-alpha.7" babel-messages "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-helper-replace-supers@^6.22.0, babel-helper-replace-supers@^6.23.0: version "6.23.0" @@ -624,14 +658,14 @@ babel-helper-replace-supers@^6.22.0, babel-helper-replace-supers@^6.23.0: babel-traverse "^6.23.0" babel-types "^6.23.0" -babel-helper-transform-fixture-test-runner@7.0.0-alpha.6: - version "7.0.0-alpha.6" - resolved "https://registry.yarnpkg.com/babel-helper-transform-fixture-test-runner/-/babel-helper-transform-fixture-test-runner-7.0.0-alpha.6.tgz#49bd6409d8521e4e1364eb0be313a1d8d7af00fa" +babel-helper-transform-fixture-test-runner@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-transform-fixture-test-runner/-/babel-helper-transform-fixture-test-runner-7.0.0-alpha.7.tgz#a4381514a0edea7686732c1a1164759afc966d26" dependencies: babel-code-frame "7.0.0-alpha.3" - babel-core "7.0.0-alpha.6" + babel-core "7.0.0-alpha.7" babel-helper-fixtures "7.0.0-alpha.3" - babel-polyfill "7.0.0-alpha.3" + babel-polyfill "7.0.0-alpha.7" chai "^3.0.0" lodash "^4.2.0" resolve "^1.3.2" @@ -643,6 +677,12 @@ babel-helpers@7.0.0-alpha.3: dependencies: babel-template "7.0.0-alpha.3" +babel-helpers@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-7.0.0-alpha.7.tgz#1640077af095fd516bec82527466fb17348b057a" + dependencies: + babel-template "7.0.0-alpha.7" + babel-helpers@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.23.0.tgz#4f8f2e092d0b6a8808a4bde79c27f1e2ecf0d992" @@ -668,9 +708,9 @@ babel-plugin-check-es2015-constants@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-7.0.0-alpha.1.tgz#ed92809ce3b4965f0ac5fd5fb9fed8aeb1321b48" -babel-plugin-check-es2015-constants@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-7.0.0-alpha.3.tgz#bc83e61842bf8769515e7f69cb43cf7f2546aaba" +babel-plugin-check-es2015-constants@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-7.0.0-alpha.7.tgz#6089e4f6e8e58b87bb04085beeb4e77103ddee3e" babel-plugin-check-es2015-constants@^6.22.0: version "6.22.0" @@ -754,9 +794,9 @@ babel-plugin-syntax-trailing-function-commas@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-alpha.1.tgz#8b2415d3add81f323ab0edb95978d640ca9fc93e" -babel-plugin-syntax-trailing-function-commas@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-alpha.3.tgz#9a54a5e3ba447d9acf0257d67fa8ba2db501615e" +babel-plugin-syntax-trailing-function-commas@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-alpha.7.tgz#0bb156466bba6c4705dafc98ec7e9f227c704cd3" babel-plugin-syntax-trailing-function-commas@^6.22.0: version "6.22.0" @@ -777,11 +817,11 @@ babel-plugin-transform-async-to-generator@7.0.0-alpha.1: babel-helper-remap-async-to-generator "7.0.0-alpha.1" babel-plugin-syntax-async-functions "7.0.0-alpha.1" -babel-plugin-transform-async-to-generator@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-7.0.0-alpha.3.tgz#5bd5294e3d57e22bf2679c913c4ee46a6fcb0efd" +babel-plugin-transform-async-to-generator@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-7.0.0-alpha.7.tgz#2ccfb70f91d78dc5e3814220d524da2f8df4430c" dependencies: - babel-helper-remap-async-to-generator "7.0.0-alpha.3" + babel-helper-remap-async-to-generator "7.0.0-alpha.7" babel-plugin-syntax-async-functions "7.0.0-alpha.3" babel-plugin-transform-async-to-generator@^6.22.0: @@ -830,9 +870,9 @@ babel-plugin-transform-es2015-arrow-functions@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-7.0.0-alpha.1.tgz#52bc08a31c74ae04fd35043014ab07929d67b5ef" -babel-plugin-transform-es2015-arrow-functions@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-7.0.0-alpha.3.tgz#1c07e322a1d6d58173f69e0a48f7b7e89a1d64ef" +babel-plugin-transform-es2015-arrow-functions@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-7.0.0-alpha.7.tgz#5921b86f8ad9391177cb7ec8793bdf2daca1cc4b" babel-plugin-transform-es2015-arrow-functions@^6.22.0: version "6.22.0" @@ -844,9 +884,9 @@ babel-plugin-transform-es2015-block-scoped-functions@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-7.0.0-alpha.1.tgz#65d4c95a4f0ec0976f8da45af493d126d29d6fe4" -babel-plugin-transform-es2015-block-scoped-functions@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-7.0.0-alpha.3.tgz#fa5f3f3715e05ec3a1ef2c1ec8bb1f1fe3a4ce0a" +babel-plugin-transform-es2015-block-scoped-functions@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-7.0.0-alpha.7.tgz#c3409df41e449c075100c5ff602f98e065577f7a" babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: version "6.22.0" @@ -863,13 +903,13 @@ babel-plugin-transform-es2015-block-scoping@7.0.0-alpha.1: babel-types "7.0.0-alpha.1" lodash "^4.2.0" -babel-plugin-transform-es2015-block-scoping@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-7.0.0-alpha.3.tgz#8c939676d0be68ef55500455b785ed1b4c0160bd" +babel-plugin-transform-es2015-block-scoping@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-7.0.0-alpha.7.tgz#b82115907057c2edcc379ee0b647f99afc73e36f" dependencies: - babel-template "7.0.0-alpha.3" - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" lodash "^4.2.0" babel-plugin-transform-es2015-block-scoping@^6.22.0: @@ -895,18 +935,18 @@ babel-plugin-transform-es2015-classes@7.0.0-alpha.1: babel-traverse "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-plugin-transform-es2015-classes@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-7.0.0-alpha.3.tgz#98e6fc79f1d3ac9ed2c51ee7c3f14d8c38ffe2c6" +babel-plugin-transform-es2015-classes@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-7.0.0-alpha.7.tgz#f892baf5e6eec72dbebb3bc4a1466232a414a275" dependencies: - babel-helper-define-map "7.0.0-alpha.3" - babel-helper-function-name "7.0.0-alpha.3" - babel-helper-optimise-call-expression "7.0.0-alpha.3" - babel-helper-replace-supers "7.0.0-alpha.3" + babel-helper-define-map "7.0.0-alpha.7" + babel-helper-function-name "7.0.0-alpha.7" + babel-helper-optimise-call-expression "7.0.0-alpha.7" + babel-helper-replace-supers "7.0.0-alpha.7" babel-messages "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-plugin-transform-es2015-classes@^6.22.0: version "6.23.0" @@ -928,11 +968,11 @@ babel-plugin-transform-es2015-computed-properties@7.0.0-alpha.1: dependencies: babel-template "7.0.0-alpha.1" -babel-plugin-transform-es2015-computed-properties@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-7.0.0-alpha.3.tgz#9577e8d3a45e63da5c5ddf14163fb2ef67bb26c8" +babel-plugin-transform-es2015-computed-properties@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-7.0.0-alpha.7.tgz#88a3eb4a1e817044d35fd916d899f5b22ed7edd6" dependencies: - babel-template "7.0.0-alpha.3" + babel-template "7.0.0-alpha.7" babel-plugin-transform-es2015-computed-properties@^6.22.0: version "6.22.0" @@ -945,9 +985,9 @@ babel-plugin-transform-es2015-destructuring@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-7.0.0-alpha.1.tgz#b49a80cb0e039863b5040913228afef1cceafe22" -babel-plugin-transform-es2015-destructuring@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-7.0.0-alpha.3.tgz#509333f153ba1b58fa1a4b48286cbdce11b028a0" +babel-plugin-transform-es2015-destructuring@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-7.0.0-alpha.7.tgz#7a5a907cf67f824f6cc5e7832a3f16ba51abdc05" babel-plugin-transform-es2015-destructuring@^6.22.0: version "6.23.0" @@ -961,11 +1001,11 @@ babel-plugin-transform-es2015-duplicate-keys@7.0.0-alpha.1: dependencies: babel-types "7.0.0-alpha.1" -babel-plugin-transform-es2015-duplicate-keys@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-7.0.0-alpha.3.tgz#1a4add3548ffd64f209be62695409d3d616b0d64" +babel-plugin-transform-es2015-duplicate-keys@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-7.0.0-alpha.7.tgz#6a522462f5123e45de1b6cb1c82cd30bcdea4f91" dependencies: - babel-types "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" babel-plugin-transform-es2015-duplicate-keys@^6.22.0: version "6.22.0" @@ -978,9 +1018,9 @@ babel-plugin-transform-es2015-for-of@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-7.0.0-alpha.1.tgz#fd4cea43f220f1c138a501e05f2331ea4cb890c8" -babel-plugin-transform-es2015-for-of@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-7.0.0-alpha.3.tgz#6a959e8995a21ae796deaa2db7d74b7009a9dd79" +babel-plugin-transform-es2015-for-of@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-7.0.0-alpha.7.tgz#3dd6e5dc5e98c5044b9cb616252e023b97477ef7" babel-plugin-transform-es2015-for-of@^6.22.0: version "6.23.0" @@ -995,12 +1035,12 @@ babel-plugin-transform-es2015-function-name@7.0.0-alpha.1: babel-helper-function-name "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-plugin-transform-es2015-function-name@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-7.0.0-alpha.3.tgz#39d08ce84f45d7652f20a2123b556a9de24459c2" +babel-plugin-transform-es2015-function-name@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-7.0.0-alpha.7.tgz#3b6ded23efaf1183de8d234b2bbdec650692924f" dependencies: - babel-helper-function-name "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-function-name "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-plugin-transform-es2015-function-name@^6.22.0: version "6.22.0" @@ -1014,9 +1054,9 @@ babel-plugin-transform-es2015-literals@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-7.0.0-alpha.1.tgz#7496a18b076c5f92f2f5b09d26cc0cfb3b5ab03e" -babel-plugin-transform-es2015-literals@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-7.0.0-alpha.3.tgz#748048faebe88da55cad28e9c1d50c83e1eb0de7" +babel-plugin-transform-es2015-literals@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-7.0.0-alpha.7.tgz#1c4e552be18f988874caac33c9e9a07e1417d1c6" babel-plugin-transform-es2015-literals@^6.22.0: version "6.22.0" @@ -1031,12 +1071,12 @@ babel-plugin-transform-es2015-modules-amd@7.0.0-alpha.1: babel-plugin-transform-es2015-modules-commonjs "7.0.0-alpha.1" babel-template "7.0.0-alpha.1" -babel-plugin-transform-es2015-modules-amd@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-7.0.0-alpha.3.tgz#960aa59d67e76948beea0cd2a5bb6771cea36c7f" +babel-plugin-transform-es2015-modules-amd@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-7.0.0-alpha.7.tgz#29a01b92303036eabe120cfa8af1fd8a23fb41b0" dependencies: - babel-plugin-transform-es2015-modules-commonjs "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" + babel-plugin-transform-es2015-modules-commonjs "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" babel-plugin-transform-es2015-modules-amd@^6.24.0: version "6.24.0" @@ -1054,13 +1094,13 @@ babel-plugin-transform-es2015-modules-commonjs@7.0.0-alpha.1: babel-template "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-plugin-transform-es2015-modules-commonjs@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-7.0.0-alpha.3.tgz#9d5b06621da4f6f665345d4ecc86084f74f608ce" +babel-plugin-transform-es2015-modules-commonjs@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-7.0.0-alpha.7.tgz#8980ff65ada36f8853950878c80e1ca4d1188e90" dependencies: - babel-plugin-transform-strict-mode "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-plugin-transform-strict-mode "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-plugin-transform-es2015-modules-commonjs@^6.24.0: version "6.24.0" @@ -1078,12 +1118,12 @@ babel-plugin-transform-es2015-modules-systemjs@7.0.0-alpha.1: babel-helper-hoist-variables "7.0.0-alpha.1" babel-template "7.0.0-alpha.1" -babel-plugin-transform-es2015-modules-systemjs@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-7.0.0-alpha.3.tgz#b725ff684cf660001700fb9377b58940a6977b91" +babel-plugin-transform-es2015-modules-systemjs@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-7.0.0-alpha.7.tgz#2e2ad4576e433c803e65297b1ca70ca68a432eff" dependencies: - babel-helper-hoist-variables "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" + babel-helper-hoist-variables "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" babel-plugin-transform-es2015-modules-systemjs@^6.22.0: version "6.23.0" @@ -1100,12 +1140,12 @@ babel-plugin-transform-es2015-modules-umd@7.0.0-alpha.1: babel-plugin-transform-es2015-modules-amd "7.0.0-alpha.1" babel-template "7.0.0-alpha.1" -babel-plugin-transform-es2015-modules-umd@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-7.0.0-alpha.3.tgz#ec37fa367540262900b0b14cda7f2006bb1e1430" +babel-plugin-transform-es2015-modules-umd@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-7.0.0-alpha.7.tgz#cd73ec6d2f1d8a3492a5ce440a451b71f9dbacd5" dependencies: - babel-plugin-transform-es2015-modules-amd "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" + babel-plugin-transform-es2015-modules-amd "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" babel-plugin-transform-es2015-modules-umd@^6.24.0: version "6.24.0" @@ -1121,11 +1161,11 @@ babel-plugin-transform-es2015-object-super@7.0.0-alpha.1: dependencies: babel-helper-replace-supers "7.0.0-alpha.1" -babel-plugin-transform-es2015-object-super@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-7.0.0-alpha.3.tgz#b27368c505aa951656cc96749b485401da620429" +babel-plugin-transform-es2015-object-super@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-7.0.0-alpha.7.tgz#0dd56a6bbea14523187c73cede1660280947e91e" dependencies: - babel-helper-replace-supers "7.0.0-alpha.3" + babel-helper-replace-supers "7.0.0-alpha.7" babel-plugin-transform-es2015-object-super@^6.22.0: version "6.22.0" @@ -1144,15 +1184,15 @@ babel-plugin-transform-es2015-parameters@7.0.0-alpha.1: babel-traverse "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-plugin-transform-es2015-parameters@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-7.0.0-alpha.3.tgz#909e780d1e5bf9d972f80f389de95d45c36d40e6" +babel-plugin-transform-es2015-parameters@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-7.0.0-alpha.7.tgz#9ff005a532110584e4bc1731ee613d1fc8ad69d1" dependencies: - babel-helper-call-delegate "7.0.0-alpha.3" - babel-helper-get-function-arity "7.0.0-alpha.3" - babel-template "7.0.0-alpha.3" - babel-traverse "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-call-delegate "7.0.0-alpha.7" + babel-helper-get-function-arity "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-plugin-transform-es2015-parameters@^6.22.0: version "6.23.0" @@ -1171,11 +1211,11 @@ babel-plugin-transform-es2015-shorthand-properties@7.0.0-alpha.1: dependencies: babel-types "7.0.0-alpha.1" -babel-plugin-transform-es2015-shorthand-properties@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-7.0.0-alpha.3.tgz#6c704d77495994c91f17f2e8e39d89fa6f3d978c" +babel-plugin-transform-es2015-shorthand-properties@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-7.0.0-alpha.7.tgz#59678d452808584f62b3b196938673cdca560852" dependencies: - babel-types "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" babel-plugin-transform-es2015-shorthand-properties@^6.22.0: version "6.22.0" @@ -1188,9 +1228,9 @@ babel-plugin-transform-es2015-spread@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-7.0.0-alpha.1.tgz#bf852df483e6870929b0421e678b4867f7657b74" -babel-plugin-transform-es2015-spread@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-7.0.0-alpha.3.tgz#2d4b831e6b0e7c73e8201c38a824fe88d6168567" +babel-plugin-transform-es2015-spread@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-7.0.0-alpha.7.tgz#6b5a26372b19e2e1d4c63af5e22d298c5c278f5d" babel-plugin-transform-es2015-spread@^6.22.0: version "6.22.0" @@ -1205,12 +1245,12 @@ babel-plugin-transform-es2015-sticky-regex@7.0.0-alpha.1: babel-helper-regex "7.0.0-alpha.1" babel-types "7.0.0-alpha.1" -babel-plugin-transform-es2015-sticky-regex@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-7.0.0-alpha.3.tgz#abc021c8ad9a9ced19c27b0d94d1817abf2a8a2b" +babel-plugin-transform-es2015-sticky-regex@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-7.0.0-alpha.7.tgz#de71144b924c5c03da720c2982ade2a717b1fded" dependencies: - babel-helper-regex "7.0.0-alpha.3" - babel-types "7.0.0-alpha.3" + babel-helper-regex "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" babel-plugin-transform-es2015-sticky-regex@^6.22.0: version "6.22.0" @@ -1224,9 +1264,9 @@ babel-plugin-transform-es2015-template-literals@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-7.0.0-alpha.1.tgz#968645727f0f580fedfee962eeaf07f99d6c38b8" -babel-plugin-transform-es2015-template-literals@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-7.0.0-alpha.3.tgz#ccad4e75903dc5ee1989a5108b83740c80b3629a" +babel-plugin-transform-es2015-template-literals@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-7.0.0-alpha.7.tgz#f8deb336f2314eac484d07801594b84c24363984" babel-plugin-transform-es2015-template-literals@^6.22.0: version "6.22.0" @@ -1238,9 +1278,9 @@ babel-plugin-transform-es2015-typeof-symbol@7.0.0-alpha.1: version "7.0.0-alpha.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-7.0.0-alpha.1.tgz#615142e4a941361a8bda6b4ad1bd33678bf74664" -babel-plugin-transform-es2015-typeof-symbol@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-7.0.0-alpha.3.tgz#6592d301f2c40e5e943e5a3e26e56adc6db736ac" +babel-plugin-transform-es2015-typeof-symbol@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-7.0.0-alpha.7.tgz#93af130f02ee1d23c554242a44ba45bd7c2d4fb1" babel-plugin-transform-es2015-typeof-symbol@^6.22.0: version "6.23.0" @@ -1255,11 +1295,11 @@ babel-plugin-transform-es2015-unicode-regex@7.0.0-alpha.1: babel-helper-regex "7.0.0-alpha.1" regexpu-core "^4.0.2" -babel-plugin-transform-es2015-unicode-regex@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-7.0.0-alpha.3.tgz#0c8acf70e05dcfceaf9c3bfa10f123a645c44bac" +babel-plugin-transform-es2015-unicode-regex@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-7.0.0-alpha.7.tgz#13b92440afbd0cd088c19ba3becd340627b3eedc" dependencies: - babel-helper-regex "7.0.0-alpha.3" + babel-helper-regex "7.0.0-alpha.7" regexpu-core "^4.0.2" babel-plugin-transform-es2015-unicode-regex@^6.22.0: @@ -1277,11 +1317,11 @@ babel-plugin-transform-exponentiation-operator@7.0.0-alpha.1: babel-helper-builder-binary-assignment-operator-visitor "7.0.0-alpha.1" babel-plugin-syntax-exponentiation-operator "7.0.0-alpha.1" -babel-plugin-transform-exponentiation-operator@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-7.0.0-alpha.3.tgz#d22d899d0489573dc085be75f5e4638a53debbd6" +babel-plugin-transform-exponentiation-operator@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-7.0.0-alpha.7.tgz#14d02d8c8d4c3dc7bf3114342c9f5a7185285ad2" dependencies: - babel-helper-builder-binary-assignment-operator-visitor "7.0.0-alpha.3" + babel-helper-builder-binary-assignment-operator-visitor "7.0.0-alpha.7" babel-plugin-syntax-exponentiation-operator "7.0.0-alpha.3" babel-plugin-transform-exponentiation-operator@^6.22.0: @@ -1299,9 +1339,9 @@ babel-plugin-transform-export-extensions@^6.22.0: babel-plugin-syntax-export-extensions "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-flow-strip-types@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-7.0.0-alpha.3.tgz#35681202b913f5b1a73d29a3f555dffff8ecad64" +babel-plugin-transform-flow-strip-types@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-7.0.0-alpha.7.tgz#90232361e08d183e7f366712ca1847017f600bf6" dependencies: babel-plugin-syntax-flow "7.0.0-alpha.3" @@ -1325,9 +1365,9 @@ babel-plugin-transform-regenerator@7.0.0-alpha.1: dependencies: regenerator-transform "0.9.8" -babel-plugin-transform-regenerator@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-7.0.0-alpha.3.tgz#5d76d87e8e1a0b73bf77aaefd704cdb535182a4e" +babel-plugin-transform-regenerator@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-7.0.0-alpha.7.tgz#2a9ea26acbd7d63a379131667485b64f6ac9d0c2" dependencies: regenerator-transform "0.9.11" @@ -1343,11 +1383,11 @@ babel-plugin-transform-strict-mode@7.0.0-alpha.1: dependencies: babel-types "7.0.0-alpha.1" -babel-plugin-transform-strict-mode@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-7.0.0-alpha.3.tgz#308068db94074f368eac190a854ebaf43118e03f" +babel-plugin-transform-strict-mode@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-7.0.0-alpha.7.tgz#90b2812844e8f2b47d4da4fb98e892fd214e4fe5" dependencies: - babel-types "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" babel-plugin-transform-strict-mode@^6.22.0: version "6.22.0" @@ -1363,6 +1403,13 @@ babel-polyfill@7.0.0-alpha.3: core-js "^2.4.0" regenerator-runtime "^0.10.0" +babel-polyfill@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-7.0.0-alpha.7.tgz#97218220deb8f325a7ae5539ea617a382fd9be6f" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.10.0" + babel-polyfill@latest: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d" @@ -1494,6 +1541,17 @@ babel-register@7.0.0-alpha.6: mkdirp "^0.5.1" source-map-support "^0.4.2" +babel-register@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-7.0.0-alpha.7.tgz#e3f1de53740f270052088f6fbbcd1b5ce3f0cdee" + dependencies: + babel-core "7.0.0-alpha.7" + core-js "^2.4.0" + home-or-tmp "^3.0.0" + lodash "^4.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.2" + babel-register@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.0.tgz#5e89f8463ba9970356d02eb07dabe3308b080cfd" @@ -1531,6 +1589,15 @@ babel-template@7.0.0-alpha.3: babylon "7.0.0-beta.7" lodash "^4.2.0" +babel-template@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.7.tgz#82e26500980d1b3f14d9ebe8ae8b9325dc158392" + dependencies: + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" + babylon "7.0.0-beta.8" + lodash "^4.2.0" + babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" @@ -1567,6 +1634,19 @@ babel-traverse@7.0.0-alpha.3: invariant "^2.2.0" lodash "^4.2.0" +babel-traverse@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.7.tgz#61cc89061b0ad0a5f9fc6df81117fac428bc4148" + dependencies: + babel-code-frame "7.0.0-alpha.3" + babel-messages "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" + babylon "7.0.0-beta.8" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" @@ -1597,6 +1677,14 @@ babel-types@7.0.0-alpha.3: lodash "^4.2.0" to-fast-properties "^1.0.1" +babel-types@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.7.tgz#4bdb77386d1f6e2001f42fa9ac21b6c3d6ad0d82" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + babel-types@^6.15.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" @@ -1618,6 +1706,10 @@ babylon@7.0.0-beta.7: version "7.0.0-beta.7" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.7.tgz#61454c26b0e285ffe826dd237d5b5d179f602e16" +babylon@7.0.0-beta.8: + version "7.0.0-beta.8" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" + babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: version "6.16.1" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" @@ -2174,7 +2266,7 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -electron-to-chromium@^1.3.2: +electron-to-chromium@^1.1.0, electron-to-chromium@^1.2.5, electron-to-chromium@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.2.tgz#b8ce5c93b308db0e92f6d0435c46ddec8f6363ab" @@ -2683,6 +2775,16 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" +glob@5.0.x, glob@^5.0.15: + version "5.0.15" + resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@7.0.5, glob@^7.0.0, glob@^7.0.3: version "7.0.5" resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" @@ -2694,7 +2796,7 @@ glob@7.0.5, glob@^7.0.0, glob@^7.0.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.5, glob@^7.0.6: +glob@7.1.1, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: From c63c2fc49bcbab9ccdd827c1d57385ddb5f29d06 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 6 Apr 2017 17:27:06 -0400 Subject: [PATCH 14/14] fix warning, readme [skip ci] --- experimental/babel-preset-env/README.md | 2 +- .../babel-preset-env/src/use-built-ins-plugin.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/experimental/babel-preset-env/README.md b/experimental/babel-preset-env/README.md index 794630c861..d34193086e 100644 --- a/experimental/babel-preset-env/README.md +++ b/experimental/babel-preset-env/README.md @@ -174,7 +174,7 @@ This option is useful for "blacklisting" a transform like `transform-regenerator ### `useBuiltIns` -`boolean`, defaults to `true`. +`boolean` | `"entry"`, defaults to `true`. A way to apply `babel-preset-env` for polyfills (via `babel-polyfill`). diff --git a/experimental/babel-preset-env/src/use-built-ins-plugin.js b/experimental/babel-preset-env/src/use-built-ins-plugin.js index a764d44d8f..33e5c478ae 100644 --- a/experimental/babel-preset-env/src/use-built-ins-plugin.js +++ b/experimental/babel-preset-env/src/use-built-ins-plugin.js @@ -5,10 +5,10 @@ function isPolyfillSource(value) { } function warnOnInstanceMethod(state, details) { - state.opts.debug && - console.warn( - `Adding a polyfill: An instance method may have been used: ${details}`, - ); + // state.opts.debug && + // console.warn( + // `Adding a polyfill: An instance method may have been used: ${details}`, + // ); } function has(obj, key) { @@ -68,8 +68,8 @@ export default function({ types: t }) { ) { console.warn( ` -When setting 'useBuiltIns: true', polyfills are automatically imported when needed. -Please remove the call or use 'useBuiltIns: "entry"' instead. +When setting "useBuiltIns: true", polyfills are automatically imported when needed. +Please remove the "import 'babel-polyfill'" call or use "useBuiltIns: 'entry'" instead. `, ); path.remove(); @@ -90,8 +90,8 @@ to the "transform-polyfill-require" plugin if (isRequire(bodyPath)) { console.warn( ` -When setting 'useBuiltIns: true', polyfills are automatically imported when needed. -Please remove the call or use 'useBuiltIns: "entry"' instead. +When setting "useBuiltIns: true", polyfills are automatically imported when needed. +Please remove the "require('babel-polyfill')" call or use "useBuiltIns: 'entry'" instead. `, ); path.remove();