Move polyfill debug into useBuiltInsEntry plugin (#280)

This commit is contained in:
Brian Ng 2017-04-13 16:42:02 -05:00 committed by Henry Zhu
parent e4d2c4e346
commit 1fca73a1b7
9 changed files with 58 additions and 184 deletions

View File

@ -144,12 +144,6 @@ export default function buildPreset(context, opts = {}) {
transformations.forEach(transform => {
logPlugin(transform, targets, pluginList);
});
if (useBuiltIns && polyfills.length) {
console.log("\nUsing polyfills:");
polyfills.forEach(polyfill => {
logPlugin(polyfill, polyfillTargets, builtInsList);
});
}
}
const regenerator = transformations.indexOf("transform-regenerator") >= 0;
@ -167,13 +161,30 @@ export default function buildPreset(context, opts = {}) {
]),
);
if (debug) {
console.log("");
console.log("Polyfills");
console.log("=========");
console.log("");
}
if (useBuiltIns === true) {
plugins.push([
addUsedBuiltInsPlugin,
{ polyfills: new Set(polyfills), regenerator, debug },
]);
} else if (useBuiltIns === "entry") {
plugins.push([useBuiltInsEntryPlugin, { polyfills, regenerator }]);
plugins.push([
useBuiltInsEntryPlugin,
{
debug,
polyfills,
regenerator,
onDebug: polyfill => logPlugin(polyfill, polyfillTargets, builtInsList),
},
]);
} else if (debug) {
console.log("None were added, since the `useBuiltIns` option was not set.");
}
return {

View File

@ -84,5 +84,18 @@ export default function({ types: t }) {
pre() {
this.numPolyfillImports = 0;
},
post() {
const { debug, onDebug, polyfills } = this.opts;
if (debug) {
if (!polyfills.length) {
console.log("Based on your targets, none were added.");
return;
}
console.log("Replaced `babel-polyfill` with the following polyfills:");
polyfills.forEach(polyfill => onDebug(polyfill));
}
},
};
}

View File

@ -33,7 +33,10 @@ Using plugins:
transform-async-to-generator {"uglify":true}
syntax-trailing-function-commas {"chrome":"55","uglify":true}
Using polyfills:
Polyfills
=========
Replaced `babel-polyfill` with the following polyfills:
es7.string.pad-start {"chrome":"55"}
es7.string.pad-end {"chrome":"55"}
web.timers {"chrome":"55"}

View File

@ -34,7 +34,10 @@ Using plugins:
transform-async-to-generator {"chrome":"54","ie":"10","node":"6"}
syntax-trailing-function-commas {"chrome":"54","ie":"10","node":"6"}
Using polyfills:
Polyfills
=========
Replaced `babel-polyfill` with the following polyfills:
es6.typed.array-buffer {"ie":"10","node":"6"}
es6.typed.int8-array {"ie":"10","node":"6"}
es6.typed.uint8-array {"ie":"10","node":"6"}

View File

@ -28,7 +28,10 @@ Using plugins:
transform-async-to-generator {"electron":"0.36"}
syntax-trailing-function-commas {"electron":"0.36"}
Using polyfills:
Polyfills
=========
Replaced `babel-polyfill` with the following polyfills:
es6.typed.array-buffer {"electron":"0.36"}
es6.typed.data-view {"electron":"0.36"}
es6.typed.int8-array {"electron":"0.36"}

View File

@ -21,4 +21,9 @@ Using plugins:
transform-es2015-function-name {"firefox":"52"}
transform-es2015-literals {"firefox":"52"}
syntax-trailing-function-commas {"node":"7.4"}
Polyfills
=========
None were added, since the `useBuiltIns` option was not set.
src/in.js -> lib/in.js

View File

@ -37,7 +37,10 @@ Using plugins:
transform-async-to-generator {"chrome":"54","edge":"13","firefox":"49","ie":"10","ios":"9","safari":"7"}
syntax-trailing-function-commas {"chrome":"54","edge":"13","firefox":"49","ie":"10","ios":"9","safari":"7"}
Using polyfills:
Polyfills
=========
Replaced `babel-polyfill` with the following polyfills:
es6.typed.array-buffer {"ie":"10","ios":"9","safari":"7"}
es6.typed.int8-array {"ie":"10","ios":"9","safari":"7"}
es6.typed.uint8-array {"ie":"10","ios":"9","safari":"7"}

View File

