msw 2.4.10 → 2.4.11

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.
Files changed (44) hide show
  1. package/lib/browser/index.js +14 -96
  2. package/lib/browser/index.js.map +1 -1
  3. package/lib/browser/index.mjs +14 -96
  4. package/lib/browser/index.mjs.map +1 -1
  5. package/lib/core/{GraphQLHandler-5pZBHLn9.d.mts → GraphQLHandler-ClMB0BOy.d.mts} +1 -1
  6. package/lib/core/{GraphQLHandler-Cu4Xvg4S.d.ts → GraphQLHandler-D6mLMXGZ.d.ts} +1 -1
  7. package/lib/core/{HttpResponse-DE19n76Q.d.ts → HttpResponse-DaYkf3ml.d.ts} +1 -1
  8. package/lib/core/{HttpResponse-Gtw1lt3H.d.mts → HttpResponse-vn-Pb4Bi.d.mts} +1 -1
  9. package/lib/core/HttpResponse.d.mts +1 -1
  10. package/lib/core/HttpResponse.d.ts +1 -1
  11. package/lib/core/SetupApi.d.mts +1 -1
  12. package/lib/core/SetupApi.d.ts +1 -1
  13. package/lib/core/getResponse.d.mts +1 -1
  14. package/lib/core/getResponse.d.ts +1 -1
  15. package/lib/core/graphql.d.mts +2 -2
  16. package/lib/core/graphql.d.ts +2 -2
  17. package/lib/core/handlers/GraphQLHandler.d.mts +2 -2
  18. package/lib/core/handlers/GraphQLHandler.d.ts +2 -2
  19. package/lib/core/handlers/HttpHandler.d.mts +1 -1
  20. package/lib/core/handlers/HttpHandler.d.ts +1 -1
  21. package/lib/core/handlers/RequestHandler.d.mts +1 -1
  22. package/lib/core/handlers/RequestHandler.d.ts +1 -1
  23. package/lib/core/http.d.mts +1 -1
  24. package/lib/core/http.d.ts +1 -1
  25. package/lib/core/index.d.mts +2 -2
  26. package/lib/core/index.d.ts +2 -2
  27. package/lib/core/passthrough.d.mts +1 -1
  28. package/lib/core/passthrough.d.ts +1 -1
  29. package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
  30. package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
  31. package/lib/core/utils/executeHandlers.d.mts +1 -1
  32. package/lib/core/utils/executeHandlers.d.ts +1 -1
  33. package/lib/core/utils/handleRequest.d.mts +1 -1
  34. package/lib/core/utils/handleRequest.d.ts +1 -1
  35. package/lib/core/utils/internal/parseGraphQLRequest.d.mts +2 -2
  36. package/lib/core/utils/internal/parseGraphQLRequest.d.ts +2 -2
  37. package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
  38. package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
  39. package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
  40. package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
  41. package/lib/iife/index.js +108 -180
  42. package/lib/iife/index.js.map +1 -1
  43. package/lib/mockServiceWorker.js +1 -1
  44. package/package.json +21 -22
