msw 2.13.2 → 2.13.4
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.
- package/cli/init.js +1 -1
- package/lib/browser/index.js +252 -72
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +252 -72
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/{HttpResponse-DlRR1D-f.d.mts → HttpResponse-BF4NGRsf.d.mts} +1 -1
- package/lib/core/{HttpResponse-CksOMVAa.d.ts → HttpResponse-yukpQS4a.d.ts} +1 -1
- package/lib/core/HttpResponse.d.mts +1 -1
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/experimental/compat.d.mts +2 -2
- package/lib/core/experimental/compat.d.ts +2 -2
- package/lib/core/experimental/compat.js +1 -0
- package/lib/core/experimental/compat.js.map +1 -1
- package/lib/core/experimental/compat.mjs +1 -0
- package/lib/core/experimental/compat.mjs.map +1 -1
- package/lib/core/experimental/define-network.d.mts +2 -2
- package/lib/core/experimental/define-network.d.ts +2 -2
- package/lib/core/experimental/define-network.js +4 -0
- package/lib/core/experimental/define-network.js.map +1 -1
- package/lib/core/experimental/define-network.mjs +6 -0
- package/lib/core/experimental/define-network.mjs.map +1 -1
- package/lib/core/experimental/frames/http-frame.d.mts +2 -2
- package/lib/core/experimental/frames/http-frame.d.ts +2 -2
- package/lib/core/experimental/frames/http-frame.js +2 -0
- package/lib/core/experimental/frames/http-frame.js.map +1 -1
- package/lib/core/experimental/frames/http-frame.mjs +5 -1
- package/lib/core/experimental/frames/http-frame.mjs.map +1 -1
- package/lib/core/experimental/frames/network-frame.d.mts +2 -2
- package/lib/core/experimental/frames/network-frame.d.ts +2 -2
- package/lib/core/experimental/frames/websocket-frame.d.mts +2 -2
- package/lib/core/experimental/frames/websocket-frame.d.ts +2 -2
- package/lib/core/experimental/frames/websocket-frame.js +2 -0
- package/lib/core/experimental/frames/websocket-frame.js.map +1 -1
- package/lib/core/experimental/frames/websocket-frame.mjs +2 -0
- package/lib/core/experimental/frames/websocket-frame.mjs.map +1 -1
- package/lib/core/experimental/handlers-controller.d.mts +1 -1
- package/lib/core/experimental/handlers-controller.d.ts +1 -1
- package/lib/core/experimental/handlers-controller.js +3 -1
- package/lib/core/experimental/handlers-controller.js.map +1 -1
- package/lib/core/experimental/handlers-controller.mjs +3 -1
- package/lib/core/experimental/handlers-controller.mjs.map +1 -1
- package/lib/core/experimental/index.d.mts +2 -2
- package/lib/core/experimental/index.d.ts +2 -2
- package/lib/core/experimental/index.js +0 -1
- package/lib/core/experimental/index.js.map +1 -1
- package/lib/core/experimental/index.mjs +1 -2
- package/lib/core/experimental/index.mjs.map +1 -1
- package/lib/core/experimental/on-unhandled-frame.d.mts +2 -2
- package/lib/core/experimental/on-unhandled-frame.d.ts +2 -2
- package/lib/core/experimental/on-unhandled-frame.js +1 -0
- package/lib/core/experimental/on-unhandled-frame.js.map +1 -1
- package/lib/core/experimental/on-unhandled-frame.mjs +1 -0
- package/lib/core/experimental/on-unhandled-frame.mjs.map +1 -1
- package/lib/core/experimental/setup-api.d.mts +1 -1
- package/lib/core/experimental/setup-api.d.ts +1 -1
- package/lib/core/experimental/setup-api.js +1 -0
- package/lib/core/experimental/setup-api.js.map +1 -1
- package/lib/core/experimental/setup-api.mjs +1 -0
- package/lib/core/experimental/setup-api.mjs.map +1 -1
- package/lib/core/experimental/sources/interceptor-source.d.mts +2 -2
- package/lib/core/experimental/sources/interceptor-source.d.ts +2 -2
- package/lib/core/experimental/sources/interceptor-source.js.map +1 -1
- package/lib/core/experimental/sources/interceptor-source.mjs +1 -3
- package/lib/core/experimental/sources/interceptor-source.mjs.map +1 -1
- package/lib/core/experimental/sources/network-source.d.mts +3 -3
- package/lib/core/experimental/sources/network-source.d.ts +3 -3
- package/lib/core/experimental/sources/network-source.js +1 -0
- package/lib/core/experimental/sources/network-source.js.map +1 -1
- package/lib/core/experimental/sources/network-source.mjs +2 -0
- package/lib/core/experimental/sources/network-source.mjs.map +1 -1
- package/lib/core/getResponse.d.mts +1 -1
- package/lib/core/getResponse.d.ts +1 -1
- package/lib/core/graphql.d.mts +1 -1
- package/lib/core/graphql.d.ts +1 -1
- package/lib/core/graphql.js +1 -0
- package/lib/core/graphql.js.map +1 -1
- package/lib/core/graphql.mjs +2 -0
- package/lib/core/graphql.mjs.map +1 -1
- package/lib/core/handlers/GraphQLHandler.d.mts +1 -1
- package/lib/core/handlers/GraphQLHandler.d.ts +1 -1
- package/lib/core/handlers/GraphQLHandler.js +1 -0
- package/lib/core/handlers/GraphQLHandler.js.map +1 -1
- package/lib/core/handlers/GraphQLHandler.mjs +4 -1
- package/lib/core/handlers/GraphQLHandler.mjs.map +1 -1
- package/lib/core/handlers/HttpHandler.d.mts +1 -1
- package/lib/core/handlers/HttpHandler.d.ts +1 -1
- package/lib/core/handlers/HttpHandler.js +1 -0
- package/lib/core/handlers/HttpHandler.js.map +1 -1
- package/lib/core/handlers/HttpHandler.mjs +1 -0
- package/lib/core/handlers/HttpHandler.mjs.map +1 -1
- package/lib/core/handlers/RequestHandler.d.mts +1 -1
- package/lib/core/handlers/RequestHandler.d.ts +1 -1
- package/lib/core/handlers/RequestHandler.js +1 -0
- package/lib/core/handlers/RequestHandler.js.map +1 -1
- package/lib/core/handlers/RequestHandler.mjs +2 -0
- package/lib/core/handlers/RequestHandler.mjs.map +1 -1
- package/lib/core/http.d.mts +1 -1
- package/lib/core/http.d.ts +1 -1
- package/lib/core/http.js +1 -0
- package/lib/core/http.js.map +1 -1
- package/lib/core/http.mjs +2 -0
- package/lib/core/http.mjs.map +1 -1
- package/lib/core/index.d.mts +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/passthrough.d.mts +1 -1
- package/lib/core/passthrough.d.ts +1 -1
- package/lib/core/sse.d.mts +4 -18
- package/lib/core/sse.d.ts +4 -18
- package/lib/core/sse.js +105 -45
- package/lib/core/sse.js.map +1 -1
- package/lib/core/sse.mjs +105 -45
- package/lib/core/sse.mjs.map +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
- package/lib/core/utils/cookieStore.js.map +1 -1
- package/lib/core/utils/cookieStore.mjs.map +1 -1
- package/lib/core/utils/executeHandlers.d.mts +1 -1
- package/lib/core/utils/executeHandlers.d.ts +1 -1
- package/lib/core/utils/executeHandlers.js +1 -0
- package/lib/core/utils/executeHandlers.js.map +1 -1
- package/lib/core/utils/executeHandlers.mjs +1 -0
- package/lib/core/utils/executeHandlers.mjs.map +1 -1
- package/lib/core/utils/handleRequest.d.mts +1 -1
- package/lib/core/utils/handleRequest.d.ts +1 -1
- package/lib/core/utils/handleRequest.js.map +1 -1
- package/lib/core/utils/handleRequest.mjs.map +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.mts +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.ts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
- package/lib/core/utils/internal/parseMultipartData.js +1 -0
- package/lib/core/utils/internal/parseMultipartData.js.map +1 -1
- package/lib/core/utils/internal/parseMultipartData.mjs +1 -0
- package/lib/core/utils/internal/parseMultipartData.mjs.map +1 -1
- package/lib/core/utils/internal/pipeEvents.js +1 -0
- package/lib/core/utils/internal/pipeEvents.js.map +1 -1
- package/lib/core/utils/internal/pipeEvents.mjs +1 -0
- package/lib/core/utils/internal/pipeEvents.mjs.map +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.js.map +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.mjs.map +1 -1
- package/lib/core/ws/WebSocketClientManager.js.map +1 -1
- package/lib/core/ws/WebSocketClientManager.mjs.map +1 -1
- package/lib/core/ws/WebSocketIndexedDBClientStore.js +1 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.js.map +1 -1
- package/lib/core/ws/WebSocketIndexedDBClientStore.mjs +1 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.mjs.map +1 -1
- package/lib/core/ws/WebSocketMemoryClientStore.js +1 -0
- package/lib/core/ws/WebSocketMemoryClientStore.js.map +1 -1
- package/lib/core/ws/WebSocketMemoryClientStore.mjs +1 -0
- package/lib/core/ws/WebSocketMemoryClientStore.mjs.map +1 -1
- package/lib/core/ws/handleWebSocketEvent.d.mts +1 -1
- package/lib/core/ws/handleWebSocketEvent.d.ts +1 -1
- package/lib/core/ws/handleWebSocketEvent.js.map +1 -1
- package/lib/core/ws/handleWebSocketEvent.mjs.map +1 -1
- package/lib/core/ws.js.map +1 -1
- package/lib/core/ws.mjs.map +1 -1
- package/lib/iife/index.js +6081 -5821
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/lib/native/index.js.map +1 -1
- package/lib/native/index.mjs.map +1 -1
- package/lib/node/index.js.map +1 -1
- package/lib/node/index.mjs.map +1 -1
- package/lib/shims/cookie.js +152 -62
- package/lib/shims/cookie.mjs +152 -62
- package/package.json +34 -41
- package/src/browser/glossary.ts +1 -1
- package/src/browser/setup-worker.ts +2 -2
- package/src/browser/sources/service-worker-source.ts +125 -28
- package/src/browser/utils/deserializeRequest.ts +0 -1
- package/src/browser/utils/should-invalidate-worker.test.ts +122 -0
- package/src/browser/utils/should-invalidate-worker.ts +13 -0
- package/src/browser/utils/workerChannel.ts +43 -21
- package/src/core/experimental/define-network.ts +10 -2
- package/src/core/experimental/frames/http-frame.test.ts +2 -1
- package/src/core/experimental/frames/http-frame.ts +6 -2
- package/src/core/experimental/frames/websocket-frame.test.ts +2 -4
- package/src/core/experimental/frames/websocket-frame.ts +3 -2
- package/src/core/experimental/handlers-controller.ts +1 -1
- package/src/core/experimental/index.ts +1 -1
- package/src/core/experimental/on-unhandled-frame.test.ts +2 -4
- package/src/core/experimental/setup-api.ts +3 -3
- package/src/core/experimental/sources/interceptor-source.ts +2 -6
- package/src/core/experimental/sources/network-source.ts +1 -1
- package/src/core/graphql.ts +8 -8
- package/src/core/handlers/GraphQLHandler.test.ts +3 -4
- package/src/core/handlers/GraphQLHandler.ts +15 -11
- package/src/core/handlers/HttpHandler.test.ts +3 -2
- package/src/core/handlers/HttpHandler.ts +7 -7
- package/src/core/handlers/RequestHandler.ts +5 -5
- package/src/core/http.ts +5 -5
- package/src/core/sse.ts +157 -56
- package/src/core/utils/cookieStore.ts +1 -1
- package/src/core/utils/executeHandlers.ts +2 -4
- package/src/core/utils/handleRequest.test.ts +5 -4
- package/src/core/utils/handleRequest.ts +3 -3
- package/src/core/utils/internal/parseGraphQLRequest.test.ts +2 -4
- package/src/core/utils/internal/parseMultipartData.ts +1 -1
- package/src/core/utils/internal/pipeEvents.ts +2 -1
- package/src/core/utils/internal/requestHandlerUtils.ts +1 -1
- package/src/core/utils/request/onUnhandledRequest.test.ts +2 -4
- package/src/core/ws/WebSocketClientManager.test.ts +2 -4
- package/src/core/ws/WebSocketClientManager.ts +1 -1
- package/src/core/ws/WebSocketIndexedDBClientStore.ts +3 -5
- package/src/core/ws/WebSocketMemoryClientStore.ts +3 -5
- package/src/core/ws/handleWebSocketEvent.ts +3 -3
- package/src/core/ws.ts +1 -1
- package/src/native/index.ts +2 -2
- package/src/node/async-handlers-controller.ts +2 -2
- package/src/node/setup-server-common.ts +4 -4
- package/src/node/setup-server.ts +2 -2
- package/lib/core/{network-frame-usYiHS0K.d.ts → on-unhandled-frame-BBR-P3kV.d.ts} +12 -12
- package/lib/core/{network-frame-B7A0ggXE.d.mts → on-unhandled-frame-Cr1KOZ0I.d.mts} +12 -12
package/lib/browser/index.mjs
CHANGED
|
@@ -534,7 +534,7 @@ var _Emitter = class {
|
|
|
534
534
|
var Emitter = _Emitter;
|
|
535
535
|
Emitter.defaultMaxListeners = 10;
|
|
536
536
|
|
|
537
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
537
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/createRequestId-DQcIlohW.mjs
|
|
538
538
|
var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
|
|
539
539
|
function getGlobalSymbol(symbol) {
|
|
540
540
|
return globalThis[symbol] || void 0;
|
|
@@ -683,7 +683,7 @@ function createRequestId() {
|
|
|
683
683
|
return Math.random().toString(16).slice(2);
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
686
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/resolveWebSocketUrl-C83-x9iE.mjs
|
|
687
687
|
function resolveWebSocketUrl(url) {
|
|
688
688
|
if (typeof url === "string") return resolveWebSocketUrl(new URL(url, typeof location !== "undefined" ? location.href : void 0));
|
|
689
689
|
if (url.protocol === "http:") url.protocol = "ws:";
|
|
@@ -694,7 +694,7 @@ function resolveWebSocketUrl(url) {
|
|
|
694
694
|
return url.href;
|
|
695
695
|
}
|
|
696
696
|
|
|
697
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
697
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/hasConfigurableGlobal-npXitu1-.mjs
|
|
698
698
|
async function emitAsync(emitter, eventName, ...data) {
|
|
699
699
|
const listeners = emitter.listeners(eventName);
|
|
700
700
|
if (listeners.length === 0) return;
|
|
@@ -778,7 +778,7 @@ var DeferredPromise = class extends Promise {
|
|
|
778
778
|
}
|
|
779
779
|
};
|
|
780
780
|
|
|
781
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
781
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/interceptors/WebSocket/index.mjs
|
|
782
782
|
function bindEvent(target, event) {
|
|
783
783
|
Object.defineProperties(event, {
|
|
784
784
|
target: {
|
|
@@ -1311,7 +1311,73 @@ function supportsReadableStreamTransfer() {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
|
1313
1313
|
|
|
1314
|
-
// node_modules/.pnpm/@
|
|
1314
|
+
// node_modules/.pnpm/@open-draft+deferred-promise@3.0.0/node_modules/@open-draft/deferred-promise/build/index.mjs
|
|
1315
|
+
function createDeferredExecutor2() {
|
|
1316
|
+
const executor = ((resolve, reject) => {
|
|
1317
|
+
executor.state = "pending";
|
|
1318
|
+
executor.resolve = (data) => {
|
|
1319
|
+
if (executor.state !== "pending") return;
|
|
1320
|
+
executor.result = data;
|
|
1321
|
+
const onFulfilled = (value) => {
|
|
1322
|
+
executor.state = "fulfilled";
|
|
1323
|
+
return value;
|
|
1324
|
+
};
|
|
1325
|
+
return resolve(data instanceof Promise ? data : Promise.resolve(data).then(onFulfilled));
|
|
1326
|
+
};
|
|
1327
|
+
executor.reject = (reason) => {
|
|
1328
|
+
if (executor.state !== "pending") return;
|
|
1329
|
+
queueMicrotask(() => {
|
|
1330
|
+
executor.state = "rejected";
|
|
1331
|
+
});
|
|
1332
|
+
return reject(executor.rejectionReason = reason);
|
|
1333
|
+
};
|
|
1334
|
+
});
|
|
1335
|
+
return executor;
|
|
1336
|
+
}
|
|
1337
|
+
var DeferredPromise2 = class extends Promise {
|
|
1338
|
+
#executor;
|
|
1339
|
+
resolve;
|
|
1340
|
+
reject;
|
|
1341
|
+
constructor(executor = null) {
|
|
1342
|
+
const deferredExecutor = createDeferredExecutor2();
|
|
1343
|
+
super((originalResolve, originalReject) => {
|
|
1344
|
+
deferredExecutor(originalResolve, originalReject);
|
|
1345
|
+
executor?.(deferredExecutor.resolve, deferredExecutor.reject);
|
|
1346
|
+
});
|
|
1347
|
+
this.#executor = deferredExecutor;
|
|
1348
|
+
this.resolve = this.#executor.resolve;
|
|
1349
|
+
this.reject = this.#executor.reject;
|
|
1350
|
+
}
|
|
1351
|
+
get state() {
|
|
1352
|
+
return this.#executor.state;
|
|
1353
|
+
}
|
|
1354
|
+
get rejectionReason() {
|
|
1355
|
+
return this.#executor.rejectionReason;
|
|
1356
|
+
}
|
|
1357
|
+
then(onFulfilled, onRejected) {
|
|
1358
|
+
return this.#decorate(super.then(onFulfilled, onRejected));
|
|
1359
|
+
}
|
|
1360
|
+
catch(onRejected) {
|
|
1361
|
+
return this.#decorate(super.catch(onRejected));
|
|
1362
|
+
}
|
|
1363
|
+
finally(onfinally) {
|
|
1364
|
+
return this.#decorate(super.finally(onfinally));
|
|
1365
|
+
}
|
|
1366
|
+
#decorate(promise) {
|
|
1367
|
+
return Object.defineProperties(promise, {
|
|
1368
|
+
resolve: {
|
|
1369
|
+
configurable: true,
|
|
1370
|
+
value: this.resolve
|
|
1371
|
+
},
|
|
1372
|
+
reject: {
|
|
1373
|
+
configurable: true,
|
|
1374
|
+
value: this.reject
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/getRawRequest-BTaNLFr0.mjs
|
|
1315
1381
|
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
|
1316
1382
|
var InterceptorError = class InterceptorError2 extends Error {
|
|
1317
1383
|
constructor(message) {
|
|
@@ -1472,7 +1538,7 @@ function setRawRequest(request, rawRequest) {
|
|
|
1472
1538
|
Reflect.set(request, kRawRequest, rawRequest);
|
|
1473
1539
|
}
|
|
1474
1540
|
|
|
1475
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
1541
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/bufferUtils-BiiO6HZv.mjs
|
|
1476
1542
|
var encoder = new TextEncoder();
|
|
1477
1543
|
function encodeBuffer(text) {
|
|
1478
1544
|
return encoder.encode(text);
|
|
@@ -1584,7 +1650,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
1584
1650
|
return registrationResult;
|
|
1585
1651
|
};
|
|
1586
1652
|
|
|
1587
|
-
// node_modules/.pnpm/rettime@0.
|
|
1653
|
+
// node_modules/.pnpm/rettime@0.11.7/node_modules/rettime/build/lens-list.mjs
|
|
1588
1654
|
var LensList = class {
|
|
1589
1655
|
#list;
|
|
1590
1656
|
#lens;
|
|
@@ -1630,7 +1696,11 @@ var LensList = class {
|
|
|
1630
1696
|
delete(key, value) {
|
|
1631
1697
|
if (this.size === 0) return;
|
|
1632
1698
|
this.#list = this.#list.filter((item) => item[1] !== value);
|
|
1633
|
-
|
|
1699
|
+
const values = this.#lens.get(key);
|
|
1700
|
+
if (values) {
|
|
1701
|
+
const index = values.indexOf(value);
|
|
1702
|
+
if (index !== -1) values.splice(index, 1);
|
|
1703
|
+
}
|
|
1634
1704
|
}
|
|
1635
1705
|
/**
|
|
1636
1706
|
* Delete all values belogning to the given key.
|
|
@@ -1653,7 +1723,7 @@ var LensList = class {
|
|
|
1653
1723
|
}
|
|
1654
1724
|
};
|
|
1655
1725
|
|
|
1656
|
-
// node_modules/.pnpm/rettime@0.
|
|
1726
|
+
// node_modules/.pnpm/rettime@0.11.7/node_modules/rettime/build/index.mjs
|
|
1657
1727
|
var kDefaultPrevented2 = Symbol("kDefaultPrevented");
|
|
1658
1728
|
var kPropagationStopped = Symbol("kPropagationStopped");
|
|
1659
1729
|
var kImmediatePropagationStopped = Symbol("kImmediatePropagationStopped");
|
|
@@ -1683,11 +1753,39 @@ var TypedEvent = class extends MessageEvent {
|
|
|
1683
1753
|
this[kImmediatePropagationStopped] = true;
|
|
1684
1754
|
}
|
|
1685
1755
|
};
|
|
1686
|
-
var kListenerOptions = Symbol("kListenerOptions");
|
|
1687
1756
|
var Emitter2 = class {
|
|
1688
1757
|
#listeners;
|
|
1758
|
+
#listenerOptions;
|
|
1759
|
+
#typelessListeners;
|
|
1760
|
+
#hookListeners;
|
|
1761
|
+
#hookListenerOptions;
|
|
1762
|
+
hooks;
|
|
1689
1763
|
constructor() {
|
|
1690
1764
|
this.#listeners = new LensList();
|
|
1765
|
+
this.#listenerOptions = /* @__PURE__ */ new WeakMap();
|
|
1766
|
+
this.#typelessListeners = /* @__PURE__ */ new WeakSet();
|
|
1767
|
+
this.#hookListeners = new LensList();
|
|
1768
|
+
this.#hookListenerOptions = /* @__PURE__ */ new WeakMap();
|
|
1769
|
+
this.hooks = {
|
|
1770
|
+
on: (hook, callback, options) => {
|
|
1771
|
+
if (options?.once) {
|
|
1772
|
+
const original = callback;
|
|
1773
|
+
const wrapper = ((...args) => {
|
|
1774
|
+
this.#hookListeners.delete(hook, wrapper);
|
|
1775
|
+
return original(...args);
|
|
1776
|
+
});
|
|
1777
|
+
callback = wrapper;
|
|
1778
|
+
}
|
|
1779
|
+
this.#hookListeners.append(hook, callback);
|
|
1780
|
+
if (options) this.#hookListenerOptions.set(callback, options);
|
|
1781
|
+
if (options?.signal) options.signal.addEventListener("abort", () => {
|
|
1782
|
+
this.#hookListeners.delete(hook, callback);
|
|
1783
|
+
}, { once: true });
|
|
1784
|
+
},
|
|
1785
|
+
removeListener: (hook, callback) => {
|
|
1786
|
+
this.#hookListeners.delete(hook, callback);
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1691
1789
|
}
|
|
1692
1790
|
/**
|
|
1693
1791
|
* Adds a listener for the given event type.
|
|
@@ -1789,7 +1887,9 @@ var Emitter2 = class {
|
|
|
1789
1887
|
* Removes a listener for the given event type.
|
|
1790
1888
|
*/
|
|
1791
1889
|
removeListener(type, listener) {
|
|
1890
|
+
const options = this.#listenerOptions.get(listener);
|
|
1792
1891
|
this.#listeners.delete(type, listener);
|
|
1892
|
+
for (const hook of this.#hookListeners.get("removeListener")) hook(type, listener, options);
|
|
1793
1893
|
}
|
|
1794
1894
|
/**
|
|
1795
1895
|
* Removes all listeners for the given event type.
|
|
@@ -1798,6 +1898,7 @@ var Emitter2 = class {
|
|
|
1798
1898
|
removeAllListeners(type) {
|
|
1799
1899
|
if (type == null) {
|
|
1800
1900
|
this.#listeners.clear();
|
|
1901
|
+
for (const [hookType, hookListener] of this.#hookListeners) if (!this.#hookListenerOptions.get(hookListener)?.persist) this.#hookListeners.delete(hookType, hookListener);
|
|
1801
1902
|
return;
|
|
1802
1903
|
}
|
|
1803
1904
|
this.#listeners.deleteAll(type);
|
|
@@ -1819,14 +1920,12 @@ var Emitter2 = class {
|
|
|
1819
1920
|
return this.listeners(type).length;
|
|
1820
1921
|
}
|
|
1821
1922
|
#addListener(type, listener, options, insertMode = "append") {
|
|
1923
|
+
for (const hook of this.#hookListeners.get("newListener")) hook(type, listener, options);
|
|
1924
|
+
if (type === "*") this.#typelessListeners.add(listener);
|
|
1822
1925
|
if (insertMode === "prepend") this.#listeners.prepend(type, listener);
|
|
1823
1926
|
else this.#listeners.append(type, listener);
|
|
1824
1927
|
if (options) {
|
|
1825
|
-
|
|
1826
|
-
value: options,
|
|
1827
|
-
enumerable: false,
|
|
1828
|
-
writable: false
|
|
1829
|
-
});
|
|
1928
|
+
this.#listenerOptions.set(listener, options);
|
|
1830
1929
|
if (options.signal) options.signal.addEventListener("abort", () => {
|
|
1831
1930
|
this.removeListener(type, listener);
|
|
1832
1931
|
}, { once: true });
|
|
@@ -1834,10 +1933,10 @@ var Emitter2 = class {
|
|
|
1834
1933
|
}
|
|
1835
1934
|
#proxyEvent(event) {
|
|
1836
1935
|
const { stopPropagation } = event;
|
|
1837
|
-
event.stopPropagation =
|
|
1936
|
+
event.stopPropagation = () => {
|
|
1838
1937
|
event[kPropagationStopped] = this;
|
|
1839
|
-
|
|
1840
|
-
}
|
|
1938
|
+
stopPropagation.call(event);
|
|
1939
|
+
};
|
|
1841
1940
|
return {
|
|
1842
1941
|
event,
|
|
1843
1942
|
revoke() {
|
|
@@ -1846,10 +1945,13 @@ var Emitter2 = class {
|
|
|
1846
1945
|
};
|
|
1847
1946
|
}
|
|
1848
1947
|
#callListener(event, listener) {
|
|
1948
|
+
for (const hook of this.#hookListeners.get("beforeEmit")) if (hook(event) === false) return;
|
|
1849
1949
|
const returnValue = listener.call(this, event);
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
this.#
|
|
1950
|
+
const options = this.#listenerOptions.get(listener);
|
|
1951
|
+
if (options?.once) {
|
|
1952
|
+
const type = this.#isTypelessListener(listener) ? "*" : event.type;
|
|
1953
|
+
this.#listeners.delete(type, listener);
|
|
1954
|
+
for (const hook of this.#hookListeners.get("removeListener")) hook(type, listener, options);
|
|
1853
1955
|
}
|
|
1854
1956
|
return returnValue;
|
|
1855
1957
|
}
|
|
@@ -1861,7 +1963,7 @@ var Emitter2 = class {
|
|
|
1861
1963
|
for (const [key, listener] of this.#listeners) if (key === "*" || key === type) yield listener;
|
|
1862
1964
|
}
|
|
1863
1965
|
#isTypelessListener(listener) {
|
|
1864
|
-
return this.#
|
|
1966
|
+
return this.#typelessListeners.has(listener);
|
|
1865
1967
|
}
|
|
1866
1968
|
};
|
|
1867
1969
|
|
|
@@ -1894,21 +1996,31 @@ var WorkerEvent = class extends TypedEvent {
|
|
|
1894
1996
|
}
|
|
1895
1997
|
};
|
|
1896
1998
|
var WorkerChannel = class extends Emitter2 {
|
|
1999
|
+
#getWorker;
|
|
2000
|
+
#controller;
|
|
1897
2001
|
constructor(options) {
|
|
1898
2002
|
super();
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2003
|
+
invariant(
|
|
2004
|
+
SUPPORTS_SERVICE_WORKER,
|
|
2005
|
+
"Failed to open a WorkerChannel: Service Worker is not supported in this environment."
|
|
2006
|
+
);
|
|
2007
|
+
this.#getWorker = options.getWorker;
|
|
2008
|
+
this.#controller = new AbortController();
|
|
2009
|
+
navigator.serviceWorker.addEventListener(
|
|
2010
|
+
"message",
|
|
2011
|
+
async (event) => {
|
|
2012
|
+
const worker = await this.#getWorker();
|
|
2013
|
+
if (event.source != null && event.source !== worker) {
|
|
2014
|
+
return;
|
|
2015
|
+
}
|
|
2016
|
+
if (event.data && isObject(event.data) && "type" in event.data) {
|
|
2017
|
+
this.emit(new WorkerEvent(event));
|
|
2018
|
+
}
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
signal: this.#controller.signal
|
|
1910
2022
|
}
|
|
1911
|
-
|
|
2023
|
+
);
|
|
1912
2024
|
}
|
|
1913
2025
|
/**
|
|
1914
2026
|
* Send data to the Service Worker controlling this client.
|
|
@@ -1917,12 +2029,20 @@ var WorkerChannel = class extends Emitter2 {
|
|
|
1917
2029
|
postMessage(type) {
|
|
1918
2030
|
invariant(
|
|
1919
2031
|
SUPPORTS_SERVICE_WORKER,
|
|
1920
|
-
"Failed to post message on a WorkerChannel: the Service Worker API is unavailable in this
|
|
2032
|
+
"Failed to post message on a WorkerChannel: the Service Worker API is unavailable in this environment. This is likely an issue with MSW. Please report it on GitHub: https://github.com/mswjs/msw/issues"
|
|
1921
2033
|
);
|
|
1922
|
-
this.
|
|
2034
|
+
this.#getWorker().then((worker) => {
|
|
1923
2035
|
worker.postMessage(type);
|
|
1924
2036
|
});
|
|
1925
2037
|
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Terminal teardown. Removes the `navigator.serviceWorker` message listener
|
|
2040
|
+
* and all emitter subscriptions. The channel is not usable afterwards.
|
|
2041
|
+
*/
|
|
2042
|
+
terminate() {
|
|
2043
|
+
this.#controller.abort();
|
|
2044
|
+
this.removeAllListeners();
|
|
2045
|
+
}
|
|
1926
2046
|
};
|
|
1927
2047
|
|
|
1928
2048
|
// src/browser/utils/pruneGetRequestBody.ts
|
|
@@ -1954,40 +2074,63 @@ function validateWorkerScope(registration) {
|
|
|
1954
2074
|
}
|
|
1955
2075
|
}
|
|
1956
2076
|
|
|
2077
|
+
// src/browser/utils/should-invalidate-worker.ts
|
|
2078
|
+
function shouldInvalidateWorker(prevOptions, nextOptions) {
|
|
2079
|
+
return prevOptions.findWorker !== nextOptions.findWorker || prevOptions.serviceWorker.url !== nextOptions.serviceWorker.url || JSON.stringify(prevOptions.serviceWorker.options) !== JSON.stringify(nextOptions.serviceWorker.options);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
1957
2082
|
// src/browser/sources/service-worker-source.ts
|
|
1958
|
-
var ServiceWorkerSource = class extends NetworkSource {
|
|
2083
|
+
var ServiceWorkerSource = class _ServiceWorkerSource extends NetworkSource {
|
|
2084
|
+
static #current;
|
|
2085
|
+
/**
|
|
2086
|
+
* Create a new Service Worker source or reuse an existing one.
|
|
2087
|
+
* These sources act as a singleton and only get recreated if the options change.
|
|
2088
|
+
*/
|
|
2089
|
+
static async from(options) {
|
|
2090
|
+
if (_ServiceWorkerSource.#current == null) {
|
|
2091
|
+
_ServiceWorkerSource.#current = new _ServiceWorkerSource(options);
|
|
2092
|
+
} else if (shouldInvalidateWorker(_ServiceWorkerSource.#current.#options, options)) {
|
|
2093
|
+
await _ServiceWorkerSource.#current.terminate();
|
|
2094
|
+
_ServiceWorkerSource.#current = new _ServiceWorkerSource(options);
|
|
2095
|
+
}
|
|
2096
|
+
return _ServiceWorkerSource.#current;
|
|
2097
|
+
}
|
|
2098
|
+
#options;
|
|
2099
|
+
#frames;
|
|
2100
|
+
#channel;
|
|
2101
|
+
#listenerController;
|
|
2102
|
+
#clientPromise;
|
|
2103
|
+
#keepAliveInterval;
|
|
2104
|
+
#stoppedAt;
|
|
2105
|
+
workerPromise;
|
|
1959
2106
|
constructor(options) {
|
|
1960
2107
|
super();
|
|
1961
|
-
this.options = options;
|
|
1962
2108
|
invariant(
|
|
1963
2109
|
supportsServiceWorker(),
|
|
1964
2110
|
"Failed to use Service Worker as the network source: the Service Worker API is not supported in this environment"
|
|
1965
2111
|
);
|
|
2112
|
+
this.#options = options;
|
|
1966
2113
|
this.#frames = /* @__PURE__ */ new Map();
|
|
1967
|
-
this.workerPromise = new
|
|
2114
|
+
this.workerPromise = new DeferredPromise2();
|
|
1968
2115
|
this.#channel = new WorkerChannel({
|
|
1969
|
-
|
|
2116
|
+
getWorker: () => this.workerPromise.then(([worker]) => worker)
|
|
1970
2117
|
});
|
|
1971
2118
|
}
|
|
1972
|
-
#frames;
|
|
1973
|
-
#channel;
|
|
1974
|
-
#clientPromise;
|
|
1975
|
-
#keepAliveInterval;
|
|
1976
|
-
#stoppedAt;
|
|
1977
|
-
workerPromise;
|
|
1978
2119
|
async enable() {
|
|
1979
|
-
this.#stoppedAt
|
|
1980
|
-
if (this.workerPromise.state !== "pending") {
|
|
2120
|
+
if (this.workerPromise.state === "fulfilled" && typeof this.#stoppedAt == "undefined") {
|
|
1981
2121
|
devUtils3.warn(
|
|
1982
2122
|
'Found a redundant "worker.start()" call. Note that starting the worker while mocking is already enabled will have no effect. Consider removing this "worker.start()" call.'
|
|
1983
2123
|
);
|
|
1984
2124
|
return this.workerPromise.then(([, registration2]) => registration2);
|
|
1985
2125
|
}
|
|
2126
|
+
this.#stoppedAt = void 0;
|
|
1986
2127
|
this.#channel.removeAllListeners();
|
|
2128
|
+
this.#frames.clear();
|
|
2129
|
+
this.#listenerController = new AbortController();
|
|
1987
2130
|
const [worker, registration] = await this.#startWorker();
|
|
1988
2131
|
if (worker.state !== "activated") {
|
|
1989
2132
|
const controller = new AbortController();
|
|
1990
|
-
const activationPromise = new
|
|
2133
|
+
const activationPromise = new DeferredPromise2();
|
|
1991
2134
|
activationPromise.then(() => controller.abort());
|
|
1992
2135
|
worker.addEventListener(
|
|
1993
2136
|
"statechange",
|
|
@@ -1996,18 +2139,20 @@ var ServiceWorkerSource = class extends NetworkSource {
|
|
|
1996
2139
|
activationPromise.resolve();
|
|
1997
2140
|
}
|
|
1998
2141
|
},
|
|
1999
|
-
{
|
|
2142
|
+
{
|
|
2143
|
+
signal: controller.signal
|
|
2144
|
+
}
|
|
2000
2145
|
);
|
|
2001
2146
|
await activationPromise;
|
|
2002
2147
|
}
|
|
2003
2148
|
this.#channel.postMessage("MOCK_ACTIVATE");
|
|
2004
|
-
const clientConfirmationPromise = new
|
|
2149
|
+
const clientConfirmationPromise = new DeferredPromise2();
|
|
2005
2150
|
this.#clientPromise = clientConfirmationPromise;
|
|
2006
2151
|
this.#channel.once("MOCKING_ENABLED", (event) => {
|
|
2007
2152
|
clientConfirmationPromise.resolve(event.data.client);
|
|
2008
2153
|
});
|
|
2009
2154
|
await clientConfirmationPromise;
|
|
2010
|
-
if (!this
|
|
2155
|
+
if (!this.#options.quiet) {
|
|
2011
2156
|
this.#printStartMessage();
|
|
2012
2157
|
}
|
|
2013
2158
|
return registration;
|
|
@@ -2020,24 +2165,47 @@ var ServiceWorkerSource = class extends NetworkSource {
|
|
|
2020
2165
|
return;
|
|
2021
2166
|
}
|
|
2022
2167
|
this.#stoppedAt = Date.now();
|
|
2023
|
-
this.#
|
|
2024
|
-
this
|
|
2025
|
-
|
|
2168
|
+
this.#listenerController?.abort();
|
|
2169
|
+
this.#listenerController = void 0;
|
|
2170
|
+
this.#channel.postMessage("CLIENT_CLOSED");
|
|
2171
|
+
if (!this.#options.quiet) {
|
|
2026
2172
|
this.#printStopMessage();
|
|
2027
2173
|
}
|
|
2028
2174
|
}
|
|
2175
|
+
/**
|
|
2176
|
+
* Terminal teardown. Unregisters the Service Worker, tears down the channel,
|
|
2177
|
+
* and clears timers. Called when the singleton is being replaced with one
|
|
2178
|
+
* that has different options. The instance is not usable afterwards.
|
|
2179
|
+
*/
|
|
2180
|
+
async terminate() {
|
|
2181
|
+
if (this.#keepAliveInterval != null) {
|
|
2182
|
+
clearInterval(this.#keepAliveInterval);
|
|
2183
|
+
this.#keepAliveInterval = void 0;
|
|
2184
|
+
}
|
|
2185
|
+
this.#frames.clear();
|
|
2186
|
+
this.#channel.terminate();
|
|
2187
|
+
this.#listenerController?.abort();
|
|
2188
|
+
this.#listenerController = void 0;
|
|
2189
|
+
if (this.workerPromise.state === "fulfilled") {
|
|
2190
|
+
const [, registration] = await this.workerPromise;
|
|
2191
|
+
await registration.unregister();
|
|
2192
|
+
}
|
|
2193
|
+
if (_ServiceWorkerSource.#current === this) {
|
|
2194
|
+
_ServiceWorkerSource.#current = void 0;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2029
2197
|
async #startWorker() {
|
|
2030
2198
|
if (this.#keepAliveInterval) {
|
|
2031
2199
|
clearInterval(this.#keepAliveInterval);
|
|
2032
2200
|
}
|
|
2033
|
-
const workerUrl = this
|
|
2201
|
+
const workerUrl = this.#options.serviceWorker.url;
|
|
2034
2202
|
const [worker, registration] = await getWorkerInstance(
|
|
2035
2203
|
workerUrl,
|
|
2036
|
-
this
|
|
2037
|
-
this
|
|
2204
|
+
this.#options.serviceWorker.options,
|
|
2205
|
+
this.#options.findWorker || this.#defaultFindWorker
|
|
2038
2206
|
);
|
|
2039
2207
|
if (worker == null) {
|
|
2040
|
-
const missingWorkerMessage = this
|
|
2208
|
+
const missingWorkerMessage = this.#options?.findWorker ? devUtils3.formatMessage(
|
|
2041
2209
|
`Failed to locate the Service Worker registration using a custom "findWorker" predicate.
|
|
2042
2210
|
|
|
2043
2211
|
Please ensure that the custom predicate properly locates the Service Worker registration at "%s".
|
|
@@ -2055,16 +2223,28 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
2055
2223
|
);
|
|
2056
2224
|
throw new Error(missingWorkerMessage);
|
|
2057
2225
|
}
|
|
2058
|
-
this.workerPromise.
|
|
2226
|
+
if (this.workerPromise.state === "pending") {
|
|
2227
|
+
this.workerPromise.resolve([worker, registration]);
|
|
2228
|
+
} else {
|
|
2229
|
+
this.workerPromise = new DeferredPromise2((resolve) => {
|
|
2230
|
+
resolve([worker, registration]);
|
|
2231
|
+
});
|
|
2232
|
+
}
|
|
2059
2233
|
this.#channel.on("REQUEST", this.#handleRequest.bind(this));
|
|
2060
2234
|
this.#channel.on("RESPONSE", this.#handleResponse.bind(this));
|
|
2061
|
-
window.addEventListener(
|
|
2062
|
-
|
|
2063
|
-
|
|
2235
|
+
window.addEventListener(
|
|
2236
|
+
"beforeunload",
|
|
2237
|
+
() => {
|
|
2238
|
+
if (worker.state !== "redundant") {
|
|
2239
|
+
this.#channel.postMessage("CLIENT_CLOSED");
|
|
2240
|
+
}
|
|
2241
|
+
clearInterval(this.#keepAliveInterval);
|
|
2242
|
+
window.postMessage({ type: "msw/worker:stop" });
|
|
2243
|
+
},
|
|
2244
|
+
{
|
|
2245
|
+
signal: this.#listenerController?.signal
|
|
2064
2246
|
}
|
|
2065
|
-
|
|
2066
|
-
window.postMessage({ type: "msw/worker:stop" });
|
|
2067
|
-
});
|
|
2247
|
+
);
|
|
2068
2248
|
await this.#checkWorkerIntegrity().catch((error2) => {
|
|
2069
2249
|
devUtils3.error(
|
|
2070
2250
|
"Error while checking the worker script integrity. Please report this on GitHub (https://github.com/mswjs/msw/issues) and include the original error below."
|
|
@@ -2074,7 +2254,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
2074
2254
|
this.#keepAliveInterval = window.setInterval(() => {
|
|
2075
2255
|
this.#channel.postMessage("KEEPALIVE_REQUEST");
|
|
2076
2256
|
}, 5e3);
|
|
2077
|
-
if (!this
|
|
2257
|
+
if (!this.#options.quiet) {
|
|
2078
2258
|
validateWorkerScope(registration);
|
|
2079
2259
|
}
|
|
2080
2260
|
return [worker, registration];
|
|
@@ -2138,7 +2318,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
2138
2318
|
return workerUrl === mockServiceWorkerUrl;
|
|
2139
2319
|
};
|
|
2140
2320
|
async #checkWorkerIntegrity() {
|
|
2141
|
-
const integrityCheckPromise = new
|
|
2321
|
+
const integrityCheckPromise = new DeferredPromise2();
|
|
2142
2322
|
this.#channel.postMessage("INTEGRITY_CHECK_REQUEST");
|
|
2143
2323
|
this.#channel.once("INTEGRITY_CHECK_RESPONSE", (event) => {
|
|
2144
2324
|
const { checksum, packageVersion } = event.data;
|
|
@@ -2262,7 +2442,7 @@ var until2 = async (promise) => {
|
|
|
2262
2442
|
}
|
|
2263
2443
|
};
|
|
2264
2444
|
|
|
2265
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
2445
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/handleRequest-D7kpTI5U.mjs
|
|
2266
2446
|
function isObject2(value, loose = false) {
|
|
2267
2447
|
return loose ? Object.prototype.toString.call(value).startsWith("[object ") : Object.prototype.toString.call(value) === "[object Object]";
|
|
2268
2448
|
}
|
|
@@ -2379,7 +2559,7 @@ async function handleRequest(options) {
|
|
|
2379
2559
|
return options.controller.handled;
|
|
2380
2560
|
}
|
|
2381
2561
|
|
|
2382
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
2562
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/fetch-DdKEdDOR.mjs
|
|
2383
2563
|
function createNetworkError(cause) {
|
|
2384
2564
|
return Object.assign(/* @__PURE__ */ new TypeError("Failed to fetch"), { cause });
|
|
2385
2565
|
}
|
|
@@ -2572,7 +2752,7 @@ var FetchInterceptor = class FetchInterceptor2 extends Interceptor {
|
|
|
2572
2752
|
}
|
|
2573
2753
|
};
|
|
2574
2754
|
|
|
2575
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
2755
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/XMLHttpRequest-BvxZV0WU.mjs
|
|
2576
2756
|
function concatArrayBuffer(left, right) {
|
|
2577
2757
|
const result = new Uint8Array(left.byteLength + right.byteLength);
|
|
2578
2758
|
result.set(left, 0);
|
|
@@ -3263,7 +3443,7 @@ function setupWorker(...handlers) {
|
|
|
3263
3443
|
);
|
|
3264
3444
|
return;
|
|
3265
3445
|
}
|
|
3266
|
-
const httpSource = supportsServiceWorker() ?
|
|
3446
|
+
const httpSource = supportsServiceWorker() ? await ServiceWorkerSource.from({
|
|
3267
3447
|
serviceWorker: {
|
|
3268
3448
|
url: options?.serviceWorker?.url?.toString() || DEFAULT_WORKER_URL,
|
|
3269
3449
|
options: options?.serviceWorker?.options
|