Scoped: fix more tests in preset-env [skip ci]

This commit is contained in:
Henry Zhu
2017-10-16 22:28:40 -04:00
parent 3400b3644b
commit 33af5f745a
11 changed files with 24 additions and 16 deletions

View File

@@ -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,
)}:`,
);

View File

@@ -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()}`);

View File

@@ -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,
),
);

View File

@@ -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,
// );
// }

View File

@@ -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();

View File

@@ -0,0 +1 @@
import "@babel/polyfill";

View File

@@ -0,0 +1,6 @@
import "@babel/polyfill";
import "@babel/polyfill";
require("@babel/polyfill");
require("@babel/polyfill");

View File

@@ -0,0 +1 @@
import "@babel/polyfill";

View File

@@ -1 +1 @@
import "@babel/template";
import "es6-promise";

View File

@@ -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) {

View File

@@ -3,7 +3,7 @@
"external-helpers",
["transform-es2015-modules-umd", {
"globals": {
"@babel/template": "baz"
"es6-promise": "Promise"
}
}]
]