core-js 3.22.8 → 3.23.2

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.
Files changed (126) hide show
  1. package/README.md +6 -6
  2. package/actual/array/find-last-index.js +2 -2
  3. package/actual/array/find-last.js +2 -2
  4. package/actual/array/group-to-map.js +6 -0
  5. package/actual/array/group.js +4 -0
  6. package/actual/array/index.js +2 -0
  7. package/actual/array/push.js +3 -0
  8. package/actual/array/unshift.js +3 -0
  9. package/actual/array/virtual/find-last-index.js +2 -2
  10. package/actual/array/virtual/find-last.js +2 -2
  11. package/actual/array/virtual/group-to-map.js +6 -0
  12. package/actual/array/virtual/group.js +4 -0
  13. package/actual/array/virtual/index.js +2 -0
  14. package/actual/array/virtual/push.js +3 -0
  15. package/actual/array/virtual/unshift.js +3 -0
  16. package/actual/instance/group-to-map.js +9 -0
  17. package/actual/instance/group.js +9 -0
  18. package/actual/instance/push.js +3 -0
  19. package/actual/instance/unshift.js +3 -0
  20. package/actual/typed-array/find-last-index.js +3 -0
  21. package/actual/typed-array/find-last.js +3 -0
  22. package/es/array/find-last-index.js +4 -0
  23. package/es/array/find-last.js +4 -0
  24. package/es/array/index.js +4 -0
  25. package/es/array/push.js +4 -0
  26. package/es/array/unshift.js +4 -0
  27. package/es/array/virtual/find-last-index.js +4 -0
  28. package/es/array/virtual/find-last.js +4 -0
  29. package/es/array/virtual/index.js +4 -0
  30. package/es/array/virtual/push.js +4 -0
  31. package/es/array/virtual/unshift.js +4 -0
  32. package/es/index.js +6 -0
  33. package/es/instance/find-last-index.js +9 -0
  34. package/es/instance/find-last.js +9 -0
  35. package/es/instance/push.js +9 -0
  36. package/es/instance/unshift.js +9 -0
  37. package/es/typed-array/find-last-index.js +1 -0
  38. package/es/typed-array/find-last.js +1 -0
  39. package/es/typed-array/methods.js +2 -0
  40. package/features/array/group-to-map.js +1 -0
  41. package/features/array/group.js +1 -0
  42. package/features/array/push.js +1 -0
  43. package/features/array/unshift.js +1 -0
  44. package/features/array/virtual/group-to-map.js +1 -0
  45. package/features/array/virtual/group.js +1 -0
  46. package/features/array/virtual/push.js +1 -0
  47. package/features/array/virtual/unshift.js +1 -0
  48. package/features/instance/group-to-map.js +1 -0
  49. package/features/instance/group.js +1 -0
  50. package/features/instance/push.js +1 -0
  51. package/features/instance/unshift.js +1 -0
  52. package/features/symbol/metadata-key.js +1 -0
  53. package/full/array/group-to-map.js +3 -0
  54. package/full/array/group.js +3 -0
  55. package/full/array/push.js +3 -0
  56. package/full/array/unshift.js +3 -0
  57. package/full/array/virtual/group-to-map.js +3 -0
  58. package/full/array/virtual/group.js +3 -0
  59. package/full/array/virtual/push.js +3 -0
  60. package/full/array/virtual/unshift.js +3 -0
  61. package/full/index.js +9 -0
  62. package/full/instance/group-to-map.js +3 -0
  63. package/full/instance/group.js +3 -0
  64. package/full/instance/push.js +3 -0
  65. package/full/instance/unshift.js +3 -0
  66. package/full/symbol/index.js +2 -2
  67. package/full/symbol/metadata-key.js +4 -0
  68. package/internals/array-buffer-view-core.js +14 -4
  69. package/internals/array-group-to-map.js +32 -0
  70. package/internals/{array-group-by.js → array-group.js} +0 -0
  71. package/internals/define-built-in.js +7 -2
  72. package/internals/engine-is-deno.js +2 -0
  73. package/internals/regexp-flags.js +1 -0
  74. package/internals/shared.js +2 -2
  75. package/internals/typed-array-constructor.js +2 -2
  76. package/internals/typed-array-species-constructor.js +2 -2
  77. package/modules/es.array.find-last-index.js +14 -0
  78. package/modules/es.array.find-last.js +14 -0
  79. package/modules/es.array.push.js +39 -0
  80. package/modules/es.array.unshift.js +42 -0
  81. package/modules/es.number.epsilon.js +1 -1
  82. package/modules/es.number.max-safe-integer.js +1 -1
  83. package/modules/es.number.min-safe-integer.js +1 -1
  84. package/modules/es.regexp.flags.js +38 -1
  85. package/modules/es.typed-array.find-last-index.js +12 -0
  86. package/modules/es.typed-array.find-last.js +12 -0
  87. package/modules/esnext.array.find-last-index.js +2 -14
  88. package/modules/esnext.array.find-last.js +2 -14
  89. package/modules/esnext.array.group-by-to-map.js +4 -30
  90. package/modules/esnext.array.group-by.js +3 -2
  91. package/modules/esnext.array.group-to-map.js +11 -0
  92. package/modules/esnext.array.group.js +15 -0
  93. package/modules/esnext.math.deg-per-rad.js +1 -1
  94. package/modules/esnext.math.rad-per-deg.js +1 -1
  95. package/modules/esnext.symbol.metadata-key.js +5 -0
  96. package/modules/esnext.symbol.metadata.js +1 -0
  97. package/modules/esnext.typed-array.find-last-index.js +2 -12
  98. package/modules/esnext.typed-array.find-last.js +2 -12
  99. package/modules/esnext.typed-array.group-by.js +2 -2
  100. package/modules/esnext.typed-array.to-reversed.js +2 -2
  101. package/modules/esnext.typed-array.to-sorted.js +2 -2
  102. package/modules/esnext.typed-array.to-spliced.js +2 -2
  103. package/modules/esnext.typed-array.with.js +22 -12
  104. package/modules/web.structured-clone.js +17 -5
  105. package/package.json +1 -1
  106. package/proposals/array-grouping-stage-3-2.js +3 -0
  107. package/proposals/array-grouping-stage-3.js +1 -0
  108. package/proposals/decorator-metadata.js +2 -0
  109. package/proposals/decorators.js +1 -2
  110. package/stable/array/find-last-index.js +1 -0
  111. package/stable/array/find-last.js +1 -0
  112. package/stable/array/push.js +3 -0
  113. package/stable/array/unshift.js +3 -0
  114. package/stable/array/virtual/find-last-index.js +1 -0
  115. package/stable/array/virtual/find-last.js +1 -0
  116. package/stable/array/virtual/push.js +3 -0
  117. package/stable/array/virtual/unshift.js +3 -0
  118. package/stable/index.js +6 -0
  119. package/stable/instance/find-last-index.js +3 -0
  120. package/stable/instance/find-last.js +3 -0
  121. package/stable/instance/push.js +3 -0
  122. package/stable/instance/unshift.js +3 -0
  123. package/stable/typed-array/find-last-index.js +1 -0
  124. package/stable/typed-array/find-last.js +1 -0
  125. package/stage/2.js +2 -1
  126. package/stage/3.js +3 -1
