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.
@@ -370,7 +370,7 @@ You can also automate this process and make the worker script update automatical
370
370
  }
371
371
  }
372
372
 
373
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
373
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-UJZOJSMP.mjs
374
374
  var encoder = new TextEncoder();
375
375
  function encodeBuffer(text) {
376
376
  return encoder.encode(text);
@@ -396,6 +396,9 @@ function isResponseWithoutBody(status) {
396
396
  return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
397
397
  }
398
398
 
399
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-HAGW22AN.mjs
400
+ var IS_PATCHED_MODULE = Symbol("isPatchedModule");
401
+
399
402
  // node_modules/.pnpm/@open-draft+logger@0.3.0/node_modules/@open-draft/logger/lib/index.mjs
400
403
  var __defProp = Object.defineProperty;
401
404
  var __export = (target, all) => {
@@ -833,8 +836,8 @@ var _Emitter = class {
833
836
  var Emitter = _Emitter;
834
837
  Emitter.defaultMaxListeners = 10;
835
838
 
836
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-WZQN3FMY.mjs
837
- var IS_PATCHED_MODULE = Symbol("isPatchedModule");
839
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs
840
+ var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
838
841
  function getGlobalSymbol(symbol) {
839
842
  return (
840
843
  // @ts-ignore https://github.com/Microsoft/TypeScript/issues/24587
@@ -977,8 +980,11 @@ var Interceptor = class {
977
980
  this.logger.info("cleared global instance!", this.symbol.description);
978
981
  }
979
982
  };
983
+ function createRequestId() {
984
+ return Math.random().toString(16).slice(2);
985
+ }
980
986
 
981
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/index.mjs
987
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/index.mjs
982
988
  var BatchInterceptor = class extends Interceptor {
983
989
  constructor(options) {
984
990
  BatchInterceptor.symbol = Symbol(options.name);
@@ -1262,14 +1268,7 @@ var DeferredPromise = class extends Promise {
1262
1268
  }
1263
1269
  };
1264
1270
 
1265
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-72HT65NX.mjs
1266
- function uuidv4() {
1267
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
1268
- const r = Math.random() * 16 | 0;
1269
- const v = c == "x" ? r : r & 3 | 8;
1270
- return v.toString(16);
1271
- });
1272
- }
1271
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-OUWBQF3Z.mjs
1273
1272
  var RequestController = class {
1274
1273
  constructor(request) {
1275
1274
  this.request = request;
@@ -1307,7 +1306,7 @@ async function emitAsync(emitter, eventName, ...data) {
1307
1306
  }
1308
1307
  }
1309
1308
 
1310
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-XQZ6GVNB.mjs
1309
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-3FNUI33J.mjs
1311
1310
  function isPropertyAccessible(obj, key) {
1312
1311
  try {
1313
1312
  obj[key];
@@ -1331,7 +1330,7 @@ var _FetchInterceptor = class extends Interceptor {
1331
1330
  checkEnvironment() {
1332
1331
  return typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined";
1333
1332
  }
1334
- setup() {
1333
+ async setup() {
1335
1334
  const pureFetch = globalThis.fetch;
1336
1335
  invariant(
1337
1336
  !pureFetch[IS_PATCHED_MODULE],
@@ -1339,7 +1338,7 @@ var _FetchInterceptor = class extends Interceptor {
1339
1338
  );
1340
1339
  globalThis.fetch = async (input, init) => {
1341
1340
  var _a;
1342
- const requestId = uuidv4();
1341
+ const requestId = createRequestId();
1343
1342
  const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input;
1344
1343
  const request = new Request(resolvedInput, init);
1345
1344
  this.logger.info("[%s] %s", request.method, request.url);
@@ -1454,7 +1453,7 @@ function createNetworkError(cause) {
1454
1453
  });
1455
1454
  }
1456
1455
 
1457
- // node_modules/.pnpm/@mswjs+interceptors@0.25.16/node_modules/@mswjs/interceptors/lib/browser/chunk-DZVB7JEV.mjs
1456
+ // node_modules/.pnpm/@mswjs+interceptors@0.26.14/node_modules/@mswjs/interceptors/lib/browser/chunk-VYFS2IF2.mjs
1458
1457
  function concatArrayBuffer(left, right) {
1459
1458
  const result = new Uint8Array(left.byteLength + right.byteLength);
1460
1459
  result.set(left, 0);
@@ -1648,7 +1647,7 @@ var XMLHttpRequestController = class {
1648
1647
  this.method = "GET";
1649
1648
  this.url = null;
1650
1649
  this.events = /* @__PURE__ */ new Map();
1651
- this.requestId = uuidv4();
1650
+ this.requestId = createRequestId();
1652
1651
  this.requestHeaders = new Headers();
1653
1652
  this.responseBuffer = new Uint8Array();
1654
1653
  this.request = createProxy(initialRequest, {
@@ -1730,7 +1729,10 @@ var XMLHttpRequestController = class {
1730
1729
  this.request.readyState
1731
1730
  );
1732
1731
  if (IS_NODE2) {
1733
- this.request.setRequestHeader("X-Request-Id", this.requestId);
1732
+ this.request.setRequestHeader(
1733
+ INTERNAL_REQUEST_ID_HEADER_NAME,
1734
+ this.requestId
1735
+ );
1734
1736
  }
1735
1737
  return invoke();
1736
1738
  }
@@ -2053,7 +2055,11 @@ function createXMLHttpRequestProxy({
2053
2055
  const XMLHttpRequestProxy = new Proxy(globalThis.XMLHttpRequest, {
2054
2056
  construct(target, args, newTarget) {
2055
2057
  logger.info("constructed new XMLHttpRequest");
2056
- const originalRequest = Reflect.construct(target, args, newTarget);
2058
+ const originalRequest = Reflect.construct(
2059
+ target,
2060
+ args,
2061
+ newTarget
2062
+ );
2057
2063
  const prototypeDescriptors = Object.getOwnPropertyDescriptors(
2058
2064
  target.prototype
2059
2065
  );