@tryghost/content-api 1.7.2 → 1.9.0
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/cjs/content-api.js +104 -5
- package/es/content-api.js +674 -373
- package/es/content-api.js.map +1 -1
- package/lib/index.js +35 -5
- package/package.json +6 -5
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -25,7 +25,7 @@ var check = function (it) {
|
|
|
25
25
|
|
|
26
26
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
27
27
|
var global_1 =
|
|
28
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
28
|
+
// eslint-disable-next-line es-x/no-global-this -- safe
|
|
29
29
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
30
30
|
check(typeof window == 'object' && window) ||
|
|
31
31
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -44,11 +44,12 @@ var fails = function (exec) {
|
|
|
44
44
|
|
|
45
45
|
// Detect IE8's incomplete defineProperty implementation
|
|
46
46
|
var descriptors = !fails(function () {
|
|
47
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
47
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
48
48
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
var functionBindNative = !fails(function () {
|
|
52
|
+
// eslint-disable-next-line es-x/no-function-prototype-bind -- safe
|
|
52
53
|
var test = (function () { /* empty */ }).bind();
|
|
53
54
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
54
55
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
@@ -61,7 +62,7 @@ var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
64
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
65
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
65
66
|
var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
|
|
66
67
|
|
|
67
68
|
// Nashorn ~ JDK8 bug
|
|
@@ -101,10 +102,10 @@ var functionUncurryThis = functionBindNative ? function (fn) {
|
|
|
101
102
|
};
|
|
102
103
|
|
|
103
104
|
var toString$2 = functionUncurryThis({}.toString);
|
|
104
|
-
var stringSlice$
|
|
105
|
+
var stringSlice$3 = functionUncurryThis(''.slice);
|
|
105
106
|
|
|
106
107
|
var classofRaw = function (it) {
|
|
107
|
-
return stringSlice$
|
|
108
|
+
return stringSlice$3(toString$2(it), 8, -1);
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
var Object$4 = global_1.Object;
|
|
@@ -119,12 +120,12 @@ var indexedObject = fails(function () {
|
|
|
119
120
|
return classofRaw(it) == 'String' ? split(it, '') : Object$4(it);
|
|
120
121
|
} : Object$4;
|
|
121
122
|
|
|
122
|
-
var TypeError$
|
|
123
|
+
var TypeError$h = global_1.TypeError;
|
|
123
124
|
|
|
124
125
|
// `RequireObjectCoercible` abstract operation
|
|
125
126
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
126
127
|
var requireObjectCoercible = function (it) {
|
|
127
|
-
if (it == undefined) throw TypeError$
|
|
128
|
+
if (it == undefined) throw TypeError$h("Can't call method on " + it);
|
|
128
129
|
return it;
|
|
129
130
|
};
|
|
130
131
|
|
|
@@ -159,35 +160,35 @@ var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
|
159
160
|
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
160
161
|
|
|
161
162
|
var process$4 = global_1.process;
|
|
162
|
-
var Deno = global_1.Deno;
|
|
163
|
-
var versions = process$4 && process$4.versions || Deno && Deno.version;
|
|
163
|
+
var Deno$1 = global_1.Deno;
|
|
164
|
+
var versions = process$4 && process$4.versions || Deno$1 && Deno$1.version;
|
|
164
165
|
var v8 = versions && versions.v8;
|
|
165
|
-
var match, version;
|
|
166
|
+
var match, version$1;
|
|
166
167
|
|
|
167
168
|
if (v8) {
|
|
168
169
|
match = v8.split('.');
|
|
169
170
|
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
170
171
|
// but their correct versions are not interesting for us
|
|
171
|
-
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
172
|
+
version$1 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
175
176
|
// so check `userAgent` even if `.v8` exists, but 0
|
|
176
|
-
if (!version && engineUserAgent) {
|
|
177
|
+
if (!version$1 && engineUserAgent) {
|
|
177
178
|
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
178
179
|
if (!match || match[1] >= 74) {
|
|
179
180
|
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
180
|
-
if (match) version = +match[1];
|
|
181
|
+
if (match) version$1 = +match[1];
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
var engineV8Version = version;
|
|
185
|
+
var engineV8Version = version$1;
|
|
185
186
|
|
|
186
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
187
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
187
188
|
|
|
188
189
|
|
|
189
190
|
|
|
190
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
191
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
191
192
|
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
192
193
|
var symbol = Symbol();
|
|
193
194
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
@@ -197,7 +198,7 @@ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
|
197
198
|
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
198
199
|
});
|
|
199
200
|
|
|
200
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
201
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
201
202
|
|
|
202
203
|
|
|
203
204
|
var useSymbolAsUid = nativeSymbol
|
|
@@ -223,12 +224,12 @@ var tryToString = function (argument) {
|
|
|
223
224
|
}
|
|
224
225
|
};
|
|
225
226
|
|
|
226
|
-
var TypeError$
|
|
227
|
+
var TypeError$g = global_1.TypeError;
|
|
227
228
|
|
|
228
229
|
// `Assert: IsCallable(argument) is true`
|
|
229
230
|
var aCallable = function (argument) {
|
|
230
231
|
if (isCallable(argument)) return argument;
|
|
231
|
-
throw TypeError$
|
|
232
|
+
throw TypeError$g(tryToString(argument) + ' is not a function');
|
|
232
233
|
};
|
|
233
234
|
|
|
234
235
|
// `GetMethod` abstract operation
|
|
@@ -238,7 +239,7 @@ var getMethod = function (V, P) {
|
|
|
238
239
|
return func == null ? undefined : aCallable(func);
|
|
239
240
|
};
|
|
240
241
|
|
|
241
|
-
var TypeError$
|
|
242
|
+
var TypeError$f = global_1.TypeError;
|
|
242
243
|
|
|
243
244
|
// `OrdinaryToPrimitive` abstract operation
|
|
244
245
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
@@ -247,10 +248,10 @@ var ordinaryToPrimitive = function (input, pref) {
|
|
|
247
248
|
if (pref === 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
248
249
|
if (isCallable(fn = input.valueOf) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
249
250
|
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
250
|
-
throw TypeError$
|
|
251
|
+
throw TypeError$f("Can't convert object to primitive value");
|
|
251
252
|
};
|
|
252
253
|
|
|
253
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
254
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
254
255
|
var defineProperty$3 = Object.defineProperty;
|
|
255
256
|
|
|
256
257
|
var setGlobal = function (key, value) {
|
|
@@ -270,10 +271,10 @@ var shared = createCommonjsModule(function (module) {
|
|
|
270
271
|
(module.exports = function (key, value) {
|
|
271
272
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
272
273
|
})('versions', []).push({
|
|
273
|
-
version: '3.
|
|
274
|
+
version: '3.22.0',
|
|
274
275
|
mode: 'global',
|
|
275
276
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
276
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
277
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.0/LICENSE',
|
|
277
278
|
source: 'https://github.com/zloirock/core-js'
|
|
278
279
|
});
|
|
279
280
|
});
|
|
@@ -290,6 +291,7 @@ var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
|
290
291
|
|
|
291
292
|
// `HasOwnProperty` abstract operation
|
|
292
293
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
294
|
+
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
293
295
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
294
296
|
return hasOwnProperty(toObject(it), key);
|
|
295
297
|
};
|
|
@@ -320,7 +322,7 @@ var wellKnownSymbol = function (name) {
|
|
|
320
322
|
} return WellKnownSymbolsStore[name];
|
|
321
323
|
};
|
|
322
324
|
|
|
323
|
-
var TypeError$
|
|
325
|
+
var TypeError$e = global_1.TypeError;
|
|
324
326
|
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
325
327
|
|
|
326
328
|
// `ToPrimitive` abstract operation
|
|
@@ -333,7 +335,7 @@ var toPrimitive = function (input, pref) {
|
|
|
333
335
|
if (pref === undefined) pref = 'default';
|
|
334
336
|
result = functionCall(exoticToPrim, input, pref);
|
|
335
337
|
if (!isObject$1(result) || isSymbol(result)) return result;
|
|
336
|
-
throw TypeError$
|
|
338
|
+
throw TypeError$e("Can't convert object to primitive value");
|
|
337
339
|
}
|
|
338
340
|
if (pref === undefined) pref = 'number';
|
|
339
341
|
return ordinaryToPrimitive(input, pref);
|
|
@@ -356,13 +358,13 @@ var documentCreateElement = function (it) {
|
|
|
356
358
|
|
|
357
359
|
// Thanks to IE8 for its funny defineProperty
|
|
358
360
|
var ie8DomDefine = !descriptors && !fails(function () {
|
|
359
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
361
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
360
362
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
361
363
|
get: function () { return 7; }
|
|
362
364
|
}).a != 7;
|
|
363
365
|
});
|
|
364
366
|
|
|
365
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
367
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
366
368
|
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
367
369
|
|
|
368
370
|
// `Object.getOwnPropertyDescriptor` method
|
|
@@ -383,7 +385,7 @@ var objectGetOwnPropertyDescriptor = {
|
|
|
383
385
|
// V8 ~ Chrome 36-
|
|
384
386
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
385
387
|
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
386
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
388
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
387
389
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
388
390
|
value: 42,
|
|
389
391
|
writable: false
|
|
@@ -391,18 +393,18 @@ var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
|
391
393
|
});
|
|
392
394
|
|
|
393
395
|
var String$4 = global_1.String;
|
|
394
|
-
var TypeError$
|
|
396
|
+
var TypeError$d = global_1.TypeError;
|
|
395
397
|
|
|
396
398
|
// `Assert: Type(argument) is Object`
|
|
397
399
|
var anObject = function (argument) {
|
|
398
400
|
if (isObject$1(argument)) return argument;
|
|
399
|
-
throw TypeError$
|
|
401
|
+
throw TypeError$d(String$4(argument) + ' is not an object');
|
|
400
402
|
};
|
|
401
403
|
|
|
402
|
-
var TypeError$
|
|
403
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
404
|
+
var TypeError$c = global_1.TypeError;
|
|
405
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
404
406
|
var $defineProperty = Object.defineProperty;
|
|
405
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
407
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
406
408
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
407
409
|
var ENUMERABLE = 'enumerable';
|
|
408
410
|
var CONFIGURABLE$1 = 'configurable';
|
|
@@ -432,7 +434,7 @@ var f$4 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Att
|
|
|
432
434
|
if (ie8DomDefine) try {
|
|
433
435
|
return $defineProperty(O, P, Attributes);
|
|
434
436
|
} catch (error) { /* empty */ }
|
|
435
|
-
if ('get' in Attributes || 'set' in Attributes) throw TypeError$
|
|
437
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError$c('Accessors not supported');
|
|
436
438
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
437
439
|
return O;
|
|
438
440
|
};
|
|
@@ -472,7 +474,7 @@ var sharedKey = function (key) {
|
|
|
472
474
|
var hiddenKeys$1 = {};
|
|
473
475
|
|
|
474
476
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
475
|
-
var TypeError$
|
|
477
|
+
var TypeError$b = global_1.TypeError;
|
|
476
478
|
var WeakMap = global_1.WeakMap;
|
|
477
479
|
var set$1, get, has;
|
|
478
480
|
|
|
@@ -484,7 +486,7 @@ var getterFor = function (TYPE) {
|
|
|
484
486
|
return function (it) {
|
|
485
487
|
var state;
|
|
486
488
|
if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
|
|
487
|
-
throw TypeError$
|
|
489
|
+
throw TypeError$b('Incompatible receiver, ' + TYPE + ' required');
|
|
488
490
|
} return state;
|
|
489
491
|
};
|
|
490
492
|
};
|
|
@@ -495,7 +497,7 @@ if (nativeWeakMap || sharedStore.state) {
|
|
|
495
497
|
var wmhas = functionUncurryThis(store.has);
|
|
496
498
|
var wmset = functionUncurryThis(store.set);
|
|
497
499
|
set$1 = function (it, metadata) {
|
|
498
|
-
if (wmhas(store, it)) throw new TypeError$
|
|
500
|
+
if (wmhas(store, it)) throw new TypeError$b(OBJECT_ALREADY_INITIALIZED);
|
|
499
501
|
metadata.facade = it;
|
|
500
502
|
wmset(store, it, metadata);
|
|
501
503
|
return metadata;
|
|
@@ -510,7 +512,7 @@ if (nativeWeakMap || sharedStore.state) {
|
|
|
510
512
|
var STATE = sharedKey('state');
|
|
511
513
|
hiddenKeys$1[STATE] = true;
|
|
512
514
|
set$1 = function (it, metadata) {
|
|
513
|
-
if (hasOwnProperty_1(it, STATE)) throw new TypeError$
|
|
515
|
+
if (hasOwnProperty_1(it, STATE)) throw new TypeError$b(OBJECT_ALREADY_INITIALIZED);
|
|
514
516
|
metadata.facade = it;
|
|
515
517
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
516
518
|
return metadata;
|
|
@@ -532,7 +534,7 @@ var internalState = {
|
|
|
532
534
|
};
|
|
533
535
|
|
|
534
536
|
var FunctionPrototype$2 = Function.prototype;
|
|
535
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
537
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
536
538
|
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
537
539
|
|
|
538
540
|
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
@@ -625,7 +627,7 @@ var lengthOfArrayLike = function (obj) {
|
|
|
625
627
|
};
|
|
626
628
|
|
|
627
629
|
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
628
|
-
var createMethod$
|
|
630
|
+
var createMethod$2 = function (IS_INCLUDES) {
|
|
629
631
|
return function ($this, el, fromIndex) {
|
|
630
632
|
var O = toIndexedObject($this);
|
|
631
633
|
var length = lengthOfArrayLike(O);
|
|
@@ -647,10 +649,10 @@ var createMethod$1 = function (IS_INCLUDES) {
|
|
|
647
649
|
var arrayIncludes = {
|
|
648
650
|
// `Array.prototype.includes` method
|
|
649
651
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
650
|
-
includes: createMethod$
|
|
652
|
+
includes: createMethod$2(true),
|
|
651
653
|
// `Array.prototype.indexOf` method
|
|
652
654
|
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
653
|
-
indexOf: createMethod$
|
|
655
|
+
indexOf: createMethod$2(false)
|
|
654
656
|
};
|
|
655
657
|
|
|
656
658
|
var indexOf$1 = arrayIncludes.indexOf;
|
|
@@ -686,7 +688,7 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
686
688
|
|
|
687
689
|
// `Object.getOwnPropertyNames` method
|
|
688
690
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
689
|
-
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
691
|
+
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
690
692
|
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
691
693
|
return objectKeysInternal(O, hiddenKeys);
|
|
692
694
|
};
|
|
@@ -695,7 +697,7 @@ var objectGetOwnPropertyNames = {
|
|
|
695
697
|
f: f$3
|
|
696
698
|
};
|
|
697
699
|
|
|
698
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
700
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
|
|
699
701
|
var f$2 = Object.getOwnPropertySymbols;
|
|
700
702
|
|
|
701
703
|
var objectGetOwnPropertySymbols = {
|
|
@@ -865,7 +867,7 @@ if (!toStringTagSupport) {
|
|
|
865
867
|
|
|
866
868
|
// `Object.keys` method
|
|
867
869
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
868
|
-
// eslint-disable-next-line es/no-object-keys -- safe
|
|
870
|
+
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
869
871
|
var objectKeys = Object.keys || function keys(O) {
|
|
870
872
|
return objectKeysInternal(O, enumBugKeys);
|
|
871
873
|
};
|
|
@@ -882,7 +884,7 @@ _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
|
882
884
|
|
|
883
885
|
// `IsArray` abstract operation
|
|
884
886
|
// https://tc39.es/ecma262/#sec-isarray
|
|
885
|
-
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
887
|
+
// eslint-disable-next-line es-x/no-array-isarray -- safe
|
|
886
888
|
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
887
889
|
return classofRaw(argument) == 'Array';
|
|
888
890
|
};
|
|
@@ -939,7 +941,7 @@ var isConstructor = !construct || fails(function () {
|
|
|
939
941
|
|| called;
|
|
940
942
|
}) ? isConstructorLegacy : isConstructorModern;
|
|
941
943
|
|
|
942
|
-
var SPECIES$
|
|
944
|
+
var SPECIES$5 = wellKnownSymbol('species');
|
|
943
945
|
var Array$1 = global_1.Array;
|
|
944
946
|
|
|
945
947
|
// a part of `ArraySpeciesCreate` abstract operation
|
|
@@ -951,7 +953,7 @@ var arraySpeciesConstructor = function (originalArray) {
|
|
|
951
953
|
// cross-realm fallback
|
|
952
954
|
if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
|
|
953
955
|
else if (isObject$1(C)) {
|
|
954
|
-
C = C[SPECIES$
|
|
956
|
+
C = C[SPECIES$5];
|
|
955
957
|
if (C === null) C = undefined;
|
|
956
958
|
}
|
|
957
959
|
} return C === undefined ? Array$1 : C;
|
|
@@ -963,7 +965,7 @@ var arraySpeciesCreate = function (originalArray, length) {
|
|
|
963
965
|
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
964
966
|
};
|
|
965
967
|
|
|
966
|
-
var SPECIES$
|
|
968
|
+
var SPECIES$4 = wellKnownSymbol('species');
|
|
967
969
|
|
|
968
970
|
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
969
971
|
// We can't use this feature detection in V8 since it causes
|
|
@@ -972,7 +974,7 @@ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
|
972
974
|
return engineV8Version >= 51 || !fails(function () {
|
|
973
975
|
var array = [];
|
|
974
976
|
var constructor = array.constructor = {};
|
|
975
|
-
constructor[SPECIES$
|
|
977
|
+
constructor[SPECIES$4] = function () {
|
|
976
978
|
return { foo: 1 };
|
|
977
979
|
};
|
|
978
980
|
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
@@ -982,7 +984,7 @@ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
|
982
984
|
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
983
985
|
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
984
986
|
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
985
|
-
var TypeError$
|
|
987
|
+
var TypeError$a = global_1.TypeError;
|
|
986
988
|
|
|
987
989
|
// We can't use this feature detection in V8 since it causes
|
|
988
990
|
// deoptimization and serious performance degradation
|
|
@@ -1001,12 +1003,12 @@ var isConcatSpreadable = function (O) {
|
|
|
1001
1003
|
return spreadable !== undefined ? !!spreadable : isArray$1(O);
|
|
1002
1004
|
};
|
|
1003
1005
|
|
|
1004
|
-
var FORCED
|
|
1006
|
+
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
1005
1007
|
|
|
1006
1008
|
// `Array.prototype.concat` method
|
|
1007
1009
|
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
1008
1010
|
// with adding support of @@isConcatSpreadable and @@species
|
|
1009
|
-
_export({ target: 'Array', proto: true, forced: FORCED
|
|
1011
|
+
_export({ target: 'Array', proto: true, forced: FORCED }, {
|
|
1010
1012
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
1011
1013
|
concat: function concat(arg) {
|
|
1012
1014
|
var O = toObject(this);
|
|
@@ -1017,10 +1019,10 @@ _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
|
1017
1019
|
E = i === -1 ? O : arguments[i];
|
|
1018
1020
|
if (isConcatSpreadable(E)) {
|
|
1019
1021
|
len = lengthOfArrayLike(E);
|
|
1020
|
-
if (n + len > MAX_SAFE_INTEGER) throw TypeError$
|
|
1022
|
+
if (n + len > MAX_SAFE_INTEGER) throw TypeError$a(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1021
1023
|
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
1022
1024
|
} else {
|
|
1023
|
-
if (n >= MAX_SAFE_INTEGER) throw TypeError$
|
|
1025
|
+
if (n >= MAX_SAFE_INTEGER) throw TypeError$a(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1024
1026
|
createProperty(A, n++, E);
|
|
1025
1027
|
}
|
|
1026
1028
|
}
|
|
@@ -1031,7 +1033,7 @@ _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
|
1031
1033
|
|
|
1032
1034
|
// `Object.defineProperties` method
|
|
1033
1035
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
1034
|
-
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
1036
|
+
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
1035
1037
|
var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
1036
1038
|
anObject(O);
|
|
1037
1039
|
var props = toIndexedObject(Properties);
|
|
@@ -1120,6 +1122,7 @@ hiddenKeys$1[IE_PROTO] = true;
|
|
|
1120
1122
|
|
|
1121
1123
|
// `Object.create` method
|
|
1122
1124
|
// https://tc39.es/ecma262/#sec-object.create
|
|
1125
|
+
// eslint-disable-next-line es-x/no-object-create -- safe
|
|
1123
1126
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
1124
1127
|
var result;
|
|
1125
1128
|
if (O !== null) {
|
|
@@ -1238,17 +1241,17 @@ var regexpUnsupportedNcg = fails(function () {
|
|
|
1238
1241
|
|
|
1239
1242
|
|
|
1240
1243
|
|
|
1241
|
-
var getInternalState
|
|
1244
|
+
var getInternalState = internalState.get;
|
|
1242
1245
|
|
|
1243
1246
|
|
|
1244
1247
|
|
|
1245
1248
|
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
1246
1249
|
var nativeExec = RegExp.prototype.exec;
|
|
1247
1250
|
var patchedExec = nativeExec;
|
|
1248
|
-
var charAt = functionUncurryThis(''.charAt);
|
|
1251
|
+
var charAt$2 = functionUncurryThis(''.charAt);
|
|
1249
1252
|
var indexOf = functionUncurryThis(''.indexOf);
|
|
1250
1253
|
var replace = functionUncurryThis(''.replace);
|
|
1251
|
-
var stringSlice$
|
|
1254
|
+
var stringSlice$2 = functionUncurryThis(''.slice);
|
|
1252
1255
|
|
|
1253
1256
|
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
1254
1257
|
var re1 = /a/;
|
|
@@ -1268,7 +1271,7 @@ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || regexp
|
|
|
1268
1271
|
if (PATCH) {
|
|
1269
1272
|
patchedExec = function exec(string) {
|
|
1270
1273
|
var re = this;
|
|
1271
|
-
var state = getInternalState
|
|
1274
|
+
var state = getInternalState(re);
|
|
1272
1275
|
var str = toString_1(string);
|
|
1273
1276
|
var raw = state.raw;
|
|
1274
1277
|
var result, reCopy, lastIndex, match, i, object, group;
|
|
@@ -1293,9 +1296,9 @@ if (PATCH) {
|
|
|
1293
1296
|
flags += 'g';
|
|
1294
1297
|
}
|
|
1295
1298
|
|
|
1296
|
-
strCopy = stringSlice$
|
|
1299
|
+
strCopy = stringSlice$2(str, re.lastIndex);
|
|
1297
1300
|
// Support anchored sticky behavior.
|
|
1298
|
-
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) {
|
|
1301
|
+
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$2(str, re.lastIndex - 1) !== '\n')) {
|
|
1299
1302
|
source = '(?: ' + source + ')';
|
|
1300
1303
|
strCopy = ' ' + strCopy;
|
|
1301
1304
|
charsAdded++;
|
|
@@ -1314,8 +1317,8 @@ if (PATCH) {
|
|
|
1314
1317
|
|
|
1315
1318
|
if (sticky) {
|
|
1316
1319
|
if (match) {
|
|
1317
|
-
match.input = stringSlice$
|
|
1318
|
-
match[0] = stringSlice$
|
|
1320
|
+
match.input = stringSlice$2(match.input, charsAdded);
|
|
1321
|
+
match[0] = stringSlice$2(match[0], charsAdded);
|
|
1319
1322
|
match.index = re.lastIndex;
|
|
1320
1323
|
re.lastIndex += match[0].length;
|
|
1321
1324
|
} else re.lastIndex = 0;
|
|
@@ -1352,6 +1355,172 @@ _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
|
|
|
1352
1355
|
exec: regexpExec
|
|
1353
1356
|
});
|
|
1354
1357
|
|
|
1358
|
+
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
var SPECIES$3 = wellKnownSymbol('species');
|
|
1368
|
+
var RegExpPrototype = RegExp.prototype;
|
|
1369
|
+
|
|
1370
|
+
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
1371
|
+
var SYMBOL = wellKnownSymbol(KEY);
|
|
1372
|
+
|
|
1373
|
+
var DELEGATES_TO_SYMBOL = !fails(function () {
|
|
1374
|
+
// String methods call symbol-named RegEp methods
|
|
1375
|
+
var O = {};
|
|
1376
|
+
O[SYMBOL] = function () { return 7; };
|
|
1377
|
+
return ''[KEY](O) != 7;
|
|
1378
|
+
});
|
|
1379
|
+
|
|
1380
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
|
1381
|
+
// Symbol-named RegExp methods call .exec
|
|
1382
|
+
var execCalled = false;
|
|
1383
|
+
var re = /a/;
|
|
1384
|
+
|
|
1385
|
+
if (KEY === 'split') {
|
|
1386
|
+
// We can't use real regex here since it causes deoptimization
|
|
1387
|
+
// and serious performance degradation in V8
|
|
1388
|
+
// https://github.com/zloirock/core-js/issues/306
|
|
1389
|
+
re = {};
|
|
1390
|
+
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
1391
|
+
// a new one. We need to return the patched regex when creating the new one.
|
|
1392
|
+
re.constructor = {};
|
|
1393
|
+
re.constructor[SPECIES$3] = function () { return re; };
|
|
1394
|
+
re.flags = '';
|
|
1395
|
+
re[SYMBOL] = /./[SYMBOL];
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
re.exec = function () { execCalled = true; return null; };
|
|
1399
|
+
|
|
1400
|
+
re[SYMBOL]('');
|
|
1401
|
+
return !execCalled;
|
|
1402
|
+
});
|
|
1403
|
+
|
|
1404
|
+
if (
|
|
1405
|
+
!DELEGATES_TO_SYMBOL ||
|
|
1406
|
+
!DELEGATES_TO_EXEC ||
|
|
1407
|
+
FORCED
|
|
1408
|
+
) {
|
|
1409
|
+
var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
|
|
1410
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
1411
|
+
var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
|
|
1412
|
+
var $exec = regexp.exec;
|
|
1413
|
+
if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
|
|
1414
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
1415
|
+
// The native String method already delegates to @@method (this
|
|
1416
|
+
// polyfilled function), leasing to infinite recursion.
|
|
1417
|
+
// We avoid it by directly calling the native @@method method.
|
|
1418
|
+
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
1419
|
+
}
|
|
1420
|
+
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
1421
|
+
}
|
|
1422
|
+
return { done: false };
|
|
1423
|
+
});
|
|
1424
|
+
|
|
1425
|
+
redefine(String.prototype, KEY, methods[0]);
|
|
1426
|
+
redefine(RegExpPrototype, SYMBOL, methods[1]);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
var charAt$1 = functionUncurryThis(''.charAt);
|
|
1433
|
+
var charCodeAt = functionUncurryThis(''.charCodeAt);
|
|
1434
|
+
var stringSlice$1 = functionUncurryThis(''.slice);
|
|
1435
|
+
|
|
1436
|
+
var createMethod$1 = function (CONVERT_TO_STRING) {
|
|
1437
|
+
return function ($this, pos) {
|
|
1438
|
+
var S = toString_1(requireObjectCoercible($this));
|
|
1439
|
+
var position = toIntegerOrInfinity(pos);
|
|
1440
|
+
var size = S.length;
|
|
1441
|
+
var first, second;
|
|
1442
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
1443
|
+
first = charCodeAt(S, position);
|
|
1444
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
1445
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
1446
|
+
? CONVERT_TO_STRING
|
|
1447
|
+
? charAt$1(S, position)
|
|
1448
|
+
: first
|
|
1449
|
+
: CONVERT_TO_STRING
|
|
1450
|
+
? stringSlice$1(S, position, position + 2)
|
|
1451
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
1452
|
+
};
|
|
1453
|
+
};
|
|
1454
|
+
|
|
1455
|
+
var stringMultibyte = {
|
|
1456
|
+
// `String.prototype.codePointAt` method
|
|
1457
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
1458
|
+
codeAt: createMethod$1(false),
|
|
1459
|
+
// `String.prototype.at` method
|
|
1460
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
1461
|
+
charAt: createMethod$1(true)
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
var charAt = stringMultibyte.charAt;
|
|
1465
|
+
|
|
1466
|
+
// `AdvanceStringIndex` abstract operation
|
|
1467
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
1468
|
+
var advanceStringIndex = function (S, index, unicode) {
|
|
1469
|
+
return index + (unicode ? charAt(S, index).length : 1);
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
var TypeError$9 = global_1.TypeError;
|
|
1473
|
+
|
|
1474
|
+
// `RegExpExec` abstract operation
|
|
1475
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
1476
|
+
var regexpExecAbstract = function (R, S) {
|
|
1477
|
+
var exec = R.exec;
|
|
1478
|
+
if (isCallable(exec)) {
|
|
1479
|
+
var result = functionCall(exec, R, S);
|
|
1480
|
+
if (result !== null) anObject(result);
|
|
1481
|
+
return result;
|
|
1482
|
+
}
|
|
1483
|
+
if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
|
|
1484
|
+
throw TypeError$9('RegExp#exec called on incompatible receiver');
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
// @@match logic
|
|
1488
|
+
fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
|
|
1489
|
+
return [
|
|
1490
|
+
// `String.prototype.match` method
|
|
1491
|
+
// https://tc39.es/ecma262/#sec-string.prototype.match
|
|
1492
|
+
function match(regexp) {
|
|
1493
|
+
var O = requireObjectCoercible(this);
|
|
1494
|
+
var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
|
|
1495
|
+
return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
|
|
1496
|
+
},
|
|
1497
|
+
// `RegExp.prototype[@@match]` method
|
|
1498
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
|
1499
|
+
function (string) {
|
|
1500
|
+
var rx = anObject(this);
|
|
1501
|
+
var S = toString_1(string);
|
|
1502
|
+
var res = maybeCallNative(nativeMatch, rx, S);
|
|
1503
|
+
|
|
1504
|
+
if (res.done) return res.value;
|
|
1505
|
+
|
|
1506
|
+
if (!rx.global) return regexpExecAbstract(rx, S);
|
|
1507
|
+
|
|
1508
|
+
var fullUnicode = rx.unicode;
|
|
1509
|
+
rx.lastIndex = 0;
|
|
1510
|
+
var A = [];
|
|
1511
|
+
var n = 0;
|
|
1512
|
+
var result;
|
|
1513
|
+
while ((result = regexpExecAbstract(rx, S)) !== null) {
|
|
1514
|
+
var matchStr = toString_1(result[0]);
|
|
1515
|
+
A[n] = matchStr;
|
|
1516
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
|
1517
|
+
n++;
|
|
1518
|
+
}
|
|
1519
|
+
return n === 0 ? null : A;
|
|
1520
|
+
}
|
|
1521
|
+
];
|
|
1522
|
+
});
|
|
1523
|
+
|
|
1355
1524
|
var MATCH$1 = wellKnownSymbol('match');
|
|
1356
1525
|
|
|
1357
1526
|
// `IsRegExp` abstract operation
|
|
@@ -1391,7 +1560,7 @@ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
|
|
|
1391
1560
|
|
|
1392
1561
|
|
|
1393
1562
|
|
|
1394
|
-
// eslint-disable-next-line es/no-string-prototype-endswith -- safe
|
|
1563
|
+
// eslint-disable-next-line es-x/no-string-prototype-endswith -- safe
|
|
1395
1564
|
var un$EndsWith = functionUncurryThis(''.endsWith);
|
|
1396
1565
|
var slice = functionUncurryThis(''.slice);
|
|
1397
1566
|
var min$1 = Math.min;
|
|
@@ -1427,7 +1596,7 @@ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
|
1427
1596
|
|
|
1428
1597
|
|
|
1429
1598
|
|
|
1430
|
-
// eslint-disable-next-line es/no-string-prototype-startswith -- safe
|
|
1599
|
+
// eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
|
|
1431
1600
|
var un$StartsWith = functionUncurryThis(''.startsWith);
|
|
1432
1601
|
var stringSlice = functionUncurryThis(''.slice);
|
|
1433
1602
|
var min = Math.min;
|
|
@@ -1453,7 +1622,7 @@ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_I
|
|
|
1453
1622
|
}
|
|
1454
1623
|
});
|
|
1455
1624
|
|
|
1456
|
-
var
|
|
1625
|
+
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
1457
1626
|
|
|
1458
1627
|
var redefineAll = function (target, src, options) {
|
|
1459
1628
|
for (var key in src) redefine(target, key, src[key], options);
|
|
@@ -1476,13 +1645,13 @@ var aPossiblePrototype = function (argument) {
|
|
|
1476
1645
|
// `Object.setPrototypeOf` method
|
|
1477
1646
|
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1478
1647
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1479
|
-
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
1648
|
+
// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
|
|
1480
1649
|
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1481
1650
|
var CORRECT_SETTER = false;
|
|
1482
1651
|
var test = {};
|
|
1483
1652
|
var setter;
|
|
1484
1653
|
try {
|
|
1485
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1654
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
1486
1655
|
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1487
1656
|
setter(test, []);
|
|
1488
1657
|
CORRECT_SETTER = test instanceof Array;
|
|
@@ -1530,160 +1699,12 @@ var anInstance = function (it, Prototype) {
|
|
|
1530
1699
|
throw TypeError$6('Incorrect invocation');
|
|
1531
1700
|
};
|
|
1532
1701
|
|
|
1533
|
-
var bind$2 = functionUncurryThis(functionUncurryThis.bind);
|
|
1534
|
-
|
|
1535
|
-
// optional / simple context binding
|
|
1536
|
-
var functionBindContext = function (fn, that) {
|
|
1537
|
-
aCallable(fn);
|
|
1538
|
-
return that === undefined ? fn : functionBindNative ? bind$2(fn, that) : function (/* ...args */) {
|
|
1539
|
-
return fn.apply(that, arguments);
|
|
1540
|
-
};
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
var iterators = {};
|
|
1544
|
-
|
|
1545
|
-
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
1546
|
-
var ArrayPrototype = Array.prototype;
|
|
1547
|
-
|
|
1548
|
-
// check on default Array iterator
|
|
1549
|
-
var isArrayIteratorMethod = function (it) {
|
|
1550
|
-
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
1551
|
-
};
|
|
1552
|
-
|
|
1553
|
-
var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
1554
|
-
|
|
1555
|
-
var getIteratorMethod = function (it) {
|
|
1556
|
-
if (it != undefined) return getMethod(it, ITERATOR$1)
|
|
1557
|
-
|| getMethod(it, '@@iterator')
|
|
1558
|
-
|| iterators[classof(it)];
|
|
1559
|
-
};
|
|
1560
|
-
|
|
1561
1702
|
var TypeError$5 = global_1.TypeError;
|
|
1562
1703
|
|
|
1563
|
-
var getIterator = function (argument, usingIterator) {
|
|
1564
|
-
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
1565
|
-
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
1566
|
-
throw TypeError$5(tryToString(argument) + ' is not iterable');
|
|
1567
|
-
};
|
|
1568
|
-
|
|
1569
|
-
var iteratorClose = function (iterator, kind, value) {
|
|
1570
|
-
var innerResult, innerError;
|
|
1571
|
-
anObject(iterator);
|
|
1572
|
-
try {
|
|
1573
|
-
innerResult = getMethod(iterator, 'return');
|
|
1574
|
-
if (!innerResult) {
|
|
1575
|
-
if (kind === 'throw') throw value;
|
|
1576
|
-
return value;
|
|
1577
|
-
}
|
|
1578
|
-
innerResult = functionCall(innerResult, iterator);
|
|
1579
|
-
} catch (error) {
|
|
1580
|
-
innerError = true;
|
|
1581
|
-
innerResult = error;
|
|
1582
|
-
}
|
|
1583
|
-
if (kind === 'throw') throw value;
|
|
1584
|
-
if (innerError) throw innerResult;
|
|
1585
|
-
anObject(innerResult);
|
|
1586
|
-
return value;
|
|
1587
|
-
};
|
|
1588
|
-
|
|
1589
|
-
var TypeError$4 = global_1.TypeError;
|
|
1590
|
-
|
|
1591
|
-
var Result = function (stopped, result) {
|
|
1592
|
-
this.stopped = stopped;
|
|
1593
|
-
this.result = result;
|
|
1594
|
-
};
|
|
1595
|
-
|
|
1596
|
-
var ResultPrototype = Result.prototype;
|
|
1597
|
-
|
|
1598
|
-
var iterate = function (iterable, unboundFunction, options) {
|
|
1599
|
-
var that = options && options.that;
|
|
1600
|
-
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
1601
|
-
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
1602
|
-
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
1603
|
-
var fn = functionBindContext(unboundFunction, that);
|
|
1604
|
-
var iterator, iterFn, index, length, result, next, step;
|
|
1605
|
-
|
|
1606
|
-
var stop = function (condition) {
|
|
1607
|
-
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
1608
|
-
return new Result(true, condition);
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
|
-
var callFn = function (value) {
|
|
1612
|
-
if (AS_ENTRIES) {
|
|
1613
|
-
anObject(value);
|
|
1614
|
-
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
1615
|
-
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
1616
|
-
};
|
|
1617
|
-
|
|
1618
|
-
if (IS_ITERATOR) {
|
|
1619
|
-
iterator = iterable;
|
|
1620
|
-
} else {
|
|
1621
|
-
iterFn = getIteratorMethod(iterable);
|
|
1622
|
-
if (!iterFn) throw TypeError$4(tryToString(iterable) + ' is not iterable');
|
|
1623
|
-
// optimisation for array iterators
|
|
1624
|
-
if (isArrayIteratorMethod(iterFn)) {
|
|
1625
|
-
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
1626
|
-
result = callFn(iterable[index]);
|
|
1627
|
-
if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
1628
|
-
} return new Result(false);
|
|
1629
|
-
}
|
|
1630
|
-
iterator = getIterator(iterable, iterFn);
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
next = iterator.next;
|
|
1634
|
-
while (!(step = functionCall(next, iterator)).done) {
|
|
1635
|
-
try {
|
|
1636
|
-
result = callFn(step.value);
|
|
1637
|
-
} catch (error) {
|
|
1638
|
-
iteratorClose(iterator, 'throw', error);
|
|
1639
|
-
}
|
|
1640
|
-
if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
1641
|
-
} return new Result(false);
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
|
-
var ITERATOR = wellKnownSymbol('iterator');
|
|
1645
|
-
var SAFE_CLOSING = false;
|
|
1646
|
-
|
|
1647
|
-
try {
|
|
1648
|
-
var called = 0;
|
|
1649
|
-
var iteratorWithReturn = {
|
|
1650
|
-
next: function () {
|
|
1651
|
-
return { done: !!called++ };
|
|
1652
|
-
},
|
|
1653
|
-
'return': function () {
|
|
1654
|
-
SAFE_CLOSING = true;
|
|
1655
|
-
}
|
|
1656
|
-
};
|
|
1657
|
-
iteratorWithReturn[ITERATOR] = function () {
|
|
1658
|
-
return this;
|
|
1659
|
-
};
|
|
1660
|
-
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
1661
|
-
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
1662
|
-
} catch (error) { /* empty */ }
|
|
1663
|
-
|
|
1664
|
-
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
1665
|
-
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
1666
|
-
var ITERATION_SUPPORT = false;
|
|
1667
|
-
try {
|
|
1668
|
-
var object = {};
|
|
1669
|
-
object[ITERATOR] = function () {
|
|
1670
|
-
return {
|
|
1671
|
-
next: function () {
|
|
1672
|
-
return { done: ITERATION_SUPPORT = true };
|
|
1673
|
-
}
|
|
1674
|
-
};
|
|
1675
|
-
};
|
|
1676
|
-
exec(object);
|
|
1677
|
-
} catch (error) { /* empty */ }
|
|
1678
|
-
return ITERATION_SUPPORT;
|
|
1679
|
-
};
|
|
1680
|
-
|
|
1681
|
-
var TypeError$3 = global_1.TypeError;
|
|
1682
|
-
|
|
1683
1704
|
// `Assert: IsConstructor(argument) is true`
|
|
1684
1705
|
var aConstructor = function (argument) {
|
|
1685
1706
|
if (isConstructor(argument)) return argument;
|
|
1686
|
-
throw TypeError$
|
|
1707
|
+
throw TypeError$5(tryToString(argument) + ' is not a constructor');
|
|
1687
1708
|
};
|
|
1688
1709
|
|
|
1689
1710
|
var SPECIES$1 = wellKnownSymbol('species');
|
|
@@ -1700,24 +1721,32 @@ var FunctionPrototype$1 = Function.prototype;
|
|
|
1700
1721
|
var apply = FunctionPrototype$1.apply;
|
|
1701
1722
|
var call = FunctionPrototype$1.call;
|
|
1702
1723
|
|
|
1703
|
-
// eslint-disable-next-line es/no-reflect -- safe
|
|
1724
|
+
// eslint-disable-next-line es-x/no-reflect -- safe
|
|
1704
1725
|
var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
|
|
1705
1726
|
return call.apply(apply, arguments);
|
|
1706
1727
|
});
|
|
1707
1728
|
|
|
1729
|
+
var bind$2 = functionUncurryThis(functionUncurryThis.bind);
|
|
1730
|
+
|
|
1731
|
+
// optional / simple context binding
|
|
1732
|
+
var functionBindContext = function (fn, that) {
|
|
1733
|
+
aCallable(fn);
|
|
1734
|
+
return that === undefined ? fn : functionBindNative ? bind$2(fn, that) : function (/* ...args */) {
|
|
1735
|
+
return fn.apply(that, arguments);
|
|
1736
|
+
};
|
|
1737
|
+
};
|
|
1738
|
+
|
|
1708
1739
|
var arraySlice = functionUncurryThis([].slice);
|
|
1709
1740
|
|
|
1710
|
-
var TypeError$
|
|
1741
|
+
var TypeError$4 = global_1.TypeError;
|
|
1711
1742
|
|
|
1712
1743
|
var validateArgumentsLength = function (passed, required) {
|
|
1713
|
-
if (passed < required) throw TypeError$
|
|
1744
|
+
if (passed < required) throw TypeError$4('Not enough arguments');
|
|
1714
1745
|
return passed;
|
|
1715
1746
|
};
|
|
1716
1747
|
|
|
1717
1748
|
var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
|
|
1718
1749
|
|
|
1719
|
-
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
1720
|
-
|
|
1721
1750
|
var set = global_1.setImmediate;
|
|
1722
1751
|
var clear = global_1.clearImmediate;
|
|
1723
1752
|
var process$3 = global_1.process;
|
|
@@ -1889,7 +1918,7 @@ if (!queueMicrotask) {
|
|
|
1889
1918
|
// for other environments - macrotask based on:
|
|
1890
1919
|
// - setImmediate
|
|
1891
1920
|
// - MessageChannel
|
|
1892
|
-
// - window.
|
|
1921
|
+
// - window.postMessage
|
|
1893
1922
|
// - onreadystatechange
|
|
1894
1923
|
// - setTimeout
|
|
1895
1924
|
} else {
|
|
@@ -1910,36 +1939,6 @@ var microtask = queueMicrotask || function (fn) {
|
|
|
1910
1939
|
} last = task;
|
|
1911
1940
|
};
|
|
1912
1941
|
|
|
1913
|
-
var PromiseCapability = function (C) {
|
|
1914
|
-
var resolve, reject;
|
|
1915
|
-
this.promise = new C(function ($$resolve, $$reject) {
|
|
1916
|
-
if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
|
1917
|
-
resolve = $$resolve;
|
|
1918
|
-
reject = $$reject;
|
|
1919
|
-
});
|
|
1920
|
-
this.resolve = aCallable(resolve);
|
|
1921
|
-
this.reject = aCallable(reject);
|
|
1922
|
-
};
|
|
1923
|
-
|
|
1924
|
-
// `NewPromiseCapability` abstract operation
|
|
1925
|
-
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
1926
|
-
var f = function (C) {
|
|
1927
|
-
return new PromiseCapability(C);
|
|
1928
|
-
};
|
|
1929
|
-
|
|
1930
|
-
var newPromiseCapability$1 = {
|
|
1931
|
-
f: f
|
|
1932
|
-
};
|
|
1933
|
-
|
|
1934
|
-
var promiseResolve = function (C, x) {
|
|
1935
|
-
anObject(C);
|
|
1936
|
-
if (isObject$1(x) && x.constructor === C) return x;
|
|
1937
|
-
var promiseCapability = newPromiseCapability$1.f(C);
|
|
1938
|
-
var resolve = promiseCapability.resolve;
|
|
1939
|
-
resolve(x);
|
|
1940
|
-
return promiseCapability.promise;
|
|
1941
|
-
};
|
|
1942
|
-
|
|
1943
1942
|
var hostReportErrors = function (a, b) {
|
|
1944
1943
|
var console = global_1.console;
|
|
1945
1944
|
if (console && console.error) {
|
|
@@ -1955,32 +1954,90 @@ var perform = function (exec) {
|
|
|
1955
1954
|
}
|
|
1956
1955
|
};
|
|
1957
1956
|
|
|
1958
|
-
var Queue = function () {
|
|
1959
|
-
this.head = null;
|
|
1960
|
-
this.tail = null;
|
|
1957
|
+
var Queue = function () {
|
|
1958
|
+
this.head = null;
|
|
1959
|
+
this.tail = null;
|
|
1960
|
+
};
|
|
1961
|
+
|
|
1962
|
+
Queue.prototype = {
|
|
1963
|
+
add: function (item) {
|
|
1964
|
+
var entry = { item: item, next: null };
|
|
1965
|
+
if (this.head) this.tail.next = entry;
|
|
1966
|
+
else this.head = entry;
|
|
1967
|
+
this.tail = entry;
|
|
1968
|
+
},
|
|
1969
|
+
get: function () {
|
|
1970
|
+
var entry = this.head;
|
|
1971
|
+
if (entry) {
|
|
1972
|
+
this.head = entry.next;
|
|
1973
|
+
if (this.tail === entry) this.tail = null;
|
|
1974
|
+
return entry.item;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
|
|
1979
|
+
var queue = Queue;
|
|
1980
|
+
|
|
1981
|
+
var promiseNativeConstructor = global_1.Promise;
|
|
1982
|
+
|
|
1983
|
+
var engineIsBrowser = typeof window == 'object' && typeof Deno != 'object';
|
|
1984
|
+
|
|
1985
|
+
promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
1986
|
+
var SPECIES = wellKnownSymbol('species');
|
|
1987
|
+
var SUBCLASSING = false;
|
|
1988
|
+
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable(global_1.PromiseRejectionEvent);
|
|
1989
|
+
|
|
1990
|
+
var FORCED_PROMISE_CONSTRUCTOR$5 = isForced_1('Promise', function () {
|
|
1991
|
+
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(promiseNativeConstructor);
|
|
1992
|
+
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(promiseNativeConstructor);
|
|
1993
|
+
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
1994
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
1995
|
+
// We can't detect it synchronously, so just check versions
|
|
1996
|
+
if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
|
|
1997
|
+
// We can't use @@species feature detection in V8 since it causes
|
|
1998
|
+
// deoptimization and performance degradation
|
|
1999
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
2000
|
+
if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
|
|
2001
|
+
// Detect correctness of subclassing with @@species support
|
|
2002
|
+
var promise = new promiseNativeConstructor(function (resolve) { resolve(1); });
|
|
2003
|
+
var FakePromise = function (exec) {
|
|
2004
|
+
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
2005
|
+
};
|
|
2006
|
+
var constructor = promise.constructor = {};
|
|
2007
|
+
constructor[SPECIES] = FakePromise;
|
|
2008
|
+
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
2009
|
+
if (!SUBCLASSING) return true;
|
|
2010
|
+
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
2011
|
+
return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_PROMISE_REJECTION_EVENT$1;
|
|
2012
|
+
});
|
|
2013
|
+
|
|
2014
|
+
var promiseConstructorDetection = {
|
|
2015
|
+
CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
|
|
2016
|
+
REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
|
|
2017
|
+
SUBCLASSING: SUBCLASSING
|
|
2018
|
+
};
|
|
2019
|
+
|
|
2020
|
+
var PromiseCapability = function (C) {
|
|
2021
|
+
var resolve, reject;
|
|
2022
|
+
this.promise = new C(function ($$resolve, $$reject) {
|
|
2023
|
+
if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
|
2024
|
+
resolve = $$resolve;
|
|
2025
|
+
reject = $$reject;
|
|
2026
|
+
});
|
|
2027
|
+
this.resolve = aCallable(resolve);
|
|
2028
|
+
this.reject = aCallable(reject);
|
|
2029
|
+
};
|
|
2030
|
+
|
|
2031
|
+
// `NewPromiseCapability` abstract operation
|
|
2032
|
+
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
2033
|
+
var f = function (C) {
|
|
2034
|
+
return new PromiseCapability(C);
|
|
1961
2035
|
};
|
|
1962
2036
|
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
var entry = { item: item, next: null };
|
|
1966
|
-
if (this.head) this.tail.next = entry;
|
|
1967
|
-
else this.head = entry;
|
|
1968
|
-
this.tail = entry;
|
|
1969
|
-
},
|
|
1970
|
-
get: function () {
|
|
1971
|
-
var entry = this.head;
|
|
1972
|
-
if (entry) {
|
|
1973
|
-
this.head = entry.next;
|
|
1974
|
-
if (this.tail === entry) this.tail = null;
|
|
1975
|
-
return entry.item;
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
2037
|
+
var newPromiseCapability$1 = {
|
|
2038
|
+
f: f
|
|
1978
2039
|
};
|
|
1979
2040
|
|
|
1980
|
-
var queue = Queue;
|
|
1981
|
-
|
|
1982
|
-
var engineIsBrowser = typeof window == 'object';
|
|
1983
|
-
|
|
1984
2041
|
var task = task$1.set;
|
|
1985
2042
|
|
|
1986
2043
|
|
|
@@ -1991,27 +2048,22 @@ var task = task$1.set;
|
|
|
1991
2048
|
|
|
1992
2049
|
|
|
1993
2050
|
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
var SPECIES = wellKnownSymbol('species');
|
|
1999
2051
|
var PROMISE = 'Promise';
|
|
2000
|
-
|
|
2001
|
-
var
|
|
2002
|
-
var
|
|
2052
|
+
var FORCED_PROMISE_CONSTRUCTOR$4 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2053
|
+
var NATIVE_PROMISE_REJECTION_EVENT = promiseConstructorDetection.REJECTION_EVENT;
|
|
2054
|
+
var NATIVE_PROMISE_SUBCLASSING = promiseConstructorDetection.SUBCLASSING;
|
|
2003
2055
|
var getInternalPromiseState = internalState.getterFor(PROMISE);
|
|
2004
|
-
var
|
|
2005
|
-
var
|
|
2006
|
-
var
|
|
2007
|
-
var
|
|
2056
|
+
var setInternalState = internalState.set;
|
|
2057
|
+
var NativePromisePrototype$1 = promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2058
|
+
var PromiseConstructor = promiseNativeConstructor;
|
|
2059
|
+
var PromisePrototype = NativePromisePrototype$1;
|
|
2060
|
+
var TypeError$3 = global_1.TypeError;
|
|
2008
2061
|
var document$1 = global_1.document;
|
|
2009
2062
|
var process$1 = global_1.process;
|
|
2010
2063
|
var newPromiseCapability = newPromiseCapability$1.f;
|
|
2011
2064
|
var newGenericPromiseCapability = newPromiseCapability;
|
|
2012
2065
|
|
|
2013
2066
|
var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent);
|
|
2014
|
-
var NATIVE_REJECTION_EVENT = isCallable(global_1.PromiseRejectionEvent);
|
|
2015
2067
|
var UNHANDLED_REJECTION = 'unhandledrejection';
|
|
2016
2068
|
var REJECTION_HANDLED = 'rejectionhandled';
|
|
2017
2069
|
var PENDING = 0;
|
|
@@ -2019,38 +2071,9 @@ var FULFILLED = 1;
|
|
|
2019
2071
|
var REJECTED = 2;
|
|
2020
2072
|
var HANDLED = 1;
|
|
2021
2073
|
var UNHANDLED = 2;
|
|
2022
|
-
var SUBCLASSING = false;
|
|
2023
2074
|
|
|
2024
2075
|
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
2025
2076
|
|
|
2026
|
-
var FORCED = isForced_1(PROMISE, function () {
|
|
2027
|
-
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
|
|
2028
|
-
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
|
|
2029
|
-
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
2030
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
2031
|
-
// We can't detect it synchronously, so just check versions
|
|
2032
|
-
if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
|
|
2033
|
-
// We can't use @@species feature detection in V8 since it causes
|
|
2034
|
-
// deoptimization and performance degradation
|
|
2035
|
-
// https://github.com/zloirock/core-js/issues/679
|
|
2036
|
-
if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
|
|
2037
|
-
// Detect correctness of subclassing with @@species support
|
|
2038
|
-
var promise = new PromiseConstructor(function (resolve) { resolve(1); });
|
|
2039
|
-
var FakePromise = function (exec) {
|
|
2040
|
-
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
2041
|
-
};
|
|
2042
|
-
var constructor = promise.constructor = {};
|
|
2043
|
-
constructor[SPECIES] = FakePromise;
|
|
2044
|
-
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
2045
|
-
if (!SUBCLASSING) return true;
|
|
2046
|
-
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
2047
|
-
return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_REJECTION_EVENT;
|
|
2048
|
-
});
|
|
2049
|
-
|
|
2050
|
-
var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
|
|
2051
|
-
PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
|
|
2052
|
-
});
|
|
2053
|
-
|
|
2054
2077
|
// helpers
|
|
2055
2078
|
var isThenable = function (it) {
|
|
2056
2079
|
var then;
|
|
@@ -2081,7 +2104,7 @@ var callReaction = function (reaction, state) {
|
|
|
2081
2104
|
}
|
|
2082
2105
|
}
|
|
2083
2106
|
if (result === reaction.promise) {
|
|
2084
|
-
reject(TypeError$
|
|
2107
|
+
reject(TypeError$3('Promise-chain cycle'));
|
|
2085
2108
|
} else if (then = isThenable(result)) {
|
|
2086
2109
|
functionCall(then, result, resolve, reject);
|
|
2087
2110
|
} else resolve(result);
|
|
@@ -2115,7 +2138,7 @@ var dispatchEvent = function (name, promise, reason) {
|
|
|
2115
2138
|
event.initEvent(name, false, true);
|
|
2116
2139
|
global_1.dispatchEvent(event);
|
|
2117
2140
|
} else event = { promise: promise, reason: reason };
|
|
2118
|
-
if (!
|
|
2141
|
+
if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event);
|
|
2119
2142
|
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
|
|
2120
2143
|
};
|
|
2121
2144
|
|
|
@@ -2171,7 +2194,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2171
2194
|
state.done = true;
|
|
2172
2195
|
if (unwrap) state = unwrap;
|
|
2173
2196
|
try {
|
|
2174
|
-
if (state.facade === value) throw TypeError$
|
|
2197
|
+
if (state.facade === value) throw TypeError$3("Promise can't be resolved itself");
|
|
2175
2198
|
var then = isThenable(value);
|
|
2176
2199
|
if (then) {
|
|
2177
2200
|
microtask(function () {
|
|
@@ -2196,20 +2219,22 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2196
2219
|
};
|
|
2197
2220
|
|
|
2198
2221
|
// constructor polyfill
|
|
2199
|
-
if (
|
|
2222
|
+
if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
2200
2223
|
// 25.4.3.1 Promise(executor)
|
|
2201
2224
|
PromiseConstructor = function Promise(executor) {
|
|
2202
2225
|
anInstance(this, PromisePrototype);
|
|
2203
2226
|
aCallable(executor);
|
|
2204
2227
|
functionCall(Internal, this);
|
|
2205
|
-
var state =
|
|
2228
|
+
var state = getInternalPromiseState(this);
|
|
2206
2229
|
try {
|
|
2207
2230
|
executor(bind$1(internalResolve, state), bind$1(internalReject, state));
|
|
2208
2231
|
} catch (error) {
|
|
2209
2232
|
internalReject(state, error);
|
|
2210
2233
|
}
|
|
2211
2234
|
};
|
|
2235
|
+
|
|
2212
2236
|
PromisePrototype = PromiseConstructor.prototype;
|
|
2237
|
+
|
|
2213
2238
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2214
2239
|
Internal = function Promise(executor) {
|
|
2215
2240
|
setInternalState(this, {
|
|
@@ -2223,6 +2248,7 @@ if (FORCED) {
|
|
|
2223
2248
|
value: undefined
|
|
2224
2249
|
});
|
|
2225
2250
|
};
|
|
2251
|
+
|
|
2226
2252
|
Internal.prototype = redefineAll(PromisePrototype, {
|
|
2227
2253
|
// `Promise.prototype.then` method
|
|
2228
2254
|
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
@@ -2239,89 +2265,206 @@ if (FORCED) {
|
|
|
2239
2265
|
callReaction(reaction, state);
|
|
2240
2266
|
});
|
|
2241
2267
|
return reaction.promise;
|
|
2242
|
-
},
|
|
2243
|
-
// `Promise.prototype.catch` method
|
|
2244
|
-
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
2245
|
-
'catch': function (onRejected) {
|
|
2246
|
-
return this.then(undefined, onRejected);
|
|
2247
2268
|
}
|
|
2248
2269
|
});
|
|
2270
|
+
|
|
2249
2271
|
OwnPromiseCapability = function () {
|
|
2250
2272
|
var promise = new Internal();
|
|
2251
|
-
var state =
|
|
2273
|
+
var state = getInternalPromiseState(promise);
|
|
2252
2274
|
this.promise = promise;
|
|
2253
2275
|
this.resolve = bind$1(internalResolve, state);
|
|
2254
2276
|
this.reject = bind$1(internalReject, state);
|
|
2255
2277
|
};
|
|
2278
|
+
|
|
2256
2279
|
newPromiseCapability$1.f = newPromiseCapability = function (C) {
|
|
2257
2280
|
return C === PromiseConstructor || C === PromiseWrapper
|
|
2258
2281
|
? new OwnPromiseCapability(C)
|
|
2259
2282
|
: newGenericPromiseCapability(C);
|
|
2260
2283
|
};
|
|
2261
2284
|
|
|
2262
|
-
if (isCallable(
|
|
2263
|
-
nativeThen = NativePromisePrototype.then;
|
|
2285
|
+
if (isCallable(promiseNativeConstructor) && NativePromisePrototype$1 !== Object.prototype) {
|
|
2286
|
+
nativeThen = NativePromisePrototype$1.then;
|
|
2264
2287
|
|
|
2265
|
-
if (!
|
|
2288
|
+
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
2266
2289
|
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
2267
|
-
redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
2290
|
+
redefine(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
2268
2291
|
var that = this;
|
|
2269
2292
|
return new PromiseConstructor(function (resolve, reject) {
|
|
2270
2293
|
functionCall(nativeThen, that, resolve, reject);
|
|
2271
2294
|
}).then(onFulfilled, onRejected);
|
|
2272
2295
|
// https://github.com/zloirock/core-js/issues/640
|
|
2273
2296
|
}, { unsafe: true });
|
|
2274
|
-
|
|
2275
|
-
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
2276
|
-
redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true });
|
|
2277
2297
|
}
|
|
2278
2298
|
|
|
2279
2299
|
// make `.constructor === Promise` work for native promise-based APIs
|
|
2280
2300
|
try {
|
|
2281
|
-
delete NativePromisePrototype.constructor;
|
|
2301
|
+
delete NativePromisePrototype$1.constructor;
|
|
2282
2302
|
} catch (error) { /* empty */ }
|
|
2283
2303
|
|
|
2284
2304
|
// make `instanceof Promise` work for native promise-based APIs
|
|
2285
2305
|
if (objectSetPrototypeOf) {
|
|
2286
|
-
objectSetPrototypeOf(NativePromisePrototype, PromisePrototype);
|
|
2306
|
+
objectSetPrototypeOf(NativePromisePrototype$1, PromisePrototype);
|
|
2287
2307
|
}
|
|
2288
2308
|
}
|
|
2289
2309
|
}
|
|
2290
2310
|
|
|
2291
|
-
_export({ global: true, wrap: true, forced:
|
|
2311
|
+
_export({ global: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2292
2312
|
Promise: PromiseConstructor
|
|
2293
2313
|
});
|
|
2294
2314
|
|
|
2295
2315
|
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
2296
2316
|
setSpecies(PROMISE);
|
|
2297
2317
|
|
|
2298
|
-
|
|
2318
|
+
var iterators = {};
|
|
2299
2319
|
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2320
|
+
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
2321
|
+
var ArrayPrototype = Array.prototype;
|
|
2322
|
+
|
|
2323
|
+
// check on default Array iterator
|
|
2324
|
+
var isArrayIteratorMethod = function (it) {
|
|
2325
|
+
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
2326
|
+
};
|
|
2327
|
+
|
|
2328
|
+
var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
2329
|
+
|
|
2330
|
+
var getIteratorMethod = function (it) {
|
|
2331
|
+
if (it != undefined) return getMethod(it, ITERATOR$1)
|
|
2332
|
+
|| getMethod(it, '@@iterator')
|
|
2333
|
+
|| iterators[classof(it)];
|
|
2334
|
+
};
|
|
2335
|
+
|
|
2336
|
+
var TypeError$2 = global_1.TypeError;
|
|
2337
|
+
|
|
2338
|
+
var getIterator = function (argument, usingIterator) {
|
|
2339
|
+
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
2340
|
+
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
2341
|
+
throw TypeError$2(tryToString(argument) + ' is not iterable');
|
|
2342
|
+
};
|
|
2343
|
+
|
|
2344
|
+
var iteratorClose = function (iterator, kind, value) {
|
|
2345
|
+
var innerResult, innerError;
|
|
2346
|
+
anObject(iterator);
|
|
2347
|
+
try {
|
|
2348
|
+
innerResult = getMethod(iterator, 'return');
|
|
2349
|
+
if (!innerResult) {
|
|
2350
|
+
if (kind === 'throw') throw value;
|
|
2351
|
+
return value;
|
|
2352
|
+
}
|
|
2353
|
+
innerResult = functionCall(innerResult, iterator);
|
|
2354
|
+
} catch (error) {
|
|
2355
|
+
innerError = true;
|
|
2356
|
+
innerResult = error;
|
|
2308
2357
|
}
|
|
2309
|
-
|
|
2358
|
+
if (kind === 'throw') throw value;
|
|
2359
|
+
if (innerError) throw innerResult;
|
|
2360
|
+
anObject(innerResult);
|
|
2361
|
+
return value;
|
|
2362
|
+
};
|
|
2310
2363
|
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2364
|
+
var TypeError$1 = global_1.TypeError;
|
|
2365
|
+
|
|
2366
|
+
var Result = function (stopped, result) {
|
|
2367
|
+
this.stopped = stopped;
|
|
2368
|
+
this.result = result;
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2371
|
+
var ResultPrototype = Result.prototype;
|
|
2372
|
+
|
|
2373
|
+
var iterate = function (iterable, unboundFunction, options) {
|
|
2374
|
+
var that = options && options.that;
|
|
2375
|
+
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
2376
|
+
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
2377
|
+
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
2378
|
+
var fn = functionBindContext(unboundFunction, that);
|
|
2379
|
+
var iterator, iterFn, index, length, result, next, step;
|
|
2380
|
+
|
|
2381
|
+
var stop = function (condition) {
|
|
2382
|
+
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
2383
|
+
return new Result(true, condition);
|
|
2384
|
+
};
|
|
2385
|
+
|
|
2386
|
+
var callFn = function (value) {
|
|
2387
|
+
if (AS_ENTRIES) {
|
|
2388
|
+
anObject(value);
|
|
2389
|
+
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
2390
|
+
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
2391
|
+
};
|
|
2392
|
+
|
|
2393
|
+
if (IS_ITERATOR) {
|
|
2394
|
+
iterator = iterable;
|
|
2395
|
+
} else {
|
|
2396
|
+
iterFn = getIteratorMethod(iterable);
|
|
2397
|
+
if (!iterFn) throw TypeError$1(tryToString(iterable) + ' is not iterable');
|
|
2398
|
+
// optimisation for array iterators
|
|
2399
|
+
if (isArrayIteratorMethod(iterFn)) {
|
|
2400
|
+
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
2401
|
+
result = callFn(iterable[index]);
|
|
2402
|
+
if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
2403
|
+
} return new Result(false);
|
|
2404
|
+
}
|
|
2405
|
+
iterator = getIterator(iterable, iterFn);
|
|
2316
2406
|
}
|
|
2407
|
+
|
|
2408
|
+
next = iterator.next;
|
|
2409
|
+
while (!(step = functionCall(next, iterator)).done) {
|
|
2410
|
+
try {
|
|
2411
|
+
result = callFn(step.value);
|
|
2412
|
+
} catch (error) {
|
|
2413
|
+
iteratorClose(iterator, 'throw', error);
|
|
2414
|
+
}
|
|
2415
|
+
if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
2416
|
+
} return new Result(false);
|
|
2417
|
+
};
|
|
2418
|
+
|
|
2419
|
+
var ITERATOR = wellKnownSymbol('iterator');
|
|
2420
|
+
var SAFE_CLOSING = false;
|
|
2421
|
+
|
|
2422
|
+
try {
|
|
2423
|
+
var called = 0;
|
|
2424
|
+
var iteratorWithReturn = {
|
|
2425
|
+
next: function () {
|
|
2426
|
+
return { done: !!called++ };
|
|
2427
|
+
},
|
|
2428
|
+
'return': function () {
|
|
2429
|
+
SAFE_CLOSING = true;
|
|
2430
|
+
}
|
|
2431
|
+
};
|
|
2432
|
+
iteratorWithReturn[ITERATOR] = function () {
|
|
2433
|
+
return this;
|
|
2434
|
+
};
|
|
2435
|
+
// eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
|
|
2436
|
+
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
2437
|
+
} catch (error) { /* empty */ }
|
|
2438
|
+
|
|
2439
|
+
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
2440
|
+
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
2441
|
+
var ITERATION_SUPPORT = false;
|
|
2442
|
+
try {
|
|
2443
|
+
var object = {};
|
|
2444
|
+
object[ITERATOR] = function () {
|
|
2445
|
+
return {
|
|
2446
|
+
next: function () {
|
|
2447
|
+
return { done: ITERATION_SUPPORT = true };
|
|
2448
|
+
}
|
|
2449
|
+
};
|
|
2450
|
+
};
|
|
2451
|
+
exec(object);
|
|
2452
|
+
} catch (error) { /* empty */ }
|
|
2453
|
+
return ITERATION_SUPPORT;
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2456
|
+
var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2457
|
+
|
|
2458
|
+
var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
|
|
2459
|
+
promiseNativeConstructor.all(iterable).then(undefined, function () { /* empty */ });
|
|
2317
2460
|
});
|
|
2318
2461
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2462
|
+
// `Promise.all` method
|
|
2463
|
+
// https://tc39.es/ecma262/#sec-promise.all
|
|
2464
|
+
_export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
|
|
2322
2465
|
all: function all(iterable) {
|
|
2323
2466
|
var C = this;
|
|
2324
|
-
var capability = newPromiseCapability(C);
|
|
2467
|
+
var capability = newPromiseCapability$1.f(C);
|
|
2325
2468
|
var resolve = capability.resolve;
|
|
2326
2469
|
var reject = capability.reject;
|
|
2327
2470
|
var result = perform(function () {
|
|
@@ -2344,12 +2487,39 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
|
2344
2487
|
});
|
|
2345
2488
|
if (result.error) reject(result.value);
|
|
2346
2489
|
return capability.promise;
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2490
|
+
}
|
|
2491
|
+
});
|
|
2492
|
+
|
|
2493
|
+
var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2494
|
+
|
|
2495
|
+
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
var NativePromisePrototype = promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2500
|
+
|
|
2501
|
+
// `Promise.prototype.catch` method
|
|
2502
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
2503
|
+
_export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
|
|
2504
|
+
'catch': function (onRejected) {
|
|
2505
|
+
return this.then(undefined, onRejected);
|
|
2506
|
+
}
|
|
2507
|
+
});
|
|
2508
|
+
|
|
2509
|
+
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
2510
|
+
if (isCallable(promiseNativeConstructor)) {
|
|
2511
|
+
var method = getBuiltIn('Promise').prototype['catch'];
|
|
2512
|
+
if (NativePromisePrototype['catch'] !== method) {
|
|
2513
|
+
redefine(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
// `Promise.race` method
|
|
2518
|
+
// https://tc39.es/ecma262/#sec-promise.race
|
|
2519
|
+
_export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
|
|
2350
2520
|
race: function race(iterable) {
|
|
2351
2521
|
var C = this;
|
|
2352
|
-
var capability = newPromiseCapability(C);
|
|
2522
|
+
var capability = newPromiseCapability$1.f(C);
|
|
2353
2523
|
var reject = capability.reject;
|
|
2354
2524
|
var result = perform(function () {
|
|
2355
2525
|
var $promiseResolve = aCallable(C.resolve);
|
|
@@ -2362,9 +2532,43 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
|
2362
2532
|
}
|
|
2363
2533
|
});
|
|
2364
2534
|
|
|
2365
|
-
|
|
2535
|
+
var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2536
|
+
|
|
2537
|
+
// `Promise.reject` method
|
|
2538
|
+
// https://tc39.es/ecma262/#sec-promise.reject
|
|
2539
|
+
_export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
|
|
2540
|
+
reject: function reject(r) {
|
|
2541
|
+
var capability = newPromiseCapability$1.f(this);
|
|
2542
|
+
functionCall(capability.reject, undefined, r);
|
|
2543
|
+
return capability.promise;
|
|
2544
|
+
}
|
|
2545
|
+
});
|
|
2546
|
+
|
|
2547
|
+
var promiseResolve = function (C, x) {
|
|
2548
|
+
anObject(C);
|
|
2549
|
+
if (isObject$1(x) && x.constructor === C) return x;
|
|
2550
|
+
var promiseCapability = newPromiseCapability$1.f(C);
|
|
2551
|
+
var resolve = promiseCapability.resolve;
|
|
2552
|
+
resolve(x);
|
|
2553
|
+
return promiseCapability.promise;
|
|
2554
|
+
};
|
|
2555
|
+
|
|
2556
|
+
var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
getBuiltIn('Promise');
|
|
2560
|
+
|
|
2561
|
+
// `Promise.resolve` method
|
|
2562
|
+
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
2563
|
+
_export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
2564
|
+
resolve: function resolve(x) {
|
|
2565
|
+
return promiseResolve(this, x);
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
|
|
2569
|
+
// eslint-disable-next-line es-x/no-object-assign -- safe
|
|
2366
2570
|
var $assign = Object.assign;
|
|
2367
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2571
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
2368
2572
|
var defineProperty$1 = Object.defineProperty;
|
|
2369
2573
|
var concat = functionUncurryThis([].concat);
|
|
2370
2574
|
|
|
@@ -2384,7 +2588,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2384
2588
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
2385
2589
|
var A = {};
|
|
2386
2590
|
var B = {};
|
|
2387
|
-
// eslint-disable-next-line es/no-symbol -- safe
|
|
2591
|
+
// eslint-disable-next-line es-x/no-symbol -- safe
|
|
2388
2592
|
var symbol = Symbol();
|
|
2389
2593
|
var alphabet = 'abcdefghijklmnopqrst';
|
|
2390
2594
|
A[symbol] = 7;
|
|
@@ -2411,7 +2615,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2411
2615
|
|
|
2412
2616
|
// `Object.assign` method
|
|
2413
2617
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2414
|
-
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
2618
|
+
// eslint-disable-next-line es-x/no-object-assign -- required for testing
|
|
2415
2619
|
_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
|
|
2416
2620
|
assign: objectAssign
|
|
2417
2621
|
});
|
|
@@ -2561,7 +2765,7 @@ var STRICT_METHOD = arrayMethodIsStrict('forEach');
|
|
|
2561
2765
|
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
2562
2766
|
var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
|
|
2563
2767
|
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
2564
|
-
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
|
|
2768
|
+
// eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
|
|
2565
2769
|
} : [].forEach;
|
|
2566
2770
|
|
|
2567
2771
|
var handlePrototype = function (CollectionPrototype) {
|
|
@@ -4038,6 +4242,79 @@ axios_1.default = default_1;
|
|
|
4038
4242
|
|
|
4039
4243
|
var axios = axios_1;
|
|
4040
4244
|
|
|
4245
|
+
var name$1 = "@tryghost/content-api";
|
|
4246
|
+
var version = "1.9.0";
|
|
4247
|
+
var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
|
|
4248
|
+
var author = "Ghost Foundation";
|
|
4249
|
+
var license = "MIT";
|
|
4250
|
+
var main = "cjs/content-api.js";
|
|
4251
|
+
var unpkg = "umd/content-api.min.js";
|
|
4252
|
+
var module = "es/content-api.js";
|
|
4253
|
+
var source = "lib/index.js";
|
|
4254
|
+
var files = [
|
|
4255
|
+
"LICENSE",
|
|
4256
|
+
"README.md",
|
|
4257
|
+
"cjs/",
|
|
4258
|
+
"lib/",
|
|
4259
|
+
"umd/",
|
|
4260
|
+
"es/"
|
|
4261
|
+
];
|
|
4262
|
+
var scripts = {
|
|
4263
|
+
dev: "echo \"Implement me!\"",
|
|
4264
|
+
pretest: "yarn build",
|
|
4265
|
+
test: "NODE_ENV=testing c8 --all --reporter text --reporter cobertura mocha './test/**/*.test.js'",
|
|
4266
|
+
build: "rollup -c",
|
|
4267
|
+
lint: "eslint . --ext .js --cache",
|
|
4268
|
+
prepare: "NODE_ENV=production yarn build",
|
|
4269
|
+
posttest: "yarn lint"
|
|
4270
|
+
};
|
|
4271
|
+
var publishConfig = {
|
|
4272
|
+
access: "public"
|
|
4273
|
+
};
|
|
4274
|
+
var devDependencies = {
|
|
4275
|
+
"@babel/core": "7.17.9",
|
|
4276
|
+
"@babel/polyfill": "7.12.1",
|
|
4277
|
+
"@babel/preset-env": "7.16.11",
|
|
4278
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
4279
|
+
c8: "7.11.0",
|
|
4280
|
+
"core-js": "3.22.0",
|
|
4281
|
+
"eslint-plugin-ghost": "1.5.0",
|
|
4282
|
+
mocha: "7.2.0",
|
|
4283
|
+
rollup: "2.70.2",
|
|
4284
|
+
"rollup-plugin-babel": "4.4.0",
|
|
4285
|
+
"rollup-plugin-commonjs": "10.1.0",
|
|
4286
|
+
"rollup-plugin-node-resolve": "5.2.0",
|
|
4287
|
+
"rollup-plugin-replace": "2.2.0",
|
|
4288
|
+
"rollup-plugin-terser": "7.0.2",
|
|
4289
|
+
should: "13.2.3",
|
|
4290
|
+
sinon: "9.2.4"
|
|
4291
|
+
};
|
|
4292
|
+
var dependencies = {
|
|
4293
|
+
axios: "^0.21.1"
|
|
4294
|
+
};
|
|
4295
|
+
var gitHead = "f699f18279c596be384760adccbbf90a659bd4bc";
|
|
4296
|
+
var packageInfo = {
|
|
4297
|
+
name: name$1,
|
|
4298
|
+
version: version,
|
|
4299
|
+
repository: repository,
|
|
4300
|
+
author: author,
|
|
4301
|
+
license: license,
|
|
4302
|
+
main: main,
|
|
4303
|
+
"umd:main": "umd/content-api.min.js",
|
|
4304
|
+
unpkg: unpkg,
|
|
4305
|
+
module: module,
|
|
4306
|
+
source: source,
|
|
4307
|
+
files: files,
|
|
4308
|
+
scripts: scripts,
|
|
4309
|
+
publishConfig: publishConfig,
|
|
4310
|
+
devDependencies: devDependencies,
|
|
4311
|
+
dependencies: dependencies,
|
|
4312
|
+
gitHead: gitHead
|
|
4313
|
+
};
|
|
4314
|
+
|
|
4315
|
+
var packageVersion = packageInfo.version; // NOTE: bump this default when Ghost v5 is released
|
|
4316
|
+
|
|
4317
|
+
var defaultAcceptVersionHeader = 'v4.0';
|
|
4041
4318
|
var supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
|
|
4042
4319
|
var name = '@tryghost/content-api';
|
|
4043
4320
|
|
|
@@ -4063,10 +4340,9 @@ var defaultMakeRequest = function defaultMakeRequest(_ref) {
|
|
|
4063
4340
|
* @param {String} options.url
|
|
4064
4341
|
* @param {String} options.key
|
|
4065
4342
|
* @param {String} [options.ghostPath]
|
|
4066
|
-
* @param {String}
|
|
4343
|
+
* @param {String|Boolean} options.version - a version string like v3, v4, v5 or boolean value identifying presence of Accept-Version header
|
|
4067
4344
|
* @param {Function} [options.makeRequest]
|
|
4068
4345
|
* @param {String} [options.host] Deprecated
|
|
4069
|
-
* @returns
|
|
4070
4346
|
*/
|
|
4071
4347
|
|
|
4072
4348
|
|
|
@@ -4103,8 +4379,32 @@ function GhostContentAPI(_ref2) {
|
|
|
4103
4379
|
});
|
|
4104
4380
|
}
|
|
4105
4381
|
|
|
4106
|
-
if (version
|
|
4382
|
+
if (version === undefined) {
|
|
4383
|
+
throw new Error("".concat(name, " Config Missing: 'version' is required. E.g. ").concat(supportedVersions.join(',')));
|
|
4384
|
+
}
|
|
4385
|
+
|
|
4386
|
+
var acceptVersionHeader;
|
|
4387
|
+
|
|
4388
|
+
if (typeof version === 'boolean') {
|
|
4389
|
+
if (version === true) {
|
|
4390
|
+
acceptVersionHeader = defaultAcceptVersionHeader;
|
|
4391
|
+
}
|
|
4392
|
+
|
|
4393
|
+
version = undefined;
|
|
4394
|
+
} else if (version && !supportedVersions.includes(version) && !version.match(/^v\d+\.\d+/)) {
|
|
4107
4395
|
throw new Error("".concat(name, " Config Invalid: 'version' ").concat(version, " is not supported"));
|
|
4396
|
+
} else {
|
|
4397
|
+
if (version === 'canary') {
|
|
4398
|
+
// eslint-disable-next-line
|
|
4399
|
+
console.warn("".concat(name, ": The 'version' parameter has a deprecated format 'canary', please use 'v{major}.{minor}' format instead"));
|
|
4400
|
+
acceptVersionHeader = defaultAcceptVersionHeader;
|
|
4401
|
+
} else if (version.match(/^v\d+$/)) {
|
|
4402
|
+
// eslint-disable-next-line
|
|
4403
|
+
console.warn("".concat(name, ": The 'version' parameter has a deprecated format 'v{major}', please use 'v{major}.{minor}' format instead"));
|
|
4404
|
+
acceptVersionHeader = "".concat(version, ".0");
|
|
4405
|
+
} else {
|
|
4406
|
+
acceptVersionHeader = version;
|
|
4407
|
+
}
|
|
4108
4408
|
}
|
|
4109
4409
|
|
|
4110
4410
|
if (!url) {
|
|
@@ -4165,9 +4465,10 @@ function GhostContentAPI(_ref2) {
|
|
|
4165
4465
|
var headers = membersToken ? {
|
|
4166
4466
|
Authorization: "GhostMembers ".concat(membersToken)
|
|
4167
4467
|
} : {};
|
|
4468
|
+
headers['User-Agent'] = "GhostContentSDK/".concat(packageVersion);
|
|
4168
4469
|
|
|
4169
|
-
if (
|
|
4170
|
-
headers['Accept-Version'] =
|
|
4470
|
+
if (acceptVersionHeader) {
|
|
4471
|
+
headers['Accept-Version'] = acceptVersionHeader;
|
|
4171
4472
|
}
|
|
4172
4473
|
|
|
4173
4474
|
params = Object.assign({
|