@@ -5,8 +5,8 @@ var aCallable = require('../internals/a-callable');
5
5
  var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
6
6
 
7
7
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
8
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
8
9
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
9
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
10
10
  var sort = uncurryThis(ArrayBufferViewCore.TypedArrayPrototype.sort);
11
11
 
12
12
  // `%TypedArray%.prototype.toSorted` method
@@ -14,6 +14,6 @@ var sort = uncurryThis(ArrayBufferViewCore.TypedArrayPrototype.sort);
14
14
  exportTypedArrayMethod('toSorted', function toSorted(compareFn) {
15
15
  if (compareFn !== undefined) aCallable(compareFn);
16
16
  var O = aTypedArray(this);
17
- var A = arrayFromConstructorAndList(O[TYPED_ARRAY_CONSTRUCTOR], O);
17
+ var A = arrayFromConstructorAndList(getTypedArrayConstructor(O), O);
18
18
  return sort(A, compareFn);
19
19
  });
@@ -4,12 +4,12 @@ var arraySlice = require('../internals/array-slice');
4
4
  var arrayToSpliced = require('../internals/array-to-spliced');
5
5
 
6
6
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
7
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
7
8
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
8
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
9
9
 
10
10
  // `%TypedArray%.prototype.toSpliced` method
11
11
  // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced
