Scoped: fix more tests in preset-env [skip ci]
This commit is contained in:
@@ -52,7 +52,7 @@ export const logEntryPolyfills = (
|
||||
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Replaced \`babel-polyfill\` with the following polyfill${wordEnds(
|
||||
[${filename}] Replaced \`@babel/polyfill\` with the following polyfill${wordEnds(
|
||||
polyfills.size,
|
||||
)}:`,
|
||||
);
|
||||
|
||||
@@ -211,7 +211,7 @@ export default function buildPreset(
|
||||
const pluginUseBuiltIns = useBuiltIns !== false;
|
||||
|
||||
// NOTE: not giving spec here yet to avoid compatibility issues when
|
||||
// babel-plugin-transform-es2015-modules-commonjs gets its spec mode
|
||||
// transform-es2015-modules-commonjs gets its spec mode
|
||||
if (modules !== false && moduleTransformations[modules]) {
|
||||
plugins.push([getPlugin(moduleTransformations[modules]), { loose }]);
|
||||
}
|
||||
@@ -227,7 +227,7 @@ export default function buildPreset(
|
||||
|
||||
if (debug && !hasBeenLogged) {
|
||||
hasBeenLogged = true;
|
||||
console.log("babel-preset-env: `DEBUG` option");
|
||||
console.log("@babel/preset-env: `DEBUG` option");
|
||||
console.log("\nUsing targets:");
|
||||
console.log(JSON.stringify(prettifyTargets(targets), null, 2));
|
||||
console.log(`\nUsing modules transform: ${modules.toString()}`);
|
||||
|
||||
@@ -11,7 +11,7 @@ type Plugin = {
|
||||
type RequireType = "require" | "import";
|
||||
|
||||
function isPolyfillSource(value: string): boolean {
|
||||
return value === "babel-polyfill";
|
||||
return value === "@babel/polyfill";
|
||||
}
|
||||
|
||||
export default function({ types: t }: { types: Object }): Plugin {
|
||||
@@ -45,7 +45,7 @@ export default function({ types: t }: { types: Object }): Plugin {
|
||||
core: ?boolean,
|
||||
): Object {
|
||||
if (core) {
|
||||
polyfill = `babel-polyfill/lib/core-js/modules/${polyfill}`;
|
||||
polyfill = `@babel/polyfill/lib/core-js/modules/${polyfill}`;
|
||||
}
|
||||
|
||||
if (requireType === "import") {
|
||||
@@ -67,7 +67,7 @@ export default function({ types: t }: { types: Object }): Plugin {
|
||||
if (regenerator) {
|
||||
imports.push(
|
||||
createImport(
|
||||
"babel-polyfill/lib/regenerator-runtime/runtime",
|
||||
"@babel/polyfill/lib/regenerator-runtime/runtime",
|
||||
requireType,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ type Plugin = {
|
||||
};
|
||||
|
||||
function isPolyfillSource(value: string): boolean {
|
||||
return value === "babel-polyfill";
|
||||
return value === "@babel/polyfill";
|
||||
}
|
||||
|
||||
// function warnOnInstanceMethod() {
|
||||
@@ -34,12 +34,12 @@ function has(obj: Object, key: string): boolean {
|
||||
// }
|
||||
|
||||
const modulePathMap = {
|
||||
"regenerator-runtime": "babel-polyfill/lib/regenerator-runtime/runtime",
|
||||
"regenerator-runtime": "@babel/polyfill/lib/regenerator-runtime/runtime",
|
||||
};
|
||||
|
||||
const getModulePath = module => {
|
||||
return (
|
||||
modulePathMap[module] || `babel-polyfill/lib/core-js/modules/${module}`
|
||||
modulePathMap[module] || `@babel/polyfill/lib/core-js/modules/${module}`
|
||||
);
|
||||
};
|
||||
|
||||
@@ -188,7 +188,7 @@ export default function({ types: t }: { types: Object }): Plugin {
|
||||
// if (obj.name === "Array" && prop.name === "from") {
|
||||
// addImport(
|
||||
// path,
|
||||
// "babel-polyfill/lib/core-js/modules/web.dom.iterable",
|
||||
// "@babel/polyfill/lib/core-js/modules/web.dom.iterable",
|
||||
// this.builtIns,
|
||||
// );
|
||||
// }
|
||||
|
||||
@@ -44,7 +44,7 @@ const assertTest = (stdout, stderr, opts) => {
|
||||
};
|
||||
|
||||
const buildTest = opts => {
|
||||
const binLoc = require.resolve("babel-cli/bin/babel");
|
||||
const binLoc = require.resolve("@babel/cli/bin/babel");
|
||||
|
||||
return callback => {
|
||||
clear();
|
||||
|
||||
1
experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/expected.js
vendored
Normal file
1
experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import "@babel/polyfill";
|
||||
@@ -0,0 +1,6 @@
|
||||
import "@babel/polyfill";
|
||||
import "@babel/polyfill";
|
||||
|
||||
require("@babel/polyfill");
|
||||
|
||||
require("@babel/polyfill");
|
||||
1
experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/expected.js
vendored
Normal file
1
experimental/babel-preset-env/test/fixtures/preset-options/exclude-built-ins/expected.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import "@babel/polyfill";
|
||||
@@ -1 +1 @@
|
||||
import "@babel/template";
|
||||
import "es6-promise";
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["@babel/template"], factory);
|
||||
define(["es6-promise"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(require("@babel/template"));
|
||||
factory(require("es6-promise"));
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(global.baz);
|
||||
factory(global.Promise);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (_babelTemplate) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"external-helpers",
|
||||
["transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"@babel/template": "baz"
|
||||
"es6-promise": "Promise"
|
||||
}
|
||||
}]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user