msw 2.2.11 → 2.2.13

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.14/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.14/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.14/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.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
@@ -1004,8 +1007,11 @@ var Interceptor = class {
1004
1007
  this.logger.info("cleared global instance!", this.symbol.description);
1005
1008
  }
1006
1009
  };
1010
+ function createRequestId() {
1011
+ return Math.random().toString(16).slice(2);
1012
+ }
1007
1013
 
1008
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/index.mjs
1014
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/index.mjs
1009
1015
  var BatchInterceptor = class extends Interceptor {
1010
1016
  constructor(options) {
1011
1017
  BatchInterceptor.symbol = Symbol(options.name);
@@ -1289,14 +1295,7 @@ var DeferredPromise = class extends Promise {
1289
1295
  }
1290
1296
  };
1291
1297
 
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
- }
1298
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-OUWBQF3Z.mjs
1300
1299
  var RequestController = class {
1301
1300
  constructor(request) {
1302
1301
  this.request = request;
@@ -1334,7 +1333,7 @@ async function emitAsync(emitter, eventName, ...data) {
1334
1333
  }
1335
1334
  }
1336
1335
 
1337
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-XQZ6GVNB.mjs
1336
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-3FNUI33J.mjs
1338
1337
  function isPropertyAccessible(obj, key) {
1339
1338
  try {
1340
1339
  obj[key];
@@ -1358,7 +1357,7 @@ var _FetchInterceptor = class extends Interceptor {
1358
1357
  checkEnvironment() {
1359
1358
  return typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined";
1360
1359
  }
1361
- setup() {
1360
+ async setup() {
1362
1361
  const pureFetch = globalThis.fetch;
1363
1362
  invariant(
1364
1363
  !pureFetch[IS_PATCHED_MODULE],
@@ -1366,7 +1365,7 @@ var _FetchInterceptor = class extends Interceptor {
1366
1365
  );
1367
1366
  globalThis.fetch = async (input, init) => {
1368
1367
  var _a;
1369
- const requestId = uuidv4();
1368
+ const requestId = createRequestId();
1370
1369
  const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input;
1371
1370
  const request = new Request(resolvedInput, init);
1372
1371
  this.logger.info("[%s] %s", request.method, request.url);
@@ -1481,7 +1480,7 @@ function createNetworkError(cause) {
1481
1480
  });
1482
1481
  }
1483
1482
 
1484
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-DZVB7JEV.mjs
1483
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-VYFS2IF2.mjs
1485
1484
  function concatArrayBuffer(left, right) {
1486
1485
  const result = new Uint8Array(left.byteLength + right.byteLength);
1487
1486
  result.set(left, 0);
@@ -1675,7 +1674,7 @@ var XMLHttpRequestController = class {
1675
1674
  this.method = "GET";
1676
1675
  this.url = null;
1677
1676
  this.events = /* @__PURE__ */ new Map();
1678
- this.requestId = uuidv4();
1677
+ this.requestId = createRequestId();
1679
1678
  this.requestHeaders = new Headers();
1680
1679
  this.responseBuffer = new Uint8Array();
1681
1680
  this.request = createProxy(initialRequest, {
@@ -1757,7 +1756,10 @@ var XMLHttpRequestController = class {
1757
1756
  this.request.readyState
1758
1757
  );
1759
1758
  if (IS_NODE2) {
1760
- this.request.setRequestHeader("X-Request-Id", this.requestId);
1759
+ this.request.setRequestHeader(
1760
+ INTERNAL_REQUEST_ID_HEADER_NAME,
1761
+ this.requestId
1762
+ );
1761
1763
  }
1762
1764
  return invoke();
1763
1765
  }
@@ -2080,7 +2082,11 @@ function createXMLHttpRequestProxy({
2080
2082
  const XMLHttpRequestProxy = new Proxy(globalThis.XMLHttpRequest, {
2081
2083
  construct(target, args, newTarget) {
2082
2084
  logger.info("constructed new XMLHttpRequest");
2083
- const originalRequest = Reflect.construct(target, args, newTarget);
2085
+ const originalRequest = Reflect.construct(
2086
+ target,
2087
+ args,
2088
+ newTarget
2089
+ );
2084
2090
  const prototypeDescriptors = Object.getOwnPropertyDescriptors(
2085
2091
  target.prototype
2086
2092
  );