From c71a291317f3382608beb2480eb79eee7f0be23f Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 15 Sep 2019 16:29:46 +0200 Subject: [PATCH] Upgrade `core-js` to version 3.2.1 This only required changing the import paths. The `es` folder contains all polyfills we need now. If we want to import everything, we need to explicitly require the `index` file. --- package-lock.json | 14 +++++++++++--- package.json | 2 +- src/shared/compatibility.js | 36 ++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 36f7d987b..b3c2aa8e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1666,6 +1666,14 @@ "requires": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "core-js": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", + "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==", + "dev": true + } } }, "babel-types": { @@ -2521,9 +2529,9 @@ } }, "core-js": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz", - "integrity": "sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz", + "integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw==", "dev": true }, "core-js-compat": { diff --git a/package.json b/package.json index c77dac209..dc7161db1 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "autoprefixer": "^9.6.1", "babel-loader": "^8.0.6", "canvas": "^2.6.0", - "core-js": "^2.6.9", + "core-js": "^3.2.1", "escodegen": "^1.12.0", "eslint": "^6.4.0", "eslint-config-prettier": "^6.3.0", diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index 30be7219e..1e5356323 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -119,7 +119,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (String.prototype.startsWith) { return; } - require('core-js/fn/string/starts-with'); + require('core-js/es/string/starts-with'); })(); // Provides support for String.prototype.endsWith in legacy browsers. @@ -128,7 +128,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (String.prototype.endsWith) { return; } - require('core-js/fn/string/ends-with'); + require('core-js/es/string/ends-with'); })(); // Provides support for String.prototype.includes in legacy browsers. @@ -137,7 +137,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (String.prototype.includes) { return; } - require('core-js/fn/string/includes'); + require('core-js/es/string/includes'); })(); // Provides support for Array.prototype.includes in legacy browsers. @@ -146,7 +146,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (Array.prototype.includes) { return; } - require('core-js/fn/array/includes'); + require('core-js/es/array/includes'); })(); // Provides support for Array.from in legacy browsers. @@ -155,7 +155,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (Array.from) { return; } - require('core-js/fn/array/from'); + require('core-js/es/array/from'); })(); // Provides support for Object.assign in legacy browsers. @@ -164,7 +164,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (Object.assign) { return; } - require('core-js/fn/object/assign'); + require('core-js/es/object/assign'); })(); // Provides support for Math.log2 in legacy browsers. @@ -173,7 +173,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (Math.log2) { return; } - Math.log2 = require('core-js/fn/math/log2'); + Math.log2 = require('core-js/es/math/log2'); })(); // Provides support for Number.isNaN in legacy browsers. @@ -182,7 +182,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (Number.isNaN) { return; } - Number.isNaN = require('core-js/fn/number/is-nan'); + Number.isNaN = require('core-js/es/number/is-nan'); })(); // Provides support for Number.isInteger in legacy browsers. @@ -191,7 +191,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (Number.isInteger) { return; } - Number.isInteger = require('core-js/fn/number/is-integer'); + Number.isInteger = require('core-js/es/number/is-integer'); })(); // Support: IE, Safari<11, Chrome<63 @@ -205,7 +205,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; globalScope.Promise.prototype.finally)) { return; } - globalScope.Promise = require('core-js/fn/promise'); + globalScope.Promise = require('core-js/es/promise/index'); })(); // Support: IE<11, Safari<8, Chrome<36 @@ -213,7 +213,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (globalScope.WeakMap) { return; } - globalScope.WeakMap = require('core-js/fn/weak-map'); + globalScope.WeakMap = require('core-js/es/weak-map/index'); })(); // Support: IE11 @@ -221,7 +221,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (globalScope.WeakSet) { return; } - globalScope.WeakSet = require('core-js/fn/weak-set'); + globalScope.WeakSet = require('core-js/es/weak-set/index'); })(); // Provides support for String.codePointAt in legacy browsers. @@ -230,7 +230,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (String.prototype.codePointAt) { return; } - require('core-js/fn/string/code-point-at'); + require('core-js/es/string/code-point-at'); })(); // Provides support for String.fromCodePoint in legacy browsers. @@ -239,7 +239,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (String.fromCodePoint) { return; } - String.fromCodePoint = require('core-js/fn/string/from-code-point'); + String.fromCodePoint = require('core-js/es/string/from-code-point'); })(); // Support: IE @@ -247,7 +247,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (globalScope.Symbol) { return; } - require('core-js/es6/symbol'); + require('core-js/es/symbol/index'); })(); // Provides support for String.prototype.padStart in legacy browsers. @@ -256,7 +256,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (String.prototype.padStart) { return; } - require('core-js/fn/string/pad-start'); + require('core-js/es/string/pad-start'); })(); // Provides support for String.prototype.padEnd in legacy browsers. @@ -265,7 +265,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (String.prototype.padEnd) { return; } - require('core-js/fn/string/pad-end'); + require('core-js/es/string/pad-end'); })(); // Provides support for Object.values in legacy browsers. @@ -274,7 +274,7 @@ const hasDOM = typeof window === 'object' && typeof document === 'object'; if (Object.values) { return; } - Object.values = require('core-js/fn/object/values'); + Object.values = require('core-js/es/object/values'); })(); }