core-js 3.11.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.
@@ -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
  }
@@ -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.11.0',
7
+ version: '3.11.1',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
10
10
  });
@@ -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
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js",
3
3
  "description": "Standard library",
4
- "version": "3.11.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": "e94a771bfe1c88f1c37c4fa05505e82e84739493"
58
+ "gitHead": "1e9c4fbb22c7954d50a4db09d40d5c7648bead88"
59
59
  }