12
12
  // eslint-disable-next-line no-unused-vars -- required for .length
13
13
  exportTypedArrayMethod('toSpliced', function toSpliced(start, deleteCount /* , ...items */) {
14
- return arrayToSpliced(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR], arraySlice(arguments));
14
+ return arrayToSpliced(aTypedArray(this), getTypedArrayConstructor(this), arraySlice(arguments));
15
15
  }, { arity: 2 });
@@ -1,22 +1,32 @@
1
1
  'use strict';
2
2
  var arrayWith = require('../internals/array-with');
3
3
  var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
4
- // var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
5
- // var toBigInt = require('../internals/to-big-int');
6
- // var classof = require('../internals/classof');
7
- // var uncurryThis = require('../internals/function-uncurry-this');
4
+ var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
5
+ var toBigInt = require('../internals/to-big-int');
6
+ var classof = require('../internals/classof');
7
+ var uncurryThis = require('../internals/function-uncurry-this');
8
8
 
9
9
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
10
+ var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
10
11
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
11
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
12
- // var slice = uncurryThis(''.slice);
12
+ var slice = uncurryThis(''.slice);
13
+
14
+ var PROPER_ORDER = !!function () {
15
+ try {
16
+ // eslint-disable-next-line no-throw-literal, es-x/no-typed-arrays -- required for testing
17
+ new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } });
18
+ } catch (error) {
19
+ // some early implementations, like WebKit, does not follow the final semantic
20
+ // https://github.com/tc39/proposal-change-array-by-copy/pull/86
21
+ return error === 8;
22
+ }
23
+ }();
13
24
 
14
25
  // `%TypedArray%.prototype.with` method
15
26
  // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with
16
27
  exportTypedArrayMethod('with', { 'with': function (index, value) {
17
- // aTypedArray(this);
18
- // var relativeIndex = toIntegerOrInfinity(index);
19
- // var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value;
20
- // return arrayWith(this, this[TYPED_ARRAY_CONSTRUCTOR], relativeIndex, actualValue);
21
- return arrayWith(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR], index, value);
22
- } }['with']);
28
+ aTypedArray(this);
29
+ var relativeIndex = toIntegerOrInfinity(index);
30
+ var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value;
31
+ return arrayWith(this, getTypedArrayConstructor(this), relativeIndex, actualValue);
32
+ } }['with'], !PROPER_ORDER);
@@ -19,6 +19,10 @@ var lengthOfArrayLike = require('../internals/length-of-array-like');
19
19
  var validateArgumentsLength = require('../internals/validate-arguments-length');
20
20
  var getRegExpFlags = require('../internals/regexp-get-flags');
21
21
  var ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable');
22
+ var V8 = require('../internals/engine-v8-version');
23
+ var IS_BROWSER = require('../internals/engine-is-browser');
24
+ var IS_DENO = require('../internals/engine-is-deno');
25
+ var IS_NODE = require('../internals/engine-is-node');
22
26
 
23
27
  var Object = global.Object;
24
28
  var Date = global.Date;
@@ -61,11 +65,11 @@ var checkBasicSemantic = function (structuredCloneImplementation) {
61
65
  }) && structuredCloneImplementation;
62
66
  };
63
67
 
