core-js-pure 3.10.2 → 3.11.3

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');
@@ -0,0 +1 @@
1
+ module.exports = typeof window == 'object';
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
  };
@@ -47,6 +47,8 @@ if (!queueMicrotask) {
47
47
  } else if (Promise && Promise.resolve) {
48
48
  // Promise.resolve without an argument throws an error in LG WebOS 2
49
49
  promise = Promise.resolve(undefined);
50
+ // workaround of WebKit ~ iOS Safari 10.1 bug
51
+ promise.constructor = Promise;
50
52
  then = promise.then;
51
53
  notify = function () {
52
54
  then.call(promise, flush);
@@ -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.2',
7
+ version: '3.11.3',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
10
10
  });
@@ -30,7 +30,10 @@ $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
30
30
  }
31
31
  });
32
32
 
33
- // patch native Promise.prototype for native async functions
34
- if (!IS_PURE && typeof NativePromise == 'function' && !NativePromise.prototype['finally']) {
35
- redefine(NativePromise.prototype, 'finally', getBuiltIn('Promise').prototype['finally']);
33
+ // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
34
+ if (!IS_PURE && typeof NativePromise == 'function') {
35
+ var method = getBuiltIn('Promise').prototype['finally'];
36
+ if (NativePromise.prototype['finally'] !== method) {
37
+ redefine(NativePromise.prototype, 'finally', method, { unsafe: true });
38
+ }
36
39
  }
@@ -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');
@@ -24,6 +25,7 @@ var perform = require('../internals/perform');
24
25
  var InternalStateModule = require('../internals/internal-state');
25
26
  var isForced = require('../internals/is-forced');
26
27
  var wellKnownSymbol = require('../internals/well-known-symbol');
28
+ var IS_BROWSER = require('../internals/engine-is-browser');
27
29
  var IS_NODE = require('../internals/engine-is-node');
28
30
  var V8_VERSION = require('../internals/engine-v8-version');
29
31
 
@@ -32,11 +34,12 @@ var PROMISE = 'Promise';
32
34
  var getInternalState = InternalStateModule.get;
33
35
  var setInternalState = InternalStateModule.set;
34
36
  var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
37
+ var NativePromisePrototype = NativePromise && NativePromise.prototype;
35
38
  var PromiseConstructor = NativePromise;
39
+ var PromiseConstructorPrototype = NativePromisePrototype;
36
40
  var TypeError = global.TypeError;
37
41
  var document = global.document;
38
42
  var process = global.process;
39
- var $fetch = getBuiltIn('fetch');
40
43
  var newPromiseCapability = newPromiseCapabilityModule.f;
41
44
  var newGenericPromiseCapability = newPromiseCapability;
42
45
  var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
@@ -48,32 +51,32 @@ var FULFILLED = 1;
48
51
  var REJECTED = 2;
49
52
  var HANDLED = 1;
50
53
  var UNHANDLED = 2;
54
+ var SUBCLASSING = false;
51
55
  var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
52
56
 
53
57
  var FORCED = isForced(PROMISE, function () {
54
58
  var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
55
- if (!GLOBAL_CORE_JS_PROMISE) {
56
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
57
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
58
- // We can't detect it synchronously, so just check versions
59
- if (V8_VERSION === 66) return true;
60
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
61
- if (!IS_NODE && !NATIVE_REJECTION_EVENT) return true;
62
- }
59
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
60
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
61
+ // We can't detect it synchronously, so just check versions
62
+ if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
63
63
  // We need Promise#finally in the pure version for preventing prototype pollution
64
- if (IS_PURE && !PromiseConstructor.prototype['finally']) return true;
64
+ if (IS_PURE && !PromiseConstructorPrototype['finally']) return true;
65
65
  // We can't use @@species feature detection in V8 since it causes
66
66
  // deoptimization and performance degradation
67
67
  // https://github.com/zloirock/core-js/issues/679
68
68
  if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor)) return false;
69
69
  // Detect correctness of subclassing with @@species support
70
- var promise = PromiseConstructor.resolve(1);
70
+ var promise = new PromiseConstructor(function (resolve) { resolve(1); });
71
71
  var FakePromise = function (exec) {
72
72
  exec(function () { /* empty */ }, function () { /* empty */ });
73
73
  };
74
74
  var constructor = promise.constructor = {};
75
75
  constructor[SPECIES] = FakePromise;
76
- return !(promise.then(function () { /* empty */ }) instanceof FakePromise);
76
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
77
+ if (!SUBCLASSING) return true;
78
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
79
+ return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
77
80
  });
78
81
 
79
82
  var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
@@ -237,6 +240,7 @@ if (FORCED) {
237
240
  internalReject(state, error);
238
241
  }
239
242
  };
243
+ PromiseConstructorPrototype = PromiseConstructor.prototype;
240
244
  // eslint-disable-next-line no-unused-vars -- required for `.length`
241
245
  Internal = function Promise(executor) {
242
246
  setInternalState(this, {
@@ -250,7 +254,7 @@ if (FORCED) {
250
254
  value: undefined
251
255
  });
252
256
  };
253
- Internal.prototype = redefineAll(PromiseConstructor.prototype, {
257
+ Internal.prototype = redefineAll(PromiseConstructorPrototype, {
254
258
  // `Promise.prototype.then` method
255
259
  // https://tc39.es/ecma262/#sec-promise.prototype.then
256
260
  then: function then(onFulfilled, onRejected) {
@@ -283,25 +287,32 @@ if (FORCED) {
283
287
  : newGenericPromiseCapability(C);
284
288
  };
285
289
 
286
- if (!IS_PURE && typeof NativePromise == 'function') {
287
- nativeThen = NativePromise.prototype.then;
290
+ if (!IS_PURE && typeof NativePromise == 'function' && NativePromisePrototype !== Object.prototype) {
291
+ nativeThen = NativePromisePrototype.then;
288
292
 
289
- // wrap native Promise#then for native async functions
290
- redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {
291
- var that = this;
292
- return new PromiseConstructor(function (resolve, reject) {
293
- nativeThen.call(that, resolve, reject);
294
- }).then(onFulfilled, onRejected);
295
- // https://github.com/zloirock/core-js/issues/640
296
- }, { unsafe: true });
293
+ if (!SUBCLASSING) {
294
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
295
+ redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
296
+ var that = this;
297
+ return new PromiseConstructor(function (resolve, reject) {
298
+ nativeThen.call(that, resolve, reject);
299
+ }).then(onFulfilled, onRejected);
300
+ // https://github.com/zloirock/core-js/issues/640
301
+ }, { unsafe: true });
297
302
 
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
- });
303
+ // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
304
+ redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true });
305
+ }
306
+
307
+ // make `.constructor === Promise` work for native promise-based APIs
308
+ try {
309
+ delete NativePromisePrototype.constructor;
310
+ } catch (error) { /* empty */ }
311
+
312
+ // make `instanceof Promise` work for native promise-based APIs
313
+ if (setPrototypeOf) {
314
+ setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype);
315
+ }
305
316
  }
306
317
  }
307
318
 
@@ -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
+ });
@@ -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
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js-pure",
3
3
  "description": "Standard library",
4
- "version": "3.10.2",
4
+ "version": "3.11.3",
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": "871050326809b302c67e4fb4e0e4007a2db7b8e8"
58
+ "gitHead": "bfe345ad3db933bdf1d5fd934c57959f83d30a91"
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');