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.
@@ -397,7 +397,7 @@ You can also automate this process and make the worker script update automatical
397
397
  }
398
398
  }
399
399
 
400
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
400
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
401
401
  var encoder = new TextEncoder();
402
402
  function encodeBuffer(text) {
403
403
  return encoder.encode(text);
@@ -423,6 +423,9 @@ function isResponseWithoutBody(status) {
423
423
  return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
424
424
  }
425
425
 
426
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-HAGW22AN.mjs
427
+ var IS_PATCHED_MODULE = Symbol("isPatchedModule");
428
+
426
429
  // node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
427
430
  var __defProp2 = Object.defineProperty;
428
431
  var __export2 = (target, all) => {
@@ -860,8 +863,8 @@ var _Emitter = class {
860
863
  var Emitter = _Emitter;
861
864
  Emitter.defaultMaxListeners = 10;
862
865
 
863
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-WZQN3FMY.mjs
864
- var IS_PATCHED_MODULE = Symbol("isPatchedModule");
866
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-KHZ3VYHS.mjs
867
+ var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
865
868
  function getGlobalSymbol(symbol) {
866
869
  return (
867
870
  // @ts-ignore https://github.com/Microsoft/TypeScript/issues/24587
@@ -1005,7 +1008,7 @@ var Interceptor = class {
1005
1008
  }
1006
1009
  };
1007
1010
 
1008
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/index.mjs
1011
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/index.mjs
1009
1012
  var BatchInterceptor = class extends Interceptor {
1010
1013
  constructor(options) {
1011
1014
  BatchInterceptor.symbol = Symbol(options.name);
@@ -1289,14 +1292,7 @@ var DeferredPromise = class extends Promise {
1289
1292
  }
1290
1293
  };
1291
1294
 
1292
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-72HT65NX.mjs
1293
- function uuidv4() {
1294
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
1295
- const r = Math.random() * 16 | 0;
1296
- const v = c == "x" ? r : r & 3 | 8;
1297
- return v.toString(16);
1298
- });
1299
- }
1295
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-OUWBQF3Z.mjs
1300
1296
  var RequestController = class {
1301
1297
  constructor(request) {
1302
1298
  this.request = request;
@@ -1334,7 +1330,7 @@ async function emitAsync(emitter, eventName, ...data) {
1334
1330
  }
1335
1331
  }
1336
1332
 
1337
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-XQZ6GVNB.mjs
1333
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-5E3BR6QC.mjs
1338
1334
  function isPropertyAccessible(obj, key) {
1339
1335
  try {
1340
1336
  obj[key];
@@ -1358,7 +1354,7 @@ var _FetchInterceptor = class extends Interceptor {
1358
1354
  checkEnvironment() {
1359
1355
  return typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined";
1360
1356
  }
1361
- setup() {
1357
+ async setup() {
1362
1358
  const pureFetch = globalThis.fetch;
1363
1359
  invariant(
1364
1360
  !pureFetch[IS_PATCHED_MODULE],
@@ -1366,7 +1362,7 @@ var _FetchInterceptor = class extends Interceptor {
1366
1362
  );
1367
1363
  globalThis.fetch = async (input, init) => {
1368
1364
  var _a;
1369
- const requestId = uuidv4();
1365
+ const requestId = crypto.randomUUID();
1370
1366
  const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input;
1371
1367
  const request = new Request(resolvedInput, init);
1372
1368
  this.logger.info("[%s] %s", request.method, request.url);
@@ -1481,7 +1477,7 @@ function createNetworkError(cause) {
1481
1477
  });
1482
1478
  }
1483
1479
 
1484
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-DZVB7JEV.mjs
1480
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.12/node_modules/@mswjs/interceptors/lib/browser/chunk-WVYFUFZR.mjs
1485
1481
  function concatArrayBuffer(left, right) {
1486
1482
  const result = new Uint8Array(left.byteLength + right.byteLength);
1487
1483
  result.set(left, 0);
@@ -1675,7 +1671,7 @@ var XMLHttpRequestController = class {
1675
1671
  this.method = "GET";
1676
1672
  this.url = null;
1677
1673
  this.events = /* @__PURE__ */ new Map();
1678
- this.requestId = uuidv4();
1674
+ this.requestId = crypto.randomUUID();
1679
1675
  this.requestHeaders = new Headers();
1680
1676
  this.responseBuffer = new Uint8Array();
1681
1677
  this.request = createProxy(initialRequest, {
@@ -1757,7 +1753,10 @@ var XMLHttpRequestController = class {
1757
1753
  this.request.readyState
1758
1754
  );
1759
1755
  if (IS_NODE2) {
1760
- this.request.setRequestHeader("X-Request-Id", this.requestId);
1756
+ this.request.setRequestHeader(
1757
+ INTERNAL_REQUEST_ID_HEADER_NAME,
1758
+ this.requestId
1759
+ );
1761
1760
  }
1762
1761
  return invoke();
1763
1762
  }
@@ -2080,7 +2079,11 @@ function createXMLHttpRequestProxy({
2080
2079
  const XMLHttpRequestProxy = new Proxy(globalThis.XMLHttpRequest, {
2081
2080
  construct(target, args, newTarget) {
2082
2081
  logger.info("constructed new XMLHttpRequest");
2083
- const originalRequest = Reflect.construct(target, args, newTarget);
2082
+ const originalRequest = Reflect.construct(
2083
+ target,
2084
+ args,
2085
+ newTarget
2086
+ );
2084
2087
  const prototypeDescriptors = Object.getOwnPropertyDescriptors(
2085
2088
  target.prototype
2086
2089
  );