@tryghost/content-api 1.5.16 → 1.5.17

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-2021 Ghost Foundation
3
+ Copyright (c) 2013-2022 Ghost Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -18,4 +18,4 @@ Follow the instructions for the top-level repo.
18
18
 
19
19
  # Copyright & License
20
20
 
21
- Copyright (c) 2013-2021 Ghost Foundation - Released under the [MIT license](LICENSE).
21
+ Copyright (c) 2013-2022 Ghost Foundation - Released under the [MIT license](LICENSE).
package/es/content-api.js CHANGED
@@ -48,9 +48,15 @@ var descriptors = !fails(function () {
48
48
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
49
49
  });
50
50
 
51
+ var functionBindNative = !fails(function () {
52
+ var test = (function () { /* empty */ }).bind();
53
+ // eslint-disable-next-line no-prototype-builtins -- safe
54
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
55
+ });
56
+
51
57
  var call$2 = Function.prototype.call;
52
58
 
53
- var functionCall = call$2.bind ? call$2.bind(call$2) : function () {
59
+ var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
54
60
  return call$2.apply(call$2, arguments);
55
61
  };
56
62
 
@@ -63,13 +69,13 @@ var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1:
63
69
 
64
70
  // `Object.prototype.propertyIsEnumerable` method implementation
65
71
  // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
66
- var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
72
+ var f$6 = NASHORN_BUG ? function propertyIsEnumerable(V) {
67
73
  var descriptor = getOwnPropertyDescriptor$4(this, V);
68
74
  return !!descriptor && descriptor.enumerable;
69
75
  } : $propertyIsEnumerable;
70
76
 
71
77
  var objectPropertyIsEnumerable = {
72
- f: f$5
78
+ f: f$6
73
79
  };
74
80
 
