msw 0.33.3 → 0.36.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/lib/esm/RequestHandler-deps.js +391 -66
- package/lib/esm/errors-deps.js +15 -1
- package/lib/esm/fetch-deps.js +9 -5
- package/lib/esm/graphql-deps.js +14 -9
- package/lib/esm/graphql.js +1 -0
- package/lib/esm/index-deps.js +2 -1
- package/lib/esm/index.js +231 -5257
- package/lib/esm/index2.js +1 -1
- package/lib/esm/mockServiceWorker.js +21 -12
- package/lib/esm/rest-deps.js +8 -15
- package/lib/esm/rest.js +1 -0
- package/lib/iife/index.js +3 -3
- package/lib/iife/mockServiceWorker.js +21 -12
- package/lib/types/context/data.d.ts +2 -3
- package/lib/types/context/extensions.d.ts +8 -0
- package/lib/types/context/index.d.ts +1 -0
- package/lib/types/graphql.d.ts +2 -1
- package/lib/types/handlers/GraphQLHandler.d.ts +5 -4
- package/lib/types/handlers/RequestHandler.d.ts +1 -1
- package/lib/types/handlers/RestHandler.d.ts +8 -10
- package/lib/types/index.d.ts +17 -7
- package/lib/types/node/glossary.d.ts +4 -14
- package/lib/types/node/index.d.ts +1 -1
- package/lib/types/rest.d.ts +10 -9
- package/lib/types/setupWorker/glossary.d.ts +16 -26
- package/lib/types/setupWorker/start/utils/prepareStartHandler.d.ts +3 -3
- package/lib/types/sharedOptions.d.ts +12 -1
- package/lib/types/typeUtils.d.ts +5 -3
- package/lib/types/utils/handleRequest.d.ts +4 -4
- package/lib/types/utils/internal/getCallFrame.d.ts +1 -1
- package/lib/types/utils/internal/jsonParse.d.ts +2 -2
- package/lib/types/utils/internal/pipeEvents.d.ts +6 -0
- package/lib/types/utils/logging/prepareResponse.d.ts +1 -1
- package/lib/types/utils/matching/matchRequestUrl.d.ts +12 -2
- package/lib/types/utils/matching/normalizePath.d.ts +1 -1
- package/lib/types/utils/request/parseBody.d.ts +2 -2
- package/lib/types/utils/request/parseWorkerRequest.d.ts +2 -2
- package/lib/types/utils/worker/createFallbackRequestListener.d.ts +2 -1
- package/lib/types/utils/worker/createRequestListener.d.ts +2 -1
- package/lib/umd/index.js +1383 -1777
- package/lib/umd/mockServiceWorker.js +21 -12
- package/native/lib/index.js +494 -491
- package/node/lib/index.js +496 -493
- package/package.json +19 -19
package/lib/umd/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MockServiceWorker = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var statuses = {
|
|
8
8
|
"100": "Continue",
|
|
@@ -88,39 +88,39 @@
|
|
|
88
88
|
|
|
89
89
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
90
90
|
|
|
91
|
-
var lib$
|
|
91
|
+
var lib$6 = {};
|
|
92
92
|
|
|
93
|
-
var Headers
|
|
93
|
+
var Headers = {};
|
|
94
94
|
|
|
95
|
-
var normalizeHeaderName$
|
|
95
|
+
var normalizeHeaderName$1 = {};
|
|
96
96
|
|
|
97
|
-
Object.defineProperty(normalizeHeaderName$
|
|
98
|
-
normalizeHeaderName$
|
|
99
|
-
var HEADERS_INVALID_CHARACTERS
|
|
100
|
-
function normalizeHeaderName
|
|
97
|
+
Object.defineProperty(normalizeHeaderName$1, "__esModule", { value: true });
|
|
98
|
+
normalizeHeaderName$1.normalizeHeaderName = void 0;
|
|
99
|
+
var HEADERS_INVALID_CHARACTERS = /[^a-z0-9\-#$%&'*+.^_`|~]/i;
|
|
100
|
+
function normalizeHeaderName(name) {
|
|
101
101
|
if (typeof name !== 'string') {
|
|
102
102
|
name = String(name);
|
|
103
103
|
}
|
|
104
|
-
if (HEADERS_INVALID_CHARACTERS
|
|
104
|
+
if (HEADERS_INVALID_CHARACTERS.test(name) || name.trim() === '') {
|
|
105
105
|
throw new TypeError('Invalid character in header field name');
|
|
106
106
|
}
|
|
107
107
|
return name.toLowerCase();
|
|
108
108
|
}
|
|
109
|
-
normalizeHeaderName$
|
|
109
|
+
normalizeHeaderName$1.normalizeHeaderName = normalizeHeaderName;
|
|
110
110
|
|
|
111
|
-
var normalizeHeaderValue$
|
|
111
|
+
var normalizeHeaderValue$1 = {};
|
|
112
112
|
|
|
113
|
-
Object.defineProperty(normalizeHeaderValue$
|
|
114
|
-
normalizeHeaderValue$
|
|
115
|
-
function normalizeHeaderValue
|
|
113
|
+
Object.defineProperty(normalizeHeaderValue$1, "__esModule", { value: true });
|
|
114
|
+
normalizeHeaderValue$1.normalizeHeaderValue = void 0;
|
|
115
|
+
function normalizeHeaderValue(value) {
|
|
116
116
|
if (typeof value !== 'string') {
|
|
117
117
|
value = String(value);
|
|
118
118
|
}
|
|
119
119
|
return value;
|
|
120
120
|
}
|
|
121
|
-
normalizeHeaderValue$
|
|
121
|
+
normalizeHeaderValue$1.normalizeHeaderValue = normalizeHeaderValue;
|
|
122
122
|
|
|
123
|
-
var __generator$
|
|
123
|
+
var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
124
124
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
125
125
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
126
126
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
var __read$
|
|
150
|
+
var __read$5 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
151
151
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
152
152
|
if (!m) return o;
|
|
153
153
|
var i = m.call(o), r, ar = [], e;
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
}
|
|
164
164
|
return ar;
|
|
165
165
|
};
|
|
166
|
-
var __values$
|
|
166
|
+
var __values$1 = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
|
|
167
167
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
168
168
|
if (m) return m.call(o);
|
|
169
169
|
if (o && typeof o.length === "number") return {
|
|
@@ -174,10 +174,10 @@
|
|
|
174
174
|
};
|
|
175
175
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
176
176
|
};
|
|
177
|
-
Object.defineProperty(Headers
|
|
178
|
-
var normalizeHeaderName_1
|
|
179
|
-
var normalizeHeaderValue_1
|
|
180
|
-
var HeadersPolyfill
|
|
177
|
+
Object.defineProperty(Headers, "__esModule", { value: true });
|
|
178
|
+
var normalizeHeaderName_1 = normalizeHeaderName$1;
|
|
179
|
+
var normalizeHeaderValue_1 = normalizeHeaderValue$1;
|
|
180
|
+
var HeadersPolyfill = /** @class */ (function () {
|
|
181
181
|
function HeadersPolyfill(init) {
|
|
182
182
|
var _this = this;
|
|
183
183
|
// Normalized header {"name":"a, b"} storage.
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
}
|
|
199
199
|
else if (Array.isArray(init)) {
|
|
200
200
|
init.forEach(function (_a) {
|
|
201
|
-
var _b = __read$
|
|
201
|
+
var _b = __read$5(_a, 2), name = _b[0], value = _b[1];
|
|
202
202
|
_this.append(name, Array.isArray(value) ? value.join(', ') : value);
|
|
203
203
|
});
|
|
204
204
|
}
|
|
@@ -215,11 +215,11 @@
|
|
|
215
215
|
HeadersPolyfill.prototype.keys = function () {
|
|
216
216
|
var _a, _b, name_1, e_1_1;
|
|
217
217
|
var e_1, _c;
|
|
218
|
-
return __generator$
|
|
218
|
+
return __generator$3(this, function (_d) {
|
|
219
219
|
switch (_d.label) {
|
|
220
220
|
case 0:
|
|
221
221
|
_d.trys.push([0, 5, 6, 7]);
|
|
222
|
-
_a = __values$
|
|
222
|
+
_a = __values$1(Object.keys(this._headers)), _b = _a.next();
|
|
223
223
|
_d.label = 1;
|
|
224
224
|
case 1:
|
|
225
225
|
if (!!_b.done) return [3 /*break*/, 4];
|
|
@@ -249,11 +249,11 @@
|
|
|
249
249
|
HeadersPolyfill.prototype.values = function () {
|
|
250
250
|
var _a, _b, value, e_2_1;
|
|
251
251
|
var e_2, _c;
|
|
252
|
-
return __generator$
|
|
252
|
+
return __generator$3(this, function (_d) {
|
|
253
253
|
switch (_d.label) {
|
|
254
254
|
case 0:
|
|
255
255
|
_d.trys.push([0, 5, 6, 7]);
|
|
256
|
-
_a = __values$
|
|
256
|
+
_a = __values$1(Object.values(this._headers)), _b = _a.next();
|
|
257
257
|
_d.label = 1;
|
|
258
258
|
case 1:
|
|
259
259
|
if (!!_b.done) return [3 /*break*/, 4];
|
|
@@ -283,11 +283,11 @@
|
|
|
283
283
|
HeadersPolyfill.prototype.entries = function () {
|
|
284
284
|
var _a, _b, name_2, e_3_1;
|
|
285
285
|
var e_3, _c;
|
|
286
|
-
return __generator$
|
|
286
|
+
return __generator$3(this, function (_d) {
|
|
287
287
|
switch (_d.label) {
|
|
288
288
|
case 0:
|
|
289
289
|
_d.trys.push([0, 5, 6, 7]);
|
|
290
|
-
_a = __values$
|
|
290
|
+
_a = __values$1(Object.keys(this._headers)), _b = _a.next();
|
|
291
291
|
_d.label = 1;
|
|
292
292
|
case 1:
|
|
293
293
|
if (!!_b.done) return [3 /*break*/, 4];
|
|
@@ -318,14 +318,14 @@
|
|
|
318
318
|
* Returns a `ByteString` sequence of all the values of a header with a given name.
|
|
319
319
|
*/
|
|
320
320
|
HeadersPolyfill.prototype.get = function (name) {
|
|
321
|
-
return this._headers[normalizeHeaderName_1
|
|
321
|
+
return this._headers[normalizeHeaderName_1.normalizeHeaderName(name)] || null;
|
|
322
322
|
};
|
|
323
323
|
/**
|
|
324
324
|
* Sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
325
325
|
*/
|
|
326
326
|
HeadersPolyfill.prototype.set = function (name, value) {
|
|
327
|
-
var normalizedName = normalizeHeaderName_1
|
|
328
|
-
this._headers[normalizedName] = normalizeHeaderValue_1
|
|
327
|
+
var normalizedName = normalizeHeaderName_1.normalizeHeaderName(name);
|
|
328
|
+
this._headers[normalizedName] = normalizeHeaderValue_1.normalizeHeaderValue(value);
|
|
329
329
|
this._names.set(normalizedName, name);
|
|
330
330
|
};
|
|
331
331
|
/**
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
if (!this.has(name)) {
|
|
343
343
|
return this;
|
|
344
344
|
}
|
|
345
|
-
var normalizedName = normalizeHeaderName_1
|
|
345
|
+
var normalizedName = normalizeHeaderName_1.normalizeHeaderName(name);
|
|
346
346
|
delete this._headers[normalizedName];
|
|
347
347
|
this._names.delete(normalizedName);
|
|
348
348
|
return this;
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
HeadersPolyfill.prototype.raw = function () {
|
|
360
360
|
var _this = this;
|
|
361
361
|
return Object.entries(this._headers).reduce(function (headers, _a) {
|
|
362
|
-
var _b = __read$
|
|
362
|
+
var _b = __read$5(_a, 2), name = _b[0], value = _b[1];
|
|
363
363
|
headers[_this._names.get(name)] = value;
|
|
364
364
|
return headers;
|
|
365
365
|
}, {});
|
|
@@ -368,7 +368,7 @@
|
|
|
368
368
|
* Returns a boolean stating whether a `Headers` object contains a certain header.
|
|
369
369
|
*/
|
|
370
370
|
HeadersPolyfill.prototype.has = function (name) {
|
|
371
|
-
return this._headers.hasOwnProperty(normalizeHeaderName_1
|
|
371
|
+
return this._headers.hasOwnProperty(normalizeHeaderName_1.normalizeHeaderName(name));
|
|
372
372
|
};
|
|
373
373
|
/**
|
|
374
374
|
* Traverses the `Headers` object,
|
|
@@ -383,15 +383,15 @@
|
|
|
383
383
|
};
|
|
384
384
|
return HeadersPolyfill;
|
|
385
385
|
}());
|
|
386
|
-
Headers
|
|
386
|
+
Headers.default = HeadersPolyfill;
|
|
387
387
|
|
|
388
|
-
var headersToString$
|
|
388
|
+
var headersToString$1 = {};
|
|
389
389
|
|
|
390
|
-
var headersToList$
|
|
390
|
+
var headersToList$1 = {};
|
|
391
391
|
|
|
392
|
-
Object.defineProperty(headersToList$
|
|
393
|
-
headersToList$
|
|
394
|
-
function headersToList
|
|
392
|
+
Object.defineProperty(headersToList$1, "__esModule", { value: true });
|
|
393
|
+
headersToList$1.headersToList = void 0;
|
|
394
|
+
function headersToList(headers) {
|
|
395
395
|
var headersList = [];
|
|
396
396
|
headers.forEach(function (value, name) {
|
|
397
397
|
var resolvedValue = value.includes(',')
|
|
@@ -401,9 +401,9 @@
|
|
|
401
401
|
});
|
|
402
402
|
return headersList;
|
|
403
403
|
}
|
|
404
|
-
headersToList$
|
|
404
|
+
headersToList$1.headersToList = headersToList;
|
|
405
405
|
|
|
406
|
-
var __read$
|
|
406
|
+
var __read$4 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
407
407
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
408
408
|
if (!m) return o;
|
|
409
409
|
var i = m.call(o), r, ar = [], e;
|
|
@@ -419,56 +419,56 @@
|
|
|
419
419
|
}
|
|
420
420
|
return ar;
|
|
421
421
|
};
|
|
422
|
-
Object.defineProperty(headersToString$
|
|
423
|
-
headersToString$
|
|
424
|
-
var headersToList_1
|
|
422
|
+
Object.defineProperty(headersToString$1, "__esModule", { value: true });
|
|
423
|
+
headersToString$1.headersToString = void 0;
|
|
424
|
+
var headersToList_1 = headersToList$1;
|
|
425
425
|
/**
|
|
426
426
|
* Converts a given `Headers` instance to its string representation.
|
|
427
427
|
*/
|
|
428
|
-
function headersToString
|
|
429
|
-
var list = headersToList_1
|
|
428
|
+
function headersToString(headers) {
|
|
429
|
+
var list = headersToList_1.headersToList(headers);
|
|
430
430
|
var lines = list.map(function (_a) {
|
|
431
|
-
var _b = __read$
|
|
431
|
+
var _b = __read$4(_a, 2), name = _b[0], value = _b[1];
|
|
432
432
|
var values = [].concat(value);
|
|
433
433
|
return name + ": " + values.join(', ');
|
|
434
434
|
});
|
|
435
435
|
return lines.join('\r\n');
|
|
436
436
|
}
|
|
437
|
-
headersToString$
|
|
437
|
+
headersToString$1.headersToString = headersToString;
|
|
438
438
|
|
|
439
|
-
var headersToObject$
|
|
439
|
+
var headersToObject$1 = {};
|
|
440
440
|
|
|
441
|
-
Object.defineProperty(headersToObject$
|
|
442
|
-
headersToObject$
|
|
441
|
+
Object.defineProperty(headersToObject$1, "__esModule", { value: true });
|
|
442
|
+
headersToObject$1.headersToObject = void 0;
|
|
443
443
|
// List of headers that cannot have multiple values,
|
|
444
444
|
// while potentially having a comma in their single value.
|
|
445
|
-
var singleValueHeaders
|
|
445
|
+
var singleValueHeaders = ['user-agent'];
|
|
446
446
|
/**
|
|
447
447
|
* Converts a given `Headers` instance into a plain object.
|
|
448
448
|
* Respects headers with multiple values.
|
|
449
449
|
*/
|
|
450
|
-
function headersToObject
|
|
450
|
+
function headersToObject(headers) {
|
|
451
451
|
var headersObject = {};
|
|
452
452
|
headers.forEach(function (value, name) {
|
|
453
|
-
var isMultiValue = !singleValueHeaders
|
|
453
|
+
var isMultiValue = !singleValueHeaders.includes(name.toLowerCase()) && value.includes(',');
|
|
454
454
|
headersObject[name] = isMultiValue
|
|
455
455
|
? value.split(',').map(function (s) { return s.trim(); })
|
|
456
456
|
: value;
|
|
457
457
|
});
|
|
458
458
|
return headersObject;
|
|
459
459
|
}
|
|
460
|
-
headersToObject$
|
|
460
|
+
headersToObject$1.headersToObject = headersToObject;
|
|
461
461
|
|
|
462
|
-
var stringToHeaders$
|
|
462
|
+
var stringToHeaders$1 = {};
|
|
463
463
|
|
|
464
|
-
Object.defineProperty(stringToHeaders$
|
|
465
|
-
stringToHeaders$
|
|
466
|
-
var Headers_1$
|
|
464
|
+
Object.defineProperty(stringToHeaders$1, "__esModule", { value: true });
|
|
465
|
+
stringToHeaders$1.stringToHeaders = void 0;
|
|
466
|
+
var Headers_1$2 = Headers;
|
|
467
467
|
/**
|
|
468
468
|
* Converts a string representation of headers (i.e. from XMLHttpRequest)
|
|
469
469
|
* to a new `Headers` instance.
|
|
470
470
|
*/
|
|
471
|
-
function stringToHeaders
|
|
471
|
+
function stringToHeaders(str) {
|
|
472
472
|
var lines = str.trim().split(/[\r\n]+/);
|
|
473
473
|
return lines.reduce(function (headers, line) {
|
|
474
474
|
var parts = line.split(': ');
|
|
@@ -476,13 +476,13 @@
|
|
|
476
476
|
var value = parts.join(': ');
|
|
477
477
|
headers.append(name, value);
|
|
478
478
|
return headers;
|
|
479
|
-
}, new Headers_1$
|
|
479
|
+
}, new Headers_1$2.default());
|
|
480
480
|
}
|
|
481
|
-
stringToHeaders$
|
|
481
|
+
stringToHeaders$1.stringToHeaders = stringToHeaders;
|
|
482
482
|
|
|
483
|
-
var listToHeaders$
|
|
483
|
+
var listToHeaders$1 = {};
|
|
484
484
|
|
|
485
|
-
var __read$
|
|
485
|
+
var __read$3 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
486
486
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
487
487
|
if (!m) return o;
|
|
488
488
|
var i = m.call(o), r, ar = [], e;
|
|
@@ -498,13 +498,13 @@
|
|
|
498
498
|
}
|
|
499
499
|
return ar;
|
|
500
500
|
};
|
|
501
|
-
Object.defineProperty(listToHeaders$
|
|
502
|
-
listToHeaders$
|
|
503
|
-
var Headers_1$
|
|
504
|
-
function listToHeaders
|
|
505
|
-
var headers = new Headers_1$
|
|
501
|
+
Object.defineProperty(listToHeaders$1, "__esModule", { value: true });
|
|
502
|
+
listToHeaders$1.listToHeaders = void 0;
|
|
503
|
+
var Headers_1$1 = Headers;
|
|
504
|
+
function listToHeaders(list) {
|
|
505
|
+
var headers = new Headers_1$1.default();
|
|
506
506
|
list.forEach(function (_a) {
|
|
507
|
-
var _b = __read$
|
|
507
|
+
var _b = __read$3(_a, 2), name = _b[0], value = _b[1];
|
|
508
508
|
var values = [].concat(value);
|
|
509
509
|
values.forEach(function (value) {
|
|
510
510
|
headers.append(name, value);
|
|
@@ -512,45 +512,45 @@
|
|
|
512
512
|
});
|
|
513
513
|
return headers;
|
|
514
514
|
}
|
|
515
|
-
listToHeaders$
|
|
515
|
+
listToHeaders$1.listToHeaders = listToHeaders;
|
|
516
516
|
|
|
517
|
-
var objectToHeaders$
|
|
517
|
+
var objectToHeaders$1 = {};
|
|
518
518
|
|
|
519
|
-
var reduceHeadersObject$
|
|
519
|
+
var reduceHeadersObject$1 = {};
|
|
520
520
|
|
|
521
|
-
Object.defineProperty(reduceHeadersObject$
|
|
522
|
-
reduceHeadersObject$
|
|
521
|
+
Object.defineProperty(reduceHeadersObject$1, "__esModule", { value: true });
|
|
522
|
+
reduceHeadersObject$1.reduceHeadersObject = void 0;
|
|
523
523
|
/**
|
|
524
524
|
* Reduces given headers object instnace.
|
|
525
525
|
*/
|
|
526
|
-
function reduceHeadersObject
|
|
526
|
+
function reduceHeadersObject(headers, reducer, initialState) {
|
|
527
527
|
return Object.keys(headers).reduce(function (nextHeaders, name) {
|
|
528
528
|
return reducer(nextHeaders, name, headers[name]);
|
|
529
529
|
}, initialState);
|
|
530
530
|
}
|
|
531
|
-
reduceHeadersObject$
|
|
531
|
+
reduceHeadersObject$1.reduceHeadersObject = reduceHeadersObject;
|
|
532
532
|
|
|
533
|
-
Object.defineProperty(objectToHeaders$
|
|
534
|
-
objectToHeaders$
|
|
535
|
-
var Headers_1
|
|
536
|
-
var reduceHeadersObject_1$
|
|
533
|
+
Object.defineProperty(objectToHeaders$1, "__esModule", { value: true });
|
|
534
|
+
objectToHeaders$1.objectToHeaders = void 0;
|
|
535
|
+
var Headers_1 = Headers;
|
|
536
|
+
var reduceHeadersObject_1$1 = reduceHeadersObject$1;
|
|
537
537
|
/**
|
|
538
538
|
* Converts a given headers object to a new `Headers` instance.
|
|
539
539
|
*/
|
|
540
|
-
function objectToHeaders
|
|
541
|
-
return reduceHeadersObject_1$
|
|
540
|
+
function objectToHeaders(headersObject) {
|
|
541
|
+
return reduceHeadersObject_1$1.reduceHeadersObject(headersObject, function (headers, name, value) {
|
|
542
542
|
var values = [].concat(value).filter(Boolean);
|
|
543
543
|
values.forEach(function (value) {
|
|
544
544
|
headers.append(name, value);
|
|
545
545
|
});
|
|
546
546
|
return headers;
|
|
547
|
-
}, new Headers_1
|
|
547
|
+
}, new Headers_1.default());
|
|
548
548
|
}
|
|
549
|
-
objectToHeaders$
|
|
549
|
+
objectToHeaders$1.objectToHeaders = objectToHeaders;
|
|
550
550
|
|
|
551
|
-
var flattenHeadersList$
|
|
551
|
+
var flattenHeadersList$1 = {};
|
|
552
552
|
|
|
553
|
-
var __read$
|
|
553
|
+
var __read$2 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
554
554
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
555
555
|
if (!m) return o;
|
|
556
556
|
var i = m.call(o), r, ar = [], e;
|
|
@@ -566,53 +566,53 @@
|
|
|
566
566
|
}
|
|
567
567
|
return ar;
|
|
568
568
|
};
|
|
569
|
-
Object.defineProperty(flattenHeadersList$
|
|
570
|
-
flattenHeadersList$
|
|
571
|
-
function flattenHeadersList
|
|
569
|
+
Object.defineProperty(flattenHeadersList$1, "__esModule", { value: true });
|
|
570
|
+
flattenHeadersList$1.flattenHeadersList = void 0;
|
|
571
|
+
function flattenHeadersList(list) {
|
|
572
572
|
return list.map(function (_a) {
|
|
573
|
-
var _b = __read$
|
|
573
|
+
var _b = __read$2(_a, 2), name = _b[0], values = _b[1];
|
|
574
574
|
return [name, [].concat(values).join('; ')];
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
|
-
flattenHeadersList$
|
|
577
|
+
flattenHeadersList$1.flattenHeadersList = flattenHeadersList;
|
|
578
578
|
|
|
579
|
-
var flattenHeadersObject$
|
|
579
|
+
var flattenHeadersObject$1 = {};
|
|
580
580
|
|
|
581
|
-
Object.defineProperty(flattenHeadersObject$
|
|
582
|
-
flattenHeadersObject$
|
|
583
|
-
var reduceHeadersObject_1
|
|
584
|
-
function flattenHeadersObject
|
|
585
|
-
return reduceHeadersObject_1
|
|
581
|
+
Object.defineProperty(flattenHeadersObject$1, "__esModule", { value: true });
|
|
582
|
+
flattenHeadersObject$1.flattenHeadersObject = void 0;
|
|
583
|
+
var reduceHeadersObject_1 = reduceHeadersObject$1;
|
|
584
|
+
function flattenHeadersObject(headersObject) {
|
|
585
|
+
return reduceHeadersObject_1.reduceHeadersObject(headersObject, function (headers, name, value) {
|
|
586
586
|
headers[name] = [].concat(value).join('; ');
|
|
587
587
|
return headers;
|
|
588
588
|
}, {});
|
|
589
589
|
}
|
|
590
|
-
flattenHeadersObject$
|
|
590
|
+
flattenHeadersObject$1.flattenHeadersObject = flattenHeadersObject;
|
|
591
591
|
|
|
592
592
|
(function (exports) {
|
|
593
593
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
594
594
|
exports.flattenHeadersObject = exports.flattenHeadersList = exports.reduceHeadersObject = exports.objectToHeaders = exports.listToHeaders = exports.stringToHeaders = exports.headersToObject = exports.headersToList = exports.headersToString = exports.Headers = void 0;
|
|
595
|
-
var Headers_1 = Headers
|
|
595
|
+
var Headers_1 = Headers;
|
|
596
596
|
Object.defineProperty(exports, "Headers", { enumerable: true, get: function () { return Headers_1.default; } });
|
|
597
|
-
var headersToString_1 = headersToString$
|
|
597
|
+
var headersToString_1 = headersToString$1;
|
|
598
598
|
Object.defineProperty(exports, "headersToString", { enumerable: true, get: function () { return headersToString_1.headersToString; } });
|
|
599
|
-
var headersToList_1 = headersToList$
|
|
599
|
+
var headersToList_1 = headersToList$1;
|
|
600
600
|
Object.defineProperty(exports, "headersToList", { enumerable: true, get: function () { return headersToList_1.headersToList; } });
|
|
601
|
-
var headersToObject_1 = headersToObject$
|
|
601
|
+
var headersToObject_1 = headersToObject$1;
|
|
602
602
|
Object.defineProperty(exports, "headersToObject", { enumerable: true, get: function () { return headersToObject_1.headersToObject; } });
|
|
603
|
-
var stringToHeaders_1 = stringToHeaders$
|
|
603
|
+
var stringToHeaders_1 = stringToHeaders$1;
|
|
604
604
|
Object.defineProperty(exports, "stringToHeaders", { enumerable: true, get: function () { return stringToHeaders_1.stringToHeaders; } });
|
|
605
|
-
var listToHeaders_1 = listToHeaders$
|
|
605
|
+
var listToHeaders_1 = listToHeaders$1;
|
|
606
606
|
Object.defineProperty(exports, "listToHeaders", { enumerable: true, get: function () { return listToHeaders_1.listToHeaders; } });
|
|
607
|
-
var objectToHeaders_1 = objectToHeaders$
|
|
607
|
+
var objectToHeaders_1 = objectToHeaders$1;
|
|
608
608
|
Object.defineProperty(exports, "objectToHeaders", { enumerable: true, get: function () { return objectToHeaders_1.objectToHeaders; } });
|
|
609
|
-
var reduceHeadersObject_1 = reduceHeadersObject$
|
|
609
|
+
var reduceHeadersObject_1 = reduceHeadersObject$1;
|
|
610
610
|
Object.defineProperty(exports, "reduceHeadersObject", { enumerable: true, get: function () { return reduceHeadersObject_1.reduceHeadersObject; } });
|
|
611
|
-
var flattenHeadersList_1 = flattenHeadersList$
|
|
611
|
+
var flattenHeadersList_1 = flattenHeadersList$1;
|
|
612
612
|
Object.defineProperty(exports, "flattenHeadersList", { enumerable: true, get: function () { return flattenHeadersList_1.flattenHeadersList; } });
|
|
613
|
-
var flattenHeadersObject_1 = flattenHeadersObject$
|
|
613
|
+
var flattenHeadersObject_1 = flattenHeadersObject$1;
|
|
614
614
|
Object.defineProperty(exports, "flattenHeadersObject", { enumerable: true, get: function () { return flattenHeadersObject_1.flattenHeadersObject; } });
|
|
615
|
-
}(lib$
|
|
615
|
+
}(lib$6));
|
|
616
616
|
|
|
617
617
|
/**
|
|
618
618
|
* Sets one or multiple response headers.
|
|
@@ -631,7 +631,7 @@
|
|
|
631
631
|
res.headers.append(name, value);
|
|
632
632
|
}
|
|
633
633
|
else {
|
|
634
|
-
const headers = lib$
|
|
634
|
+
const headers = lib$6.objectToHeaders(name);
|
|
635
635
|
headers.forEach((value, name) => {
|
|
636
636
|
res.headers.append(name, value);
|
|
637
637
|
});
|
|
@@ -652,7 +652,7 @@
|
|
|
652
652
|
* @public
|
|
653
653
|
*/
|
|
654
654
|
|
|
655
|
-
var parse_1 = parse$
|
|
655
|
+
var parse_1 = parse$5;
|
|
656
656
|
var serialize_1 = serialize;
|
|
657
657
|
|
|
658
658
|
/**
|
|
@@ -686,7 +686,7 @@
|
|
|
686
686
|
* @public
|
|
687
687
|
*/
|
|
688
688
|
|
|
689
|
-
function parse$
|
|
689
|
+
function parse$5(str, options) {
|
|
690
690
|
if (typeof str !== 'string') {
|
|
691
691
|
throw new TypeError('argument str must be a string');
|
|
692
692
|
}
|
|
@@ -871,12 +871,12 @@
|
|
|
871
871
|
};
|
|
872
872
|
|
|
873
873
|
/**
|
|
874
|
-
* Parses a given
|
|
874
|
+
* Parses a given value into a JSON.
|
|
875
875
|
* Does not throw an exception on an invalid JSON string.
|
|
876
876
|
*/
|
|
877
|
-
function jsonParse(
|
|
877
|
+
function jsonParse(value) {
|
|
878
878
|
try {
|
|
879
|
-
return JSON.parse(
|
|
879
|
+
return JSON.parse(value);
|
|
880
880
|
}
|
|
881
881
|
catch (error) {
|
|
882
882
|
return undefined;
|
|
@@ -942,7 +942,21 @@
|
|
|
942
942
|
};
|
|
943
943
|
};
|
|
944
944
|
|
|
945
|
-
|
|
945
|
+
/**
|
|
946
|
+
* Sets the GraphQL extensions on a given response.
|
|
947
|
+
* @example
|
|
948
|
+
* res(ctx.extensions({ tracing: { version: 1 }}))
|
|
949
|
+
* @see {@link https://mswjs.io/docs/api/context/extensions `ctx.extensions()`}
|
|
950
|
+
*/
|
|
951
|
+
const extensions = (payload) => {
|
|
952
|
+
return (res) => {
|
|
953
|
+
const prevBody = jsonParse(res.body) || {};
|
|
954
|
+
const nextBody = mergeRight(prevBody, { extensions: payload });
|
|
955
|
+
return json(nextBody)(res);
|
|
956
|
+
};
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
var lib$5 = {exports: {}};
|
|
946
960
|
|
|
947
961
|
(function (module, exports) {
|
|
948
962
|
(function (global, factory) {
|
|
@@ -965,14 +979,14 @@
|
|
|
965
979
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
966
980
|
|
|
967
981
|
})));
|
|
968
|
-
}(lib$
|
|
982
|
+
}(lib$5, lib$5.exports));
|
|
969
983
|
|
|
970
984
|
const SET_TIMEOUT_MAX_ALLOWED_INT = 2147483647;
|
|
971
985
|
const MIN_SERVER_RESPONSE_TIME = 100;
|
|
972
986
|
const MAX_SERVER_RESPONSE_TIME = 400;
|
|
973
987
|
const NODE_SERVER_RESPONSE_TIME = 5;
|
|
974
988
|
const getRandomServerResponseTime = () => {
|
|
975
|
-
if (lib$
|
|
989
|
+
if (lib$5.exports.isNodeProcess()) {
|
|
976
990
|
return NODE_SERVER_RESPONSE_TIME;
|
|
977
991
|
}
|
|
978
992
|
return Math.floor(Math.random() * (MAX_SERVER_RESPONSE_TIME - MIN_SERVER_RESPONSE_TIME) +
|
|
@@ -1039,9 +1053,9 @@
|
|
|
1039
1053
|
};
|
|
1040
1054
|
};
|
|
1041
1055
|
|
|
1042
|
-
const useFetch = lib$
|
|
1056
|
+
const useFetch = lib$5.exports.isNodeProcess() ? require('node-fetch') : window.fetch;
|
|
1043
1057
|
const augmentRequestInit = (requestInit) => {
|
|
1044
|
-
const headers = new lib$
|
|
1058
|
+
const headers = new lib$6.Headers(requestInit.headers);
|
|
1045
1059
|
headers.set('x-msw-bypass', 'true');
|
|
1046
1060
|
return Object.assign(Object.assign({}, requestInit), { headers: headers.all() });
|
|
1047
1061
|
};
|
|
@@ -1051,8 +1065,12 @@
|
|
|
1051
1065
|
if (['GET', 'HEAD'].includes(method)) {
|
|
1052
1066
|
return requestParameters;
|
|
1053
1067
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1068
|
+
if (typeof body === 'object' || typeof body === 'number') {
|
|
1069
|
+
requestParameters.body = JSON.stringify(body);
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
requestParameters.body = body;
|
|
1073
|
+
}
|
|
1056
1074
|
return requestParameters;
|
|
1057
1075
|
};
|
|
1058
1076
|
/**
|
|
@@ -1106,6 +1124,7 @@
|
|
|
1106
1124
|
cookie: cookie,
|
|
1107
1125
|
body: body,
|
|
1108
1126
|
data: data,
|
|
1127
|
+
extensions: extensions,
|
|
1109
1128
|
delay: delay,
|
|
1110
1129
|
errors: errors,
|
|
1111
1130
|
fetch: fetch$1,
|
|
@@ -1114,78 +1133,78 @@
|
|
|
1114
1133
|
xml: xml
|
|
1115
1134
|
});
|
|
1116
1135
|
|
|
1117
|
-
var lib$
|
|
1136
|
+
var lib$4 = {};
|
|
1118
1137
|
|
|
1119
|
-
var StrictEventEmitter$
|
|
1138
|
+
var StrictEventEmitter$1 = {};
|
|
1120
1139
|
|
|
1121
|
-
var events
|
|
1140
|
+
var events = {exports: {}};
|
|
1122
1141
|
|
|
1123
|
-
var R
|
|
1124
|
-
var ReflectApply
|
|
1125
|
-
? R
|
|
1142
|
+
var R = typeof Reflect === 'object' ? Reflect : null;
|
|
1143
|
+
var ReflectApply = R && typeof R.apply === 'function'
|
|
1144
|
+
? R.apply
|
|
1126
1145
|
: function ReflectApply(target, receiver, args) {
|
|
1127
1146
|
return Function.prototype.apply.call(target, receiver, args);
|
|
1128
1147
|
};
|
|
1129
1148
|
|
|
1130
|
-
var ReflectOwnKeys
|
|
1131
|
-
if (R
|
|
1132
|
-
ReflectOwnKeys
|
|
1149
|
+
var ReflectOwnKeys;
|
|
1150
|
+
if (R && typeof R.ownKeys === 'function') {
|
|
1151
|
+
ReflectOwnKeys = R.ownKeys;
|
|
1133
1152
|
} else if (Object.getOwnPropertySymbols) {
|
|
1134
|
-
ReflectOwnKeys
|
|
1153
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
1135
1154
|
return Object.getOwnPropertyNames(target)
|
|
1136
1155
|
.concat(Object.getOwnPropertySymbols(target));
|
|
1137
1156
|
};
|
|
1138
1157
|
} else {
|
|
1139
|
-
ReflectOwnKeys
|
|
1158
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
1140
1159
|
return Object.getOwnPropertyNames(target);
|
|
1141
1160
|
};
|
|
1142
1161
|
}
|
|
1143
1162
|
|
|
1144
|
-
function ProcessEmitWarning
|
|
1163
|
+
function ProcessEmitWarning(warning) {
|
|
1145
1164
|
if (console && console.warn) console.warn(warning);
|
|
1146
1165
|
}
|
|
1147
1166
|
|
|
1148
|
-
var NumberIsNaN
|
|
1167
|
+
var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
|
|
1149
1168
|
return value !== value;
|
|
1150
1169
|
};
|
|
1151
1170
|
|
|
1152
|
-
function EventEmitter
|
|
1153
|
-
EventEmitter
|
|
1171
|
+
function EventEmitter() {
|
|
1172
|
+
EventEmitter.init.call(this);
|
|
1154
1173
|
}
|
|
1155
|
-
events
|
|
1156
|
-
events
|
|
1174
|
+
events.exports = EventEmitter;
|
|
1175
|
+
events.exports.once = once;
|
|
1157
1176
|
|
|
1158
1177
|
// Backwards-compat with node 0.10.x
|
|
1159
|
-
EventEmitter
|
|
1178
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
1160
1179
|
|
|
1161
|
-
EventEmitter
|
|
1162
|
-
EventEmitter
|
|
1163
|
-
EventEmitter
|
|
1180
|
+
EventEmitter.prototype._events = undefined;
|
|
1181
|
+
EventEmitter.prototype._eventsCount = 0;
|
|
1182
|
+
EventEmitter.prototype._maxListeners = undefined;
|
|
1164
1183
|
|
|
1165
1184
|
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
1166
1185
|
// added to it. This is a useful default which helps finding memory leaks.
|
|
1167
|
-
var defaultMaxListeners
|
|
1186
|
+
var defaultMaxListeners = 10;
|
|
1168
1187
|
|
|
1169
|
-
function checkListener
|
|
1188
|
+
function checkListener(listener) {
|
|
1170
1189
|
if (typeof listener !== 'function') {
|
|
1171
1190
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
1172
1191
|
}
|
|
1173
1192
|
}
|
|
1174
1193
|
|
|
1175
|
-
Object.defineProperty(EventEmitter
|
|
1194
|
+
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
|
1176
1195
|
enumerable: true,
|
|
1177
1196
|
get: function() {
|
|
1178
|
-
return defaultMaxListeners
|
|
1197
|
+
return defaultMaxListeners;
|
|
1179
1198
|
},
|
|
1180
1199
|
set: function(arg) {
|
|
1181
|
-
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN
|
|
1200
|
+
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
|
1182
1201
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
|
1183
1202
|
}
|
|
1184
|
-
defaultMaxListeners
|
|
1203
|
+
defaultMaxListeners = arg;
|
|
1185
1204
|
}
|
|
1186
1205
|
});
|
|
1187
1206
|
|
|
1188
|
-
EventEmitter
|
|
1207
|
+
EventEmitter.init = function() {
|
|
1189
1208
|
|
|
1190
1209
|
if (this._events === undefined ||
|
|
1191
1210
|
this._events === Object.getPrototypeOf(this)._events) {
|
|
@@ -1198,25 +1217,25 @@
|
|
|
1198
1217
|
|
|
1199
1218
|
// Obviously not all Emitters should be limited to 10. This function allows
|
|
1200
1219
|
// that to be increased. Set to zero for unlimited.
|
|
1201
|
-
EventEmitter
|
|
1202
|
-
if (typeof n !== 'number' || n < 0 || NumberIsNaN
|
|
1220
|
+
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
1221
|
+
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
|
|
1203
1222
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
|
|
1204
1223
|
}
|
|
1205
1224
|
this._maxListeners = n;
|
|
1206
1225
|
return this;
|
|
1207
1226
|
};
|
|
1208
1227
|
|
|
1209
|
-
function _getMaxListeners
|
|
1228
|
+
function _getMaxListeners(that) {
|
|
1210
1229
|
if (that._maxListeners === undefined)
|
|
1211
|
-
return EventEmitter
|
|
1230
|
+
return EventEmitter.defaultMaxListeners;
|
|
1212
1231
|
return that._maxListeners;
|
|
1213
1232
|
}
|
|
1214
1233
|
|
|
1215
|
-
EventEmitter
|
|
1216
|
-
return _getMaxListeners
|
|
1234
|
+
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
1235
|
+
return _getMaxListeners(this);
|
|
1217
1236
|
};
|
|
1218
1237
|
|
|
1219
|
-
EventEmitter
|
|
1238
|
+
EventEmitter.prototype.emit = function emit(type) {
|
|
1220
1239
|
var args = [];
|
|
1221
1240
|
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
1222
1241
|
var doError = (type === 'error');
|
|
@@ -1249,23 +1268,23 @@
|
|
|
1249
1268
|
return false;
|
|
1250
1269
|
|
|
1251
1270
|
if (typeof handler === 'function') {
|
|
1252
|
-
ReflectApply
|
|
1271
|
+
ReflectApply(handler, this, args);
|
|
1253
1272
|
} else {
|
|
1254
1273
|
var len = handler.length;
|
|
1255
|
-
var listeners = arrayClone
|
|
1274
|
+
var listeners = arrayClone(handler, len);
|
|
1256
1275
|
for (var i = 0; i < len; ++i)
|
|
1257
|
-
ReflectApply
|
|
1276
|
+
ReflectApply(listeners[i], this, args);
|
|
1258
1277
|
}
|
|
1259
1278
|
|
|
1260
1279
|
return true;
|
|
1261
1280
|
};
|
|
1262
1281
|
|
|
1263
|
-
function _addListener
|
|
1282
|
+
function _addListener(target, type, listener, prepend) {
|
|
1264
1283
|
var m;
|
|
1265
1284
|
var events;
|
|
1266
1285
|
var existing;
|
|
1267
1286
|
|
|
1268
|
-
checkListener
|
|
1287
|
+
checkListener(listener);
|
|
1269
1288
|
|
|
1270
1289
|
events = target._events;
|
|
1271
1290
|
if (events === undefined) {
|
|
@@ -1302,7 +1321,7 @@
|
|
|
1302
1321
|
}
|
|
1303
1322
|
|
|
1304
1323
|
// Check for listener leak
|
|
1305
|
-
m = _getMaxListeners
|
|
1324
|
+
m = _getMaxListeners(target);
|
|
1306
1325
|
if (m > 0 && existing.length > m && !existing.warned) {
|
|
1307
1326
|
existing.warned = true;
|
|
1308
1327
|
// No error code for this since it is a Warning
|
|
@@ -1315,25 +1334,25 @@
|
|
|
1315
1334
|
w.emitter = target;
|
|
1316
1335
|
w.type = type;
|
|
1317
1336
|
w.count = existing.length;
|
|
1318
|
-
ProcessEmitWarning
|
|
1337
|
+
ProcessEmitWarning(w);
|
|
1319
1338
|
}
|
|
1320
1339
|
}
|
|
1321
1340
|
|
|
1322
1341
|
return target;
|
|
1323
1342
|
}
|
|
1324
1343
|
|
|
1325
|
-
EventEmitter
|
|
1326
|
-
return _addListener
|
|
1344
|
+
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
1345
|
+
return _addListener(this, type, listener, false);
|
|
1327
1346
|
};
|
|
1328
1347
|
|
|
1329
|
-
EventEmitter
|
|
1348
|
+
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
1330
1349
|
|
|
1331
|
-
EventEmitter
|
|
1350
|
+
EventEmitter.prototype.prependListener =
|
|
1332
1351
|
function prependListener(type, listener) {
|
|
1333
|
-
return _addListener
|
|
1352
|
+
return _addListener(this, type, listener, true);
|
|
1334
1353
|
};
|
|
1335
1354
|
|
|
1336
|
-
function onceWrapper
|
|
1355
|
+
function onceWrapper() {
|
|
1337
1356
|
if (!this.fired) {
|
|
1338
1357
|
this.target.removeListener(this.type, this.wrapFn);
|
|
1339
1358
|
this.fired = true;
|
|
@@ -1343,33 +1362,33 @@
|
|
|
1343
1362
|
}
|
|
1344
1363
|
}
|
|
1345
1364
|
|
|
1346
|
-
function _onceWrap
|
|
1365
|
+
function _onceWrap(target, type, listener) {
|
|
1347
1366
|
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
|
1348
|
-
var wrapped = onceWrapper
|
|
1367
|
+
var wrapped = onceWrapper.bind(state);
|
|
1349
1368
|
wrapped.listener = listener;
|
|
1350
1369
|
state.wrapFn = wrapped;
|
|
1351
1370
|
return wrapped;
|
|
1352
1371
|
}
|
|
1353
1372
|
|
|
1354
|
-
EventEmitter
|
|
1355
|
-
checkListener
|
|
1356
|
-
this.on(type, _onceWrap
|
|
1373
|
+
EventEmitter.prototype.once = function once(type, listener) {
|
|
1374
|
+
checkListener(listener);
|
|
1375
|
+
this.on(type, _onceWrap(this, type, listener));
|
|
1357
1376
|
return this;
|
|
1358
1377
|
};
|
|
1359
1378
|
|
|
1360
|
-
EventEmitter
|
|
1379
|
+
EventEmitter.prototype.prependOnceListener =
|
|
1361
1380
|
function prependOnceListener(type, listener) {
|
|
1362
|
-
checkListener
|
|
1363
|
-
this.prependListener(type, _onceWrap
|
|
1381
|
+
checkListener(listener);
|
|
1382
|
+
this.prependListener(type, _onceWrap(this, type, listener));
|
|
1364
1383
|
return this;
|
|
1365
1384
|
};
|
|
1366
1385
|
|
|
1367
1386
|
// Emits a 'removeListener' event if and only if the listener was removed.
|
|
1368
|
-
EventEmitter
|
|
1387
|
+
EventEmitter.prototype.removeListener =
|
|
1369
1388
|
function removeListener(type, listener) {
|
|
1370
1389
|
var list, events, position, i, originalListener;
|
|
1371
1390
|
|
|
1372
|
-
checkListener
|
|
1391
|
+
checkListener(listener);
|
|
1373
1392
|
|
|
1374
1393
|
events = this._events;
|
|
1375
1394
|
if (events === undefined)
|
|
@@ -1404,7 +1423,7 @@
|
|
|
1404
1423
|
if (position === 0)
|
|
1405
1424
|
list.shift();
|
|
1406
1425
|
else {
|
|
1407
|
-
spliceOne
|
|
1426
|
+
spliceOne(list, position);
|
|
1408
1427
|
}
|
|
1409
1428
|
|
|
1410
1429
|
if (list.length === 1)
|
|
@@ -1417,9 +1436,9 @@
|
|
|
1417
1436
|
return this;
|
|
1418
1437
|
};
|
|
1419
1438
|
|
|
1420
|
-
EventEmitter
|
|
1439
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
1421
1440
|
|
|
1422
|
-
EventEmitter
|
|
1441
|
+
EventEmitter.prototype.removeAllListeners =
|
|
1423
1442
|
function removeAllListeners(type) {
|
|
1424
1443
|
var listeners, events, i;
|
|
1425
1444
|
|
|
@@ -1470,7 +1489,7 @@
|
|
|
1470
1489
|
return this;
|
|
1471
1490
|
};
|
|
1472
1491
|
|
|
1473
|
-
function _listeners
|
|
1492
|
+
function _listeners(target, type, unwrap) {
|
|
1474
1493
|
var events = target._events;
|
|
1475
1494
|
|
|
1476
1495
|
if (events === undefined)
|
|
@@ -1484,27 +1503,27 @@
|
|
|
1484
1503
|
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
|
1485
1504
|
|
|
1486
1505
|
return unwrap ?
|
|
1487
|
-
unwrapListeners
|
|
1506
|
+
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
1488
1507
|
}
|
|
1489
1508
|
|
|
1490
|
-
EventEmitter
|
|
1491
|
-
return _listeners
|
|
1509
|
+
EventEmitter.prototype.listeners = function listeners(type) {
|
|
1510
|
+
return _listeners(this, type, true);
|
|
1492
1511
|
};
|
|
1493
1512
|
|
|
1494
|
-
EventEmitter
|
|
1495
|
-
return _listeners
|
|
1513
|
+
EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
|
1514
|
+
return _listeners(this, type, false);
|
|
1496
1515
|
};
|
|
1497
1516
|
|
|
1498
|
-
EventEmitter
|
|
1517
|
+
EventEmitter.listenerCount = function(emitter, type) {
|
|
1499
1518
|
if (typeof emitter.listenerCount === 'function') {
|
|
1500
1519
|
return emitter.listenerCount(type);
|
|
1501
1520
|
} else {
|
|
1502
|
-
return listenerCount
|
|
1521
|
+
return listenerCount.call(emitter, type);
|
|
1503
1522
|
}
|
|
1504
1523
|
};
|
|
1505
1524
|
|
|
1506
|
-
EventEmitter
|
|
1507
|
-
function listenerCount
|
|
1525
|
+
EventEmitter.prototype.listenerCount = listenerCount;
|
|
1526
|
+
function listenerCount(type) {
|
|
1508
1527
|
var events = this._events;
|
|
1509
1528
|
|
|
1510
1529
|
if (events !== undefined) {
|
|
@@ -1520,24 +1539,24 @@
|
|
|
1520
1539
|
return 0;
|
|
1521
1540
|
}
|
|
1522
1541
|
|
|
1523
|
-
EventEmitter
|
|
1524
|
-
return this._eventsCount > 0 ? ReflectOwnKeys
|
|
1542
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
1543
|
+
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
|
1525
1544
|
};
|
|
1526
1545
|
|
|
1527
|
-
function arrayClone
|
|
1546
|
+
function arrayClone(arr, n) {
|
|
1528
1547
|
var copy = new Array(n);
|
|
1529
1548
|
for (var i = 0; i < n; ++i)
|
|
1530
1549
|
copy[i] = arr[i];
|
|
1531
1550
|
return copy;
|
|
1532
1551
|
}
|
|
1533
1552
|
|
|
1534
|
-
function spliceOne
|
|
1553
|
+
function spliceOne(list, index) {
|
|
1535
1554
|
for (; index + 1 < list.length; index++)
|
|
1536
1555
|
list[index] = list[index + 1];
|
|
1537
1556
|
list.pop();
|
|
1538
1557
|
}
|
|
1539
1558
|
|
|
1540
|
-
function unwrapListeners
|
|
1559
|
+
function unwrapListeners(arr) {
|
|
1541
1560
|
var ret = new Array(arr.length);
|
|
1542
1561
|
for (var i = 0; i < ret.length; ++i) {
|
|
1543
1562
|
ret[i] = arr[i].listener || arr[i];
|
|
@@ -1545,7 +1564,7 @@
|
|
|
1545
1564
|
return ret;
|
|
1546
1565
|
}
|
|
1547
1566
|
|
|
1548
|
-
function once
|
|
1567
|
+
function once(emitter, name) {
|
|
1549
1568
|
return new Promise(function (resolve, reject) {
|
|
1550
1569
|
function errorListener(err) {
|
|
1551
1570
|
emitter.removeListener(name, resolver);
|
|
@@ -1558,20 +1577,20 @@
|
|
|
1558
1577
|
}
|
|
1559
1578
|
resolve([].slice.call(arguments));
|
|
1560
1579
|
}
|
|
1561
|
-
eventTargetAgnosticAddListener
|
|
1580
|
+
eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
|
|
1562
1581
|
if (name !== 'error') {
|
|
1563
|
-
addErrorHandlerIfEventEmitter
|
|
1582
|
+
addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
|
|
1564
1583
|
}
|
|
1565
1584
|
});
|
|
1566
1585
|
}
|
|
1567
1586
|
|
|
1568
|
-
function addErrorHandlerIfEventEmitter
|
|
1587
|
+
function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
|
|
1569
1588
|
if (typeof emitter.on === 'function') {
|
|
1570
|
-
eventTargetAgnosticAddListener
|
|
1589
|
+
eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
|
|
1571
1590
|
}
|
|
1572
1591
|
}
|
|
1573
1592
|
|
|
1574
|
-
function eventTargetAgnosticAddListener
|
|
1593
|
+
function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
1575
1594
|
if (typeof emitter.on === 'function') {
|
|
1576
1595
|
if (flags.once) {
|
|
1577
1596
|
emitter.once(name, listener);
|
|
@@ -1594,7 +1613,7 @@
|
|
|
1594
1613
|
}
|
|
1595
1614
|
}
|
|
1596
1615
|
|
|
1597
|
-
var __extends$
|
|
1616
|
+
var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
1598
1617
|
var extendStatics = function (d, b) {
|
|
1599
1618
|
extendStatics = Object.setPrototypeOf ||
|
|
1600
1619
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -1607,18 +1626,18 @@
|
|
|
1607
1626
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1608
1627
|
};
|
|
1609
1628
|
})();
|
|
1610
|
-
var __spreadArrays
|
|
1629
|
+
var __spreadArrays = (commonjsGlobal && commonjsGlobal.__spreadArrays) || function () {
|
|
1611
1630
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
1612
1631
|
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
1613
1632
|
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
1614
1633
|
r[k] = a[j];
|
|
1615
1634
|
return r;
|
|
1616
1635
|
};
|
|
1617
|
-
StrictEventEmitter$
|
|
1618
|
-
StrictEventEmitter$
|
|
1619
|
-
var events_1
|
|
1620
|
-
var StrictEventEmitter
|
|
1621
|
-
__extends$
|
|
1636
|
+
StrictEventEmitter$1.__esModule = true;
|
|
1637
|
+
StrictEventEmitter$1.StrictEventEmitter = void 0;
|
|
1638
|
+
var events_1 = events.exports;
|
|
1639
|
+
var StrictEventEmitter = /** @class */ (function (_super) {
|
|
1640
|
+
__extends$2(StrictEventEmitter, _super);
|
|
1622
1641
|
function StrictEventEmitter() {
|
|
1623
1642
|
return _super.call(this) || this;
|
|
1624
1643
|
}
|
|
@@ -1636,7 +1655,7 @@
|
|
|
1636
1655
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1637
1656
|
data[_i - 1] = arguments[_i];
|
|
1638
1657
|
}
|
|
1639
|
-
return _super.prototype.emit.apply(this, __spreadArrays
|
|
1658
|
+
return _super.prototype.emit.apply(this, __spreadArrays([event.toString()], data));
|
|
1640
1659
|
};
|
|
1641
1660
|
StrictEventEmitter.prototype.addListener = function (event, listener) {
|
|
1642
1661
|
return _super.prototype.addListener.call(this, event.toString(), listener);
|
|
@@ -1645,8 +1664,8 @@
|
|
|
1645
1664
|
return _super.prototype.removeListener.call(this, event.toString(), listener);
|
|
1646
1665
|
};
|
|
1647
1666
|
return StrictEventEmitter;
|
|
1648
|
-
}(events_1
|
|
1649
|
-
StrictEventEmitter$
|
|
1667
|
+
}(events_1.EventEmitter));
|
|
1668
|
+
StrictEventEmitter$1.StrictEventEmitter = StrictEventEmitter;
|
|
1650
1669
|
|
|
1651
1670
|
(function (exports) {
|
|
1652
1671
|
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -1658,9 +1677,9 @@
|
|
|
1658
1677
|
}));
|
|
1659
1678
|
exports.__esModule = true;
|
|
1660
1679
|
exports.StrictEventEmitter = void 0;
|
|
1661
|
-
var StrictEventEmitter_1 = StrictEventEmitter$
|
|
1680
|
+
var StrictEventEmitter_1 = StrictEventEmitter$1;
|
|
1662
1681
|
__createBinding(exports, StrictEventEmitter_1, "StrictEventEmitter");
|
|
1663
|
-
}(lib$
|
|
1682
|
+
}(lib$4));
|
|
1664
1683
|
|
|
1665
1684
|
/*! *****************************************************************************
|
|
1666
1685
|
Copyright (c) Microsoft Corporation.
|
|
@@ -1699,17 +1718,17 @@
|
|
|
1699
1718
|
});
|
|
1700
1719
|
}
|
|
1701
1720
|
|
|
1702
|
-
var lib$
|
|
1721
|
+
var lib$3 = {};
|
|
1703
1722
|
|
|
1704
|
-
var until$
|
|
1723
|
+
var until$1 = {};
|
|
1705
1724
|
|
|
1706
|
-
Object.defineProperty(until$
|
|
1725
|
+
Object.defineProperty(until$1, "__esModule", { value: true });
|
|
1707
1726
|
/**
|
|
1708
1727
|
* Gracefully handles a given Promise factory.
|
|
1709
1728
|
* @example
|
|
1710
1729
|
* cosnt [error, data] = await until(() => asyncAction())
|
|
1711
1730
|
*/
|
|
1712
|
-
until$
|
|
1731
|
+
until$1.until = async (promise) => {
|
|
1713
1732
|
try {
|
|
1714
1733
|
const data = await promise().catch((error) => {
|
|
1715
1734
|
throw error;
|
|
@@ -1721,9 +1740,9 @@
|
|
|
1721
1740
|
}
|
|
1722
1741
|
};
|
|
1723
1742
|
|
|
1724
|
-
Object.defineProperty(lib$
|
|
1725
|
-
var until_1$
|
|
1726
|
-
var until
|
|
1743
|
+
Object.defineProperty(lib$3, "__esModule", { value: true });
|
|
1744
|
+
var until_1$1 = until$1;
|
|
1745
|
+
var until = lib$3.until = until_1$1.until;
|
|
1727
1746
|
|
|
1728
1747
|
/**
|
|
1729
1748
|
* Attempts to resolve a Service Worker instance from a given registration,
|
|
@@ -1750,16 +1769,16 @@
|
|
|
1750
1769
|
return new URL(relativeUrl, location.origin).href;
|
|
1751
1770
|
}
|
|
1752
1771
|
|
|
1753
|
-
var lib$
|
|
1772
|
+
var lib$2 = {};
|
|
1754
1773
|
|
|
1755
|
-
var invariant$
|
|
1774
|
+
var invariant$3 = {};
|
|
1756
1775
|
|
|
1757
|
-
var format$
|
|
1776
|
+
var format$1 = {};
|
|
1758
1777
|
|
|
1759
|
-
Object.defineProperty(format$
|
|
1760
|
-
format$
|
|
1761
|
-
var POSITIONALS_EXP
|
|
1762
|
-
function serializePositional
|
|
1778
|
+
Object.defineProperty(format$1, "__esModule", { value: true });
|
|
1779
|
+
format$1.format = void 0;
|
|
1780
|
+
var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
|
|
1781
|
+
function serializePositional(positional, flag) {
|
|
1763
1782
|
switch (flag) {
|
|
1764
1783
|
// Strings.
|
|
1765
1784
|
case 's':
|
|
@@ -1786,7 +1805,7 @@
|
|
|
1786
1805
|
}
|
|
1787
1806
|
}
|
|
1788
1807
|
}
|
|
1789
|
-
function format
|
|
1808
|
+
function format(message) {
|
|
1790
1809
|
var positionals = [];
|
|
1791
1810
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1792
1811
|
positionals[_i - 1] = arguments[_i];
|
|
@@ -1795,9 +1814,9 @@
|
|
|
1795
1814
|
return message;
|
|
1796
1815
|
}
|
|
1797
1816
|
var positionalIndex = 0;
|
|
1798
|
-
var formattedMessage = message.replace(POSITIONALS_EXP
|
|
1817
|
+
var formattedMessage = message.replace(POSITIONALS_EXP, function (match, isEscaped, _, flag) {
|
|
1799
1818
|
var positional = positionals[positionalIndex];
|
|
1800
|
-
var value = serializePositional
|
|
1819
|
+
var value = serializePositional(positional, flag);
|
|
1801
1820
|
if (!isEscaped) {
|
|
1802
1821
|
positionalIndex++;
|
|
1803
1822
|
return value;
|
|
@@ -1811,9 +1830,9 @@
|
|
|
1811
1830
|
formattedMessage = formattedMessage.replace(/%{2,2}/g, '%');
|
|
1812
1831
|
return formattedMessage;
|
|
1813
1832
|
}
|
|
1814
|
-
format$
|
|
1833
|
+
format$1.format = format;
|
|
1815
1834
|
|
|
1816
|
-
var __extends$
|
|
1835
|
+
var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
1817
1836
|
var extendStatics = function (d, b) {
|
|
1818
1837
|
extendStatics = Object.setPrototypeOf ||
|
|
1819
1838
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -1828,17 +1847,17 @@
|
|
|
1828
1847
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1829
1848
|
};
|
|
1830
1849
|
})();
|
|
1831
|
-
var __spreadArray
|
|
1850
|
+
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
|
|
1832
1851
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
1833
1852
|
to[j] = from[i];
|
|
1834
1853
|
return to;
|
|
1835
1854
|
};
|
|
1836
|
-
Object.defineProperty(invariant$
|
|
1837
|
-
invariant$
|
|
1838
|
-
var format_1
|
|
1839
|
-
var STACK_FRAMES_TO_IGNORE
|
|
1840
|
-
var InvariantError
|
|
1841
|
-
__extends$
|
|
1855
|
+
Object.defineProperty(invariant$3, "__esModule", { value: true });
|
|
1856
|
+
invariant$3.invariant = invariant$3.InvariantError = void 0;
|
|
1857
|
+
var format_1 = format$1;
|
|
1858
|
+
var STACK_FRAMES_TO_IGNORE = 2;
|
|
1859
|
+
var InvariantError = /** @class */ (function (_super) {
|
|
1860
|
+
__extends$1(InvariantError, _super);
|
|
1842
1861
|
function InvariantError(message) {
|
|
1843
1862
|
var positionals = [];
|
|
1844
1863
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -1846,29 +1865,29 @@
|
|
|
1846
1865
|
}
|
|
1847
1866
|
var _this = _super.call(this, message) || this;
|
|
1848
1867
|
_this.name = 'Invariant Violation';
|
|
1849
|
-
_this.message = format_1
|
|
1868
|
+
_this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
|
|
1850
1869
|
if (_this.stack) {
|
|
1851
1870
|
var prevStack = _this.stack;
|
|
1852
1871
|
_this.stack = prevStack
|
|
1853
1872
|
.split('\n')
|
|
1854
|
-
.slice(STACK_FRAMES_TO_IGNORE
|
|
1873
|
+
.slice(STACK_FRAMES_TO_IGNORE)
|
|
1855
1874
|
.join('\n');
|
|
1856
1875
|
}
|
|
1857
1876
|
return _this;
|
|
1858
1877
|
}
|
|
1859
1878
|
return InvariantError;
|
|
1860
1879
|
}(Error));
|
|
1861
|
-
invariant$
|
|
1862
|
-
function invariant$
|
|
1880
|
+
invariant$3.InvariantError = InvariantError;
|
|
1881
|
+
function invariant$2(predicate, message) {
|
|
1863
1882
|
var positionals = [];
|
|
1864
1883
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1865
1884
|
positionals[_i - 2] = arguments[_i];
|
|
1866
1885
|
}
|
|
1867
1886
|
if (!predicate) {
|
|
1868
|
-
throw new (InvariantError
|
|
1887
|
+
throw new (InvariantError.bind.apply(InvariantError, __spreadArray([void 0, message], positionals)))();
|
|
1869
1888
|
}
|
|
1870
1889
|
}
|
|
1871
|
-
invariant$
|
|
1890
|
+
invariant$3.invariant = invariant$2;
|
|
1872
1891
|
|
|
1873
1892
|
(function (exports) {
|
|
1874
1893
|
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -1882,16 +1901,16 @@
|
|
|
1882
1901
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1883
1902
|
};
|
|
1884
1903
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1885
|
-
__exportStar(invariant$
|
|
1886
|
-
__exportStar(format$
|
|
1887
|
-
}(lib$
|
|
1904
|
+
__exportStar(invariant$3, exports);
|
|
1905
|
+
__exportStar(format$1, exports);
|
|
1906
|
+
}(lib$2));
|
|
1888
1907
|
|
|
1889
1908
|
const LIBRARY_PREFIX = '[MSW]';
|
|
1890
1909
|
/**
|
|
1891
1910
|
* Formats a given message by appending the library's prefix string.
|
|
1892
1911
|
*/
|
|
1893
1912
|
function formatMessage(message, ...positionals) {
|
|
1894
|
-
const interpolatedMessage = lib$
|
|
1913
|
+
const interpolatedMessage = lib$2.format(message, ...positionals);
|
|
1895
1914
|
return `${LIBRARY_PREFIX} ${interpolatedMessage}`;
|
|
1896
1915
|
}
|
|
1897
1916
|
/**
|
|
@@ -1942,7 +1961,7 @@
|
|
|
1942
1961
|
});
|
|
1943
1962
|
}
|
|
1944
1963
|
// When the Service Worker wasn't found, register it anew and return the reference.
|
|
1945
|
-
const [error, instance] = yield until
|
|
1964
|
+
const [error, instance] = yield until(() => __awaiter$3(void 0, void 0, void 0, function* () {
|
|
1946
1965
|
const registration = yield navigator.serviceWorker.register(url, options);
|
|
1947
1966
|
return [
|
|
1948
1967
|
// Compare existing worker registration by its worker URL,
|
|
@@ -2022,7 +2041,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
2022
2041
|
}
|
|
2023
2042
|
}
|
|
2024
2043
|
|
|
2025
|
-
var lib$
|
|
2044
|
+
var lib$1 = {};
|
|
2026
2045
|
|
|
2027
2046
|
var CookieStore = {};
|
|
2028
2047
|
|
|
@@ -2086,7 +2105,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
2086
2105
|
return cookie;
|
|
2087
2106
|
}
|
|
2088
2107
|
|
|
2089
|
-
function parse$
|
|
2108
|
+
function parse$4(input, options) {
|
|
2090
2109
|
options = options
|
|
2091
2110
|
? Object.assign({}, defaultParseOptions, options)
|
|
2092
2111
|
: defaultParseOptions;
|
|
@@ -2224,8 +2243,8 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
2224
2243
|
return cookiesStrings;
|
|
2225
2244
|
}
|
|
2226
2245
|
|
|
2227
|
-
setCookie.exports = parse$
|
|
2228
|
-
setCookie.exports.parse = parse$
|
|
2246
|
+
setCookie.exports = parse$4;
|
|
2247
|
+
setCookie.exports.parse = parse$4;
|
|
2229
2248
|
setCookie.exports.parseString = parseString;
|
|
2230
2249
|
setCookie.exports.splitCookiesString = splitCookiesString;
|
|
2231
2250
|
|
|
@@ -2393,7 +2412,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2393
2412
|
var CookieStore_1 = CookieStore;
|
|
2394
2413
|
Object.defineProperty(exports, "store", { enumerable: true, get: function () { return __importDefault(CookieStore_1).default; } });
|
|
2395
2414
|
Object.defineProperty(exports, "PERSISTENCY_KEY", { enumerable: true, get: function () { return CookieStore_1.PERSISTENCY_KEY; } });
|
|
2396
|
-
}(lib$
|
|
2415
|
+
}(lib$1));
|
|
2397
2416
|
|
|
2398
2417
|
function getAllCookies() {
|
|
2399
2418
|
return parse_1(document.cookie);
|
|
@@ -2405,7 +2424,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2405
2424
|
/**
|
|
2406
2425
|
* @note No cookies persist on the document in Node.js: no document.
|
|
2407
2426
|
*/
|
|
2408
|
-
if (typeof location === 'undefined') {
|
|
2427
|
+
if (typeof document === 'undefined' || typeof location === 'undefined') {
|
|
2409
2428
|
return {};
|
|
2410
2429
|
}
|
|
2411
2430
|
switch (request.credentials) {
|
|
@@ -2426,8 +2445,8 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2426
2445
|
|
|
2427
2446
|
function setRequestCookies(request) {
|
|
2428
2447
|
var _a;
|
|
2429
|
-
lib$
|
|
2430
|
-
request.cookies = Object.assign(Object.assign({}, getRequestCookies(request)), Array.from((_a = lib$
|
|
2448
|
+
lib$1.store.hydrate();
|
|
2449
|
+
request.cookies = Object.assign(Object.assign({}, getRequestCookies(request)), Array.from((_a = lib$1.store.get(Object.assign(Object.assign({}, request), { url: request.url.toString() }))) === null || _a === void 0 ? void 0 : _a.entries()).reduce((cookies, [name, { value }]) => Object.assign(cookies, { [name]: value }), {}));
|
|
2431
2450
|
request.headers.set('cookie', Object.entries(request.cookies)
|
|
2432
2451
|
.map(([name, value]) => `${name}=${value}`)
|
|
2433
2452
|
.join('; '));
|
|
@@ -2435,7 +2454,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2435
2454
|
|
|
2436
2455
|
function parseContentHeaders(headersString) {
|
|
2437
2456
|
var _a, _b;
|
|
2438
|
-
const headers = lib$
|
|
2457
|
+
const headers = lib$6.stringToHeaders(headersString);
|
|
2439
2458
|
const contentType = headers.get('content-type') || 'text/plain';
|
|
2440
2459
|
const disposition = headers.get('content-disposition');
|
|
2441
2460
|
if (!disposition) {
|
|
@@ -2506,25 +2525,25 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2506
2525
|
}
|
|
2507
2526
|
|
|
2508
2527
|
/**
|
|
2509
|
-
* Parses a given request/response body based on the
|
|
2528
|
+
* Parses a given request/response body based on the "Content-Type" header.
|
|
2510
2529
|
*/
|
|
2511
2530
|
function parseBody(body, headers) {
|
|
2512
2531
|
// Return whatever falsey body value is given.
|
|
2513
2532
|
if (!body) {
|
|
2514
2533
|
return body;
|
|
2515
2534
|
}
|
|
2516
|
-
const contentType = headers === null || headers === void 0 ? void 0 : headers.get('content-type');
|
|
2535
|
+
const contentType = (headers === null || headers === void 0 ? void 0 : headers.get('content-type')) || '';
|
|
2517
2536
|
// If the body has a Multipart Content-Type
|
|
2518
2537
|
// parse it into an object.
|
|
2519
|
-
const hasMultipartContent = contentType
|
|
2538
|
+
const hasMultipartContent = contentType.startsWith('multipart/form-data');
|
|
2520
2539
|
if (hasMultipartContent && typeof body !== 'object') {
|
|
2521
|
-
return parseMultipartData(body, headers) || body;
|
|
2540
|
+
return parseMultipartData(body.toString(), headers) || body;
|
|
2522
2541
|
}
|
|
2523
2542
|
// If the intercepted request's body has a JSON Content-Type
|
|
2524
2543
|
// parse it into an object.
|
|
2525
|
-
const hasJsonContent = contentType
|
|
2544
|
+
const hasJsonContent = contentType.includes('json');
|
|
2526
2545
|
if (hasJsonContent && typeof body !== 'object') {
|
|
2527
|
-
return jsonParse(body) || body;
|
|
2546
|
+
return jsonParse(body.toString()) || body;
|
|
2528
2547
|
}
|
|
2529
2548
|
// Otherwise leave as-is.
|
|
2530
2549
|
return body;
|
|
@@ -2571,7 +2590,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2571
2590
|
destination: rawRequest.destination,
|
|
2572
2591
|
body: pruneGetRequestBody(rawRequest),
|
|
2573
2592
|
bodyUsed: rawRequest.bodyUsed,
|
|
2574
|
-
headers: new lib$
|
|
2593
|
+
headers: new lib$6.Headers(rawRequest.headers),
|
|
2575
2594
|
};
|
|
2576
2595
|
// Set document cookies on the request.
|
|
2577
2596
|
setRequestCookies(request);
|
|
@@ -3312,14 +3331,14 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3312
3331
|
|
|
3313
3332
|
var defineInspect$1 = {};
|
|
3314
3333
|
|
|
3315
|
-
var invariant$
|
|
3334
|
+
var invariant$1 = {};
|
|
3316
3335
|
|
|
3317
|
-
Object.defineProperty(invariant$
|
|
3336
|
+
Object.defineProperty(invariant$1, "__esModule", {
|
|
3318
3337
|
value: true
|
|
3319
3338
|
});
|
|
3320
|
-
invariant$
|
|
3339
|
+
invariant$1.default = invariant;
|
|
3321
3340
|
|
|
3322
|
-
function invariant
|
|
3341
|
+
function invariant(condition, message) {
|
|
3323
3342
|
var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')
|
|
3324
3343
|
|
|
3325
3344
|
if (!booleanCondition) {
|
|
@@ -3343,7 +3362,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3343
3362
|
});
|
|
3344
3363
|
defineInspect$1.default = defineInspect;
|
|
3345
3364
|
|
|
3346
|
-
var _invariant$f = _interopRequireDefault$M(invariant$
|
|
3365
|
+
var _invariant$f = _interopRequireDefault$M(invariant$1);
|
|
3347
3366
|
|
|
3348
3367
|
var _nodejsCustomInspectSymbol$1 = _interopRequireDefault$M(nodejsCustomInspectSymbol$1);
|
|
3349
3368
|
|
|
@@ -3826,7 +3845,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3826
3845
|
|
|
3827
3846
|
directiveLocation.DirectiveLocation = DirectiveLocation;
|
|
3828
3847
|
|
|
3829
|
-
var lexer = {};
|
|
3848
|
+
var lexer$1 = {};
|
|
3830
3849
|
|
|
3831
3850
|
var blockString = {};
|
|
3832
3851
|
|
|
@@ -3963,11 +3982,11 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3963
3982
|
return '"""' + result.replace(/"""/g, '\\"""') + '"""';
|
|
3964
3983
|
}
|
|
3965
3984
|
|
|
3966
|
-
Object.defineProperty(lexer, "__esModule", {
|
|
3985
|
+
Object.defineProperty(lexer$1, "__esModule", {
|
|
3967
3986
|
value: true
|
|
3968
3987
|
});
|
|
3969
|
-
lexer.isPunctuatorTokenKind = isPunctuatorTokenKind;
|
|
3970
|
-
lexer.Lexer = void 0;
|
|
3988
|
+
lexer$1.isPunctuatorTokenKind = isPunctuatorTokenKind;
|
|
3989
|
+
lexer$1.Lexer = void 0;
|
|
3971
3990
|
|
|
3972
3991
|
var _syntaxError$1 = syntaxError$1;
|
|
3973
3992
|
|
|
@@ -4049,7 +4068,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
4049
4068
|
*/
|
|
4050
4069
|
|
|
4051
4070
|
|
|
4052
|
-
lexer.Lexer = Lexer;
|
|
4071
|
+
lexer$1.Lexer = Lexer;
|
|
4053
4072
|
|
|
4054
4073
|
function isPunctuatorTokenKind(kind) {
|
|
4055
4074
|
return kind === _tokenKind$3.TokenKind.BANG || kind === _tokenKind$3.TokenKind.DOLLAR || kind === _tokenKind$3.TokenKind.AMP || kind === _tokenKind$3.TokenKind.PAREN_L || kind === _tokenKind$3.TokenKind.PAREN_R || kind === _tokenKind$3.TokenKind.SPREAD || kind === _tokenKind$3.TokenKind.COLON || kind === _tokenKind$3.TokenKind.EQUALS || kind === _tokenKind$3.TokenKind.AT || kind === _tokenKind$3.TokenKind.BRACKET_L || kind === _tokenKind$3.TokenKind.BRACKET_R || kind === _tokenKind$3.TokenKind.BRACE_L || kind === _tokenKind$3.TokenKind.PIPE || kind === _tokenKind$3.TokenKind.BRACE_R;
|
|
@@ -4655,7 +4674,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
4655
4674
|
Object.defineProperty(parser, "__esModule", {
|
|
4656
4675
|
value: true
|
|
4657
4676
|
});
|
|
4658
|
-
parser.parse = parse$
|
|
4677
|
+
parser.parse = parse$3;
|
|
4659
4678
|
parser.parseValue = parseValue;
|
|
4660
4679
|
parser.parseType = parseType;
|
|
4661
4680
|
parser.Parser = void 0;
|
|
@@ -4672,13 +4691,13 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
4672
4691
|
|
|
4673
4692
|
var _directiveLocation$3 = directiveLocation;
|
|
4674
4693
|
|
|
4675
|
-
var _lexer$1 = lexer;
|
|
4694
|
+
var _lexer$1 = lexer$1;
|
|
4676
4695
|
|
|
4677
4696
|
/**
|
|
4678
4697
|
* Given a GraphQL source, parses it into a Document.
|
|
4679
4698
|
* Throws GraphQLError if a syntax error is encountered.
|
|
4680
4699
|
*/
|
|
4681
|
-
function parse$
|
|
4700
|
+
function parse$3(source, options) {
|
|
4682
4701
|
var parser = new Parser(source, options);
|
|
4683
4702
|
return parser.parseDocument();
|
|
4684
4703
|
}
|
|
@@ -7484,7 +7503,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
7484
7503
|
|
|
7485
7504
|
var _inspect$q = _interopRequireDefault$B(inspect$1);
|
|
7486
7505
|
|
|
7487
|
-
var _invariant$e = _interopRequireDefault$B(invariant$
|
|
7506
|
+
var _invariant$e = _interopRequireDefault$B(invariant$1);
|
|
7488
7507
|
|
|
7489
7508
|
var _keyValMap$3 = _interopRequireDefault$B(keyValMap$1);
|
|
7490
7509
|
|
|
@@ -9348,7 +9367,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
9348
9367
|
|
|
9349
9368
|
var _inspect$n = _interopRequireDefault$y(inspect$1);
|
|
9350
9369
|
|
|
9351
|
-
var _invariant$d = _interopRequireDefault$y(invariant$
|
|
9370
|
+
var _invariant$d = _interopRequireDefault$y(invariant$1);
|
|
9352
9371
|
|
|
9353
9372
|
var _isObjectLike$5 = _interopRequireDefault$y(isObjectLike$1);
|
|
9354
9373
|
|
|
@@ -9542,7 +9561,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
9542
9561
|
|
|
9543
9562
|
var _inspect$m = _interopRequireDefault$x(inspect$1);
|
|
9544
9563
|
|
|
9545
|
-
var _invariant$c = _interopRequireDefault$x(invariant$
|
|
9564
|
+
var _invariant$c = _interopRequireDefault$x(invariant$1);
|
|
9546
9565
|
|
|
9547
9566
|
var _printer$8 = printer;
|
|
9548
9567
|
|
|
@@ -11294,7 +11313,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
11294
11313
|
|
|
11295
11314
|
var _inspect$i = _interopRequireDefault$t(inspect$1);
|
|
11296
11315
|
|
|
11297
|
-
var _invariant$b = _interopRequireDefault$t(invariant$
|
|
11316
|
+
var _invariant$b = _interopRequireDefault$t(invariant$1);
|
|
11298
11317
|
|
|
11299
11318
|
var _kinds$j = kinds;
|
|
11300
11319
|
|
|
@@ -12623,7 +12642,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
12623
12642
|
|
|
12624
12643
|
var _inspect$f = _interopRequireDefault$n(inspect$1);
|
|
12625
12644
|
|
|
12626
|
-
var _invariant$a = _interopRequireDefault$n(invariant$
|
|
12645
|
+
var _invariant$a = _interopRequireDefault$n(invariant$1);
|
|
12627
12646
|
|
|
12628
12647
|
var _GraphQLError$n = GraphQLError$1;
|
|
12629
12648
|
|
|
@@ -14283,7 +14302,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
14283
14302
|
|
|
14284
14303
|
var _inspect$a = _interopRequireDefault$h(inspect$1);
|
|
14285
14304
|
|
|
14286
|
-
var _invariant$9 = _interopRequireDefault$h(invariant$
|
|
14305
|
+
var _invariant$9 = _interopRequireDefault$h(invariant$1);
|
|
14287
14306
|
|
|
14288
14307
|
var _didYouMean$1 = _interopRequireDefault$h(didYouMean$1);
|
|
14289
14308
|
|
|
@@ -15112,7 +15131,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
15112
15131
|
|
|
15113
15132
|
var _inspect$9 = _interopRequireDefault$e(inspect$1);
|
|
15114
15133
|
|
|
15115
|
-
var _invariant$8 = _interopRequireDefault$e(invariant$
|
|
15134
|
+
var _invariant$8 = _interopRequireDefault$e(invariant$1);
|
|
15116
15135
|
|
|
15117
15136
|
var _kinds$6 = kinds;
|
|
15118
15137
|
|
|
@@ -15297,7 +15316,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
15297
15316
|
|
|
15298
15317
|
var _inspect$8 = _interopRequireDefault$d(inspect$1);
|
|
15299
15318
|
|
|
15300
|
-
var _invariant$7 = _interopRequireDefault$d(invariant$
|
|
15319
|
+
var _invariant$7 = _interopRequireDefault$d(invariant$1);
|
|
15301
15320
|
|
|
15302
15321
|
var _didYouMean = _interopRequireDefault$d(didYouMean$1);
|
|
15303
15322
|
|
|
@@ -15678,7 +15697,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
15678
15697
|
|
|
15679
15698
|
var _memoize = _interopRequireDefault$b(memoize3$1);
|
|
15680
15699
|
|
|
15681
|
-
var _invariant$6 = _interopRequireDefault$b(invariant$
|
|
15700
|
+
var _invariant$6 = _interopRequireDefault$b(invariant$1);
|
|
15682
15701
|
|
|
15683
15702
|
var _devAssert$4 = _interopRequireDefault$b(devAssert$1);
|
|
15684
15703
|
|
|
@@ -17337,7 +17356,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
17337
17356
|
|
|
17338
17357
|
var _tokenKind = tokenKind;
|
|
17339
17358
|
|
|
17340
|
-
var _lexer = lexer;
|
|
17359
|
+
var _lexer = lexer$1;
|
|
17341
17360
|
|
|
17342
17361
|
var _parser = parser;
|
|
17343
17362
|
|
|
@@ -17729,7 +17748,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
17729
17748
|
});
|
|
17730
17749
|
NoDeprecatedCustomRule$1.NoDeprecatedCustomRule = NoDeprecatedCustomRule;
|
|
17731
17750
|
|
|
17732
|
-
var _invariant$5 = _interopRequireDefault$8(invariant$
|
|
17751
|
+
var _invariant$5 = _interopRequireDefault$8(invariant$1);
|
|
17733
17752
|
|
|
17734
17753
|
var _GraphQLError$1 = GraphQLError$1;
|
|
17735
17754
|
|
|
@@ -18314,7 +18333,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
18314
18333
|
});
|
|
18315
18334
|
introspectionFromSchema$1.introspectionFromSchema = introspectionFromSchema;
|
|
18316
18335
|
|
|
18317
|
-
var _invariant$4 = _interopRequireDefault$6(invariant$
|
|
18336
|
+
var _invariant$4 = _interopRequireDefault$6(invariant$1);
|
|
18318
18337
|
|
|
18319
18338
|
var _parser$2 = parser;
|
|
18320
18339
|
|
|
@@ -18711,7 +18730,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
18711
18730
|
|
|
18712
18731
|
var _mapValue = _interopRequireDefault$4(mapValue$1);
|
|
18713
18732
|
|
|
18714
|
-
var _invariant$3 = _interopRequireDefault$4(invariant$
|
|
18733
|
+
var _invariant$3 = _interopRequireDefault$4(invariant$1);
|
|
18715
18734
|
|
|
18716
18735
|
var _devAssert$1 = _interopRequireDefault$4(devAssert$1);
|
|
18717
18736
|
|
|
@@ -19541,7 +19560,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
19541
19560
|
|
|
19542
19561
|
var _inspect$2 = _interopRequireDefault$2(inspect$1);
|
|
19543
19562
|
|
|
19544
|
-
var _invariant$2 = _interopRequireDefault$2(invariant$
|
|
19563
|
+
var _invariant$2 = _interopRequireDefault$2(invariant$1);
|
|
19545
19564
|
|
|
19546
19565
|
var _keyValMap = _interopRequireDefault$2(keyValMap$1);
|
|
19547
19566
|
|
|
@@ -19746,7 +19765,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
19746
19765
|
|
|
19747
19766
|
var _inspect$1 = _interopRequireDefault$1(inspect$1);
|
|
19748
19767
|
|
|
19749
|
-
var _invariant$1 = _interopRequireDefault$1(invariant$
|
|
19768
|
+
var _invariant$1 = _interopRequireDefault$1(invariant$1);
|
|
19750
19769
|
|
|
19751
19770
|
var _printer$1 = printer;
|
|
19752
19771
|
|
|
@@ -20153,7 +20172,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
20153
20172
|
|
|
20154
20173
|
var _tokenKind = tokenKind;
|
|
20155
20174
|
|
|
20156
|
-
var _lexer = lexer;
|
|
20175
|
+
var _lexer = lexer$1;
|
|
20157
20176
|
|
|
20158
20177
|
var _blockString = blockString;
|
|
20159
20178
|
|
|
@@ -20281,7 +20300,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
20281
20300
|
|
|
20282
20301
|
var _inspect = _interopRequireDefault(inspect$1);
|
|
20283
20302
|
|
|
20284
|
-
var _invariant = _interopRequireDefault(invariant$
|
|
20303
|
+
var _invariant = _interopRequireDefault(invariant$1);
|
|
20285
20304
|
|
|
20286
20305
|
var _naturalCompare = _interopRequireDefault(naturalCompare$1);
|
|
20287
20306
|
|
|
@@ -22427,57 +22446,420 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22427
22446
|
* Formats a mocked response for introspection in the browser's console.
|
|
22428
22447
|
*/
|
|
22429
22448
|
function prepareResponse(res) {
|
|
22430
|
-
const responseHeaders = lib$
|
|
22449
|
+
const responseHeaders = lib$6.objectToHeaders(res.headers);
|
|
22431
22450
|
return Object.assign(Object.assign({}, res), {
|
|
22432
22451
|
// Parse a response JSON body for preview in the logs
|
|
22433
22452
|
body: parseBody(res.body, responseHeaders) });
|
|
22434
22453
|
}
|
|
22435
22454
|
|
|
22436
|
-
var
|
|
22437
|
-
|
|
22438
|
-
Object.defineProperty(cjs, '__esModule', { value: true });
|
|
22439
|
-
|
|
22440
|
-
/**
|
|
22441
|
-
* Converts a string path to a Regular Expression.
|
|
22442
|
-
* Transforms path parameters into named RegExp groups.
|
|
22443
|
-
*/
|
|
22444
|
-
const pathToRegExp = (path) => {
|
|
22445
|
-
const pattern = path
|
|
22446
|
-
// Escape literal dots
|
|
22447
|
-
.replace(/\./g, '\\.')
|
|
22448
|
-
// Escape literal slashes
|
|
22449
|
-
.replace(/\//g, '/')
|
|
22450
|
-
// Escape literal question marks
|
|
22451
|
-
.replace(/\?/g, '\\?')
|
|
22452
|
-
// Ignore trailing slashes
|
|
22453
|
-
.replace(/\/+$/, '')
|
|
22454
|
-
// Replace wildcard with any zero-to-any character sequence
|
|
22455
|
-
.replace(/\*+/g, '.*')
|
|
22456
|
-
// Replace parameters with named capturing groups
|
|
22457
|
-
.replace(/:([^\d|^\/][a-zA-Z0-9_]*(?=(?:\/|\\.)|$))/g, (_, paramName) => `(?<${paramName}>[^\/]+?)`)
|
|
22458
|
-
// Allow optional trailing slash
|
|
22459
|
-
.concat('(\\/|$)');
|
|
22460
|
-
return new RegExp(pattern, 'gi');
|
|
22461
|
-
};
|
|
22455
|
+
var dist = {};
|
|
22462
22456
|
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22477
|
-
|
|
22478
|
-
|
|
22479
|
-
|
|
22480
|
-
|
|
22457
|
+
Object.defineProperty(dist, "__esModule", { value: true });
|
|
22458
|
+
dist.pathToRegexp = dist.tokensToRegexp = dist.regexpToFunction = match_1 = dist.match = dist.tokensToFunction = dist.compile = dist.parse = void 0;
|
|
22459
|
+
/**
|
|
22460
|
+
* Tokenize input string.
|
|
22461
|
+
*/
|
|
22462
|
+
function lexer(str) {
|
|
22463
|
+
var tokens = [];
|
|
22464
|
+
var i = 0;
|
|
22465
|
+
while (i < str.length) {
|
|
22466
|
+
var char = str[i];
|
|
22467
|
+
if (char === "*" || char === "+" || char === "?") {
|
|
22468
|
+
tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
|
|
22469
|
+
continue;
|
|
22470
|
+
}
|
|
22471
|
+
if (char === "\\") {
|
|
22472
|
+
tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
|
|
22473
|
+
continue;
|
|
22474
|
+
}
|
|
22475
|
+
if (char === "{") {
|
|
22476
|
+
tokens.push({ type: "OPEN", index: i, value: str[i++] });
|
|
22477
|
+
continue;
|
|
22478
|
+
}
|
|
22479
|
+
if (char === "}") {
|
|
22480
|
+
tokens.push({ type: "CLOSE", index: i, value: str[i++] });
|
|
22481
|
+
continue;
|
|
22482
|
+
}
|
|
22483
|
+
if (char === ":") {
|
|
22484
|
+
var name = "";
|
|
22485
|
+
var j = i + 1;
|
|
22486
|
+
while (j < str.length) {
|
|
22487
|
+
var code = str.charCodeAt(j);
|
|
22488
|
+
if (
|
|
22489
|
+
// `0-9`
|
|
22490
|
+
(code >= 48 && code <= 57) ||
|
|
22491
|
+
// `A-Z`
|
|
22492
|
+
(code >= 65 && code <= 90) ||
|
|
22493
|
+
// `a-z`
|
|
22494
|
+
(code >= 97 && code <= 122) ||
|
|
22495
|
+
// `_`
|
|
22496
|
+
code === 95) {
|
|
22497
|
+
name += str[j++];
|
|
22498
|
+
continue;
|
|
22499
|
+
}
|
|
22500
|
+
break;
|
|
22501
|
+
}
|
|
22502
|
+
if (!name)
|
|
22503
|
+
throw new TypeError("Missing parameter name at " + i);
|
|
22504
|
+
tokens.push({ type: "NAME", index: i, value: name });
|
|
22505
|
+
i = j;
|
|
22506
|
+
continue;
|
|
22507
|
+
}
|
|
22508
|
+
if (char === "(") {
|
|
22509
|
+
var count = 1;
|
|
22510
|
+
var pattern = "";
|
|
22511
|
+
var j = i + 1;
|
|
22512
|
+
if (str[j] === "?") {
|
|
22513
|
+
throw new TypeError("Pattern cannot start with \"?\" at " + j);
|
|
22514
|
+
}
|
|
22515
|
+
while (j < str.length) {
|
|
22516
|
+
if (str[j] === "\\") {
|
|
22517
|
+
pattern += str[j++] + str[j++];
|
|
22518
|
+
continue;
|
|
22519
|
+
}
|
|
22520
|
+
if (str[j] === ")") {
|
|
22521
|
+
count--;
|
|
22522
|
+
if (count === 0) {
|
|
22523
|
+
j++;
|
|
22524
|
+
break;
|
|
22525
|
+
}
|
|
22526
|
+
}
|
|
22527
|
+
else if (str[j] === "(") {
|
|
22528
|
+
count++;
|
|
22529
|
+
if (str[j + 1] !== "?") {
|
|
22530
|
+
throw new TypeError("Capturing groups are not allowed at " + j);
|
|
22531
|
+
}
|
|
22532
|
+
}
|
|
22533
|
+
pattern += str[j++];
|
|
22534
|
+
}
|
|
22535
|
+
if (count)
|
|
22536
|
+
throw new TypeError("Unbalanced pattern at " + i);
|
|
22537
|
+
if (!pattern)
|
|
22538
|
+
throw new TypeError("Missing pattern at " + i);
|
|
22539
|
+
tokens.push({ type: "PATTERN", index: i, value: pattern });
|
|
22540
|
+
i = j;
|
|
22541
|
+
continue;
|
|
22542
|
+
}
|
|
22543
|
+
tokens.push({ type: "CHAR", index: i, value: str[i++] });
|
|
22544
|
+
}
|
|
22545
|
+
tokens.push({ type: "END", index: i, value: "" });
|
|
22546
|
+
return tokens;
|
|
22547
|
+
}
|
|
22548
|
+
/**
|
|
22549
|
+
* Parse a string for the raw tokens.
|
|
22550
|
+
*/
|
|
22551
|
+
function parse$2(str, options) {
|
|
22552
|
+
if (options === void 0) { options = {}; }
|
|
22553
|
+
var tokens = lexer(str);
|
|
22554
|
+
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
|
|
22555
|
+
var defaultPattern = "[^" + escapeString(options.delimiter || "/#?") + "]+?";
|
|
22556
|
+
var result = [];
|
|
22557
|
+
var key = 0;
|
|
22558
|
+
var i = 0;
|
|
22559
|
+
var path = "";
|
|
22560
|
+
var tryConsume = function (type) {
|
|
22561
|
+
if (i < tokens.length && tokens[i].type === type)
|
|
22562
|
+
return tokens[i++].value;
|
|
22563
|
+
};
|
|
22564
|
+
var mustConsume = function (type) {
|
|
22565
|
+
var value = tryConsume(type);
|
|
22566
|
+
if (value !== undefined)
|
|
22567
|
+
return value;
|
|
22568
|
+
var _a = tokens[i], nextType = _a.type, index = _a.index;
|
|
22569
|
+
throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type);
|
|
22570
|
+
};
|
|
22571
|
+
var consumeText = function () {
|
|
22572
|
+
var result = "";
|
|
22573
|
+
var value;
|
|
22574
|
+
// tslint:disable-next-line
|
|
22575
|
+
while ((value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR"))) {
|
|
22576
|
+
result += value;
|
|
22577
|
+
}
|
|
22578
|
+
return result;
|
|
22579
|
+
};
|
|
22580
|
+
while (i < tokens.length) {
|
|
22581
|
+
var char = tryConsume("CHAR");
|
|
22582
|
+
var name = tryConsume("NAME");
|
|
22583
|
+
var pattern = tryConsume("PATTERN");
|
|
22584
|
+
if (name || pattern) {
|
|
22585
|
+
var prefix = char || "";
|
|
22586
|
+
if (prefixes.indexOf(prefix) === -1) {
|
|
22587
|
+
path += prefix;
|
|
22588
|
+
prefix = "";
|
|
22589
|
+
}
|
|
22590
|
+
if (path) {
|
|
22591
|
+
result.push(path);
|
|
22592
|
+
path = "";
|
|
22593
|
+
}
|
|
22594
|
+
result.push({
|
|
22595
|
+
name: name || key++,
|
|
22596
|
+
prefix: prefix,
|
|
22597
|
+
suffix: "",
|
|
22598
|
+
pattern: pattern || defaultPattern,
|
|
22599
|
+
modifier: tryConsume("MODIFIER") || ""
|
|
22600
|
+
});
|
|
22601
|
+
continue;
|
|
22602
|
+
}
|
|
22603
|
+
var value = char || tryConsume("ESCAPED_CHAR");
|
|
22604
|
+
if (value) {
|
|
22605
|
+
path += value;
|
|
22606
|
+
continue;
|
|
22607
|
+
}
|
|
22608
|
+
if (path) {
|
|
22609
|
+
result.push(path);
|
|
22610
|
+
path = "";
|
|
22611
|
+
}
|
|
22612
|
+
var open = tryConsume("OPEN");
|
|
22613
|
+
if (open) {
|
|
22614
|
+
var prefix = consumeText();
|
|
22615
|
+
var name_1 = tryConsume("NAME") || "";
|
|
22616
|
+
var pattern_1 = tryConsume("PATTERN") || "";
|
|
22617
|
+
var suffix = consumeText();
|
|
22618
|
+
mustConsume("CLOSE");
|
|
22619
|
+
result.push({
|
|
22620
|
+
name: name_1 || (pattern_1 ? key++ : ""),
|
|
22621
|
+
pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
|
|
22622
|
+
prefix: prefix,
|
|
22623
|
+
suffix: suffix,
|
|
22624
|
+
modifier: tryConsume("MODIFIER") || ""
|
|
22625
|
+
});
|
|
22626
|
+
continue;
|
|
22627
|
+
}
|
|
22628
|
+
mustConsume("END");
|
|
22629
|
+
}
|
|
22630
|
+
return result;
|
|
22631
|
+
}
|
|
22632
|
+
dist.parse = parse$2;
|
|
22633
|
+
/**
|
|
22634
|
+
* Compile a string to a template function for the path.
|
|
22635
|
+
*/
|
|
22636
|
+
function compile(str, options) {
|
|
22637
|
+
return tokensToFunction(parse$2(str, options), options);
|
|
22638
|
+
}
|
|
22639
|
+
dist.compile = compile;
|
|
22640
|
+
/**
|
|
22641
|
+
* Expose a method for transforming tokens into the path function.
|
|
22642
|
+
*/
|
|
22643
|
+
function tokensToFunction(tokens, options) {
|
|
22644
|
+
if (options === void 0) { options = {}; }
|
|
22645
|
+
var reFlags = flags(options);
|
|
22646
|
+
var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
|
|
22647
|
+
// Compile all the tokens into regexps.
|
|
22648
|
+
var matches = tokens.map(function (token) {
|
|
22649
|
+
if (typeof token === "object") {
|
|
22650
|
+
return new RegExp("^(?:" + token.pattern + ")$", reFlags);
|
|
22651
|
+
}
|
|
22652
|
+
});
|
|
22653
|
+
return function (data) {
|
|
22654
|
+
var path = "";
|
|
22655
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
22656
|
+
var token = tokens[i];
|
|
22657
|
+
if (typeof token === "string") {
|
|
22658
|
+
path += token;
|
|
22659
|
+
continue;
|
|
22660
|
+
}
|
|
22661
|
+
var value = data ? data[token.name] : undefined;
|
|
22662
|
+
var optional = token.modifier === "?" || token.modifier === "*";
|
|
22663
|
+
var repeat = token.modifier === "*" || token.modifier === "+";
|
|
22664
|
+
if (Array.isArray(value)) {
|
|
22665
|
+
if (!repeat) {
|
|
22666
|
+
throw new TypeError("Expected \"" + token.name + "\" to not repeat, but got an array");
|
|
22667
|
+
}
|
|
22668
|
+
if (value.length === 0) {
|
|
22669
|
+
if (optional)
|
|
22670
|
+
continue;
|
|
22671
|
+
throw new TypeError("Expected \"" + token.name + "\" to not be empty");
|
|
22672
|
+
}
|
|
22673
|
+
for (var j = 0; j < value.length; j++) {
|
|
22674
|
+
var segment = encode(value[j], token);
|
|
22675
|
+
if (validate && !matches[i].test(segment)) {
|
|
22676
|
+
throw new TypeError("Expected all \"" + token.name + "\" to match \"" + token.pattern + "\", but got \"" + segment + "\"");
|
|
22677
|
+
}
|
|
22678
|
+
path += token.prefix + segment + token.suffix;
|
|
22679
|
+
}
|
|
22680
|
+
continue;
|
|
22681
|
+
}
|
|
22682
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
22683
|
+
var segment = encode(String(value), token);
|
|
22684
|
+
if (validate && !matches[i].test(segment)) {
|
|
22685
|
+
throw new TypeError("Expected \"" + token.name + "\" to match \"" + token.pattern + "\", but got \"" + segment + "\"");
|
|
22686
|
+
}
|
|
22687
|
+
path += token.prefix + segment + token.suffix;
|
|
22688
|
+
continue;
|
|
22689
|
+
}
|
|
22690
|
+
if (optional)
|
|
22691
|
+
continue;
|
|
22692
|
+
var typeOfMessage = repeat ? "an array" : "a string";
|
|
22693
|
+
throw new TypeError("Expected \"" + token.name + "\" to be " + typeOfMessage);
|
|
22694
|
+
}
|
|
22695
|
+
return path;
|
|
22696
|
+
};
|
|
22697
|
+
}
|
|
22698
|
+
dist.tokensToFunction = tokensToFunction;
|
|
22699
|
+
/**
|
|
22700
|
+
* Create path match function from `path-to-regexp` spec.
|
|
22701
|
+
*/
|
|
22702
|
+
function match(str, options) {
|
|
22703
|
+
var keys = [];
|
|
22704
|
+
var re = pathToRegexp(str, keys, options);
|
|
22705
|
+
return regexpToFunction(re, keys, options);
|
|
22706
|
+
}
|
|
22707
|
+
var match_1 = dist.match = match;
|
|
22708
|
+
/**
|
|
22709
|
+
* Create a path match function from `path-to-regexp` output.
|
|
22710
|
+
*/
|
|
22711
|
+
function regexpToFunction(re, keys, options) {
|
|
22712
|
+
if (options === void 0) { options = {}; }
|
|
22713
|
+
var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;
|
|
22714
|
+
return function (pathname) {
|
|
22715
|
+
var m = re.exec(pathname);
|
|
22716
|
+
if (!m)
|
|
22717
|
+
return false;
|
|
22718
|
+
var path = m[0], index = m.index;
|
|
22719
|
+
var params = Object.create(null);
|
|
22720
|
+
var _loop_1 = function (i) {
|
|
22721
|
+
// tslint:disable-next-line
|
|
22722
|
+
if (m[i] === undefined)
|
|
22723
|
+
return "continue";
|
|
22724
|
+
var key = keys[i - 1];
|
|
22725
|
+
if (key.modifier === "*" || key.modifier === "+") {
|
|
22726
|
+
params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {
|
|
22727
|
+
return decode(value, key);
|
|
22728
|
+
});
|
|
22729
|
+
}
|
|
22730
|
+
else {
|
|
22731
|
+
params[key.name] = decode(m[i], key);
|
|
22732
|
+
}
|
|
22733
|
+
};
|
|
22734
|
+
for (var i = 1; i < m.length; i++) {
|
|
22735
|
+
_loop_1(i);
|
|
22736
|
+
}
|
|
22737
|
+
return { path: path, index: index, params: params };
|
|
22738
|
+
};
|
|
22739
|
+
}
|
|
22740
|
+
dist.regexpToFunction = regexpToFunction;
|
|
22741
|
+
/**
|
|
22742
|
+
* Escape a regular expression string.
|
|
22743
|
+
*/
|
|
22744
|
+
function escapeString(str) {
|
|
22745
|
+
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
22746
|
+
}
|
|
22747
|
+
/**
|
|
22748
|
+
* Get the flags for a regexp from the options.
|
|
22749
|
+
*/
|
|
22750
|
+
function flags(options) {
|
|
22751
|
+
return options && options.sensitive ? "" : "i";
|
|
22752
|
+
}
|
|
22753
|
+
/**
|
|
22754
|
+
* Pull out keys from a regexp.
|
|
22755
|
+
*/
|
|
22756
|
+
function regexpToRegexp(path, keys) {
|
|
22757
|
+
if (!keys)
|
|
22758
|
+
return path;
|
|
22759
|
+
var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
22760
|
+
var index = 0;
|
|
22761
|
+
var execResult = groupsRegex.exec(path.source);
|
|
22762
|
+
while (execResult) {
|
|
22763
|
+
keys.push({
|
|
22764
|
+
// Use parenthesized substring match if available, index otherwise
|
|
22765
|
+
name: execResult[1] || index++,
|
|
22766
|
+
prefix: "",
|
|
22767
|
+
suffix: "",
|
|
22768
|
+
modifier: "",
|
|
22769
|
+
pattern: ""
|
|
22770
|
+
});
|
|
22771
|
+
execResult = groupsRegex.exec(path.source);
|
|
22772
|
+
}
|
|
22773
|
+
return path;
|
|
22774
|
+
}
|
|
22775
|
+
/**
|
|
22776
|
+
* Transform an array into a regexp.
|
|
22777
|
+
*/
|
|
22778
|
+
function arrayToRegexp(paths, keys, options) {
|
|
22779
|
+
var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });
|
|
22780
|
+
return new RegExp("(?:" + parts.join("|") + ")", flags(options));
|
|
22781
|
+
}
|
|
22782
|
+
/**
|
|
22783
|
+
* Create a path regexp from string input.
|
|
22784
|
+
*/
|
|
22785
|
+
function stringToRegexp(path, keys, options) {
|
|
22786
|
+
return tokensToRegexp(parse$2(path, options), keys, options);
|
|
22787
|
+
}
|
|
22788
|
+
/**
|
|
22789
|
+
* Expose a function for taking tokens and returning a RegExp.
|
|
22790
|
+
*/
|
|
22791
|
+
function tokensToRegexp(tokens, keys, options) {
|
|
22792
|
+
if (options === void 0) { options = {}; }
|
|
22793
|
+
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d;
|
|
22794
|
+
var endsWith = "[" + escapeString(options.endsWith || "") + "]|$";
|
|
22795
|
+
var delimiter = "[" + escapeString(options.delimiter || "/#?") + "]";
|
|
22796
|
+
var route = start ? "^" : "";
|
|
22797
|
+
// Iterate over the tokens and create our regexp string.
|
|
22798
|
+
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
|
22799
|
+
var token = tokens_1[_i];
|
|
22800
|
+
if (typeof token === "string") {
|
|
22801
|
+
route += escapeString(encode(token));
|
|
22802
|
+
}
|
|
22803
|
+
else {
|
|
22804
|
+
var prefix = escapeString(encode(token.prefix));
|
|
22805
|
+
var suffix = escapeString(encode(token.suffix));
|
|
22806
|
+
if (token.pattern) {
|
|
22807
|
+
if (keys)
|
|
22808
|
+
keys.push(token);
|
|
22809
|
+
if (prefix || suffix) {
|
|
22810
|
+
if (token.modifier === "+" || token.modifier === "*") {
|
|
22811
|
+
var mod = token.modifier === "*" ? "?" : "";
|
|
22812
|
+
route += "(?:" + prefix + "((?:" + token.pattern + ")(?:" + suffix + prefix + "(?:" + token.pattern + "))*)" + suffix + ")" + mod;
|
|
22813
|
+
}
|
|
22814
|
+
else {
|
|
22815
|
+
route += "(?:" + prefix + "(" + token.pattern + ")" + suffix + ")" + token.modifier;
|
|
22816
|
+
}
|
|
22817
|
+
}
|
|
22818
|
+
else {
|
|
22819
|
+
route += "(" + token.pattern + ")" + token.modifier;
|
|
22820
|
+
}
|
|
22821
|
+
}
|
|
22822
|
+
else {
|
|
22823
|
+
route += "(?:" + prefix + suffix + ")" + token.modifier;
|
|
22824
|
+
}
|
|
22825
|
+
}
|
|
22826
|
+
}
|
|
22827
|
+
if (end) {
|
|
22828
|
+
if (!strict)
|
|
22829
|
+
route += delimiter + "?";
|
|
22830
|
+
route += !options.endsWith ? "$" : "(?=" + endsWith + ")";
|
|
22831
|
+
}
|
|
22832
|
+
else {
|
|
22833
|
+
var endToken = tokens[tokens.length - 1];
|
|
22834
|
+
var isEndDelimited = typeof endToken === "string"
|
|
22835
|
+
? delimiter.indexOf(endToken[endToken.length - 1]) > -1
|
|
22836
|
+
: // tslint:disable-next-line
|
|
22837
|
+
endToken === undefined;
|
|
22838
|
+
if (!strict) {
|
|
22839
|
+
route += "(?:" + delimiter + "(?=" + endsWith + "))?";
|
|
22840
|
+
}
|
|
22841
|
+
if (!isEndDelimited) {
|
|
22842
|
+
route += "(?=" + delimiter + "|" + endsWith + ")";
|
|
22843
|
+
}
|
|
22844
|
+
}
|
|
22845
|
+
return new RegExp(route, flags(options));
|
|
22846
|
+
}
|
|
22847
|
+
dist.tokensToRegexp = tokensToRegexp;
|
|
22848
|
+
/**
|
|
22849
|
+
* Normalize the given path string, returning a regular expression.
|
|
22850
|
+
*
|
|
22851
|
+
* An empty array can be passed in for the keys, which will hold the
|
|
22852
|
+
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
22853
|
+
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
22854
|
+
*/
|
|
22855
|
+
function pathToRegexp(path, keys, options) {
|
|
22856
|
+
if (path instanceof RegExp)
|
|
22857
|
+
return regexpToRegexp(path, keys);
|
|
22858
|
+
if (Array.isArray(path))
|
|
22859
|
+
return arrayToRegexp(path, keys, options);
|
|
22860
|
+
return stringToRegexp(path, keys, options);
|
|
22861
|
+
}
|
|
22862
|
+
dist.pathToRegexp = pathToRegexp;
|
|
22481
22863
|
|
|
22482
22864
|
var getCleanUrl$1 = {};
|
|
22483
22865
|
|
|
@@ -22512,9 +22894,12 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22512
22894
|
return path;
|
|
22513
22895
|
}
|
|
22514
22896
|
// Resolve a relative request URL against a given custom "baseUrl"
|
|
22515
|
-
// or the
|
|
22516
|
-
const origin = baseUrl || (typeof
|
|
22517
|
-
return origin
|
|
22897
|
+
// or the document baseURI (in the case of browser/browser-like environments).
|
|
22898
|
+
const origin = baseUrl || (typeof document !== 'undefined' && document.baseURI);
|
|
22899
|
+
return origin
|
|
22900
|
+
? // Encode and decode the path to preserve escaped characters.
|
|
22901
|
+
decodeURI(new URL(encodeURI(path), origin).href)
|
|
22902
|
+
: path;
|
|
22518
22903
|
}
|
|
22519
22904
|
|
|
22520
22905
|
/**
|
|
@@ -22533,12 +22918,48 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22533
22918
|
return cleanUrl(maybeAbsoluteUrl);
|
|
22534
22919
|
}
|
|
22535
22920
|
|
|
22921
|
+
/**
|
|
22922
|
+
* Coerce a path supported by MSW into a path
|
|
22923
|
+
* supported by "path-to-regexp".
|
|
22924
|
+
*/
|
|
22925
|
+
function coercePath(path) {
|
|
22926
|
+
return (path
|
|
22927
|
+
/**
|
|
22928
|
+
* Replace wildcards ("*") with unnamed capturing groups
|
|
22929
|
+
* because "path-to-regexp" doesn't support wildcards.
|
|
22930
|
+
* Ignore path parameter' modifiers (i.e. ":name*").
|
|
22931
|
+
*/
|
|
22932
|
+
.replace(/([:a-zA-Z_-]*)(\*{1,2})+/g, (_, parameterName, wildcard) => {
|
|
22933
|
+
const expression = '(.*)';
|
|
22934
|
+
if (!parameterName) {
|
|
22935
|
+
return expression;
|
|
22936
|
+
}
|
|
22937
|
+
return parameterName.startsWith(':')
|
|
22938
|
+
? `${parameterName}${wildcard}`
|
|
22939
|
+
: `${parameterName}${expression}`;
|
|
22940
|
+
})
|
|
22941
|
+
/**
|
|
22942
|
+
* Escape the protocol so that "path-to-regexp" could match
|
|
22943
|
+
* absolute URL.
|
|
22944
|
+
* @see https://github.com/pillarjs/path-to-regexp/issues/259
|
|
22945
|
+
*/
|
|
22946
|
+
.replace(/^([^\/]+)(:)(?=\/\/)/g, '$1\\$2'));
|
|
22947
|
+
}
|
|
22536
22948
|
/**
|
|
22537
22949
|
* Returns the result of matching given request URL against a mask.
|
|
22538
22950
|
*/
|
|
22539
22951
|
function matchRequestUrl(url, path, baseUrl) {
|
|
22540
22952
|
const normalizedPath = normalizePath(path, baseUrl);
|
|
22541
|
-
|
|
22953
|
+
const cleanPath = typeof normalizedPath === 'string'
|
|
22954
|
+
? coercePath(normalizedPath)
|
|
22955
|
+
: normalizedPath;
|
|
22956
|
+
const cleanUrl = getCleanUrl_2(url);
|
|
22957
|
+
const result = match_1(cleanPath, { decode: decodeURIComponent })(cleanUrl);
|
|
22958
|
+
const params = (result && result.params) || {};
|
|
22959
|
+
return {
|
|
22960
|
+
matches: result !== false,
|
|
22961
|
+
params,
|
|
22962
|
+
};
|
|
22542
22963
|
}
|
|
22543
22964
|
|
|
22544
22965
|
/**
|
|
@@ -22566,7 +22987,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22566
22987
|
function createResponseComposition(responseOverrides, defaultTransformers = defaultResponseTransformers) {
|
|
22567
22988
|
return (...transformers) => __awaiter$3(this, void 0, void 0, function* () {
|
|
22568
22989
|
const initialResponse = Object.assign({}, defaultResponse, {
|
|
22569
|
-
headers: new lib$
|
|
22990
|
+
headers: new lib$6.Headers({
|
|
22570
22991
|
'x-powered-by': 'msw',
|
|
22571
22992
|
}),
|
|
22572
22993
|
}, responseOverrides);
|
|
@@ -22587,18 +23008,21 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22587
23008
|
},
|
|
22588
23009
|
});
|
|
22589
23010
|
|
|
23011
|
+
const BUILD_FRAME = /(node_modules)?[\/\\]lib[\/\\](umd|esm|iief|cjs)[\/\\]|^[^\/\\]*$/;
|
|
22590
23012
|
/**
|
|
22591
23013
|
* Return the stack trace frame of a function's invocation.
|
|
22592
23014
|
*/
|
|
22593
|
-
function getCallFrame() {
|
|
23015
|
+
function getCallFrame(error) {
|
|
22594
23016
|
// In <IE11, new Error may return an undefined stack
|
|
22595
|
-
const stack =
|
|
22596
|
-
|
|
23017
|
+
const stack = error.stack;
|
|
23018
|
+
if (!stack) {
|
|
23019
|
+
return;
|
|
23020
|
+
}
|
|
23021
|
+
const frames = stack.split('\n').slice(1);
|
|
22597
23022
|
// Get the first frame that doesn't reference the library's internal trace.
|
|
22598
23023
|
// Assume that frame is the invocation frame.
|
|
22599
|
-
const
|
|
22600
|
-
|
|
22601
|
-
return !ignoreFrameRegExp.test(frame);
|
|
23024
|
+
const declarationFrame = frames.find((frame) => {
|
|
23025
|
+
return !BUILD_FRAME.test(frame);
|
|
22602
23026
|
});
|
|
22603
23027
|
if (!declarationFrame) {
|
|
22604
23028
|
return;
|
|
@@ -22631,7 +23055,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22631
23055
|
this.shouldSkip = false;
|
|
22632
23056
|
this.ctx = options.ctx || defaultContext;
|
|
22633
23057
|
this.resolver = options.resolver;
|
|
22634
|
-
const callFrame = getCallFrame();
|
|
23058
|
+
const callFrame = getCallFrame(new Error());
|
|
22635
23059
|
this.info = Object.assign(Object.assign({}, options.info), { callFrame });
|
|
22636
23060
|
}
|
|
22637
23061
|
/**
|
|
@@ -22758,21 +23182,9 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22758
23182
|
return;
|
|
22759
23183
|
}
|
|
22760
23184
|
const searchParams = getSearchParams(path);
|
|
22761
|
-
const queryParams = [];
|
|
22762
23185
|
searchParams.forEach((_, paramName) => {
|
|
22763
|
-
queryParams.push(paramName);
|
|
22764
23186
|
});
|
|
22765
|
-
devUtils.warn(
|
|
22766
|
-
Found a redundant usage of query parameters in the request handler URL for "${method} ${path}". Please match against a path instead, and access query parameters in the response resolver function:
|
|
22767
|
-
|
|
22768
|
-
rest.${method.toLowerCase()}("${url}", (req, res, ctx) => {
|
|
22769
|
-
const query = req.url.searchParams
|
|
22770
|
-
${queryParams
|
|
22771
|
-
.map((paramName) => `\
|
|
22772
|
-
const ${paramName} = query.get("${paramName}")`)
|
|
22773
|
-
.join('\n')}
|
|
22774
|
-
})\
|
|
22775
|
-
`);
|
|
23187
|
+
devUtils.warn(`Found a redundant usage of query parameters in the request handler URL for "${method} ${path}". Please match against a path instead and access query parameters in the response resolver function using "req.url.searchParams".`);
|
|
22776
23188
|
}
|
|
22777
23189
|
parse(request, resolutionContext) {
|
|
22778
23190
|
return matchRequestUrl(request.url, this.info.path, resolutionContext === null || resolutionContext === void 0 ? void 0 : resolutionContext.baseUrl);
|
|
@@ -22781,7 +23193,11 @@ ${queryParams
|
|
|
22781
23193
|
return Object.assign(Object.assign({}, request), { params: parsedResult.params || {} });
|
|
22782
23194
|
}
|
|
22783
23195
|
predicate(request, parsedResult) {
|
|
22784
|
-
|
|
23196
|
+
const matchesMethod = this.info.method instanceof RegExp
|
|
23197
|
+
? this.info.method.test(request.method)
|
|
23198
|
+
: isStringEqual(this.info.method, request.method);
|
|
23199
|
+
// console.log({ request, matchesMethod, parsedResult })
|
|
23200
|
+
return matchesMethod && parsedResult.matches;
|
|
22785
23201
|
}
|
|
22786
23202
|
log(request, response) {
|
|
22787
23203
|
const publicUrl = getPublicUrlFromRequest(request);
|
|
@@ -22815,6 +23231,7 @@ ${queryParams
|
|
|
22815
23231
|
delay,
|
|
22816
23232
|
fetch: fetch$1,
|
|
22817
23233
|
data,
|
|
23234
|
+
extensions,
|
|
22818
23235
|
errors,
|
|
22819
23236
|
cookie,
|
|
22820
23237
|
};
|
|
@@ -22861,10 +23278,10 @@ ${queryParams
|
|
|
22861
23278
|
if (!parsedResult) {
|
|
22862
23279
|
return false;
|
|
22863
23280
|
}
|
|
22864
|
-
if (!parsedResult.operationName) {
|
|
23281
|
+
if (!parsedResult.operationName && this.info.operationType !== 'all') {
|
|
22865
23282
|
const publicUrl = getPublicUrlFromRequest(request);
|
|
22866
23283
|
devUtils.warn(`\
|
|
22867
|
-
Failed to intercept a GraphQL request at "${request.method} ${publicUrl}":
|
|
23284
|
+
Failed to intercept a GraphQL request at "${request.method} ${publicUrl}": anonymous GraphQL operations are not supported.
|
|
22868
23285
|
|
|
22869
23286
|
Consider naming this operation or using "graphql.operation" request handler to intercept GraphQL requests regardless of their operation name/type. Read more: https://mswjs.io/docs/api/graphql/operation\
|
|
22870
23287
|
`);
|
|
@@ -22874,7 +23291,7 @@ Consider naming this operation or using "graphql.operation" request handler to i
|
|
|
22874
23291
|
const hasMatchingOperationType = this.info.operationType === 'all' ||
|
|
22875
23292
|
parsedResult.operationType === this.info.operationType;
|
|
22876
23293
|
const hasMatchingOperationName = this.info.operationName instanceof RegExp
|
|
22877
|
-
? this.info.operationName.test(parsedResult.operationName)
|
|
23294
|
+
? this.info.operationName.test(parsedResult.operationName || '')
|
|
22878
23295
|
: parsedResult.operationName === this.info.operationName;
|
|
22879
23296
|
return (hasMatchingUrl.matches &&
|
|
22880
23297
|
hasMatchingOperationType &&
|
|
@@ -22884,7 +23301,10 @@ Consider naming this operation or using "graphql.operation" request handler to i
|
|
|
22884
23301
|
const loggedRequest = prepareRequest(request);
|
|
22885
23302
|
const loggedResponse = prepareResponse(response);
|
|
22886
23303
|
const statusColor = getStatusCodeColor(response.status);
|
|
22887
|
-
|
|
23304
|
+
const requestInfo = (parsedRequest === null || parsedRequest === void 0 ? void 0 : parsedRequest.operationName)
|
|
23305
|
+
? `${parsedRequest === null || parsedRequest === void 0 ? void 0 : parsedRequest.operationType} ${parsedRequest === null || parsedRequest === void 0 ? void 0 : parsedRequest.operationName}`
|
|
23306
|
+
: `anonymous ${parsedRequest === null || parsedRequest === void 0 ? void 0 : parsedRequest.operationType}`;
|
|
23307
|
+
console.groupCollapsed(devUtils.formatMessage('%s %s (%c%s%c)'), getTimestamp(), `${requestInfo}`, `color:${statusColor}`, `${response.status} ${response.statusText}`, 'color:inherit');
|
|
22888
23308
|
console.log('Request:', loggedRequest);
|
|
22889
23309
|
console.log('Handler:', this);
|
|
22890
23310
|
console.log('Response:', loggedResponse);
|
|
@@ -22998,8 +23418,10 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
|
|
|
22998
23418
|
const message = messageTemplate.join('\n\n');
|
|
22999
23419
|
switch (strategy) {
|
|
23000
23420
|
case 'error': {
|
|
23421
|
+
// Print a developer-friendly error.
|
|
23001
23422
|
devUtils.error('Error: %s', message);
|
|
23002
|
-
|
|
23423
|
+
// Throw an exception to halt request processing and not perform the original request.
|
|
23424
|
+
throw new Error('Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.');
|
|
23003
23425
|
}
|
|
23004
23426
|
case 'warn': {
|
|
23005
23427
|
devUtils.warn('Warning: %s', message);
|
|
@@ -23013,8 +23435,8 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
|
|
|
23013
23435
|
}
|
|
23014
23436
|
|
|
23015
23437
|
function readResponseCookies(request, response) {
|
|
23016
|
-
lib$
|
|
23017
|
-
lib$
|
|
23438
|
+
lib$1.store.add(Object.assign(Object.assign({}, request), { url: request.url.toString() }), response);
|
|
23439
|
+
lib$1.store.persist();
|
|
23018
23440
|
}
|
|
23019
23441
|
|
|
23020
23442
|
function handleRequest(request, handlers, options, emitter, handleRequestOptions) {
|
|
@@ -23042,7 +23464,12 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
|
|
|
23042
23464
|
// When the handled request returned no mocked response, warn the developer,
|
|
23043
23465
|
// as it may be an oversight on their part. Perform the request as-is.
|
|
23044
23466
|
if (!response) {
|
|
23045
|
-
devUtils.warn(
|
|
23467
|
+
devUtils.warn(`\
|
|
23468
|
+
Expected response resolver to return a mocked response Object, but got %s. The original response is going to be used instead.\
|
|
23469
|
+
\n
|
|
23470
|
+
\u2022 %s
|
|
23471
|
+
%s\
|
|
23472
|
+
`, response, handler.info.header, handler.info.callFrame);
|
|
23046
23473
|
emitter.emit('request:end', request);
|
|
23047
23474
|
(_c = handleRequestOptions === null || handleRequestOptions === void 0 ? void 0 : handleRequestOptions.onBypassResponse) === null || _c === void 0 ? void 0 : _c.call(handleRequestOptions, request);
|
|
23048
23475
|
return;
|
|
@@ -23129,8 +23556,8 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
|
|
|
23129
23556
|
const { payload: actualChecksum } = yield context.events.once('INTEGRITY_CHECK_RESPONSE');
|
|
23130
23557
|
// Compare the response from the Service Worker and the
|
|
23131
23558
|
// global variable set by Rollup during the build.
|
|
23132
|
-
if (actualChecksum !== "
|
|
23133
|
-
throw new Error(`Currently active Service Worker (${actualChecksum}) is behind the latest published one (${"
|
|
23559
|
+
if (actualChecksum !== "02f4ad4a2797f85668baf196e553d929") {
|
|
23560
|
+
throw new Error(`Currently active Service Worker (${actualChecksum}) is behind the latest published one (${"02f4ad4a2797f85668baf196e553d929"}).`);
|
|
23134
23561
|
}
|
|
23135
23562
|
return serviceWorker;
|
|
23136
23563
|
});
|
|
@@ -23147,7 +23574,7 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
|
|
|
23147
23574
|
window.XMLHttpRequest.prototype.send = function (...args) {
|
|
23148
23575
|
// Keep this function synchronous to comply with `XMLHttpRequest.prototype.send`,
|
|
23149
23576
|
// because that method is always synchronous.
|
|
23150
|
-
until
|
|
23577
|
+
until(() => predicatePromise).then(() => {
|
|
23151
23578
|
window.XMLHttpRequest.prototype.send = originalXhrSend;
|
|
23152
23579
|
this.send(...args);
|
|
23153
23580
|
});
|
|
@@ -23155,7 +23582,7 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
|
|
|
23155
23582
|
// Defer any `fetch` requests until the Service Worker is ready.
|
|
23156
23583
|
const originalFetch = window.fetch;
|
|
23157
23584
|
window.fetch = (...args) => __awaiter$3(this, void 0, void 0, function* () {
|
|
23158
|
-
yield until
|
|
23585
|
+
yield until(() => predicatePromise);
|
|
23159
23586
|
window.fetch = originalFetch;
|
|
23160
23587
|
return window.fetch(...args);
|
|
23161
23588
|
});
|
|
@@ -23238,7 +23665,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
23238
23665
|
window.clearInterval(context.keepAliveInterval);
|
|
23239
23666
|
});
|
|
23240
23667
|
// Check if the active Service Worker is the latest published one
|
|
23241
|
-
const [integrityError] = yield until
|
|
23668
|
+
const [integrityError] = yield until(() => requestIntegrityCheck(context, worker));
|
|
23242
23669
|
if (integrityError) {
|
|
23243
23670
|
devUtils.error(`\
|
|
23244
23671
|
Detected outdated Service Worker: ${integrityError.message}
|
|
@@ -23279,16 +23706,14 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
23279
23706
|
}
|
|
23280
23707
|
|
|
23281
23708
|
const createStop = (context) => {
|
|
23282
|
-
/**
|
|
23283
|
-
* Signal the Service Worker to disable mocking for this client.
|
|
23284
|
-
* Use this an an explicit way to stop the mocking, while preserving
|
|
23285
|
-
* the worker-client relation. Does not affect the worker's lifecycle.
|
|
23286
|
-
*/
|
|
23287
23709
|
return function stop() {
|
|
23288
23710
|
var _a;
|
|
23711
|
+
/**
|
|
23712
|
+
* Signal the Service Worker to disable mocking for this client.
|
|
23713
|
+
* Use this an an explicit way to stop the mocking, while preserving
|
|
23714
|
+
* the worker-client relation. Does not affect the worker's lifecycle.
|
|
23715
|
+
*/
|
|
23289
23716
|
context.workerChannel.send('MOCK_DEACTIVATE');
|
|
23290
|
-
context.events.removeAllListeners();
|
|
23291
|
-
context.emitter.removeAllListeners();
|
|
23292
23717
|
window.clearInterval(context.keepAliveInterval);
|
|
23293
23718
|
printStopMessage({ quiet: (_a = context.startOptions) === null || _a === void 0 ? void 0 : _a.quiet });
|
|
23294
23719
|
};
|
|
@@ -23332,1253 +23757,43 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
23332
23757
|
};
|
|
23333
23758
|
}
|
|
23334
23759
|
|
|
23335
|
-
var lib
|
|
23760
|
+
var lib = {};
|
|
23336
23761
|
|
|
23337
23762
|
var createInterceptor$1 = {};
|
|
23338
23763
|
|
|
23339
|
-
|
|
23340
|
-
|
|
23341
|
-
var
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23350
|
-
|
|
23351
|
-
|
|
23352
|
-
|
|
23353
|
-
|
|
23354
|
-
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
.concat(Object.getOwnPropertySymbols(target));
|
|
23359
|
-
};
|
|
23360
|
-
} else {
|
|
23361
|
-
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
23362
|
-
return Object.getOwnPropertyNames(target);
|
|
23363
|
-
};
|
|
23364
|
-
}
|
|
23365
|
-
|
|
23366
|
-
function ProcessEmitWarning(warning) {
|
|
23367
|
-
if (console && console.warn) console.warn(warning);
|
|
23368
|
-
}
|
|
23369
|
-
|
|
23370
|
-
var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
|
|
23371
|
-
return value !== value;
|
|
23372
|
-
};
|
|
23373
|
-
|
|
23374
|
-
function EventEmitter() {
|
|
23375
|
-
EventEmitter.init.call(this);
|
|
23376
|
-
}
|
|
23377
|
-
events.exports = EventEmitter;
|
|
23378
|
-
events.exports.once = once;
|
|
23379
|
-
|
|
23380
|
-
// Backwards-compat with node 0.10.x
|
|
23381
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
23382
|
-
|
|
23383
|
-
EventEmitter.prototype._events = undefined;
|
|
23384
|
-
EventEmitter.prototype._eventsCount = 0;
|
|
23385
|
-
EventEmitter.prototype._maxListeners = undefined;
|
|
23386
|
-
|
|
23387
|
-
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
23388
|
-
// added to it. This is a useful default which helps finding memory leaks.
|
|
23389
|
-
var defaultMaxListeners = 10;
|
|
23390
|
-
|
|
23391
|
-
function checkListener(listener) {
|
|
23392
|
-
if (typeof listener !== 'function') {
|
|
23393
|
-
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
23394
|
-
}
|
|
23395
|
-
}
|
|
23396
|
-
|
|
23397
|
-
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
|
23398
|
-
enumerable: true,
|
|
23399
|
-
get: function() {
|
|
23400
|
-
return defaultMaxListeners;
|
|
23401
|
-
},
|
|
23402
|
-
set: function(arg) {
|
|
23403
|
-
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
|
23404
|
-
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
|
23405
|
-
}
|
|
23406
|
-
defaultMaxListeners = arg;
|
|
23407
|
-
}
|
|
23408
|
-
});
|
|
23409
|
-
|
|
23410
|
-
EventEmitter.init = function() {
|
|
23411
|
-
|
|
23412
|
-
if (this._events === undefined ||
|
|
23413
|
-
this._events === Object.getPrototypeOf(this)._events) {
|
|
23414
|
-
this._events = Object.create(null);
|
|
23415
|
-
this._eventsCount = 0;
|
|
23416
|
-
}
|
|
23417
|
-
|
|
23418
|
-
this._maxListeners = this._maxListeners || undefined;
|
|
23419
|
-
};
|
|
23420
|
-
|
|
23421
|
-
// Obviously not all Emitters should be limited to 10. This function allows
|
|
23422
|
-
// that to be increased. Set to zero for unlimited.
|
|
23423
|
-
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
23424
|
-
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
|
|
23425
|
-
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
|
|
23426
|
-
}
|
|
23427
|
-
this._maxListeners = n;
|
|
23428
|
-
return this;
|
|
23429
|
-
};
|
|
23430
|
-
|
|
23431
|
-
function _getMaxListeners(that) {
|
|
23432
|
-
if (that._maxListeners === undefined)
|
|
23433
|
-
return EventEmitter.defaultMaxListeners;
|
|
23434
|
-
return that._maxListeners;
|
|
23435
|
-
}
|
|
23436
|
-
|
|
23437
|
-
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
23438
|
-
return _getMaxListeners(this);
|
|
23439
|
-
};
|
|
23440
|
-
|
|
23441
|
-
EventEmitter.prototype.emit = function emit(type) {
|
|
23442
|
-
var args = [];
|
|
23443
|
-
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
23444
|
-
var doError = (type === 'error');
|
|
23445
|
-
|
|
23446
|
-
var events = this._events;
|
|
23447
|
-
if (events !== undefined)
|
|
23448
|
-
doError = (doError && events.error === undefined);
|
|
23449
|
-
else if (!doError)
|
|
23450
|
-
return false;
|
|
23451
|
-
|
|
23452
|
-
// If there is no 'error' event listener then throw.
|
|
23453
|
-
if (doError) {
|
|
23454
|
-
var er;
|
|
23455
|
-
if (args.length > 0)
|
|
23456
|
-
er = args[0];
|
|
23457
|
-
if (er instanceof Error) {
|
|
23458
|
-
// Note: The comments on the `throw` lines are intentional, they show
|
|
23459
|
-
// up in Node's output if this results in an unhandled exception.
|
|
23460
|
-
throw er; // Unhandled 'error' event
|
|
23461
|
-
}
|
|
23462
|
-
// At least give some kind of context to the user
|
|
23463
|
-
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
|
|
23464
|
-
err.context = er;
|
|
23465
|
-
throw err; // Unhandled 'error' event
|
|
23466
|
-
}
|
|
23467
|
-
|
|
23468
|
-
var handler = events[type];
|
|
23469
|
-
|
|
23470
|
-
if (handler === undefined)
|
|
23471
|
-
return false;
|
|
23472
|
-
|
|
23473
|
-
if (typeof handler === 'function') {
|
|
23474
|
-
ReflectApply(handler, this, args);
|
|
23475
|
-
} else {
|
|
23476
|
-
var len = handler.length;
|
|
23477
|
-
var listeners = arrayClone(handler, len);
|
|
23478
|
-
for (var i = 0; i < len; ++i)
|
|
23479
|
-
ReflectApply(listeners[i], this, args);
|
|
23480
|
-
}
|
|
23481
|
-
|
|
23482
|
-
return true;
|
|
23483
|
-
};
|
|
23484
|
-
|
|
23485
|
-
function _addListener(target, type, listener, prepend) {
|
|
23486
|
-
var m;
|
|
23487
|
-
var events;
|
|
23488
|
-
var existing;
|
|
23489
|
-
|
|
23490
|
-
checkListener(listener);
|
|
23491
|
-
|
|
23492
|
-
events = target._events;
|
|
23493
|
-
if (events === undefined) {
|
|
23494
|
-
events = target._events = Object.create(null);
|
|
23495
|
-
target._eventsCount = 0;
|
|
23496
|
-
} else {
|
|
23497
|
-
// To avoid recursion in the case that type === "newListener"! Before
|
|
23498
|
-
// adding it to the listeners, first emit "newListener".
|
|
23499
|
-
if (events.newListener !== undefined) {
|
|
23500
|
-
target.emit('newListener', type,
|
|
23501
|
-
listener.listener ? listener.listener : listener);
|
|
23502
|
-
|
|
23503
|
-
// Re-assign `events` because a newListener handler could have caused the
|
|
23504
|
-
// this._events to be assigned to a new object
|
|
23505
|
-
events = target._events;
|
|
23506
|
-
}
|
|
23507
|
-
existing = events[type];
|
|
23508
|
-
}
|
|
23509
|
-
|
|
23510
|
-
if (existing === undefined) {
|
|
23511
|
-
// Optimize the case of one listener. Don't need the extra array object.
|
|
23512
|
-
existing = events[type] = listener;
|
|
23513
|
-
++target._eventsCount;
|
|
23514
|
-
} else {
|
|
23515
|
-
if (typeof existing === 'function') {
|
|
23516
|
-
// Adding the second element, need to change to array.
|
|
23517
|
-
existing = events[type] =
|
|
23518
|
-
prepend ? [listener, existing] : [existing, listener];
|
|
23519
|
-
// If we've already got an array, just append.
|
|
23520
|
-
} else if (prepend) {
|
|
23521
|
-
existing.unshift(listener);
|
|
23522
|
-
} else {
|
|
23523
|
-
existing.push(listener);
|
|
23524
|
-
}
|
|
23525
|
-
|
|
23526
|
-
// Check for listener leak
|
|
23527
|
-
m = _getMaxListeners(target);
|
|
23528
|
-
if (m > 0 && existing.length > m && !existing.warned) {
|
|
23529
|
-
existing.warned = true;
|
|
23530
|
-
// No error code for this since it is a Warning
|
|
23531
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
23532
|
-
var w = new Error('Possible EventEmitter memory leak detected. ' +
|
|
23533
|
-
existing.length + ' ' + String(type) + ' listeners ' +
|
|
23534
|
-
'added. Use emitter.setMaxListeners() to ' +
|
|
23535
|
-
'increase limit');
|
|
23536
|
-
w.name = 'MaxListenersExceededWarning';
|
|
23537
|
-
w.emitter = target;
|
|
23538
|
-
w.type = type;
|
|
23539
|
-
w.count = existing.length;
|
|
23540
|
-
ProcessEmitWarning(w);
|
|
23541
|
-
}
|
|
23542
|
-
}
|
|
23543
|
-
|
|
23544
|
-
return target;
|
|
23545
|
-
}
|
|
23546
|
-
|
|
23547
|
-
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
23548
|
-
return _addListener(this, type, listener, false);
|
|
23549
|
-
};
|
|
23550
|
-
|
|
23551
|
-
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
23552
|
-
|
|
23553
|
-
EventEmitter.prototype.prependListener =
|
|
23554
|
-
function prependListener(type, listener) {
|
|
23555
|
-
return _addListener(this, type, listener, true);
|
|
23556
|
-
};
|
|
23557
|
-
|
|
23558
|
-
function onceWrapper() {
|
|
23559
|
-
if (!this.fired) {
|
|
23560
|
-
this.target.removeListener(this.type, this.wrapFn);
|
|
23561
|
-
this.fired = true;
|
|
23562
|
-
if (arguments.length === 0)
|
|
23563
|
-
return this.listener.call(this.target);
|
|
23564
|
-
return this.listener.apply(this.target, arguments);
|
|
23565
|
-
}
|
|
23566
|
-
}
|
|
23567
|
-
|
|
23568
|
-
function _onceWrap(target, type, listener) {
|
|
23569
|
-
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
|
23570
|
-
var wrapped = onceWrapper.bind(state);
|
|
23571
|
-
wrapped.listener = listener;
|
|
23572
|
-
state.wrapFn = wrapped;
|
|
23573
|
-
return wrapped;
|
|
23574
|
-
}
|
|
23575
|
-
|
|
23576
|
-
EventEmitter.prototype.once = function once(type, listener) {
|
|
23577
|
-
checkListener(listener);
|
|
23578
|
-
this.on(type, _onceWrap(this, type, listener));
|
|
23579
|
-
return this;
|
|
23580
|
-
};
|
|
23581
|
-
|
|
23582
|
-
EventEmitter.prototype.prependOnceListener =
|
|
23583
|
-
function prependOnceListener(type, listener) {
|
|
23584
|
-
checkListener(listener);
|
|
23585
|
-
this.prependListener(type, _onceWrap(this, type, listener));
|
|
23586
|
-
return this;
|
|
23587
|
-
};
|
|
23588
|
-
|
|
23589
|
-
// Emits a 'removeListener' event if and only if the listener was removed.
|
|
23590
|
-
EventEmitter.prototype.removeListener =
|
|
23591
|
-
function removeListener(type, listener) {
|
|
23592
|
-
var list, events, position, i, originalListener;
|
|
23593
|
-
|
|
23594
|
-
checkListener(listener);
|
|
23595
|
-
|
|
23596
|
-
events = this._events;
|
|
23597
|
-
if (events === undefined)
|
|
23598
|
-
return this;
|
|
23599
|
-
|
|
23600
|
-
list = events[type];
|
|
23601
|
-
if (list === undefined)
|
|
23602
|
-
return this;
|
|
23603
|
-
|
|
23604
|
-
if (list === listener || list.listener === listener) {
|
|
23605
|
-
if (--this._eventsCount === 0)
|
|
23606
|
-
this._events = Object.create(null);
|
|
23607
|
-
else {
|
|
23608
|
-
delete events[type];
|
|
23609
|
-
if (events.removeListener)
|
|
23610
|
-
this.emit('removeListener', type, list.listener || listener);
|
|
23611
|
-
}
|
|
23612
|
-
} else if (typeof list !== 'function') {
|
|
23613
|
-
position = -1;
|
|
23614
|
-
|
|
23615
|
-
for (i = list.length - 1; i >= 0; i--) {
|
|
23616
|
-
if (list[i] === listener || list[i].listener === listener) {
|
|
23617
|
-
originalListener = list[i].listener;
|
|
23618
|
-
position = i;
|
|
23619
|
-
break;
|
|
23620
|
-
}
|
|
23621
|
-
}
|
|
23622
|
-
|
|
23623
|
-
if (position < 0)
|
|
23624
|
-
return this;
|
|
23625
|
-
|
|
23626
|
-
if (position === 0)
|
|
23627
|
-
list.shift();
|
|
23628
|
-
else {
|
|
23629
|
-
spliceOne(list, position);
|
|
23630
|
-
}
|
|
23631
|
-
|
|
23632
|
-
if (list.length === 1)
|
|
23633
|
-
events[type] = list[0];
|
|
23634
|
-
|
|
23635
|
-
if (events.removeListener !== undefined)
|
|
23636
|
-
this.emit('removeListener', type, originalListener || listener);
|
|
23637
|
-
}
|
|
23638
|
-
|
|
23639
|
-
return this;
|
|
23640
|
-
};
|
|
23641
|
-
|
|
23642
|
-
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
23643
|
-
|
|
23644
|
-
EventEmitter.prototype.removeAllListeners =
|
|
23645
|
-
function removeAllListeners(type) {
|
|
23646
|
-
var listeners, events, i;
|
|
23647
|
-
|
|
23648
|
-
events = this._events;
|
|
23649
|
-
if (events === undefined)
|
|
23650
|
-
return this;
|
|
23651
|
-
|
|
23652
|
-
// not listening for removeListener, no need to emit
|
|
23653
|
-
if (events.removeListener === undefined) {
|
|
23654
|
-
if (arguments.length === 0) {
|
|
23655
|
-
this._events = Object.create(null);
|
|
23656
|
-
this._eventsCount = 0;
|
|
23657
|
-
} else if (events[type] !== undefined) {
|
|
23658
|
-
if (--this._eventsCount === 0)
|
|
23659
|
-
this._events = Object.create(null);
|
|
23660
|
-
else
|
|
23661
|
-
delete events[type];
|
|
23662
|
-
}
|
|
23663
|
-
return this;
|
|
23664
|
-
}
|
|
23665
|
-
|
|
23666
|
-
// emit removeListener for all listeners on all events
|
|
23667
|
-
if (arguments.length === 0) {
|
|
23668
|
-
var keys = Object.keys(events);
|
|
23669
|
-
var key;
|
|
23670
|
-
for (i = 0; i < keys.length; ++i) {
|
|
23671
|
-
key = keys[i];
|
|
23672
|
-
if (key === 'removeListener') continue;
|
|
23673
|
-
this.removeAllListeners(key);
|
|
23674
|
-
}
|
|
23675
|
-
this.removeAllListeners('removeListener');
|
|
23676
|
-
this._events = Object.create(null);
|
|
23677
|
-
this._eventsCount = 0;
|
|
23678
|
-
return this;
|
|
23679
|
-
}
|
|
23680
|
-
|
|
23681
|
-
listeners = events[type];
|
|
23682
|
-
|
|
23683
|
-
if (typeof listeners === 'function') {
|
|
23684
|
-
this.removeListener(type, listeners);
|
|
23685
|
-
} else if (listeners !== undefined) {
|
|
23686
|
-
// LIFO order
|
|
23687
|
-
for (i = listeners.length - 1; i >= 0; i--) {
|
|
23688
|
-
this.removeListener(type, listeners[i]);
|
|
23689
|
-
}
|
|
23690
|
-
}
|
|
23691
|
-
|
|
23692
|
-
return this;
|
|
23693
|
-
};
|
|
23694
|
-
|
|
23695
|
-
function _listeners(target, type, unwrap) {
|
|
23696
|
-
var events = target._events;
|
|
23697
|
-
|
|
23698
|
-
if (events === undefined)
|
|
23699
|
-
return [];
|
|
23700
|
-
|
|
23701
|
-
var evlistener = events[type];
|
|
23702
|
-
if (evlistener === undefined)
|
|
23703
|
-
return [];
|
|
23704
|
-
|
|
23705
|
-
if (typeof evlistener === 'function')
|
|
23706
|
-
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
|
23707
|
-
|
|
23708
|
-
return unwrap ?
|
|
23709
|
-
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
23710
|
-
}
|
|
23711
|
-
|
|
23712
|
-
EventEmitter.prototype.listeners = function listeners(type) {
|
|
23713
|
-
return _listeners(this, type, true);
|
|
23714
|
-
};
|
|
23715
|
-
|
|
23716
|
-
EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
|
23717
|
-
return _listeners(this, type, false);
|
|
23718
|
-
};
|
|
23719
|
-
|
|
23720
|
-
EventEmitter.listenerCount = function(emitter, type) {
|
|
23721
|
-
if (typeof emitter.listenerCount === 'function') {
|
|
23722
|
-
return emitter.listenerCount(type);
|
|
23723
|
-
} else {
|
|
23724
|
-
return listenerCount.call(emitter, type);
|
|
23725
|
-
}
|
|
23726
|
-
};
|
|
23727
|
-
|
|
23728
|
-
EventEmitter.prototype.listenerCount = listenerCount;
|
|
23729
|
-
function listenerCount(type) {
|
|
23730
|
-
var events = this._events;
|
|
23731
|
-
|
|
23732
|
-
if (events !== undefined) {
|
|
23733
|
-
var evlistener = events[type];
|
|
23734
|
-
|
|
23735
|
-
if (typeof evlistener === 'function') {
|
|
23736
|
-
return 1;
|
|
23737
|
-
} else if (evlistener !== undefined) {
|
|
23738
|
-
return evlistener.length;
|
|
23739
|
-
}
|
|
23740
|
-
}
|
|
23741
|
-
|
|
23742
|
-
return 0;
|
|
23743
|
-
}
|
|
23744
|
-
|
|
23745
|
-
EventEmitter.prototype.eventNames = function eventNames() {
|
|
23746
|
-
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
|
23747
|
-
};
|
|
23748
|
-
|
|
23749
|
-
function arrayClone(arr, n) {
|
|
23750
|
-
var copy = new Array(n);
|
|
23751
|
-
for (var i = 0; i < n; ++i)
|
|
23752
|
-
copy[i] = arr[i];
|
|
23753
|
-
return copy;
|
|
23754
|
-
}
|
|
23755
|
-
|
|
23756
|
-
function spliceOne(list, index) {
|
|
23757
|
-
for (; index + 1 < list.length; index++)
|
|
23758
|
-
list[index] = list[index + 1];
|
|
23759
|
-
list.pop();
|
|
23760
|
-
}
|
|
23761
|
-
|
|
23762
|
-
function unwrapListeners(arr) {
|
|
23763
|
-
var ret = new Array(arr.length);
|
|
23764
|
-
for (var i = 0; i < ret.length; ++i) {
|
|
23765
|
-
ret[i] = arr[i].listener || arr[i];
|
|
23766
|
-
}
|
|
23767
|
-
return ret;
|
|
23768
|
-
}
|
|
23769
|
-
|
|
23770
|
-
function once(emitter, name) {
|
|
23771
|
-
return new Promise(function (resolve, reject) {
|
|
23772
|
-
function errorListener(err) {
|
|
23773
|
-
emitter.removeListener(name, resolver);
|
|
23774
|
-
reject(err);
|
|
23775
|
-
}
|
|
23776
|
-
|
|
23777
|
-
function resolver() {
|
|
23778
|
-
if (typeof emitter.removeListener === 'function') {
|
|
23779
|
-
emitter.removeListener('error', errorListener);
|
|
23780
|
-
}
|
|
23781
|
-
resolve([].slice.call(arguments));
|
|
23782
|
-
}
|
|
23783
|
-
eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
|
|
23784
|
-
if (name !== 'error') {
|
|
23785
|
-
addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
|
|
23786
|
-
}
|
|
23787
|
-
});
|
|
23788
|
-
}
|
|
23789
|
-
|
|
23790
|
-
function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
|
|
23791
|
-
if (typeof emitter.on === 'function') {
|
|
23792
|
-
eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
|
|
23793
|
-
}
|
|
23794
|
-
}
|
|
23795
|
-
|
|
23796
|
-
function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
23797
|
-
if (typeof emitter.on === 'function') {
|
|
23798
|
-
if (flags.once) {
|
|
23799
|
-
emitter.once(name, listener);
|
|
23800
|
-
} else {
|
|
23801
|
-
emitter.on(name, listener);
|
|
23802
|
-
}
|
|
23803
|
-
} else if (typeof emitter.addEventListener === 'function') {
|
|
23804
|
-
// EventTarget does not have `error` event semantics like Node
|
|
23805
|
-
// EventEmitters, we do not listen for `error` events here.
|
|
23806
|
-
emitter.addEventListener(name, function wrapListener(arg) {
|
|
23807
|
-
// IE does not have builtin `{ once: true }` support so we
|
|
23808
|
-
// have to do it manually.
|
|
23809
|
-
if (flags.once) {
|
|
23810
|
-
emitter.removeEventListener(name, wrapListener);
|
|
23811
|
-
}
|
|
23812
|
-
listener(arg);
|
|
23813
|
-
});
|
|
23814
|
-
} else {
|
|
23815
|
-
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
|
|
23816
|
-
}
|
|
23817
|
-
}
|
|
23818
|
-
|
|
23819
|
-
var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
23820
|
-
var extendStatics = function (d, b) {
|
|
23821
|
-
extendStatics = Object.setPrototypeOf ||
|
|
23822
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23823
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
23824
|
-
return extendStatics(d, b);
|
|
23825
|
-
};
|
|
23826
|
-
return function (d, b) {
|
|
23827
|
-
extendStatics(d, b);
|
|
23828
|
-
function __() { this.constructor = d; }
|
|
23829
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
23830
|
-
};
|
|
23831
|
-
})();
|
|
23832
|
-
var __spreadArrays = (commonjsGlobal && commonjsGlobal.__spreadArrays) || function () {
|
|
23833
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
23834
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
23835
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
23836
|
-
r[k] = a[j];
|
|
23837
|
-
return r;
|
|
23838
|
-
};
|
|
23839
|
-
StrictEventEmitter$1.__esModule = true;
|
|
23840
|
-
StrictEventEmitter$1.StrictEventEmitter = void 0;
|
|
23841
|
-
var events_1 = events.exports;
|
|
23842
|
-
var StrictEventEmitter = /** @class */ (function (_super) {
|
|
23843
|
-
__extends$2(StrictEventEmitter, _super);
|
|
23844
|
-
function StrictEventEmitter() {
|
|
23845
|
-
return _super.call(this) || this;
|
|
23846
|
-
}
|
|
23847
|
-
StrictEventEmitter.prototype.on = function (event, listener) {
|
|
23848
|
-
return _super.prototype.on.call(this, event.toString(), listener);
|
|
23849
|
-
};
|
|
23850
|
-
StrictEventEmitter.prototype.once = function (event, listener) {
|
|
23851
|
-
return _super.prototype.on.call(this, event.toString(), listener);
|
|
23852
|
-
};
|
|
23853
|
-
StrictEventEmitter.prototype.off = function (event, listener) {
|
|
23854
|
-
return _super.prototype.off.call(this, event.toString(), listener);
|
|
23855
|
-
};
|
|
23856
|
-
StrictEventEmitter.prototype.emit = function (event) {
|
|
23857
|
-
var data = [];
|
|
23858
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
23859
|
-
data[_i - 1] = arguments[_i];
|
|
23860
|
-
}
|
|
23861
|
-
return _super.prototype.emit.apply(this, __spreadArrays([event.toString()], data));
|
|
23862
|
-
};
|
|
23863
|
-
StrictEventEmitter.prototype.addListener = function (event, listener) {
|
|
23864
|
-
return _super.prototype.addListener.call(this, event.toString(), listener);
|
|
23865
|
-
};
|
|
23866
|
-
StrictEventEmitter.prototype.removeListener = function (event, listener) {
|
|
23867
|
-
return _super.prototype.removeListener.call(this, event.toString(), listener);
|
|
23868
|
-
};
|
|
23869
|
-
return StrictEventEmitter;
|
|
23870
|
-
}(events_1.EventEmitter));
|
|
23871
|
-
StrictEventEmitter$1.StrictEventEmitter = StrictEventEmitter;
|
|
23872
|
-
|
|
23873
|
-
(function (exports) {
|
|
23874
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23875
|
-
if (k2 === undefined) k2 = k;
|
|
23876
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23877
|
-
}) : (function(o, m, k, k2) {
|
|
23878
|
-
if (k2 === undefined) k2 = k;
|
|
23879
|
-
o[k2] = m[k];
|
|
23880
|
-
}));
|
|
23881
|
-
exports.__esModule = true;
|
|
23882
|
-
exports.StrictEventEmitter = void 0;
|
|
23883
|
-
var StrictEventEmitter_1 = StrictEventEmitter$1;
|
|
23884
|
-
__createBinding(exports, StrictEventEmitter_1, "StrictEventEmitter");
|
|
23885
|
-
}(lib$3));
|
|
23886
|
-
|
|
23887
|
-
Object.defineProperty(createInterceptor$1, "__esModule", { value: true });
|
|
23888
|
-
createInterceptor$1.createInterceptor = void 0;
|
|
23889
|
-
var strict_event_emitter_1$1 = lib$3;
|
|
23890
|
-
function createInterceptor(options) {
|
|
23891
|
-
var observer = new strict_event_emitter_1$1.StrictEventEmitter();
|
|
23892
|
-
var cleanupFns = [];
|
|
23893
|
-
return {
|
|
23894
|
-
apply: function () {
|
|
23895
|
-
cleanupFns = options.modules.map(function (interceptor) {
|
|
23896
|
-
return interceptor(observer, options.resolver);
|
|
23897
|
-
});
|
|
23898
|
-
},
|
|
23899
|
-
on: function (event, listener) {
|
|
23900
|
-
observer.addListener(event, listener);
|
|
23901
|
-
},
|
|
23902
|
-
restore: function () {
|
|
23903
|
-
observer.removeAllListeners();
|
|
23904
|
-
if (cleanupFns.length === 0) {
|
|
23905
|
-
throw new Error("Failed to restore patched modules: no patches found. Did you forget to run \".apply()\"?");
|
|
23906
|
-
}
|
|
23907
|
-
cleanupFns.forEach(function (restore) { return restore(); });
|
|
23908
|
-
},
|
|
23909
|
-
};
|
|
23910
|
-
}
|
|
23911
|
-
createInterceptor$1.createInterceptor = createInterceptor;
|
|
23912
|
-
|
|
23913
|
-
var remote = {};
|
|
23914
|
-
|
|
23915
|
-
var lib$2 = {};
|
|
23916
|
-
|
|
23917
|
-
var Headers = {};
|
|
23918
|
-
|
|
23919
|
-
var normalizeHeaderName$1 = {};
|
|
23920
|
-
|
|
23921
|
-
Object.defineProperty(normalizeHeaderName$1, "__esModule", { value: true });
|
|
23922
|
-
normalizeHeaderName$1.normalizeHeaderName = void 0;
|
|
23923
|
-
var HEADERS_INVALID_CHARACTERS = /[^a-z0-9\-#$%&'*+.^_`|~]/i;
|
|
23924
|
-
function normalizeHeaderName(name) {
|
|
23925
|
-
if (typeof name !== 'string') {
|
|
23926
|
-
name = String(name);
|
|
23927
|
-
}
|
|
23928
|
-
if (HEADERS_INVALID_CHARACTERS.test(name) || name.trim() === '') {
|
|
23929
|
-
throw new TypeError('Invalid character in header field name');
|
|
23930
|
-
}
|
|
23931
|
-
return name.toLowerCase();
|
|
23932
|
-
}
|
|
23933
|
-
normalizeHeaderName$1.normalizeHeaderName = normalizeHeaderName;
|
|
23934
|
-
|
|
23935
|
-
var normalizeHeaderValue$1 = {};
|
|
23936
|
-
|
|
23937
|
-
Object.defineProperty(normalizeHeaderValue$1, "__esModule", { value: true });
|
|
23938
|
-
normalizeHeaderValue$1.normalizeHeaderValue = void 0;
|
|
23939
|
-
function normalizeHeaderValue(value) {
|
|
23940
|
-
if (typeof value !== 'string') {
|
|
23941
|
-
value = String(value);
|
|
23942
|
-
}
|
|
23943
|
-
return value;
|
|
23944
|
-
}
|
|
23945
|
-
normalizeHeaderValue$1.normalizeHeaderValue = normalizeHeaderValue;
|
|
23946
|
-
|
|
23947
|
-
var __generator$3 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
23948
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23949
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
23950
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
23951
|
-
function step(op) {
|
|
23952
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23953
|
-
while (_) try {
|
|
23954
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
23955
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
23956
|
-
switch (op[0]) {
|
|
23957
|
-
case 0: case 1: t = op; break;
|
|
23958
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23959
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23960
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
23961
|
-
default:
|
|
23962
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
23963
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
23964
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
23965
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
23966
|
-
if (t[2]) _.ops.pop();
|
|
23967
|
-
_.trys.pop(); continue;
|
|
23968
|
-
}
|
|
23969
|
-
op = body.call(thisArg, _);
|
|
23970
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
23971
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
23972
|
-
}
|
|
23973
|
-
};
|
|
23974
|
-
var __read$5 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
23975
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23976
|
-
if (!m) return o;
|
|
23977
|
-
var i = m.call(o), r, ar = [], e;
|
|
23978
|
-
try {
|
|
23979
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
23980
|
-
}
|
|
23981
|
-
catch (error) { e = { error: error }; }
|
|
23982
|
-
finally {
|
|
23983
|
-
try {
|
|
23984
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23985
|
-
}
|
|
23986
|
-
finally { if (e) throw e.error; }
|
|
23987
|
-
}
|
|
23988
|
-
return ar;
|
|
23989
|
-
};
|
|
23990
|
-
var __values$1 = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
|
|
23991
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
23992
|
-
if (m) return m.call(o);
|
|
23993
|
-
if (o && typeof o.length === "number") return {
|
|
23994
|
-
next: function () {
|
|
23995
|
-
if (o && i >= o.length) o = void 0;
|
|
23996
|
-
return { value: o && o[i++], done: !o };
|
|
23997
|
-
}
|
|
23998
|
-
};
|
|
23999
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
24000
|
-
};
|
|
24001
|
-
Object.defineProperty(Headers, "__esModule", { value: true });
|
|
24002
|
-
var normalizeHeaderName_1 = normalizeHeaderName$1;
|
|
24003
|
-
var normalizeHeaderValue_1 = normalizeHeaderValue$1;
|
|
24004
|
-
var HeadersPolyfill = /** @class */ (function () {
|
|
24005
|
-
function HeadersPolyfill(init) {
|
|
24006
|
-
var _this = this;
|
|
24007
|
-
// Normalized header {"name":"a, b"} storage.
|
|
24008
|
-
this._headers = {};
|
|
24009
|
-
// Keeps the mapping between the raw header name
|
|
24010
|
-
// and the normalized header name to ease the lookup.
|
|
24011
|
-
this._names = new Map();
|
|
24012
|
-
/**
|
|
24013
|
-
* @note Cannot check if the `init` is an instance of the `Headers`
|
|
24014
|
-
* because that class is only defined in the browser.
|
|
24015
|
-
*/
|
|
24016
|
-
if (['Headers', 'HeadersPolyfill'].includes(init === null || init === void 0 ? void 0 : init.constructor.name) ||
|
|
24017
|
-
init instanceof HeadersPolyfill) {
|
|
24018
|
-
var initialHeaders = init;
|
|
24019
|
-
initialHeaders.forEach(function (value, name) {
|
|
24020
|
-
_this.append(name, value);
|
|
24021
|
-
}, this);
|
|
24022
|
-
}
|
|
24023
|
-
else if (Array.isArray(init)) {
|
|
24024
|
-
init.forEach(function (_a) {
|
|
24025
|
-
var _b = __read$5(_a, 2), name = _b[0], value = _b[1];
|
|
24026
|
-
_this.append(name, Array.isArray(value) ? value.join(', ') : value);
|
|
24027
|
-
});
|
|
24028
|
-
}
|
|
24029
|
-
else if (init) {
|
|
24030
|
-
Object.getOwnPropertyNames(init).forEach(function (name) {
|
|
24031
|
-
var value = init[name];
|
|
24032
|
-
_this.append(name, Array.isArray(value) ? value.join(', ') : value);
|
|
24033
|
-
});
|
|
24034
|
-
}
|
|
24035
|
-
}
|
|
24036
|
-
HeadersPolyfill.prototype[Symbol.iterator] = function () {
|
|
24037
|
-
return this.entries();
|
|
24038
|
-
};
|
|
24039
|
-
HeadersPolyfill.prototype.keys = function () {
|
|
24040
|
-
var _a, _b, name_1, e_1_1;
|
|
24041
|
-
var e_1, _c;
|
|
24042
|
-
return __generator$3(this, function (_d) {
|
|
24043
|
-
switch (_d.label) {
|
|
24044
|
-
case 0:
|
|
24045
|
-
_d.trys.push([0, 5, 6, 7]);
|
|
24046
|
-
_a = __values$1(Object.keys(this._headers)), _b = _a.next();
|
|
24047
|
-
_d.label = 1;
|
|
24048
|
-
case 1:
|
|
24049
|
-
if (!!_b.done) return [3 /*break*/, 4];
|
|
24050
|
-
name_1 = _b.value;
|
|
24051
|
-
return [4 /*yield*/, name_1];
|
|
24052
|
-
case 2:
|
|
24053
|
-
_d.sent();
|
|
24054
|
-
_d.label = 3;
|
|
24055
|
-
case 3:
|
|
24056
|
-
_b = _a.next();
|
|
24057
|
-
return [3 /*break*/, 1];
|
|
24058
|
-
case 4: return [3 /*break*/, 7];
|
|
24059
|
-
case 5:
|
|
24060
|
-
e_1_1 = _d.sent();
|
|
24061
|
-
e_1 = { error: e_1_1 };
|
|
24062
|
-
return [3 /*break*/, 7];
|
|
24063
|
-
case 6:
|
|
24064
|
-
try {
|
|
24065
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
24066
|
-
}
|
|
24067
|
-
finally { if (e_1) throw e_1.error; }
|
|
24068
|
-
return [7 /*endfinally*/];
|
|
24069
|
-
case 7: return [2 /*return*/];
|
|
24070
|
-
}
|
|
24071
|
-
});
|
|
24072
|
-
};
|
|
24073
|
-
HeadersPolyfill.prototype.values = function () {
|
|
24074
|
-
var _a, _b, value, e_2_1;
|
|
24075
|
-
var e_2, _c;
|
|
24076
|
-
return __generator$3(this, function (_d) {
|
|
24077
|
-
switch (_d.label) {
|
|
24078
|
-
case 0:
|
|
24079
|
-
_d.trys.push([0, 5, 6, 7]);
|
|
24080
|
-
_a = __values$1(Object.values(this._headers)), _b = _a.next();
|
|
24081
|
-
_d.label = 1;
|
|
24082
|
-
case 1:
|
|
24083
|
-
if (!!_b.done) return [3 /*break*/, 4];
|
|
24084
|
-
value = _b.value;
|
|
24085
|
-
return [4 /*yield*/, value];
|
|
24086
|
-
case 2:
|
|
24087
|
-
_d.sent();
|
|
24088
|
-
_d.label = 3;
|
|
24089
|
-
case 3:
|
|
24090
|
-
_b = _a.next();
|
|
24091
|
-
return [3 /*break*/, 1];
|
|
24092
|
-
case 4: return [3 /*break*/, 7];
|
|
24093
|
-
case 5:
|
|
24094
|
-
e_2_1 = _d.sent();
|
|
24095
|
-
e_2 = { error: e_2_1 };
|
|
24096
|
-
return [3 /*break*/, 7];
|
|
24097
|
-
case 6:
|
|
24098
|
-
try {
|
|
24099
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
24100
|
-
}
|
|
24101
|
-
finally { if (e_2) throw e_2.error; }
|
|
24102
|
-
return [7 /*endfinally*/];
|
|
24103
|
-
case 7: return [2 /*return*/];
|
|
24104
|
-
}
|
|
24105
|
-
});
|
|
24106
|
-
};
|
|
24107
|
-
HeadersPolyfill.prototype.entries = function () {
|
|
24108
|
-
var _a, _b, name_2, e_3_1;
|
|
24109
|
-
var e_3, _c;
|
|
24110
|
-
return __generator$3(this, function (_d) {
|
|
24111
|
-
switch (_d.label) {
|
|
24112
|
-
case 0:
|
|
24113
|
-
_d.trys.push([0, 5, 6, 7]);
|
|
24114
|
-
_a = __values$1(Object.keys(this._headers)), _b = _a.next();
|
|
24115
|
-
_d.label = 1;
|
|
24116
|
-
case 1:
|
|
24117
|
-
if (!!_b.done) return [3 /*break*/, 4];
|
|
24118
|
-
name_2 = _b.value;
|
|
24119
|
-
return [4 /*yield*/, [name_2, this.get(name_2)]];
|
|
24120
|
-
case 2:
|
|
24121
|
-
_d.sent();
|
|
24122
|
-
_d.label = 3;
|
|
24123
|
-
case 3:
|
|
24124
|
-
_b = _a.next();
|
|
24125
|
-
return [3 /*break*/, 1];
|
|
24126
|
-
case 4: return [3 /*break*/, 7];
|
|
24127
|
-
case 5:
|
|
24128
|
-
e_3_1 = _d.sent();
|
|
24129
|
-
e_3 = { error: e_3_1 };
|
|
24130
|
-
return [3 /*break*/, 7];
|
|
24131
|
-
case 6:
|
|
24132
|
-
try {
|
|
24133
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
24134
|
-
}
|
|
24135
|
-
finally { if (e_3) throw e_3.error; }
|
|
24136
|
-
return [7 /*endfinally*/];
|
|
24137
|
-
case 7: return [2 /*return*/];
|
|
24138
|
-
}
|
|
24139
|
-
});
|
|
24140
|
-
};
|
|
24141
|
-
/**
|
|
24142
|
-
* Returns a `ByteString` sequence of all the values of a header with a given name.
|
|
24143
|
-
*/
|
|
24144
|
-
HeadersPolyfill.prototype.get = function (name) {
|
|
24145
|
-
return this._headers[normalizeHeaderName_1.normalizeHeaderName(name)] || null;
|
|
24146
|
-
};
|
|
24147
|
-
/**
|
|
24148
|
-
* Sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
24149
|
-
*/
|
|
24150
|
-
HeadersPolyfill.prototype.set = function (name, value) {
|
|
24151
|
-
var normalizedName = normalizeHeaderName_1.normalizeHeaderName(name);
|
|
24152
|
-
this._headers[normalizedName] = normalizeHeaderValue_1.normalizeHeaderValue(value);
|
|
24153
|
-
this._names.set(normalizedName, name);
|
|
24154
|
-
};
|
|
24155
|
-
/**
|
|
24156
|
-
* Appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
24157
|
-
*/
|
|
24158
|
-
HeadersPolyfill.prototype.append = function (name, value) {
|
|
24159
|
-
var resolvedValue = this.has(name) ? this.get(name) + ", " + value : value;
|
|
24160
|
-
this.set(name, resolvedValue);
|
|
24161
|
-
};
|
|
24162
|
-
/**
|
|
24163
|
-
* Deletes a header from the `Headers` object.
|
|
24164
|
-
*/
|
|
24165
|
-
HeadersPolyfill.prototype.delete = function (name) {
|
|
24166
|
-
if (!this.has(name)) {
|
|
24167
|
-
return this;
|
|
24168
|
-
}
|
|
24169
|
-
var normalizedName = normalizeHeaderName_1.normalizeHeaderName(name);
|
|
24170
|
-
delete this._headers[normalizedName];
|
|
24171
|
-
this._names.delete(normalizedName);
|
|
24172
|
-
return this;
|
|
24173
|
-
};
|
|
24174
|
-
/**
|
|
24175
|
-
* Returns the object of all the normalized headers.
|
|
24176
|
-
*/
|
|
24177
|
-
HeadersPolyfill.prototype.all = function () {
|
|
24178
|
-
return this._headers;
|
|
24179
|
-
};
|
|
24180
|
-
/**
|
|
24181
|
-
* Returns the object of all the raw headers.
|
|
24182
|
-
*/
|
|
24183
|
-
HeadersPolyfill.prototype.raw = function () {
|
|
24184
|
-
var _this = this;
|
|
24185
|
-
return Object.entries(this._headers).reduce(function (headers, _a) {
|
|
24186
|
-
var _b = __read$5(_a, 2), name = _b[0], value = _b[1];
|
|
24187
|
-
headers[_this._names.get(name)] = value;
|
|
24188
|
-
return headers;
|
|
24189
|
-
}, {});
|
|
24190
|
-
};
|
|
24191
|
-
/**
|
|
24192
|
-
* Returns a boolean stating whether a `Headers` object contains a certain header.
|
|
24193
|
-
*/
|
|
24194
|
-
HeadersPolyfill.prototype.has = function (name) {
|
|
24195
|
-
return this._headers.hasOwnProperty(normalizeHeaderName_1.normalizeHeaderName(name));
|
|
24196
|
-
};
|
|
24197
|
-
/**
|
|
24198
|
-
* Traverses the `Headers` object,
|
|
24199
|
-
* calling the given callback for each header.
|
|
24200
|
-
*/
|
|
24201
|
-
HeadersPolyfill.prototype.forEach = function (callback, thisArg) {
|
|
24202
|
-
for (var name_3 in this._headers) {
|
|
24203
|
-
if (this._headers.hasOwnProperty(name_3)) {
|
|
24204
|
-
callback.call(thisArg, this._headers[name_3], name_3, this);
|
|
24205
|
-
}
|
|
24206
|
-
}
|
|
24207
|
-
};
|
|
24208
|
-
return HeadersPolyfill;
|
|
24209
|
-
}());
|
|
24210
|
-
Headers.default = HeadersPolyfill;
|
|
24211
|
-
|
|
24212
|
-
var headersToString$1 = {};
|
|
24213
|
-
|
|
24214
|
-
var headersToList$1 = {};
|
|
24215
|
-
|
|
24216
|
-
Object.defineProperty(headersToList$1, "__esModule", { value: true });
|
|
24217
|
-
headersToList$1.headersToList = void 0;
|
|
24218
|
-
function headersToList(headers) {
|
|
24219
|
-
var headersList = [];
|
|
24220
|
-
headers.forEach(function (value, name) {
|
|
24221
|
-
var resolvedValue = value.includes(',')
|
|
24222
|
-
? value.split(',').map(function (value) { return value.trim(); })
|
|
24223
|
-
: value;
|
|
24224
|
-
headersList.push([name, resolvedValue]);
|
|
24225
|
-
});
|
|
24226
|
-
return headersList;
|
|
24227
|
-
}
|
|
24228
|
-
headersToList$1.headersToList = headersToList;
|
|
24229
|
-
|
|
24230
|
-
var __read$4 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
24231
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
24232
|
-
if (!m) return o;
|
|
24233
|
-
var i = m.call(o), r, ar = [], e;
|
|
24234
|
-
try {
|
|
24235
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
24236
|
-
}
|
|
24237
|
-
catch (error) { e = { error: error }; }
|
|
24238
|
-
finally {
|
|
24239
|
-
try {
|
|
24240
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24241
|
-
}
|
|
24242
|
-
finally { if (e) throw e.error; }
|
|
24243
|
-
}
|
|
24244
|
-
return ar;
|
|
24245
|
-
};
|
|
24246
|
-
Object.defineProperty(headersToString$1, "__esModule", { value: true });
|
|
24247
|
-
headersToString$1.headersToString = void 0;
|
|
24248
|
-
var headersToList_1 = headersToList$1;
|
|
24249
|
-
/**
|
|
24250
|
-
* Converts a given `Headers` instance to its string representation.
|
|
24251
|
-
*/
|
|
24252
|
-
function headersToString(headers) {
|
|
24253
|
-
var list = headersToList_1.headersToList(headers);
|
|
24254
|
-
var lines = list.map(function (_a) {
|
|
24255
|
-
var _b = __read$4(_a, 2), name = _b[0], value = _b[1];
|
|
24256
|
-
var values = [].concat(value);
|
|
24257
|
-
return name + ": " + values.join(', ');
|
|
24258
|
-
});
|
|
24259
|
-
return lines.join('\r\n');
|
|
24260
|
-
}
|
|
24261
|
-
headersToString$1.headersToString = headersToString;
|
|
24262
|
-
|
|
24263
|
-
var headersToObject$1 = {};
|
|
24264
|
-
|
|
24265
|
-
Object.defineProperty(headersToObject$1, "__esModule", { value: true });
|
|
24266
|
-
headersToObject$1.headersToObject = void 0;
|
|
24267
|
-
// List of headers that cannot have multiple values,
|
|
24268
|
-
// while potentially having a comma in their single value.
|
|
24269
|
-
var singleValueHeaders = ['user-agent'];
|
|
24270
|
-
/**
|
|
24271
|
-
* Converts a given `Headers` instance into a plain object.
|
|
24272
|
-
* Respects headers with multiple values.
|
|
24273
|
-
*/
|
|
24274
|
-
function headersToObject(headers) {
|
|
24275
|
-
var headersObject = {};
|
|
24276
|
-
headers.forEach(function (value, name) {
|
|
24277
|
-
var isMultiValue = !singleValueHeaders.includes(name.toLowerCase()) && value.includes(',');
|
|
24278
|
-
headersObject[name] = isMultiValue
|
|
24279
|
-
? value.split(',').map(function (s) { return s.trim(); })
|
|
24280
|
-
: value;
|
|
24281
|
-
});
|
|
24282
|
-
return headersObject;
|
|
24283
|
-
}
|
|
24284
|
-
headersToObject$1.headersToObject = headersToObject;
|
|
24285
|
-
|
|
24286
|
-
var stringToHeaders$1 = {};
|
|
24287
|
-
|
|
24288
|
-
Object.defineProperty(stringToHeaders$1, "__esModule", { value: true });
|
|
24289
|
-
stringToHeaders$1.stringToHeaders = void 0;
|
|
24290
|
-
var Headers_1$2 = Headers;
|
|
24291
|
-
/**
|
|
24292
|
-
* Converts a string representation of headers (i.e. from XMLHttpRequest)
|
|
24293
|
-
* to a new `Headers` instance.
|
|
24294
|
-
*/
|
|
24295
|
-
function stringToHeaders(str) {
|
|
24296
|
-
var lines = str.trim().split(/[\r\n]+/);
|
|
24297
|
-
return lines.reduce(function (headers, line) {
|
|
24298
|
-
var parts = line.split(': ');
|
|
24299
|
-
var name = parts.shift();
|
|
24300
|
-
var value = parts.join(': ');
|
|
24301
|
-
headers.append(name, value);
|
|
24302
|
-
return headers;
|
|
24303
|
-
}, new Headers_1$2.default());
|
|
24304
|
-
}
|
|
24305
|
-
stringToHeaders$1.stringToHeaders = stringToHeaders;
|
|
24306
|
-
|
|
24307
|
-
var listToHeaders$1 = {};
|
|
24308
|
-
|
|
24309
|
-
var __read$3 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
24310
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
24311
|
-
if (!m) return o;
|
|
24312
|
-
var i = m.call(o), r, ar = [], e;
|
|
24313
|
-
try {
|
|
24314
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
24315
|
-
}
|
|
24316
|
-
catch (error) { e = { error: error }; }
|
|
24317
|
-
finally {
|
|
24318
|
-
try {
|
|
24319
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24320
|
-
}
|
|
24321
|
-
finally { if (e) throw e.error; }
|
|
24322
|
-
}
|
|
24323
|
-
return ar;
|
|
24324
|
-
};
|
|
24325
|
-
Object.defineProperty(listToHeaders$1, "__esModule", { value: true });
|
|
24326
|
-
listToHeaders$1.listToHeaders = void 0;
|
|
24327
|
-
var Headers_1$1 = Headers;
|
|
24328
|
-
function listToHeaders(list) {
|
|
24329
|
-
var headers = new Headers_1$1.default();
|
|
24330
|
-
list.forEach(function (_a) {
|
|
24331
|
-
var _b = __read$3(_a, 2), name = _b[0], value = _b[1];
|
|
24332
|
-
var values = [].concat(value);
|
|
24333
|
-
values.forEach(function (value) {
|
|
24334
|
-
headers.append(name, value);
|
|
24335
|
-
});
|
|
24336
|
-
});
|
|
24337
|
-
return headers;
|
|
24338
|
-
}
|
|
24339
|
-
listToHeaders$1.listToHeaders = listToHeaders;
|
|
24340
|
-
|
|
24341
|
-
var objectToHeaders$1 = {};
|
|
24342
|
-
|
|
24343
|
-
var reduceHeadersObject$1 = {};
|
|
24344
|
-
|
|
24345
|
-
Object.defineProperty(reduceHeadersObject$1, "__esModule", { value: true });
|
|
24346
|
-
reduceHeadersObject$1.reduceHeadersObject = void 0;
|
|
24347
|
-
/**
|
|
24348
|
-
* Reduces given headers object instnace.
|
|
24349
|
-
*/
|
|
24350
|
-
function reduceHeadersObject(headers, reducer, initialState) {
|
|
24351
|
-
return Object.keys(headers).reduce(function (nextHeaders, name) {
|
|
24352
|
-
return reducer(nextHeaders, name, headers[name]);
|
|
24353
|
-
}, initialState);
|
|
24354
|
-
}
|
|
24355
|
-
reduceHeadersObject$1.reduceHeadersObject = reduceHeadersObject;
|
|
24356
|
-
|
|
24357
|
-
Object.defineProperty(objectToHeaders$1, "__esModule", { value: true });
|
|
24358
|
-
objectToHeaders$1.objectToHeaders = void 0;
|
|
24359
|
-
var Headers_1 = Headers;
|
|
24360
|
-
var reduceHeadersObject_1$1 = reduceHeadersObject$1;
|
|
24361
|
-
/**
|
|
24362
|
-
* Converts a given headers object to a new `Headers` instance.
|
|
24363
|
-
*/
|
|
24364
|
-
function objectToHeaders(headersObject) {
|
|
24365
|
-
return reduceHeadersObject_1$1.reduceHeadersObject(headersObject, function (headers, name, value) {
|
|
24366
|
-
var values = [].concat(value).filter(Boolean);
|
|
24367
|
-
values.forEach(function (value) {
|
|
24368
|
-
headers.append(name, value);
|
|
24369
|
-
});
|
|
24370
|
-
return headers;
|
|
24371
|
-
}, new Headers_1.default());
|
|
24372
|
-
}
|
|
24373
|
-
objectToHeaders$1.objectToHeaders = objectToHeaders;
|
|
24374
|
-
|
|
24375
|
-
var flattenHeadersList$1 = {};
|
|
24376
|
-
|
|
24377
|
-
var __read$2 = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
24378
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
24379
|
-
if (!m) return o;
|
|
24380
|
-
var i = m.call(o), r, ar = [], e;
|
|
24381
|
-
try {
|
|
24382
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
24383
|
-
}
|
|
24384
|
-
catch (error) { e = { error: error }; }
|
|
24385
|
-
finally {
|
|
24386
|
-
try {
|
|
24387
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24388
|
-
}
|
|
24389
|
-
finally { if (e) throw e.error; }
|
|
24390
|
-
}
|
|
24391
|
-
return ar;
|
|
24392
|
-
};
|
|
24393
|
-
Object.defineProperty(flattenHeadersList$1, "__esModule", { value: true });
|
|
24394
|
-
flattenHeadersList$1.flattenHeadersList = void 0;
|
|
24395
|
-
function flattenHeadersList(list) {
|
|
24396
|
-
return list.map(function (_a) {
|
|
24397
|
-
var _b = __read$2(_a, 2), name = _b[0], values = _b[1];
|
|
24398
|
-
return [name, [].concat(values).join('; ')];
|
|
24399
|
-
});
|
|
24400
|
-
}
|
|
24401
|
-
flattenHeadersList$1.flattenHeadersList = flattenHeadersList;
|
|
24402
|
-
|
|
24403
|
-
var flattenHeadersObject$1 = {};
|
|
24404
|
-
|
|
24405
|
-
Object.defineProperty(flattenHeadersObject$1, "__esModule", { value: true });
|
|
24406
|
-
flattenHeadersObject$1.flattenHeadersObject = void 0;
|
|
24407
|
-
var reduceHeadersObject_1 = reduceHeadersObject$1;
|
|
24408
|
-
function flattenHeadersObject(headersObject) {
|
|
24409
|
-
return reduceHeadersObject_1.reduceHeadersObject(headersObject, function (headers, name, value) {
|
|
24410
|
-
headers[name] = [].concat(value).join('; ');
|
|
24411
|
-
return headers;
|
|
24412
|
-
}, {});
|
|
24413
|
-
}
|
|
24414
|
-
flattenHeadersObject$1.flattenHeadersObject = flattenHeadersObject;
|
|
24415
|
-
|
|
24416
|
-
(function (exports) {
|
|
24417
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24418
|
-
exports.flattenHeadersObject = exports.flattenHeadersList = exports.reduceHeadersObject = exports.objectToHeaders = exports.listToHeaders = exports.stringToHeaders = exports.headersToObject = exports.headersToList = exports.headersToString = exports.Headers = void 0;
|
|
24419
|
-
var Headers_1 = Headers;
|
|
24420
|
-
Object.defineProperty(exports, "Headers", { enumerable: true, get: function () { return Headers_1.default; } });
|
|
24421
|
-
var headersToString_1 = headersToString$1;
|
|
24422
|
-
Object.defineProperty(exports, "headersToString", { enumerable: true, get: function () { return headersToString_1.headersToString; } });
|
|
24423
|
-
var headersToList_1 = headersToList$1;
|
|
24424
|
-
Object.defineProperty(exports, "headersToList", { enumerable: true, get: function () { return headersToList_1.headersToList; } });
|
|
24425
|
-
var headersToObject_1 = headersToObject$1;
|
|
24426
|
-
Object.defineProperty(exports, "headersToObject", { enumerable: true, get: function () { return headersToObject_1.headersToObject; } });
|
|
24427
|
-
var stringToHeaders_1 = stringToHeaders$1;
|
|
24428
|
-
Object.defineProperty(exports, "stringToHeaders", { enumerable: true, get: function () { return stringToHeaders_1.stringToHeaders; } });
|
|
24429
|
-
var listToHeaders_1 = listToHeaders$1;
|
|
24430
|
-
Object.defineProperty(exports, "listToHeaders", { enumerable: true, get: function () { return listToHeaders_1.listToHeaders; } });
|
|
24431
|
-
var objectToHeaders_1 = objectToHeaders$1;
|
|
24432
|
-
Object.defineProperty(exports, "objectToHeaders", { enumerable: true, get: function () { return objectToHeaders_1.objectToHeaders; } });
|
|
24433
|
-
var reduceHeadersObject_1 = reduceHeadersObject$1;
|
|
24434
|
-
Object.defineProperty(exports, "reduceHeadersObject", { enumerable: true, get: function () { return reduceHeadersObject_1.reduceHeadersObject; } });
|
|
24435
|
-
var flattenHeadersList_1 = flattenHeadersList$1;
|
|
24436
|
-
Object.defineProperty(exports, "flattenHeadersList", { enumerable: true, get: function () { return flattenHeadersList_1.flattenHeadersList; } });
|
|
24437
|
-
var flattenHeadersObject_1 = flattenHeadersObject$1;
|
|
24438
|
-
Object.defineProperty(exports, "flattenHeadersObject", { enumerable: true, get: function () { return flattenHeadersObject_1.flattenHeadersObject; } });
|
|
24439
|
-
}(lib$2));
|
|
24440
|
-
|
|
24441
|
-
var lib$1 = {};
|
|
24442
|
-
|
|
24443
|
-
var invariant$1 = {};
|
|
24444
|
-
|
|
24445
|
-
var format$1 = {};
|
|
24446
|
-
|
|
24447
|
-
Object.defineProperty(format$1, "__esModule", { value: true });
|
|
24448
|
-
format$1.format = void 0;
|
|
24449
|
-
var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
|
|
24450
|
-
function serializePositional(positional, flag) {
|
|
24451
|
-
switch (flag) {
|
|
24452
|
-
// Strings.
|
|
24453
|
-
case 's':
|
|
24454
|
-
return positional;
|
|
24455
|
-
// Digits.
|
|
24456
|
-
case 'd':
|
|
24457
|
-
case 'i':
|
|
24458
|
-
return Number(positional);
|
|
24459
|
-
// JSON.
|
|
24460
|
-
case 'j':
|
|
24461
|
-
return JSON.stringify(positional);
|
|
24462
|
-
// Objects.
|
|
24463
|
-
case 'o': {
|
|
24464
|
-
// Preserve stings to prevent extra quotes around them.
|
|
24465
|
-
if (typeof positional === 'string') {
|
|
24466
|
-
return positional;
|
|
24467
|
-
}
|
|
24468
|
-
var json = JSON.stringify(positional);
|
|
24469
|
-
// If the positional isn't serializable, return it as-is.
|
|
24470
|
-
if (json === '{}' || json === '[]' || /^\[object .+?\]$/.test(json)) {
|
|
24471
|
-
return positional;
|
|
23764
|
+
Object.defineProperty(createInterceptor$1, "__esModule", { value: true });
|
|
23765
|
+
createInterceptor$1.createInterceptor = void 0;
|
|
23766
|
+
var strict_event_emitter_1$1 = lib$4;
|
|
23767
|
+
function createInterceptor(options) {
|
|
23768
|
+
var observer = new strict_event_emitter_1$1.StrictEventEmitter();
|
|
23769
|
+
var cleanupFns = [];
|
|
23770
|
+
return {
|
|
23771
|
+
apply: function () {
|
|
23772
|
+
cleanupFns = options.modules.map(function (interceptor) {
|
|
23773
|
+
return interceptor(observer, options.resolver);
|
|
23774
|
+
});
|
|
23775
|
+
},
|
|
23776
|
+
on: function (event, listener) {
|
|
23777
|
+
observer.addListener(event, listener);
|
|
23778
|
+
},
|
|
23779
|
+
restore: function () {
|
|
23780
|
+
observer.removeAllListeners();
|
|
23781
|
+
if (cleanupFns.length === 0) {
|
|
23782
|
+
throw new Error("Failed to restore patched modules: no patches found. Did you forget to run \".apply()\"?");
|
|
24472
23783
|
}
|
|
24473
|
-
return
|
|
24474
|
-
}
|
|
24475
|
-
}
|
|
24476
|
-
}
|
|
24477
|
-
function format(message) {
|
|
24478
|
-
var positionals = [];
|
|
24479
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
24480
|
-
positionals[_i - 1] = arguments[_i];
|
|
24481
|
-
}
|
|
24482
|
-
if (positionals.length === 0) {
|
|
24483
|
-
return message;
|
|
24484
|
-
}
|
|
24485
|
-
var positionalIndex = 0;
|
|
24486
|
-
var formattedMessage = message.replace(POSITIONALS_EXP, function (match, isEscaped, _, flag) {
|
|
24487
|
-
var positional = positionals[positionalIndex];
|
|
24488
|
-
var value = serializePositional(positional, flag);
|
|
24489
|
-
if (!isEscaped) {
|
|
24490
|
-
positionalIndex++;
|
|
24491
|
-
return value;
|
|
24492
|
-
}
|
|
24493
|
-
return match;
|
|
24494
|
-
});
|
|
24495
|
-
// Append unresolved positionals to string as-is.
|
|
24496
|
-
if (positionalIndex < positionals.length) {
|
|
24497
|
-
formattedMessage += " " + positionals.slice(positionalIndex).join(' ');
|
|
24498
|
-
}
|
|
24499
|
-
formattedMessage = formattedMessage.replace(/%{2,2}/g, '%');
|
|
24500
|
-
return formattedMessage;
|
|
24501
|
-
}
|
|
24502
|
-
format$1.format = format;
|
|
24503
|
-
|
|
24504
|
-
var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
24505
|
-
var extendStatics = function (d, b) {
|
|
24506
|
-
extendStatics = Object.setPrototypeOf ||
|
|
24507
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
24508
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
24509
|
-
return extendStatics(d, b);
|
|
24510
|
-
};
|
|
24511
|
-
return function (d, b) {
|
|
24512
|
-
if (typeof b !== "function" && b !== null)
|
|
24513
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
24514
|
-
extendStatics(d, b);
|
|
24515
|
-
function __() { this.constructor = d; }
|
|
24516
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
23784
|
+
cleanupFns.forEach(function (restore) { return restore(); });
|
|
23785
|
+
},
|
|
24517
23786
|
};
|
|
24518
|
-
})();
|
|
24519
|
-
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
|
|
24520
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
24521
|
-
to[j] = from[i];
|
|
24522
|
-
return to;
|
|
24523
|
-
};
|
|
24524
|
-
Object.defineProperty(invariant$1, "__esModule", { value: true });
|
|
24525
|
-
invariant$1.invariant = invariant$1.InvariantError = void 0;
|
|
24526
|
-
var format_1 = format$1;
|
|
24527
|
-
var STACK_FRAMES_TO_IGNORE = 2;
|
|
24528
|
-
var InvariantError = /** @class */ (function (_super) {
|
|
24529
|
-
__extends$1(InvariantError, _super);
|
|
24530
|
-
function InvariantError(message) {
|
|
24531
|
-
var positionals = [];
|
|
24532
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
24533
|
-
positionals[_i - 1] = arguments[_i];
|
|
24534
|
-
}
|
|
24535
|
-
var _this = _super.call(this, message) || this;
|
|
24536
|
-
_this.name = 'Invariant Violation';
|
|
24537
|
-
_this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
|
|
24538
|
-
if (_this.stack) {
|
|
24539
|
-
var prevStack = _this.stack;
|
|
24540
|
-
_this.stack = prevStack
|
|
24541
|
-
.split('\n')
|
|
24542
|
-
.slice(STACK_FRAMES_TO_IGNORE)
|
|
24543
|
-
.join('\n');
|
|
24544
|
-
}
|
|
24545
|
-
return _this;
|
|
24546
|
-
}
|
|
24547
|
-
return InvariantError;
|
|
24548
|
-
}(Error));
|
|
24549
|
-
invariant$1.InvariantError = InvariantError;
|
|
24550
|
-
function invariant(predicate, message) {
|
|
24551
|
-
var positionals = [];
|
|
24552
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
24553
|
-
positionals[_i - 2] = arguments[_i];
|
|
24554
|
-
}
|
|
24555
|
-
if (!predicate) {
|
|
24556
|
-
throw new (InvariantError.bind.apply(InvariantError, __spreadArray([void 0, message], positionals)))();
|
|
24557
|
-
}
|
|
24558
23787
|
}
|
|
24559
|
-
|
|
23788
|
+
createInterceptor$1.createInterceptor = createInterceptor;
|
|
24560
23789
|
|
|
24561
|
-
|
|
24562
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24563
|
-
if (k2 === undefined) k2 = k;
|
|
24564
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
24565
|
-
}) : (function(o, m, k, k2) {
|
|
24566
|
-
if (k2 === undefined) k2 = k;
|
|
24567
|
-
o[k2] = m[k];
|
|
24568
|
-
}));
|
|
24569
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
24570
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
24571
|
-
};
|
|
24572
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24573
|
-
__exportStar(invariant$1, exports);
|
|
24574
|
-
__exportStar(format$1, exports);
|
|
24575
|
-
}(lib$1));
|
|
23790
|
+
var remote = {};
|
|
24576
23791
|
|
|
24577
23792
|
var toIsoResponse$1 = {};
|
|
24578
23793
|
|
|
24579
23794
|
Object.defineProperty(toIsoResponse$1, "__esModule", { value: true });
|
|
24580
23795
|
toIsoResponse$1.toIsoResponse = void 0;
|
|
24581
|
-
var headers_utils_1$3 = lib$
|
|
23796
|
+
var headers_utils_1$3 = lib$6;
|
|
24582
23797
|
/**
|
|
24583
23798
|
* Converts a given mocked response object into an isomorphic response.
|
|
24584
23799
|
*/
|
|
@@ -24657,9 +23872,9 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
24657
23872
|
};
|
|
24658
23873
|
Object.defineProperty(remote, "__esModule", { value: true });
|
|
24659
23874
|
remote.createRemoteResolver = remote.createRemoteInterceptor = void 0;
|
|
24660
|
-
var headers_utils_1$2 = lib$
|
|
24661
|
-
var outvariant_1 = lib$
|
|
24662
|
-
var strict_event_emitter_1 = lib$
|
|
23875
|
+
var headers_utils_1$2 = lib$6;
|
|
23876
|
+
var outvariant_1 = lib$2;
|
|
23877
|
+
var strict_event_emitter_1 = lib$4;
|
|
24663
23878
|
var createInterceptor_1 = createInterceptor$1;
|
|
24664
23879
|
var toIsoResponse_1$2 = toIsoResponse$1;
|
|
24665
23880
|
function requestReviver(key, value) {
|
|
@@ -24788,7 +24003,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
24788
24003
|
var getCleanUrl_1 = getCleanUrl$1;
|
|
24789
24004
|
Object.defineProperty(exports, "getCleanUrl", { enumerable: true, get: function () { return getCleanUrl_1.getCleanUrl; } });
|
|
24790
24005
|
|
|
24791
|
-
}(lib
|
|
24006
|
+
}(lib));
|
|
24792
24007
|
|
|
24793
24008
|
var fetch = {};
|
|
24794
24009
|
|
|
@@ -25031,6 +24246,8 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
25031
24246
|
function createDebug(namespace) {
|
|
25032
24247
|
let prevTime;
|
|
25033
24248
|
let enableOverride = null;
|
|
24249
|
+
let namespacesCache;
|
|
24250
|
+
let enabledCache;
|
|
25034
24251
|
|
|
25035
24252
|
function debug(...args) {
|
|
25036
24253
|
// Disabled?
|
|
@@ -25091,7 +24308,17 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
25091
24308
|
Object.defineProperty(debug, 'enabled', {
|
|
25092
24309
|
enumerable: true,
|
|
25093
24310
|
configurable: false,
|
|
25094
|
-
get: () =>
|
|
24311
|
+
get: () => {
|
|
24312
|
+
if (enableOverride !== null) {
|
|
24313
|
+
return enableOverride;
|
|
24314
|
+
}
|
|
24315
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
24316
|
+
namespacesCache = createDebug.namespaces;
|
|
24317
|
+
enabledCache = createDebug.enabled(namespace);
|
|
24318
|
+
}
|
|
24319
|
+
|
|
24320
|
+
return enabledCache;
|
|
24321
|
+
},
|
|
25095
24322
|
set: v => {
|
|
25096
24323
|
enableOverride = v;
|
|
25097
24324
|
}
|
|
@@ -25120,6 +24347,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
25120
24347
|
*/
|
|
25121
24348
|
function enable(namespaces) {
|
|
25122
24349
|
createDebug.save(namespaces);
|
|
24350
|
+
createDebug.namespaces = namespaces;
|
|
25123
24351
|
|
|
25124
24352
|
createDebug.names = [];
|
|
25125
24353
|
createDebug.skips = [];
|
|
@@ -25552,7 +24780,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
25552
24780
|
};
|
|
25553
24781
|
Object.defineProperty(fetch, "__esModule", { value: true });
|
|
25554
24782
|
var interceptFetch_1 = fetch.interceptFetch = void 0;
|
|
25555
|
-
var headers_utils_1$1 = lib$
|
|
24783
|
+
var headers_utils_1$1 = lib$6;
|
|
25556
24784
|
var toIsoResponse_1$1 = toIsoResponse$1;
|
|
25557
24785
|
var uuid_1$1 = uuid;
|
|
25558
24786
|
var debug$1 = browser.exports('fetch');
|
|
@@ -25598,15 +24826,16 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
25598
24826
|
}
|
|
25599
24827
|
debug$1('no mocked response found, bypassing...');
|
|
25600
24828
|
return [2 /*return*/, pureFetch(input, init).then(function (response) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
25601
|
-
var _a, _b, _c;
|
|
24829
|
+
var cloneResponse, _a, _b, _c;
|
|
25602
24830
|
return __generator$1(this, function (_d) {
|
|
25603
24831
|
switch (_d.label) {
|
|
25604
24832
|
case 0:
|
|
25605
|
-
|
|
24833
|
+
cloneResponse = response.clone();
|
|
24834
|
+
debug$1('original fetch performed', cloneResponse);
|
|
25606
24835
|
_b = (_a = observer).emit;
|
|
25607
24836
|
_c = ['response',
|
|
25608
24837
|
isoRequest];
|
|
25609
|
-
return [4 /*yield*/, normalizeFetchResponse(
|
|
24838
|
+
return [4 /*yield*/, normalizeFetchResponse(cloneResponse)];
|
|
25610
24839
|
case 1:
|
|
25611
24840
|
_b.apply(_a, _c.concat([_d.sent()]));
|
|
25612
24841
|
return [2 /*return*/, response];
|
|
@@ -25645,37 +24874,181 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
25645
24874
|
|
|
25646
24875
|
var XMLHttpRequestOverride = {};
|
|
25647
24876
|
|
|
25648
|
-
var
|
|
24877
|
+
var domParser = {};
|
|
25649
24878
|
|
|
25650
|
-
var
|
|
24879
|
+
var conventions$2 = {};
|
|
25651
24880
|
|
|
25652
|
-
Object.defineProperty(until, "__esModule", { value: true });
|
|
25653
24881
|
/**
|
|
25654
|
-
*
|
|
25655
|
-
*
|
|
25656
|
-
*
|
|
24882
|
+
* "Shallow freezes" an object to render it immutable.
|
|
24883
|
+
* Uses `Object.freeze` if available,
|
|
24884
|
+
* otherwise the immutability is only in the type.
|
|
24885
|
+
*
|
|
24886
|
+
* Is used to create "enum like" objects.
|
|
24887
|
+
*
|
|
24888
|
+
* @template T
|
|
24889
|
+
* @param {T} object the object to freeze
|
|
24890
|
+
* @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
|
|
24891
|
+
* allows to inject custom object constructor for tests
|
|
24892
|
+
* @returns {Readonly<T>}
|
|
24893
|
+
*
|
|
24894
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
|
|
25657
24895
|
*/
|
|
25658
|
-
|
|
25659
|
-
|
|
25660
|
-
|
|
25661
|
-
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
|
|
25666
|
-
|
|
25667
|
-
|
|
25668
|
-
|
|
24896
|
+
function freeze(object, oc) {
|
|
24897
|
+
if (oc === undefined) {
|
|
24898
|
+
oc = Object;
|
|
24899
|
+
}
|
|
24900
|
+
return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
|
|
24901
|
+
}
|
|
24902
|
+
|
|
24903
|
+
/**
|
|
24904
|
+
* All mime types that are allowed as input to `DOMParser.parseFromString`
|
|
24905
|
+
*
|
|
24906
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
|
|
24907
|
+
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
|
|
24908
|
+
* @see DOMParser.prototype.parseFromString
|
|
24909
|
+
*/
|
|
24910
|
+
var MIME_TYPE = freeze({
|
|
24911
|
+
/**
|
|
24912
|
+
* `text/html`, the only mime type that triggers treating an XML document as HTML.
|
|
24913
|
+
*
|
|
24914
|
+
* @see DOMParser.SupportedType.isHTML
|
|
24915
|
+
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
|
|
24916
|
+
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
|
|
24917
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
|
|
24918
|
+
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
|
|
24919
|
+
*/
|
|
24920
|
+
HTML: 'text/html',
|
|
25669
24921
|
|
|
25670
|
-
|
|
25671
|
-
|
|
25672
|
-
|
|
24922
|
+
/**
|
|
24923
|
+
* Helper method to check a mime type if it indicates an HTML document
|
|
24924
|
+
*
|
|
24925
|
+
* @param {string} [value]
|
|
24926
|
+
* @returns {boolean}
|
|
24927
|
+
*
|
|
24928
|
+
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
|
|
24929
|
+
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
|
|
24930
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
|
|
24931
|
+
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
|
|
24932
|
+
isHTML: function (value) {
|
|
24933
|
+
return value === MIME_TYPE.HTML
|
|
24934
|
+
},
|
|
25673
24935
|
|
|
25674
|
-
|
|
24936
|
+
/**
|
|
24937
|
+
* `application/xml`, the standard mime type for XML documents.
|
|
24938
|
+
*
|
|
24939
|
+
* @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
|
|
24940
|
+
* @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
|
|
24941
|
+
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
|
|
24942
|
+
*/
|
|
24943
|
+
XML_APPLICATION: 'application/xml',
|
|
24944
|
+
|
|
24945
|
+
/**
|
|
24946
|
+
* `text/html`, an alias for `application/xml`.
|
|
24947
|
+
*
|
|
24948
|
+
* @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
|
|
24949
|
+
* @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
|
|
24950
|
+
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
|
|
24951
|
+
*/
|
|
24952
|
+
XML_TEXT: 'text/xml',
|
|
24953
|
+
|
|
24954
|
+
/**
|
|
24955
|
+
* `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
|
|
24956
|
+
* but is parsed as an XML document.
|
|
24957
|
+
*
|
|
24958
|
+
* @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
|
|
24959
|
+
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
|
|
24960
|
+
* @see https://en.wikipedia.org/wiki/XHTML Wikipedia
|
|
24961
|
+
*/
|
|
24962
|
+
XML_XHTML_APPLICATION: 'application/xhtml+xml',
|
|
24963
|
+
|
|
24964
|
+
/**
|
|
24965
|
+
* `image/svg+xml`,
|
|
24966
|
+
*
|
|
24967
|
+
* @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
|
|
24968
|
+
* @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
|
|
24969
|
+
* @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
|
|
24970
|
+
*/
|
|
24971
|
+
XML_SVG_IMAGE: 'image/svg+xml',
|
|
24972
|
+
});
|
|
24973
|
+
|
|
24974
|
+
/**
|
|
24975
|
+
* Namespaces that are used in this code base.
|
|
24976
|
+
*
|
|
24977
|
+
* @see http://www.w3.org/TR/REC-xml-names
|
|
24978
|
+
*/
|
|
24979
|
+
var NAMESPACE$3 = freeze({
|
|
24980
|
+
/**
|
|
24981
|
+
* The XHTML namespace.
|
|
24982
|
+
*
|
|
24983
|
+
* @see http://www.w3.org/1999/xhtml
|
|
24984
|
+
*/
|
|
24985
|
+
HTML: 'http://www.w3.org/1999/xhtml',
|
|
24986
|
+
|
|
24987
|
+
/**
|
|
24988
|
+
* Checks if `uri` equals `NAMESPACE.HTML`.
|
|
24989
|
+
*
|
|
24990
|
+
* @param {string} [uri]
|
|
24991
|
+
*
|
|
24992
|
+
* @see NAMESPACE.HTML
|
|
24993
|
+
*/
|
|
24994
|
+
isHTML: function (uri) {
|
|
24995
|
+
return uri === NAMESPACE$3.HTML
|
|
24996
|
+
},
|
|
24997
|
+
|
|
24998
|
+
/**
|
|
24999
|
+
* The SVG namespace.
|
|
25000
|
+
*
|
|
25001
|
+
* @see http://www.w3.org/2000/svg
|
|
25002
|
+
*/
|
|
25003
|
+
SVG: 'http://www.w3.org/2000/svg',
|
|
25675
25004
|
|
|
25676
|
-
|
|
25005
|
+
/**
|
|
25006
|
+
* The `xml:` namespace.
|
|
25007
|
+
*
|
|
25008
|
+
* @see http://www.w3.org/XML/1998/namespace
|
|
25009
|
+
*/
|
|
25010
|
+
XML: 'http://www.w3.org/XML/1998/namespace',
|
|
25011
|
+
|
|
25012
|
+
/**
|
|
25013
|
+
* The `xmlns:` namespace
|
|
25014
|
+
*
|
|
25015
|
+
* @see https://www.w3.org/2000/xmlns/
|
|
25016
|
+
*/
|
|
25017
|
+
XMLNS: 'http://www.w3.org/2000/xmlns/',
|
|
25018
|
+
});
|
|
25019
|
+
|
|
25020
|
+
conventions$2.freeze = freeze;
|
|
25021
|
+
conventions$2.MIME_TYPE = MIME_TYPE;
|
|
25022
|
+
conventions$2.NAMESPACE = NAMESPACE$3;
|
|
25023
|
+
|
|
25024
|
+
var entities$1 = {};
|
|
25677
25025
|
|
|
25678
|
-
|
|
25026
|
+
(function (exports) {
|
|
25027
|
+
var freeze = conventions$2.freeze;
|
|
25028
|
+
|
|
25029
|
+
/**
|
|
25030
|
+
* The entities that are predefined in every XML document.
|
|
25031
|
+
*
|
|
25032
|
+
* @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
|
|
25033
|
+
* @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
|
|
25034
|
+
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
|
|
25035
|
+
*/
|
|
25036
|
+
exports.XML_ENTITIES = freeze({amp:'&', apos:"'", gt:'>', lt:'<', quot:'"'});
|
|
25037
|
+
|
|
25038
|
+
/**
|
|
25039
|
+
* A map of currently 241 entities that are detected in an HTML document.
|
|
25040
|
+
* They contain all entries from `XML_ENTITIES`.
|
|
25041
|
+
*
|
|
25042
|
+
* @see XML_ENTITIES
|
|
25043
|
+
* @see DOMParser.parseFromString
|
|
25044
|
+
* @see DOMImplementation.prototype.createHTMLDocument
|
|
25045
|
+
* @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec
|
|
25046
|
+
* @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
|
|
25047
|
+
* @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
|
|
25048
|
+
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
|
|
25049
|
+
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
|
|
25050
|
+
*/
|
|
25051
|
+
exports.HTML_ENTITIES = freeze({
|
|
25679
25052
|
lt: '<',
|
|
25680
25053
|
gt: '>',
|
|
25681
25054
|
amp: '&',
|
|
@@ -25917,10 +25290,19 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
25917
25290
|
clubs: "♣",
|
|
25918
25291
|
hearts: "♥",
|
|
25919
25292
|
diams: "♦"
|
|
25920
|
-
};
|
|
25293
|
+
});
|
|
25294
|
+
|
|
25295
|
+
/**
|
|
25296
|
+
* @deprecated use `HTML_ENTITIES` instead
|
|
25297
|
+
* @see HTML_ENTITIES
|
|
25298
|
+
*/
|
|
25299
|
+
exports.entityMap = exports.HTML_ENTITIES;
|
|
25300
|
+
}(entities$1));
|
|
25921
25301
|
|
|
25922
25302
|
var sax$1 = {};
|
|
25923
25303
|
|
|
25304
|
+
var NAMESPACE$2 = conventions$2.NAMESPACE;
|
|
25305
|
+
|
|
25924
25306
|
//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
25925
25307
|
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
|
25926
25308
|
//[5] Name ::= NameStartChar (NameChar)*
|
|
@@ -26038,7 +25420,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26038
25420
|
switch(source.charAt(tagStart+1)){
|
|
26039
25421
|
case '/':
|
|
26040
25422
|
var end = source.indexOf('>',tagStart+3);
|
|
26041
|
-
var tagName = source.substring(tagStart+2,end);
|
|
25423
|
+
var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
|
|
26042
25424
|
var config = parseStack.pop();
|
|
26043
25425
|
if(end<0){
|
|
26044
25426
|
|
|
@@ -26111,12 +25493,10 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26111
25493
|
parseStack.push(el);
|
|
26112
25494
|
}
|
|
26113
25495
|
}
|
|
26114
|
-
|
|
26115
|
-
|
|
26116
|
-
|
|
26117
|
-
if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){
|
|
25496
|
+
|
|
25497
|
+
if (NAMESPACE$2.isHTML(el.uri) && !el.closed) {
|
|
26118
25498
|
end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder);
|
|
26119
|
-
}else {
|
|
25499
|
+
} else {
|
|
26120
25500
|
end++;
|
|
26121
25501
|
}
|
|
26122
25502
|
}
|
|
@@ -26252,7 +25632,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26252
25632
|
errorHandler.warning('attribute "'+value+'" missed quot(")!');
|
|
26253
25633
|
addAttribute(attrName, value.replace(/&#?\w+;/g,entityReplacer), start);
|
|
26254
25634
|
}else {
|
|
26255
|
-
if(currentNSMap['']
|
|
25635
|
+
if(!NAMESPACE$2.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){
|
|
26256
25636
|
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!');
|
|
26257
25637
|
}
|
|
26258
25638
|
addAttribute(value, value, start);
|
|
@@ -26300,7 +25680,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26300
25680
|
//case S_ATTR_NOQUOT_VALUE:void();break;
|
|
26301
25681
|
case S_ATTR_SPACE:
|
|
26302
25682
|
el.tagName;
|
|
26303
|
-
if(currentNSMap['']
|
|
25683
|
+
if (!NAMESPACE$2.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
|
|
26304
25684
|
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!');
|
|
26305
25685
|
}
|
|
26306
25686
|
addAttribute(attrName, attrName, start);
|
|
@@ -26359,7 +25739,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26359
25739
|
//console.log(currentNSMap,1)
|
|
26360
25740
|
}
|
|
26361
25741
|
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
|
|
26362
|
-
a.uri =
|
|
25742
|
+
a.uri = NAMESPACE$2.XMLNS;
|
|
26363
25743
|
domBuilder.startPrefixMapping(nsPrefix, value);
|
|
26364
25744
|
}
|
|
26365
25745
|
}
|
|
@@ -26369,7 +25749,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26369
25749
|
var prefix = a.prefix;
|
|
26370
25750
|
if(prefix){//no prefix attribute has no namespace
|
|
26371
25751
|
if(prefix === 'xml'){
|
|
26372
|
-
a.uri =
|
|
25752
|
+
a.uri = NAMESPACE$2.XML;
|
|
26373
25753
|
}if(prefix !== 'xmlns'){
|
|
26374
25754
|
a.uri = currentNSMap[prefix || ''];
|
|
26375
25755
|
|
|
@@ -26566,11 +25946,74 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26566
25946
|
|
|
26567
25947
|
var dom = {};
|
|
26568
25948
|
|
|
25949
|
+
var conventions$1 = conventions$2;
|
|
25950
|
+
|
|
25951
|
+
var NAMESPACE$1 = conventions$1.NAMESPACE;
|
|
25952
|
+
|
|
25953
|
+
/**
|
|
25954
|
+
* A prerequisite for `[].filter`, to drop elements that are empty
|
|
25955
|
+
* @param {string} input
|
|
25956
|
+
* @returns {boolean}
|
|
25957
|
+
*/
|
|
25958
|
+
function notEmptyString (input) {
|
|
25959
|
+
return input !== ''
|
|
25960
|
+
}
|
|
25961
|
+
/**
|
|
25962
|
+
* @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace
|
|
25963
|
+
* @see https://infra.spec.whatwg.org/#ascii-whitespace
|
|
25964
|
+
*
|
|
25965
|
+
* @param {string} input
|
|
25966
|
+
* @returns {string[]} (can be empty)
|
|
25967
|
+
*/
|
|
25968
|
+
function splitOnASCIIWhitespace(input) {
|
|
25969
|
+
// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE
|
|
25970
|
+
return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : []
|
|
25971
|
+
}
|
|
25972
|
+
|
|
25973
|
+
/**
|
|
25974
|
+
* Adds element as a key to current if it is not already present.
|
|
25975
|
+
*
|
|
25976
|
+
* @param {Record<string, boolean | undefined>} current
|
|
25977
|
+
* @param {string} element
|
|
25978
|
+
* @returns {Record<string, boolean | undefined>}
|
|
25979
|
+
*/
|
|
25980
|
+
function orderedSetReducer (current, element) {
|
|
25981
|
+
if (!current.hasOwnProperty(element)) {
|
|
25982
|
+
current[element] = true;
|
|
25983
|
+
}
|
|
25984
|
+
return current;
|
|
25985
|
+
}
|
|
25986
|
+
|
|
25987
|
+
/**
|
|
25988
|
+
* @see https://infra.spec.whatwg.org/#ordered-set
|
|
25989
|
+
* @param {string} input
|
|
25990
|
+
* @returns {string[]}
|
|
25991
|
+
*/
|
|
25992
|
+
function toOrderedSet(input) {
|
|
25993
|
+
if (!input) return [];
|
|
25994
|
+
var list = splitOnASCIIWhitespace(input);
|
|
25995
|
+
return Object.keys(list.reduce(orderedSetReducer, {}))
|
|
25996
|
+
}
|
|
25997
|
+
|
|
25998
|
+
/**
|
|
25999
|
+
* Uses `list.indexOf` to implement something like `Array.prototype.includes`,
|
|
26000
|
+
* which we can not rely on being available.
|
|
26001
|
+
*
|
|
26002
|
+
* @param {any[]} list
|
|
26003
|
+
* @returns {function(any): boolean}
|
|
26004
|
+
*/
|
|
26005
|
+
function arrayIncludes (list) {
|
|
26006
|
+
return function(element) {
|
|
26007
|
+
return list && list.indexOf(element) !== -1;
|
|
26008
|
+
}
|
|
26009
|
+
}
|
|
26010
|
+
|
|
26569
26011
|
function copy(src,dest){
|
|
26570
26012
|
for(var p in src){
|
|
26571
26013
|
dest[p] = src[p];
|
|
26572
26014
|
}
|
|
26573
26015
|
}
|
|
26016
|
+
|
|
26574
26017
|
/**
|
|
26575
26018
|
^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));?
|
|
26576
26019
|
^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));?
|
|
@@ -26590,7 +26033,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26590
26033
|
pt.constructor = Class;
|
|
26591
26034
|
}
|
|
26592
26035
|
}
|
|
26593
|
-
|
|
26036
|
+
|
|
26594
26037
|
// Node Types
|
|
26595
26038
|
var NodeType = {};
|
|
26596
26039
|
var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
|
|
@@ -26646,6 +26089,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26646
26089
|
return error;
|
|
26647
26090
|
}DOMException.prototype = Error.prototype;
|
|
26648
26091
|
copy(ExceptionCode,DOMException);
|
|
26092
|
+
|
|
26649
26093
|
/**
|
|
26650
26094
|
* @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177
|
|
26651
26095
|
* The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.
|
|
@@ -26676,6 +26120,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26676
26120
|
return buf.join('');
|
|
26677
26121
|
}
|
|
26678
26122
|
};
|
|
26123
|
+
|
|
26679
26124
|
function LiveNodeList(node,refresh){
|
|
26680
26125
|
this._node = node;
|
|
26681
26126
|
this._refresh = refresh;
|
|
@@ -26697,9 +26142,15 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26697
26142
|
};
|
|
26698
26143
|
|
|
26699
26144
|
_extends(LiveNodeList,NodeList);
|
|
26145
|
+
|
|
26700
26146
|
/**
|
|
26701
|
-
*
|
|
26702
|
-
*
|
|
26147
|
+
* Objects implementing the NamedNodeMap interface are used
|
|
26148
|
+
* to represent collections of nodes that can be accessed by name.
|
|
26149
|
+
* Note that NamedNodeMap does not inherit from NodeList;
|
|
26150
|
+
* NamedNodeMaps are not maintained in any particular order.
|
|
26151
|
+
* Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,
|
|
26152
|
+
* but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
|
|
26153
|
+
* and does not imply that the DOM specifies an order to these Nodes.
|
|
26703
26154
|
* NamedNodeMap objects in the DOM are live.
|
|
26704
26155
|
* used for attributes or DocumentType entities
|
|
26705
26156
|
*/
|
|
@@ -26810,54 +26261,108 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26810
26261
|
return null;
|
|
26811
26262
|
}
|
|
26812
26263
|
};
|
|
26264
|
+
|
|
26813
26265
|
/**
|
|
26814
|
-
*
|
|
26266
|
+
* The DOMImplementation interface represents an object providing methods
|
|
26267
|
+
* which are not dependent on any particular document.
|
|
26268
|
+
* Such an object is returned by the `Document.implementation` property.
|
|
26269
|
+
*
|
|
26270
|
+
* __The individual methods describe the differences compared to the specs.__
|
|
26271
|
+
*
|
|
26272
|
+
* @constructor
|
|
26273
|
+
*
|
|
26274
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN
|
|
26275
|
+
* @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)
|
|
26276
|
+
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core
|
|
26277
|
+
* @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core
|
|
26278
|
+
* @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard
|
|
26815
26279
|
*/
|
|
26816
|
-
function DOMImplementation$1(
|
|
26817
|
-
this._features = {};
|
|
26818
|
-
if (features) {
|
|
26819
|
-
for (var feature in features) {
|
|
26820
|
-
this._features = features[feature];
|
|
26821
|
-
}
|
|
26822
|
-
}
|
|
26280
|
+
function DOMImplementation$1() {
|
|
26823
26281
|
}
|
|
26282
|
+
|
|
26824
26283
|
DOMImplementation$1.prototype = {
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26284
|
+
/**
|
|
26285
|
+
* The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
|
|
26286
|
+
* The different implementations fairly diverged in what kind of features were reported.
|
|
26287
|
+
* The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
|
|
26288
|
+
*
|
|
26289
|
+
* @deprecated It is deprecated and modern browsers return true in all cases.
|
|
26290
|
+
*
|
|
26291
|
+
* @param {string} feature
|
|
26292
|
+
* @param {string} [version]
|
|
26293
|
+
* @returns {boolean} always true
|
|
26294
|
+
*
|
|
26295
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
|
|
26296
|
+
* @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
|
|
26297
|
+
* @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
|
|
26298
|
+
*/
|
|
26299
|
+
hasFeature: function(feature, version) {
|
|
26828
26300
|
return true;
|
|
26829
|
-
} else {
|
|
26830
|
-
return false;
|
|
26831
|
-
}
|
|
26832
26301
|
},
|
|
26833
|
-
|
|
26834
|
-
|
|
26302
|
+
/**
|
|
26303
|
+
* Creates an XML Document object of the specified type with its document element.
|
|
26304
|
+
*
|
|
26305
|
+
* __It behaves slightly different from the description in the living standard__:
|
|
26306
|
+
* - There is no interface/class `XMLDocument`, it returns a `Document` instance.
|
|
26307
|
+
* - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
|
|
26308
|
+
* - this implementation is not validating names or qualified names
|
|
26309
|
+
* (when parsing XML strings, the SAX parser takes care of that)
|
|
26310
|
+
*
|
|
26311
|
+
* @param {string|null} namespaceURI
|
|
26312
|
+
* @param {string} qualifiedName
|
|
26313
|
+
* @param {DocumentType=null} doctype
|
|
26314
|
+
* @returns {Document}
|
|
26315
|
+
*
|
|
26316
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
|
|
26317
|
+
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
|
|
26318
|
+
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
|
|
26319
|
+
*
|
|
26320
|
+
* @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
|
|
26321
|
+
* @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
|
|
26322
|
+
* @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
|
|
26323
|
+
*/
|
|
26324
|
+
createDocument: function(namespaceURI, qualifiedName, doctype){
|
|
26835
26325
|
var doc = new Document();
|
|
26836
26326
|
doc.implementation = this;
|
|
26837
26327
|
doc.childNodes = new NodeList();
|
|
26838
|
-
doc.doctype = doctype;
|
|
26839
|
-
if(doctype){
|
|
26328
|
+
doc.doctype = doctype || null;
|
|
26329
|
+
if (doctype){
|
|
26840
26330
|
doc.appendChild(doctype);
|
|
26841
26331
|
}
|
|
26842
|
-
if(qualifiedName){
|
|
26843
|
-
var root = doc.createElementNS(namespaceURI,qualifiedName);
|
|
26332
|
+
if (qualifiedName){
|
|
26333
|
+
var root = doc.createElementNS(namespaceURI, qualifiedName);
|
|
26844
26334
|
doc.appendChild(root);
|
|
26845
26335
|
}
|
|
26846
26336
|
return doc;
|
|
26847
26337
|
},
|
|
26848
|
-
|
|
26849
|
-
|
|
26338
|
+
/**
|
|
26339
|
+
* Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
|
|
26340
|
+
*
|
|
26341
|
+
* __This behavior is slightly different from the in the specs__:
|
|
26342
|
+
* - this implementation is not validating names or qualified names
|
|
26343
|
+
* (when parsing XML strings, the SAX parser takes care of that)
|
|
26344
|
+
*
|
|
26345
|
+
* @param {string} qualifiedName
|
|
26346
|
+
* @param {string} [publicId]
|
|
26347
|
+
* @param {string} [systemId]
|
|
26348
|
+
* @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
|
|
26349
|
+
* or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
|
|
26350
|
+
*
|
|
26351
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
|
|
26352
|
+
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
|
|
26353
|
+
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
|
|
26354
|
+
*
|
|
26355
|
+
* @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
|
|
26356
|
+
* @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
|
|
26357
|
+
* @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
|
|
26358
|
+
*/
|
|
26359
|
+
createDocumentType: function(qualifiedName, publicId, systemId){
|
|
26850
26360
|
var node = new DocumentType();
|
|
26851
26361
|
node.name = qualifiedName;
|
|
26852
26362
|
node.nodeName = qualifiedName;
|
|
26853
|
-
node.publicId = publicId;
|
|
26854
|
-
node.systemId = systemId;
|
|
26855
|
-
|
|
26856
|
-
//readonly attribute DOMString internalSubset;
|
|
26857
|
-
|
|
26858
|
-
//TODO:..
|
|
26859
|
-
// readonly attribute NamedNodeMap entities;
|
|
26860
|
-
// readonly attribute NamedNodeMap notations;
|
|
26363
|
+
node.publicId = publicId || '';
|
|
26364
|
+
node.systemId = systemId || '';
|
|
26365
|
+
|
|
26861
26366
|
return node;
|
|
26862
26367
|
}
|
|
26863
26368
|
};
|
|
@@ -26996,22 +26501,25 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
26996
26501
|
|
|
26997
26502
|
function Document(){
|
|
26998
26503
|
}
|
|
26504
|
+
|
|
26999
26505
|
function _onAddAttribute(doc,el,newAttr){
|
|
27000
26506
|
doc && doc._inc++;
|
|
27001
26507
|
var ns = newAttr.namespaceURI ;
|
|
27002
|
-
if(ns
|
|
26508
|
+
if(ns === NAMESPACE$1.XMLNS){
|
|
27003
26509
|
//update namespace
|
|
27004
26510
|
el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value;
|
|
27005
26511
|
}
|
|
27006
26512
|
}
|
|
26513
|
+
|
|
27007
26514
|
function _onRemoveAttribute(doc,el,newAttr,remove){
|
|
27008
26515
|
doc && doc._inc++;
|
|
27009
26516
|
var ns = newAttr.namespaceURI ;
|
|
27010
|
-
if(ns
|
|
26517
|
+
if(ns === NAMESPACE$1.XMLNS){
|
|
27011
26518
|
//update namespace
|
|
27012
26519
|
delete el._nsMap[newAttr.prefix?newAttr.localName:''];
|
|
27013
26520
|
}
|
|
27014
26521
|
}
|
|
26522
|
+
|
|
27015
26523
|
function _onUpdateChild(doc,el,newChild){
|
|
27016
26524
|
if(doc && doc._inc){
|
|
27017
26525
|
doc._inc++;
|
|
@@ -27127,8 +26635,8 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27127
26635
|
doctype : null,
|
|
27128
26636
|
documentElement : null,
|
|
27129
26637
|
_inc : 1,
|
|
27130
|
-
|
|
27131
|
-
insertBefore : function(newChild, refChild){//raises
|
|
26638
|
+
|
|
26639
|
+
insertBefore : function(newChild, refChild){//raises
|
|
27132
26640
|
if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){
|
|
27133
26641
|
var child = newChild.firstChild;
|
|
27134
26642
|
while(child){
|
|
@@ -27141,7 +26649,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27141
26649
|
if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){
|
|
27142
26650
|
this.documentElement = newChild;
|
|
27143
26651
|
}
|
|
27144
|
-
|
|
26652
|
+
|
|
27145
26653
|
return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild;
|
|
27146
26654
|
},
|
|
27147
26655
|
removeChild : function(oldChild){
|
|
@@ -27167,28 +26675,58 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27167
26675
|
});
|
|
27168
26676
|
return rtv;
|
|
27169
26677
|
},
|
|
27170
|
-
|
|
27171
|
-
|
|
27172
|
-
|
|
26678
|
+
|
|
26679
|
+
/**
|
|
26680
|
+
* The `getElementsByClassName` method of `Document` interface returns an array-like object
|
|
26681
|
+
* of all child elements which have **all** of the given class name(s).
|
|
26682
|
+
*
|
|
26683
|
+
* Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
|
|
26684
|
+
*
|
|
26685
|
+
*
|
|
26686
|
+
* Warning: This is a live LiveNodeList.
|
|
26687
|
+
* Changes in the DOM will reflect in the array as the changes occur.
|
|
26688
|
+
* If an element selected by this array no longer qualifies for the selector,
|
|
26689
|
+
* it will automatically be removed. Be aware of this for iteration purposes.
|
|
26690
|
+
*
|
|
26691
|
+
* @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
|
|
26692
|
+
*
|
|
26693
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
|
|
26694
|
+
* @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
|
|
26695
|
+
*/
|
|
26696
|
+
getElementsByClassName: function(classNames) {
|
|
26697
|
+
var classNamesSet = toOrderedSet(classNames);
|
|
27173
26698
|
return new LiveNodeList(this, function(base) {
|
|
27174
26699
|
var ls = [];
|
|
27175
|
-
|
|
27176
|
-
|
|
27177
|
-
if(
|
|
27178
|
-
|
|
26700
|
+
if (classNamesSet.length > 0) {
|
|
26701
|
+
_visitNode(base.documentElement, function(node) {
|
|
26702
|
+
if(node !== base && node.nodeType === ELEMENT_NODE) {
|
|
26703
|
+
var nodeClassNames = node.getAttribute('class');
|
|
26704
|
+
// can be null if the attribute does not exist
|
|
26705
|
+
if (nodeClassNames) {
|
|
26706
|
+
// before splitting and iterating just compare them for the most common case
|
|
26707
|
+
var matches = classNames === nodeClassNames;
|
|
26708
|
+
if (!matches) {
|
|
26709
|
+
var nodeClassNamesSet = toOrderedSet(nodeClassNames);
|
|
26710
|
+
matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
|
|
26711
|
+
}
|
|
26712
|
+
if(matches) {
|
|
26713
|
+
ls.push(node);
|
|
26714
|
+
}
|
|
26715
|
+
}
|
|
27179
26716
|
}
|
|
27180
|
-
}
|
|
27181
|
-
}
|
|
26717
|
+
});
|
|
26718
|
+
}
|
|
27182
26719
|
return ls;
|
|
27183
26720
|
});
|
|
27184
26721
|
},
|
|
27185
|
-
|
|
26722
|
+
|
|
27186
26723
|
//document factory method:
|
|
27187
26724
|
createElement : function(tagName){
|
|
27188
26725
|
var node = new Element();
|
|
27189
26726
|
node.ownerDocument = this;
|
|
27190
26727
|
node.nodeName = tagName;
|
|
27191
26728
|
node.tagName = tagName;
|
|
26729
|
+
node.localName = tagName;
|
|
27192
26730
|
node.childNodes = new NodeList();
|
|
27193
26731
|
var attrs = node.attributes = new NamedNodeMap();
|
|
27194
26732
|
attrs._ownerElement = node;
|
|
@@ -27495,36 +27033,49 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27495
27033
|
//console.log('###',this.nodeType,uri,prefix,buf.join(''))
|
|
27496
27034
|
return buf.join('');
|
|
27497
27035
|
}
|
|
27498
|
-
|
|
27499
|
-
|
|
27036
|
+
|
|
27037
|
+
function needNamespaceDefine(node, isHTML, visibleNamespaces) {
|
|
27038
|
+
var prefix = node.prefix || '';
|
|
27500
27039
|
var uri = node.namespaceURI;
|
|
27501
|
-
|
|
27040
|
+
// According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,
|
|
27041
|
+
// and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :
|
|
27042
|
+
// > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.
|
|
27043
|
+
// in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)
|
|
27044
|
+
// and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :
|
|
27045
|
+
// > [...] Furthermore, the attribute value [...] must not be an empty string.
|
|
27046
|
+
// so serializing empty namespace value like xmlns:ds="" would produce an invalid XML document.
|
|
27047
|
+
if (!uri) {
|
|
27502
27048
|
return false;
|
|
27503
27049
|
}
|
|
27504
|
-
if (prefix === "xml" && uri ===
|
|
27505
|
-
|| uri == 'http://www.w3.org/2000/xmlns/'){
|
|
27050
|
+
if (prefix === "xml" && uri === NAMESPACE$1.XML || uri === NAMESPACE$1.XMLNS) {
|
|
27506
27051
|
return false;
|
|
27507
27052
|
}
|
|
27508
27053
|
|
|
27509
27054
|
var i = visibleNamespaces.length;
|
|
27510
|
-
//console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces)
|
|
27511
27055
|
while (i--) {
|
|
27512
27056
|
var ns = visibleNamespaces[i];
|
|
27513
27057
|
// get namespace prefix
|
|
27514
|
-
|
|
27515
|
-
|
|
27516
|
-
return ns.namespace != uri;
|
|
27058
|
+
if (ns.prefix === prefix) {
|
|
27059
|
+
return ns.namespace !== uri;
|
|
27517
27060
|
}
|
|
27518
27061
|
}
|
|
27519
|
-
//console.log(isHTML,uri,prefix=='')
|
|
27520
|
-
//if(isHTML && prefix ==null && uri == 'http://www.w3.org/1999/xhtml'){
|
|
27521
|
-
// return false;
|
|
27522
|
-
//}
|
|
27523
|
-
//node.flag = '11111'
|
|
27524
|
-
//console.error(3,true,node.flag,node.prefix,node.namespaceURI)
|
|
27525
27062
|
return true;
|
|
27526
27063
|
}
|
|
27064
|
+
/**
|
|
27065
|
+
* Well-formed constraint: No < in Attribute Values
|
|
27066
|
+
* The replacement text of any entity referred to directly or indirectly in an attribute value must not contain a <.
|
|
27067
|
+
* @see https://www.w3.org/TR/xml/#CleanAttrVals
|
|
27068
|
+
* @see https://www.w3.org/TR/xml/#NT-AttValue
|
|
27069
|
+
*/
|
|
27070
|
+
function addSerializedAttribute(buf, qualifiedName, value) {
|
|
27071
|
+
buf.push(' ', qualifiedName, '="', value.replace(/[<&"]/g,_xmlEncoder), '"');
|
|
27072
|
+
}
|
|
27073
|
+
|
|
27527
27074
|
function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
|
27075
|
+
if (!visibleNamespaces) {
|
|
27076
|
+
visibleNamespaces = [];
|
|
27077
|
+
}
|
|
27078
|
+
|
|
27528
27079
|
if(nodeFilter){
|
|
27529
27080
|
node = nodeFilter(node);
|
|
27530
27081
|
if(node){
|
|
@@ -27537,20 +27088,40 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27537
27088
|
}
|
|
27538
27089
|
//buf.sort.apply(attrs, attributeSorter);
|
|
27539
27090
|
}
|
|
27091
|
+
|
|
27540
27092
|
switch(node.nodeType){
|
|
27541
27093
|
case ELEMENT_NODE:
|
|
27542
|
-
if (!visibleNamespaces) visibleNamespaces = [];
|
|
27543
|
-
visibleNamespaces.length;
|
|
27544
27094
|
var attrs = node.attributes;
|
|
27545
27095
|
var len = attrs.length;
|
|
27546
27096
|
var child = node.firstChild;
|
|
27547
27097
|
var nodeName = node.tagName;
|
|
27548
27098
|
|
|
27549
|
-
isHTML =
|
|
27550
|
-
|
|
27551
|
-
|
|
27552
|
-
|
|
27553
|
-
|
|
27099
|
+
isHTML = NAMESPACE$1.isHTML(node.namespaceURI) || isHTML;
|
|
27100
|
+
|
|
27101
|
+
var prefixedNodeName = nodeName;
|
|
27102
|
+
if (!isHTML && !node.prefix && node.namespaceURI) {
|
|
27103
|
+
var defaultNS;
|
|
27104
|
+
for (var ai = 0; ai < attrs.length; ai++) {
|
|
27105
|
+
if (attrs.item(ai).name === 'xmlns') {
|
|
27106
|
+
defaultNS = attrs.item(ai).value;
|
|
27107
|
+
break
|
|
27108
|
+
}
|
|
27109
|
+
}
|
|
27110
|
+
if (defaultNS !== node.namespaceURI) {
|
|
27111
|
+
for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
|
|
27112
|
+
var namespace = visibleNamespaces[nsi];
|
|
27113
|
+
if (namespace.namespace === node.namespaceURI) {
|
|
27114
|
+
if (namespace.prefix) {
|
|
27115
|
+
prefixedNodeName = namespace.prefix + ':' + nodeName;
|
|
27116
|
+
}
|
|
27117
|
+
break
|
|
27118
|
+
}
|
|
27119
|
+
}
|
|
27120
|
+
}
|
|
27121
|
+
}
|
|
27122
|
+
|
|
27123
|
+
buf.push('<', prefixedNodeName);
|
|
27124
|
+
|
|
27554
27125
|
for(var i=0;i<len;i++){
|
|
27555
27126
|
// add namespaces for attributes
|
|
27556
27127
|
var attr = attrs.item(i);
|
|
@@ -27560,28 +27131,24 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27560
27131
|
visibleNamespaces.push({ prefix: '', namespace: attr.value });
|
|
27561
27132
|
}
|
|
27562
27133
|
}
|
|
27134
|
+
|
|
27563
27135
|
for(var i=0;i<len;i++){
|
|
27564
27136
|
var attr = attrs.item(i);
|
|
27565
27137
|
if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
|
|
27566
27138
|
var prefix = attr.prefix||'';
|
|
27567
27139
|
var uri = attr.namespaceURI;
|
|
27568
|
-
|
|
27569
|
-
buf.push(ns, '="' , uri , '"');
|
|
27140
|
+
addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
|
|
27570
27141
|
visibleNamespaces.push({ prefix: prefix, namespace:uri });
|
|
27571
27142
|
}
|
|
27572
27143
|
serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
|
|
27573
27144
|
}
|
|
27145
|
+
|
|
27574
27146
|
// add namespace for current node
|
|
27575
|
-
if (needNamespaceDefine(node,isHTML, visibleNamespaces)) {
|
|
27147
|
+
if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
|
|
27576
27148
|
var prefix = node.prefix||'';
|
|
27577
27149
|
var uri = node.namespaceURI;
|
|
27578
|
-
|
|
27579
|
-
|
|
27580
|
-
// Empty namespace URL will we produce an invalid XML document
|
|
27581
|
-
var ns = prefix ? ' xmlns:' + prefix : " xmlns";
|
|
27582
|
-
buf.push(ns, '="' , uri , '"');
|
|
27583
|
-
visibleNamespaces.push({ prefix: prefix, namespace:uri });
|
|
27584
|
-
}
|
|
27150
|
+
addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
|
|
27151
|
+
visibleNamespaces.push({ prefix: prefix, namespace:uri });
|
|
27585
27152
|
}
|
|
27586
27153
|
|
|
27587
27154
|
if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
|
|
@@ -27592,18 +27159,18 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27592
27159
|
if(child.data){
|
|
27593
27160
|
buf.push(child.data);
|
|
27594
27161
|
}else {
|
|
27595
|
-
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
|
27162
|
+
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
|
|
27596
27163
|
}
|
|
27597
27164
|
child = child.nextSibling;
|
|
27598
27165
|
}
|
|
27599
27166
|
}else
|
|
27600
27167
|
{
|
|
27601
27168
|
while(child){
|
|
27602
|
-
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
|
27169
|
+
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
|
|
27603
27170
|
child = child.nextSibling;
|
|
27604
27171
|
}
|
|
27605
27172
|
}
|
|
27606
|
-
buf.push('</',
|
|
27173
|
+
buf.push('</',prefixedNodeName,'>');
|
|
27607
27174
|
}else {
|
|
27608
27175
|
buf.push('/>');
|
|
27609
27176
|
}
|
|
@@ -27614,18 +27181,12 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27614
27181
|
case DOCUMENT_FRAGMENT_NODE:
|
|
27615
27182
|
var child = node.firstChild;
|
|
27616
27183
|
while(child){
|
|
27617
|
-
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
|
27184
|
+
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
|
|
27618
27185
|
child = child.nextSibling;
|
|
27619
27186
|
}
|
|
27620
27187
|
return;
|
|
27621
27188
|
case ATTRIBUTE_NODE:
|
|
27622
|
-
|
|
27623
|
-
* Well-formedness constraint: No < in Attribute Values
|
|
27624
|
-
* The replacement text of any entity referred to directly or indirectly in an attribute value must not contain a <.
|
|
27625
|
-
* @see https://www.w3.org/TR/xml/#CleanAttrVals
|
|
27626
|
-
* @see https://www.w3.org/TR/xml/#NT-AttValue
|
|
27627
|
-
*/
|
|
27628
|
-
return buf.push(' ', node.name, '="', node.value.replace(/[<&"]/g,_xmlEncoder), '"');
|
|
27189
|
+
return addSerializedAttribute(buf, node.name, node.value);
|
|
27629
27190
|
case TEXT_NODE:
|
|
27630
27191
|
/**
|
|
27631
27192
|
* The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
|
|
@@ -27776,10 +27337,12 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27776
27337
|
return this.$$length;
|
|
27777
27338
|
}
|
|
27778
27339
|
});
|
|
27340
|
+
|
|
27779
27341
|
Object.defineProperty(Node.prototype,'textContent',{
|
|
27780
27342
|
get:function(){
|
|
27781
27343
|
return getTextContent(this);
|
|
27782
27344
|
},
|
|
27345
|
+
|
|
27783
27346
|
set:function(data){
|
|
27784
27347
|
switch(this.nodeType){
|
|
27785
27348
|
case ELEMENT_NODE:
|
|
@@ -27791,8 +27354,8 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27791
27354
|
this.appendChild(this.ownerDocument.createTextNode(data));
|
|
27792
27355
|
}
|
|
27793
27356
|
break;
|
|
27357
|
+
|
|
27794
27358
|
default:
|
|
27795
|
-
//TODO:
|
|
27796
27359
|
this.data = data;
|
|
27797
27360
|
this.value = data;
|
|
27798
27361
|
this.nodeValue = data;
|
|
@@ -27817,6 +27380,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27817
27380
|
return node.nodeValue;
|
|
27818
27381
|
}
|
|
27819
27382
|
}
|
|
27383
|
+
|
|
27820
27384
|
__set__ = function(object,key,value){
|
|
27821
27385
|
//console.log(value)
|
|
27822
27386
|
object['$$'+key] = value;
|
|
@@ -27826,11 +27390,19 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27826
27390
|
}
|
|
27827
27391
|
|
|
27828
27392
|
//if(typeof require == 'function'){
|
|
27829
|
-
dom.
|
|
27393
|
+
dom.DocumentType = DocumentType;
|
|
27830
27394
|
dom.DOMException = DOMException;
|
|
27831
27395
|
dom.DOMImplementation = DOMImplementation$1;
|
|
27396
|
+
dom.Element = Element;
|
|
27397
|
+
dom.Node = Node;
|
|
27398
|
+
dom.NodeList = NodeList;
|
|
27832
27399
|
dom.XMLSerializer = XMLSerializer;
|
|
27833
27400
|
|
|
27401
|
+
var conventions = conventions$2;
|
|
27402
|
+
var entities = entities$1;
|
|
27403
|
+
|
|
27404
|
+
var NAMESPACE = conventions.NAMESPACE;
|
|
27405
|
+
|
|
27834
27406
|
function DOMParser(options){
|
|
27835
27407
|
this.options = options ||{locator:{}};
|
|
27836
27408
|
}
|
|
@@ -27843,7 +27415,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27843
27415
|
var locator = options.locator;
|
|
27844
27416
|
var defaultNSMap = options.xmlns||{};
|
|
27845
27417
|
var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;
|
|
27846
|
-
var entityMap = isHTML?
|
|
27418
|
+
var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
|
|
27847
27419
|
if(locator){
|
|
27848
27420
|
domBuilder.setDocumentLocator(locator);
|
|
27849
27421
|
}
|
|
@@ -27851,9 +27423,9 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27851
27423
|
sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
|
|
27852
27424
|
sax.domBuilder = options.domBuilder || domBuilder;
|
|
27853
27425
|
if(isHTML){
|
|
27854
|
-
defaultNSMap['']=
|
|
27426
|
+
defaultNSMap[''] = NAMESPACE.HTML;
|
|
27855
27427
|
}
|
|
27856
|
-
defaultNSMap.xml = defaultNSMap.xml ||
|
|
27428
|
+
defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
|
|
27857
27429
|
if(source && typeof source === 'string'){
|
|
27858
27430
|
sax.parse(source,defaultNSMap,entityMap);
|
|
27859
27431
|
}else {
|
|
@@ -28075,7 +27647,6 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28075
27647
|
}//appendChild and setAttributeNS are preformance key
|
|
28076
27648
|
|
|
28077
27649
|
//if(typeof require == 'function'){
|
|
28078
|
-
var htmlEntity = entities;
|
|
28079
27650
|
var sax = sax$1;
|
|
28080
27651
|
var XMLReader = sax.XMLReader;
|
|
28081
27652
|
var ParseError = sax.ParseError;
|
|
@@ -28311,8 +27882,8 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28311
27882
|
* XMLHttpRequest override class.
|
|
28312
27883
|
* Inspired by https://github.com/marvinhagemeister/xhr-mocklet.
|
|
28313
27884
|
*/
|
|
28314
|
-
var until_1 = lib;
|
|
28315
|
-
var headers_utils_1 = lib$
|
|
27885
|
+
var until_1 = lib$3;
|
|
27886
|
+
var headers_utils_1 = lib$6;
|
|
28316
27887
|
var xmldom_1 = domParser;
|
|
28317
27888
|
var parseJson_1 = parseJson$1;
|
|
28318
27889
|
var toIsoResponse_1 = toIsoResponse$1;
|
|
@@ -28774,7 +28345,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28774
28345
|
}
|
|
28775
28346
|
|
|
28776
28347
|
function createFallbackRequestListener(context, options) {
|
|
28777
|
-
const interceptor = lib
|
|
28348
|
+
const interceptor = lib.createInterceptor({
|
|
28778
28349
|
modules: [interceptFetch_1, interceptXMLHttpRequest_1],
|
|
28779
28350
|
resolver(request) {
|
|
28780
28351
|
return __awaiter$3(this, void 0, void 0, function* () {
|
|
@@ -28822,6 +28393,23 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28822
28393
|
};
|
|
28823
28394
|
}
|
|
28824
28395
|
|
|
28396
|
+
/**
|
|
28397
|
+
* Pipes all emitted events from one emitter to another.
|
|
28398
|
+
*/
|
|
28399
|
+
function pipeEvents(source, destination) {
|
|
28400
|
+
const rawEmit = source.emit;
|
|
28401
|
+
// @ts-ignore
|
|
28402
|
+
if (rawEmit._isPiped) {
|
|
28403
|
+
return;
|
|
28404
|
+
}
|
|
28405
|
+
source.emit = function (event, ...data) {
|
|
28406
|
+
destination.emit(event, ...data);
|
|
28407
|
+
return rawEmit.call(this, event, ...data);
|
|
28408
|
+
};
|
|
28409
|
+
// @ts-ignore
|
|
28410
|
+
source.emit._isPiped = true;
|
|
28411
|
+
}
|
|
28412
|
+
|
|
28825
28413
|
// Declare the list of event handlers on the module's scope
|
|
28826
28414
|
// so it persists between Fash refreshes of the application's code.
|
|
28827
28415
|
let listeners = [];
|
|
@@ -28837,15 +28425,18 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28837
28425
|
throw new Error(devUtils.formatMessage('Failed to call "setupWorker" given an Array of request handlers (setupWorker([a, b])), expected to receive each handler individually: setupWorker(a, b).'));
|
|
28838
28426
|
});
|
|
28839
28427
|
// Error when attempting to run this function in a Node.js environment.
|
|
28840
|
-
if (lib$
|
|
28428
|
+
if (lib$5.exports.isNodeProcess()) {
|
|
28841
28429
|
throw new Error(devUtils.formatMessage('Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead.'));
|
|
28842
28430
|
}
|
|
28431
|
+
const emitter = new lib$4.StrictEventEmitter();
|
|
28432
|
+
const publicEmitter = new lib$4.StrictEventEmitter();
|
|
28433
|
+
pipeEvents(emitter, publicEmitter);
|
|
28843
28434
|
const context = {
|
|
28844
28435
|
startOptions: undefined,
|
|
28845
28436
|
worker: null,
|
|
28846
28437
|
registration: null,
|
|
28847
28438
|
requestHandlers: [...requestHandlers],
|
|
28848
|
-
emitter
|
|
28439
|
+
emitter,
|
|
28849
28440
|
workerChannel: {
|
|
28850
28441
|
on(eventType, callback) {
|
|
28851
28442
|
context.events.addListener(navigator.serviceWorker, 'message', (event) => {
|
|
@@ -28911,7 +28502,12 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28911
28502
|
: createStop(context);
|
|
28912
28503
|
return {
|
|
28913
28504
|
start: prepareStartHandler(startHandler, context),
|
|
28914
|
-
stop
|
|
28505
|
+
stop() {
|
|
28506
|
+
context.events.removeAllListeners();
|
|
28507
|
+
context.emitter.removeAllListeners();
|
|
28508
|
+
publicEmitter.removeAllListeners();
|
|
28509
|
+
stopHandler();
|
|
28510
|
+
},
|
|
28915
28511
|
use(...handlers) {
|
|
28916
28512
|
use(context.requestHandlers, ...handlers);
|
|
28917
28513
|
},
|
|
@@ -28938,8 +28534,16 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28938
28534
|
console.groupEnd();
|
|
28939
28535
|
});
|
|
28940
28536
|
},
|
|
28941
|
-
|
|
28942
|
-
|
|
28537
|
+
events: {
|
|
28538
|
+
on(...args) {
|
|
28539
|
+
return publicEmitter.on(...args);
|
|
28540
|
+
},
|
|
28541
|
+
removeListener(...args) {
|
|
28542
|
+
return publicEmitter.removeListener(...args);
|
|
28543
|
+
},
|
|
28544
|
+
removeAllListeners(...args) {
|
|
28545
|
+
return publicEmitter.removeAllListeners(...args);
|
|
28546
|
+
},
|
|
28943
28547
|
},
|
|
28944
28548
|
};
|
|
28945
28549
|
}
|
|
@@ -28950,6 +28554,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28950
28554
|
};
|
|
28951
28555
|
}
|
|
28952
28556
|
const rest = {
|
|
28557
|
+
all: createRestHandler(/.+/),
|
|
28953
28558
|
head: createRestHandler(exports.RESTMethods.HEAD),
|
|
28954
28559
|
get: createRestHandler(exports.RESTMethods.GET),
|
|
28955
28560
|
post: createRestHandler(exports.RESTMethods.POST),
|
|
@@ -29010,6 +28615,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
29010
28615
|
exports.GraphQLHandler = GraphQLHandler;
|
|
29011
28616
|
exports.RequestHandler = RequestHandler;
|
|
29012
28617
|
exports.RestHandler = RestHandler;
|
|
28618
|
+
exports.cleanUrl = cleanUrl;
|
|
29013
28619
|
exports.compose = compose;
|
|
29014
28620
|
exports.context = index;
|
|
29015
28621
|
exports.createResponseComposition = createResponseComposition;
|
|
@@ -29025,4 +28631,4 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
29025
28631
|
exports.restContext = restContext;
|
|
29026
28632
|
exports.setupWorker = setupWorker;
|
|
29027
28633
|
|
|
29028
|
-
}))
|
|
28634
|
+
}));
|