msw 2.7.2 → 2.7.3

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.
@@ -14,6 +14,7 @@ export { LifeCycleEventsMap, SharedOptions } from './sharedOptions.mjs';
14
14
  export { DelayMode, MAX_SERVER_RESPONSE_TIME, MIN_SERVER_RESPONSE_TIME, NODE_SERVER_RESPONSE_TIME, SET_TIMEOUT_MAX_ALLOWED_INT, delay } from './delay.mjs';
15
15
  export { bypass } from './bypass.mjs';
16
16
  export { passthrough } from './passthrough.mjs';
17
+ export { isCommonAssetRequest } from './isCommonAssetRequest.mjs';
17
18
  export { WebSocketData } from '@mswjs/interceptors/WebSocket';
18
19
  import 'strict-event-emitter';
19
20
  import './utils/internal/Disposable.mjs';
@@ -14,6 +14,7 @@ export { LifeCycleEventsMap, SharedOptions } from './sharedOptions.js';
14
14
  export { DelayMode, MAX_SERVER_RESPONSE_TIME, MIN_SERVER_RESPONSE_TIME, NODE_SERVER_RESPONSE_TIME, SET_TIMEOUT_MAX_ALLOWED_INT, delay } from './delay.js';
15
15
  export { bypass } from './bypass.js';
16
16
  export { passthrough } from './passthrough.js';
17
+ export { isCommonAssetRequest } from './isCommonAssetRequest.js';
17
18
  export { WebSocketData } from '@mswjs/interceptors/WebSocket';
18
19
  import 'strict-event-emitter';
19
20
  import './utils/internal/Disposable.js';
