Build/Test Tools: Replace the deprecated @babel/polyfill.

This replaces the dependency of the deprecated `@babel/polyfill` package with the `core-js` package through `@wordpress/babel-preset-default`.

Previously, the file consisted of a generalized group of polyfills, and not all of them were required. This change allows the contents of this file to be built according to the exact needs as dictated by the `@wordpress/babel-preset-default` package, which takes into account the current browser support.

Props gziolo, youknowriad. 
Fixes #52941.

git-svn-id: https://develop.svn.wordpress.org/trunk@51146 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2021-06-14 23:16:27 +00:00
parent 18ebf26bc3
commit 825a9c7b97
3 changed files with 5 additions and 13 deletions
+2 -10
View File
@@ -1087,15 +1087,6 @@
"@babel/helper-plugin-utils": "^7.12.13"
}
},
"@babel/polyfill": {
"version": "7.10.1",
"resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.10.1.tgz",
"integrity": "sha512-TviueJ4PBW5p48ra8IMtLXVkDucrlOZAIZ+EXqS3Ot4eukHbWiqcn7DcqpA1k5PcKtmJ4Xl9xwdv6yQvvcA+3g==",
"requires": {
"core-js": "^2.6.5",
"regenerator-runtime": "^0.13.4"
}
},
"@babel/preset-env": {
"version": "7.14.4",
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.14.4.tgz",
@@ -8170,7 +8161,8 @@
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==",
"dev": true
},
"core-js-compat": {
"version": "3.14.0",
+1 -1
View File
@@ -24,6 +24,7 @@
"last 2 Opera versions"
],
"devDependencies": {
"@wordpress/babel-preset-default": "6.2.0",
"@wordpress/custom-templated-path-webpack-plugin": "2.0.5",
"@wordpress/dependency-extraction-webpack-plugin": "3.1.4",
"@wordpress/e2e-test-utils": "5.3.0",
@@ -76,7 +77,6 @@
"webpack-livereload-plugin": "2.3.0"
},
"dependencies": {
"@babel/polyfill": "7.10.1",
"@wordpress/a11y": "3.1.1",
"@wordpress/annotations": "2.1.1",
"@wordpress/api-fetch": "5.1.1",
+2 -2
View File
@@ -73,7 +73,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
const vendors = {
'lodash.js': 'lodash/lodash.js',
'wp-polyfill.js': '@babel/polyfill/dist/polyfill.js',
'wp-polyfill.js': '@wordpress/babel-preset-default/build/polyfill.js',
'wp-polyfill-fetch.js': 'whatwg-fetch/dist/fetch.umd.js',
'wp-polyfill-element-closest.js': 'element-closest/element-closest.js',
'wp-polyfill-node-contains.js': 'polyfill-library/polyfills/__dist/Node.prototype.contains/raw.js',
@@ -88,7 +88,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
const minifiedVendors = {
'lodash.min.js': 'lodash/lodash.min.js',
'wp-polyfill.min.js': '@babel/polyfill/dist/polyfill.min.js',
'wp-polyfill.min.js': '@wordpress/babel-preset-default/build/polyfill.min.js',
'wp-polyfill-formdata.min.js': 'formdata-polyfill/formdata.min.js',
'wp-polyfill-url.min.js': 'core-js-url-browser/url.min.js',
'wp-polyfill-object-fit.min.js': 'objectFitPolyfill/dist/objectFitPolyfill.min.js',