core-js 3.10.0 → 3.11.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.
package/features/index.js CHANGED
@@ -285,6 +285,7 @@ require('../modules/esnext.math.signbit');
285
285
  require('../modules/esnext.math.umulh');
286
286
  require('../modules/esnext.number.from-string');
287
287
  require('../modules/esnext.number.range');
288
+ require('../modules/esnext.object.has-own');
288
289
  require('../modules/esnext.object.iterate-entries');
289
290
  require('../modules/esnext.object.iterate-keys');
290
291
  require('../modules/esnext.object.iterate-values');
@@ -0,0 +1,4 @@
1
+ require('../../modules/esnext.object.has-own');
2
+ var path = require('../../internals/path');
3
+
4
+ module.exports = path.Object.hasOwn;
@@ -1,4 +1,5 @@
1
1
  var parent = require('../../es/object');
2
+ require('../../modules/esnext.object.has-own');
2
3
  require('../../modules/esnext.object.iterate-entries');
3
4
  require('../../modules/esnext.object.iterate-keys');
4
5
  require('../../modules/esnext.object.iterate-values');
@@ -81,9 +81,9 @@ var exportTypedArrayMethod = function (KEY, property, forced) {
81
81
  if (!DESCRIPTORS) return;
82
82
  if (forced) for (var ARRAY in TypedArrayConstructorsList) {
83
83
  var TypedArrayConstructor = global[ARRAY];
84
- if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) {
84
+ if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) try {
85
85
  delete TypedArrayConstructor.prototype[KEY];
86
- }
86
+ } catch (error) { /* empty */ }
87
87
  }
88
88
  if (!TypedArrayPrototype[KEY] || forced) {
89
89
  redefine(TypedArrayPrototype, KEY, forced ? property
@@ -97,14 +97,14 @@ var exportTypedArrayStaticMethod = function (KEY, property, forced) {
97
97
  if (setPrototypeOf) {
98
98
  if (forced) for (ARRAY in TypedArrayConstructorsList) {
99
99
  TypedArrayConstructor = global[ARRAY];
100
- if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) {
100
+ if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) try {
101
101
  delete TypedArrayConstructor[KEY];
102
- }
102
+ } catch (error) { /* empty */ }
103
103
  }
104
104
  if (!TypedArray[KEY] || forced) {
105
105
  // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
106
106
  try {
107
- return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property);
107
+ return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
108
108
  } catch (error) { /* empty */ }
109
109
  } else return;
110
110
  }
@@ -1,3 +1,3 @@
1
1
  var userAgent = require('../internals/engine-user-agent');
2
2
 
3
- module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
3
+ module.exports = /(?:iphone|ipod|ipad).*applewebkit/i.test(userAgent);
@@ -4,7 +4,6 @@ require('../modules/es.regexp.exec');
4
4
  var redefine = require('../internals/redefine');
5
5
  var fails = require('../internals/fails');
6
6
  var wellKnownSymbol = require('../internals/well-known-symbol');
7
- var regexpExec = require('../internals/regexp-exec');
8
7
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
9
8
 
10
9
  var SPECIES = wellKnownSymbol('species');
