@tryghost/content-api 1.7.3 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/content-api.js +128 -7
- package/es/content-api.js +1101 -681
- package/es/content-api.js.map +1 -1
- package/lib/index.js +59 -7
- package/package.json +5 -4
- 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,18 +44,25 @@ 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
|
+
var functionBindNative = !fails(function () {
|
|
52
|
+
// eslint-disable-next-line es-x/no-function-prototype-bind -- safe
|
|
53
|
+
var test = (function () { /* empty */ }).bind();
|
|
54
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
55
|
+
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
56
|
+
});
|
|
57
|
+
|
|
51
58
|
var call$2 = Function.prototype.call;
|
|
52
59
|
|
|
53
|
-
var functionCall =
|
|
60
|
+
var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
|
|
54
61
|
return call$2.apply(call$2, arguments);
|
|
55
62
|
};
|
|
56
63
|
|
|
57
64
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
58
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
65
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
59
66
|
var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
|
|
60
67
|
|
|
61
68
|
// Nashorn ~ JDK8 bug
|
|
@@ -63,13 +70,13 @@ var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1:
|
|
|
63
70
|
|
|
64
71
|
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
65
72
|
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
66
|
-
var f$
|
|
73
|
+
var f$6 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
67
74
|
var descriptor = getOwnPropertyDescriptor$4(this, V);
|
|
68
75
|
return !!descriptor && descriptor.enumerable;
|
|
69
76
|
} : $propertyIsEnumerable;
|
|
70
77
|
|
|
71
78
|
var objectPropertyIsEnumerable = {
|
|
72
|
-
f: f$
|
|
79
|
+
f: f$6
|
|
73
80
|
};
|
|
74
81
|
|
|
75
82
|
var createPropertyDescriptor = function (bitmap, value) {
|
|
@@ -82,12 +89,12 @@ var createPropertyDescriptor = function (bitmap, value) {
|
|
|
82
89
|
};
|
|
83
90
|
|
|
84
91
|
var FunctionPrototype$3 = Function.prototype;
|
|
85
|
-
var bind$
|
|
92
|
+
var bind$3 = FunctionPrototype$3.bind;
|
|
86
93
|
var call$1 = FunctionPrototype$3.call;
|
|
87
|
-
var
|
|
94
|
+
var uncurryThis = functionBindNative && bind$3.bind(call$1, call$1);
|
|
88
95
|
|
|
89
|
-
var functionUncurryThis =
|
|
90
|
-
return fn &&
|
|
96
|
+
var functionUncurryThis = functionBindNative ? function (fn) {
|
|
97
|
+
return fn && uncurryThis(fn);
|
|
91
98
|
} : function (fn) {
|
|
92
99
|
return fn && function () {
|
|
93
100
|
return call$1.apply(fn, arguments);
|
|
@@ -95,10 +102,10 @@ var functionUncurryThis = bind$4 ? function (fn) {
|
|
|
95
102
|
};
|
|
96
103
|
|
|
97
104
|
var toString$2 = functionUncurryThis({}.toString);
|
|
98
|
-
var stringSlice$
|
|
105
|
+
var stringSlice$3 = functionUncurryThis(''.slice);
|
|
99
106
|
|
|
100
107
|
var classofRaw = function (it) {
|
|
101
|
-
return stringSlice$
|
|
108
|
+
return stringSlice$3(toString$2(it), 8, -1);
|
|
102
109
|
};
|
|
103
110
|
|
|
104
111
|
var Object$4 = global_1.Object;
|
|
@@ -113,12 +120,12 @@ var indexedObject = fails(function () {
|
|
|
113
120
|
return classofRaw(it) == 'String' ? split(it, '') : Object$4(it);
|
|
114
121
|
} : Object$4;
|
|
115
122
|
|
|
116
|
-
var TypeError$
|
|
123
|
+
var TypeError$h = global_1.TypeError;
|
|
117
124
|
|
|
118
125
|
// `RequireObjectCoercible` abstract operation
|
|
119
126
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
120
127
|
var requireObjectCoercible = function (it) {
|
|
121
|
-
if (it == undefined) throw TypeError$
|
|
128
|
+
if (it == undefined) throw TypeError$h("Can't call method on " + it);
|
|
122
129
|
return it;
|
|
123
130
|
};
|
|
124
131
|
|
|
@@ -153,35 +160,35 @@ var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
|
153
160
|
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
154
161
|
|
|
155
162
|
var process$4 = global_1.process;
|
|
156
|
-
var Deno = global_1.Deno;
|
|
157
|
-
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;
|
|
158
165
|
var v8 = versions && versions.v8;
|
|
159
|
-
var match, version;
|
|
166
|
+
var match, version$1;
|
|
160
167
|
|
|
161
168
|
if (v8) {
|
|
162
169
|
match = v8.split('.');
|
|
163
170
|
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
164
171
|
// but their correct versions are not interesting for us
|
|
165
|
-
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]);
|
|
166
173
|
}
|
|
167
174
|
|
|
168
175
|
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
169
176
|
// so check `userAgent` even if `.v8` exists, but 0
|
|
170
|
-
if (!version && engineUserAgent) {
|
|
177
|
+
if (!version$1 && engineUserAgent) {
|
|
171
178
|
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
172
179
|
if (!match || match[1] >= 74) {
|
|
173
180
|
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
174
|
-
if (match) version = +match[1];
|
|
181
|
+
if (match) version$1 = +match[1];
|
|
175
182
|
}
|
|
176
183
|
}
|
|
177
184
|
|
|
178
|
-
var engineV8Version = version;
|
|
185
|
+
var engineV8Version = version$1;
|
|
179
186
|
|
|
180
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
187
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
181
188
|
|
|
182
189
|
|
|
183
190
|
|
|
184
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
191
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
185
192
|
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
186
193
|
var symbol = Symbol();
|
|
187
194
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
@@ -191,7 +198,7 @@ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
|
191
198
|
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
192
199
|
});
|
|
193
200
|
|
|
194
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
201
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
195
202
|
|
|
196
203
|
|
|
197
204
|
var useSymbolAsUid = nativeSymbol
|
|
@@ -217,12 +224,12 @@ var tryToString = function (argument) {
|
|
|
217
224
|
}
|
|
218
225
|
};
|
|
219
226
|
|
|
220
|
-
var TypeError$
|
|
227
|
+
var TypeError$g = global_1.TypeError;
|
|
221
228
|
|
|
222
229
|
// `Assert: IsCallable(argument) is true`
|
|
223
230
|
var aCallable = function (argument) {
|
|
224
231
|
if (isCallable(argument)) return argument;
|
|
225
|
-
throw TypeError$
|
|
232
|
+
throw TypeError$g(tryToString(argument) + ' is not a function');
|
|
226
233
|
};
|
|
227
234
|
|
|
228
235
|
// `GetMethod` abstract operation
|
|
@@ -232,7 +239,7 @@ var getMethod = function (V, P) {
|
|
|
232
239
|
return func == null ? undefined : aCallable(func);
|
|
233
240
|
};
|
|
234
241
|
|
|
235
|
-
var TypeError$
|
|
242
|
+
var TypeError$f = global_1.TypeError;
|
|
236
243
|
|
|
237
244
|
// `OrdinaryToPrimitive` abstract operation
|
|
238
245
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
@@ -241,10 +248,10 @@ var ordinaryToPrimitive = function (input, pref) {
|
|
|
241
248
|
if (pref === 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
242
249
|
if (isCallable(fn = input.valueOf) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
243
250
|
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
244
|
-
throw TypeError$
|
|
251
|
+
throw TypeError$f("Can't convert object to primitive value");
|
|
245
252
|
};
|
|
246
253
|
|
|
247
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
254
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
248
255
|
var defineProperty$3 = Object.defineProperty;
|
|
249
256
|
|
|
250
257
|
var setGlobal = function (key, value) {
|
|
@@ -264,9 +271,11 @@ var shared = createCommonjsModule(function (module) {
|
|
|
264
271
|
(module.exports = function (key, value) {
|
|
265
272
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
266
273
|
})('versions', []).push({
|
|
267
|
-
version: '3.
|
|
274
|
+
version: '3.22.0',
|
|
268
275
|
mode: 'global',
|
|
269
|
-
copyright: '©
|
|
276
|
+
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
277
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.0/LICENSE',
|
|
278
|
+
source: 'https://github.com/zloirock/core-js'
|
|
270
279
|
});
|
|
271
280
|
});
|
|
272
281
|
|
|
@@ -282,6 +291,7 @@ var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
|
282
291
|
|
|
283
292
|
// `HasOwnProperty` abstract operation
|
|
284
293
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
294
|
+
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
285
295
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
286
296
|
return hasOwnProperty(toObject(it), key);
|
|
287
297
|
};
|
|
@@ -312,7 +322,7 @@ var wellKnownSymbol = function (name) {
|
|
|
312
322
|
} return WellKnownSymbolsStore[name];
|
|
313
323
|
};
|
|
314
324
|
|
|
315
|
-
var TypeError$
|
|
325
|
+
var TypeError$e = global_1.TypeError;
|
|
316
326
|
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
317
327
|
|
|
318
328
|
// `ToPrimitive` abstract operation
|
|
@@ -325,7 +335,7 @@ var toPrimitive = function (input, pref) {
|
|
|
325
335
|
if (pref === undefined) pref = 'default';
|
|
326
336
|
result = functionCall(exoticToPrim, input, pref);
|
|
327
337
|
if (!isObject$1(result) || isSymbol(result)) return result;
|
|
328
|
-
throw TypeError$
|
|
338
|
+
throw TypeError$e("Can't convert object to primitive value");
|
|
329
339
|
}
|
|
330
340
|
if (pref === undefined) pref = 'number';
|
|
331
341
|
return ordinaryToPrimitive(input, pref);
|
|
@@ -346,61 +356,91 @@ var documentCreateElement = function (it) {
|
|
|
346
356
|
return EXISTS$1 ? document$3.createElement(it) : {};
|
|
347
357
|
};
|
|
348
358
|
|
|
349
|
-
//
|
|
359
|
+
// Thanks to IE8 for its funny defineProperty
|
|
350
360
|
var ie8DomDefine = !descriptors && !fails(function () {
|
|
351
|
-
// eslint-disable-next-line es/no-object-defineproperty --
|
|
361
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
352
362
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
353
363
|
get: function () { return 7; }
|
|
354
364
|
}).a != 7;
|
|
355
365
|
});
|
|
356
366
|
|
|
357
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
358
|
-
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
367
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
368
|
+
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
359
369
|
|
|
360
370
|
// `Object.getOwnPropertyDescriptor` method
|
|
361
371
|
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
362
|
-
var f$
|
|
372
|
+
var f$5 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
363
373
|
O = toIndexedObject(O);
|
|
364
374
|
P = toPropertyKey(P);
|
|
365
375
|
if (ie8DomDefine) try {
|
|
366
|
-
return $getOwnPropertyDescriptor(O, P);
|
|
376
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
367
377
|
} catch (error) { /* empty */ }
|
|
368
378
|
if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
|
|
369
379
|
};
|
|
370
380
|
|
|
371
381
|
var objectGetOwnPropertyDescriptor = {
|
|
372
|
-
f: f$
|
|
382
|
+
f: f$5
|
|
373
383
|
};
|
|
374
384
|
|
|
385
|
+
// V8 ~ Chrome 36-
|
|
386
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
387
|
+
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
388
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
389
|
+
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
390
|
+
value: 42,
|
|
391
|
+
writable: false
|
|
392
|
+
}).prototype != 42;
|
|
393
|
+
});
|
|
394
|
+
|
|
375
395
|
var String$4 = global_1.String;
|
|
376
|
-
var TypeError$
|
|
396
|
+
var TypeError$d = global_1.TypeError;
|
|
377
397
|
|
|
378
398
|
// `Assert: Type(argument) is Object`
|
|
379
399
|
var anObject = function (argument) {
|
|
380
400
|
if (isObject$1(argument)) return argument;
|
|
381
|
-
throw TypeError$
|
|
401
|
+
throw TypeError$d(String$4(argument) + ' is not an object');
|
|
382
402
|
};
|
|
383
403
|
|
|
384
|
-
var TypeError$
|
|
385
|
-
// 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
|
|
386
406
|
var $defineProperty = Object.defineProperty;
|
|
407
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
408
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
409
|
+
var ENUMERABLE = 'enumerable';
|
|
410
|
+
var CONFIGURABLE$1 = 'configurable';
|
|
411
|
+
var WRITABLE = 'writable';
|
|
387
412
|
|
|
388
413
|
// `Object.defineProperty` method
|
|
389
414
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
390
|
-
var f$
|
|
415
|
+
var f$4 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
416
|
+
anObject(O);
|
|
417
|
+
P = toPropertyKey(P);
|
|
418
|
+
anObject(Attributes);
|
|
419
|
+
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
420
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
421
|
+
if (current && current[WRITABLE]) {
|
|
422
|
+
O[P] = Attributes.value;
|
|
423
|
+
Attributes = {
|
|
424
|
+
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
|
|
425
|
+
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
426
|
+
writable: false
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
} return $defineProperty(O, P, Attributes);
|
|
430
|
+
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
391
431
|
anObject(O);
|
|
392
432
|
P = toPropertyKey(P);
|
|
393
433
|
anObject(Attributes);
|
|
394
434
|
if (ie8DomDefine) try {
|
|
395
435
|
return $defineProperty(O, P, Attributes);
|
|
396
436
|
} catch (error) { /* empty */ }
|
|
397
|
-
if ('get' in Attributes || 'set' in Attributes) throw TypeError$
|
|
437
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError$c('Accessors not supported');
|
|
398
438
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
399
439
|
return O;
|
|
400
440
|
};
|
|
401
441
|
|
|
402
442
|
var objectDefineProperty = {
|
|
403
|
-
f: f$
|
|
443
|
+
f: f$4
|
|
404
444
|
};
|
|
405
445
|
|
|
406
446
|
var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
@@ -434,7 +474,7 @@ var sharedKey = function (key) {
|
|
|
434
474
|
var hiddenKeys$1 = {};
|
|
435
475
|
|
|
436
476
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
437
|
-
var TypeError$
|
|
477
|
+
var TypeError$b = global_1.TypeError;
|
|
438
478
|
var WeakMap = global_1.WeakMap;
|
|
439
479
|
var set$1, get, has;
|
|
440
480
|
|
|
@@ -446,7 +486,7 @@ var getterFor = function (TYPE) {
|
|
|
446
486
|
return function (it) {
|
|
447
487
|
var state;
|
|
448
488
|
if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
|
|
449
|
-
throw TypeError$
|
|
489
|
+
throw TypeError$b('Incompatible receiver, ' + TYPE + ' required');
|
|
450
490
|
} return state;
|
|
451
491
|
};
|
|
452
492
|
};
|
|
@@ -457,7 +497,7 @@ if (nativeWeakMap || sharedStore.state) {
|
|
|
457
497
|
var wmhas = functionUncurryThis(store.has);
|
|
458
498
|
var wmset = functionUncurryThis(store.set);
|
|
459
499
|
set$1 = function (it, metadata) {
|
|
460
|
-
if (wmhas(store, it)) throw new TypeError$
|
|
500
|
+
if (wmhas(store, it)) throw new TypeError$b(OBJECT_ALREADY_INITIALIZED);
|
|
461
501
|
metadata.facade = it;
|
|
462
502
|
wmset(store, it, metadata);
|
|
463
503
|
return metadata;
|
|
@@ -472,7 +512,7 @@ if (nativeWeakMap || sharedStore.state) {
|
|
|
472
512
|
var STATE = sharedKey('state');
|
|
473
513
|
hiddenKeys$1[STATE] = true;
|
|
474
514
|
set$1 = function (it, metadata) {
|
|
475
|
-
if (hasOwnProperty_1(it, STATE)) throw new TypeError$
|
|
515
|
+
if (hasOwnProperty_1(it, STATE)) throw new TypeError$b(OBJECT_ALREADY_INITIALIZED);
|
|
476
516
|
metadata.facade = it;
|
|
477
517
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
478
518
|
return metadata;
|
|
@@ -494,7 +534,7 @@ var internalState = {
|
|
|
494
534
|
};
|
|
495
535
|
|
|
496
536
|
var FunctionPrototype$2 = Function.prototype;
|
|
497
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
537
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
498
538
|
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
499
539
|
|
|
500
540
|
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
@@ -587,7 +627,7 @@ var lengthOfArrayLike = function (obj) {
|
|
|
587
627
|
};
|
|
588
628
|
|
|
589
629
|
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
590
|
-
var createMethod$
|
|
630
|
+
var createMethod$2 = function (IS_INCLUDES) {
|
|
591
631
|
return function ($this, el, fromIndex) {
|
|
592
632
|
var O = toIndexedObject($this);
|
|
593
633
|
var length = lengthOfArrayLike(O);
|
|
@@ -609,10 +649,10 @@ var createMethod$1 = function (IS_INCLUDES) {
|
|
|
609
649
|
var arrayIncludes = {
|
|
610
650
|
// `Array.prototype.includes` method
|
|
611
651
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
612
|
-
includes: createMethod$
|
|
652
|
+
includes: createMethod$2(true),
|
|
613
653
|
// `Array.prototype.indexOf` method
|
|
614
654
|
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
615
|
-
indexOf: createMethod$
|
|
655
|
+
indexOf: createMethod$2(false)
|
|
616
656
|
};
|
|
617
657
|
|
|
618
658
|
var indexOf$1 = arrayIncludes.indexOf;
|
|
@@ -648,20 +688,20 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
648
688
|
|
|
649
689
|
// `Object.getOwnPropertyNames` method
|
|
650
690
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
651
|
-
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
652
|
-
var f$
|
|
691
|
+
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
692
|
+
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
653
693
|
return objectKeysInternal(O, hiddenKeys);
|
|
654
694
|
};
|
|
655
695
|
|
|
656
696
|
var objectGetOwnPropertyNames = {
|
|
657
|
-
f: f$
|
|
697
|
+
f: f$3
|
|
658
698
|
};
|
|
659
699
|
|
|
660
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
661
|
-
var f$
|
|
700
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
|
|
701
|
+
var f$2 = Object.getOwnPropertySymbols;
|
|
662
702
|
|
|
663
703
|
var objectGetOwnPropertySymbols = {
|
|
664
|
-
f: f$
|
|
704
|
+
f: f$2
|
|
665
705
|
};
|
|
666
706
|
|
|
667
707
|
var concat$1 = functionUncurryThis([].concat);
|
|
@@ -673,13 +713,15 @@ var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
|
673
713
|
return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
|
|
674
714
|
};
|
|
675
715
|
|
|
676
|
-
var copyConstructorProperties = function (target, source) {
|
|
716
|
+
var copyConstructorProperties = function (target, source, exceptions) {
|
|
677
717
|
var keys = ownKeys(source);
|
|
678
718
|
var defineProperty = objectDefineProperty.f;
|
|
679
719
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
680
720
|
for (var i = 0; i < keys.length; i++) {
|
|
681
721
|
var key = keys[i];
|
|
682
|
-
if (!hasOwnProperty_1(target, key)
|
|
722
|
+
if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
|
|
723
|
+
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
724
|
+
}
|
|
683
725
|
}
|
|
684
726
|
};
|
|
685
727
|
|
|
@@ -758,27 +800,6 @@ var _export = function (options, source) {
|
|
|
758
800
|
}
|
|
759
801
|
};
|
|
760
802
|
|
|
761
|
-
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
762
|
-
var method = [][METHOD_NAME];
|
|
763
|
-
return !!method && fails(function () {
|
|
764
|
-
// eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
|
|
765
|
-
method.call(null, argument || function () { throw 1; }, 1);
|
|
766
|
-
});
|
|
767
|
-
};
|
|
768
|
-
|
|
769
|
-
var un$Join = functionUncurryThis([].join);
|
|
770
|
-
|
|
771
|
-
var ES3_STRINGS = indexedObject != Object;
|
|
772
|
-
var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
|
|
773
|
-
|
|
774
|
-
// `Array.prototype.join` method
|
|
775
|
-
// https://tc39.es/ecma262/#sec-array.prototype.join
|
|
776
|
-
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
|
|
777
|
-
join: function join(separator) {
|
|
778
|
-
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
|
|
782
803
|
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
783
804
|
var test = {};
|
|
784
805
|
|
|
@@ -811,179 +832,66 @@ var classof = toStringTagSupport ? classofRaw : function (it) {
|
|
|
811
832
|
: (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
812
833
|
};
|
|
813
834
|
|
|
814
|
-
|
|
815
|
-
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
816
|
-
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
817
|
-
return '[object ' + classof(this) + ']';
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
// `Object.prototype.toString` method
|
|
821
|
-
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
822
|
-
if (!toStringTagSupport) {
|
|
823
|
-
redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
// `Object.keys` method
|
|
827
|
-
// https://tc39.es/ecma262/#sec-object.keys
|
|
828
|
-
// eslint-disable-next-line es/no-object-keys -- safe
|
|
829
|
-
var objectKeys = Object.keys || function keys(O) {
|
|
830
|
-
return objectKeysInternal(O, enumBugKeys);
|
|
831
|
-
};
|
|
832
|
-
|
|
833
|
-
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
834
|
-
|
|
835
|
-
// `Object.keys` method
|
|
836
|
-
// https://tc39.es/ecma262/#sec-object.keys
|
|
837
|
-
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
838
|
-
keys: function keys(it) {
|
|
839
|
-
return objectKeys(toObject(it));
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
|
|
843
|
-
// `IsArray` abstract operation
|
|
844
|
-
// https://tc39.es/ecma262/#sec-isarray
|
|
845
|
-
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
846
|
-
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
847
|
-
return classofRaw(argument) == 'Array';
|
|
848
|
-
};
|
|
849
|
-
|
|
850
|
-
var createProperty = function (object, key, value) {
|
|
851
|
-
var propertyKey = toPropertyKey(key);
|
|
852
|
-
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
853
|
-
else object[propertyKey] = value;
|
|
854
|
-
};
|
|
855
|
-
|
|
856
|
-
var noop = function () { /* empty */ };
|
|
857
|
-
var empty = [];
|
|
858
|
-
var construct = getBuiltIn('Reflect', 'construct');
|
|
859
|
-
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
860
|
-
var exec = functionUncurryThis(constructorRegExp.exec);
|
|
861
|
-
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
862
|
-
|
|
863
|
-
var isConstructorModern = function (argument) {
|
|
864
|
-
if (!isCallable(argument)) return false;
|
|
865
|
-
try {
|
|
866
|
-
construct(noop, empty, argument);
|
|
867
|
-
return true;
|
|
868
|
-
} catch (error) {
|
|
869
|
-
return false;
|
|
870
|
-
}
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
var isConstructorLegacy = function (argument) {
|
|
874
|
-
if (!isCallable(argument)) return false;
|
|
875
|
-
switch (classof(argument)) {
|
|
876
|
-
case 'AsyncFunction':
|
|
877
|
-
case 'GeneratorFunction':
|
|
878
|
-
case 'AsyncGeneratorFunction': return false;
|
|
879
|
-
// we can't check .prototype since constructors produced by .bind haven't it
|
|
880
|
-
} return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
// `IsConstructor` abstract operation
|
|
884
|
-
// https://tc39.es/ecma262/#sec-isconstructor
|
|
885
|
-
var isConstructor = !construct || fails(function () {
|
|
886
|
-
var called;
|
|
887
|
-
return isConstructorModern(isConstructorModern.call)
|
|
888
|
-
|| !isConstructorModern(Object)
|
|
889
|
-
|| !isConstructorModern(function () { called = true; })
|
|
890
|
-
|| called;
|
|
891
|
-
}) ? isConstructorLegacy : isConstructorModern;
|
|
892
|
-
|
|
893
|
-
var SPECIES$4 = wellKnownSymbol('species');
|
|
894
|
-
var Array$1 = global_1.Array;
|
|
835
|
+
var String$3 = global_1.String;
|
|
895
836
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
var C;
|
|
900
|
-
if (isArray$1(originalArray)) {
|
|
901
|
-
C = originalArray.constructor;
|
|
902
|
-
// cross-realm fallback
|
|
903
|
-
if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
|
|
904
|
-
else if (isObject$1(C)) {
|
|
905
|
-
C = C[SPECIES$4];
|
|
906
|
-
if (C === null) C = undefined;
|
|
907
|
-
}
|
|
908
|
-
} return C === undefined ? Array$1 : C;
|
|
837
|
+
var toString_1 = function (argument) {
|
|
838
|
+
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
839
|
+
return String$3(argument);
|
|
909
840
|
};
|
|
910
841
|
|
|
911
|
-
// `
|
|
912
|
-
// https://tc39.es/ecma262/#sec-
|
|
913
|
-
var
|
|
914
|
-
|
|
842
|
+
// `RegExp.prototype.flags` getter implementation
|
|
843
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
844
|
+
var regexpFlags = function () {
|
|
845
|
+
var that = anObject(this);
|
|
846
|
+
var result = '';
|
|
847
|
+
if (that.global) result += 'g';
|
|
848
|
+
if (that.ignoreCase) result += 'i';
|
|
849
|
+
if (that.multiline) result += 'm';
|
|
850
|
+
if (that.dotAll) result += 's';
|
|
851
|
+
if (that.unicode) result += 'u';
|
|
852
|
+
if (that.sticky) result += 'y';
|
|
853
|
+
return result;
|
|
915
854
|
};
|
|
916
855
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
920
|
-
// We can't use this feature detection in V8 since it causes
|
|
921
|
-
// deoptimization and serious performance degradation
|
|
922
|
-
// https://github.com/zloirock/core-js/issues/677
|
|
923
|
-
return engineV8Version >= 51 || !fails(function () {
|
|
924
|
-
var array = [];
|
|
925
|
-
var constructor = array.constructor = {};
|
|
926
|
-
constructor[SPECIES$3] = function () {
|
|
927
|
-
return { foo: 1 };
|
|
928
|
-
};
|
|
929
|
-
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
930
|
-
});
|
|
931
|
-
};
|
|
856
|
+
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
857
|
+
var $RegExp$2 = global_1.RegExp;
|
|
932
858
|
|
|
933
|
-
var
|
|
934
|
-
var
|
|
935
|
-
|
|
936
|
-
|
|
859
|
+
var UNSUPPORTED_Y$1 = fails(function () {
|
|
860
|
+
var re = $RegExp$2('a', 'y');
|
|
861
|
+
re.lastIndex = 2;
|
|
862
|
+
return re.exec('abcd') != null;
|
|
863
|
+
});
|
|
937
864
|
|
|
938
|
-
//
|
|
939
|
-
//
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
var array = [];
|
|
943
|
-
array[IS_CONCAT_SPREADABLE] = false;
|
|
944
|
-
return array.concat()[0] !== array;
|
|
865
|
+
// UC Browser bug
|
|
866
|
+
// https://github.com/zloirock/core-js/issues/1008
|
|
867
|
+
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
|
|
868
|
+
return !$RegExp$2('a', 'y').sticky;
|
|
945
869
|
});
|
|
946
870
|
|
|
947
|
-
var
|
|
871
|
+
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
|
|
872
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
873
|
+
var re = $RegExp$2('^r', 'gy');
|
|
874
|
+
re.lastIndex = 2;
|
|
875
|
+
return re.exec('str') != null;
|
|
876
|
+
});
|
|
948
877
|
|
|
949
|
-
var
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
878
|
+
var regexpStickyHelpers = {
|
|
879
|
+
BROKEN_CARET: BROKEN_CARET,
|
|
880
|
+
MISSED_STICKY: MISSED_STICKY,
|
|
881
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
953
882
|
};
|
|
954
883
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
//
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
962
|
-
concat: function concat(arg) {
|
|
963
|
-
var O = toObject(this);
|
|
964
|
-
var A = arraySpeciesCreate(O, 0);
|
|
965
|
-
var n = 0;
|
|
966
|
-
var i, k, length, len, E;
|
|
967
|
-
for (i = -1, length = arguments.length; i < length; i++) {
|
|
968
|
-
E = i === -1 ? O : arguments[i];
|
|
969
|
-
if (isConcatSpreadable(E)) {
|
|
970
|
-
len = lengthOfArrayLike(E);
|
|
971
|
-
if (n + len > MAX_SAFE_INTEGER) throw TypeError$8(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
972
|
-
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
973
|
-
} else {
|
|
974
|
-
if (n >= MAX_SAFE_INTEGER) throw TypeError$8(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
975
|
-
createProperty(A, n++, E);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
A.length = n;
|
|
979
|
-
return A;
|
|
980
|
-
}
|
|
981
|
-
});
|
|
884
|
+
// `Object.keys` method
|
|
885
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
886
|
+
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
887
|
+
var objectKeys = Object.keys || function keys(O) {
|
|
888
|
+
return objectKeysInternal(O, enumBugKeys);
|
|
889
|
+
};
|
|
982
890
|
|
|
983
891
|
// `Object.defineProperties` method
|
|
984
892
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
985
|
-
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
986
|
-
var
|
|
893
|
+
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
894
|
+
var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
987
895
|
anObject(O);
|
|
988
896
|
var props = toIndexedObject(Properties);
|
|
989
897
|
var keys = objectKeys(Properties);
|
|
@@ -994,6 +902,10 @@ var objectDefineProperties = descriptors ? Object.defineProperties : function de
|
|
|
994
902
|
return O;
|
|
995
903
|
};
|
|
996
904
|
|
|
905
|
+
var objectDefineProperties = {
|
|
906
|
+
f: f$1
|
|
907
|
+
};
|
|
908
|
+
|
|
997
909
|
var html = getBuiltIn('document', 'documentElement');
|
|
998
910
|
|
|
999
911
|
/* global ActiveXObject -- old IE, WSH */
|
|
@@ -1067,6 +979,7 @@ hiddenKeys$1[IE_PROTO] = true;
|
|
|
1067
979
|
|
|
1068
980
|
// `Object.create` method
|
|
1069
981
|
// https://tc39.es/ecma262/#sec-object.create
|
|
982
|
+
// eslint-disable-next-line es-x/no-object-create -- safe
|
|
1070
983
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
1071
984
|
var result;
|
|
1072
985
|
if (O !== null) {
|
|
@@ -1076,89 +989,16 @@ var objectCreate = Object.create || function create(O, Properties) {
|
|
|
1076
989
|
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
1077
990
|
result[IE_PROTO] = O;
|
|
1078
991
|
} else result = NullProtoObject();
|
|
1079
|
-
return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
|
992
|
+
return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
|
|
1080
993
|
};
|
|
1081
994
|
|
|
1082
|
-
|
|
1083
|
-
var
|
|
995
|
+
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
996
|
+
var $RegExp$1 = global_1.RegExp;
|
|
1084
997
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
configurable: true,
|
|
1090
|
-
value: objectCreate(null)
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
// add a key to Array.prototype[@@unscopables]
|
|
1095
|
-
var addToUnscopables = function (key) {
|
|
1096
|
-
ArrayPrototype$1[UNSCOPABLES][key] = true;
|
|
1097
|
-
};
|
|
1098
|
-
|
|
1099
|
-
var $includes = arrayIncludes.includes;
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
// `Array.prototype.includes` method
|
|
1103
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1104
|
-
_export({ target: 'Array', proto: true }, {
|
|
1105
|
-
includes: function includes(el /* , fromIndex = 0 */) {
|
|
1106
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
1107
|
-
}
|
|
1108
|
-
});
|
|
1109
|
-
|
|
1110
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1111
|
-
addToUnscopables('includes');
|
|
1112
|
-
|
|
1113
|
-
var String$3 = global_1.String;
|
|
1114
|
-
|
|
1115
|
-
var toString_1 = function (argument) {
|
|
1116
|
-
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
1117
|
-
return String$3(argument);
|
|
1118
|
-
};
|
|
1119
|
-
|
|
1120
|
-
// `RegExp.prototype.flags` getter implementation
|
|
1121
|
-
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
1122
|
-
var regexpFlags = function () {
|
|
1123
|
-
var that = anObject(this);
|
|
1124
|
-
var result = '';
|
|
1125
|
-
if (that.global) result += 'g';
|
|
1126
|
-
if (that.ignoreCase) result += 'i';
|
|
1127
|
-
if (that.multiline) result += 'm';
|
|
1128
|
-
if (that.dotAll) result += 's';
|
|
1129
|
-
if (that.unicode) result += 'u';
|
|
1130
|
-
if (that.sticky) result += 'y';
|
|
1131
|
-
return result;
|
|
1132
|
-
};
|
|
1133
|
-
|
|
1134
|
-
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
1135
|
-
var $RegExp$2 = global_1.RegExp;
|
|
1136
|
-
|
|
1137
|
-
var UNSUPPORTED_Y$1 = fails(function () {
|
|
1138
|
-
var re = $RegExp$2('a', 'y');
|
|
1139
|
-
re.lastIndex = 2;
|
|
1140
|
-
return re.exec('abcd') != null;
|
|
1141
|
-
});
|
|
1142
|
-
|
|
1143
|
-
var BROKEN_CARET = fails(function () {
|
|
1144
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
1145
|
-
var re = $RegExp$2('^r', 'gy');
|
|
1146
|
-
re.lastIndex = 2;
|
|
1147
|
-
return re.exec('str') != null;
|
|
1148
|
-
});
|
|
1149
|
-
|
|
1150
|
-
var regexpStickyHelpers = {
|
|
1151
|
-
UNSUPPORTED_Y: UNSUPPORTED_Y$1,
|
|
1152
|
-
BROKEN_CARET: BROKEN_CARET
|
|
1153
|
-
};
|
|
1154
|
-
|
|
1155
|
-
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
1156
|
-
var $RegExp$1 = global_1.RegExp;
|
|
1157
|
-
|
|
1158
|
-
var regexpUnsupportedDotAll = fails(function () {
|
|
1159
|
-
var re = $RegExp$1('.', 's');
|
|
1160
|
-
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
1161
|
-
});
|
|
998
|
+
var regexpUnsupportedDotAll = fails(function () {
|
|
999
|
+
var re = $RegExp$1('.', 's');
|
|
1000
|
+
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
1001
|
+
});
|
|
1162
1002
|
|
|
1163
1003
|
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
1164
1004
|
var $RegExp = global_1.RegExp;
|
|
@@ -1178,17 +1018,17 @@ var regexpUnsupportedNcg = fails(function () {
|
|
|
1178
1018
|
|
|
1179
1019
|
|
|
1180
1020
|
|
|
1181
|
-
var getInternalState
|
|
1021
|
+
var getInternalState = internalState.get;
|
|
1182
1022
|
|
|
1183
1023
|
|
|
1184
1024
|
|
|
1185
1025
|
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
1186
1026
|
var nativeExec = RegExp.prototype.exec;
|
|
1187
1027
|
var patchedExec = nativeExec;
|
|
1188
|
-
var charAt = functionUncurryThis(''.charAt);
|
|
1028
|
+
var charAt$2 = functionUncurryThis(''.charAt);
|
|
1189
1029
|
var indexOf = functionUncurryThis(''.indexOf);
|
|
1190
1030
|
var replace = functionUncurryThis(''.replace);
|
|
1191
|
-
var stringSlice$
|
|
1031
|
+
var stringSlice$2 = functionUncurryThis(''.slice);
|
|
1192
1032
|
|
|
1193
1033
|
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
1194
1034
|
var re1 = /a/;
|
|
@@ -1198,7 +1038,7 @@ var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
|
1198
1038
|
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
1199
1039
|
})();
|
|
1200
1040
|
|
|
1201
|
-
var UNSUPPORTED_Y = regexpStickyHelpers.
|
|
1041
|
+
var UNSUPPORTED_Y = regexpStickyHelpers.BROKEN_CARET;
|
|
1202
1042
|
|
|
1203
1043
|
// nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
1204
1044
|
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
@@ -1206,10 +1046,9 @@ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
|
1206
1046
|
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || regexpUnsupportedDotAll || regexpUnsupportedNcg;
|
|
1207
1047
|
|
|
1208
1048
|
if (PATCH) {
|
|
1209
|
-
// eslint-disable-next-line max-statements -- TODO
|
|
1210
1049
|
patchedExec = function exec(string) {
|
|
1211
1050
|
var re = this;
|
|
1212
|
-
var state = getInternalState
|
|
1051
|
+
var state = getInternalState(re);
|
|
1213
1052
|
var str = toString_1(string);
|
|
1214
1053
|
var raw = state.raw;
|
|
1215
1054
|
var result, reCopy, lastIndex, match, i, object, group;
|
|
@@ -1234,9 +1073,9 @@ if (PATCH) {
|
|
|
1234
1073
|
flags += 'g';
|
|
1235
1074
|
}
|
|
1236
1075
|
|
|
1237
|
-
strCopy = stringSlice$
|
|
1076
|
+
strCopy = stringSlice$2(str, re.lastIndex);
|
|
1238
1077
|
// Support anchored sticky behavior.
|
|
1239
|
-
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) {
|
|
1078
|
+
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$2(str, re.lastIndex - 1) !== '\n')) {
|
|
1240
1079
|
source = '(?: ' + source + ')';
|
|
1241
1080
|
strCopy = ' ' + strCopy;
|
|
1242
1081
|
charsAdded++;
|
|
@@ -1255,8 +1094,8 @@ if (PATCH) {
|
|
|
1255
1094
|
|
|
1256
1095
|
if (sticky) {
|
|
1257
1096
|
if (match) {
|
|
1258
|
-
match.input = stringSlice$
|
|
1259
|
-
match[0] = stringSlice$
|
|
1097
|
+
match.input = stringSlice$2(match.input, charsAdded);
|
|
1098
|
+
match[0] = stringSlice$2(match[0], charsAdded);
|
|
1260
1099
|
match.index = re.lastIndex;
|
|
1261
1100
|
re.lastIndex += match[0].length;
|
|
1262
1101
|
} else re.lastIndex = 0;
|
|
@@ -1287,12 +1126,401 @@ if (PATCH) {
|
|
|
1287
1126
|
|
|
1288
1127
|
var regexpExec = patchedExec;
|
|
1289
1128
|
|
|
1290
|
-
// `RegExp.prototype.exec` method
|
|
1291
|
-
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
1292
|
-
_export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
|
|
1293
|
-
exec: regexpExec
|
|
1129
|
+
// `RegExp.prototype.exec` method
|
|
1130
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
1131
|
+
_export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
|
|
1132
|
+
exec: regexpExec
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
var SPECIES$5 = wellKnownSymbol('species');
|
|
1145
|
+
var RegExpPrototype = RegExp.prototype;
|
|
1146
|
+
|
|
1147
|
+
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
1148
|
+
var SYMBOL = wellKnownSymbol(KEY);
|
|
1149
|
+
|
|
1150
|
+
var DELEGATES_TO_SYMBOL = !fails(function () {
|
|
1151
|
+
// String methods call symbol-named RegEp methods
|
|
1152
|
+
var O = {};
|
|
1153
|
+
O[SYMBOL] = function () { return 7; };
|
|
1154
|
+
return ''[KEY](O) != 7;
|
|
1155
|
+
});
|
|
1156
|
+
|
|
1157
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
|
1158
|
+
// Symbol-named RegExp methods call .exec
|
|
1159
|
+
var execCalled = false;
|
|
1160
|
+
var re = /a/;
|
|
1161
|
+
|
|
1162
|
+
if (KEY === 'split') {
|
|
1163
|
+
// We can't use real regex here since it causes deoptimization
|
|
1164
|
+
// and serious performance degradation in V8
|
|
1165
|
+
// https://github.com/zloirock/core-js/issues/306
|
|
1166
|
+
re = {};
|
|
1167
|
+
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
1168
|
+
// a new one. We need to return the patched regex when creating the new one.
|
|
1169
|
+
re.constructor = {};
|
|
1170
|
+
re.constructor[SPECIES$5] = function () { return re; };
|
|
1171
|
+
re.flags = '';
|
|
1172
|
+
re[SYMBOL] = /./[SYMBOL];
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
re.exec = function () { execCalled = true; return null; };
|
|
1176
|
+
|
|
1177
|
+
re[SYMBOL]('');
|
|
1178
|
+
return !execCalled;
|
|
1179
|
+
});
|
|
1180
|
+
|
|
1181
|
+
if (
|
|
1182
|
+
!DELEGATES_TO_SYMBOL ||
|
|
1183
|
+
!DELEGATES_TO_EXEC ||
|
|
1184
|
+
FORCED
|
|
1185
|
+
) {
|
|
1186
|
+
var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
|
|
1187
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
1188
|
+
var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
|
|
1189
|
+
var $exec = regexp.exec;
|
|
1190
|
+
if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
|
|
1191
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
1192
|
+
// The native String method already delegates to @@method (this
|
|
1193
|
+
// polyfilled function), leasing to infinite recursion.
|
|
1194
|
+
// We avoid it by directly calling the native @@method method.
|
|
1195
|
+
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
1196
|
+
}
|
|
1197
|
+
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
1198
|
+
}
|
|
1199
|
+
return { done: false };
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
redefine(String.prototype, KEY, methods[0]);
|
|
1203
|
+
redefine(RegExpPrototype, SYMBOL, methods[1]);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
var charAt$1 = functionUncurryThis(''.charAt);
|
|
1210
|
+
var charCodeAt = functionUncurryThis(''.charCodeAt);
|
|
1211
|
+
var stringSlice$1 = functionUncurryThis(''.slice);
|
|
1212
|
+
|
|
1213
|
+
var createMethod$1 = function (CONVERT_TO_STRING) {
|
|
1214
|
+
return function ($this, pos) {
|
|
1215
|
+
var S = toString_1(requireObjectCoercible($this));
|
|
1216
|
+
var position = toIntegerOrInfinity(pos);
|
|
1217
|
+
var size = S.length;
|
|
1218
|
+
var first, second;
|
|
1219
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
1220
|
+
first = charCodeAt(S, position);
|
|
1221
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
1222
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
1223
|
+
? CONVERT_TO_STRING
|
|
1224
|
+
? charAt$1(S, position)
|
|
1225
|
+
: first
|
|
1226
|
+
: CONVERT_TO_STRING
|
|
1227
|
+
? stringSlice$1(S, position, position + 2)
|
|
1228
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
1229
|
+
};
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
var stringMultibyte = {
|
|
1233
|
+
// `String.prototype.codePointAt` method
|
|
1234
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
1235
|
+
codeAt: createMethod$1(false),
|
|
1236
|
+
// `String.prototype.at` method
|
|
1237
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
1238
|
+
charAt: createMethod$1(true)
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
var charAt = stringMultibyte.charAt;
|
|
1242
|
+
|
|
1243
|
+
// `AdvanceStringIndex` abstract operation
|
|
1244
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
1245
|
+
var advanceStringIndex = function (S, index, unicode) {
|
|
1246
|
+
return index + (unicode ? charAt(S, index).length : 1);
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
var TypeError$a = global_1.TypeError;
|
|
1250
|
+
|
|
1251
|
+
// `RegExpExec` abstract operation
|
|
1252
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
1253
|
+
var regexpExecAbstract = function (R, S) {
|
|
1254
|
+
var exec = R.exec;
|
|
1255
|
+
if (isCallable(exec)) {
|
|
1256
|
+
var result = functionCall(exec, R, S);
|
|
1257
|
+
if (result !== null) anObject(result);
|
|
1258
|
+
return result;
|
|
1259
|
+
}
|
|
1260
|
+
if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
|
|
1261
|
+
throw TypeError$a('RegExp#exec called on incompatible receiver');
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
// @@match logic
|
|
1265
|
+
fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
|
|
1266
|
+
return [
|
|
1267
|
+
// `String.prototype.match` method
|
|
1268
|
+
// https://tc39.es/ecma262/#sec-string.prototype.match
|
|
1269
|
+
function match(regexp) {
|
|
1270
|
+
var O = requireObjectCoercible(this);
|
|
1271
|
+
var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
|
|
1272
|
+
return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
|
|
1273
|
+
},
|
|
1274
|
+
// `RegExp.prototype[@@match]` method
|
|
1275
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
|
1276
|
+
function (string) {
|
|
1277
|
+
var rx = anObject(this);
|
|
1278
|
+
var S = toString_1(string);
|
|
1279
|
+
var res = maybeCallNative(nativeMatch, rx, S);
|
|
1280
|
+
|
|
1281
|
+
if (res.done) return res.value;
|
|
1282
|
+
|
|
1283
|
+
if (!rx.global) return regexpExecAbstract(rx, S);
|
|
1284
|
+
|
|
1285
|
+
var fullUnicode = rx.unicode;
|
|
1286
|
+
rx.lastIndex = 0;
|
|
1287
|
+
var A = [];
|
|
1288
|
+
var n = 0;
|
|
1289
|
+
var result;
|
|
1290
|
+
while ((result = regexpExecAbstract(rx, S)) !== null) {
|
|
1291
|
+
var matchStr = toString_1(result[0]);
|
|
1292
|
+
A[n] = matchStr;
|
|
1293
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
|
1294
|
+
n++;
|
|
1295
|
+
}
|
|
1296
|
+
return n === 0 ? null : A;
|
|
1297
|
+
}
|
|
1298
|
+
];
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1301
|
+
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
1302
|
+
var method = [][METHOD_NAME];
|
|
1303
|
+
return !!method && fails(function () {
|
|
1304
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
1305
|
+
method.call(null, argument || function () { return 1; }, 1);
|
|
1306
|
+
});
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
var un$Join = functionUncurryThis([].join);
|
|
1310
|
+
|
|
1311
|
+
var ES3_STRINGS = indexedObject != Object;
|
|
1312
|
+
var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
|
|
1313
|
+
|
|
1314
|
+
// `Array.prototype.join` method
|
|
1315
|
+
// https://tc39.es/ecma262/#sec-array.prototype.join
|
|
1316
|
+
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
|
|
1317
|
+
join: function join(separator) {
|
|
1318
|
+
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
|
|
1322
|
+
// `Object.prototype.toString` method implementation
|
|
1323
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1324
|
+
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
1325
|
+
return '[object ' + classof(this) + ']';
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
// `Object.prototype.toString` method
|
|
1329
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1330
|
+
if (!toStringTagSupport) {
|
|
1331
|
+
redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
1335
|
+
|
|
1336
|
+
// `Object.keys` method
|
|
1337
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
1338
|
+
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
1339
|
+
keys: function keys(it) {
|
|
1340
|
+
return objectKeys(toObject(it));
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
// `IsArray` abstract operation
|
|
1345
|
+
// https://tc39.es/ecma262/#sec-isarray
|
|
1346
|
+
// eslint-disable-next-line es-x/no-array-isarray -- safe
|
|
1347
|
+
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
1348
|
+
return classofRaw(argument) == 'Array';
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
var createProperty = function (object, key, value) {
|
|
1352
|
+
var propertyKey = toPropertyKey(key);
|
|
1353
|
+
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
1354
|
+
else object[propertyKey] = value;
|
|
1355
|
+
};
|
|
1356
|
+
|
|
1357
|
+
var noop = function () { /* empty */ };
|
|
1358
|
+
var empty = [];
|
|
1359
|
+
var construct = getBuiltIn('Reflect', 'construct');
|
|
1360
|
+
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1361
|
+
var exec = functionUncurryThis(constructorRegExp.exec);
|
|
1362
|
+
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
1363
|
+
|
|
1364
|
+
var isConstructorModern = function isConstructor(argument) {
|
|
1365
|
+
if (!isCallable(argument)) return false;
|
|
1366
|
+
try {
|
|
1367
|
+
construct(noop, empty, argument);
|
|
1368
|
+
return true;
|
|
1369
|
+
} catch (error) {
|
|
1370
|
+
return false;
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
var isConstructorLegacy = function isConstructor(argument) {
|
|
1375
|
+
if (!isCallable(argument)) return false;
|
|
1376
|
+
switch (classof(argument)) {
|
|
1377
|
+
case 'AsyncFunction':
|
|
1378
|
+
case 'GeneratorFunction':
|
|
1379
|
+
case 'AsyncGeneratorFunction': return false;
|
|
1380
|
+
}
|
|
1381
|
+
try {
|
|
1382
|
+
// we can't check .prototype since constructors produced by .bind haven't it
|
|
1383
|
+
// `Function#toString` throws on some built-it function in some legacy engines
|
|
1384
|
+
// (for example, `DOMQuad` and similar in FF41-)
|
|
1385
|
+
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
1386
|
+
} catch (error) {
|
|
1387
|
+
return true;
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
|
|
1391
|
+
isConstructorLegacy.sham = true;
|
|
1392
|
+
|
|
1393
|
+
// `IsConstructor` abstract operation
|
|
1394
|
+
// https://tc39.es/ecma262/#sec-isconstructor
|
|
1395
|
+
var isConstructor = !construct || fails(function () {
|
|
1396
|
+
var called;
|
|
1397
|
+
return isConstructorModern(isConstructorModern.call)
|
|
1398
|
+
|| !isConstructorModern(Object)
|
|
1399
|
+
|| !isConstructorModern(function () { called = true; })
|
|
1400
|
+
|| called;
|
|
1401
|
+
}) ? isConstructorLegacy : isConstructorModern;
|
|
1402
|
+
|
|
1403
|
+
var SPECIES$4 = wellKnownSymbol('species');
|
|
1404
|
+
var Array$1 = global_1.Array;
|
|
1405
|
+
|
|
1406
|
+
// a part of `ArraySpeciesCreate` abstract operation
|
|
1407
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1408
|
+
var arraySpeciesConstructor = function (originalArray) {
|
|
1409
|
+
var C;
|
|
1410
|
+
if (isArray$1(originalArray)) {
|
|
1411
|
+
C = originalArray.constructor;
|
|
1412
|
+
// cross-realm fallback
|
|
1413
|
+
if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
|
|
1414
|
+
else if (isObject$1(C)) {
|
|
1415
|
+
C = C[SPECIES$4];
|
|
1416
|
+
if (C === null) C = undefined;
|
|
1417
|
+
}
|
|
1418
|
+
} return C === undefined ? Array$1 : C;
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
// `ArraySpeciesCreate` abstract operation
|
|
1422
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1423
|
+
var arraySpeciesCreate = function (originalArray, length) {
|
|
1424
|
+
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
var SPECIES$3 = wellKnownSymbol('species');
|
|
1428
|
+
|
|
1429
|
+
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
1430
|
+
// We can't use this feature detection in V8 since it causes
|
|
1431
|
+
// deoptimization and serious performance degradation
|
|
1432
|
+
// https://github.com/zloirock/core-js/issues/677
|
|
1433
|
+
return engineV8Version >= 51 || !fails(function () {
|
|
1434
|
+
var array = [];
|
|
1435
|
+
var constructor = array.constructor = {};
|
|
1436
|
+
constructor[SPECIES$3] = function () {
|
|
1437
|
+
return { foo: 1 };
|
|
1438
|
+
};
|
|
1439
|
+
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
1440
|
+
});
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
1444
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
1445
|
+
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
1446
|
+
var TypeError$9 = global_1.TypeError;
|
|
1447
|
+
|
|
1448
|
+
// We can't use this feature detection in V8 since it causes
|
|
1449
|
+
// deoptimization and serious performance degradation
|
|
1450
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
1451
|
+
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
1452
|
+
var array = [];
|
|
1453
|
+
array[IS_CONCAT_SPREADABLE] = false;
|
|
1454
|
+
return array.concat()[0] !== array;
|
|
1455
|
+
});
|
|
1456
|
+
|
|
1457
|
+
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
1458
|
+
|
|
1459
|
+
var isConcatSpreadable = function (O) {
|
|
1460
|
+
if (!isObject$1(O)) return false;
|
|
1461
|
+
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
1462
|
+
return spreadable !== undefined ? !!spreadable : isArray$1(O);
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
1466
|
+
|
|
1467
|
+
// `Array.prototype.concat` method
|
|
1468
|
+
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
1469
|
+
// with adding support of @@isConcatSpreadable and @@species
|
|
1470
|
+
_export({ target: 'Array', proto: true, forced: FORCED }, {
|
|
1471
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
1472
|
+
concat: function concat(arg) {
|
|
1473
|
+
var O = toObject(this);
|
|
1474
|
+
var A = arraySpeciesCreate(O, 0);
|
|
1475
|
+
var n = 0;
|
|
1476
|
+
var i, k, length, len, E;
|
|
1477
|
+
for (i = -1, length = arguments.length; i < length; i++) {
|
|
1478
|
+
E = i === -1 ? O : arguments[i];
|
|
1479
|
+
if (isConcatSpreadable(E)) {
|
|
1480
|
+
len = lengthOfArrayLike(E);
|
|
1481
|
+
if (n + len > MAX_SAFE_INTEGER) throw TypeError$9(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1482
|
+
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
1483
|
+
} else {
|
|
1484
|
+
if (n >= MAX_SAFE_INTEGER) throw TypeError$9(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1485
|
+
createProperty(A, n++, E);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
A.length = n;
|
|
1489
|
+
return A;
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
|
|
1493
|
+
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
1494
|
+
var ArrayPrototype$1 = Array.prototype;
|
|
1495
|
+
|
|
1496
|
+
// Array.prototype[@@unscopables]
|
|
1497
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1498
|
+
if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
|
|
1499
|
+
objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, {
|
|
1500
|
+
configurable: true,
|
|
1501
|
+
value: objectCreate(null)
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
// add a key to Array.prototype[@@unscopables]
|
|
1506
|
+
var addToUnscopables = function (key) {
|
|
1507
|
+
ArrayPrototype$1[UNSCOPABLES][key] = true;
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
var $includes = arrayIncludes.includes;
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
// `Array.prototype.includes` method
|
|
1514
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1515
|
+
_export({ target: 'Array', proto: true }, {
|
|
1516
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
1517
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
1518
|
+
}
|
|
1294
1519
|
});
|
|
1295
1520
|
|
|
1521
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1522
|
+
addToUnscopables('includes');
|
|
1523
|
+
|
|
1296
1524
|
var MATCH$1 = wellKnownSymbol('match');
|
|
1297
1525
|
|
|
1298
1526
|
// `IsRegExp` abstract operation
|
|
@@ -1302,11 +1530,11 @@ var isRegexp = function (it) {
|
|
|
1302
1530
|
return isObject$1(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
1303
1531
|
};
|
|
1304
1532
|
|
|
1305
|
-
var TypeError$
|
|
1533
|
+
var TypeError$8 = global_1.TypeError;
|
|
1306
1534
|
|
|
1307
1535
|
var notARegexp = function (it) {
|
|
1308
1536
|
if (isRegexp(it)) {
|
|
1309
|
-
throw TypeError$
|
|
1537
|
+
throw TypeError$8("The method doesn't accept regular expressions");
|
|
1310
1538
|
} return it;
|
|
1311
1539
|
};
|
|
1312
1540
|
|
|
@@ -1332,7 +1560,7 @@ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
|
|
|
1332
1560
|
|
|
1333
1561
|
|
|
1334
1562
|
|
|
1335
|
-
// eslint-disable-next-line es/no-string-prototype-endswith -- safe
|
|
1563
|
+
// eslint-disable-next-line es-x/no-string-prototype-endswith -- safe
|
|
1336
1564
|
var un$EndsWith = functionUncurryThis(''.endsWith);
|
|
1337
1565
|
var slice = functionUncurryThis(''.slice);
|
|
1338
1566
|
var min$1 = Math.min;
|
|
@@ -1368,7 +1596,7 @@ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
|
1368
1596
|
|
|
1369
1597
|
|
|
1370
1598
|
|
|
1371
|
-
// eslint-disable-next-line es/no-string-prototype-startswith -- safe
|
|
1599
|
+
// eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
|
|
1372
1600
|
var un$StartsWith = functionUncurryThis(''.startsWith);
|
|
1373
1601
|
var stringSlice = functionUncurryThis(''.slice);
|
|
1374
1602
|
var min = Math.min;
|
|
@@ -1394,7 +1622,7 @@ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_I
|
|
|
1394
1622
|
}
|
|
1395
1623
|
});
|
|
1396
1624
|
|
|
1397
|
-
var
|
|
1625
|
+
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
1398
1626
|
|
|
1399
1627
|
var redefineAll = function (target, src, options) {
|
|
1400
1628
|
for (var key in src) redefine(target, key, src[key], options);
|
|
@@ -1402,11 +1630,11 @@ var redefineAll = function (target, src, options) {
|
|
|
1402
1630
|
};
|
|
1403
1631
|
|
|
1404
1632
|
var String$2 = global_1.String;
|
|
1405
|
-
var TypeError$
|
|
1633
|
+
var TypeError$7 = global_1.TypeError;
|
|
1406
1634
|
|
|
1407
1635
|
var aPossiblePrototype = function (argument) {
|
|
1408
1636
|
if (typeof argument == 'object' || isCallable(argument)) return argument;
|
|
1409
|
-
throw TypeError$
|
|
1637
|
+
throw TypeError$7("Can't set " + String$2(argument) + ' as a prototype');
|
|
1410
1638
|
};
|
|
1411
1639
|
|
|
1412
1640
|
/* eslint-disable no-proto -- safe */
|
|
@@ -1417,13 +1645,13 @@ var aPossiblePrototype = function (argument) {
|
|
|
1417
1645
|
// `Object.setPrototypeOf` method
|
|
1418
1646
|
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1419
1647
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1420
|
-
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
1648
|
+
// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
|
|
1421
1649
|
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1422
1650
|
var CORRECT_SETTER = false;
|
|
1423
1651
|
var test = {};
|
|
1424
1652
|
var setter;
|
|
1425
1653
|
try {
|
|
1426
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1654
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
1427
1655
|
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1428
1656
|
setter(test, []);
|
|
1429
1657
|
CORRECT_SETTER = test instanceof Array;
|
|
@@ -1443,9 +1671,10 @@ var defineProperty$2 = objectDefineProperty.f;
|
|
|
1443
1671
|
|
|
1444
1672
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1445
1673
|
|
|
1446
|
-
var setToStringTag = function (
|
|
1447
|
-
if (
|
|
1448
|
-
|
|
1674
|
+
var setToStringTag = function (target, TAG, STATIC) {
|
|
1675
|
+
if (target && !STATIC) target = target.prototype;
|
|
1676
|
+
if (target && !hasOwnProperty_1(target, TO_STRING_TAG)) {
|
|
1677
|
+
defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
|
|
1449
1678
|
}
|
|
1450
1679
|
};
|
|
1451
1680
|
|
|
@@ -1463,167 +1692,19 @@ var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
|
1463
1692
|
}
|
|
1464
1693
|
};
|
|
1465
1694
|
|
|
1466
|
-
var TypeError$
|
|
1695
|
+
var TypeError$6 = global_1.TypeError;
|
|
1467
1696
|
|
|
1468
1697
|
var anInstance = function (it, Prototype) {
|
|
1469
1698
|
if (objectIsPrototypeOf(Prototype, it)) return it;
|
|
1470
|
-
throw TypeError$
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
var bind$3 = functionUncurryThis(functionUncurryThis.bind);
|
|
1474
|
-
|
|
1475
|
-
// optional / simple context binding
|
|
1476
|
-
var functionBindContext = function (fn, that) {
|
|
1477
|
-
aCallable(fn);
|
|
1478
|
-
return that === undefined ? fn : bind$3 ? bind$3(fn, that) : function (/* ...args */) {
|
|
1479
|
-
return fn.apply(that, arguments);
|
|
1480
|
-
};
|
|
1481
|
-
};
|
|
1482
|
-
|
|
1483
|
-
var iterators = {};
|
|
1484
|
-
|
|
1485
|
-
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
1486
|
-
var ArrayPrototype = Array.prototype;
|
|
1487
|
-
|
|
1488
|
-
// check on default Array iterator
|
|
1489
|
-
var isArrayIteratorMethod = function (it) {
|
|
1490
|
-
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
1491
|
-
};
|
|
1492
|
-
|
|
1493
|
-
var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
1494
|
-
|
|
1495
|
-
var getIteratorMethod = function (it) {
|
|
1496
|
-
if (it != undefined) return getMethod(it, ITERATOR$1)
|
|
1497
|
-
|| getMethod(it, '@@iterator')
|
|
1498
|
-
|| iterators[classof(it)];
|
|
1499
|
-
};
|
|
1500
|
-
|
|
1501
|
-
var TypeError$4 = global_1.TypeError;
|
|
1502
|
-
|
|
1503
|
-
var getIterator = function (argument, usingIterator) {
|
|
1504
|
-
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
1505
|
-
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
1506
|
-
throw TypeError$4(tryToString(argument) + ' is not iterable');
|
|
1507
|
-
};
|
|
1508
|
-
|
|
1509
|
-
var iteratorClose = function (iterator, kind, value) {
|
|
1510
|
-
var innerResult, innerError;
|
|
1511
|
-
anObject(iterator);
|
|
1512
|
-
try {
|
|
1513
|
-
innerResult = getMethod(iterator, 'return');
|
|
1514
|
-
if (!innerResult) {
|
|
1515
|
-
if (kind === 'throw') throw value;
|
|
1516
|
-
return value;
|
|
1517
|
-
}
|
|
1518
|
-
innerResult = functionCall(innerResult, iterator);
|
|
1519
|
-
} catch (error) {
|
|
1520
|
-
innerError = true;
|
|
1521
|
-
innerResult = error;
|
|
1522
|
-
}
|
|
1523
|
-
if (kind === 'throw') throw value;
|
|
1524
|
-
if (innerError) throw innerResult;
|
|
1525
|
-
anObject(innerResult);
|
|
1526
|
-
return value;
|
|
1527
|
-
};
|
|
1528
|
-
|
|
1529
|
-
var TypeError$3 = global_1.TypeError;
|
|
1530
|
-
|
|
1531
|
-
var Result = function (stopped, result) {
|
|
1532
|
-
this.stopped = stopped;
|
|
1533
|
-
this.result = result;
|
|
1534
|
-
};
|
|
1535
|
-
|
|
1536
|
-
var ResultPrototype = Result.prototype;
|
|
1537
|
-
|
|
1538
|
-
var iterate = function (iterable, unboundFunction, options) {
|
|
1539
|
-
var that = options && options.that;
|
|
1540
|
-
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
1541
|
-
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
1542
|
-
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
1543
|
-
var fn = functionBindContext(unboundFunction, that);
|
|
1544
|
-
var iterator, iterFn, index, length, result, next, step;
|
|
1545
|
-
|
|
1546
|
-
var stop = function (condition) {
|
|
1547
|
-
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
1548
|
-
return new Result(true, condition);
|
|
1549
|
-
};
|
|
1550
|
-
|
|
1551
|
-
var callFn = function (value) {
|
|
1552
|
-
if (AS_ENTRIES) {
|
|
1553
|
-
anObject(value);
|
|
1554
|
-
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
1555
|
-
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
1556
|
-
};
|
|
1557
|
-
|
|
1558
|
-
if (IS_ITERATOR) {
|
|
1559
|
-
iterator = iterable;
|
|
1560
|
-
} else {
|
|
1561
|
-
iterFn = getIteratorMethod(iterable);
|
|
1562
|
-
if (!iterFn) throw TypeError$3(tryToString(iterable) + ' is not iterable');
|
|
1563
|
-
// optimisation for array iterators
|
|
1564
|
-
if (isArrayIteratorMethod(iterFn)) {
|
|
1565
|
-
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
1566
|
-
result = callFn(iterable[index]);
|
|
1567
|
-
if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
1568
|
-
} return new Result(false);
|
|
1569
|
-
}
|
|
1570
|
-
iterator = getIterator(iterable, iterFn);
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
next = iterator.next;
|
|
1574
|
-
while (!(step = functionCall(next, iterator)).done) {
|
|
1575
|
-
try {
|
|
1576
|
-
result = callFn(step.value);
|
|
1577
|
-
} catch (error) {
|
|
1578
|
-
iteratorClose(iterator, 'throw', error);
|
|
1579
|
-
}
|
|
1580
|
-
if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
1581
|
-
} return new Result(false);
|
|
1582
|
-
};
|
|
1583
|
-
|
|
1584
|
-
var ITERATOR = wellKnownSymbol('iterator');
|
|
1585
|
-
var SAFE_CLOSING = false;
|
|
1586
|
-
|
|
1587
|
-
try {
|
|
1588
|
-
var called = 0;
|
|
1589
|
-
var iteratorWithReturn = {
|
|
1590
|
-
next: function () {
|
|
1591
|
-
return { done: !!called++ };
|
|
1592
|
-
},
|
|
1593
|
-
'return': function () {
|
|
1594
|
-
SAFE_CLOSING = true;
|
|
1595
|
-
}
|
|
1596
|
-
};
|
|
1597
|
-
iteratorWithReturn[ITERATOR] = function () {
|
|
1598
|
-
return this;
|
|
1599
|
-
};
|
|
1600
|
-
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
1601
|
-
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
1602
|
-
} catch (error) { /* empty */ }
|
|
1603
|
-
|
|
1604
|
-
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
1605
|
-
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
1606
|
-
var ITERATION_SUPPORT = false;
|
|
1607
|
-
try {
|
|
1608
|
-
var object = {};
|
|
1609
|
-
object[ITERATOR] = function () {
|
|
1610
|
-
return {
|
|
1611
|
-
next: function () {
|
|
1612
|
-
return { done: ITERATION_SUPPORT = true };
|
|
1613
|
-
}
|
|
1614
|
-
};
|
|
1615
|
-
};
|
|
1616
|
-
exec(object);
|
|
1617
|
-
} catch (error) { /* empty */ }
|
|
1618
|
-
return ITERATION_SUPPORT;
|
|
1699
|
+
throw TypeError$6('Incorrect invocation');
|
|
1619
1700
|
};
|
|
1620
1701
|
|
|
1621
|
-
var TypeError$
|
|
1702
|
+
var TypeError$5 = global_1.TypeError;
|
|
1622
1703
|
|
|
1623
1704
|
// `Assert: IsConstructor(argument) is true`
|
|
1624
1705
|
var aConstructor = function (argument) {
|
|
1625
1706
|
if (isConstructor(argument)) return argument;
|
|
1626
|
-
throw TypeError$
|
|
1707
|
+
throw TypeError$5(tryToString(argument) + ' is not a constructor');
|
|
1627
1708
|
};
|
|
1628
1709
|
|
|
1629
1710
|
var SPECIES$1 = wellKnownSymbol('species');
|
|
@@ -1638,19 +1719,33 @@ var speciesConstructor = function (O, defaultConstructor) {
|
|
|
1638
1719
|
|
|
1639
1720
|
var FunctionPrototype$1 = Function.prototype;
|
|
1640
1721
|
var apply = FunctionPrototype$1.apply;
|
|
1641
|
-
var bind$2 = FunctionPrototype$1.bind;
|
|
1642
1722
|
var call = FunctionPrototype$1.call;
|
|
1643
1723
|
|
|
1644
|
-
// eslint-disable-next-line es/no-reflect -- safe
|
|
1645
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (
|
|
1724
|
+
// eslint-disable-next-line es-x/no-reflect -- safe
|
|
1725
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
|
|
1646
1726
|
return call.apply(apply, arguments);
|
|
1647
1727
|
});
|
|
1648
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
|
+
|
|
1649
1739
|
var arraySlice = functionUncurryThis([].slice);
|
|
1650
1740
|
|
|
1651
|
-
var
|
|
1741
|
+
var TypeError$4 = global_1.TypeError;
|
|
1652
1742
|
|
|
1653
|
-
var
|
|
1743
|
+
var validateArgumentsLength = function (passed, required) {
|
|
1744
|
+
if (passed < required) throw TypeError$4('Not enough arguments');
|
|
1745
|
+
return passed;
|
|
1746
|
+
};
|
|
1747
|
+
|
|
1748
|
+
var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
|
|
1654
1749
|
|
|
1655
1750
|
var set = global_1.setImmediate;
|
|
1656
1751
|
var clear = global_1.clearImmediate;
|
|
@@ -1660,7 +1755,7 @@ var Function$1 = global_1.Function;
|
|
|
1660
1755
|
var MessageChannel = global_1.MessageChannel;
|
|
1661
1756
|
var String$1 = global_1.String;
|
|
1662
1757
|
var counter = 0;
|
|
1663
|
-
var queue = {};
|
|
1758
|
+
var queue$1 = {};
|
|
1664
1759
|
var ONREADYSTATECHANGE = 'onreadystatechange';
|
|
1665
1760
|
var location, defer, channel, port;
|
|
1666
1761
|
|
|
@@ -1670,9 +1765,9 @@ try {
|
|
|
1670
1765
|
} catch (error) { /* empty */ }
|
|
1671
1766
|
|
|
1672
1767
|
var run = function (id) {
|
|
1673
|
-
if (hasOwnProperty_1(queue, id)) {
|
|
1674
|
-
var fn = queue[id];
|
|
1675
|
-
delete queue[id];
|
|
1768
|
+
if (hasOwnProperty_1(queue$1, id)) {
|
|
1769
|
+
var fn = queue$1[id];
|
|
1770
|
+
delete queue$1[id];
|
|
1676
1771
|
fn();
|
|
1677
1772
|
}
|
|
1678
1773
|
};
|
|
@@ -1694,16 +1789,18 @@ var post = function (id) {
|
|
|
1694
1789
|
|
|
1695
1790
|
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
1696
1791
|
if (!set || !clear) {
|
|
1697
|
-
set = function setImmediate(
|
|
1792
|
+
set = function setImmediate(handler) {
|
|
1793
|
+
validateArgumentsLength(arguments.length, 1);
|
|
1794
|
+
var fn = isCallable(handler) ? handler : Function$1(handler);
|
|
1698
1795
|
var args = arraySlice(arguments, 1);
|
|
1699
|
-
queue[++counter] = function () {
|
|
1700
|
-
functionApply(
|
|
1796
|
+
queue$1[++counter] = function () {
|
|
1797
|
+
functionApply(fn, undefined, args);
|
|
1701
1798
|
};
|
|
1702
1799
|
defer(counter);
|
|
1703
1800
|
return counter;
|
|
1704
1801
|
};
|
|
1705
1802
|
clear = function clearImmediate(id) {
|
|
1706
|
-
delete queue[id];
|
|
1803
|
+
delete queue$1[id];
|
|
1707
1804
|
};
|
|
1708
1805
|
// Node.js 0.8-
|
|
1709
1806
|
if (engineIsNode) {
|
|
@@ -1821,7 +1918,7 @@ if (!queueMicrotask) {
|
|
|
1821
1918
|
// for other environments - macrotask based on:
|
|
1822
1919
|
// - setImmediate
|
|
1823
1920
|
// - MessageChannel
|
|
1824
|
-
// - window.
|
|
1921
|
+
// - window.postMessage
|
|
1825
1922
|
// - onreadystatechange
|
|
1826
1923
|
// - setTimeout
|
|
1827
1924
|
} else {
|
|
@@ -1842,6 +1939,84 @@ var microtask = queueMicrotask || function (fn) {
|
|
|
1842
1939
|
} last = task;
|
|
1843
1940
|
};
|
|
1844
1941
|
|
|
1942
|
+
var hostReportErrors = function (a, b) {
|
|
1943
|
+
var console = global_1.console;
|
|
1944
|
+
if (console && console.error) {
|
|
1945
|
+
arguments.length == 1 ? console.error(a) : console.error(a, b);
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
|
|
1949
|
+
var perform = function (exec) {
|
|
1950
|
+
try {
|
|
1951
|
+
return { error: false, value: exec() };
|
|
1952
|
+
} catch (error) {
|
|
1953
|
+
return { error: true, value: error };
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
|
|
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
|
+
|
|
1845
2020
|
var PromiseCapability = function (C) {
|
|
1846
2021
|
var resolve, reject;
|
|
1847
2022
|
this.promise = new C(function ($$resolve, $$reject) {
|
|
@@ -1859,35 +2034,9 @@ var f = function (C) {
|
|
|
1859
2034
|
return new PromiseCapability(C);
|
|
1860
2035
|
};
|
|
1861
2036
|
|
|
1862
|
-
var newPromiseCapability$1 = {
|
|
1863
|
-
f: f
|
|
1864
|
-
};
|
|
1865
|
-
|
|
1866
|
-
var promiseResolve = function (C, x) {
|
|
1867
|
-
anObject(C);
|
|
1868
|
-
if (isObject$1(x) && x.constructor === C) return x;
|
|
1869
|
-
var promiseCapability = newPromiseCapability$1.f(C);
|
|
1870
|
-
var resolve = promiseCapability.resolve;
|
|
1871
|
-
resolve(x);
|
|
1872
|
-
return promiseCapability.promise;
|
|
1873
|
-
};
|
|
1874
|
-
|
|
1875
|
-
var hostReportErrors = function (a, b) {
|
|
1876
|
-
var console = global_1.console;
|
|
1877
|
-
if (console && console.error) {
|
|
1878
|
-
arguments.length == 1 ? console.error(a) : console.error(a, b);
|
|
1879
|
-
}
|
|
1880
|
-
};
|
|
1881
|
-
|
|
1882
|
-
var perform = function (exec) {
|
|
1883
|
-
try {
|
|
1884
|
-
return { error: false, value: exec() };
|
|
1885
|
-
} catch (error) {
|
|
1886
|
-
return { error: true, value: error };
|
|
1887
|
-
}
|
|
1888
|
-
};
|
|
1889
|
-
|
|
1890
|
-
var engineIsBrowser = typeof window == 'object';
|
|
2037
|
+
var newPromiseCapability$1 = {
|
|
2038
|
+
f: f
|
|
2039
|
+
};
|
|
1891
2040
|
|
|
1892
2041
|
var task = task$1.set;
|
|
1893
2042
|
|
|
@@ -1899,26 +2048,22 @@ var task = task$1.set;
|
|
|
1899
2048
|
|
|
1900
2049
|
|
|
1901
2050
|
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
var SPECIES = wellKnownSymbol('species');
|
|
1906
2051
|
var PROMISE = 'Promise';
|
|
1907
|
-
|
|
1908
|
-
var
|
|
1909
|
-
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;
|
|
1910
2055
|
var getInternalPromiseState = internalState.getterFor(PROMISE);
|
|
1911
|
-
var
|
|
1912
|
-
var
|
|
1913
|
-
var
|
|
1914
|
-
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;
|
|
1915
2061
|
var document$1 = global_1.document;
|
|
1916
2062
|
var process$1 = global_1.process;
|
|
1917
2063
|
var newPromiseCapability = newPromiseCapability$1.f;
|
|
1918
2064
|
var newGenericPromiseCapability = newPromiseCapability;
|
|
1919
2065
|
|
|
1920
2066
|
var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent);
|
|
1921
|
-
var NATIVE_REJECTION_EVENT = isCallable(global_1.PromiseRejectionEvent);
|
|
1922
2067
|
var UNHANDLED_REJECTION = 'unhandledrejection';
|
|
1923
2068
|
var REJECTION_HANDLED = 'rejectionhandled';
|
|
1924
2069
|
var PENDING = 0;
|
|
@@ -1926,87 +2071,59 @@ var FULFILLED = 1;
|
|
|
1926
2071
|
var REJECTED = 2;
|
|
1927
2072
|
var HANDLED = 1;
|
|
1928
2073
|
var UNHANDLED = 2;
|
|
1929
|
-
var SUBCLASSING = false;
|
|
1930
2074
|
|
|
1931
2075
|
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
1932
2076
|
|
|
1933
|
-
var FORCED = isForced_1(PROMISE, function () {
|
|
1934
|
-
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
|
|
1935
|
-
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
|
|
1936
|
-
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
1937
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
1938
|
-
// We can't detect it synchronously, so just check versions
|
|
1939
|
-
if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
|
|
1940
|
-
// We can't use @@species feature detection in V8 since it causes
|
|
1941
|
-
// deoptimization and performance degradation
|
|
1942
|
-
// https://github.com/zloirock/core-js/issues/679
|
|
1943
|
-
if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
|
|
1944
|
-
// Detect correctness of subclassing with @@species support
|
|
1945
|
-
var promise = new PromiseConstructor(function (resolve) { resolve(1); });
|
|
1946
|
-
var FakePromise = function (exec) {
|
|
1947
|
-
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
1948
|
-
};
|
|
1949
|
-
var constructor = promise.constructor = {};
|
|
1950
|
-
constructor[SPECIES] = FakePromise;
|
|
1951
|
-
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
1952
|
-
if (!SUBCLASSING) return true;
|
|
1953
|
-
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
1954
|
-
return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_REJECTION_EVENT;
|
|
1955
|
-
});
|
|
1956
|
-
|
|
1957
|
-
var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
|
|
1958
|
-
PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
|
|
1959
|
-
});
|
|
1960
|
-
|
|
1961
2077
|
// helpers
|
|
1962
2078
|
var isThenable = function (it) {
|
|
1963
2079
|
var then;
|
|
1964
2080
|
return isObject$1(it) && isCallable(then = it.then) ? then : false;
|
|
1965
2081
|
};
|
|
1966
2082
|
|
|
2083
|
+
var callReaction = function (reaction, state) {
|
|
2084
|
+
var value = state.value;
|
|
2085
|
+
var ok = state.state == FULFILLED;
|
|
2086
|
+
var handler = ok ? reaction.ok : reaction.fail;
|
|
2087
|
+
var resolve = reaction.resolve;
|
|
2088
|
+
var reject = reaction.reject;
|
|
2089
|
+
var domain = reaction.domain;
|
|
2090
|
+
var result, then, exited;
|
|
2091
|
+
try {
|
|
2092
|
+
if (handler) {
|
|
2093
|
+
if (!ok) {
|
|
2094
|
+
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
|
2095
|
+
state.rejection = HANDLED;
|
|
2096
|
+
}
|
|
2097
|
+
if (handler === true) result = value;
|
|
2098
|
+
else {
|
|
2099
|
+
if (domain) domain.enter();
|
|
2100
|
+
result = handler(value); // can throw
|
|
2101
|
+
if (domain) {
|
|
2102
|
+
domain.exit();
|
|
2103
|
+
exited = true;
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
if (result === reaction.promise) {
|
|
2107
|
+
reject(TypeError$3('Promise-chain cycle'));
|
|
2108
|
+
} else if (then = isThenable(result)) {
|
|
2109
|
+
functionCall(then, result, resolve, reject);
|
|
2110
|
+
} else resolve(result);
|
|
2111
|
+
} else reject(value);
|
|
2112
|
+
} catch (error) {
|
|
2113
|
+
if (domain && !exited) domain.exit();
|
|
2114
|
+
reject(error);
|
|
2115
|
+
}
|
|
2116
|
+
};
|
|
2117
|
+
|
|
1967
2118
|
var notify = function (state, isReject) {
|
|
1968
2119
|
if (state.notified) return;
|
|
1969
2120
|
state.notified = true;
|
|
1970
|
-
var chain = state.reactions;
|
|
1971
2121
|
microtask(function () {
|
|
1972
|
-
var
|
|
1973
|
-
var
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
while (chain.length > index) {
|
|
1977
|
-
var reaction = chain[index++];
|
|
1978
|
-
var handler = ok ? reaction.ok : reaction.fail;
|
|
1979
|
-
var resolve = reaction.resolve;
|
|
1980
|
-
var reject = reaction.reject;
|
|
1981
|
-
var domain = reaction.domain;
|
|
1982
|
-
var result, then, exited;
|
|
1983
|
-
try {
|
|
1984
|
-
if (handler) {
|
|
1985
|
-
if (!ok) {
|
|
1986
|
-
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
|
1987
|
-
state.rejection = HANDLED;
|
|
1988
|
-
}
|
|
1989
|
-
if (handler === true) result = value;
|
|
1990
|
-
else {
|
|
1991
|
-
if (domain) domain.enter();
|
|
1992
|
-
result = handler(value); // can throw
|
|
1993
|
-
if (domain) {
|
|
1994
|
-
domain.exit();
|
|
1995
|
-
exited = true;
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
if (result === reaction.promise) {
|
|
1999
|
-
reject(TypeError$1('Promise-chain cycle'));
|
|
2000
|
-
} else if (then = isThenable(result)) {
|
|
2001
|
-
functionCall(then, result, resolve, reject);
|
|
2002
|
-
} else resolve(result);
|
|
2003
|
-
} else reject(value);
|
|
2004
|
-
} catch (error) {
|
|
2005
|
-
if (domain && !exited) domain.exit();
|
|
2006
|
-
reject(error);
|
|
2007
|
-
}
|
|
2122
|
+
var reactions = state.reactions;
|
|
2123
|
+
var reaction;
|
|
2124
|
+
while (reaction = reactions.get()) {
|
|
2125
|
+
callReaction(reaction, state);
|
|
2008
2126
|
}
|
|
2009
|
-
state.reactions = [];
|
|
2010
2127
|
state.notified = false;
|
|
2011
2128
|
if (isReject && !state.rejection) onUnhandled(state);
|
|
2012
2129
|
});
|
|
@@ -2021,7 +2138,7 @@ var dispatchEvent = function (name, promise, reason) {
|
|
|
2021
2138
|
event.initEvent(name, false, true);
|
|
2022
2139
|
global_1.dispatchEvent(event);
|
|
2023
2140
|
} else event = { promise: promise, reason: reason };
|
|
2024
|
-
if (!
|
|
2141
|
+
if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event);
|
|
2025
2142
|
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
|
|
2026
2143
|
};
|
|
2027
2144
|
|
|
@@ -2077,7 +2194,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2077
2194
|
state.done = true;
|
|
2078
2195
|
if (unwrap) state = unwrap;
|
|
2079
2196
|
try {
|
|
2080
|
-
if (state.facade === value) throw TypeError$
|
|
2197
|
+
if (state.facade === value) throw TypeError$3("Promise can't be resolved itself");
|
|
2081
2198
|
var then = isThenable(value);
|
|
2082
2199
|
if (then) {
|
|
2083
2200
|
microtask(function () {
|
|
@@ -2102,20 +2219,22 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2102
2219
|
};
|
|
2103
2220
|
|
|
2104
2221
|
// constructor polyfill
|
|
2105
|
-
if (
|
|
2222
|
+
if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
2106
2223
|
// 25.4.3.1 Promise(executor)
|
|
2107
2224
|
PromiseConstructor = function Promise(executor) {
|
|
2108
2225
|
anInstance(this, PromisePrototype);
|
|
2109
2226
|
aCallable(executor);
|
|
2110
2227
|
functionCall(Internal, this);
|
|
2111
|
-
var state =
|
|
2228
|
+
var state = getInternalPromiseState(this);
|
|
2112
2229
|
try {
|
|
2113
2230
|
executor(bind$1(internalResolve, state), bind$1(internalReject, state));
|
|
2114
2231
|
} catch (error) {
|
|
2115
2232
|
internalReject(state, error);
|
|
2116
2233
|
}
|
|
2117
2234
|
};
|
|
2235
|
+
|
|
2118
2236
|
PromisePrototype = PromiseConstructor.prototype;
|
|
2237
|
+
|
|
2119
2238
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2120
2239
|
Internal = function Promise(executor) {
|
|
2121
2240
|
setInternalState(this, {
|
|
@@ -2123,109 +2242,229 @@ if (FORCED) {
|
|
|
2123
2242
|
done: false,
|
|
2124
2243
|
notified: false,
|
|
2125
2244
|
parent: false,
|
|
2126
|
-
reactions:
|
|
2245
|
+
reactions: new queue(),
|
|
2127
2246
|
rejection: false,
|
|
2128
2247
|
state: PENDING,
|
|
2129
2248
|
value: undefined
|
|
2130
2249
|
});
|
|
2131
2250
|
};
|
|
2251
|
+
|
|
2132
2252
|
Internal.prototype = redefineAll(PromisePrototype, {
|
|
2133
2253
|
// `Promise.prototype.then` method
|
|
2134
2254
|
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
2255
|
+
// eslint-disable-next-line unicorn/no-thenable -- safe
|
|
2135
2256
|
then: function then(onFulfilled, onRejected) {
|
|
2136
2257
|
var state = getInternalPromiseState(this);
|
|
2137
|
-
var reactions = state.reactions;
|
|
2138
2258
|
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
|
2259
|
+
state.parent = true;
|
|
2139
2260
|
reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
|
|
2140
2261
|
reaction.fail = isCallable(onRejected) && onRejected;
|
|
2141
2262
|
reaction.domain = engineIsNode ? process$1.domain : undefined;
|
|
2142
|
-
state.
|
|
2143
|
-
|
|
2144
|
-
|
|
2263
|
+
if (state.state == PENDING) state.reactions.add(reaction);
|
|
2264
|
+
else microtask(function () {
|
|
2265
|
+
callReaction(reaction, state);
|
|
2266
|
+
});
|
|
2145
2267
|
return reaction.promise;
|
|
2146
|
-
},
|
|
2147
|
-
// `Promise.prototype.catch` method
|
|
2148
|
-
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
2149
|
-
'catch': function (onRejected) {
|
|
2150
|
-
return this.then(undefined, onRejected);
|
|
2151
2268
|
}
|
|
2152
2269
|
});
|
|
2270
|
+
|
|
2153
2271
|
OwnPromiseCapability = function () {
|
|
2154
2272
|
var promise = new Internal();
|
|
2155
|
-
var state =
|
|
2273
|
+
var state = getInternalPromiseState(promise);
|
|
2156
2274
|
this.promise = promise;
|
|
2157
2275
|
this.resolve = bind$1(internalResolve, state);
|
|
2158
2276
|
this.reject = bind$1(internalReject, state);
|
|
2159
2277
|
};
|
|
2278
|
+
|
|
2160
2279
|
newPromiseCapability$1.f = newPromiseCapability = function (C) {
|
|
2161
2280
|
return C === PromiseConstructor || C === PromiseWrapper
|
|
2162
2281
|
? new OwnPromiseCapability(C)
|
|
2163
2282
|
: newGenericPromiseCapability(C);
|
|
2164
2283
|
};
|
|
2165
2284
|
|
|
2166
|
-
if (isCallable(
|
|
2167
|
-
nativeThen = NativePromisePrototype.then;
|
|
2285
|
+
if (isCallable(promiseNativeConstructor) && NativePromisePrototype$1 !== Object.prototype) {
|
|
2286
|
+
nativeThen = NativePromisePrototype$1.then;
|
|
2168
2287
|
|
|
2169
|
-
if (!
|
|
2288
|
+
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
2170
2289
|
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
2171
|
-
redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
2290
|
+
redefine(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
2172
2291
|
var that = this;
|
|
2173
2292
|
return new PromiseConstructor(function (resolve, reject) {
|
|
2174
2293
|
functionCall(nativeThen, that, resolve, reject);
|
|
2175
2294
|
}).then(onFulfilled, onRejected);
|
|
2176
2295
|
// https://github.com/zloirock/core-js/issues/640
|
|
2177
2296
|
}, { unsafe: true });
|
|
2178
|
-
|
|
2179
|
-
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
2180
|
-
redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true });
|
|
2181
2297
|
}
|
|
2182
2298
|
|
|
2183
2299
|
// make `.constructor === Promise` work for native promise-based APIs
|
|
2184
2300
|
try {
|
|
2185
|
-
delete NativePromisePrototype.constructor;
|
|
2301
|
+
delete NativePromisePrototype$1.constructor;
|
|
2186
2302
|
} catch (error) { /* empty */ }
|
|
2187
2303
|
|
|
2188
2304
|
// make `instanceof Promise` work for native promise-based APIs
|
|
2189
2305
|
if (objectSetPrototypeOf) {
|
|
2190
|
-
objectSetPrototypeOf(NativePromisePrototype, PromisePrototype);
|
|
2306
|
+
objectSetPrototypeOf(NativePromisePrototype$1, PromisePrototype);
|
|
2191
2307
|
}
|
|
2192
2308
|
}
|
|
2193
2309
|
}
|
|
2194
2310
|
|
|
2195
|
-
_export({ global: true, wrap: true, forced:
|
|
2311
|
+
_export({ global: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2196
2312
|
Promise: PromiseConstructor
|
|
2197
2313
|
});
|
|
2198
2314
|
|
|
2199
2315
|
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
2200
2316
|
setSpecies(PROMISE);
|
|
2201
2317
|
|
|
2202
|
-
|
|
2318
|
+
var iterators = {};
|
|
2203
2319
|
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
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;
|
|
2212
2357
|
}
|
|
2213
|
-
|
|
2358
|
+
if (kind === 'throw') throw value;
|
|
2359
|
+
if (innerError) throw innerResult;
|
|
2360
|
+
anObject(innerResult);
|
|
2361
|
+
return value;
|
|
2362
|
+
};
|
|
2214
2363
|
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
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);
|
|
2220
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 */ });
|
|
2221
2460
|
});
|
|
2222
2461
|
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2462
|
+
// `Promise.all` method
|
|
2463
|
+
// https://tc39.es/ecma262/#sec-promise.all
|
|
2464
|
+
_export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
|
|
2226
2465
|
all: function all(iterable) {
|
|
2227
2466
|
var C = this;
|
|
2228
|
-
var capability = newPromiseCapability(C);
|
|
2467
|
+
var capability = newPromiseCapability$1.f(C);
|
|
2229
2468
|
var resolve = capability.resolve;
|
|
2230
2469
|
var reject = capability.reject;
|
|
2231
2470
|
var result = perform(function () {
|
|
@@ -2248,12 +2487,39 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
|
2248
2487
|
});
|
|
2249
2488
|
if (result.error) reject(result.value);
|
|
2250
2489
|
return capability.promise;
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
|
-
|
|
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 }, {
|
|
2254
2520
|
race: function race(iterable) {
|
|
2255
2521
|
var C = this;
|
|
2256
|
-
var capability = newPromiseCapability(C);
|
|
2522
|
+
var capability = newPromiseCapability$1.f(C);
|
|
2257
2523
|
var reject = capability.reject;
|
|
2258
2524
|
var result = perform(function () {
|
|
2259
2525
|
var $promiseResolve = aCallable(C.resolve);
|
|
@@ -2266,9 +2532,43 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
|
2266
2532
|
}
|
|
2267
2533
|
});
|
|
2268
2534
|
|
|
2269
|
-
|
|
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
|
|
2270
2570
|
var $assign = Object.assign;
|
|
2271
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2571
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
2272
2572
|
var defineProperty$1 = Object.defineProperty;
|
|
2273
2573
|
var concat = functionUncurryThis([].concat);
|
|
2274
2574
|
|
|
@@ -2288,7 +2588,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2288
2588
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
2289
2589
|
var A = {};
|
|
2290
2590
|
var B = {};
|
|
2291
|
-
// eslint-disable-next-line es/no-symbol -- safe
|
|
2591
|
+
// eslint-disable-next-line es-x/no-symbol -- safe
|
|
2292
2592
|
var symbol = Symbol();
|
|
2293
2593
|
var alphabet = 'abcdefghijklmnopqrst';
|
|
2294
2594
|
A[symbol] = 7;
|
|
@@ -2315,7 +2615,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2315
2615
|
|
|
2316
2616
|
// `Object.assign` method
|
|
2317
2617
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2318
|
-
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
2618
|
+
// eslint-disable-next-line es-x/no-object-assign -- required for testing
|
|
2319
2619
|
_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
|
|
2320
2620
|
assign: objectAssign
|
|
2321
2621
|
});
|
|
@@ -2326,7 +2626,7 @@ var defineProperty = objectDefineProperty.f;
|
|
|
2326
2626
|
|
|
2327
2627
|
var FunctionPrototype = Function.prototype;
|
|
2328
2628
|
var functionToString = functionUncurryThis(FunctionPrototype.toString);
|
|
2329
|
-
var nameRE =
|
|
2629
|
+
var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
|
|
2330
2630
|
var regExpExec = functionUncurryThis(nameRE.exec);
|
|
2331
2631
|
var NAME = 'name';
|
|
2332
2632
|
|
|
@@ -2465,7 +2765,7 @@ var STRICT_METHOD = arrayMethodIsStrict('forEach');
|
|
|
2465
2765
|
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
2466
2766
|
var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
|
|
2467
2767
|
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
2468
|
-
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
|
|
2768
|
+
// eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
|
|
2469
2769
|
} : [].forEach;
|
|
2470
2770
|
|
|
2471
2771
|
var handlePrototype = function (CollectionPrototype) {
|
|
@@ -3942,8 +4242,103 @@ axios_1.default = default_1;
|
|
|
3942
4242
|
|
|
3943
4243
|
var axios = axios_1;
|
|
3944
4244
|
|
|
4245
|
+
var name$1 = "@tryghost/content-api";
|
|
4246
|
+
var version = "1.9.1";
|
|
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 = "6c0165f2588537f0e00e76567c2ed2f526f7faff";
|
|
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';
|
|
3945
4318
|
var supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
|
|
3946
4319
|
var name = '@tryghost/content-api';
|
|
4320
|
+
/**
|
|
4321
|
+
* This method can go away in favor of only sending 'Accept-Version` headers
|
|
4322
|
+
* once the Ghost API removes a concept of version from it's URLS (with Ghost v5)
|
|
4323
|
+
*
|
|
4324
|
+
* @param {string} [version] version in `v{major}` format
|
|
4325
|
+
* @returns {string}
|
|
4326
|
+
*/
|
|
4327
|
+
|
|
4328
|
+
var resolveAPIPrefix = function resolveAPIPrefix(version) {
|
|
4329
|
+
var prefix; // NOTE: the "version.match(/^v5\.\d+/)" expression should be changed to "version.match(/^v\d+\.\d+/)" once Ghost v5 is out
|
|
4330
|
+
|
|
4331
|
+
if (version === 'v5' || version === undefined || version.match(/^v5\.\d+/)) {
|
|
4332
|
+
prefix = "/content/";
|
|
4333
|
+
} else if (version.match(/^v\d+\.\d+/)) {
|
|
4334
|
+
var versionPrefix = /^(v\d+)\.\d+/.exec(version)[1];
|
|
4335
|
+
prefix = "/".concat(versionPrefix, "/content/");
|
|
4336
|
+
} else {
|
|
4337
|
+
prefix = "/".concat(version, "/content/");
|
|
4338
|
+
}
|
|
4339
|
+
|
|
4340
|
+
return prefix;
|
|
4341
|
+
};
|
|
3947
4342
|
|
|
3948
4343
|
var defaultMakeRequest = function defaultMakeRequest(_ref) {
|
|
3949
4344
|
var url = _ref.url,
|
|
@@ -3967,7 +4362,7 @@ var defaultMakeRequest = function defaultMakeRequest(_ref) {
|
|
|
3967
4362
|
* @param {String} options.url
|
|
3968
4363
|
* @param {String} options.key
|
|
3969
4364
|
* @param {String} [options.ghostPath]
|
|
3970
|
-
* @param {String}
|
|
4365
|
+
* @param {String|Boolean} options.version - a version string like v3, v4, v5 or boolean value identifying presence of Accept-Version header
|
|
3971
4366
|
* @param {Function} [options.makeRequest]
|
|
3972
4367
|
* @param {String} [options.host] Deprecated
|
|
3973
4368
|
*/
|
|
@@ -4006,8 +4401,32 @@ function GhostContentAPI(_ref2) {
|
|
|
4006
4401
|
});
|
|
4007
4402
|
}
|
|
4008
4403
|
|
|
4009
|
-
if (version
|
|
4404
|
+
if (version === undefined) {
|
|
4405
|
+
throw new Error("".concat(name, " Config Missing: 'version' is required. E.g. ").concat(supportedVersions.join(',')));
|
|
4406
|
+
}
|
|
4407
|
+
|
|
4408
|
+
var acceptVersionHeader;
|
|
4409
|
+
|
|
4410
|
+
if (typeof version === 'boolean') {
|
|
4411
|
+
if (version === true) {
|
|
4412
|
+
acceptVersionHeader = defaultAcceptVersionHeader;
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4415
|
+
version = undefined;
|
|
4416
|
+
} else if (version && !supportedVersions.includes(version) && !version.match(/^v\d+\.\d+/)) {
|
|
4010
4417
|
throw new Error("".concat(name, " Config Invalid: 'version' ").concat(version, " is not supported"));
|
|
4418
|
+
} else {
|
|
4419
|
+
if (version === 'canary') {
|
|
4420
|
+
// eslint-disable-next-line
|
|
4421
|
+
console.warn("".concat(name, ": The 'version' parameter has a deprecated format 'canary', please use 'v{major}.{minor}' format instead"));
|
|
4422
|
+
acceptVersionHeader = defaultAcceptVersionHeader;
|
|
4423
|
+
} else if (version.match(/^v\d+$/)) {
|
|
4424
|
+
// eslint-disable-next-line
|
|
4425
|
+
console.warn("".concat(name, ": The 'version' parameter has a deprecated format 'v{major}', please use 'v{major}.{minor}' format instead"));
|
|
4426
|
+
acceptVersionHeader = "".concat(version, ".0");
|
|
4427
|
+
} else {
|
|
4428
|
+
acceptVersionHeader = version;
|
|
4429
|
+
}
|
|
4011
4430
|
}
|
|
4012
4431
|
|
|
4013
4432
|
if (!url) {
|
|
@@ -4068,15 +4487,16 @@ function GhostContentAPI(_ref2) {
|
|
|
4068
4487
|
var headers = membersToken ? {
|
|
4069
4488
|
Authorization: "GhostMembers ".concat(membersToken)
|
|
4070
4489
|
} : {};
|
|
4490
|
+
headers['User-Agent'] = "GhostContentSDK/".concat(packageVersion);
|
|
4071
4491
|
|
|
4072
|
-
if (
|
|
4073
|
-
headers['Accept-Version'] =
|
|
4492
|
+
if (acceptVersionHeader) {
|
|
4493
|
+
headers['Accept-Version'] = acceptVersionHeader;
|
|
4074
4494
|
}
|
|
4075
4495
|
|
|
4076
4496
|
params = Object.assign({
|
|
4077
4497
|
key: key
|
|
4078
4498
|
}, params);
|
|
4079
|
-
var apiUrl =
|
|
4499
|
+
var apiUrl = "".concat(url, "/").concat(ghostPath, "/api").concat(resolveAPIPrefix(version)).concat(resourceType, "/").concat(id ? id + '/' : '');
|
|
4080
4500
|
return makeRequest({
|
|
4081
4501
|
url: apiUrl,
|
|
4082
4502
|
method: 'get',
|