64
- var checkErrorsCloning = function (structuredCloneImplementation) {
68
+ var checkErrorsCloning = function (structuredCloneImplementation, $Error) {
65
69
  return !fails(function () {
66
- var error = new Error();
70
+ var error = new $Error();
67
71
  var test = structuredCloneImplementation({ a: error, b: error });
68
- return !(test && test.a === test.b && test.a instanceof Error);
72
+ return !(test && test.a === test.b && test.a instanceof $Error);
69
73
  });
70
74
  };
71
75
 
@@ -80,12 +84,17 @@ var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
80
84
  // FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+
81
85
  // FF and Safari implementations can't clone errors
82
86
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1556604
83
- // Chrome <103 returns `null` if cloned object contains multiple references to one error
87
+ // Chrome <102 returns `null` if cloned object contains multiple references to one error
84
88
  // https://bugs.chromium.org/p/v8/issues/detail?id=12542
89
+ // NodeJS implementation can't clone DOMExceptions
90
+ // https://github.com/nodejs/node/issues/41038
85
91
  // no one of current implementations supports new (html/5749) error cloning semantic
86
92
  var nativeStructuredClone = global.structuredClone;
87
93
 
88
- var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone) || !checkNewErrorsCloningSemantic(nativeStructuredClone);
94
+ var FORCED_REPLACEMENT = IS_PURE
95
+ || !checkErrorsCloning(nativeStructuredClone, Error)
96
+ || !checkErrorsCloning(nativeStructuredClone, DOMException)
97
+ || !checkNewErrorsCloningSemantic(nativeStructuredClone);
89
98
 
90
99
  // Chrome 82+, Safari 14.1+, Deno 1.11+
91
100
  // Chrome 78-81 implementation swaps `.name` and `.message` of cloned `DOMException`
@@ -397,6 +406,9 @@ var structuredCloneInternal = function (value, map) {
397
406
  };
398
407
 
