diff --git a/CHANGELOG.md b/CHANGELOG.md index 63fc8b4c4629..46eef81d66ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Changelog ##### Unreleased +- Nothing + +##### [3.27.1 - 2022.12.30](https://github.com/zloirock/core-js/releases/tag/v3.27.1) - Fixed a Chakra-based MS Edge (18-) bug that unfreeze (O_o) frozen arrays used as `WeakMap` keys - Fixing of the previous bug also fixes some cases of `String.dedent` in MS Edge - Fixed dependencies of some entries diff --git a/README.md b/README.md index b94049ce54cd..2286e0fbbf14 100644 --- a/README.md +++ b/README.md @@ -203,11 +203,11 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) ### Installation:[⬆](#index) ```sh // global version -npm install --save core-js@3.27.0 +npm install --save core-js@3.27.1 // version without global namespace pollution -npm install --save core-js-pure@3.27.0 +npm install --save core-js-pure@3.27.1 // bundled global version -npm install --save core-js-bundle@3.27.0 +npm install --save core-js-bundle@3.27.1 ``` Or you can use `core-js` [from CDN](https://www.jsdelivr.com/package/npm/core-js-bundle). diff --git a/deno/corejs/README.md b/deno/corejs/README.md index d95f7909492c..efe3b6b7744b 100644 --- a/deno/corejs/README.md +++ b/deno/corejs/README.md @@ -28,7 +28,7 @@ *Example*: ```js -import 'https://deno.land/x/corejs@v3.27.0/index.js'; // <- at the top of your entry point +import 'https://deno.land/x/corejs@v3.27.1/index.js'; // <- at the top of your entry point Object.hasOwn({ foo: 42 }, 'foo'); // => true diff --git a/deno/corejs/index.js b/deno/corejs/index.js index 20791d1a7204..fc299189736f 100644 --- a/deno/corejs/index.js +++ b/deno/corejs/index.js @@ -1,7 +1,7 @@ /** - * core-js 3.27.0 + * core-js 3.27.1 * © 2014-2022 Denis Pushkarev (zloirock.ru) - * license: https://github.com/zloirock/core-js/blob/v3.27.0/LICENSE + * license: https://github.com/zloirock/core-js/blob/v3.27.1/LICENSE * source: https://github.com/zloirock/core-js */ !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap @@ -939,10 +939,10 @@ var store = __webpack_require__(36); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.27.0', + version: '3.27.1', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.27.0/LICENSE', + license: 'https://github.com/zloirock/core-js/blob/v3.27.1/LICENSE', source: 'https://github.com/zloirock/core-js' }); @@ -7831,6 +7831,7 @@ __webpack_require__(242); "use strict"; +var FREEZING = __webpack_require__(238); var global = __webpack_require__(3); var uncurryThis = __webpack_require__(13); var defineBuiltIns = __webpack_require__(166); @@ -7838,10 +7839,26 @@ var InternalMetadataModule = __webpack_require__(232); var collection = __webpack_require__(231); var collectionWeak = __webpack_require__(243); var isObject = __webpack_require__(19); -var isExtensible = __webpack_require__(236); var enforceInternalState = __webpack_require__(51).enforce; +var fails = __webpack_require__(6); var NATIVE_WEAK_MAP = __webpack_require__(52); +var $Object = Object; +// eslint-disable-next-line es/no-array-isarray -- safe +var isArray = Array.isArray; +// eslint-disable-next-line es/no-object-isextensible -- safe +var isExtensible = $Object.isExtensible; +// eslint-disable-next-line es/no-object-isfrozen -- safe +var isFrozen = $Object.isFrozen; +// eslint-disable-next-line es/no-object-issealed -- safe +var isSealed = $Object.isSealed; +// eslint-disable-next-line es/no-object-freeze -- safe +var freeze = $Object.freeze; +// eslint-disable-next-line es/no-object-seal -- safe +var seal = $Object.seal; + +var FROZEN = {}; +var SEALED = {}; var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; var InternalWeakMap; @@ -7854,18 +7871,27 @@ var wrapper = function (init) { // `WeakMap` constructor // https://tc39.es/ecma262/#sec-weakmap-constructor var $WeakMap = collection('WeakMap', wrapper, collectionWeak); +var WeakMapPrototype = $WeakMap.prototype; +var nativeSet = uncurryThis(WeakMapPrototype.set); + +// Chakra Edge bug: adding frozen arrays to WeakMap unfreeze them +var hasMSEdgeFreezingBug = function () { + return FREEZING && fails(function () { + var frozenArray = freeze([]); + nativeSet(new $WeakMap(), frozenArray, 1); + return !isFrozen(frozenArray); + }); +}; // IE11 WeakMap frozen keys fix // We can't use feature detection because it crash some old IE builds // https://github.com/zloirock/core-js/issues/485 -if (NATIVE_WEAK_MAP && IS_IE11) { +if (NATIVE_WEAK_MAP) if (IS_IE11) { InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); InternalMetadataModule.enable(); - var WeakMapPrototype = $WeakMap.prototype; var nativeDelete = uncurryThis(WeakMapPrototype['delete']); var nativeHas = uncurryThis(WeakMapPrototype.has); var nativeGet = uncurryThis(WeakMapPrototype.get); - var nativeSet = uncurryThis(WeakMapPrototype.set); defineBuiltIns(WeakMapPrototype, { 'delete': function (key) { if (isObject(key) && !isExtensible(key)) { @@ -7897,6 +7923,21 @@ if (NATIVE_WEAK_MAP && IS_IE11) { return this; } }); +// Chakra Edge frozen keys fix +} else if (hasMSEdgeFreezingBug()) { + defineBuiltIns(WeakMapPrototype, { + set: function set(key, value) { + var arrayIntegrityLevel; + if (isArray(key)) { + if (isFrozen(key)) arrayIntegrityLevel = FROZEN; + else if (isSealed(key)) arrayIntegrityLevel = SEALED; + } + nativeSet(this, key, value); + if (arrayIntegrityLevel == FROZEN) freeze(key); + if (arrayIntegrityLevel == SEALED) seal(key); + return this; + } + }); } diff --git a/docs/compat/compat-data.js b/docs/compat/compat-data.js index c973f85345e4..f594b338707c 100644 --- a/docs/compat/compat-data.js +++ b/docs/compat/compat-data.js @@ -5465,7 +5465,7 @@ "chrome": "51", "chrome-android": "51", "deno": "1.0", - "edge": "15", + "edge": "79", "electron": "1.2", "firefox": "53", "firefox-android": "53", @@ -5486,7 +5486,7 @@ "chrome": "51", "chrome-android": "51", "deno": "1.0", - "edge": "15", + "edge": "79", "electron": "1.2", "firefox": "53", "firefox-android": "53", diff --git a/docs/compat/tests.js b/docs/compat/tests.js index 15b5d9406426..f22ac59cfe5e 100644 --- a/docs/compat/tests.js +++ b/docs/compat/tests.js @@ -1364,7 +1364,7 @@ GLOBAL.tests = { return unescape; }, 'es.weak-map.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { - var key = Object.freeze({}); + var key = Object.freeze([]); var called = 0; var iterable = { next: function () { @@ -1376,10 +1376,13 @@ GLOBAL.tests = { }; var map = new WeakMap(iterable); + // MS IE bug return map.get(key) == 1 && map.get(null) == undefined && map.set({}, 2) == map - && map[Symbol.toStringTag]; + && map[Symbol.toStringTag] + // MS Edge bug + && Object.isFrozen(key); }], 'es.weak-set.constructor': [SAFE_ITERATION_CLOSING_SUPPORT, function () { var key = {}; diff --git a/package.json b/package.json index f552526fa6a4..ab301425c025 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "3.27.0", + "version": "3.27.1", "repository": { "type": "git", "url": "https://github.com/zloirock/core-js.git" diff --git a/packages/core-js-builder/package.json b/packages/core-js-builder/package.json index 8df0a04e7588..b876d27eba83 100644 --- a/packages/core-js-builder/package.json +++ b/packages/core-js-builder/package.json @@ -1,6 +1,6 @@ { "name": "core-js-builder", - "version": "3.27.0", + "version": "3.27.1", "description": "core-js builder", "repository": { "type": "git", @@ -20,8 +20,8 @@ "sideEffects": false, "main": "index.js", "dependencies": { - "core-js": "3.27.0", - "core-js-compat": "3.27.0", + "core-js": "3.27.1", + "core-js-compat": "3.27.1", "mkdirp": ">=0.5.5 <1", "webpack": ">=4.46.0 <5" }, diff --git a/packages/core-js-bundle/package.json b/packages/core-js-bundle/package.json index 312de9813f21..b3109bf60343 100644 --- a/packages/core-js-bundle/package.json +++ b/packages/core-js-bundle/package.json @@ -1,6 +1,6 @@ { "name": "core-js-bundle", - "version": "3.27.0", + "version": "3.27.1", "description": "Standard library", "keywords": [ "ES3", diff --git a/packages/core-js-compat/package.json b/packages/core-js-compat/package.json index 40b2fa8364cc..c4870315836e 100644 --- a/packages/core-js-compat/package.json +++ b/packages/core-js-compat/package.json @@ -1,6 +1,6 @@ { "name": "core-js-compat", - "version": "3.27.0", + "version": "3.27.1", "description": "core-js compat", "repository": { "type": "git", diff --git a/packages/core-js-pure/package.json b/packages/core-js-pure/package.json index 46668c84417b..e7b31634a836 100644 --- a/packages/core-js-pure/package.json +++ b/packages/core-js-pure/package.json @@ -1,6 +1,6 @@ { "name": "core-js-pure", - "version": "3.27.0", + "version": "3.27.1", "description": "Standard library", "keywords": [ "ES3", diff --git a/packages/core-js/internals/shared.js b/packages/core-js/internals/shared.js index f0fca8632ae7..7d572f18f3ba 100644 --- a/packages/core-js/internals/shared.js +++ b/packages/core-js/internals/shared.js @@ -4,9 +4,9 @@ var store = require('../internals/shared-store'); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.27.0', + version: '3.27.1', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.27.0/LICENSE', + license: 'https://github.com/zloirock/core-js/blob/v3.27.1/LICENSE', source: 'https://github.com/zloirock/core-js' }); diff --git a/packages/core-js/package.json b/packages/core-js/package.json index 2cd03b7bdca6..4ead0f4e08ac 100644 --- a/packages/core-js/package.json +++ b/packages/core-js/package.json @@ -1,6 +1,6 @@ { "name": "core-js", - "version": "3.27.0", + "version": "3.27.1", "description": "Standard library", "keywords": [ "ES3",