From 825a9c7b97eb972c97e0282d605913282e7f60a3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 14 Jun 2021 23:16:27 +0000 Subject: [PATCH] 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 --- package-lock.json | 12 ++---------- package.json | 2 +- tools/webpack/packages.js | 4 ++-- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea84c09e3a035..29616e7058e73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 6c5e9b57ac936..057b9329e219c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js index c45563ea02367..e55919c275314 100644 --- a/tools/webpack/packages.js +++ b/tools/webpack/packages.js @@ -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',