@@ -25,7 +25,7 @@ __export(browser_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(browser_exports);
27
27
 
28
- // node_modules/.pnpm/outvariant@1.4.2/node_modules/outvariant/lib/index.mjs
28
+ // node_modules/.pnpm/outvariant@1.4.3/node_modules/outvariant/lib/index.mjs
29
29
  var POSITIONALS_EXP = /(%?)(%([sdijo]))/g;
30
30
  function serializePositional(positional, flag) {
31
31
  switch (flag) {
@@ -96,10 +96,12 @@ var invariant = (predicate, message, ...positionals) => {
96
96
  };
97
97
  invariant.as = (ErrorConstructor, predicate, message, ...positionals) => {
98
98
  if (!predicate) {
99
- const formatMessage = positionals.length === 0 ? message : format(message, positionals);
99
+ const formatMessage = positionals.length === 0 ? message : format(message, ...positionals);
100
100
  let error2;
101
101
  try {
102
- error2 = Reflect.construct(ErrorConstructor, [formatMessage]);
102
+ error2 = Reflect.construct(ErrorConstructor, [
103
+ formatMessage
104
+ ]);
103
105
  } catch (err) {
104
106
  error2 = ErrorConstructor(formatMessage);
105
107
  }
@@ -461,90 +463,6 @@ function isResponseError(response) {
461
463
  return isPropertyAccessible(response, "type") && response.type === "error";
462
464
  }
463
465
 
464
- // node_modules/.pnpm/outvariant@1.4.3/node_modules/outvariant/lib/index.mjs
465
- var POSITIONALS_EXP2 = /(%?)(%([sdijo]))/g;
466
- function serializePositional2(positional, flag) {
467
- switch (flag) {
468
- case "s":
469
- return positional;
470
- case "d":
471
- case "i":
472
- return Number(positional);
473
- case "j":
474
- return JSON.stringify(positional);
475
- case "o": {
476
- if (typeof positional === "string") {
477
- return positional;
478
- }
479
- const json = JSON.stringify(positional);
480
- if (json === "{}" || json === "[]" || /^\[object .+?\]$/.test(json)) {
481
- return positional;
482
- }
483
- return json;
484
- }
485
- }
486
- }
487
- function format2(message, ...positionals) {
488
- if (positionals.length === 0) {
489
- return message;
490
- }
491
- let positionalIndex = 0;
492
- let formattedMessage = message.replace(
493
- POSITIONALS_EXP2,
494
- (match, isEscaped, _, flag) => {
495
- const positional = positionals[positionalIndex];
496
- const value = serializePositional2(positional, flag);
497
- if (!isEscaped) {
498
- positionalIndex++;
499
- return value;
500
- }
501
- return match;
502
- }
503
- );
504
- if (positionalIndex < positionals.length) {
505
- formattedMessage += ` ${positionals.slice(positionalIndex).join(" ")}`;
506
- }
507
- formattedMessage = formattedMessage.replace(/%{2,2}/g, "%");
508
- return formattedMessage;
509
- }
510
- var STACK_FRAMES_TO_IGNORE2 = 2;
511
- function cleanErrorStack2(error2) {
512
- if (!error2.stack) {
513
- return;
514
- }
515
- const nextStack = error2.stack.split("\n");
516
- nextStack.splice(1, STACK_FRAMES_TO_IGNORE2);
517
- error2.stack = nextStack.join("\n");
518
- }
519
- var InvariantError2 = class extends Error {
520
- constructor(message, ...positionals) {
521
- super(message);
522
- this.message = message;
523
- this.name = "Invariant Violation";
524
- this.message = format2(message, ...positionals);
525
- cleanErrorStack2(this);
526
- }
527
- };
528
- var invariant2 = (predicate, message, ...positionals) => {
529
- if (!predicate) {
530
- throw new InvariantError2(message, ...positionals);
531
- }
532
- };
533
- invariant2.as = (ErrorConstructor, predicate, message, ...positionals) => {
534
- if (!predicate) {
535
- const formatMessage = positionals.length === 0 ? message : format2(message, ...positionals);
536
- let error2;
537
- try {
538
- error2 = Reflect.construct(ErrorConstructor, [
539
- formatMessage
540
- ]);
541
- } catch (err) {
542
- error2 = ErrorConstructor(formatMessage);
543
- }
544
- throw error2;
545
- }
546
- };
547
-
548
466
  // node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
549
467
  var __defProp2 = Object.defineProperty;
550
468
  var __export2 = (target, all) => {
@@ -773,21 +691,21 @@ var PerformanceEntry = class {
773
691
  var noop = () => void 0;
774
692
  function log(message, ...positionals) {
775
693
  if (IS_NODE) {
776
- process.stdout.write(format2(message, ...positionals) + "\n");
694
+ process.stdout.write(format(message, ...positionals) + "\n");
777
695
  return;
778
696
  }
779
697
  console.log(message, ...positionals);
780
698
  }
781
699
  function warn(message, ...positionals) {
782
700
  if (IS_NODE) {
783
- process.stderr.write(format2(message, ...positionals) + "\n");
701
+ process.stderr.write(format(message, ...positionals) + "\n");
784
702
  return;
785
703
  }
786
704
  console.warn(message, ...positionals);
787
705
  }
788
706
  function error(message, ...positionals) {
789
707
  if (IS_NODE) {
790
- process.stderr.write(format2(message, ...positionals) + "\n");
708
+ process.stderr.write(format(message, ...positionals) + "\n");
791
709
  return;
792
710
  }
793
711
  console.error(message, ...positionals);
@@ -1438,7 +1356,7 @@ var RequestController = class {
1438
1356
  * controller.respondWith(Response.error())
1439
1357
  */
1440
1358
  respondWith(response) {
1441
- invariant2.as(
1359
+ invariant.as(
1442
1360
  InterceptorError,
1443
1361
  !this[kRequestHandled],
1444
1362
  'Failed to respond to the "%s %s" request: the "request" event has already been handled.',
@@ -1455,7 +1373,7 @@ var RequestController = class {
1455
1373
  * controller.errorWith(new Error('Oops!'))
1456
1374
  */
1457
1375
  errorWith(error2) {
1458
- invariant2.as(
1376
+ invariant.as(
1459
1377
  InterceptorError,
1460
1378
  !this[kRequestHandled],
1461
1379
  'Failed to error the "%s %s" request: the "request" event has already been handled.',
@@ -1666,7 +1584,7 @@ var _FetchInterceptor = class extends Interceptor {
1666
1584
  }
1667
1585
  async setup() {
1668
1586
  const pureFetch = globalThis.fetch;
1669
- invariant2(
1587
+ invariant(
1670
1588
  !pureFetch[IS_PATCHED_MODULE],
1671
1589
  'Failed to patch the "fetch" module: already patched.'
1672
1590
  );
@@ -2304,7 +2222,7 @@ var XMLHttpRequestController = class {
2304
2222
  }
2305
2223
  }
2306
2224
  get responseText() {
2307
- invariant2(
2225
+ invariant(
2308
2226
  this.request.responseType === "" || this.request.responseType === "text",
2309
2227
  "InvalidStateError: The object is in invalid state."
2310
2228
  );
@@ -2316,7 +2234,7 @@ var XMLHttpRequestController = class {
2316
2234
  return responseText;
2317
2235
  }
2318
2236
  get responseXML() {
2319
- invariant2(
2237
+ invariant(
2320
2238
  this.request.responseType === "" || this.request.responseType === "document",
2321
2239
  "InvalidStateError: The object is in invalid state."
2322
2240
  );
@@ -2532,7 +2450,7 @@ var _XMLHttpRequestInterceptor = class extends Interceptor {
2532
2450
  const logger = this.logger.extend("setup");
2533
2451
  logger.info('patching "XMLHttpRequest" module...');
2534
2452
  const PureXMLHttpRequest = globalThis.XMLHttpRequest;
2535
- invariant2(
2453
+ invariant(
2536
2454
  !PureXMLHttpRequest[IS_PATCHED_MODULE],
2537
2455
  'Failed to patch the "XMLHttpRequest" module: already patched.'
2538
2456
  );