Skip to content

BREAKING CHANGES: bump Babel to 8.0.0-beta.1 #1889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
"es6"
],
"peerDependencies": {
"@babel/core": "^7.0.0",
"@types/babel__core": "^7.1.9",
"@babel/core": "^8.0.0-beta.1",
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
Expand All @@ -70,15 +69,13 @@
"@rollup/pluginutils": "^5.0.1"
},
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/plugin-external-helpers": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.19.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.19.1",
"@babel/preset-env": "^7.19.1",
"@babel/core": "^8.0.0-beta.1",
"@babel/plugin-external-helpers": "^8.0.0-beta.1",
"@babel/plugin-proposal-decorators": "^8.0.0-beta.1",
"@babel/plugin-transform-runtime": "^8.0.0-beta.1",
"@babel/preset-env": "^8.0.0-beta.1",
"@rollup/plugin-json": "^5.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@types/babel__core": "^7.1.9",
"rollup": "^4.0.0-24",
"source-map": "^0.7.4"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/babel/test/as-input-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ test('allows transform-runtime to inject esm version of helpers', async (t) => {
}
);
t.deepEqual(warnings, [
`"@babel/runtime/helpers/esm/createClass" is imported by "test/fixtures/runtime-helpers-esm/main.js", but could not be resolved – treating it as an external dependency.`,
`"@babel/runtime/helpers/esm/classCallCheck" is imported by "test/fixtures/runtime-helpers-esm/main.js", but could not be resolved – treating it as an external dependency.`
`"@babel/runtime/helpers/createClass" is imported by "test/fixtures/runtime-helpers-esm/main.js", but could not be resolved – treating it as an external dependency.`,
`"@babel/runtime/helpers/classCallCheck" is imported by "test/fixtures/runtime-helpers-esm/main.js", but could not be resolved – treating it as an external dependency.`
]);
t.is(
code,
`import _createClass from '@babel/runtime/helpers/esm/createClass';
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
`import _createClass from '@babel/runtime/helpers/createClass';
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';

var Foo = /*#__PURE__*/_createClass(function Foo() {
_classCallCheck(this, Foo);
Expand Down Expand Up @@ -540,7 +540,7 @@ test('can be used as an input plugin while transforming the output', async (t) =
input: `${FIXTURES}basic/main.js`,
plugins: [
getBabelOutputPlugin({
presets: ['@babel/env']
presets: [['@babel/env', { targets: 'firefox 2' }]]
})
]
});
Expand All @@ -556,7 +556,7 @@ test('works as a CJS plugin', async (t) => {
input: `${FIXTURES}basic/main.js`,
plugins: [
babelPluginCjs({
presets: ['@babel/env']
presets: [['@babel/env', { targets: 'firefox 2' }]]
})
]
});
Expand Down
33 changes: 16 additions & 17 deletions packages/babel/test/as-output-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function generate(input, babelOptions = {}, generateOptions = {}, rollupOp

test('allows running the plugin on the output via output options', async (t) => {
const code = await generate('basic/main.js', {
presets: ['@babel/env']
presets: [['@babel/env', { targets: 'firefox 2' }]]
});
t.false(code.includes('const'));
});
Expand All @@ -73,21 +73,21 @@ test('ignores .babelrc when transforming the output by default', async (t) => {
t.true(code.includes('const'));
});

test("allows transform-runtime to be used with `useESModules: false` (the default) and `format: 'cjs'`", async (t) => {
test("allows transform-runtime to be used with `format: 'cjs'`", async (t) => {
const code = await generate(
'runtime-helpers/main.js',
{
presets: ['@babel/env'],
plugins: [['@babel/transform-runtime', { useESModules: false }]]
presets: [['@babel/env', { targets: 'firefox 2' }]],
plugins: [['@babel/transform-runtime']]
},
{ format: 'cjs' }
);
t.is(
code,
`'use strict';

var _createClass = require("@babel/runtime/helpers/createClass");
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
var _createClass = require("@babel/runtime/helpers/createClass").default;
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck").default;
var Foo = /*#__PURE__*/_createClass(function Foo() {
_classCallCheck(this, Foo);
});
Expand All @@ -96,19 +96,19 @@ module.exports = Foo;
);
});

test("allows transform-runtime to be used with `useESModules: true` and `format: 'es'`", async (t) => {
test("allows transform-runtime to be used with `format: 'es'`", async (t) => {
const code = await generate(
'runtime-helpers/main.js',
{
presets: ['@babel/env'],
plugins: [['@babel/transform-runtime', { useESModules: true }]]
presets: [['@babel/env', { targets: 'firefox 2' }]],
plugins: [['@babel/transform-runtime']]
},
{ format: 'es' }
);
t.is(
code,
`import _createClass from "@babel/runtime/helpers/esm/createClass";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
`import _createClass from "@babel/runtime/helpers/createClass";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
var Foo = /*#__PURE__*/_createClass(function Foo() {
_classCallCheck(this, Foo);
});
Expand Down Expand Up @@ -155,7 +155,7 @@ test('allows using external-helpers plugin even if the externalHelpers flag is n
const code = await generate(
'external-helpers/main.js',
{
presets: ['@babel/env'],
presets: [['@babel/env', { targets: 'firefox 2' }]],
plugins: ['@babel/external-helpers']
},
{},
Expand Down Expand Up @@ -211,8 +211,7 @@ test('transforms all chunks in a code-splitting setup', async (t) => {
format: 'es',
plugins: [
getBabelOutputPlugin({
plugins: ['@babel/syntax-dynamic-import'],
presets: ['@babel/env']
presets: [['@babel/env', { targets: 'firefox 2' }]]
})
]
},
Expand Down Expand Up @@ -246,7 +245,7 @@ test('transforms all chunks when preserving modules', async (t) => {
preserveModules: true,
plugins: [
getBabelOutputPlugin({
presets: ['@babel/env']
presets: [['@babel/env', { targets: 'firefox 2' }]]
})
]
},
Expand Down Expand Up @@ -320,7 +319,7 @@ test('throws when using a Rollup output format other than esm or cjs', async (t)
test('allows using a Rollup output format other than esm or cjs with allowAllFormats', async (t) => {
const code = await generate(
'basic/main.js',
{ presets: ['@babel/env'], allowAllFormats: true },
{ presets: [['@babel/env', { targets: 'firefox 2' }]], allowAllFormats: true },
{ format: 'iife' }
);
t.is(
Expand All @@ -338,7 +337,7 @@ test('allows using a Rollup output format other than esm or cjs with allowAllFor
test('allows using Babel to transform to other formats', async (t) => {
const code = await generate(
'basic/main.js',
{ presets: [['@babel/env', { modules: 'umd' }]] },
{ presets: [['@babel/env', { modules: 'umd', targets: 'firefox 2' }]] },
{ format: 'es' }
);
t.is(
Expand Down
2 changes: 1 addition & 1 deletion packages/babel/test/fixtures/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": [ "@babel/env" ]
"presets": [ ["@babel/env", { "targets": "firefox 2" }] ]
}
22 changes: 21 additions & 1 deletion packages/babel/test/fixtures/class-loose/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
{
"presets": [ ["@babel/env", { "loose": true } ] ]
"presets": [
["@babel/preset-env", { "exclude": ["transform-typeof-symbol"], "targets": "firefox 2" }]
],
"assumptions": {
"arrayLikeIsIterable": true,
"constantReexports": true,
"ignoreFunctionLength": true,
"ignoreToPrimitiveHint": true,
"mutableTemplateObject": true,
"noClassCalls": true,
"noDocumentAll": true,
"objectRestNoSymbols": true,
"privateFieldsAsProperties": true,
"pureGetters": true,
"setClassMethods": true,
"setComputedProperties": true,
"setPublicClassFields": true,
"setSpreadProperties": true,
"skipForOfIteratorClosing": true,
"superIsCallableConstructor": true
}
}
2 changes: 1 addition & 1 deletion packages/babel/test/fixtures/external-helpers/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": [ "@babel/env" ],
"presets": [ ["@babel/env", { "targets": "firefox 2" } ] ],
"plugins": [ "@babel/external-helpers" ]
}
22 changes: 21 additions & 1 deletion packages/babel/test/fixtures/ignored-file/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
{
"presets": [ ["@babel/env", { "loose": true } ] ],
"presets": [
["@babel/preset-env", { "exclude": ["transform-typeof-symbol"] }]
],
"assumptions": {
"arrayLikeIsIterable": true,
"constantReexports": true,
"ignoreFunctionLength": true,
"ignoreToPrimitiveHint": true,
"mutableTemplateObject": true,
"noClassCalls": true,
"noDocumentAll": true,
"objectRestNoSymbols": true,
"privateFieldsAsProperties": true,
"pureGetters": true,
"setClassMethods": true,
"setComputedProperties": true,
"setPublicClassFields": true,
"setSpreadProperties": true,
"skipForOfIteratorClosing": true,
"superIsCallableConstructor": true
},
"ignore": ["ignored.js"]
}
4 changes: 2 additions & 2 deletions packages/babel/test/fixtures/proposal-decorators/.babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [ "@babel/env" ],
"presets": [ ["@babel/env", { "targets": "firefox 2" } ] ],
"plugins": [
["@babel/proposal-decorators", { "legacy": true }]
["@babel/proposal-decorators", { "version": "legacy" }]
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [ "@babel/env" ],
"presets": [ ["@babel/env", { "targets": "firefox 2" } ] ],
"plugins": [
[ "@babel/transform-runtime" ]
]
Expand Down
4 changes: 2 additions & 2 deletions packages/babel/test/fixtures/runtime-helpers-esm/.babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [ "@babel/env" ],
"presets": [ ["@babel/env", { "targets": "firefox 2" } ] ],
"plugins": [
[ "@babel/transform-runtime", { "useESModules": true } ]
[ "@babel/transform-runtime" ]
]
}
2 changes: 1 addition & 1 deletion packages/babel/test/fixtures/runtime-helpers/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": [ "@babel/env" ],
"presets": [ ["@babel/env", { "targets": "firefox 2" } ] ],
"plugins": [ "@babel/external-helpers", "@babel/transform-runtime" ]
}
Loading
Loading