msw 2.6.1 → 2.6.2

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.
@@ -33,8 +33,18 @@ __export(getRequestCookies_exports, {
33
33
  module.exports = __toCommonJS(getRequestCookies_exports);
34
34
  var import_cookie = __toESM(require("@bundled-es-modules/cookie"));
35
35
  var import_cookieStore = require("../cookieStore.js");
36
+ function parseCookies(input) {
37
+ const parsedCookies = import_cookie.default.parse(input);
38
+ const cookies = {};
39
+ for (const cookieName in parsedCookies) {
40
+ if (typeof parsedCookies[cookieName] !== "undefined") {
41
+ cookies[cookieName] = parsedCookies[cookieName];
42
+ }
43
+ }
44
+ return cookies;
45
+ }
36
46
  function getAllDocumentCookies() {
37
- return import_cookie.default.parse(document.cookie);
47
+ return parseCookies(document.cookie);
38
48
  }
39
49
  function getDocumentCookies(request) {
40
50
  if (typeof document === "undefined" || typeof location === "undefined") {
@@ -55,7 +65,7 @@ function getDocumentCookies(request) {
55
65
  }
56
66
  function getAllRequestCookies(request) {
57
67
  const requestCookieHeader = request.headers.get("cookie");
58
- const cookiesFromHeaders = requestCookieHeader ? import_cookie.default.parse(requestCookieHeader) : {};
68
+ const cookiesFromHeaders = requestCookieHeader ? parseCookies(requestCookieHeader) : {};
59
69
  const cookiesFromDocument = getDocumentCookies(request);
60
70
  for (const name in cookiesFromDocument) {
61
71
  request.headers.append(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/utils/request/getRequestCookies.ts"],"sourcesContent":["import cookieUtils from '@bundled-es-modules/cookie'\nimport { cookieStore } from '../cookieStore'\n\nfunction getAllDocumentCookies() {\n return cookieUtils.parse(document.cookie)\n}\n\nfunction getDocumentCookies(request: Request): Record<string, string> {\n if (typeof document === 'undefined' || typeof location === 'undefined') {\n return {}\n }\n\n switch (request.credentials) {\n case 'same-origin': {\n const requestUrl = new URL(request.url)\n\n // Return document cookies only when requested a resource\n // from the same origin as the current document.\n return location.origin === requestUrl.origin\n ? getAllDocumentCookies()\n : {}\n }\n\n case 'include': {\n // Return all document cookies.\n return getAllDocumentCookies()\n }\n\n default: {\n return {}\n }\n }\n}\n\nexport function getAllRequestCookies(request: Request): Record<string, string> {\n /**\n * @note While the \"cookie\" header is a forbidden header field\n * in the browser, you can read it in Node.js. We need to respect\n * it for mocking in Node.js.\n */\n const requestCookieHeader = request.headers.get('cookie')\n const cookiesFromHeaders = requestCookieHeader\n ? cookieUtils.parse(requestCookieHeader)\n : {}\n\n const cookiesFromDocument = getDocumentCookies(request)\n\n // Forward the document cookies to the request headers.\n for (const name in cookiesFromDocument) {\n request.headers.append(\n 'cookie',\n cookieUtils.serialize(name, cookiesFromDocument[name]),\n )\n }\n\n const cookiesFromStore = cookieStore.getCookiesSync(request.url)\n const storedCookiesObject = Object.fromEntries(\n cookiesFromStore.map((cookie) => [cookie.key, cookie.value]),\n )\n\n // Forward the raw stored cookies to request headers\n // so they contain metadata like \"expires\", \"secure\", etc.\n for (const cookie of cookiesFromStore) {\n request.headers.append('cookie', cookie.toString())\n }\n\n return {\n ...cookiesFromDocument,\n ...storedCookiesObject,\n ...cookiesFromHeaders,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAwB;AACxB,yBAA4B;AAE5B,SAAS,wBAAwB;AAC/B,SAAO,cAAAA,QAAY,MAAM,SAAS,MAAM;AAC1C;AAEA,SAAS,mBAAmB,SAA0C;AACpE,MAAI,OAAO,aAAa,eAAe,OAAO,aAAa,aAAa;AACtE,WAAO,CAAC;AAAA,EACV;AAEA,UAAQ,QAAQ,aAAa;AAAA,IAC3B,KAAK,eAAe;AAClB,YAAM,aAAa,IAAI,IAAI,QAAQ,GAAG;AAItC,aAAO,SAAS,WAAW,WAAW,SAClC,sBAAsB,IACtB,CAAC;AAAA,IACP;AAAA,IAEA,KAAK,WAAW;AAEd,aAAO,sBAAsB;AAAA,IAC/B;AAAA,IAEA,SAAS;AACP,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA0C;AAM7E,QAAM,sBAAsB,QAAQ,QAAQ,IAAI,QAAQ;AACxD,QAAM,qBAAqB,sBACvB,cAAAA,QAAY,MAAM,mBAAmB,IACrC,CAAC;AAEL,QAAM,sBAAsB,mBAAmB,OAAO;AAGtD,aAAW,QAAQ,qBAAqB;AACtC,YAAQ,QAAQ;AAAA,MACd;AAAA,MACA,cAAAA,QAAY,UAAU,MAAM,oBAAoB,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AAEA,QAAM,mBAAmB,+BAAY,eAAe,QAAQ,GAAG;AAC/D,QAAM,sBAAsB,OAAO;AAAA,IACjC,iBAAiB,IAAI,CAAC,WAAW,CAAC,OAAO,KAAK,OAAO,KAAK,CAAC;AAAA,EAC7D;AAIA,aAAW,UAAU,kBAAkB;AACrC,YAAQ,QAAQ,OAAO,UAAU,OAAO,SAAS,CAAC;AAAA,EACpD;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;","names":["cookieUtils"]}
1
+ {"version":3,"sources":["../../../../src/core/utils/request/getRequestCookies.ts"],"sourcesContent":["import cookieUtils from '@bundled-es-modules/cookie'\nimport { cookieStore } from '../cookieStore'\n\nfunction parseCookies(input: string): Record<string, string> {\n const parsedCookies = cookieUtils.parse(input)\n const cookies: Record<string, string> = {}\n\n for (const cookieName in parsedCookies) {\n if (typeof parsedCookies[cookieName] !== 'undefined') {\n cookies[cookieName] = parsedCookies[cookieName]\n }\n }\n\n return cookies\n}\n\nfunction getAllDocumentCookies() {\n return parseCookies(document.cookie)\n}\n\nfunction getDocumentCookies(request: Request): Record<string, string> {\n if (typeof document === 'undefined' || typeof location === 'undefined') {\n return {}\n }\n\n switch (request.credentials) {\n case 'same-origin': {\n const requestUrl = new URL(request.url)\n\n // Return document cookies only when requested a resource\n // from the same origin as the current document.\n return location.origin === requestUrl.origin\n ? getAllDocumentCookies()\n : {}\n }\n\n case 'include': {\n // Return all document cookies.\n return getAllDocumentCookies()\n }\n\n default: {\n return {}\n }\n }\n}\n\nexport function getAllRequestCookies(request: Request): Record<string, string> {\n /**\n * @note While the \"cookie\" header is a forbidden header field\n * in the browser, you can read it in Node.js. We need to respect\n * it for mocking in Node.js.\n */\n const requestCookieHeader = request.headers.get('cookie')\n const cookiesFromHeaders = requestCookieHeader\n ? parseCookies(requestCookieHeader)\n : {}\n\n const cookiesFromDocument = getDocumentCookies(request)\n\n // Forward the document cookies to the request headers.\n for (const name in cookiesFromDocument) {\n request.headers.append(\n 'cookie',\n cookieUtils.serialize(name, cookiesFromDocument[name]),\n )\n }\n\n const cookiesFromStore = cookieStore.getCookiesSync(request.url)\n const storedCookiesObject = Object.fromEntries(\n cookiesFromStore.map((cookie) => [cookie.key, cookie.value]),\n )\n\n // Forward the raw stored cookies to request headers\n // so they contain metadata like \"expires\", \"secure\", etc.\n for (const cookie of cookiesFromStore) {\n request.headers.append('cookie', cookie.toString())\n }\n\n return {\n ...cookiesFromDocument,\n ...storedCookiesObject,\n ...cookiesFromHeaders,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAwB;AACxB,yBAA4B;AAE5B,SAAS,aAAa,OAAuC;AAC3D,QAAM,gBAAgB,cAAAA,QAAY,MAAM,KAAK;AAC7C,QAAM,UAAkC,CAAC;AAEzC,aAAW,cAAc,eAAe;AACtC,QAAI,OAAO,cAAc,UAAU,MAAM,aAAa;AACpD,cAAQ,UAAU,IAAI,cAAc,UAAU;AAAA,IAChD;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,wBAAwB;AAC/B,SAAO,aAAa,SAAS,MAAM;AACrC;AAEA,SAAS,mBAAmB,SAA0C;AACpE,MAAI,OAAO,aAAa,eAAe,OAAO,aAAa,aAAa;AACtE,WAAO,CAAC;AAAA,EACV;AAEA,UAAQ,QAAQ,aAAa;AAAA,IAC3B,KAAK,eAAe;AAClB,YAAM,aAAa,IAAI,IAAI,QAAQ,GAAG;AAItC,aAAO,SAAS,WAAW,WAAW,SAClC,sBAAsB,IACtB,CAAC;AAAA,IACP;AAAA,IAEA,KAAK,WAAW;AAEd,aAAO,sBAAsB;AAAA,IAC/B;AAAA,IAEA,SAAS;AACP,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA0C;AAM7E,QAAM,sBAAsB,QAAQ,QAAQ,IAAI,QAAQ;AACxD,QAAM,qBAAqB,sBACvB,aAAa,mBAAmB,IAChC,CAAC;AAEL,QAAM,sBAAsB,mBAAmB,OAAO;AAGtD,aAAW,QAAQ,qBAAqB;AACtC,YAAQ,QAAQ;AAAA,MACd;AAAA,MACA,cAAAA,QAAY,UAAU,MAAM,oBAAoB,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AAEA,QAAM,mBAAmB,+BAAY,eAAe,QAAQ,GAAG;AAC/D,QAAM,sBAAsB,OAAO;AAAA,IACjC,iBAAiB,IAAI,CAAC,WAAW,CAAC,OAAO,KAAK,OAAO,KAAK,CAAC;AAAA,EAC7D;AAIA,aAAW,UAAU,kBAAkB;AACrC,YAAQ,QAAQ,OAAO,UAAU,OAAO,SAAS,CAAC;AAAA,EACpD;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;","names":["cookieUtils"]}
@@ -1,7 +1,17 @@
1
1
  import cookieUtils from "@bundled-es-modules/cookie";
2
2
  import { cookieStore } from '../cookieStore.mjs';
3
+ function parseCookies(input) {
4
+ const parsedCookies = cookieUtils.parse(input);
5
+ const cookies = {};
6
+ for (const cookieName in parsedCookies) {
7
+ if (typeof parsedCookies[cookieName] !== "undefined") {
8
+ cookies[cookieName] = parsedCookies[cookieName];
9
+ }
10
+ }
11
+ return cookies;
12
+ }
3
13
  function getAllDocumentCookies() {
4
- return cookieUtils.parse(document.cookie);
14
+ return parseCookies(document.cookie);
5
15
  }
6
16
  function getDocumentCookies(request) {
7
17
  if (typeof document === "undefined" || typeof location === "undefined") {
@@ -22,7 +32,7 @@ function getDocumentCookies(request) {
22
32
  }
23
33
  function getAllRequestCookies(request) {
24
34
  const requestCookieHeader = request.headers.get("cookie");
25
- const cookiesFromHeaders = requestCookieHeader ? cookieUtils.parse(requestCookieHeader) : {};
35
+ const cookiesFromHeaders = requestCookieHeader ? parseCookies(requestCookieHeader) : {};
26
36
  const cookiesFromDocument = getDocumentCookies(request);
27
37
  for (const name in cookiesFromDocument) {
28
38
  request.headers.append(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/utils/request/getRequestCookies.ts"],"sourcesContent":["import cookieUtils from '@bundled-es-modules/cookie'\nimport { cookieStore } from '../cookieStore'\n\nfunction getAllDocumentCookies() {\n return cookieUtils.parse(document.cookie)\n}\n\nfunction getDocumentCookies(request: Request): Record<string, string> {\n if (typeof document === 'undefined' || typeof location === 'undefined') {\n return {}\n }\n\n switch (request.credentials) {\n case 'same-origin': {\n const requestUrl = new URL(request.url)\n\n // Return document cookies only when requested a resource\n // from the same origin as the current document.\n return location.origin === requestUrl.origin\n ? getAllDocumentCookies()\n : {}\n }\n\n case 'include': {\n // Return all document cookies.\n return getAllDocumentCookies()\n }\n\n default: {\n return {}\n }\n }\n}\n\nexport function getAllRequestCookies(request: Request): Record<string, string> {\n /**\n * @note While the \"cookie\" header is a forbidden header field\n * in the browser, you can read it in Node.js. We need to respect\n * it for mocking in Node.js.\n */\n const requestCookieHeader = request.headers.get('cookie')\n const cookiesFromHeaders = requestCookieHeader\n ? cookieUtils.parse(requestCookieHeader)\n : {}\n\n const cookiesFromDocument = getDocumentCookies(request)\n\n // Forward the document cookies to the request headers.\n for (const name in cookiesFromDocument) {\n request.headers.append(\n 'cookie',\n cookieUtils.serialize(name, cookiesFromDocument[name]),\n )\n }\n\n const cookiesFromStore = cookieStore.getCookiesSync(request.url)\n const storedCookiesObject = Object.fromEntries(\n cookiesFromStore.map((cookie) => [cookie.key, cookie.value]),\n )\n\n // Forward the raw stored cookies to request headers\n // so they contain metadata like \"expires\", \"secure\", etc.\n for (const cookie of cookiesFromStore) {\n request.headers.append('cookie', cookie.toString())\n }\n\n return {\n ...cookiesFromDocument,\n ...storedCookiesObject,\n ...cookiesFromHeaders,\n }\n}\n"],"mappings":"AAAA,OAAO,iBAAiB;AACxB,SAAS,mBAAmB;AAE5B,SAAS,wBAAwB;AAC/B,SAAO,YAAY,MAAM,SAAS,MAAM;AAC1C;AAEA,SAAS,mBAAmB,SAA0C;AACpE,MAAI,OAAO,aAAa,eAAe,OAAO,aAAa,aAAa;AACtE,WAAO,CAAC;AAAA,EACV;AAEA,UAAQ,QAAQ,aAAa;AAAA,IAC3B,KAAK,eAAe;AAClB,YAAM,aAAa,IAAI,IAAI,QAAQ,GAAG;AAItC,aAAO,SAAS,WAAW,WAAW,SAClC,sBAAsB,IACtB,CAAC;AAAA,IACP;AAAA,IAEA,KAAK,WAAW;AAEd,aAAO,sBAAsB;AAAA,IAC/B;AAAA,IAEA,SAAS;AACP,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA0C;AAM7E,QAAM,sBAAsB,QAAQ,QAAQ,IAAI,QAAQ;AACxD,QAAM,qBAAqB,sBACvB,YAAY,MAAM,mBAAmB,IACrC,CAAC;AAEL,QAAM,sBAAsB,mBAAmB,OAAO;AAGtD,aAAW,QAAQ,qBAAqB;AACtC,YAAQ,QAAQ;AAAA,MACd;AAAA,MACA,YAAY,UAAU,MAAM,oBAAoB,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AAEA,QAAM,mBAAmB,YAAY,eAAe,QAAQ,GAAG;AAC/D,QAAM,sBAAsB,OAAO;AAAA,IACjC,iBAAiB,IAAI,CAAC,WAAW,CAAC,OAAO,KAAK,OAAO,KAAK,CAAC;AAAA,EAC7D;AAIA,aAAW,UAAU,kBAAkB;AACrC,YAAQ,QAAQ,OAAO,UAAU,OAAO,SAAS,CAAC;AAAA,EACpD;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/utils/request/getRequestCookies.ts"],"sourcesContent":["import cookieUtils from '@bundled-es-modules/cookie'\nimport { cookieStore } from '../cookieStore'\n\nfunction parseCookies(input: string): Record<string, string> {\n const parsedCookies = cookieUtils.parse(input)\n const cookies: Record<string, string> = {}\n\n for (const cookieName in parsedCookies) {\n if (typeof parsedCookies[cookieName] !== 'undefined') {\n cookies[cookieName] = parsedCookies[cookieName]\n }\n }\n\n return cookies\n}\n\nfunction getAllDocumentCookies() {\n return parseCookies(document.cookie)\n}\n\nfunction getDocumentCookies(request: Request): Record<string, string> {\n if (typeof document === 'undefined' || typeof location === 'undefined') {\n return {}\n }\n\n switch (request.credentials) {\n case 'same-origin': {\n const requestUrl = new URL(request.url)\n\n // Return document cookies only when requested a resource\n // from the same origin as the current document.\n return location.origin === requestUrl.origin\n ? getAllDocumentCookies()\n : {}\n }\n\n case 'include': {\n // Return all document cookies.\n return getAllDocumentCookies()\n }\n\n default: {\n return {}\n }\n }\n}\n\nexport function getAllRequestCookies(request: Request): Record<string, string> {\n /**\n * @note While the \"cookie\" header is a forbidden header field\n * in the browser, you can read it in Node.js. We need to respect\n * it for mocking in Node.js.\n */\n const requestCookieHeader = request.headers.get('cookie')\n const cookiesFromHeaders = requestCookieHeader\n ? parseCookies(requestCookieHeader)\n : {}\n\n const cookiesFromDocument = getDocumentCookies(request)\n\n // Forward the document cookies to the request headers.\n for (const name in cookiesFromDocument) {\n request.headers.append(\n 'cookie',\n cookieUtils.serialize(name, cookiesFromDocument[name]),\n )\n }\n\n const cookiesFromStore = cookieStore.getCookiesSync(request.url)\n const storedCookiesObject = Object.fromEntries(\n cookiesFromStore.map((cookie) => [cookie.key, cookie.value]),\n )\n\n // Forward the raw stored cookies to request headers\n // so they contain metadata like \"expires\", \"secure\", etc.\n for (const cookie of cookiesFromStore) {\n request.headers.append('cookie', cookie.toString())\n }\n\n return {\n ...cookiesFromDocument,\n ...storedCookiesObject,\n ...cookiesFromHeaders,\n }\n}\n"],"mappings":"AAAA,OAAO,iBAAiB;AACxB,SAAS,mBAAmB;AAE5B,SAAS,aAAa,OAAuC;AAC3D,QAAM,gBAAgB,YAAY,MAAM,KAAK;AAC7C,QAAM,UAAkC,CAAC;AAEzC,aAAW,cAAc,eAAe;AACtC,QAAI,OAAO,cAAc,UAAU,MAAM,aAAa;AACpD,cAAQ,UAAU,IAAI,cAAc,UAAU;AAAA,IAChD;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,wBAAwB;AAC/B,SAAO,aAAa,SAAS,MAAM;AACrC;AAEA,SAAS,mBAAmB,SAA0C;AACpE,MAAI,OAAO,aAAa,eAAe,OAAO,aAAa,aAAa;AACtE,WAAO,CAAC;AAAA,EACV;AAEA,UAAQ,QAAQ,aAAa;AAAA,IAC3B,KAAK,eAAe;AAClB,YAAM,aAAa,IAAI,IAAI,QAAQ,GAAG;AAItC,aAAO,SAAS,WAAW,WAAW,SAClC,sBAAsB,IACtB,CAAC;AAAA,IACP;AAAA,IAEA,KAAK,WAAW;AAEd,aAAO,sBAAsB;AAAA,IAC/B;AAAA,IAEA,SAAS;AACP,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACF;AAEO,SAAS,qBAAqB,SAA0C;AAM7E,QAAM,sBAAsB,QAAQ,QAAQ,IAAI,QAAQ;AACxD,QAAM,qBAAqB,sBACvB,aAAa,mBAAmB,IAChC,CAAC;AAEL,QAAM,sBAAsB,mBAAmB,OAAO;AAGtD,aAAW,QAAQ,qBAAqB;AACtC,YAAQ,QAAQ;AAAA,MACd;AAAA,MACA,YAAY,UAAU,MAAM,oBAAoB,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AAEA,QAAM,mBAAmB,YAAY,eAAe,QAAQ,GAAG;AAC/D,QAAM,sBAAsB,OAAO;AAAA,IACjC,iBAAiB,IAAI,CAAC,WAAW,CAAC,OAAO,KAAK,OAAO,KAAK,CAAC;AAAA,EAC7D;AAIA,aAAW,UAAU,kBAAkB;AACrC,YAAQ,QAAQ,OAAO,UAAU,OAAO,SAAS,CAAC;AAAA,EACpD;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;","names":[]}
package/lib/iife/index.js CHANGED
@@ -14456,7 +14456,7 @@ ${operationTypes.join("\n")}
14456
14456
  return stringToRegexp(path, keys, options);
14457
14457
  }
14458
14458
 
14459
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/chunk-6HYIRFX2.mjs
14459
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-6HYIRFX2.mjs
14460
14460
  var encoder = new TextEncoder();
14461
14461
  function encodeBuffer(text) {
14462
14462
  return encoder.encode(text);
@@ -14472,7 +14472,7 @@ ${operationTypes.join("\n")}
14472
14472
  );
14473
14473
  }
14474
14474
 
14475
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/chunk-XVPRNJO7.mjs
14475
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-6MOMO77R.mjs
14476
14476
  var IS_PATCHED_MODULE = Symbol("isPatchedModule");
14477
14477
  function isPropertyAccessible(obj, key) {
14478
14478
  try {
@@ -14808,7 +14808,7 @@ ${operationTypes.join("\n")}
14808
14808
  return message3.toString();
14809
14809
  }
14810
14810
 
14811
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs
14811
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs
14812
14812
  var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
14813
14813
  function getGlobalSymbol(symbol) {
14814
14814
  return (
@@ -14956,7 +14956,7 @@ ${operationTypes.join("\n")}
14956
14956
  return Math.random().toString(16).slice(2);
14957
14957
  }
14958
14958
 
14959
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/index.mjs
14959
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/index.mjs
14960
14960
  var BatchInterceptor = class extends Interceptor {
14961
14961
  constructor(options) {
14962
14962
  BatchInterceptor.symbol = Symbol(options.name);
@@ -15080,7 +15080,7 @@ ${operationTypes.join("\n")}
15080
15080
  return urlInstance.origin === location.origin ? urlInstance.pathname : urlInstance.origin + urlInstance.pathname;
15081
15081
  }
15082
15082
 
15083
- // node_modules/.pnpm/@bundled-es-modules+cookie@2.0.0/node_modules/@bundled-es-modules/cookie/index-esm.js
15083
+ // node_modules/.pnpm/@bundled-es-modules+cookie@2.0.1/node_modules/@bundled-es-modules/cookie/index-esm.js
15084
15084
  var __create2 = Object.create;
15085
15085
  var __defProp4 = Object.defineProperty;
15086
15086
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -15112,68 +15112,92 @@ ${operationTypes.join("\n")}
15112
15112
  exports.parse = parse3;
15113
15113
  exports.serialize = serialize;
15114
15114
  var __toString = Object.prototype.toString;
15115
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
15116
- function parse3(str, options) {
15115
+ var __hasOwnProperty = Object.prototype.hasOwnProperty;
15116
+ var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
15117
+ var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
15118
+ var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
15119
+ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
15120
+ function parse3(str, opt) {
15117
15121
  if (typeof str !== "string") {
15118
15122
  throw new TypeError("argument str must be a string");
15119
15123
  }
15120
15124
  var obj = {};
15121
- var opt = options || {};
15122
- var dec = opt.decode || decode;
15125
+ var len = str.length;
15126
+ if (len < 2) return obj;
15127
+ var dec = opt && opt.decode || decode;
15123
15128
  var index = 0;
15124
- while (index < str.length) {
15125
- var eqIdx = str.indexOf("=", index);
15126
- if (eqIdx === -1) {
15127
- break;
15128
- }
15129
- var endIdx = str.indexOf(";", index);
15129
+ var eqIdx = 0;
15130
+ var endIdx = 0;
15131
+ do {
15132
+ eqIdx = str.indexOf("=", index);
15133
+ if (eqIdx === -1) break;
15134
+ endIdx = str.indexOf(";", index);
15130
15135
  if (endIdx === -1) {
15131
- endIdx = str.length;
15132
- } else if (endIdx < eqIdx) {
15136
+ endIdx = len;
15137
+ } else if (eqIdx > endIdx) {
15133
15138
  index = str.lastIndexOf(";", eqIdx - 1) + 1;
15134
15139
  continue;
15135
15140
  }
15136
- var key = str.slice(index, eqIdx).trim();
15137
- if (void 0 === obj[key]) {
15138
- var val = str.slice(eqIdx + 1, endIdx).trim();
15139
- if (val.charCodeAt(0) === 34) {
15140
- val = val.slice(1, -1);
15141
+ var keyStartIdx = startIndex(str, index, eqIdx);
15142
+ var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
15143
+ var key = str.slice(keyStartIdx, keyEndIdx);
15144
+ if (!__hasOwnProperty.call(obj, key)) {
15145
+ var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
15146
+ var valEndIdx = endIndex(str, endIdx, valStartIdx);
15147
+ if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
15148
+ valStartIdx++;
15149
+ valEndIdx--;
15141
15150
  }
15151
+ var val = str.slice(valStartIdx, valEndIdx);
15142
15152
  obj[key] = tryDecode(val, dec);
15143
15153
  }
15144
15154
  index = endIdx + 1;
15145
- }
15155
+ } while (index < len);
15146
15156
  return obj;
15147
15157
  }
15148
- function serialize(name, val, options) {
15149
- var opt = options || {};
15150
- var enc = opt.encode || encode;
15158
+ function startIndex(str, index, max) {
15159
+ do {
15160
+ var code = str.charCodeAt(index);
15161
+ if (code !== 32 && code !== 9) return index;
15162
+ } while (++index < max);
15163
+ return max;
15164
+ }
15165
+ function endIndex(str, index, min) {
15166
+ while (index > min) {
15167
+ var code = str.charCodeAt(--index);
15168
+ if (code !== 32 && code !== 9) return index + 1;
15169
+ }
15170
+ return min;
15171
+ }
15172
+ function serialize(name, val, opt) {
15173
+ var enc = opt && opt.encode || encodeURIComponent;
15151
15174
  if (typeof enc !== "function") {
15152
15175
  throw new TypeError("option encode is invalid");
15153
15176
  }
15154
- if (!fieldContentRegExp.test(name)) {
15177
+ if (!cookieNameRegExp.test(name)) {
15155
15178
  throw new TypeError("argument name is invalid");
15156
15179
  }
15157
15180
  var value = enc(val);
15158
- if (value && !fieldContentRegExp.test(value)) {
15181
+ if (!cookieValueRegExp.test(value)) {
15159
15182
  throw new TypeError("argument val is invalid");
15160
15183
  }
15161
15184
  var str = name + "=" + value;
15185
+ if (!opt) return str;
15162
15186
  if (null != opt.maxAge) {
15163
- var maxAge = opt.maxAge - 0;
15164
- if (isNaN(maxAge) || !isFinite(maxAge)) {
15187
+ var maxAge = Math.floor(opt.maxAge);
15188
+ if (!isFinite(maxAge)) {
15165
15189
  throw new TypeError("option maxAge is invalid");
15166
15190
  }
15167
- str += "; Max-Age=" + Math.floor(maxAge);
15191
+ str += "; Max-Age=" + maxAge;
15168
15192
  }
15169
15193
  if (opt.domain) {
15170
- if (!fieldContentRegExp.test(opt.domain)) {
15194
+ if (!domainValueRegExp.test(opt.domain)) {
15171
15195
  throw new TypeError("option domain is invalid");
15172
15196
  }
15173
15197
  str += "; Domain=" + opt.domain;
15174
15198
  }
15175
15199
  if (opt.path) {
15176
- if (!fieldContentRegExp.test(opt.path)) {
15200
+ if (!pathValueRegExp.test(opt.path)) {
15177
15201
  throw new TypeError("option path is invalid");
15178
15202
  }
15179
15203
  str += "; Path=" + opt.path;
@@ -15191,6 +15215,9 @@ ${operationTypes.join("\n")}
15191
15215
  if (opt.secure) {
15192
15216
  str += "; Secure";
15193
15217
  }
15218
+ if (opt.partitioned) {
15219
+ str += "; Partitioned";
15220
+ }
15194
15221
  if (opt.priority) {
15195
15222
  var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
15196
15223
  switch (priority) {
@@ -15231,11 +15258,8 @@ ${operationTypes.join("\n")}
15231
15258
  function decode(str) {
15232
15259
  return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
15233
15260
  }
15234
- function encode(val) {
15235
- return encodeURIComponent(val);
15236
- }
15237
15261
  function isDate(val) {
15238
- return __toString.call(val) === "[object Date]" || val instanceof Date;
15262
+ return __toString.call(val) === "[object Date]";
15239
15263
  }
15240
15264
  function tryDecode(str, decode2) {
15241
15265
  try {
@@ -27215,8 +27239,18 @@ ${operationTypes.join("\n")}
27215
27239
  var cookieStore = new CookieJar(store);
27216
27240
 
27217
27241
  // src/core/utils/request/getRequestCookies.ts
27242
+ function parseCookies(input) {
27243
+ const parsedCookies = source_default2.parse(input);
27244
+ const cookies = {};
27245
+ for (const cookieName in parsedCookies) {
27246
+ if (typeof parsedCookies[cookieName] !== "undefined") {
27247
+ cookies[cookieName] = parsedCookies[cookieName];
27248
+ }
27249
+ }
27250
+ return cookies;
27251
+ }
27218
27252
  function getAllDocumentCookies() {
27219
- return source_default2.parse(document.cookie);
27253
+ return parseCookies(document.cookie);
27220
27254
  }
27221
27255
  function getDocumentCookies(request) {
27222
27256
  if (typeof document === "undefined" || typeof location === "undefined") {
@@ -27237,7 +27271,7 @@ ${operationTypes.join("\n")}
27237
27271
  }
27238
27272
  function getAllRequestCookies(request) {
27239
27273
  const requestCookieHeader = request.headers.get("cookie");
27240
- const cookiesFromHeaders = requestCookieHeader ? source_default2.parse(requestCookieHeader) : {};
27274
+ const cookiesFromHeaders = requestCookieHeader ? parseCookies(requestCookieHeader) : {};
27241
27275
  const cookiesFromDocument = getDocumentCookies(request);
27242
27276
  for (const name in cookiesFromDocument) {
27243
27277
  request.headers.append(
@@ -29470,7 +29504,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29470
29504
  }
29471
29505
  };
29472
29506
 
29473
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/chunk-THPGBWJQ.mjs
29507
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-4RQHC4IY.mjs
29474
29508
  var InterceptorError = class extends Error {
29475
29509
  constructor(message3) {
29476
29510
  super(message3);
@@ -29574,13 +29608,17 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29574
29608
  });
29575
29609
  const requestAbortPromise = new DeferredPromise();
29576
29610
  if (options.request.signal) {
29577
- options.request.signal.addEventListener(
29578
- "abort",
29579
- () => {
29580
- requestAbortPromise.reject(options.request.signal.reason);
29581
- },
29582
- { once: true }
29583
- );
29611
+ if (options.request.signal.aborted) {
29612
+ requestAbortPromise.reject(options.request.signal.reason);
29613
+ } else {
29614
+ options.request.signal.addEventListener(
29615
+ "abort",
29616
+ () => {
29617
+ requestAbortPromise.reject(options.request.signal.reason);
29618
+ },
29619
+ { once: true }
29620
+ );
29621
+ }
29584
29622
  }
29585
29623
  const result = await until(async () => {
29586
29624
  const requestListtenersPromise = emitAsync(options.emitter, "request", {
@@ -29638,7 +29676,28 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29638
29676
  return false;
29639
29677
  }
29640
29678
 
29641
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/chunk-GHRPKS6J.mjs
29679
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-TX5GBTFY.mjs
29680
+ function hasConfigurableGlobal(propertyName) {
29681
+ const descriptor = Object.getOwnPropertyDescriptor(globalThis, propertyName);
29682
+ if (typeof descriptor === "undefined") {
29683
+ return false;
29684
+ }
29685
+ if (typeof descriptor.get === "function" && typeof descriptor.get() === "undefined") {
29686
+ return false;
29687
+ }
29688
+ if (typeof descriptor.get === "undefined" && descriptor.value == null) {
29689
+ return false;
29690
+ }
29691
+ if (typeof descriptor.set === "undefined" && !descriptor.configurable) {
29692
+ console.error(
29693
+ `[MSW] Failed to apply interceptor: the global \`${propertyName}\` property is non-configurable. This is likely an issue with your environment. If you are using a framework, please open an issue about this in their repository.`
29694
+ );
29695
+ return false;
29696
+ }
29697
+ return true;
29698
+ }
29699
+
29700
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-VXLPKFY4.mjs
29642
29701
  function canParseUrl(url) {
29643
29702
  try {
29644
29703
  new URL(url);
@@ -29713,12 +29772,78 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29713
29772
  }
29714
29773
  return false;
29715
29774
  }
29775
+ var BrotliDecompressionStream = class extends TransformStream {
29776
+ constructor() {
29777
+ console.warn(
29778
+ "[Interceptors]: Brotli decompression of response streams is not supported in the browser"
29779
+ );
29780
+ super({
29781
+ transform(chunk, controller) {
29782
+ controller.enqueue(chunk);
29783
+ }
29784
+ });
29785
+ }
29786
+ };
29787
+ var PipelineStream = class extends TransformStream {
29788
+ constructor(transformStreams, ...strategies) {
29789
+ super({}, ...strategies);
29790
+ const readable = [super.readable, ...transformStreams].reduce(
29791
+ (readable2, transform) => readable2.pipeThrough(transform)
29792
+ );
29793
+ Object.defineProperty(this, "readable", {
29794
+ get() {
29795
+ return readable;
29796
+ }
29797
+ });
29798
+ }
29799
+ };
29800
+ function parseContentEncoding(contentEncoding) {
29801
+ return contentEncoding.toLowerCase().split(",").map((coding) => coding.trim());
29802
+ }
29803
+ function createDecompressionStream(contentEncoding) {
29804
+ if (contentEncoding === "") {
29805
+ return null;
29806
+ }
29807
+ const codings = parseContentEncoding(contentEncoding);
29808
+ if (codings.length === 0) {
29809
+ return null;
29810
+ }
29811
+ const transformers = codings.reduceRight(
29812
+ (transformers2, coding) => {
29813
+ if (coding === "gzip" || coding === "x-gzip") {
29814
+ return transformers2.concat(new DecompressionStream("gzip"));
29815
+ } else if (coding === "deflate") {
29816
+ return transformers2.concat(new DecompressionStream("deflate"));
29817
+ } else if (coding === "br") {
29818
+ return transformers2.concat(new BrotliDecompressionStream());
29819
+ } else {
29820
+ transformers2.length = 0;
29821
+ }
29822
+ return transformers2;
29823
+ },
29824
+ []
29825
+ );
29826
+ return new PipelineStream(transformers);
29827
+ }
29828
+ function decompressResponse(response) {
29829
+ if (response.body === null) {
29830
+ return null;
29831
+ }
29832
+ const decompressionStream = createDecompressionStream(
29833
+ response.headers.get("content-encoding") || ""
29834
+ );
29835
+ if (!decompressionStream) {
29836
+ return null;
29837
+ }
29838
+ response.body.pipeTo(decompressionStream.writable);
29839
+ return decompressionStream.readable;
29840
+ }
29716
29841
  var _FetchInterceptor = class extends Interceptor {
29717
29842
  constructor() {
29718
29843
  super(_FetchInterceptor.symbol);
29719
29844
  }
29720
29845
  checkEnvironment() {
29721
- return typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined";
29846
+ return hasConfigurableGlobal("fetch");
29722
29847
  }
29723
29848
  async setup() {
29724
29849
  const pureFetch = globalThis.fetch;
@@ -29743,10 +29868,12 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29743
29868
  requestId,
29744
29869
  emitter: this.emitter,
29745
29870
  controller,
29746
- onResponse: async (response) => {
29871
+ onResponse: async (rawResponse) => {
29747
29872
  this.logger.info("received mocked response!", {
29748
- response
29873
+ rawResponse
29749
29874
  });
29875
+ const decompressedStream = decompressResponse(rawResponse);
29876
+ const response = decompressedStream === null ? rawResponse : new Response(decompressedStream, rawResponse);
29750
29877
  if (RESPONSE_STATUS_CODES_WITH_REDIRECT.has(response.status)) {
29751
29878
  if (request.redirect === "error") {
29752
29879
  responsePromise.reject(createNetworkError("unexpected redirect"));
@@ -29764,6 +29891,12 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29764
29891
  return;
29765
29892
  }
29766
29893
  }
29894
+ Object.defineProperty(response, "url", {
29895
+ writable: false,
29896
+ enumerable: true,
29897
+ configurable: false,
29898
+ value: request.url
29899
+ });
29767
29900
  if (this.emitter.listenerCount("response") > 0) {
29768
29901
  this.logger.info('emitting the "response" event...');
29769
29902
  await emitAsync(this.emitter, "response", {
@@ -29776,12 +29909,6 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29776
29909
  requestId
29777
29910
  });
29778
29911
  }
29779
- Object.defineProperty(response, "url", {
29780
- writable: false,
29781
- enumerable: true,
29782
- configurable: false,
29783
- value: request.url
29784
- });
29785
29912
  responsePromise.resolve(response);
29786
29913
  },
29787
29914
  onRequestError: (response) => {
@@ -29835,7 +29962,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
29835
29962
  var FetchInterceptor = _FetchInterceptor;
29836
29963
  FetchInterceptor.symbol = Symbol("fetch");
29837
29964
 
29838
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/chunk-SUQ32ZQK.mjs
29965
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/chunk-MMAVIMED.mjs
29839
29966
  function concatArrayBuffer(left, right) {
29840
29967
  const result = new Uint8Array(left.byteLength + right.byteLength);
29841
29968
  result.set(left, 0);
@@ -30582,7 +30709,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
30582
30709
  super(_XMLHttpRequestInterceptor.interceptorSymbol);
30583
30710
  }
30584
30711
  checkEnvironment() {
30585
- return typeof globalThis.XMLHttpRequest !== "undefined";
30712
+ return hasConfigurableGlobal("XMLHttpRequest");
30586
30713
  }
30587
30714
  setup() {
30588
30715
  const logger = this.logger.extend("setup");
@@ -30706,7 +30833,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
30706
30833
  }
30707
30834
  }
30708
30835
 
30709
- // node_modules/.pnpm/@mswjs+interceptors@0.36.5/node_modules/@mswjs/interceptors/lib/browser/interceptors/WebSocket/index.mjs
30836
+ // node_modules/.pnpm/@mswjs+interceptors@0.36.10/node_modules/@mswjs/interceptors/lib/browser/interceptors/WebSocket/index.mjs
30710
30837
  function bindEvent(target, event) {
30711
30838
  Object.defineProperties(event, {
30712
30839
  target: {
@@ -31297,11 +31424,14 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
31297
31424
  super(_WebSocketInterceptor.symbol);
31298
31425
  }
31299
31426
  checkEnvironment() {
31300
- return typeof globalThis.WebSocket !== "undefined";
31427
+ return hasConfigurableGlobal("WebSocket");
31301
31428
  }
31302
31429
  setup() {
31303
- const originalWebSocket = globalThis.WebSocket;
31304
- const webSocketProxy = new Proxy(globalThis.WebSocket, {
31430
+ const originalWebSocketDescriptor = Object.getOwnPropertyDescriptor(
31431
+ globalThis,
31432
+ "WebSocket"
31433
+ );
31434
+ const WebSocketProxy = new Proxy(globalThis.WebSocket, {
31305
31435
  construct: (target, args, newTarget) => {
31306
31436
  const [url, protocols] = args;
31307
31437
  const createConnection = () => {
@@ -31348,9 +31478,16 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
31348
31478
  return socket;
31349
31479
  }
31350
31480
  });
31351
- globalThis.WebSocket = webSocketProxy;
31481
+ Object.defineProperty(globalThis, "WebSocket", {
31482
+ value: WebSocketProxy,
31483
+ configurable: true
31484
+ });
31352
31485
  this.subscriptions.push(() => {
31353
- globalThis.WebSocket = originalWebSocket;
31486
+ Object.defineProperty(
31487
+ globalThis,
31488
+ "WebSocket",
31489
+ originalWebSocketDescriptor
31490
+ );
31354
31491
  });
31355
31492
  }
31356
31493
  };