@@ -95,7 +94,7 @@ module.exports = function (KEY, length, exec, sham) {
95
94
  ) {
96
95
  var nativeRegExpMethod = /./[SYMBOL];
97
96
  var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
98
- if (regexp.exec === regexpExec) {
97
+ if (regexp.exec === RegExp.prototype.exec) {
99
98
  if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
100
99
  // The native String method already delegates to @@method (this
101
100
  // polyfilled function), leasing to infinite recursion.
package/internals/has.js CHANGED
@@ -1,5 +1,7 @@
1
+ var toObject = require('../internals/to-object');
2
+
1
3
  var hasOwnProperty = {}.hasOwnProperty;
2
4
 
3
- module.exports = function (it, key) {
4
- return hasOwnProperty.call(it, key);
5
+ module.exports = function hasOwn(it, key) {
6
+ return hasOwnProperty.call(toObject(it), key);
5
7
  };
@@ -7,6 +7,7 @@ var shared = require('../internals/shared-store');
7
7
  var sharedKey = require('../internals/shared-key');
8
8
  var hiddenKeys = require('../internals/hidden-keys');
9
9
 
10
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
10
11
  var WeakMap = global.WeakMap;
11
12
  var set, get, has;
12
13
 
@@ -29,6 +30,7 @@ if (NATIVE_WEAK_MAP) {
29
30
  var wmhas = store.has;
30
31
  var wmset = store.set;
31
32
  set = function (it, metadata) {
33
+ if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
32
34
  metadata.facade = it;
33
35
  wmset.call(store, it, metadata);
34
36
  return metadata;
@@ -43,6 +45,7 @@ if (NATIVE_WEAK_MAP) {
43
45
  var STATE = sharedKey('state');
44
46
  hiddenKeys[STATE] = true;
45
47
  set = function (it, metadata) {
48
+ if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
46
49
  metadata.facade = it;
47
50
  createNonEnumerableProperty(it, STATE, metadata);
48
51
  return metadata;
@@ -4,9 +4,6 @@ var stickyHelpers = require('./regexp-sticky-helpers');
4
4
  var shared = require('./shared');
5
5
 
6
6
  var nativeExec = RegExp.prototype.exec;
7
- // This always refers to the native implementation, because the
8
- // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
9
- // which loads this file before patching the method.
10
7
  var nativeReplace = shared('native-string-replace', String.prototype.replace);
11
8
 
12
9
  var patchedExec = nativeExec;
@@ -22,7 +19,7 @@ var UPDATES_LAST_INDEX_WRONG = (function () {
22
19
  var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
23
20
 
24
21
  // nonparticipating capturing group, copied from es5-shim's String#split patch.
25
- // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
22
+ // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing
26
23
  var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
27
24
 
28
25
  var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
@@ -4,7 +4,7 @@ var store = require('../internals/shared-store');
4
4
  (module.exports = function (key, value) {
5
5
  return store[key] || (store[key] = value !== undefined ? value : {});
6
6
  })('versions', []).push({
7
- version: '3.10.0',
7
+ version: '3.11.1',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
10
10
  });
@@ -2,4 +2,4 @@
2
2
  var userAgent = require('../internals/engine-user-agent');
3
3
 
4
4
  // eslint-disable-next-line unicorn/no-unsafe-regex -- safe
5
- module.exports = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
5
+ module.exports = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent);
@@ -6,6 +6,7 @@ var getBuiltIn = require('../internals/get-built-in');
6
6
  var NativePromise = require('../internals/native-promise-constructor');
7
7
  var redefine = require('../internals/redefine');
8
8
  var redefineAll = require('../internals/redefine-all');
9
+ var setPrototypeOf = require('../internals/object-set-prototype-of');
9
10
  var setToStringTag = require('../internals/set-to-string-tag');
10
11
  var setSpecies = require('../internals/set-species');
11
12
  var isObject = require('../internals/is-object');
@@ -32,11 +33,11 @@ var PROMISE = 'Promise';
32
33
  var getInternalState = InternalStateModule.get;
33
34
  var setInternalState = InternalStateModule.set;
34
35
  var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
36
+ var NativePromisePrototype = NativePromise && NativePromise.prototype;
35
37
  var PromiseConstructor = NativePromise;
36
38
  var TypeError = global.TypeError;
37
39
  var document = global.document;
38
40
  var process = global.process;
39
- var $fetch = getBuiltIn('fetch');
40
41
  var newPromiseCapability = newPromiseCapabilityModule.f;
41
42
  var newGenericPromiseCapability = newPromiseCapability;
42
43
  var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
@@ -283,11 +284,11 @@ if (FORCED) {
283
284
  : newGenericPromiseCapability(C);
284
285
  };
285
286
 
286
- if (!IS_PURE && typeof NativePromise == 'function') {
287
- nativeThen = NativePromise.prototype.then;
287
+ if (!IS_PURE && typeof NativePromise == 'function' && NativePromisePrototype !== Object.prototype) {
288
+ nativeThen = NativePromisePrototype.then;
288
289
 
289
- // wrap native Promise#then for native async functions
290
- redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {
290
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
291
+ redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
291
292
  var that = this;
292
293
  return new PromiseConstructor(function (resolve, reject) {
293
294
  nativeThen.call(that, resolve, reject);
@@ -295,13 +296,15 @@ if (FORCED) {
295
296
  // https://github.com/zloirock/core-js/issues/640
296
297
  }, { unsafe: true });
297
298
 
298
- // wrap fetch result
299
- if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, {
300
- // eslint-disable-next-line no-unused-vars -- required for `.length`
301
- fetch: function fetch(input /* , init */) {
302
- return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));
303
- }
304
- });
299
+ // make `.constructor === Promise` work for native promise-based APIs
300
+ try {
301
+ delete NativePromisePrototype.constructor;
302
+ } catch (error) { /* empty */ }
303
+
304
+ // make `instanceof Promise` work for native promise-based APIs
305
+ if (setPrototypeOf) {
306
+ setPrototypeOf(NativePromisePrototype, PromiseConstructor.prototype);
307
+ }
305
308
  }
306
309
  }
307
310
 
@@ -9,7 +9,7 @@ var getFlags = require('../internals/regexp-flags');
9
9
  var stickyHelpers = require('../internals/regexp-sticky-helpers');
10
10
  var redefine = require('../internals/redefine');
11
11
  var fails = require('../internals/fails');
12
- var setInternalState = require('../internals/internal-state').set;
12
+ var enforceInternalState = require('../internals/internal-state').enforce;
13
13
  var setSpecies = require('../internals/set-species');
14
14
  var wellKnownSymbol = require('../internals/well-known-symbol');
15
15
 
@@ -61,7 +61,10 @@ if (FORCED) {
61
61
  RegExpWrapper
62
62
  );
63
63
 
64
- if (UNSUPPORTED_Y && sticky) setInternalState(result, { sticky: sticky });
64
+ if (UNSUPPORTED_Y && sticky) {
65
+ var state = enforceInternalState(result);
66
+ state.sticky = true;
67
+ }
65
68
 
66
69
  return result;
67
70
  };
@@ -8,15 +8,13 @@ var advanceStringIndex = require('../internals/advance-string-index');
8
8
  var toLength = require('../internals/to-length');
9
9
  var callRegExpExec = require('../internals/regexp-exec-abstract');
10
10
  var regexpExec = require('../internals/regexp-exec');
11
- var fails = require('../internals/fails');
11
+ var stickyHelpers = require('../internals/regexp-sticky-helpers');
12
12
 
13
+ var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
13
14
  var arrayPush = [].push;
14
15
  var min = Math.min;
15
16
  var MAX_UINT32 = 0xFFFFFFFF;
16
17
 
17
- // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
18
- var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
19
-
20
18
  // @@split logic
21
19
  fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
22
20
  var internalSplit;
@@ -99,11 +97,11 @@ fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCal
99
97
  var flags = (rx.ignoreCase ? 'i' : '') +
100
98
  (rx.multiline ? 'm' : '') +
101
99
  (rx.unicode ? 'u' : '') +
102
- (SUPPORTS_Y ? 'y' : 'g');
100
+ (UNSUPPORTED_Y ? 'g' : 'y');
103
101
 
104
102
  // ^(? + rx + ) is needed, in combination with some S slicing, to
105
103
  // simulate the 'y' flag.
106
- var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
104
+ var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
107
105
  var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
108
106
  if (lim === 0) return [];
109
107
  if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
@@ -111,12 +109,12 @@ fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCal
111
109
  var q = 0;
112
110
  var A = [];
113
111
  while (q < S.length) {
114
- splitter.lastIndex = SUPPORTS_Y ? q : 0;
115
- var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
112
+ splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
113
+ var z = callRegExpExec(splitter, UNSUPPORTED_Y ? S.slice(q) : S);
116
114
  var e;
117
115
  if (
118
116
  z === null ||
119
- (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
117
+ (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
120
118
  ) {
121
119
  q = advanceStringIndex(S, q, unicodeMatching);
122
120
  } else {
@@ -133,4 +131,4 @@ fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCal
133
131
  return A;
134
132
  }
135
133
  ];
136
- }, !SUPPORTS_Y);
134
+ }, UNSUPPORTED_Y);
@@ -0,0 +1,8 @@
1
+ var $ = require('../internals/export');
2
+ var hasOwn = require('../internals/has');
3
+
4
+ // `Object.hasOwn` method
5
+ // https://github.com/tc39/proposal-accessible-object-hasownproperty
6
+ $({ target: 'Object', stat: true }, {
7
+ hasOwn: hasOwn
8
+ });
@@ -40,7 +40,8 @@ var subscriptionClosed = function (subscriptionState) {
40
40
  return subscriptionState.observer === undefined;
41
41
  };
42
42
 
43
- var close = function (subscription, subscriptionState) {
43
+ var close = function (subscriptionState) {
44
+ var subscription = subscriptionState.facade;
44
45
  if (!DESCRIPTORS) {
45
46
  subscription.closed = true;
46
47
  var subscriptionObserver = subscriptionState.subscriptionObserver;
@@ -79,7 +80,7 @@ Subscription.prototype = redefineAll({}, {
79
80
  unsubscribe: function unsubscribe() {
80
81
  var subscriptionState = getInternalState(this);
81
82
  if (!subscriptionClosed(subscriptionState)) {
82
- close(this, subscriptionState);
83
+ close(subscriptionState);
83
84
  cleanupSubscription(subscriptionState);
84
85
  }
85
86
  }
@@ -111,11 +112,10 @@ SubscriptionObserver.prototype = redefineAll({}, {
111
112
  }
112
113
  },
113
114
  error: function error(value) {
114
- var subscription = getInternalState(this).subscription;
115
- var subscriptionState = getInternalState(subscription);
115
+ var subscriptionState = getInternalState(getInternalState(this).subscription);
116
116
  if (!subscriptionClosed(subscriptionState)) {
117
117
  var observer = subscriptionState.observer;
118
- close(subscription, subscriptionState);
118
+ close(subscriptionState);
119
119
  try {
120
120
  var errorMethod = getMethod(observer.error);
121
121
  if (errorMethod) errorMethod.call(observer, value);
@@ -126,11 +126,10 @@ SubscriptionObserver.prototype = redefineAll({}, {
126
126
  }
127
127
  },
128
128
  complete: function complete() {
129
- var subscription = getInternalState(this).subscription;
130
- var subscriptionState = getInternalState(subscription);
129
+ var subscriptionState = getInternalState(getInternalState(this).subscription);
131
130
  if (!subscriptionClosed(subscriptionState)) {
132
131
  var observer = subscriptionState.observer;
133
- close(subscription, subscriptionState);
132
+ close(subscriptionState);
134
133
  try {
135
134
  var completeMethod = getMethod(observer.complete);
136
135
  if (completeMethod) completeMethod.call(observer);
@@ -31,6 +31,7 @@ var INVALID_HOST = 'Invalid host';
31
31
  var INVALID_PORT = 'Invalid port';
32
32
 
33
33
  var ALPHA = /[A-Za-z]/;
34
+ // eslint-disable-next-line regexp/no-obscure-range -- safe
34
35
  var ALPHANUMERIC = /[\d+-.A-Za-z]/;
35
36
  var DIGIT = /\d/;
36
37
  var HEX_START = /^(0x|0X)/;
@@ -38,10 +39,10 @@ var OCT = /^[0-7]+$/;
38
39
  var DEC = /^\d+$/;
39
40
  var HEX = /^[\dA-Fa-f]+$/;
40
41
  /* eslint-disable no-control-regex -- safe */
41
- var FORBIDDEN_HOST_CODE_POINT = /[\u0000\t\u000A\u000D #%/:?@[\\]]/;
42
- var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\t\u000A\u000D #/:?@[\\]]/;
42
+ var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:?@[\\]]/;
43
+ var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:?@[\\]]/;
43
44
  var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
44
- var TAB_AND_NEW_LINE = /[\t\u000A\u000D]/g;
45
+ var TAB_AND_NEW_LINE = /[\t\n\r]/g;
45
46
  /* eslint-enable no-control-regex -- safe */
46
47
  var EOF;
47
48
 
@@ -800,7 +801,7 @@ var getOrigin = function () {
800
801
  var scheme = url.scheme;
801
802
  var port = url.port;
802
803
  if (scheme == 'blob') try {
803
- return new URL(scheme.path[0]).origin;
804
+ return new URLConstructor(scheme.path[0]).origin;
804
805
  } catch (error) {
805
806
  return 'null';
806
807
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js",
3
3
  "description": "Standard library",
4
- "version": "3.10.0",
4
+ "version": "3.11.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git",
@@ -55,5 +55,5 @@
55
55
  "scripts": {
56
56
  "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
57
57
  },
58
- "gitHead": "bb9b7f58458914e54cb4dbc130374a4c0487fca5"
58
+ "gitHead": "1e9c4fbb22c7954d50a4db09d40d5c7648bead88"
59
59
  }
@@ -0,0 +1,2 @@
1
+ // https://github.com/tc39/proposal-accessible-object-hasownproperty
2
+ require('../modules/esnext.object.has-own');
package/stage/2.js CHANGED
@@ -1,3 +1,4 @@
1
+ require('../proposals/accessible-object-hasownproperty');
1
2
  require('../proposals/array-find-from-last');
2
3
  require('../proposals/array-is-template-object');
3
4
  require('../proposals/iterator-helpers');