package/lib/core/index.js CHANGED
@@ -30,6 +30,7 @@ __export(core_exports, {
30
30
  getResponse: () => import_getResponse.getResponse,
31
31
  graphql: () => import_graphql.graphql,
32
32
  http: () => import_http.http,
33
+ isCommonAssetRequest: () => import_isCommonAssetRequest.isCommonAssetRequest,
33
34
  matchRequestUrl: () => import_matchRequestUrl.matchRequestUrl,
34
35
  passthrough: () => import_passthrough.passthrough,
35
36
  ws: () => import_ws.ws
@@ -52,5 +53,6 @@ __reExport(core_exports, require("./HttpResponse.js"), module.exports);
52
53
  __reExport(core_exports, require("./delay.js"), module.exports);
53
54
  var import_bypass = require("./bypass.js");
54
55
  var import_passthrough = require("./passthrough.js");
56
+ var import_isCommonAssetRequest = require("./isCommonAssetRequest.js");
55
57
  (0, import_checkGlobals.checkGlobals)();
56
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLJsonRequestBody,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAE7B,sBAAyB;AAGzB,4BAA+B;AAC/B,kBAAqB;AACrB,yBAAyC;AACzC,qBAAwB;AACxB,4BAA+B;AAG/B,gBAAuC;AACvC,8BAIO;AAGP,6BAAgC;AAChC,yBAAc,kCArBd;AAsBA,yBAA4B;AAC5B,sBAAyB;AAqCzB,yBAAc,2BA5Dd;AA6DA,yBAAc,oBA7Dd;AA8DA,oBAAuB;AACvB,yBAA4B;AAAA,IAM5B,kCAAa;","names":[]}
1
+ {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLJsonRequestBody,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\nexport { isCommonAssetRequest } from './isCommonAssetRequest'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAE7B,sBAAyB;AAGzB,4BAA+B;AAC/B,kBAAqB;AACrB,yBAAyC;AACzC,qBAAwB;AACxB,4BAA+B;AAG/B,gBAAuC;AACvC,8BAIO;AAGP,6BAAgC;AAChC,yBAAc,kCArBd;AAsBA,yBAA4B;AAC5B,sBAAyB;AAqCzB,yBAAc,2BA5Dd;AA6DA,yBAAc,oBA7Dd;AA8DA,oBAAuB;AACvB,yBAA4B;AAC5B,kCAAqC;AAAA,IAMrC,kCAAa;","names":[]}
@@ -17,6 +17,7 @@ export * from './HttpResponse.mjs';
17
17
  export * from './delay.mjs';
18
18
  import { bypass } from './bypass.mjs';
19
19
  import { passthrough } from './passthrough.mjs';
20
+ import { isCommonAssetRequest } from './isCommonAssetRequest.mjs';
20
21
  checkGlobals();
21
22
  export {
22
23
  GraphQLHandler,
@@ -30,6 +31,7 @@ export {
30
31
  getResponse,
31
32
  graphql,
32
33
  http,
34
+ isCommonAssetRequest,
33
35
  matchRequestUrl,
34
36
  passthrough,
35
37
  ws
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLJsonRequestBody,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,gBAAgB;AAGzB,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,aAAa,mBAAmB;AACzC,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAG/B,SAAS,UAA8B;AACvC;AAAA,EACE;AAAA,OAGK;AAGP,SAAS,uBAAuB;AAChC,cAAc;AACd,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAqCzB,cAAc;AACd,cAAc;AACd,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAM5B,aAAa;","names":[]}
1
+ {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["import { checkGlobals } from './utils/internal/checkGlobals'\n\nexport { SetupApi } from './SetupApi'\n\n/* HTTP handlers */\nexport { RequestHandler } from './handlers/RequestHandler'\nexport { http } from './http'\nexport { HttpHandler, HttpMethods } from './handlers/HttpHandler'\nexport { graphql } from './graphql'\nexport { GraphQLHandler } from './handlers/GraphQLHandler'\n\n/* WebSocket handler */\nexport { ws, type WebSocketLink } from './ws'\nexport {\n WebSocketHandler,\n type WebSocketHandlerEventMap,\n type WebSocketHandlerConnection,\n} from './handlers/WebSocketHandler'\n\n/* Utils */\nexport { matchRequestUrl } from './utils/matching/matchRequestUrl'\nexport * from './utils/handleRequest'\nexport { getResponse } from './getResponse'\nexport { cleanUrl } from './utils/url/cleanUrl'\n\n/**\n * Type definitions.\n */\n\nexport type { SharedOptions, LifeCycleEventsMap } from './sharedOptions'\n\nexport type {\n ResponseResolver,\n ResponseResolverReturnType,\n AsyncResponseResolverReturnType,\n RequestHandlerOptions,\n DefaultBodyType,\n DefaultRequestMultipartBody,\n JsonBodyType,\n} from './handlers/RequestHandler'\n\nexport type {\n RequestQuery,\n HttpRequestParsedResult,\n} from './handlers/HttpHandler'\nexport type { HttpRequestHandler, HttpResponseResolver } from './http'\n\nexport type {\n GraphQLQuery,\n GraphQLVariables,\n GraphQLRequestBody,\n GraphQLJsonRequestBody,\n} from './handlers/GraphQLHandler'\nexport type { GraphQLRequestHandler, GraphQLResponseResolver } from './graphql'\n\nexport type { WebSocketData, WebSocketEventListener } from './ws'\n\nexport type { Path, PathParams, Match } from './utils/matching/matchRequestUrl'\nexport type { ParsedGraphQLRequest } from './utils/internal/parseGraphQLRequest'\n\nexport * from './HttpResponse'\nexport * from './delay'\nexport { bypass } from './bypass'\nexport { passthrough } from './passthrough'\nexport { isCommonAssetRequest } from './isCommonAssetRequest'\n\n// Validate environmental globals before executing any code.\n// This ensures that the library gives user-friendly errors\n// when ran in the environments that require additional polyfills\n// from the end user.\ncheckGlobals()\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,gBAAgB;AAGzB,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,aAAa,mBAAmB;AACzC,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAG/B,SAAS,UAA8B;AACvC;AAAA,EACE;AAAA,OAGK;AAGP,SAAS,uBAAuB;AAChC,cAAc;AACd,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAqCzB,cAAc;AACd,cAAc;AACd,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AAMrC,aAAa;","names":[]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Determines if the given request is a static asset request.
3
+ * Useful when deciding which unhandled requests to ignore.
4
+ * @note Despite being ignored, you can still intercept and mock
5
+ * static assets by creating request handlers for them.
6
+ *
7
+ * @example
8
+ * import { isCommonAssetRequest } from 'msw'
9
+ *
10
+ * await worker.start({
11
+ * onUnhandledRequest(request, print) {
12
+ * if (!isCommonAssetRequest(request)) {
13
+ * print.warning()
14
+ * }
15
+ * }
16
+ * })
17
+ */
18
+ declare function isCommonAssetRequest(request: Request): boolean;
19
+
20
+ export { isCommonAssetRequest };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Determines if the given request is a static asset request.
3
+ * Useful when deciding which unhandled requests to ignore.
4
+ * @note Despite being ignored, you can still intercept and mock
5
+ * static assets by creating request handlers for them.
6
+ *
7
+ * @example
8
+ * import { isCommonAssetRequest } from 'msw'
9
+ *
10
+ * await worker.start({
11
+ * onUnhandledRequest(request, print) {
12
+ * if (!isCommonAssetRequest(request)) {
13
+ * print.warning()
14
+ * }
15
+ * }
16
+ * })
17
+ */
18
+ declare function isCommonAssetRequest(request: Request): boolean;
19
+
20
+ export { isCommonAssetRequest };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var isCommonAssetRequest_exports = {};
20
+ __export(isCommonAssetRequest_exports, {
21
+ isCommonAssetRequest: () => isCommonAssetRequest
22
+ });
23
+ module.exports = __toCommonJS(isCommonAssetRequest_exports);
24
+ function isCommonAssetRequest(request) {
25
+ const url = new URL(request.url);
26
+ if (url.protocol === "file:") {
27
+ return true;
28
+ }
29
+ if (/(fonts\.googleapis\.com)/.test(url.hostname)) {
30
+ return true;
31
+ }
32
+ if (/node_modules/.test(url.pathname)) {
33
+ return true;
34
+ }
35
+ if (url.pathname.includes("@vite")) {
36
+ return true;
37
+ }
38
+ return /\.(s?css|less|m?jsx?|m?tsx?|html|ttf|otf|woff|woff2|eot|gif|jpe?g|png|avif|webp|svg|mp4|webm|ogg|mov|mp3|wav|ogg|flac|aac|pdf|txt|csv|json|xml|md|zip|tar|gz|rar|7z)$/i.test(
39
+ url.pathname
40
+ );
41
+ }
42
+ //# sourceMappingURL=isCommonAssetRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/isCommonAssetRequest.ts"],"sourcesContent":["/**\n * Determines if the given request is a static asset request.\n * Useful when deciding which unhandled requests to ignore.\n * @note Despite being ignored, you can still intercept and mock\n * static assets by creating request handlers for them.\n *\n * @example\n * import { isCommonAssetRequest } from 'msw'\n *\n * await worker.start({\n * onUnhandledRequest(request, print) {\n * if (!isCommonAssetRequest(request)) {\n * print.warning()\n * }\n * }\n * })\n */\nexport function isCommonAssetRequest(request: Request): boolean {\n const url = new URL(request.url)\n\n // Ignore certain protocols.\n if (url.protocol === 'file:') {\n return true\n }\n\n // Ignore static assets hosts.\n if (/(fonts\\.googleapis\\.com)/.test(url.hostname)) {\n return true\n }\n\n // Ignore node modules served over HTTP.\n if (/node_modules/.test(url.pathname)) {\n return true\n }\n\n // Ignore internal Vite requests, like \"/@vite/client\".\n if (url.pathname.includes('@vite')) {\n return true\n }\n\n // Ignore common static assets.\n return /\\.(s?css|less|m?jsx?|m?tsx?|html|ttf|otf|woff|woff2|eot|gif|jpe?g|png|avif|webp|svg|mp4|webm|ogg|mov|mp3|wav|ogg|flac|aac|pdf|txt|csv|json|xml|md|zip|tar|gz|rar|7z)$/i.test(\n url.pathname,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,qBAAqB,SAA2B;AAC9D,QAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAG/B,MAAI,IAAI,aAAa,SAAS;AAC5B,WAAO;AAAA,EACT;AAGA,MAAI,2BAA2B,KAAK,IAAI,QAAQ,GAAG;AACjD,WAAO;AAAA,EACT;AAGA,MAAI,eAAe,KAAK,IAAI,QAAQ,GAAG;AACrC,WAAO;AAAA,EACT;AAGA,MAAI,IAAI,SAAS,SAAS,OAAO,GAAG;AAClC,WAAO;AAAA,EACT;AAGA,SAAO,yKAAyK;AAAA,IAC9K,IAAI;AAAA,EACN;AACF;","names":[]}
@@ -0,0 +1,22 @@
1
+ function isCommonAssetRequest(request) {
2
+ const url = new URL(request.url);
3
+ if (url.protocol === "file:") {
4
+ return true;
5
+ }
6
+ if (/(fonts\.googleapis\.com)/.test(url.hostname)) {
7
+ return true;
8
+ }
9
+ if (/node_modules/.test(url.pathname)) {
10
+ return true;
11
+ }
12
+ if (url.pathname.includes("@vite")) {
13
+ return true;
14
+ }
15
+ return /\.(s?css|less|m?jsx?|m?tsx?|html|ttf|otf|woff|woff2|eot|gif|jpe?g|png|avif|webp|svg|mp4|webm|ogg|mov|mp3|wav|ogg|flac|aac|pdf|txt|csv|json|xml|md|zip|tar|gz|rar|7z)$/i.test(
16
+ url.pathname
17
+ );
18
+ }
19
+ export {
20
+ isCommonAssetRequest
21
+ };
22
+ //# sourceMappingURL=isCommonAssetRequest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/isCommonAssetRequest.ts"],"sourcesContent":["/**\n * Determines if the given request is a static asset request.\n * Useful when deciding which unhandled requests to ignore.\n * @note Despite being ignored, you can still intercept and mock\n * static assets by creating request handlers for them.\n *\n * @example\n * import { isCommonAssetRequest } from 'msw'\n *\n * await worker.start({\n * onUnhandledRequest(request, print) {\n * if (!isCommonAssetRequest(request)) {\n * print.warning()\n * }\n * }\n * })\n */\nexport function isCommonAssetRequest(request: Request): boolean {\n const url = new URL(request.url)\n\n // Ignore certain protocols.\n if (url.protocol === 'file:') {\n return true\n }\n\n // Ignore static assets hosts.\n if (/(fonts\\.googleapis\\.com)/.test(url.hostname)) {\n return true\n }\n\n // Ignore node modules served over HTTP.\n if (/node_modules/.test(url.pathname)) {\n return true\n }\n\n // Ignore internal Vite requests, like \"/@vite/client\".\n if (url.pathname.includes('@vite')) {\n return true\n }\n\n // Ignore common static assets.\n return /\\.(s?css|less|m?jsx?|m?tsx?|html|ttf|otf|woff|woff2|eot|gif|jpe?g|png|avif|webp|svg|mp4|webm|ogg|mov|mp3|wav|ogg|flac|aac|pdf|txt|csv|json|xml|md|zip|tar|gz|rar|7z)$/i.test(\n url.pathname,\n )\n}\n"],"mappings":"AAiBO,SAAS,qBAAqB,SAA2B;AAC9D,QAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAG/B,MAAI,IAAI,aAAa,SAAS;AAC5B,WAAO;AAAA,EACT;AAGA,MAAI,2BAA2B,KAAK,IAAI,QAAQ,GAAG;AACjD,WAAO;AAAA,EACT;AAGA,MAAI,eAAe,KAAK,IAAI,QAAQ,GAAG;AACrC,WAAO;AAAA,EACT;AAGA,MAAI,IAAI,SAAS,SAAS,OAAO,GAAG;AAClC,WAAO;AAAA,EACT;AAGA,SAAO,yKAAyK;AAAA,IAC9K,IAAI;AAAA,EACN;AACF;","names":[]}
@@ -23,6 +23,7 @@ __export(onUnhandledRequest_exports, {
23
23
  module.exports = __toCommonJS(onUnhandledRequest_exports);
24
24
  var import_toPublicUrl = require("./toPublicUrl.js");
25
25
  var import_devUtils = require("../internal/devUtils.js");
26
+ var import_isCommonAssetRequest = require("../../isCommonAssetRequest.js");
26
27
  async function onUnhandledRequest(request, strategy = "warn") {
27
28
  const url = new URL(request.url);
28
29
  const publicUrl = (0, import_toPublicUrl.toPublicUrl)(url) + url.search;
@@ -68,9 +69,8 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
68
69
  });
69
70
  return;
70
71
  }
71
- if (url.protocol === "file:") {
72
- return;
72
+ if (!(0, import_isCommonAssetRequest.isCommonAssetRequest)(request)) {
73
+ applyStrategy(strategy);
73
74
  }
74
- applyStrategy(strategy);
75
75
  }
76
76
  //# sourceMappingURL=onUnhandledRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/utils/request/onUnhandledRequest.ts"],"sourcesContent":["import { toPublicUrl } from './toPublicUrl'\nimport { InternalError, devUtils } from '../internal/devUtils'\n\nexport interface UnhandledRequestPrint {\n warning(): void\n error(): void\n}\n\nexport type UnhandledRequestCallback = (\n request: Request,\n print: UnhandledRequestPrint,\n) => void\n\nexport type UnhandledRequestStrategy =\n | 'bypass'\n | 'warn'\n | 'error'\n | UnhandledRequestCallback\n\nexport async function onUnhandledRequest(\n request: Request,\n strategy: UnhandledRequestStrategy = 'warn',\n): Promise<void> {\n const url = new URL(request.url)\n const publicUrl = toPublicUrl(url) + url.search\n\n const requestBody =\n request.method === 'HEAD' || request.method === 'GET'\n ? null\n : await request.clone().text()\n const messageDetails = `\\n\\n \\u2022 ${request.method} ${publicUrl}\\n\\n${requestBody ? ` \\u2022 Request body: ${requestBody}\\n\\n` : ''}`\n const unhandledRequestMessage = `intercepted a request without a matching request handler:${messageDetails}If you still wish to intercept this unhandled request, please create a request handler for it.\\nRead more: https://mswjs.io/docs/getting-started/mocks`\n\n function applyStrategy(strategy: UnhandledRequestStrategy) {\n switch (strategy) {\n case 'error': {\n // Print a developer-friendly error.\n devUtils.error('Error: %s', unhandledRequestMessage)\n\n // Throw an exception to halt request processing and not perform the original request.\n throw new InternalError(\n devUtils.formatMessage(\n 'Cannot bypass a request when using the \"error\" strategy for the \"onUnhandledRequest\" option.',\n ),\n )\n }\n\n case 'warn': {\n devUtils.warn('Warning: %s', unhandledRequestMessage)\n break\n }\n\n case 'bypass':\n break\n\n default:\n throw new InternalError(\n devUtils.formatMessage(\n 'Failed to react to an unhandled request: unknown strategy \"%s\". Please provide one of the supported strategies (\"bypass\", \"warn\", \"error\") or a custom callback function as the value of the \"onUnhandledRequest\" option.',\n strategy,\n ),\n )\n }\n }\n\n if (typeof strategy === 'function') {\n strategy(request, {\n warning: applyStrategy.bind(null, 'warn'),\n error: applyStrategy.bind(null, 'error'),\n })\n return\n }\n\n /**\n * @note Ignore \"file://\" requests.\n * Those often are an implementation detail of modern tooling\n * that fetches modules via HTTP. Developers don't issue those\n * requests and so they mustn't be warned about them.\n */\n if (url.protocol === 'file:') {\n return\n }\n\n applyStrategy(strategy)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B;AAC5B,sBAAwC;AAkBxC,eAAsB,mBACpB,SACA,WAAqC,QACtB;AACf,QAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,QAAM,gBAAY,gCAAY,GAAG,IAAI,IAAI;AAEzC,QAAM,cACJ,QAAQ,WAAW,UAAU,QAAQ,WAAW,QAC5C,OACA,MAAM,QAAQ,MAAM,EAAE,KAAK;AACjC,QAAM,iBAAiB;AAAA;AAAA,WAAgB,QAAQ,MAAM,IAAI,SAAS;AAAA;AAAA,EAAO,cAAc,0BAA0B,WAAW;AAAA;AAAA,IAAS,EAAE;AACvI,QAAM,0BAA0B,4DAA4D,cAAc;AAAA;AAE1G,WAAS,cAAcA,WAAoC;AACzD,YAAQA,WAAU;AAAA,MAChB,KAAK,SAAS;AAEZ,iCAAS,MAAM,aAAa,uBAAuB;AAGnD,cAAM,IAAI;AAAA,UACR,yBAAS;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MAEA,KAAK,QAAQ;AACX,iCAAS,KAAK,eAAe,uBAAuB;AACpD;AAAA,MACF;AAAA,MAEA,KAAK;AACH;AAAA,MAEF;AACE,cAAM,IAAI;AAAA,UACR,yBAAS;AAAA,YACP;AAAA,YACAA;AAAA,UACF;AAAA,QACF;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,aAAS,SAAS;AAAA,MAChB,SAAS,cAAc,KAAK,MAAM,MAAM;AAAA,MACxC,OAAO,cAAc,KAAK,MAAM,OAAO;AAAA,IACzC,CAAC;AACD;AAAA,EACF;AAQA,MAAI,IAAI,aAAa,SAAS;AAC5B;AAAA,EACF;AAEA,gBAAc,QAAQ;AACxB;","names":["strategy"]}
1
+ {"version":3,"sources":["../../../../src/core/utils/request/onUnhandledRequest.ts"],"sourcesContent":["import { toPublicUrl } from './toPublicUrl'\nimport { InternalError, devUtils } from '../internal/devUtils'\nimport { isCommonAssetRequest } from '../../isCommonAssetRequest'\n\nexport interface UnhandledRequestPrint {\n warning(): void\n error(): void\n}\n\nexport type UnhandledRequestCallback = (\n request: Request,\n print: UnhandledRequestPrint,\n) => void\n\nexport type UnhandledRequestStrategy =\n | 'bypass'\n | 'warn'\n | 'error'\n | UnhandledRequestCallback\n\nexport async function onUnhandledRequest(\n request: Request,\n strategy: UnhandledRequestStrategy = 'warn',\n): Promise<void> {\n const url = new URL(request.url)\n const publicUrl = toPublicUrl(url) + url.search\n\n const requestBody =\n request.method === 'HEAD' || request.method === 'GET'\n ? null\n : await request.clone().text()\n const messageDetails = `\\n\\n \\u2022 ${request.method} ${publicUrl}\\n\\n${requestBody ? ` \\u2022 Request body: ${requestBody}\\n\\n` : ''}`\n const unhandledRequestMessage = `intercepted a request without a matching request handler:${messageDetails}If you still wish to intercept this unhandled request, please create a request handler for it.\\nRead more: https://mswjs.io/docs/getting-started/mocks`\n\n function applyStrategy(strategy: UnhandledRequestStrategy) {\n switch (strategy) {\n case 'error': {\n // Print a developer-friendly error.\n devUtils.error('Error: %s', unhandledRequestMessage)\n\n // Throw an exception to halt request processing and not perform the original request.\n throw new InternalError(\n devUtils.formatMessage(\n 'Cannot bypass a request when using the \"error\" strategy for the \"onUnhandledRequest\" option.',\n ),\n )\n }\n\n case 'warn': {\n devUtils.warn('Warning: %s', unhandledRequestMessage)\n break\n }\n\n case 'bypass':\n break\n\n default:\n throw new InternalError(\n devUtils.formatMessage(\n 'Failed to react to an unhandled request: unknown strategy \"%s\". Please provide one of the supported strategies (\"bypass\", \"warn\", \"error\") or a custom callback function as the value of the \"onUnhandledRequest\" option.',\n strategy,\n ),\n )\n }\n }\n\n if (typeof strategy === 'function') {\n strategy(request, {\n warning: applyStrategy.bind(null, 'warn'),\n error: applyStrategy.bind(null, 'error'),\n })\n return\n }\n\n // Ignore common static asset requests when using a built-in strategy.\n // There's a slight overhead here because this utility will create a request URL\n // instance again despite us having done so previously in this function.\n if (!isCommonAssetRequest(request)) {\n applyStrategy(strategy)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B;AAC5B,sBAAwC;AACxC,kCAAqC;AAkBrC,eAAsB,mBACpB,SACA,WAAqC,QACtB;AACf,QAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,QAAM,gBAAY,gCAAY,GAAG,IAAI,IAAI;AAEzC,QAAM,cACJ,QAAQ,WAAW,UAAU,QAAQ,WAAW,QAC5C,OACA,MAAM,QAAQ,MAAM,EAAE,KAAK;AACjC,QAAM,iBAAiB;AAAA;AAAA,WAAgB,QAAQ,MAAM,IAAI,SAAS;AAAA;AAAA,EAAO,cAAc,0BAA0B,WAAW;AAAA;AAAA,IAAS,EAAE;AACvI,QAAM,0BAA0B,4DAA4D,cAAc;AAAA;AAE1G,WAAS,cAAcA,WAAoC;AACzD,YAAQA,WAAU;AAAA,MAChB,KAAK,SAAS;AAEZ,iCAAS,MAAM,aAAa,uBAAuB;AAGnD,cAAM,IAAI;AAAA,UACR,yBAAS;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MAEA,KAAK,QAAQ;AACX,iCAAS,KAAK,eAAe,uBAAuB;AACpD;AAAA,MACF;AAAA,MAEA,KAAK;AACH;AAAA,MAEF;AACE,cAAM,IAAI;AAAA,UACR,yBAAS;AAAA,YACP;AAAA,YACAA;AAAA,UACF;AAAA,QACF;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,aAAS,SAAS;AAAA,MAChB,SAAS,cAAc,KAAK,MAAM,MAAM;AAAA,MACxC,OAAO,cAAc,KAAK,MAAM,OAAO;AAAA,IACzC,CAAC;AACD;AAAA,EACF;AAKA,MAAI,KAAC,kDAAqB,OAAO,GAAG;AAClC,kBAAc,QAAQ;AAAA,EACxB;AACF;","names":["strategy"]}
@@ -1,5 +1,6 @@
1
1
  import { toPublicUrl } from './toPublicUrl.mjs';
2
2
  import { InternalError, devUtils } from '../internal/devUtils.mjs';
3
+ import { isCommonAssetRequest } from '../../isCommonAssetRequest.mjs';
3
4
  async function onUnhandledRequest(request, strategy = "warn") {
4
5
  const url = new URL(request.url);
5
6
  const publicUrl = toPublicUrl(url) + url.search;
@@ -45,10 +46,9 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
45
46
  });
46
47
  return;
47
48
  }
48
- if (url.protocol === "file:") {
49
- return;
49
+ if (!isCommonAssetRequest(request)) {
50
+ applyStrategy(strategy);
50
51
  }
51
- applyStrategy(strategy);
52
52
  }
53
53
  export {
54
54
  onUnhandledRequest
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/utils/request/onUnhandledRequest.ts"],"sourcesContent":["import { toPublicUrl } from './toPublicUrl'\nimport { InternalError, devUtils } from '../internal/devUtils'\n\nexport interface UnhandledRequestPrint {\n warning(): void\n error(): void\n}\n\nexport type UnhandledRequestCallback = (\n request: Request,\n print: UnhandledRequestPrint,\n) => void\n\nexport type UnhandledRequestStrategy =\n | 'bypass'\n | 'warn'\n | 'error'\n | UnhandledRequestCallback\n\nexport async function onUnhandledRequest(\n request: Request,\n strategy: UnhandledRequestStrategy = 'warn',\n): Promise<void> {\n const url = new URL(request.url)\n const publicUrl = toPublicUrl(url) + url.search\n\n const requestBody =\n request.method === 'HEAD' || request.method === 'GET'\n ? null\n : await request.clone().text()\n const messageDetails = `\\n\\n \\u2022 ${request.method} ${publicUrl}\\n\\n${requestBody ? ` \\u2022 Request body: ${requestBody}\\n\\n` : ''}`\n const unhandledRequestMessage = `intercepted a request without a matching request handler:${messageDetails}If you still wish to intercept this unhandled request, please create a request handler for it.\\nRead more: https://mswjs.io/docs/getting-started/mocks`\n\n function applyStrategy(strategy: UnhandledRequestStrategy) {\n switch (strategy) {\n case 'error': {\n // Print a developer-friendly error.\n devUtils.error('Error: %s', unhandledRequestMessage)\n\n // Throw an exception to halt request processing and not perform the original request.\n throw new InternalError(\n devUtils.formatMessage(\n 'Cannot bypass a request when using the \"error\" strategy for the \"onUnhandledRequest\" option.',\n ),\n )\n }\n\n case 'warn': {\n devUtils.warn('Warning: %s', unhandledRequestMessage)\n break\n }\n\n case 'bypass':\n break\n\n default:\n throw new InternalError(\n devUtils.formatMessage(\n 'Failed to react to an unhandled request: unknown strategy \"%s\". Please provide one of the supported strategies (\"bypass\", \"warn\", \"error\") or a custom callback function as the value of the \"onUnhandledRequest\" option.',\n strategy,\n ),\n )\n }\n }\n\n if (typeof strategy === 'function') {\n strategy(request, {\n warning: applyStrategy.bind(null, 'warn'),\n error: applyStrategy.bind(null, 'error'),\n })\n return\n }\n\n /**\n * @note Ignore \"file://\" requests.\n * Those often are an implementation detail of modern tooling\n * that fetches modules via HTTP. Developers don't issue those\n * requests and so they mustn't be warned about them.\n */\n if (url.protocol === 'file:') {\n return\n }\n\n applyStrategy(strategy)\n}\n"],"mappings":"AAAA,SAAS,mBAAmB;AAC5B,SAAS,eAAe,gBAAgB;AAkBxC,eAAsB,mBACpB,SACA,WAAqC,QACtB;AACf,QAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,QAAM,YAAY,YAAY,GAAG,IAAI,IAAI;AAEzC,QAAM,cACJ,QAAQ,WAAW,UAAU,QAAQ,WAAW,QAC5C,OACA,MAAM,QAAQ,MAAM,EAAE,KAAK;AACjC,QAAM,iBAAiB;AAAA;AAAA,WAAgB,QAAQ,MAAM,IAAI,SAAS;AAAA;AAAA,EAAO,cAAc,0BAA0B,WAAW;AAAA;AAAA,IAAS,EAAE;AACvI,QAAM,0BAA0B,4DAA4D,cAAc;AAAA;AAE1G,WAAS,cAAcA,WAAoC;AACzD,YAAQA,WAAU;AAAA,MAChB,KAAK,SAAS;AAEZ,iBAAS,MAAM,aAAa,uBAAuB;AAGnD,cAAM,IAAI;AAAA,UACR,SAAS;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MAEA,KAAK,QAAQ;AACX,iBAAS,KAAK,eAAe,uBAAuB;AACpD;AAAA,MACF;AAAA,MAEA,KAAK;AACH;AAAA,MAEF;AACE,cAAM,IAAI;AAAA,UACR,SAAS;AAAA,YACP;AAAA,YACAA;AAAA,UACF;AAAA,QACF;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,aAAS,SAAS;AAAA,MAChB,SAAS,cAAc,KAAK,MAAM,MAAM;AAAA,MACxC,OAAO,cAAc,KAAK,MAAM,OAAO;AAAA,IACzC,CAAC;AACD;AAAA,EACF;AAQA,MAAI,IAAI,aAAa,SAAS;AAC5B;AAAA,EACF;AAEA,gBAAc,QAAQ;AACxB;","names":["strategy"]}
1
+ {"version":3,"sources":["../../../../src/core/utils/request/onUnhandledRequest.ts"],"sourcesContent":["import { toPublicUrl } from './toPublicUrl'\nimport { InternalError, devUtils } from '../internal/devUtils'\nimport { isCommonAssetRequest } from '../../isCommonAssetRequest'\n\nexport interface UnhandledRequestPrint {\n warning(): void\n error(): void\n}\n\nexport type UnhandledRequestCallback = (\n request: Request,\n print: UnhandledRequestPrint,\n) => void\n\nexport type UnhandledRequestStrategy =\n | 'bypass'\n | 'warn'\n | 'error'\n | UnhandledRequestCallback\n\nexport async function onUnhandledRequest(\n request: Request,\n strategy: UnhandledRequestStrategy = 'warn',\n): Promise<void> {\n const url = new URL(request.url)\n const publicUrl = toPublicUrl(url) + url.search\n\n const requestBody =\n request.method === 'HEAD' || request.method === 'GET'\n ? null\n : await request.clone().text()\n const messageDetails = `\\n\\n \\u2022 ${request.method} ${publicUrl}\\n\\n${requestBody ? ` \\u2022 Request body: ${requestBody}\\n\\n` : ''}`\n const unhandledRequestMessage = `intercepted a request without a matching request handler:${messageDetails}If you still wish to intercept this unhandled request, please create a request handler for it.\\nRead more: https://mswjs.io/docs/getting-started/mocks`\n\n function applyStrategy(strategy: UnhandledRequestStrategy) {\n switch (strategy) {\n case 'error': {\n // Print a developer-friendly error.\n devUtils.error('Error: %s', unhandledRequestMessage)\n\n // Throw an exception to halt request processing and not perform the original request.\n throw new InternalError(\n devUtils.formatMessage(\n 'Cannot bypass a request when using the \"error\" strategy for the \"onUnhandledRequest\" option.',\n ),\n )\n }\n\n case 'warn': {\n devUtils.warn('Warning: %s', unhandledRequestMessage)\n break\n }\n\n case 'bypass':\n break\n\n default:\n throw new InternalError(\n devUtils.formatMessage(\n 'Failed to react to an unhandled request: unknown strategy \"%s\". Please provide one of the supported strategies (\"bypass\", \"warn\", \"error\") or a custom callback function as the value of the \"onUnhandledRequest\" option.',\n strategy,\n ),\n )\n }\n }\n\n if (typeof strategy === 'function') {\n strategy(request, {\n warning: applyStrategy.bind(null, 'warn'),\n error: applyStrategy.bind(null, 'error'),\n })\n return\n }\n\n // Ignore common static asset requests when using a built-in strategy.\n // There's a slight overhead here because this utility will create a request URL\n // instance again despite us having done so previously in this function.\n if (!isCommonAssetRequest(request)) {\n applyStrategy(strategy)\n }\n}\n"],"mappings":"AAAA,SAAS,mBAAmB;AAC5B,SAAS,eAAe,gBAAgB;AACxC,SAAS,4BAA4B;AAkBrC,eAAsB,mBACpB,SACA,WAAqC,QACtB;AACf,QAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,QAAM,YAAY,YAAY,GAAG,IAAI,IAAI;AAEzC,QAAM,cACJ,QAAQ,WAAW,UAAU,QAAQ,WAAW,QAC5C,OACA,MAAM,QAAQ,MAAM,EAAE,KAAK;AACjC,QAAM,iBAAiB;AAAA;AAAA,WAAgB,QAAQ,MAAM,IAAI,SAAS;AAAA;AAAA,EAAO,cAAc,0BAA0B,WAAW;AAAA;AAAA,IAAS,EAAE;AACvI,QAAM,0BAA0B,4DAA4D,cAAc;AAAA;AAE1G,WAAS,cAAcA,WAAoC;AACzD,YAAQA,WAAU;AAAA,MAChB,KAAK,SAAS;AAEZ,iBAAS,MAAM,aAAa,uBAAuB;AAGnD,cAAM,IAAI;AAAA,UACR,SAAS;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MAEA,KAAK,QAAQ;AACX,iBAAS,KAAK,eAAe,uBAAuB;AACpD;AAAA,MACF;AAAA,MAEA,KAAK;AACH;AAAA,MAEF;AACE,cAAM,IAAI;AAAA,UACR,SAAS;AAAA,YACP;AAAA,YACAA;AAAA,UACF;AAAA,QACF;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,aAAS,SAAS;AAAA,MAChB,SAAS,cAAc,KAAK,MAAM,MAAM;AAAA,MACxC,OAAO,cAAc,KAAK,MAAM,OAAO;AAAA,IACzC,CAAC;AACD;AAAA,EACF;AAKA,MAAI,CAAC,qBAAqB,OAAO,GAAG;AAClC,kBAAc,QAAQ;AAAA,EACxB;AACF;","names":["strategy"]}
package/lib/iife/index.js CHANGED
@@ -13133,6 +13133,7 @@ ${operationTypes.join("\n")}
13133
13133
  graphql: () => graphql2,
13134
13134
  handleRequest: () => handleRequest,
13135
13135
  http: () => http,
13136
+ isCommonAssetRequest: () => isCommonAssetRequest,
13136
13137
  matchRequestUrl: () => matchRequestUrl,
13137
13138
  passthrough: () => passthrough,
13138
13139
  setupWorker: () => setupWorker,
@@ -28497,6 +28498,26 @@ Consider naming this operation or using "graphql.operation()" request handler to
28497
28498
  return null;
28498
28499
  };
28499
28500
 
28501
+ // src/core/isCommonAssetRequest.ts
28502
+ function isCommonAssetRequest(request) {
28503
+ const url = new URL(request.url);
28504
+ if (url.protocol === "file:") {
28505
+ return true;
28506
+ }
28507
+ if (/(fonts\.googleapis\.com)/.test(url.hostname)) {
28508
+ return true;
28509
+ }
28510
+ if (/node_modules/.test(url.pathname)) {
28511
+ return true;
28512
+ }
28513
+ if (url.pathname.includes("@vite")) {
28514
+ return true;
28515
+ }
28516
+ return /\.(s?css|less|m?jsx?|m?tsx?|html|ttf|otf|woff|woff2|eot|gif|jpe?g|png|avif|webp|svg|mp4|webm|ogg|mov|mp3|wav|ogg|flac|aac|pdf|txt|csv|json|xml|md|zip|tar|gz|rar|7z)$/i.test(
28517
+ url.pathname
28518
+ );
28519
+ }
28520
+
28500
28521
  // src/core/utils/request/onUnhandledRequest.ts
28501
28522
  async function onUnhandledRequest(request, strategy = "warn") {
28502
28523
  const url = new URL(request.url);
@@ -28543,10 +28564,9 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
28543
28564
  });
28544
28565
  return;
28545
28566
  }
28546
- if (url.protocol === "file:") {
28547
- return;
28567
+ if (!isCommonAssetRequest(request)) {
28568
+ applyStrategy(strategy);
28548
28569
  }
28549
- applyStrategy(strategy);
28550
28570
  }
28551
28571
 
28552
28572
  // src/core/utils/HttpResponse/decorators.ts