msw 2.2.11 → 2.2.12

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
@@ -1121,7 +1121,7 @@ var MockServiceWorker = (() => {
1121
1121
  return stringToRegexp(path, keys, options);
1122
1122
  }
1123
1123
 
1124
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
1124
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
1125
1125
  var encoder = new TextEncoder();
1126
1126
  function encodeBuffer(text) {
1127
1127
  return encoder.encode(text);
@@ -1147,6 +1147,9 @@ var MockServiceWorker = (() => {
1147
1147
  return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
1148
1148
  }
1149
1149
 
1150
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-HAGW22AN.mjs
1151
+ var IS_PATCHED_MODULE = Symbol("isPatchedModule");
1152
+
1150
1153
  // node_modules/.pnpm/is-node-process@1.2.0/node_modules/is-node-process/lib/index.mjs
1151
1154
  function isNodeProcess() {
1152
1155
  if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
@@ -1434,8 +1437,8 @@ var MockServiceWorker = (() => {
1434
1437
  return message3.toString();
1435
1438
  }
1436
1439
 
1437
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-WZQN3FMY.mjs
1438
- var IS_PATCHED_MODULE = Symbol("isPatchedModule");
1440
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-KHZ3VYHS.mjs
1441
+ var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
1439
1442
  function getGlobalSymbol(symbol) {
1440
1443
  return (
1441
1444
  // @ts-ignore https://github.com/Microsoft/TypeScript/issues/24587
@@ -1579,7 +1582,7 @@ var MockServiceWorker = (() => {
1579
1582
  }
1580
1583
  };
1581
1584
 
1582
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/index.mjs
1585
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/index.mjs
1583
1586
  var BatchInterceptor = class extends Interceptor {
1584
1587
  constructor(options) {
1585
1588
  BatchInterceptor.symbol = Symbol(options.name);
@@ -6487,14 +6490,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
6487
6490
  }
6488
6491
  };
6489
6492
 
6490
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-72HT65NX.mjs
6491
- function uuidv4() {
6492
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
6493
- const r = Math.random() * 16 | 0;
6494
- const v = c == "x" ? r : r & 3 | 8;
6495
- return v.toString(16);
6496
- });
6497
- }
6493
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-OUWBQF3Z.mjs
6498
6494
  var RequestController = class {
6499
6495
  constructor(request) {
6500
6496
  this.request = request;
@@ -6532,7 +6528,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
6532
6528
  }
6533
6529
  }
6534
6530
 
6535
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-XQZ6GVNB.mjs
6531
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-5E3BR6QC.mjs
6536
6532
  function isPropertyAccessible2(obj, key) {
6537
6533
  try {
6538
6534
  obj[key];
@@ -6556,7 +6552,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
6556
6552
  checkEnvironment() {
6557
6553
  return typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined";
6558
6554
  }
6559
- setup() {
6555
+ async setup() {
6560
6556
  const pureFetch = globalThis.fetch;
6561
6557
  invariant(
6562
6558
  !pureFetch[IS_PATCHED_MODULE],
@@ -6564,7 +6560,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
6564
6560
  );
6565
6561
  globalThis.fetch = async (input, init) => {
6566
6562
  var _a2;
6567
- const requestId = uuidv4();
6563
+ const requestId = crypto.randomUUID();
6568
6564
  const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input;
6569
6565
  const request = new Request(resolvedInput, init);
6570
6566
  this.logger.info("[%s] %s", request.method, request.url);
@@ -6679,7 +6675,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
6679
6675
  });
6680
6676
  }
6681
6677
 
6682
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-DZVB7JEV.mjs
6678
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-WVYFUFZR.mjs
6683
6679
  function concatArrayBuffer(left, right) {
6684
6680
  const result = new Uint8Array(left.byteLength + right.byteLength);
6685
6681
  result.set(left, 0);
@@ -6873,7 +6869,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
6873
6869
  this.method = "GET";
6874
6870
  this.url = null;
6875
6871
  this.events = /* @__PURE__ */ new Map();
6876
- this.requestId = uuidv4();
6872
+ this.requestId = crypto.randomUUID();
6877
6873
  this.requestHeaders = new Headers();
6878
6874
  this.responseBuffer = new Uint8Array();
6879
6875
  this.request = createProxy(initialRequest, {
@@ -6955,7 +6951,10 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
6955
6951
  this.request.readyState
6956
6952
  );
6957
6953
  if (IS_NODE2) {
6958
- this.request.setRequestHeader("X-Request-Id", this.requestId);
6954
+ this.request.setRequestHeader(
6955
+ INTERNAL_REQUEST_ID_HEADER_NAME,
6956
+ this.requestId
6957
+ );
6959
6958
  }
6960
6959
  return invoke();
6961
6960
  }
@@ -7278,7 +7277,11 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
7278
7277
  const XMLHttpRequestProxy = new Proxy(globalThis.XMLHttpRequest, {
7279
7278
  construct(target, args, newTarget) {
7280
7279
  logger.info("constructed new XMLHttpRequest");
7281
- const originalRequest = Reflect.construct(target, args, newTarget);
7280
+ const originalRequest = Reflect.construct(
7281
+ target,
7282
+ args,
7283
+ newTarget
7284
+ );
7282
7285
  const prototypeDescriptors = Object.getOwnPropertyDescriptors(
7283
7286
  target.prototype
7284
7287
  );