msw 1.2.0 → 1.2.2

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/iife/index.js CHANGED
@@ -137,25 +137,6 @@ var MockServiceWorker = (() => {
137
137
  }
138
138
  });
139
139
 
140
- // node_modules/.pnpm/is-node-process@1.0.1/node_modules/is-node-process/lib/index.js
141
- var require_lib = __commonJS({
142
- "node_modules/.pnpm/is-node-process@1.0.1/node_modules/is-node-process/lib/index.js"(exports, module) {
143
- (function(global2, factory) {
144
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.IsNodeProcess = {}));
145
- })(exports, function(exports2) {
146
- "use strict";
147
- function isNodeProcess4() {
148
- if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
149
- return true;
150
- }
151
- return !!(typeof process !== "undefined" && process.versions && process.versions.node);
152
- }
153
- exports2.isNodeProcess = isNodeProcess4;
154
- Object.defineProperty(exports2, "__esModule", { value: true });
155
- });
156
- }
157
- });
158
-
159
140
  // node_modules/.pnpm/node-fetch@2.6.9/node_modules/node-fetch/browser.js
160
141
  var require_browser = __commonJS({
161
142
  "node_modules/.pnpm/node-fetch@2.6.9/node_modules/node-fetch/browser.js"(exports, module) {
@@ -183,176 +164,6 @@ var MockServiceWorker = (() => {
183
164
  }
184
165
  });
185
166
 
186
- // node_modules/.pnpm/outvariant@1.3.0/node_modules/outvariant/lib/format.js
187
- var require_format = __commonJS({
188
- "node_modules/.pnpm/outvariant@1.3.0/node_modules/outvariant/lib/format.js"(exports) {
189
- "use strict";
190
- Object.defineProperty(exports, "__esModule", { value: true });
191
- exports.format = void 0;
192
- var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
193
- function serializePositional(positional, flag) {
194
- switch (flag) {
195
- case "s":
196
- return positional;
197
- case "d":
198
- case "i":
199
- return Number(positional);
200
- case "j":
201
- return JSON.stringify(positional);
202
- case "o": {
203
- if (typeof positional === "string") {
204
- return positional;
205
- }
206
- var json2 = JSON.stringify(positional);
207
- if (json2 === "{}" || json2 === "[]" || /^\[object .+?\]$/.test(json2)) {
208
- return positional;
209
- }
210
- return json2;
211
- }
212
- }
213
- }
214
- function format2(message) {
215
- var positionals = [];
216
- for (var _i = 1; _i < arguments.length; _i++) {
217
- positionals[_i - 1] = arguments[_i];
218
- }
219
- if (positionals.length === 0) {
220
- return message;
221
- }
222
- var positionalIndex = 0;
223
- var formattedMessage = message.replace(POSITIONALS_EXP, function(match2, isEscaped, _, flag) {
224
- var positional = positionals[positionalIndex];
225
- var value = serializePositional(positional, flag);
226
- if (!isEscaped) {
227
- positionalIndex++;
228
- return value;
229
- }
230
- return match2;
231
- });
232
- if (positionalIndex < positionals.length) {
233
- formattedMessage += " " + positionals.slice(positionalIndex).join(" ");
234
- }
235
- formattedMessage = formattedMessage.replace(/%{2,2}/g, "%");
236
- return formattedMessage;
237
- }
238
- exports.format = format2;
239
- }
240
- });
241
-
242
- // node_modules/.pnpm/outvariant@1.3.0/node_modules/outvariant/lib/invariant.js
243
- var require_invariant = __commonJS({
244
- "node_modules/.pnpm/outvariant@1.3.0/node_modules/outvariant/lib/invariant.js"(exports) {
245
- "use strict";
246
- var __extends = exports && exports.__extends || function() {
247
- var extendStatics = function(d, b) {
248
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
249
- d2.__proto__ = b2;
250
- } || function(d2, b2) {
251
- for (var p in b2)
252
- if (Object.prototype.hasOwnProperty.call(b2, p))
253
- d2[p] = b2[p];
254
- };
255
- return extendStatics(d, b);
256
- };
257
- return function(d, b) {
258
- if (typeof b !== "function" && b !== null)
259
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
260
- extendStatics(d, b);
261
- function __() {
262
- this.constructor = d;
263
- }
264
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
265
- };
266
- }();
267
- var __spreadArray = exports && exports.__spreadArray || function(to, from) {
268
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
269
- to[j] = from[i];
270
- return to;
271
- };
272
- Object.defineProperty(exports, "__esModule", { value: true });
273
- exports.invariant = exports.createInvariantWith = exports.InvariantError = void 0;
274
- var format_1 = require_format();
275
- var STACK_FRAMES_TO_IGNORE = 2;
276
- function cleanErrorStack(error2) {
277
- if (!error2.stack) {
278
- return;
279
- }
280
- var nextStack = error2.stack.split("\n");
281
- nextStack.splice(1, STACK_FRAMES_TO_IGNORE);
282
- error2.stack = nextStack.join("\n");
283
- }
284
- var InvariantError = function(_super) {
285
- __extends(InvariantError2, _super);
286
- function InvariantError2(message) {
287
- var positionals = [];
288
- for (var _i = 1; _i < arguments.length; _i++) {
289
- positionals[_i - 1] = arguments[_i];
290
- }
291
- var _this = _super.call(this, message) || this;
292
- _this.message = message;
293
- _this.name = "Invariant Violation";
294
- _this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
295
- cleanErrorStack(_this);
296
- return _this;
297
- }
298
- return InvariantError2;
299
- }(Error);
300
- exports.InvariantError = InvariantError;
301
- function createInvariantWith(ErrorConstructor) {
302
- var invariant6 = function(predicate, message) {
303
- var positionals = [];
304
- for (var _i = 2; _i < arguments.length; _i++) {
305
- positionals[_i - 2] = arguments[_i];
306
- }
307
- if (!predicate) {
308
- var resolvedMessage = format_1.format.apply(void 0, __spreadArray([message], positionals));
309
- var isConstructor = !!ErrorConstructor.prototype.name;
310
- var error2 = isConstructor ? new ErrorConstructor(resolvedMessage) : ErrorConstructor(resolvedMessage);
311
- cleanErrorStack(error2);
312
- throw error2;
313
- }
314
- };
315
- return invariant6;
316
- }
317
- exports.createInvariantWith = createInvariantWith;
318
- function polymorphicInvariant(ErrorClass) {
319
- var args = [];
320
- for (var _i = 1; _i < arguments.length; _i++) {
321
- args[_i - 1] = arguments[_i];
322
- }
323
- return createInvariantWith(ErrorClass).apply(void 0, args);
324
- }
325
- exports.invariant = createInvariantWith(InvariantError);
326
- exports.invariant.as = polymorphicInvariant;
327
- }
328
- });
329
-
330
- // node_modules/.pnpm/outvariant@1.3.0/node_modules/outvariant/lib/index.js
331
- var require_lib2 = __commonJS({
332
- "node_modules/.pnpm/outvariant@1.3.0/node_modules/outvariant/lib/index.js"(exports) {
333
- "use strict";
334
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
335
- if (k2 === void 0)
336
- k2 = k;
337
- Object.defineProperty(o, k2, { enumerable: true, get: function() {
338
- return m[k];
339
- } });
340
- } : function(o, m, k, k2) {
341
- if (k2 === void 0)
342
- k2 = k;
343
- o[k2] = m[k];
344
- });
345
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
346
- for (var p in m)
347
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
348
- __createBinding(exports2, m, p);
349
- };
350
- Object.defineProperty(exports, "__esModule", { value: true });
351
- __exportStar(require_invariant(), exports);
352
- __exportStar(require_format(), exports);
353
- }
354
- });
355
-
356
167
  // node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/until.js
