Skip to content

Commit

Permalink
Update to Babel 7.4 and core-js 3 (#15139)
Browse files Browse the repository at this point in the history
* Specify core-js version when using useBuiltIns

* Update to Babel 7.4 and core-js 3

* setupFiles: fix path to async-iterator

* Also update Babel packages in babel-preset-default

* Update snapshot for babel-preset-default test

* Manually include web.dom-collections.iterator in jest config

* Regenerate package-lock.json file after latest changes applied

* Upgrade ESLint related npm packages

* Another cleanup in the package-lock.json file

* Remove ESLint rules which throw error to fix linting

* Add core-js/modules/web.dom.iterable to make e2e tests work

* Update Babel packages to the latest version

* Update ignore files in e2e tests config

* Add changelog entries related to Babel and ESLint version bumps
  • Loading branch information
swissspidy authored Apr 30, 2019
1 parent 1d959ba commit 5e4d627
Show file tree
Hide file tree
Showing 59 changed files with 920 additions and 529 deletions.
29 changes: 0 additions & 29 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,6 @@ module.exports = {
selector: 'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' + majorMinorRegExp + '/]',
message: 'Deprecated functions must be removed before releasing this version.',
},
{
// Builds a selector which handles CallExpression with path
// argument at varied position by function.
//
// See: https://github.com/WordPress/gutenberg/pull/9615
selector: map( {
1: [
'property',
'matchesProperty',
'path',
],
2: [
'invokeMap',
'get',
'has',
'hasIn',
'invoke',
'result',
'set',
'setWith',
'unset',
'update',
'updateWith',
],
}, ( functionNames, argPosition ) => (
`CallExpression[callee.name=/^(${ functionNames.join( '|' ) })$/] > Literal:nth-child(${ argPosition })`
) ).join( ',' ),
message: 'Always pass an array as the path argument',
},
{
selector: 'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] Literal[value=/\\.{3}/]',
message: 'Use ellipsis character (…) in place of three dots',
Expand Down
1,288 changes: 855 additions & 433 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
"@wordpress/wordcount": "file:packages/wordcount"
},
"devDependencies": {
"@babel/core": "7.2.2",
"@babel/core": "7.4.4",
"@babel/plugin-syntax-jsx": "7.2.0",
"@babel/runtime-corejs2": "7.3.1",
"@babel/traverse": "7.2.3",
"@babel/runtime-corejs3": "7.4.4",
"@babel/traverse": "7.4.4",
"@wordpress/babel-plugin-import-jsx-pragma": "file:packages/babel-plugin-import-jsx-pragma",
"@wordpress/babel-plugin-makepot": "file:packages/babel-plugin-makepot",
"@wordpress/babel-preset-default": "file:packages/babel-preset-default",
Expand All @@ -84,7 +84,7 @@
"chalk": "2.4.1",
"concurrently": "3.5.0",
"copy-webpack-plugin": "4.5.2",
"core-js": "2.5.7",
"core-js": "3.0.1",
"cross-env": "3.2.4",
"cssnano": "4.1.10",
"deasync": "0.1.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ When creating a new package, you need to provide at least the following:
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.0.0"
"@babel/runtime": "^7.4.4"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/dom-ready": "file:../dom-ready"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/annotations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/data": "file:../data",
"@wordpress/hooks": "file:../hooks",
"@wordpress/i18n": "file:../i18n",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/i18n": "file:../i18n",
"@wordpress/url": "file:../url"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/autop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1"
"@babel/runtime": "^7.4.4"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-makepot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"gettext-parser": "^1.3.1",
"lodash": "^4.17.11"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/babel-preset-default/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## 4.1.0 (unreleased)
## Unreleased

### New Feature
### New Features

- Handle `<></>` JSX Fragments with `@wordpress/element` `Fragment` ([#15120](https://github.com/WordPress/gutenberg/pull/15120)).
- The bundled `@babel/core` dependency has been updated from requiring `^7.2.2` to requiring `^7.4.4`. Babel preset is now using `core-js@3` instead of `core-js@2` (see [Migration Guide](https://babeljs.io/blog/2019/03/19/7.4.0#migration-from-core-js-2)).

## 4.0.0 (2019-03-06)

Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset-default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = function( api ) {

if ( isTestEnv ) {
opts.useBuiltIns = 'usage';
opts.corejs = 3;
} else {
opts.modules = false;
opts.targets = {
Expand Down
10 changes: 5 additions & 5 deletions packages/babel-preset-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
],
"main": "index.js",
"dependencies": {
"@babel/core": "^7.2.2",
"@babel/core": "^7.4.4",
"@babel/plugin-proposal-async-generator-functions": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"@babel/runtime": "^7.3.1",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/runtime": "^7.4.4",
"@wordpress/babel-plugin-import-jsx-pragma": "file:../babel-plugin-import-jsx-pragma",
"@wordpress/browserslist-config": "file:../browserslist-config"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Babel preset default', function () {
return _context.stop();
}
}
}, _callee, this);
}, _callee);
}));
return _foo.apply(this, arguments);
}
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('Babel preset default', function () {
return _context2.stop();
}
}
}, _callee2, this);
}, _callee2);
})));
});"
`;
2 changes: 1 addition & 1 deletion packages/blob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1"
"@babel/runtime": "^7.4.4"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.0.0",
"@babel/runtime": "^7.4.4",
"@wordpress/a11y": "file:../a11y",
"@wordpress/blob": "file:../blob",
"@wordpress/blocks": "file:../blocks",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/autop": "file:../autop",
"@wordpress/blob": "file:../blob",
"@wordpress/block-editor": "file:../block-editor",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-serialization-default-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1"
"@babel/runtime": "^7.4.4"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/autop": "file:../autop",
"@wordpress/blob": "file:../blob",
"@wordpress/block-serialization-default-parser": "file:../block-serialization-default-parser",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/a11y": "file:../a11y",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/compose": "file:../compose",
Expand Down
2 changes: 1 addition & 1 deletion packages/compose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/element": "file:../element",
"@wordpress/is-shallow-equal": "file:../is-shallow-equal",
"lodash": "^4.17.11"
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/data": "file:../data",
"@wordpress/deprecated": "file:../deprecated",
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-templated-path-webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"escape-string-regexp": "^1.0.5"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/compose": "file:../compose",
"@wordpress/deprecated": "file:../deprecated",
"@wordpress/element": "file:../element",
Expand Down
2 changes: 1 addition & 1 deletion packages/date/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"moment": "^2.22.1",
"moment-timezone": "^0.5.16"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/deprecated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/hooks": "file:../hooks"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/dom-ready/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"dependencies": {
"@babel/runtime": "^7.3.1"
"@babel/runtime": "^7.4.4"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"lodash": "^4.17.11"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/keycodes": "file:../keycodes",
"@wordpress/url": "file:../url",
"lodash": "^4.17.11",
Expand Down
4 changes: 0 additions & 4 deletions packages/e2e-tests/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@ module.exports = {
'<rootDir>/config/setup-test-framework.js',
'expect-puppeteer',
],
transformIgnorePatterns: [
'node_modules',
'scripts/config/puppeteer.config.js',
],
};
2 changes: 1 addition & 1 deletion packages/e2e-tests/specs/preview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe( 'Preview', () => {

// When autosave completes for a new post, the URL of the editor should
// update to include the ID. Use this to assert on preview URL.
const [ , postId ] = await( await editorPage.waitForFunction( () => {
const [ , postId ] = await ( await editorPage.waitForFunction( () => {
return window.location.search.match( /[\?&]post=(\d+)/ );
} ) ).jsonValue();

Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/a11y": "file:../a11y",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/block-editor": "file:../block-editor",
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.0.0",
"@babel/runtime": "^7.4.4",
"@wordpress/block-editor": "file:../block-editor",
"@wordpress/components": "file:../components",
"@wordpress/element": "file:../element",
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/blob": "file:../blob",
"@wordpress/block-editor": "file:../block-editor",
Expand Down
2 changes: 1 addition & 1 deletion packages/element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/escape-html": "file:../escape-html",
"lodash": "^4.17.11",
"react": "^16.8.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/escape-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1"
"@babel/runtime": "^7.4.4"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"url": "https://github.com/WordPress/gutenberg/issues"
},
"dependencies": {
"babel-eslint": "^8.0.3",
"babel-eslint": "^10.0.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-hooks": "^1.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1",
"@babel/runtime": "^7.4.4",
"@wordpress/block-editor": "file:../block-editor",
"@wordpress/components": "file:../components",
"@wordpress/editor": "file:../editor",
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.3.1"
"@babel/runtime": "^7.4.4"
},
"publishConfig": {
"access": "public"
Expand Down
Loading

0 comments on commit 5e4d627

Please sign in to comment.