75
81
  var createPropertyDescriptor = function (bitmap, value) {
@@ -82,12 +88,12 @@ var createPropertyDescriptor = function (bitmap, value) {
82
88
  };
83
89
 
84
90
  var FunctionPrototype$3 = Function.prototype;
85
- var bind$4 = FunctionPrototype$3.bind;
91
+ var bind$3 = FunctionPrototype$3.bind;
86
92
  var call$1 = FunctionPrototype$3.call;
87
- var callBind = bind$4 && bind$4.bind(call$1);
93
+ var uncurryThis = functionBindNative && bind$3.bind(call$1, call$1);
88
94
 
89
- var functionUncurryThis = bind$4 ? function (fn) {
90
- return fn && callBind(call$1, fn);
95
+ var functionUncurryThis = functionBindNative ? function (fn) {
96
+ return fn && uncurryThis(fn);
91
97
  } : function (fn) {
92
98
  return fn && function () {
93
99
  return call$1.apply(fn, arguments);
@@ -264,9 +270,11 @@ var shared = createCommonjsModule(function (module) {
264
270
  (module.exports = function (key, value) {
265
271
  return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
266
272
  })('versions', []).push({
267
- version: '3.19.1',
273
+ version: '3.20.3',
268
274
  mode: 'global',
269
- copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
275
+ copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
276
+ license: 'https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE',
277
+ source: 'https://github.com/zloirock/core-js'
270
278
  });
271
279
  });
272
280
 
@@ -346,32 +354,42 @@ var documentCreateElement = function (it) {
346
354
  return EXISTS$1 ? document$3.createElement(it) : {};
347
355
  };
348
356
 
349
- // Thank's IE8 for his funny defineProperty
357
+ // Thanks to IE8 for its funny defineProperty
350
358
  var ie8DomDefine = !descriptors && !fails(function () {
351
- // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
359
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
352
360
  return Object.defineProperty(documentCreateElement('div'), 'a', {
353
361
  get: function () { return 7; }
354
362
  }).a != 7;
355
363
  });
356
364
 
357
365
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
358
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
366
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
359
367
 
360
368
  // `Object.getOwnPropertyDescriptor` method
361
369
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
362
- var f$4 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
370
+ var f$5 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
363
371
  O = toIndexedObject(O);
364
372
  P = toPropertyKey(P);
365
373
  if (ie8DomDefine) try {
366
- return $getOwnPropertyDescriptor(O, P);
374
+ return $getOwnPropertyDescriptor$1(O, P);
367
375
  } catch (error) { /* empty */ }
368
376
  if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
369
377
  };
370
378
 
371
379
  var objectGetOwnPropertyDescriptor = {
372
- f: f$4
380
+ f: f$5
373
381
  };
374
382
 
383
+ // V8 ~ Chrome 36-
384
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
385
+ var v8PrototypeDefineBug = descriptors && fails(function () {
386
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
387
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
388
+ value: 42,
389
+ writable: false
390
+ }).prototype != 42;
391
+ });
392
+
375
393
  var String$4 = global_1.String;
376
394
  var TypeError$b = global_1.TypeError;
377
395
 
@@ -384,10 +402,30 @@ var anObject = function (argument) {
384
402
  var TypeError$a = global_1.TypeError;
385
403
  // eslint-disable-next-line es/no-object-defineproperty -- safe
386
404
  var $defineProperty = Object.defineProperty;
405
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
406
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
407
+ var ENUMERABLE = 'enumerable';
408
+ var CONFIGURABLE$1 = 'configurable';
409
+ var WRITABLE = 'writable';
387
410
 
388
411
  // `Object.defineProperty` method
389
412
  // https://tc39.es/ecma262/#sec-object.defineproperty
390
- var f$3 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
413
+ var f$4 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
414
+ anObject(O);
415
+ P = toPropertyKey(P);
416
+ anObject(Attributes);
417
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
418
+ var current = $getOwnPropertyDescriptor(O, P);
419
+ if (current && current[WRITABLE]) {
420
+ O[P] = Attributes.value;
421
+ Attributes = {
422
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
423
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
424
+ writable: false
425
+ };
426
+ }
427
+ } return $defineProperty(O, P, Attributes);
428
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
391
429
  anObject(O);
392
430
  P = toPropertyKey(P);
393
431
  anObject(Attributes);
@@ -400,7 +438,7 @@ var f$3 = descriptors ? $defineProperty : function defineProperty(O, P, Attribut
400
438
  };
401
439
 
402
440
  var objectDefineProperty = {
403
- f: f$3
441
+ f: f$4
404
442
  };
405
443
 
406
444
  var createNonEnumerableProperty = descriptors ? function (object, key, value) {
@@ -649,19 +687,19 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
649
687
  // `Object.getOwnPropertyNames` method
650
688
  // https://tc39.es/ecma262/#sec-object.getownpropertynames
651
689
  // eslint-disable-next-line es/no-object-getownpropertynames -- safe
652
- var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
690
+ var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
653
691
  return objectKeysInternal(O, hiddenKeys);
654
692
  };
655
693
 
656
694
  var objectGetOwnPropertyNames = {
657
- f: f$2
695
+ f: f$3
658
696
  };
659
697
 
660
698
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
661
- var f$1 = Object.getOwnPropertySymbols;
699
+ var f$2 = Object.getOwnPropertySymbols;
662
700
 
663
701
  var objectGetOwnPropertySymbols = {
664
- f: f$1
702
+ f: f$2
665
703
  };
666
704
 
667
705
  var concat$1 = functionUncurryThis([].concat);
@@ -673,13 +711,15 @@ var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
673
711
  return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
674
712
  };
675
713
 
