Archive @babel/preset-env-standalone (#10993)
* Move @babel/preset-env-standalone to babel-archive babel/babel-archive@a1fadd2d77 * Move tests to @babel/standalone * Remove references in build scripts * Update lockfile * Delete duplicated test file. It's already in babel-standalone/test/babel.js
This commit is contained in:
parent
761563571c
commit
755ec192e2
@ -25,12 +25,6 @@ aliases:
|
|||||||
- &artifact_babel_min
|
- &artifact_babel_min
|
||||||
path: ~/babel/packages/babel-standalone/babel.min.js
|
path: ~/babel/packages/babel-standalone/babel.min.js
|
||||||
|
|
||||||
- &artifact_env
|
|
||||||
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.js
|
|
||||||
|
|
||||||
- &artifact_env_min
|
|
||||||
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
|
|
||||||
|
|
||||||
- &test262_workdir
|
- &test262_workdir
|
||||||
working_directory: ~/babel/babel-test262-runner
|
working_directory: ~/babel/babel-test262-runner
|
||||||
|
|
||||||
@ -69,8 +63,6 @@ jobs:
|
|||||||
- run: yarn jest "\-standalone/test"
|
- run: yarn jest "\-standalone/test"
|
||||||
- store_artifacts: *artifact_babel
|
- store_artifacts: *artifact_babel
|
||||||
- store_artifacts: *artifact_babel_min
|
- store_artifacts: *artifact_babel_min
|
||||||
- store_artifacts: *artifact_env
|
|
||||||
- store_artifacts: *artifact_env_min
|
|
||||||
- save_cache: *save-node-modules-cache
|
- save_cache: *save-node-modules-cache
|
||||||
- save_cache: *save-yarn-cache
|
- save_cache: *save-yarn-cache
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,6 @@ codemods/*/test/tmp
|
|||||||
packages/babel-compat-data/build
|
packages/babel-compat-data/build
|
||||||
packages/babel-preset-env/data/[^(plugin-features|shipped-proposals).js]
|
packages/babel-preset-env/data/[^(plugin-features|shipped-proposals).js]
|
||||||
packages/babel-preset-env/test/debug-fixtures
|
packages/babel-preset-env/test/debug-fixtures
|
||||||
packages/babel-preset-env-standalone/babel-preset-env.js
|
|
||||||
packages/babel-preset-env-standalone/babel-preset-env.min.js
|
|
||||||
packages/babel-standalone/babel.js
|
packages/babel-standalone/babel.js
|
||||||
packages/babel-standalone/babel.min.js
|
packages/babel-standalone/babel.min.js
|
||||||
packages/babel-parser/test/expressions
|
packages/babel-parser/test/expressions
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -56,9 +56,6 @@ package-lock.json
|
|||||||
packages/babel-standalone/babel.js
|
packages/babel-standalone/babel.js
|
||||||
packages/babel-standalone/babel.js.map
|
packages/babel-standalone/babel.js.map
|
||||||
packages/babel-standalone/babel.min.js
|
packages/babel-standalone/babel.min.js
|
||||||
packages/babel-preset-env-standalone/babel-preset-env.js
|
|
||||||
packages/babel-preset-env-standalone/babel-preset-env.js.map
|
|
||||||
packages/babel-preset-env-standalone/babel-preset-env.min.js
|
|
||||||
/codemods/*/lib
|
/codemods/*/lib
|
||||||
/codemods/*/node_modules
|
/codemods/*/node_modules
|
||||||
/packages/babel-parser/build
|
/packages/babel-parser/build
|
||||||
|
|||||||
56
Gulpfile.js
56
Gulpfile.js
@ -11,7 +11,6 @@ const filter = require("gulp-filter");
|
|||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const rollup = require("rollup");
|
const rollup = require("rollup");
|
||||||
const rollupAlias = require("@rollup/plugin-alias");
|
|
||||||
const rollupBabel = require("rollup-plugin-babel");
|
const rollupBabel = require("rollup-plugin-babel");
|
||||||
const rollupBabelSource = require("./scripts/rollup-plugin-babel-source");
|
const rollupBabelSource = require("./scripts/rollup-plugin-babel-source");
|
||||||
const rollupCommonJs = require("rollup-plugin-commonjs");
|
const rollupCommonJs = require("rollup-plugin-commonjs");
|
||||||
@ -88,9 +87,7 @@ function buildRollup(packages) {
|
|||||||
packages.map(
|
packages.map(
|
||||||
({ src, format, dest, name, filename, version = babelVersion }) => {
|
({ src, format, dest, name, filename, version = babelVersion }) => {
|
||||||
const extraPlugins = [];
|
const extraPlugins = [];
|
||||||
let inputExternal = undefined,
|
let nodeResolveBrowser = false,
|
||||||
outputGlobals = undefined,
|
|
||||||
nodeResolveBrowser = false,
|
|
||||||
babelEnvName = "rollup";
|
babelEnvName = "rollup";
|
||||||
switch (src) {
|
switch (src) {
|
||||||
case "packages/babel-standalone":
|
case "packages/babel-standalone":
|
||||||
@ -104,39 +101,6 @@ function buildRollup(packages) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "packages/babel-preset-env-standalone":
|
|
||||||
nodeResolveBrowser = true;
|
|
||||||
babelEnvName = "standalone";
|
|
||||||
if (minify) {
|
|
||||||
extraPlugins.push(
|
|
||||||
rollupTerser({
|
|
||||||
include: /^.+\.min\.js$/,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
inputExternal = ["@babel/standalone"];
|
|
||||||
outputGlobals = {
|
|
||||||
"@babel/standalone": "Babel",
|
|
||||||
};
|
|
||||||
extraPlugins.push(
|
|
||||||
rollupAlias({
|
|
||||||
entries: [
|
|
||||||
{
|
|
||||||
find: "./available-plugins",
|
|
||||||
replacement: require.resolve(
|
|
||||||
path.join(__dirname, src, "./src/available-plugins")
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: "caniuse-lite/data/regions",
|
|
||||||
replacement: require.resolve(
|
|
||||||
path.join(__dirname, src, "./src/caniuse-lite-regions")
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
// If this build is part of a pull request, include the pull request number in
|
// If this build is part of a pull request, include the pull request number in
|
||||||
// the version number.
|
// the version number.
|
||||||
@ -150,7 +114,6 @@ function buildRollup(packages) {
|
|||||||
return rollup
|
return rollup
|
||||||
.rollup({
|
.rollup({
|
||||||
input,
|
input,
|
||||||
external: inputExternal,
|
|
||||||
plugins: [
|
plugins: [
|
||||||
...extraPlugins,
|
...extraPlugins,
|
||||||
rollupBabelSource(),
|
rollupBabelSource(),
|
||||||
@ -208,7 +171,6 @@ function buildRollup(packages) {
|
|||||||
file: outputFile,
|
file: outputFile,
|
||||||
format,
|
format,
|
||||||
name,
|
name,
|
||||||
globals: outputGlobals,
|
|
||||||
sourcemap: sourcemap,
|
sourcemap: sourcemap,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -232,7 +194,6 @@ function buildRollup(packages) {
|
|||||||
file: outputFile.replace(/\.js$/, ".min.js"),
|
file: outputFile.replace(/\.js$/, ".min.js"),
|
||||||
format,
|
format,
|
||||||
name,
|
name,
|
||||||
globals: outputGlobals,
|
|
||||||
sourcemap: sourcemap,
|
sourcemap: sourcemap,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -262,24 +223,9 @@ const standaloneBundle = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const presetEnvStandaloneBundle = [
|
|
||||||
{
|
|
||||||
src: "packages/babel-preset-env-standalone",
|
|
||||||
format: "umd",
|
|
||||||
name: "BabelPresetEnv",
|
|
||||||
filename: "babel-preset-env.js",
|
|
||||||
dest: "",
|
|
||||||
version: require("./packages/babel-preset-env/package").version,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
gulp.task("build-rollup", () => buildRollup(libBundles));
|
gulp.task("build-rollup", () => buildRollup(libBundles));
|
||||||
gulp.task("build-babel-standalone", () => buildRollup(standaloneBundle));
|
gulp.task("build-babel-standalone", () => buildRollup(standaloneBundle));
|
||||||
|
|
||||||
gulp.task("build-babel-preset-env-standalone", () =>
|
|
||||||
buildRollup(presetEnvStandaloneBundle)
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("build-babel", () => buildBabel(/* exclude */ libBundles));
|
gulp.task("build-babel", () => buildBabel(/* exclude */ libBundles));
|
||||||
gulp.task("build-babel-types", () =>
|
gulp.task("build-babel-types", () =>
|
||||||
buildBabel(/* exclude */ libBundles, "packages/babel-types/src/**/*.js")
|
buildBabel(/* exclude */ libBundles, "packages/babel-types/src/**/*.js")
|
||||||
|
|||||||
10
Makefile
10
Makefile
@ -2,7 +2,7 @@ FLOW_COMMIT = a1f9a4c709dcebb27a5084acf47755fbae699c25
|
|||||||
TEST262_COMMIT = 28b4fcca4b1b1d278dfe0cc0e69c7d9d59b31aab
|
TEST262_COMMIT = 28b4fcca4b1b1d278dfe0cc0e69c7d9d59b31aab
|
||||||
TYPESCRIPT_COMMIT = 5fc917be2e4dd64c8e9504d36615cd7fbfdd4cd3
|
TYPESCRIPT_COMMIT = 5fc917be2e4dd64c8e9504d36615cd7fbfdd4cd3
|
||||||
|
|
||||||
FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone"
|
||||||
|
|
||||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||||
export FORCE_COLOR = true
|
export FORCE_COLOR = true
|
||||||
@ -50,7 +50,7 @@ build-flow-typings:
|
|||||||
build-typescript-typings:
|
build-typescript-typings:
|
||||||
$(NODE) packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts
|
$(NODE) packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts
|
||||||
|
|
||||||
build-standalone: build-babel-standalone build-preset-env-standalone
|
build-standalone: build-babel-standalone
|
||||||
|
|
||||||
build-standalone-ci: build-bundle-ci
|
build-standalone-ci: build-bundle-ci
|
||||||
$(MAKE) build-standalone
|
$(MAKE) build-standalone
|
||||||
@ -58,15 +58,9 @@ build-standalone-ci: build-bundle-ci
|
|||||||
build-babel-standalone:
|
build-babel-standalone:
|
||||||
$(YARN) gulp build-babel-standalone
|
$(YARN) gulp build-babel-standalone
|
||||||
|
|
||||||
build-preset-env-standalone:
|
|
||||||
$(YARN) gulp build-babel-preset-env-standalone
|
|
||||||
|
|
||||||
prepublish-build-standalone:
|
prepublish-build-standalone:
|
||||||
BABEL_ENV=production IS_PUBLISH=true $(YARN) gulp build-babel-standalone
|
BABEL_ENV=production IS_PUBLISH=true $(YARN) gulp build-babel-standalone
|
||||||
|
|
||||||
prepublish-build-preset-env-standalone:
|
|
||||||
BABEL_ENV=production IS_PUBLISH=true $(YARN) gulp build-babel-preset-env-standalone
|
|
||||||
|
|
||||||
build-dist: build-polyfill-dist build-plugin-transform-runtime-dist
|
build-dist: build-polyfill-dist build-plugin-transform-runtime-dist
|
||||||
|
|
||||||
build-polyfill-dist:
|
build-polyfill-dist:
|
||||||
|
|||||||
@ -89,7 +89,6 @@ module.exports = function(api) {
|
|||||||
"packages/*/test/fixtures",
|
"packages/*/test/fixtures",
|
||||||
ignoreLib ? "packages/*/lib" : null,
|
ignoreLib ? "packages/*/lib" : null,
|
||||||
"packages/babel-standalone/babel.js",
|
"packages/babel-standalone/babel.js",
|
||||||
"packages/babel-preset-env-standalone/babel-preset-env.js",
|
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
presets: [["@babel/env", envOpts]],
|
presets: [["@babel/env", envOpts]],
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|||||||
@ -45,14 +45,12 @@ module.exports = {
|
|||||||
transformIgnorePatterns: [
|
transformIgnorePatterns: [
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
||||||
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
|
||||||
"/test/(fixtures|tmp|__data__)/",
|
"/test/(fixtures|tmp|__data__)/",
|
||||||
"<rootDir>/(packages|codemods|eslint)/[^/]+/lib/",
|
"<rootDir>/(packages|codemods|eslint)/[^/]+/lib/",
|
||||||
],
|
],
|
||||||
coveragePathIgnorePatterns: [
|
coveragePathIgnorePatterns: [
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
||||||
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
|
||||||
"/test/(fixtures|tmp|__data__)/",
|
"/test/(fixtures|tmp|__data__)/",
|
||||||
],
|
],
|
||||||
modulePathIgnorePatterns: [
|
modulePathIgnorePatterns: [
|
||||||
|
|||||||
@ -27,7 +27,6 @@
|
|||||||
"@babel/preset-flow": "^7.8.3",
|
"@babel/preset-flow": "^7.8.3",
|
||||||
"@babel/register": "^7.8.3",
|
"@babel/register": "^7.8.3",
|
||||||
"@babel/runtime": "^7.8.4",
|
"@babel/runtime": "^7.8.4",
|
||||||
"@rollup/plugin-alias": "^2.2.0",
|
|
||||||
"@rollup/plugin-json": "^4.0.0",
|
"@rollup/plugin-json": "^4.0.0",
|
||||||
"babel-eslint": "^11.0.0-beta.2",
|
"babel-eslint": "^11.0.0-beta.2",
|
||||||
"babel-jest": "^24.9.0",
|
"babel-jest": "^24.9.0",
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
# @babel/preset-env-standalone
|
|
||||||
|
|
||||||
> Standalone build of babel-preset-env for use in non-Node.js environments.
|
|
||||||
|
|
||||||
See our website [@babel/preset-env-standalone](https://babeljs.io/docs/en/next/babel-preset-env-standalone.html) for more information.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install --save-dev @babel/preset-env-standalone
|
|
||||||
```
|
|
||||||
|
|
||||||
or using yarn:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn add @babel/preset-env-standalone --dev
|
|
||||||
```
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@babel/preset-env-standalone",
|
|
||||||
"version": "7.8.3",
|
|
||||||
"description": "Standalone build of babel-preset-env for use in non-Node.js environments.",
|
|
||||||
"main": "babel-preset-env.js",
|
|
||||||
"files": [
|
|
||||||
"babel-preset-env.js",
|
|
||||||
"babel-preset-env.min.js"
|
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"prepublishOnly": "cd ../.. && make prepublish-build-preset-env-standalone"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/plugin-proposal-dynamic-import": "^7.8.3",
|
|
||||||
"@babel/plugin-proposal-json-strings": "^7.8.3",
|
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
|
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
|
|
||||||
"@babel/plugin-syntax-json-strings": "^7.8.0",
|
|
||||||
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0",
|
|
||||||
"@babel/plugin-syntax-optional-chaining": "^7.8.0",
|
|
||||||
"@babel/plugin-syntax-top-level-await": "^7.8.3",
|
|
||||||
"@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3",
|
|
||||||
"@babel/plugin-transform-new-target": "^7.8.3",
|
|
||||||
"@babel/preset-env": "^7.8.3",
|
|
||||||
"@babel/standalone": "^7.8.3",
|
|
||||||
"lodash": "^4.17.13"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"babel",
|
|
||||||
"babel-preset-env",
|
|
||||||
"babeljs",
|
|
||||||
"6to5",
|
|
||||||
"transpile",
|
|
||||||
"preset",
|
|
||||||
"standalone",
|
|
||||||
"transpiler"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/babel/babel/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/babel/babel/packages/babel-preset-env-standalone#readme",
|
|
||||||
"jest": {
|
|
||||||
"transformIgnorePatterns": [
|
|
||||||
"/node_modules/",
|
|
||||||
"babel-preset-env.js"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
/* eslint sort-keys: "error" */
|
|
||||||
|
|
||||||
import { availablePlugins, registerPlugin } from "@babel/standalone";
|
|
||||||
import proposalJsonStrings from "@babel/plugin-proposal-json-strings";
|
|
||||||
import proposalDynamicImport from "@babel/plugin-proposal-dynamic-import";
|
|
||||||
import proposalNullishCoalescingOperator from "@babel/plugin-proposal-nullish-coalescing-operator";
|
|
||||||
import proposalOptionalChaining from "@babel/plugin-proposal-optional-chaining";
|
|
||||||
import syntaxJsonStrings from "@babel/plugin-syntax-json-strings";
|
|
||||||
import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator";
|
|
||||||
import syntaxOptionalChaining from "@babel/plugin-syntax-nullish-coalescing-operator";
|
|
||||||
import syntaxTopLevelAwait from "@babel/plugin-syntax-top-level-await";
|
|
||||||
import transformNamedCapturingGroupsRegex from "@babel/plugin-transform-named-capturing-groups-regex";
|
|
||||||
import transformNewTarget from "@babel/plugin-transform-new-target";
|
|
||||||
|
|
||||||
const notIncludedPlugins = {
|
|
||||||
"proposal-dynamic-import": proposalDynamicImport,
|
|
||||||
"proposal-json-strings": proposalJsonStrings,
|
|
||||||
"proposal-nullish-coalescing-operator": proposalNullishCoalescingOperator,
|
|
||||||
"proposal-optional-chaining": proposalOptionalChaining,
|
|
||||||
"syntax-json-strings": syntaxJsonStrings,
|
|
||||||
"syntax-nullish-coalescing-operator": syntaxNullishCoalescingOperator,
|
|
||||||
"syntax-optional-chaining": syntaxOptionalChaining,
|
|
||||||
"syntax-top-level-await": syntaxTopLevelAwait,
|
|
||||||
"transform-named-capturing-groups-regex": transformNamedCapturingGroupsRegex,
|
|
||||||
"transform-new-target": transformNewTarget,
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.keys(notIncludedPlugins).forEach(pluginName => {
|
|
||||||
if (!availablePlugins[pluginName]) {
|
|
||||||
registerPlugin(pluginName, notIncludedPlugins[pluginName]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default availablePlugins;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
module.exports = {};
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
/* global VERSION */
|
|
||||||
|
|
||||||
import { registerPreset } from "@babel/standalone";
|
|
||||||
import babelPresetEnv from "@babel/preset-env";
|
|
||||||
|
|
||||||
registerPreset("env", babelPresetEnv);
|
|
||||||
|
|
||||||
export const version = VERSION;
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
import expectedAvailablePlugins from "@babel/preset-env/lib/available-plugins";
|
|
||||||
import difference from "lodash/difference";
|
|
||||||
|
|
||||||
// build-babel-preset-env-standalone in CI coverage tests is skipped, so we skip this test as well
|
|
||||||
(process.env.TEST_TYPE === "cov" ? describe.skip : describe)(
|
|
||||||
"available-plugins",
|
|
||||||
() => {
|
|
||||||
const actualAvailablePlugins = require("../lib/available-plugins").default;
|
|
||||||
it("should be a superset of available-plugins in @babel/preset-env", () => {
|
|
||||||
const expectedPluginList = Object.keys(expectedAvailablePlugins);
|
|
||||||
expectedPluginList.sort();
|
|
||||||
|
|
||||||
const actualPluginList = Object.keys(actualAvailablePlugins);
|
|
||||||
actualPluginList.sort();
|
|
||||||
// If this test is failed, add the missing plugins to ./src/available-plugins
|
|
||||||
expect(difference(expectedPluginList, actualPluginList)).toEqual([]);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
// build-babel-standalone in CI coverage tests is skipped, so we skip this test as well
|
|
||||||
(process.env.TEST_TYPE === "cov" ? describe.skip : describe)(
|
|
||||||
"babel-preset-env-standalone",
|
|
||||||
() => {
|
|
||||||
const Babel = require("@babel/standalone/babel");
|
|
||||||
jest.mock("Babel", () => require("@babel/standalone/babel"), {
|
|
||||||
virtual: true,
|
|
||||||
});
|
|
||||||
require("../babel-preset-env");
|
|
||||||
|
|
||||||
it("works w/o targets", () => {
|
|
||||||
const output = Babel.transform("const a = 1;", {
|
|
||||||
sourceType: "script",
|
|
||||||
presets: ["env"],
|
|
||||||
}).code;
|
|
||||||
expect(output).toBe("var a = 1;");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("doesn't transpile `const` with chrome 60", () => {
|
|
||||||
const output = Babel.transform("const a = 1;", {
|
|
||||||
sourceType: "script",
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
"env",
|
|
||||||
{
|
|
||||||
targets: {
|
|
||||||
chrome: 60,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
}).code;
|
|
||||||
expect(output).toBe("const a = 1;");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("transpiles `const` with chrome 60 and preset-es2015", () => {
|
|
||||||
const output = Babel.transform("const a = 1;", {
|
|
||||||
sourceType: "script",
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
"env",
|
|
||||||
{
|
|
||||||
targets: {
|
|
||||||
chrome: 60,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"es2015",
|
|
||||||
],
|
|
||||||
}).code;
|
|
||||||
expect(output).toBe("var a = 1;");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("uses transform-new-targets plugin", () => {
|
|
||||||
const output = Babel.transform("function Foo() {new.target}", {
|
|
||||||
sourceType: "script",
|
|
||||||
presets: ["env"],
|
|
||||||
}).code;
|
|
||||||
expect(output).toBe(
|
|
||||||
"function Foo() {\n this instanceof Foo ? this.constructor : void 0;\n}",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@ -1819,13 +1819,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" ">= 8"
|
"@types/node" ">= 8"
|
||||||
|
|
||||||
"@rollup/plugin-alias@^2.2.0":
|
|
||||||
version "2.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-2.2.0.tgz#3ac52ece8b39583249884adb90fb316484389fe5"
|
|
||||||
integrity sha512-//6zmlHGbmousaatu4pBlC61gqZykLbH0c2GESBO4JgK5xFZgb/ih0zlg/5/BmTAczX5R/xsHRnsYsu4KyHV5w==
|
|
||||||
dependencies:
|
|
||||||
slash "^3.0.0"
|
|
||||||
|
|
||||||
"@rollup/plugin-json@^4.0.0":
|
"@rollup/plugin-json@^4.0.0":
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.0.0.tgz#4462e83c7ad5544bef4a601a6e8450daedc4b69b"
|
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.0.0.tgz#4462e83c7ad5544bef4a601a6e8450daedc4b69b"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user