357
168
  var require_until = __commonJS({
358
169
  "node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/until.js"(exports) {
@@ -372,7 +183,7 @@ var MockServiceWorker = (() => {
372
183
  });
373
184
 
374
185
  // node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/index.js
375
- var require_lib3 = __commonJS({
186
+ var require_lib = __commonJS({
376
187
  "node_modules/.pnpm/@open-draft+until@1.0.3/node_modules/@open-draft/until/lib/index.js"(exports) {
377
188
  "use strict";
378
189
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1299,7 +1110,7 @@ var MockServiceWorker = (() => {
1299
1110
  });
1300
1111
 
1301
1112
  // node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/index.js
1302
- var require_lib4 = __commonJS({
1113
+ var require_lib2 = __commonJS({
1303
1114
  "node_modules/.pnpm/strict-event-emitter@0.2.8/node_modules/strict-event-emitter/lib/index.js"(exports) {
1304
1115
  "use strict";
1305
1116
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -1501,7 +1312,7 @@ var MockServiceWorker = (() => {
1501
1312
  Object.defineProperty(exports, "__esModule", { value: true });
1502
1313
  exports.AsyncEventEmitter = exports.AsyncEventEmitterReadyState = void 0;
1503
1314
  var debug_1 = require_browser2();
1504
- var strict_event_emitter_1 = require_lib4();
1315
+ var strict_event_emitter_1 = require_lib2();
1505
1316
  var nextTick_1 = require_nextTick();
1506
1317
  var AsyncEventEmitterReadyState;
1507
1318
  (function(AsyncEventEmitterReadyState2) {
@@ -1919,7 +1730,7 @@ var MockServiceWorker = (() => {
1919
1730
  });
1920
1731
 
1921
1732
  // node_modules/.pnpm/headers-polyfill@3.1.2/node_modules/headers-polyfill/lib/index.js
1922
- var require_lib5 = __commonJS({
1733
+ var require_lib3 = __commonJS({
1923
1734
  "node_modules/.pnpm/headers-polyfill@3.1.2/node_modules/headers-polyfill/lib/index.js"(exports, module) {
1924
1735
  var __defProp2 = Object.defineProperty;
1925
1736
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -2136,6 +1947,112 @@ var MockServiceWorker = (() => {
2136
1947
  }
2137
1948
  });
2138
1949
 
1950
+ // node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/lib/index.js
1951
+ var require_lib4 = __commonJS({
1952
+ "node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/lib/index.js"(exports, module) {
1953
+ "use strict";
1954
+ var __defProp2 = Object.defineProperty;
1955
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1956
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
1957
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1958
+ var __export2 = (target, all) => {
1959
+ for (var name in all)
1960
+ __defProp2(target, name, { get: all[name], enumerable: true });
1961
+ };
1962
+ var __copyProps2 = (to, from, except, desc) => {
1963
+ if (from && typeof from === "object" || typeof from === "function") {
1964
+ for (let key of __getOwnPropNames2(from))
1965
+ if (!__hasOwnProp2.call(to, key) && key !== except)
1966
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1967
+ }
1968
+ return to;
1969
+ };
1970
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1971
+ var src_exports2 = {};
1972
+ __export2(src_exports2, {
1973
+ InvariantError: () => InvariantError2,
1974
+ format: () => format2,
1975
+ invariant: () => invariant3
1976
+ });
1977
+ module.exports = __toCommonJS2(src_exports2);
1978
+ var POSITIONALS_EXP2 = /(%?)(%([sdjo]))/g;
1979
+ function serializePositional2(positional, flag) {
1980
+ switch (flag) {
1981
+ case "s":
1982
+ return positional;
1983
+ case "d":
1984
+ case "i":
1985
+ return Number(positional);
1986
+ case "j":
1987
+ return JSON.stringify(positional);
1988
+ case "o": {
1989
+ if (typeof positional === "string") {
1990
+ return positional;
1991
+ }
1992
+ const json2 = JSON.stringify(positional);
1993
+ if (json2 === "{}" || json2 === "[]" || /^\[object .+?\]$/.test(json2)) {
1994
+ return positional;
1995
+ }
1996
+ return json2;
1997
+ }
1998
+ }
1999
+ }
2000
+ function format2(message, ...positionals) {
2001
+ if (positionals.length === 0) {
2002
+ return message;
2003
+ }
2004
+ let positionalIndex = 0;
2005
+ let formattedMessage = message.replace(
2006
+ POSITIONALS_EXP2,
2007
+ (match2, isEscaped, _, flag) => {
2008
+ const positional = positionals[positionalIndex];
2009
+ const value = serializePositional2(positional, flag);
2010
+ if (!isEscaped) {
2011
+ positionalIndex++;
2012
+ return value;
2013
+ }
2014
+ return match2;
2015
+ }
2016
+ );
2017
+ if (positionalIndex < positionals.length) {
2018
+ formattedMessage += ` ${positionals.slice(positionalIndex).join(" ")}`;
2019
+ }
2020
+ formattedMessage = formattedMessage.replace(/%{2,2}/g, "%");
2021
+ return formattedMessage;
2022
+ }
2023
+ var STACK_FRAMES_TO_IGNORE2 = 2;
2024
+ function cleanErrorStack2(error2) {
2025
+ if (!error2.stack) {
2026
+ return;
2027
+ }
2028
+ const nextStack = error2.stack.split("\n");
2029
+ nextStack.splice(1, STACK_FRAMES_TO_IGNORE2);
2030
+ error2.stack = nextStack.join("\n");
2031
+ }
2032
+ var InvariantError2 = class extends Error {
2033
+ constructor(message, ...positionals) {
2034
+ super(message);
2035
+ this.message = message;
2036
+ this.name = "Invariant Violation";
2037
+ this.message = format2(message, ...positionals);
2038
+ cleanErrorStack2(this);
2039
+ }
2040
+ };
2041
+ var invariant3 = (predicate, message, ...positionals) => {
2042
+ if (!predicate) {
2043
+ throw new InvariantError2(message, ...positionals);
2044
+ }
2045
+ };
2046
+ invariant3.as = (ErrorConstructor, predicate, message, ...positionals) => {
2047
+ if (!predicate) {
2048
+ const isConstructor = ErrorConstructor.prototype.name != null;
2049
+ const error2 = isConstructor ? new ErrorConstructor(format2(message, positionals)) : ErrorConstructor(format2(message, positionals));
2050
+ throw error2;
2051
+ }
2052
+ };
2053
+ }
2054
+ });
2055
+
2139
2056
  // node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js
2140
2057
  var require_shams = __commonJS({
2141
2058
  "node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js"(exports, module) {
@@ -3910,7 +3827,7 @@ var MockServiceWorker = (() => {
3910
3827
  });
3911
3828
 
3912
3829
  // node_modules/.pnpm/web-encoding@1.1.5/node_modules/web-encoding/src/lib.js
3913
- var require_lib6 = __commonJS({
3830
+ var require_lib5 = __commonJS({
3914
3831
  "node_modules/.pnpm/web-encoding@1.1.5/node_modules/web-encoding/src/lib.js"(exports) {
3915
3832
  "use strict";
3916
3833
  exports.TextEncoder = typeof TextEncoder !== "undefined" ? TextEncoder : require_util().TextEncoder;
@@ -3924,7 +3841,7 @@ var MockServiceWorker = (() => {
3924
3841
  "use strict";
3925
3842
  Object.defineProperty(exports, "__esModule", { value: true });
3926
3843
  exports.getArrayBuffer = exports.decodeBuffer = exports.encodeBuffer = void 0;
3927
- var web_encoding_1 = require_lib6();
3844
+ var web_encoding_1 = require_lib5();
3928
3845
  function encodeBuffer3(text2) {
3929
3846
  var encoder = new web_encoding_1.TextEncoder();
3930
3847
  var encoded = encoder.encode(text2);
@@ -4069,8 +3986,8 @@ var MockServiceWorker = (() => {
4069
3986
  };
4070
3987
  Object.defineProperty(exports, "__esModule", { value: true });
4071
3988
  exports.IsomorphicRequest = void 0;
4072
- var headers_polyfill_1 = require_lib5();
4073
- var outvariant_1 = require_lib2();
3989
+ var headers_polyfill_1 = require_lib3();
3990
+ var outvariant_1 = require_lib4();
4074
3991
  var bufferUtils_1 = require_bufferUtils();
4075
3992
  var uuid_1 = require_uuid();
4076
3993
  var IsomorphicRequest2 = function() {
@@ -4318,7 +4235,7 @@ var MockServiceWorker = (() => {
4318
4235
  }();
4319
4236
  Object.defineProperty(exports, "__esModule", { value: true });
4320
4237
  exports.InteractiveIsomorphicRequest = void 0;
4321
- var outvariant_1 = require_lib2();
4238
+ var outvariant_1 = require_lib4();
4322
4239
  var IsomorphicRequest_1 = require_IsomorphicRequest();
4323
4240
  var createLazyCallback_1 = require_createLazyCallback();
4324
4241
  var InteractiveIsomorphicRequest = function(_super) {
@@ -4356,7 +4273,7 @@ var MockServiceWorker = (() => {
4356
4273
  });
4357
4274
 
4358
4275
  // node_modules/.pnpm/@mswjs+interceptors@0.17.7/node_modules/@mswjs/interceptors/lib/index.js
4359
- var require_lib7 = __commonJS({
4276
+ var require_lib6 = __commonJS({
4360
4277
  "node_modules/.pnpm/@mswjs+interceptors@0.17.7/node_modules/@mswjs/interceptors/lib/index.js"(exports) {
4361
4278
  "use strict";
4362
4279
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -4711,7 +4628,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
4711
4628
  });
4712
4629
 
4713
4630
  // node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/index.js
4714
- var require_lib8 = __commonJS({
4631
+ var require_lib7 = __commonJS({
4715
4632
  "node_modules/.pnpm/@mswjs+cookies@0.2.2/node_modules/@mswjs/cookies/lib/index.js"(exports) {
4716
4633
  "use strict";
4717
4634
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -4827,7 +4744,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
4827
4744
  "use strict";
4828
4745
  Object.defineProperty(exports, "__esModule", { value: true });
4829
4746
  exports.toIsoResponse = void 0;
4830
- var headers_polyfill_1 = require_lib5();
4747
+ var headers_polyfill_1 = require_lib3();
4831
4748
  function toIsoResponse(response2) {
4832
4749
  var _a2;
4833
4750
  return {
@@ -5004,8 +4921,8 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
5004
4921
  };
5005
4922
  Object.defineProperty(exports, "__esModule", { value: true });
5006
4923
  exports.FetchInterceptor = void 0;
5007
- var headers_polyfill_1 = require_lib5();
5008
- var outvariant_1 = require_lib2();
4924
+ var headers_polyfill_1 = require_lib3();
4925
+ var outvariant_1 = require_lib4();
5009
4926
  var IsomorphicRequest_1 = require_IsomorphicRequest();
5010
4927
  var glossary_1 = require_glossary();
5011
4928
  var Interceptor_1 = require_Interceptor();
@@ -7492,7 +7409,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
7492
7409
  });
7493
7410
 
7494
7411
  // node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/index.js
7495
- var require_lib9 = __commonJS({
7412
+ var require_lib8 = __commonJS({
7496
7413
  "node_modules/.pnpm/@xmldom+xmldom@0.8.6/node_modules/@xmldom/xmldom/lib/index.js"(exports) {
7497
7414
  var dom = require_dom();
7498
7415
  exports.DOMImplementation = dom.DOMImplementation;
@@ -7814,9 +7731,9 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
7814
7731
  };
7815
7732
  Object.defineProperty(exports, "__esModule", { value: true });
7816
7733
  exports.createXMLHttpRequestOverride = void 0;
7817
- var until_1 = require_lib3();
7818
- var headers_polyfill_1 = require_lib5();
7819
- var xmldom_1 = require_lib9();
7734
+ var until_1 = require_lib();
7735
+ var headers_polyfill_1 = require_lib3();
7736
+ var xmldom_1 = require_lib8();
7820
7737
  var parseJson_1 = require_parseJson();
7821
7738
  var toIsoResponse_1 = require_toIsoResponse();
7822
7739
  var bufferFrom_1 = require_bufferFrom();
@@ -8227,7 +8144,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
8227
8144
  }();
8228
8145
  Object.defineProperty(exports, "__esModule", { value: true });
8229
8146
  exports.XMLHttpRequestInterceptor = void 0;
8230
- var outvariant_1 = require_lib2();
8147
+ var outvariant_1 = require_lib4();
8231
8148
  var glossary_1 = require_glossary();
8232
8149
  var Interceptor_1 = require_Interceptor();
8233
8150
  var XMLHttpRequestOverride_1 = require_XMLHttpRequestOverride();
@@ -8411,7 +8328,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
8411
8328
  });
8412
8329
 
8413
8330
  // node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/index.js
8414
- var require_lib10 = __commonJS({
8331
+ var require_lib9 = __commonJS({
8415
8332
  "node_modules/.pnpm/strict-event-emitter@0.4.6/node_modules/strict-event-emitter/lib/index.js"(exports) {
8416
8333
  "use strict";
8417
8334
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -8806,14 +8723,28 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
8806
8723
  };
8807
8724
  };
8808
8725
 
8726
+ // node_modules/.pnpm/is-node-process@1.2.0/node_modules/is-node-process/lib/index.mjs
8727
+ function isNodeProcess() {
8728
+ if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
8729
+ return true;
8730
+ }
8731
+ if (typeof process !== "undefined") {
8732
+ const type = process.type;
8733
+ if (type === "renderer" || type === "worker") {
8734
+ return false;
8735
+ }
8736
+ return !!(process.versions && process.versions.node);
8737
+ }
8738
+ return false;
8739
+ }
8740
+
8809
8741
  // src/context/delay.ts
8810
- var import_is_node_process = __toESM(require_lib());
8811
8742
  var SET_TIMEOUT_MAX_ALLOWED_INT = 2147483647;
8812
8743
  var MIN_SERVER_RESPONSE_TIME = 100;
8813
8744
  var MAX_SERVER_RESPONSE_TIME = 400;
8814
8745
  var NODE_SERVER_RESPONSE_TIME = 5;
8815
8746
  var getRandomServerResponseTime = () => {
8816
- if ((0, import_is_node_process.isNodeProcess)()) {
8747
+ if (isNodeProcess()) {
8817
8748
  return NODE_SERVER_RESPONSE_TIME;
8818
8749
  }
8819
8750
  return Math.floor(
@@ -8867,8 +8798,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
8867
8798
  };
8868
8799
 
8869
8800
  // src/context/fetch.ts
8870
- var import_is_node_process2 = __toESM(require_lib());
8871
- var useFetch = (0, import_is_node_process2.isNodeProcess)() ? (input, init) => Promise.resolve().then(() => __toESM(require_browser())).then(
8801
+ var useFetch = isNodeProcess() ? (input, init) => Promise.resolve().then(() => __toESM(require_browser())).then(
8872
8802
  ({ default: nodeFetch }) => nodeFetch(input, init)
8873
8803
  ) : globalThis.fetch;
8874
8804
  var augmentRequestInit = (requestInit) => {
@@ -8922,14 +8852,87 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
8922
8852
  };
8923
8853
  };
8924
8854
 
8925
- // src/utils/internal/checkGlobals.ts
8926
- var import_outvariant2 = __toESM(require_lib2());
8855
+ // node_modules/.pnpm/outvariant@1.4.0/node_modules/outvariant/lib/index.mjs
8856
+ var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
8857
+ function serializePositional(positional, flag) {
8858
+ switch (flag) {
8859
+ case "s":
8860
+ return positional;
8861
+ case "d":
8862
+ case "i":
8863
+ return Number(positional);
8864
+ case "j":
8865
+ return JSON.stringify(positional);
8866
+ case "o": {
8867
+ if (typeof positional === "string") {
8868
+ return positional;
8869
+ }
8870
+ const json2 = JSON.stringify(positional);
8871
+ if (json2 === "{}" || json2 === "[]" || /^\[object .+?\]$/.test(json2)) {
8872
+ return positional;
8873
+ }
8874
+ return json2;
8875
+ }
8876
+ }
8877
+ }
8878
+ function format(message, ...positionals) {
8879
+ if (positionals.length === 0) {
8880
+ return message;
8881
+ }
8882
+ let positionalIndex = 0;
8883
+ let formattedMessage = message.replace(
8884
+ POSITIONALS_EXP,
8885
+ (match2, isEscaped, _, flag) => {
8886
+ const positional = positionals[positionalIndex];
8887
+ const value = serializePositional(positional, flag);
8888
+ if (!isEscaped) {
8889
+ positionalIndex++;
8890
+ return value;
8891
+ }
8892
+ return match2;
8893
+ }
8894
+ );
8895
+ if (positionalIndex < positionals.length) {
8896
+ formattedMessage += ` ${positionals.slice(positionalIndex).join(" ")}`;
8897
+ }
8898
+ formattedMessage = formattedMessage.replace(/%{2,2}/g, "%");
8899
+ return formattedMessage;
8900
+ }
8901
+ var STACK_FRAMES_TO_IGNORE = 2;
8902
+ function cleanErrorStack(error2) {
8903
+ if (!error2.stack) {
8904
+ return;
8905
+ }
8906
+ const nextStack = error2.stack.split("\n");
8907
+ nextStack.splice(1, STACK_FRAMES_TO_IGNORE);
8908
+ error2.stack = nextStack.join("\n");
8909
+ }
8910
+ var InvariantError = class extends Error {
8911
+ constructor(message, ...positionals) {
8912
+ super(message);
8913
+ this.message = message;
8914
+ this.name = "Invariant Violation";
8915
+ this.message = format(message, ...positionals);
8916
+ cleanErrorStack(this);
8917
+ }
8918
+ };
8919
+ var invariant = (predicate, message, ...positionals) => {
8920
+ if (!predicate) {
8921
+ throw new InvariantError(message, ...positionals);
8922
+ }
8923
+ };
8924
+ invariant.as = (ErrorConstructor, predicate, message, ...positionals) => {
8925
+ if (!predicate) {
8926
+ const isConstructor = ErrorConstructor.prototype.name != null;
8927
+ const error2 = isConstructor ? new ErrorConstructor(format(message, positionals)) : ErrorConstructor(format(message, positionals));
8928
+ throw error2;
8929
+ }
8930
+ };
8927
8931
 
8928
8932
  // src/utils/internal/devUtils.ts
8929
- var import_outvariant = __toESM(require_lib2());
8930
8933
  var LIBRARY_PREFIX = "[MSW]";
8931
8934
  function formatMessage(message, ...positionals) {
8932
- const interpolatedMessage = (0, import_outvariant.format)(message, ...positionals);
8935
+ const interpolatedMessage = format(message, ...positionals);
8933
8936
  return `${LIBRARY_PREFIX} ${interpolatedMessage}`;
8934
8937
  }
8935
8938
  function warn(message, ...positionals) {
@@ -8946,7 +8949,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
8946
8949
 
8947
8950
  // src/utils/internal/checkGlobals.ts
8948
8951
  function checkGlobals() {
8949
- (0, import_outvariant2.invariant)(
8952
+ invariant(
8950
8953
  typeof URL !== "undefined",
8951
8954
  devUtils.formatMessage(
8952
8955
  `Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".`
@@ -8954,15 +8957,11 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
8954
8957
  );
8955
8958
  }
8956
8959
 
8957
- // src/setupWorker/setupWorker.ts
8958
- var import_outvariant5 = __toESM(require_lib2());
8959
- var import_is_node_process3 = __toESM(require_lib());
8960
-
8961
8960
  // src/setupWorker/start/createStartHandler.ts
8962
- var import_until4 = __toESM(require_lib3());
8961
+ var import_until4 = __toESM(require_lib());
8963
8962
 
8964
8963
  // src/setupWorker/start/utils/getWorkerInstance.ts
8965
- var import_until = __toESM(require_lib3());
8964
+ var import_until = __toESM(require_lib());
8966
8965
 
8967
8966
  // src/setupWorker/start/utils/getWorkerByRegistration.ts
8968
8967
  function getWorkerByRegistration(registration, absoluteWorkerUrl, findWorker) {
@@ -9104,12 +9103,12 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
9104
9103
  };
9105
9104
 
9106
9105
  // src/utils/request/parseWorkerRequest.ts
9107
- var import_interceptors2 = __toESM(require_lib7());
9106
+ var import_interceptors2 = __toESM(require_lib6());
9108
9107
 
9109
9108
  // src/utils/request/MockedRequest.ts
9110
9109
  var cookieUtils3 = __toESM(require_cookie());
9111
- var import_cookies = __toESM(require_lib8());
9112
- var import_interceptors = __toESM(require_lib7());
9110
+ var import_cookies = __toESM(require_lib7());
9111
+ var import_interceptors = __toESM(require_lib6());
9113
9112
  var import_bufferUtils = __toESM(require_bufferUtils());
9114
9113
 
9115
9114
  // src/utils/request/getRequestCookies.ts
@@ -9289,7 +9288,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
9289
9288
  }
9290
9289
 
9291
9290
  // src/utils/handleRequest.ts
9292
- var import_until2 = __toESM(require_lib3());
9291
+ var import_until2 = __toESM(require_lib());
9293
9292
 
9294
9293
  // src/utils/getResponse.ts
9295
9294
  var getResponse = async (request, handlers, resolutionContext) => {
@@ -11479,9 +11478,10 @@ spurious results.`);
11479
11478
  // src/utils/logging/prepareResponse.ts
11480
11479
  function prepareResponse(res) {
11481
11480
  const responseHeaders = objectToHeaders(res.headers);
11481
+ const parsedBody = parseBody(res.body, responseHeaders);
11482
11482
  return {
11483
11483
  ...res,
11484
- body: parseBody(res.body, responseHeaders)
11484
+ body: parsedBody
11485
11485
  };
11486
11486
  }
11487
11487
 
@@ -12097,7 +12097,6 @@ spurious results.`);
12097
12097
  };
12098
12098
 
12099
12099
  // src/context/field.ts
12100
- var import_outvariant3 = __toESM(require_lib2());
12101
12100
  var field = (fieldName, fieldValue) => {
12102
12101
  return (res) => {
12103
12102
  validateFieldName(fieldName);
@@ -12107,27 +12106,27 @@ spurious results.`);
12107
12106
  };
12108
12107
  };
12109
12108
  function validateFieldName(fieldName) {
12110
- (0, import_outvariant3.invariant)(
12109
+ invariant(
12111
12110
  fieldName.trim() !== "",
12112
12111
  devUtils.formatMessage(
12113
12112
  "Failed to set a custom field on a GraphQL response: field name cannot be empty."
12114
12113
  )
12115
12114
  );
12116
- (0, import_outvariant3.invariant)(
12115
+ invariant(
12117
12116
  fieldName !== "data",
12118
12117
  devUtils.formatMessage(
12119
12118
  'Failed to set a custom "%s" field on a mocked GraphQL response: forbidden field name. Did you mean to call "ctx.data()" instead?',
12120
12119
  fieldName
12121
12120
  )
12122
12121
  );
12123
- (0, import_outvariant3.invariant)(
12122
+ invariant(
12124
12123
  fieldName !== "errors",
12125
12124
  devUtils.formatMessage(
12126
12125
  'Failed to set a custom "%s" field on a mocked GraphQL response: forbidden field name. Did you mean to call "ctx.errors()" instead?',
12127
12126
  fieldName
12128
12127
  )
12129
12128
  );
12130
- (0, import_outvariant3.invariant)(
12129
+ invariant(
12131
12130
  fieldName !== "extensions",
12132
12131
  devUtils.formatMessage(
12133
12132
  'Failed to set a custom "%s" field on a mocked GraphQL response: forbidden field name. Did you mean to call "ctx.extensions()" instead?',
@@ -12376,7 +12375,7 @@ Read more: https://mswjs.io/docs/getting-started/mocks`
12376
12375
  }
12377
12376
 
12378
12377
  // src/utils/request/readResponseCookies.ts
12379
- var import_cookies2 = __toESM(require_lib8());
12378
+ var import_cookies2 = __toESM(require_lib7());
12380
12379
  function readResponseCookies(request, response2) {
12381
12380
  import_cookies2.store.add({ ...request, url: request.url.toString() }, response2);
12382
12381
  import_cookies2.store.persist();
@@ -12443,12 +12442,12 @@ Read more: https://mswjs.io/docs/getting-started/mocks`
12443
12442
  }
12444
12443
 
12445
12444
  // src/utils/logging/serializeResponse.ts
12446
- function serializeResponse(source) {
12445
+ async function serializeResponse(response2) {
12447
12446
  return {
12448
- status: source.status,
12449
- statusText: source.statusText,
12450
- headers: flattenHeadersObject(headersToObject(source.headers)),
12451
- body: source.body
12447
+ status: response2.status,
12448
+ statusText: response2.statusText,
12449
+ headers: flattenHeadersObject(headersToObject(response2.headers)),
12450
+ body: await response2.text()
12452
12451
  };
12453
12452
  }
12454
12453
 
@@ -12489,10 +12488,10 @@ Read more: https://mswjs.io/docs/getting-started/mocks`
12489
12488
  [responseBodyBuffer]
12490
12489
  );
12491
12490
  if (!options.quiet) {
12492
- context.emitter.once("response:mocked", (response3) => {
12491
+ context.emitter.once("response:mocked", async (response3) => {
12493
12492
  handler.log(
12494
12493
  publicRequest,
12495
- serializeResponse(response3),
12494
+ await serializeResponse(response3),
12496
12495
  parsedRequest
12497
12496
  );
12498
12497
  });
@@ -12560,7 +12559,7 @@ This exception has been gracefully handled as a 500 response, however, it's stro
12560
12559
  }
12561
12560
 
12562
12561
  // src/utils/deferNetworkRequestsUntil.ts
12563
- var import_until3 = __toESM(require_lib3());
12562
+ var import_until3 = __toESM(require_lib());
12564
12563
  function deferNetworkRequestsUntil(predicatePromise) {
12565
12564
  const originalXhrSend = window.XMLHttpRequest.prototype.send;
12566
12565
  window.XMLHttpRequest.prototype.send = function(...args) {
@@ -12738,12 +12737,12 @@ If this message still persists after updating, please report an issue: https://g
12738
12737
  };
12739
12738
 
12740
12739
  // src/setupWorker/start/createFallbackRequestListener.ts
12741
- var import_interceptors4 = __toESM(require_lib7());
12740
+ var import_interceptors4 = __toESM(require_lib6());
12742
12741
  var import_fetch3 = __toESM(require_fetch());
12743
12742
  var import_XMLHttpRequest = __toESM(require_XMLHttpRequest());
12744
12743
 
12745
12744
  // src/utils/request/createResponseFromIsomorphicResponse.ts
12746
- var import_interceptors3 = __toESM(require_lib7());
12745
+ var import_interceptors3 = __toESM(require_lib6());
12747
12746
  var noop = () => {
12748
12747
  throw new Error("Not implemented");
12749
12748
  };
@@ -12802,10 +12801,10 @@ If this message still persists after updating, please report an issue: https://g
12802
12801
  },
12803
12802
  onMockedResponse(_, { handler, publicRequest, parsedRequest }) {
12804
12803
  if (!options.quiet) {
12805
- context.emitter.once("response:mocked", (response3) => {
12804
+ context.emitter.once("response:mocked", async (response3) => {
12806
12805
  handler.log(
12807
12806
  publicRequest,
12808
- serializeResponse(response3),
12807
+ await serializeResponse(response3),
12809
12808
  parsedRequest
12810
12809
  );
12811
12810
  });
@@ -12857,8 +12856,7 @@ If this message still persists after updating, please report an issue: https://g
12857
12856
  }
12858
12857
 
12859
12858
  // src/SetupApi.ts
12860
- var import_outvariant4 = __toESM(require_lib2());
12861
- var import_strict_event_emitter = __toESM(require_lib10());
12859
+ var import_strict_event_emitter = __toESM(require_lib9());
12862
12860
 
12863
12861
  // src/utils/internal/pipeEvents.ts
12864
12862
  function pipeEvents(source, destination) {
@@ -12893,7 +12891,7 @@ If this message still persists after updating, please report an issue: https://g
12893
12891
  }
12894
12892
  validateHandlers(...handlers) {
12895
12893
  for (const handler of handlers) {
12896
- (0, import_outvariant4.invariant)(
12894
+ invariant(
12897
12895
  !Array.isArray(handler),
12898
12896
  devUtils.formatMessage(
12899
12897
  'Failed to construct "%s" given an Array of request handlers. Make sure you spread the request handlers when calling the respective setup function.'
@@ -12941,8 +12939,8 @@ If this message still persists after updating, please report an issue: https://g
12941
12939
  super(...handlers);
12942
12940
  this.startHandler = null;
12943
12941
  this.stopHandler = null;
12944
- (0, import_outvariant5.invariant)(
12945
- !(0, import_is_node_process3.isNodeProcess)(),
12942
+ invariant(
12943
+ !isNodeProcess(),
12946
12944
  devUtils.formatMessage(
12947
12945
  "Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead."
12948
12946
  )