@ -43,91 +43,7 @@ Using plugins:
transform-async-to-generator {"chrome":"54","electron":"0.36","node":"6.1","ie":"10"}
syntax-trailing-function-commas {"chrome":"54","electron":"0.36","node":"6.1","ie":"10"}
Using polyfills:
es6.typed.array-buffer {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.data-view {"electron":"0.36"}
es6.typed.int8-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.uint8-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.uint8-clamped-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.int16-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.uint16-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.int32-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.uint32-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.float32-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.typed.float64-array {"electron":"0.36","node":"6.1","ie":"10"}
es6.map {"electron":"0.36","node":"6.1","ie":"10"}
es6.set {"electron":"0.36","node":"6.1","ie":"10"}
es6.weak-map {"electron":"0.36","node":"6.1","ie":"10"}
es6.weak-set {"electron":"0.36","node":"6.1","ie":"10"}
es6.reflect.apply {"electron":"0.36","ie":"10"}
es6.reflect.construct {"electron":"0.36","ie":"10"}
es6.reflect.define-property {"electron":"0.36","ie":"10"}
es6.reflect.delete-property {"electron":"0.36","ie":"10"}
es6.reflect.get {"electron":"0.36","ie":"10"}
es6.reflect.get-own-property-descriptor {"electron":"0.36","ie":"10"}
es6.reflect.get-prototype-of {"electron":"0.36","ie":"10"}
es6.reflect.has {"electron":"0.36","ie":"10"}
es6.reflect.is-extensible {"electron":"0.36","ie":"10"}
es6.reflect.own-keys {"electron":"0.36","ie":"10"}
es6.reflect.prevent-extensions {"electron":"0.36","ie":"10"}
es6.reflect.set {"electron":"0.36","ie":"10"}
es6.reflect.set-prototype-of {"electron":"0.36","ie":"10"}
es6.promise {"electron":"0.36","node":"6.1","ie":"10"}
es6.symbol {"electron":"0.36","node":"6.1","ie":"10"}
es6.object.assign {"ie":"10"}
es6.object.is {"ie":"10"}
es6.object.set-prototype-of {"ie":"10"}
es6.function.name {"electron":"0.36","node":"6.1","ie":"10"}
es6.string.raw {"ie":"10"}
es6.string.from-code-point {"ie":"10"}
es6.string.code-point-at {"ie":"10"}
es6.string.repeat {"ie":"10"}
es6.string.starts-with {"ie":"10"}
es6.string.ends-with {"ie":"10"}
es6.string.includes {"ie":"10"}
es6.regexp.flags {"electron":"0.36","ie":"10"}
es6.regexp.match {"electron":"0.36","ie":"10"}
es6.regexp.replace {"electron":"0.36","ie":"10"}
es6.regexp.split {"electron":"0.36","ie":"10"}
es6.regexp.search {"electron":"0.36","ie":"10"}
es6.array.from {"electron":"0.36","node":"6.1","ie":"10"}
es6.array.of {"ie":"10"}
es6.array.copy-within {"ie":"10"}
es6.array.find {"ie":"10"}
es6.array.find-index {"ie":"10"}
es6.array.fill {"ie":"10"}
es6.array.iterator {"ie":"10"}
es6.number.is-finite {"ie":"10"}
es6.number.is-integer {"ie":"10"}
es6.number.is-safe-integer {"ie":"10"}
es6.number.is-nan {"ie":"10"}
es6.number.epsilon {"ie":"10"}
es6.number.min-safe-integer {"ie":"10"}
es6.number.max-safe-integer {"ie":"10"}
es6.math.acosh {"ie":"10"}
es6.math.asinh {"ie":"10"}
es6.math.atanh {"ie":"10"}
es6.math.cbrt {"ie":"10"}
es6.math.clz32 {"ie":"10"}
es6.math.cosh {"ie":"10"}
es6.math.expm1 {"ie":"10"}
es6.math.fround {"ie":"10"}
es6.math.hypot {"ie":"10"}
es6.math.imul {"ie":"10"}
es6.math.log1p {"ie":"10"}
es6.math.log10 {"ie":"10"}
es6.math.log2 {"ie":"10"}
es6.math.sign {"ie":"10"}
es6.math.sinh {"ie":"10"}
es6.math.tanh {"ie":"10"}
es6.math.trunc {"ie":"10"}
es7.array.includes {"ie":"10"}
es7.object.values {"electron":"0.36","node":"6.1","ie":"10"}
es7.object.entries {"electron":"0.36","node":"6.1","ie":"10"}
es7.object.get-own-property-descriptors {"electron":"0.36","node":"6.1","ie":"10"}
es7.string.pad-start {"chrome":"54","electron":"0.36","node":"6.1","ie":"10"}
es7.string.pad-end {"chrome":"54","electron":"0.36","node":"6.1","ie":"10"}
web.timers {"chrome":"54","electron":"0.36","node":"6.1","ie":"10"}
web.immediate {"chrome":"54","electron":"0.36","node":"6.1","ie":"10"}
web.dom.iterable {"chrome":"54","electron":"0.36","node":"6.1","ie":"10"}
Polyfills
=========
src/in.js -> lib/in.js

View File

@ -34,90 +34,7 @@ Using plugins:
transform-async-to-generator {"chrome":"54","node":"6.10","ie":"10"}
syntax-trailing-function-commas {"chrome":"54","node":"6.10","ie":"10"}
Using polyfills:
es6.typed.array-buffer {"ie":"10"}
es6.typed.int8-array {"ie":"10"}
es6.typed.uint8-array {"ie":"10"}
es6.typed.uint8-clamped-array {"ie":"10"}
es6.typed.int16-array {"ie":"10"}
es6.typed.uint16-array {"ie":"10"}
es6.typed.int32-array {"ie":"10"}
es6.typed.uint32-array {"ie":"10"}
es6.typed.float32-array {"ie":"10"}
es6.typed.float64-array {"ie":"10"}
es6.map {"ie":"10"}
es6.set {"ie":"10"}
es6.weak-map {"ie":"10"}
es6.weak-set {"ie":"10"}
es6.reflect.apply {"ie":"10"}
es6.reflect.construct {"ie":"10"}
es6.reflect.define-property {"ie":"10"}
es6.reflect.delete-property {"ie":"10"}
es6.reflect.get {"ie":"10"}
es6.reflect.get-own-property-descriptor {"ie":"10"}
es6.reflect.get-prototype-of {"ie":"10"}
es6.reflect.has {"ie":"10"}
es6.reflect.is-extensible {"ie":"10"}
es6.reflect.own-keys {"ie":"10"}
es6.reflect.prevent-extensions {"ie":"10"}
es6.reflect.set {"ie":"10"}
es6.reflect.set-prototype-of {"ie":"10"}
es6.promise {"ie":"10"}
es6.symbol {"ie":"10"}
es6.object.assign {"ie":"10"}
es6.object.is {"ie":"10"}
es6.object.set-prototype-of {"ie":"10"}
es6.function.name {"ie":"10"}
es6.string.raw {"ie":"10"}
es6.string.from-code-point {"ie":"10"}
es6.string.code-point-at {"ie":"10"}
es6.string.repeat {"ie":"10"}
es6.string.starts-with {"ie":"10"}
es6.string.ends-with {"ie":"10"}
es6.string.includes {"ie":"10"}
es6.regexp.flags {"ie":"10"}
es6.regexp.match {"ie":"10"}
es6.regexp.replace {"ie":"10"}
es6.regexp.split {"ie":"10"}
es6.regexp.search {"ie":"10"}
es6.array.from {"ie":"10"}
es6.array.of {"ie":"10"}
es6.array.copy-within {"ie":"10"}
es6.array.find {"ie":"10"}
es6.array.find-index {"ie":"10"}
es6.array.fill {"ie":"10"}
es6.array.iterator {"ie":"10"}
es6.number.is-finite {"ie":"10"}
es6.number.is-integer {"ie":"10"}
es6.number.is-safe-integer {"ie":"10"}
es6.number.is-nan {"ie":"10"}
es6.number.epsilon {"ie":"10"}
es6.number.min-safe-integer {"ie":"10"}
es6.number.max-safe-integer {"ie":"10"}
es6.math.acosh {"ie":"10"}
es6.math.asinh {"ie":"10"}
es6.math.atanh {"ie":"10"}
es6.math.cbrt {"ie":"10"}
es6.math.clz32 {"ie":"10"}
es6.math.cosh {"ie":"10"}
es6.math.expm1 {"ie":"10"}
es6.math.fround {"ie":"10"}
es6.math.hypot {"ie":"10"}
es6.math.imul {"ie":"10"}
es6.math.log1p {"ie":"10"}
es6.math.log10 {"ie":"10"}
es6.math.log2 {"ie":"10"}
es6.math.sign {"ie":"10"}
es6.math.sinh {"ie":"10"}
es6.math.tanh {"ie":"10"}
es6.math.trunc {"ie":"10"}
es7.array.includes {"ie":"10"}
es7.object.values {"node":"6.10","ie":"10"}
es7.object.entries {"node":"6.10","ie":"10"}
es7.object.get-own-property-descriptors {"node":"6.10","ie":"10"}
es7.string.pad-start {"chrome":"54","node":"6.10","ie":"10"}
es7.string.pad-end {"chrome":"54","node":"6.10","ie":"10"}
web.timers {"chrome":"54","node":"6.10","ie":"10"}
web.immediate {"chrome":"54","node":"6.10","ie":"10"}
web.dom.iterable {"chrome":"54","node":"6.10","ie":"10"}
Polyfills
=========
src/in.js -> lib/in.js