399
408
  var PROPER_TRANSFER = nativeStructuredClone && !fails(function () {
409
+ // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation
410
+ // https://github.com/zloirock/core-js/issues/679
411
+ if ((IS_DENO && V8 > 92) || (IS_NODE && V8 > 94) || (IS_BROWSER && V8 > 97)) return false;
400
412
  var buffer = new ArrayBuffer(8);
401
413
  var clone = nativeStructuredClone(buffer, { transfer: [buffer] });
402
414
  return buffer.byteLength != 0 || clone.byteLength != 8;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js",
3
3
  "description": "Standard library",
4
- "version": "3.22.8",
4
+ "version": "3.23.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"
@@ -0,0 +1,3 @@
1
+ // https://github.com/tc39/proposal-array-grouping
2
+ require('../modules/esnext.array.group');
3
+ require('../modules/esnext.array.group-to-map');
@@ -1,3 +1,4 @@
1
1
  // https://github.com/tc39/proposal-array-grouping
2
+ // TODO: Remove from `core-js@4`
2
3
  require('../modules/esnext.array.group-by');
3
4
  require('../modules/esnext.array.group-by-to-map');
@@ -0,0 +1,2 @@
1
+ // https://github.com/tc39/proposal-decorator-metadata
2
+ require('../modules/esnext.symbol.metadata-key');
@@ -1,4 +1,3 @@
1
- // TODO: The metadata API is splitting out into a separate Stage 2 proposal
2
- // so required a new entry point for it when it will be finally formed
1
+ // TODO: Remove from `core-js@4`
3
2
  // https://github.com/tc39/proposal-decorators
4
3
  require('../modules/esnext.symbol.metadata');
@@ -0,0 +1 @@
1
+ module.exports = require('../../es/array/find-last-index');
@@ -0,0 +1 @@
1
+ module.exports = require('../../es/array/find-last');
@@ -0,0 +1,3 @@
1
+ var parent = require('../../es/array/push');
2
+
3
+ module.exports = parent;
@@ -0,0 +1,3 @@
1
+ var parent = require('../../es/array/unshift');
2
+
3
+ module.exports = parent;
@@ -0,0 +1 @@
1
+ module.exports = require('../../../es/array/virtual/find-last-index');
@@ -0,0 +1 @@
1
+ module.exports = require('../../../es/array/virtual/find-last');
@@ -0,0 +1,3 @@
1
+ var parent = require('../../../es/array/virtual/push');
2
+
3
+ module.exports = parent;
@@ -0,0 +1,3 @@
1
+ var parent = require('../../../es/array/virtual/unshift');
2
+
3
+ module.exports = parent;
package/stable/index.js CHANGED
@@ -25,6 +25,8 @@ require('../modules/es.array.fill');
25
25
  require('../modules/es.array.filter');
26
26
  require('../modules/es.array.find');
27
27
  require('../modules/es.array.find-index');
28
+ require('../modules/es.array.find-last');
29
+ require('../modules/es.array.find-last-index');
28
30
  require('../modules/es.array.flat');
29
31
  require('../modules/es.array.flat-map');
30
32
  require('../modules/es.array.for-each');
@@ -37,6 +39,7 @@ require('../modules/es.array.join');
37
39
  require('../modules/es.array.last-index-of');
38
40
  require('../modules/es.array.map');
39
41
  require('../modules/es.array.of');
42
+ require('../modules/es.array.push');
40
43
  require('../modules/es.array.reduce');
41
44
  require('../modules/es.array.reduce-right');
42
45
  require('../modules/es.array.reverse');
@@ -47,6 +50,7 @@ require('../modules/es.array.species');
47
50
  require('../modules/es.array.splice');
48
51
  require('../modules/es.array.unscopables.flat');
49
52
  require('../modules/es.array.unscopables.flat-map');
53
+ require('../modules/es.array.unshift');
50
54
  require('../modules/es.array-buffer.constructor');
51
55
  require('../modules/es.array-buffer.is-view');
52
56
  require('../modules/es.array-buffer.slice');
@@ -202,6 +206,8 @@ require('../modules/es.typed-array.fill');
202
206
  require('../modules/es.typed-array.filter');
203
207
  require('../modules/es.typed-array.find');
204
208
  require('../modules/es.typed-array.find-index');
209
+ require('../modules/es.typed-array.find-last');
210
+ require('../modules/es.typed-array.find-last-index');
205
211
  require('../modules/es.typed-array.for-each');
206
212
  require('../modules/es.typed-array.from');
207
213
  require('../modules/es.typed-array.includes');
@@ -0,0 +1,3 @@
1
+ var parent = require('../../es/instance/find-last-index');
2
+
3
+ module.exports = parent;
@@ -0,0 +1,3 @@
1
+ var parent = require('../../es/instance/find-last');
2
+
3
+ module.exports = parent;
@@ -0,0 +1,3 @@
1
+ var parent = require('../../es/instance/push');
2
+
3
+ module.exports = parent;
@@ -0,0 +1,3 @@
1
+ var parent = require('../../es/instance/push');
2
+
3
+ module.exports = parent;
@@ -0,0 +1 @@
1
+ module.exports = require('../../es/typed-array/find-last-index');
@@ -0,0 +1 @@
1
+ module.exports = require('../../es/typed-array/find-last');
package/stage/2.js CHANGED
@@ -1,12 +1,13 @@
1
1
  require('../proposals/array-from-async-stage-2');
2
2
  require('../proposals/array-is-template-object');
3
- require('../proposals/decorators');
3
+ require('../proposals/decorator-metadata');
4
4
  require('../proposals/iterator-helpers');
5
5
  require('../proposals/map-upsert-stage-2');
6
6
  require('../proposals/set-methods');
7
7
  require('../proposals/using-statement');
8
8
  // TODO: Obsolete versions, remove from `core-js@4`
9
9
  require('../proposals/array-grouping');
10
+ require('../proposals/decorators');
10
11
  var parent = require('./3');
11
12
 
12
13
  module.exports = parent;
package/stage/3.js CHANGED
@@ -1,6 +1,8 @@
1
1
  require('../proposals/array-find-from-last');
2
- require('../proposals/array-grouping-stage-3');
2
+ require('../proposals/array-grouping-stage-3-2');
3
3
  require('../proposals/change-array-by-copy');
4
+ // TODO: Obsolete versions, remove from `core-js@4`
5
+ require('../proposals/array-grouping-stage-3');
4
6
  var parent = require('./4');
5
7
 
6
8
  module.exports = parent;