676
- var copyConstructorProperties = function (target, source) {
714
+ var copyConstructorProperties = function (target, source, exceptions) {
677
715
  var keys = ownKeys(source);
678
716
  var defineProperty = objectDefineProperty.f;
679
717
  var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
680
718
  for (var i = 0; i < keys.length; i++) {
681
719
  var key = keys[i];
682
- if (!hasOwnProperty_1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
720
+ if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
721
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
722
+ }
683
723
  }
684
724
  };
685
725
 
@@ -789,7 +829,7 @@ var objectKeys = Object.keys || function keys(O) {
789
829
  // `Object.defineProperties` method
790
830
  // https://tc39.es/ecma262/#sec-object.defineproperties
791
831
  // eslint-disable-next-line es/no-object-defineproperties -- safe
792
- var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
832
+ var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
793
833
  anObject(O);
794
834
  var props = toIndexedObject(Properties);
795
835
  var keys = objectKeys(Properties);
@@ -800,6 +840,10 @@ var objectDefineProperties = descriptors ? Object.defineProperties : function de
800
840
  return O;
801
841
  };
802
842
 
843
+ var objectDefineProperties = {
844
+ f: f$1
845
+ };
846
+
803
847
  var html = getBuiltIn('document', 'documentElement');
804
848
 
805
849
  /* global ActiveXObject -- old IE, WSH */
@@ -882,7 +926,7 @@ var objectCreate = Object.create || function create(O, Properties) {
882
926
  // add "__proto__" for Object.getPrototypeOf polyfill
883
927
  result[IE_PROTO] = O;
884
928
  } else result = NullProtoObject();
885
- return Properties === undefined ? result : objectDefineProperties(result, Properties);
929
+ return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
886
930
  };
887
931
 
888
932
  var UNSCOPABLES = wellKnownSymbol('unscopables');
@@ -978,7 +1022,13 @@ var UNSUPPORTED_Y$1 = fails(function () {
978
1022
  return re.exec('abcd') != null;
979
1023
  });
980
1024
 
981
- var BROKEN_CARET = fails(function () {
1025
+ // UC Browser bug
1026
+ // https://github.com/zloirock/core-js/issues/1008
1027
+ var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
1028
+ return !$RegExp$2('a', 'y').sticky;
1029
+ });
1030
+
1031
+ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
982
1032
  // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
983
1033
  var re = $RegExp$2('^r', 'gy');
984
1034
  re.lastIndex = 2;
@@ -986,8 +1036,9 @@ var BROKEN_CARET = fails(function () {
986
1036
  });
987
1037
 
988
1038
  var regexpStickyHelpers = {
989
- UNSUPPORTED_Y: UNSUPPORTED_Y$1,
990
- BROKEN_CARET: BROKEN_CARET
1039
+ BROKEN_CARET: BROKEN_CARET,
1040
+ MISSED_STICKY: MISSED_STICKY,
1041
+ UNSUPPORTED_Y: UNSUPPORTED_Y$1
991
1042
  };
992
1043
 
993
1044
  // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
@@ -1036,7 +1087,7 @@ var UPDATES_LAST_INDEX_WRONG = (function () {
1036
1087
  return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1037
1088
  })();
1038
1089
 
1039
- var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
1090
+ var UNSUPPORTED_Y = regexpStickyHelpers.BROKEN_CARET;
1040
1091
 
1041
1092
  // nonparticipating capturing group, copied from es5-shim's String#split patch.
1042
1093
  var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
@@ -1044,7 +1095,6 @@ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1044
1095
  var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || regexpUnsupportedDotAll || regexpUnsupportedNcg;
1045
1096
 
