Skip to content

Commit

Permalink
3.22.5
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed May 10, 2022
1 parent 951124c commit f1b4f76
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 39 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog
##### Unreleased
- Nothing

##### [3.22.5 - 2022.05.10](https://github.com/zloirock/core-js/releases/tag/v3.22.5)
- Ensured that polyfilled constructors `.prototype` is non-writable
- Ensured that polyfilled methods `.prototype` is not defined
- Added detection and fix of a V8 ~ Chrome <103 [bug](https://bugs.chromium.org/p/v8/issues/detail?id=12542) of `struturedClone` that returns `null` if cloned object contains multiple references to one error
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ queueMicrotask(() => console.log('called as microtask'));
### Installation:[](#index)
```
// global version
npm install --save core-js@3.22.4
npm install --save core-js@3.22.5
// version without global namespace pollution
npm install --save core-js-pure@3.22.4
npm install --save core-js-pure@3.22.5
// bundled global version
npm install --save core-js-bundle@3.22.4
npm install --save core-js-bundle@3.22.5
```

Or you can use `core-js` [from CDN](https://www.jsdelivr.com/package/npm/core-js-bundle).
Expand Down
2 changes: 1 addition & 1 deletion deno/corejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

*Example*:
```js
import 'https://deno.land/x/corejs@v3.22.4/index.js'; // <- at the top of your entry point
import 'https://deno.land/x/corejs@v3.22.5/index.js'; // <- at the top of your entry point

Object.hasOwn({ foo: 42 }, 'foo'); // => true

Expand Down
69 changes: 44 additions & 25 deletions deno/corejs/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* core-js 3.22.4
* core-js 3.22.5
* © 2014-2022 Denis Pushkarev (zloirock.ru)
* license: https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE
* license: https://github.com/zloirock/core-js/blob/v3.22.5/LICENSE
* source: https://github.com/zloirock/core-js
*/
!function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap
Expand Down Expand Up @@ -261,14 +261,14 @@ var FORCED = Error('e', { cause: 7 }).cause !== 7;
var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
var O = {};
O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED);
$({ global: true, arity: 1, forced: FORCED }, O);
$({ global: true, constructor: true, arity: 1, forced: FORCED }, O);
};

var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
if (WebAssembly && WebAssembly[ERROR_NAME]) {
var O = {};
O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED);
$({ target: WEB_ASSEMBLY, stat: true, arity: 1, forced: FORCED }, O);
$({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED }, O);
}
};

Expand Down Expand Up @@ -883,10 +883,10 @@ var store = __webpack_require__(34);
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.22.4',
version: '3.22.5',
mode: IS_PURE ? 'pure' : 'global',
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
license: 'https://github.com/zloirock/core-js/blob/v3.22.5/LICENSE',
source: 'https://github.com/zloirock/core-js'
});

Expand Down Expand Up @@ -1149,15 +1149,17 @@ module.exports = function (O, key, value, options) {
var fails = __webpack_require__(6);
var isCallable = __webpack_require__(19);
var hasOwn = __webpack_require__(36);
var defineProperty = __webpack_require__(42).f;
var DESCRIPTORS = __webpack_require__(5);
var CONFIGURABLE_FUNCTION_NAME = __webpack_require__(47).CONFIGURABLE;
var inspectSource = __webpack_require__(48);
var InternalStateModule = __webpack_require__(49);

var enforceInternalState = InternalStateModule.enforce;
var getInternalState = InternalStateModule.get;
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
var defineProperty = Object.defineProperty;

var CONFIGURABLE_LENGTH = !fails(function () {
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
});

Expand All @@ -1175,6 +1177,11 @@ var makeBuiltIn = module.exports = function (value, name, options) {
if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
defineProperty(value, 'length', { value: options.arity });
}
if (options && hasOwn(options, 'constructor') && options.constructor) {
if (DESCRIPTORS) try {
defineProperty(value, 'prototype', { writable: false });
} catch (error) { /* empty */ }
} else value.prototype = undefined;
var state = enforceInternalState(value);
if (!hasOwn(state, 'source')) {
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
Expand Down Expand Up @@ -1946,7 +1953,7 @@ var AggregateErrorPrototype = $AggregateError.prototype = create(Error.prototype

// `AggregateError` constructor
// https://tc39.es/ecma262/#sec-aggregate-error-constructor
$({ global: true }, {
$({ global: true, constructor: true, arity: 2 }, {
AggregateError: $AggregateError
});

Expand Down Expand Up @@ -2331,7 +2338,7 @@ var FORCED = !fails(function () {
});

// https://github.com/tc39/proposal-error-cause
$({ global: true, arity: 2, forced: FORCED }, {
$({ global: true, constructor: true, arity: 2, forced: FORCED }, {
AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) {
// eslint-disable-next-line no-unused-vars -- required for functions `.length`
return function AggregateError(errors, message) { return apply(init, this, arguments); };
Expand Down Expand Up @@ -4215,7 +4222,7 @@ if (IS_PURE || !hasOwn(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPr
createNonEnumerableProperty(AsyncIteratorPrototype, 'constructor', AsyncIteratorConstructor);
}

$({ global: true, forced: IS_PURE }, {
$({ global: true, constructor: true, forced: IS_PURE }, {
AsyncIterator: AsyncIteratorConstructor
});

Expand Down Expand Up @@ -5204,7 +5211,7 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
}

exported[CONSTRUCTOR_NAME] = Constructor;
$({ global: true, forced: Constructor != NativeConstructor }, exported);
$({ global: true, constructor: true, forced: Constructor != NativeConstructor }, exported);

setToStringTag(Constructor, CONSTRUCTOR_NAME);

Expand Down Expand Up @@ -6162,7 +6169,7 @@ if (FORCED || !hasOwn(IteratorPrototype, 'constructor') || IteratorPrototype.con

IteratorConstructor.prototype = IteratorPrototype;

$({ global: true, forced: FORCED }, {
$({ global: true, constructor: true, forced: FORCED }, {
Iterator: IteratorConstructor
});

Expand Down Expand Up @@ -7834,7 +7841,7 @@ defineBuiltIns(ObservablePrototype, {

defineBuiltIn(ObservablePrototype, $$OBSERVABLE, function () { return this; });

$({ global: true, forced: OBSERVABLE_FORCED }, {
$({ global: true, constructor: true, forced: OBSERVABLE_FORCED }, {
Observable: $Observable
});

Expand Down Expand Up @@ -9478,7 +9485,7 @@ var FORCED_CONSTRUCTOR = IS_PURE ? INCORRECT_TO_STRING || INCORRECT_CODE || MISS

// `DOMException` constructor
// https://webidl.spec.whatwg.org/#idl-DOMException
$({ global: true, forced: FORCED_CONSTRUCTOR }, {
$({ global: true, constructor: true, forced: FORCED_CONSTRUCTOR }, {
DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException
});

Expand Down Expand Up @@ -9645,7 +9652,7 @@ var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !DOM_EXCEPTION_HAS_STACK;

// `DOMException` constructor patch for `.stack` where it's required
// https://webidl.spec.whatwg.org/#es-DOMException-specialness
$({ global: true, forced: IS_PURE || FORCED_CONSTRUCTOR }, { // TODO: fix export logic
$({ global: true, constructor: true, forced: IS_PURE || FORCED_CONSTRUCTOR }, { // TODO: fix export logic
DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException
});

Expand Down Expand Up @@ -9930,30 +9937,42 @@ var checkBasicSemantic = function (structuredCloneImplementation) {
}) && structuredCloneImplementation;
};

var checkErrorsCloning = function (structuredCloneImplementation) {
return !fails(function () {
var error = new Error();
var test = structuredCloneImplementation({ a: error, b: error });
return !(test && test.a === test.b && test.a instanceof Error);
});
};

// https://github.com/whatwg/html/pull/5749
var checkNewErrorsSemantic = function (structuredCloneImplementation) {
var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
return !fails(function () {
var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
}) && structuredCloneImplementation;
});
};

// FF94+, Safari TP134+, Chrome Canary 98+, NodeJS 17.0+, Deno 1.13+
// current FF and Safari implementations can't clone errors
// FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+
// FF and Safari implementations can't clone errors
// https://bugzilla.mozilla.org/show_bug.cgi?id=1556604
// Chrome <103 returns `null` if cloned object contains multiple references to one error
// https://bugs.chromium.org/p/v8/issues/detail?id=12542
// no one of current implementations supports new (html/5749) error cloning semantic
var nativeStructuredClone = global.structuredClone;

var FORCED_REPLACEMENT = IS_PURE || !checkNewErrorsSemantic(nativeStructuredClone);
var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone) || !checkNewErrorsCloningSemantic(nativeStructuredClone);

// Chrome 82+, Safari 14.1+, Deno 1.11+
// Chrome 78-81 implementation swaps `.name` and `.message` of cloned `DOMException`
// Chrome returns `null` if cloned object contains multiple references to one error
// Safari 14.1 implementation doesn't clone some `RegExp` flags, so requires a workaround
// current Safari implementation can't clone errors
// Safari implementation can't clone errors
// Deno 1.2-1.10 implementations too naive
// NodeJS 16.0+ does not have `PerformanceMark` constructor, structured cloning implementation
// from `performance.mark` is too naive and can't clone, for example, `RegExp` or some boxed primitives
// https://github.com/nodejs/node/issues/40840
// NodeJS 16.0+ does not have `PerformanceMark` constructor
// NodeJS <17.2 structured cloning implementation from `performance.mark` is too naive
// and can't clone, for example, `RegExp` or some boxed primitives
// https://github.com/nodejs/node/issues/40840
// no one of current implementations supports new (html/5749) error cloning semantic
var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.22.4",
"version": "3.22.5",
"workspaces": [
"./packages/*"
],
Expand Down
6 changes: 3 additions & 3 deletions packages/core-js-builder/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "core-js-builder",
"description": "core-js builder",
"version": "3.22.4",
"version": "3.22.5",
"repository": {
"type": "git",
"url": "https://github.com/zloirock/core-js.git",
"directory": "packages/core-js-builder"
},
"main": "index.js",
"dependencies": {
"core-js": "3.22.4",
"core-js-compat": "3.22.4",
"core-js": "3.22.5",
"core-js-compat": "3.22.5",
"mkdirp": ">=0.5.5 <1",
"webpack": ">=4.46.0 <5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-bundle/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core-js-bundle",
"description": "Standard library",
"version": "3.22.4",
"version": "3.22.5",
"repository": {
"type": "git",
"url": "https://github.com/zloirock/core-js.git"
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-compat/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core-js-compat",
"description": "core-js compat",
"version": "3.22.4",
"version": "3.22.5",
"repository": {
"type": "git",
"url": "https://github.com/zloirock/core-js.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-pure/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core-js-pure",
"description": "Standard library",
"version": "3.22.4",
"version": "3.22.5",
"repository": {
"type": "git",
"url": "https://github.com/zloirock/core-js.git"
Expand Down
4 changes: 2 additions & 2 deletions packages/core-js/internals/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.22.4',
version: '3.22.5',
mode: IS_PURE ? 'pure' : 'global',
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
license: 'https://github.com/zloirock/core-js/blob/v3.22.5/LICENSE',
source: 'https://github.com/zloirock/core-js'
});
2 changes: 1 addition & 1 deletion packages/core-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core-js",
"description": "Standard library",
"version": "3.22.4",
"version": "3.22.5",
"repository": {
"type": "git",
"url": "https://github.com/zloirock/core-js.git"
Expand Down

0 comments on commit f1b4f76

Please sign in to comment.