core-js 3.36.0 → 3.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,9 @@ module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undef
26
26
  var length, result, step, iterator, next, value;
27
27
  // if the target is not iterable or it's an array with the default iterator - use a simple case
28
28
  if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
29
+ result = IS_CONSTRUCTOR ? new this() : [];
29
30
  iterator = getIterator(O, iteratorMethod);
30
31
  next = iterator.next;
31
- result = IS_CONSTRUCTOR ? new this() : [];
32
32
  for (;!(step = call(next, iterator)).done; index++) {
33
33
  value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
34
34
  createProperty(result, index, value);
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
  /* eslint-disable no-proto -- safe */
3
3
  var uncurryThisAccessor = require('../internals/function-uncurry-this-accessor');
4
- var anObject = require('../internals/an-object');
4
+ var isObject = require('../internals/is-object');
5
+ var requireObjectCoercible = require('../internals/require-object-coercible');
5
6
  var aPossiblePrototype = require('../internals/a-possible-prototype');
6
7
 
7
8
  // `Object.setPrototypeOf` method
@@ -18,8 +19,9 @@ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
18
19
  CORRECT_SETTER = test instanceof Array;
19
20
  } catch (error) { /* empty */ }
20
21
  return function setPrototypeOf(O, proto) {
21
- anObject(O);
22
+ requireObjectCoercible(O);
22
23
  aPossiblePrototype(proto);
24
+ if (!isObject(O)) return O;
23
25
  if (CORRECT_SETTER) setter(O, proto);
24
26
  else O.__proto__ = proto;
25
27
  return O;
@@ -7,9 +7,9 @@ var SHARED = '__core-js_shared__';
7
7
  var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
8
8
 
9
9
  (store.versions || (store.versions = [])).push({
10
- version: '3.36.0',
10
+ version: '3.36.1',
11
11
  mode: IS_PURE ? 'pure' : 'global',
12
12
  copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
13
- license: 'https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE',
13
+ license: 'https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE',
14
14
  source: 'https://github.com/zloirock/core-js'
15
15
  });
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var globalThis = require('../internals/global');
3
4
  var isPrototypeOf = require('../internals/object-is-prototype-of');
4
5
  var getPrototypeOf = require('../internals/object-get-prototype-of');
5
6
  var setPrototypeOf = require('../internals/object-set-prototype-of');
@@ -10,15 +11,30 @@ var createPropertyDescriptor = require('../internals/create-property-descriptor'
10
11
  var installErrorStack = require('../internals/error-stack-install');
11
12
  var normalizeStringArgument = require('../internals/normalize-string-argument');
12
13
  var wellKnownSymbol = require('../internals/well-known-symbol');
14
+ var fails = require('../internals/fails');
15
+ var IS_PURE = require('../internals/is-pure');
13
16
 
17
+ var NativeSuppressedError = globalThis.SuppressedError;
14
18
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
15
19
  var $Error = Error;
16
20
 
21
+ // https://github.com/oven-sh/bun/issues/9282
22
+ var WRONG_ARITY = !!NativeSuppressedError && NativeSuppressedError.length !== 3;
23
+
24
+ // https://github.com/oven-sh/bun/issues/9283
25
+ var EXTRA_ARGS_SUPPORT = !!NativeSuppressedError && fails(function () {
26
+ return NativeSuppressedError(1, 2, 3, { cause: 4 }).cause === 4;
27
+ });
28
+
29
+ var PATCH = WRONG_ARITY || EXTRA_ARGS_SUPPORT;
30
+
17
31
  var $SuppressedError = function SuppressedError(error, suppressed, message) {
18
32
  var isInstance = isPrototypeOf(SuppressedErrorPrototype, this);
19
33
  var that;
20
34
  if (setPrototypeOf) {
21
- that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : SuppressedErrorPrototype);
35
+ that = PATCH && (!isInstance || getPrototypeOf(this) === SuppressedErrorPrototype)
36
+ ? new NativeSuppressedError()
37
+ : setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : SuppressedErrorPrototype);
22
38
  } else {
23
39
  that = isInstance ? this : create(SuppressedErrorPrototype);
24
40
  createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
@@ -33,14 +49,16 @@ var $SuppressedError = function SuppressedError(error, suppressed, message) {
33
49
  if (setPrototypeOf) setPrototypeOf($SuppressedError, $Error);
34
50
  else copyConstructorProperties($SuppressedError, $Error, { name: true });
35
51
 
36
- var SuppressedErrorPrototype = $SuppressedError.prototype = create($Error.prototype, {
52
+ var SuppressedErrorPrototype = $SuppressedError.prototype = PATCH ? NativeSuppressedError.prototype : create($Error.prototype, {
37
53
  constructor: createPropertyDescriptor(1, $SuppressedError),
38
54
  message: createPropertyDescriptor(1, ''),
39
55
  name: createPropertyDescriptor(1, 'SuppressedError')
40
56
  });
41
57
 
58
+ if (PATCH && !IS_PURE) SuppressedErrorPrototype.constructor = $SuppressedError;
59
+
42
60
  // `SuppressedError` constructor
43
61
  // https://github.com/tc39/proposal-explicit-resource-management
44
- $({ global: true, constructor: true, arity: 3 }, {
62
+ $({ global: true, constructor: true, arity: 3, forced: PATCH }, {
45
63
  SuppressedError: $SuppressedError
46
64
  });
@@ -1,12 +1,23 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var globalThis = require('../internals/global');
3
4
  var microtask = require('../internals/microtask');
4
5
  var aCallable = require('../internals/a-callable');
5
6
  var validateArgumentsLength = require('../internals/validate-arguments-length');
7
+ var fails = require('../internals/fails');
8
+ var DESCRIPTORS = require('../internals/descriptors');
9
+
10
+ // Bun ~ 1.0.30 bug
11
+ // https://github.com/oven-sh/bun/issues/9249
12
+ var WRONG_ARITY = fails(function () {
13
+ // getOwnPropertyDescriptor for prevent experimental warning in Node 11
14
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
15
+ return DESCRIPTORS && Object.getOwnPropertyDescriptor(globalThis, 'queueMicrotask').value.length !== 1;
16
+ });
6
17
 
7
18
  // `queueMicrotask` method
8
19
  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
9
- $({ global: true, enumerable: true, dontCallGetSet: true }, {
20
+ $({ global: true, enumerable: true, dontCallGetSet: true, forced: WRONG_ARITY }, {
10
21
  queueMicrotask: function queueMicrotask(fn) {
11
22
  validateArgumentsLength(arguments.length, 1);
12
23
  microtask(aCallable(fn));
@@ -14,9 +14,15 @@ var THROWS_WITHOUT_ARGUMENTS = USE_NATIVE_URL && fails(function () {
14
14
  URL.canParse();
15
15
  });
16
16
 
17
+ // Bun ~ 1.0.30 bug
18
+ // https://github.com/oven-sh/bun/issues/9250
19
+ var WRONG_ARITY = fails(function () {
20
+ return URL.canParse.length !== 1;
21
+ });
22
+
17
23
  // `URL.canParse` method
18
24
  // https://url.spec.whatwg.org/#dom-url-canparse
19
- $({ target: 'URL', stat: true, forced: !THROWS_WITHOUT_ARGUMENTS }, {
25
+ $({ target: 'URL', stat: true, forced: !THROWS_WITHOUT_ARGUMENTS || WRONG_ARITY }, {
20
26
  canParse: function canParse(url) {
21
27
  var length = validateArgumentsLength(arguments.length, 1);
22
28
  var urlString = toString(url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-js",
3
- "version": "3.36.0",
3
+ "version": "3.36.1",
4
4
  "type": "commonjs",
5
5
  "description": "Standard library",
6
6
  "keywords": [