1046
1097
  if (PATCH) {
1047
- // eslint-disable-next-line max-statements -- TODO
1048
1098
  patchedExec = function exec(string) {
1049
1099
  var re = this;
1050
1100
  var state = getInternalState$1(re);
@@ -1293,9 +1343,10 @@ var defineProperty$2 = objectDefineProperty.f;
1293
1343
 
1294
1344
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1295
1345
 
1296
- var setToStringTag = function (it, TAG, STATIC) {
1297
- if (it && !hasOwnProperty_1(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
1298
- defineProperty$2(it, TO_STRING_TAG, { configurable: true, value: TAG });
1346
+ var setToStringTag = function (target, TAG, STATIC) {
1347
+ if (target && !STATIC) target = target.prototype;
1348
+ if (target && !hasOwnProperty_1(target, TO_STRING_TAG)) {
1349
+ defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
1299
1350
  }
1300
1351
  };
1301
1352
 
@@ -1320,12 +1371,12 @@ var anInstance = function (it, Prototype) {
1320
1371
  throw TypeError$6('Incorrect invocation');
1321
1372
  };
1322
1373
 
1323
- var bind$3 = functionUncurryThis(functionUncurryThis.bind);
1374
+ var bind$2 = functionUncurryThis(functionUncurryThis.bind);
1324
1375
 
1325
1376
  // optional / simple context binding
1326
1377
  var functionBindContext = function (fn, that) {
1327
1378
  aCallable(fn);
1328
- return that === undefined ? fn : bind$3 ? bind$3(fn, that) : function (/* ...args */) {
1379
+ return that === undefined ? fn : functionBindNative ? bind$2(fn, that) : function (/* ...args */) {
1329
1380
  return fn.apply(that, arguments);
1330
1381
  };
1331
1382
  };
@@ -1475,7 +1526,7 @@ var constructorRegExp = /^\s*(?:class|function)\b/;
1475
1526
  var exec = functionUncurryThis(constructorRegExp.exec);
1476
1527
  var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1477
1528
 
1478
- var isConstructorModern = function (argument) {
1529
+ var isConstructorModern = function isConstructor(argument) {
1479
1530
  if (!isCallable(argument)) return false;
1480
1531
  try {
1481
1532
  construct(noop, empty, argument);
@@ -1485,16 +1536,25 @@ var isConstructorModern = function (argument) {
1485
1536
  }
1486
1537
  };
1487
1538
 
1488
- var isConstructorLegacy = function (argument) {
1539
+ var isConstructorLegacy = function isConstructor(argument) {
1489
1540
  if (!isCallable(argument)) return false;
1490
1541
  switch (classof(argument)) {
1491
1542
  case 'AsyncFunction':
1492
1543
  case 'GeneratorFunction':
1493
1544
  case 'AsyncGeneratorFunction': return false;
1545
+ }
1546
+ try {
1494
1547
  // we can't check .prototype since constructors produced by .bind haven't it
1495
- } return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
1548
+ // `Function#toString` throws on some built-it function in some legacy engines
1549
+ // (for example, `DOMQuad` and similar in FF41-)
1550
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
1551
+ } catch (error) {
1552
+ return true;
1553
+ }
1496
1554
  };
1497
1555
 
1556
+ isConstructorLegacy.sham = true;
1557
+
1498
1558
  // `IsConstructor` abstract operation
1499
1559
  // https://tc39.es/ecma262/#sec-isconstructor
1500
1560
  var isConstructor = !construct || fails(function () {
@@ -1525,11 +1585,10 @@ var speciesConstructor = function (O, defaultConstructor) {
1525
1585
 
1526
1586
  var FunctionPrototype$1 = Function.prototype;
1527
1587
  var apply = FunctionPrototype$1.apply;
1528
- var bind$2 = FunctionPrototype$1.bind;
1529
1588
  var call = FunctionPrototype$1.call;
1530
1589
 
1531
1590
  // eslint-disable-next-line es/no-reflect -- safe
1532
- var functionApply = typeof Reflect == 'object' && Reflect.apply || (bind$2 ? call.bind(apply) : function () {
1591
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
1533
1592
  return call.apply(apply, arguments);
1534
1593
  });
1535
1594
 
@@ -1547,7 +1606,7 @@ var Function$1 = global_1.Function;
1547
1606
  var MessageChannel = global_1.MessageChannel;
1548
1607
  var String$1 = global_1.String;
1549
1608
  var counter = 0;
1550
- var queue = {};
1609
+ var queue$1 = {};
1551
1610
  var ONREADYSTATECHANGE = 'onreadystatechange';
1552
1611
  var location, defer, channel, port;
1553
1612
 
@@ -1557,9 +1616,9 @@ try {
1557
1616
  } catch (error) { /* empty */ }
1558
1617
 
1559
1618
  var run = function (id) {
1560
- if (hasOwnProperty_1(queue, id)) {
1561
- var fn = queue[id];
1562
- delete queue[id];
1619
+ if (hasOwnProperty_1(queue$1, id)) {
1620
+ var fn = queue$1[id];
1621
+ delete queue$1[id];
1563
1622
  fn();
1564
1623
  }
1565
1624
  };
@@ -1583,14 +1642,14 @@ var post = function (id) {
1583
1642
  if (!set || !clear) {
1584
1643
  set = function setImmediate(fn) {
1585
1644
  var args = arraySlice(arguments, 1);
1586
- queue[++counter] = function () {
1645
+ queue$1[++counter] = function () {
1587
1646
  functionApply(isCallable(fn) ? fn : Function$1(fn), undefined, args);
1588
1647
  };
1589
1648
  defer(counter);
1590
1649
  return counter;
1591
1650
  };
1592
1651
  clear = function clearImmediate(id) {
1593
- delete queue[id];
1652
+ delete queue$1[id];
1594
1653
  };
1595
1654
  // Node.js 0.8-
1596
1655
  if (engineIsNode) {
@@ -1774,6 +1833,30 @@ var perform = function (exec) {
1774
1833
  }
1775
1834
  };
1776
1835
 
1836
+ var Queue = function () {
1837
+ this.head = null;
1838
+ this.tail = null;
1839
+ };
1840
+
1841
+ Queue.prototype = {
1842
+ add: function (item) {
1843
+ var entry = { item: item, next: null };
1844
+ if (this.head) this.tail.next = entry;
1845
+ else this.head = entry;
1846
+ this.tail = entry;
1847
+ },
1848
+ get: function () {
1849
+ var entry = this.head;
1850
+ if (entry) {
1851
+ this.head = entry.next;
1852
+ if (this.tail === entry) this.tail = null;
1853
+ return entry.item;
1854
+ }
1855
+ }
1856
+ };
1857
+
1858
+ var queue = Queue;
1859
+
1777
1860
  var engineIsBrowser = typeof window == 'object';
1778
1861
 
1779
1862
  var task = task$1.set;
@@ -1789,10 +1872,11 @@ var task = task$1.set;
1789
1872
 
1790
1873
 
1791
1874
 
1875
+
1792
1876
  var SPECIES$2 = wellKnownSymbol('species');
1793
1877
  var PROMISE = 'Promise';
1794
1878
 
1795
- var getInternalState = internalState.get;
1879
+ var getInternalState = internalState.getterFor(PROMISE);
1796
1880
  var setInternalState = internalState.set;
1797
1881
  var getInternalPromiseState = internalState.getterFor(PROMISE);
1798
1882
  var NativePromisePrototype = nativePromiseConstructor && nativePromiseConstructor.prototype;
@@ -1851,49 +1935,50 @@ var isThenable = function (it) {
1851
1935
  return isObject$1(it) && isCallable(then = it.then) ? then : false;
1852
1936
  };
1853
1937
 
1938
+ var callReaction = function (reaction, state) {
1939
+ var value = state.value;
1940
+ var ok = state.state == FULFILLED;
1941
+ var handler = ok ? reaction.ok : reaction.fail;
1942
+ var resolve = reaction.resolve;
1943
+ var reject = reaction.reject;
1944
+ var domain = reaction.domain;
1945
+ var result, then, exited;
1946
+ try {
1947
+ if (handler) {
1948
+ if (!ok) {
1949
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
1950
+ state.rejection = HANDLED;
1951
+ }
1952
+ if (handler === true) result = value;
1953
+ else {
1954
+ if (domain) domain.enter();
1955
+ result = handler(value); // can throw
1956
+ if (domain) {
1957
+ domain.exit();
1958
+ exited = true;
1959
+ }
1960
+ }
1961
+ if (result === reaction.promise) {
1962
+ reject(TypeError$2('Promise-chain cycle'));
1963
+ } else if (then = isThenable(result)) {
1964
+ functionCall(then, result, resolve, reject);
1965
+ } else resolve(result);
1966
+ } else reject(value);
1967
+ } catch (error) {
1968
+ if (domain && !exited) domain.exit();
1969
+ reject(error);
1970
+ }
1971
+ };
1972
+
1854
1973
  var notify = function (state, isReject) {
1855
1974
  if (state.notified) return;
1856
1975
  state.notified = true;
1857
- var chain = state.reactions;
1858
1976
  microtask(function () {
1859
- var value = state.value;
1860
- var ok = state.state == FULFILLED;
1861
- var index = 0;
1862
- // variable length - can't use forEach
1863
- while (chain.length > index) {
1864
- var reaction = chain[index++];
1865
- var handler = ok ? reaction.ok : reaction.fail;
1866
- var resolve = reaction.resolve;
1867
- var reject = reaction.reject;
1868
- var domain = reaction.domain;
1869
- var result, then, exited;
1870
- try {
1871
- if (handler) {
1872
- if (!ok) {
1873
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
1874
- state.rejection = HANDLED;
1875
- }
1876
- if (handler === true) result = value;
1877
- else {
1878
- if (domain) domain.enter();
1879
- result = handler(value); // can throw
1880
- if (domain) {
1881
- domain.exit();
1882
- exited = true;
1883
- }
1884
- }
1885
- if (result === reaction.promise) {
1886
- reject(TypeError$2('Promise-chain cycle'));
1887
- } else if (then = isThenable(result)) {
1888
- functionCall(then, result, resolve, reject);
1889
- } else resolve(result);
1890
- } else reject(value);
1891
- } catch (error) {
1892
- if (domain && !exited) domain.exit();
1893
- reject(error);
1894
- }
1977
+ var reactions = state.reactions;
1978
+ var reaction;
1979
+ while (reaction = reactions.get()) {
1980
+ callReaction(reaction, state);
1895
1981
  }
1896
- state.reactions = [];
1897
1982
  state.notified = false;
1898
1983
  if (isReject && !state.rejection) onUnhandled(state);
1899
1984
  });
@@ -2010,7 +2095,7 @@ if (FORCED$1) {
2010
2095
  done: false,
2011
2096
  notified: false,
2012
2097
  parent: false,
2013
- reactions: [],
2098
+ reactions: new queue(),
2014
2099
  rejection: false,
2015
2100
  state: PENDING,
2016
2101
  value: undefined
@@ -2019,16 +2104,18 @@ if (FORCED$1) {
2019
2104
  Internal.prototype = redefineAll(PromisePrototype, {
2020
2105
  // `Promise.prototype.then` method
2021
2106
  // https://tc39.es/ecma262/#sec-promise.prototype.then
2107
+ // eslint-disable-next-line unicorn/no-thenable -- safe
2022
2108
  then: function then(onFulfilled, onRejected) {
2023
2109
  var state = getInternalPromiseState(this);
2024
- var reactions = state.reactions;
2025
2110
  var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
2111
+ state.parent = true;
2026
2112
  reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
2027
2113
  reaction.fail = isCallable(onRejected) && onRejected;
2028
2114
  reaction.domain = engineIsNode ? process$1.domain : undefined;
2029
- state.parent = true;
2030
- reactions[reactions.length] = reaction;
2031
- if (state.state != PENDING) notify(state, false);
2115
+ if (state.state == PENDING) state.reactions.add(reaction);
2116
+ else microtask(function () {
2117
+ callReaction(reaction, state);
2118
+ });
2032
2119
  return reaction.promise;
2033
2120
  },
2034
2121
  // `Promise.prototype.catch` method
@@ -2326,7 +2413,7 @@ var defineProperty = objectDefineProperty.f;
2326
2413
 
2327
2414
  var FunctionPrototype = Function.prototype;
2328
2415
  var functionToString = functionUncurryThis(FunctionPrototype.toString);
2329
- var nameRE = /^\s*function ([^ (]*)/;
2416
+ var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
2330
2417
  var regExpExec = functionUncurryThis(nameRE.exec);
2331
2418
  var NAME = 'name';
2332
2419