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/cli/init.js
CHANGED
package/lib/browser/index.js
CHANGED
|
@@ -561,7 +561,7 @@ var _Emitter = class {
|
|
|
561
561
|
var Emitter = _Emitter;
|
|
562
562
|
Emitter.defaultMaxListeners = 10;
|
|
563
563
|
|
|
564
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
564
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/createRequestId-DQcIlohW.mjs
|
|
565
565
|
var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
|
|
566
566
|
function getGlobalSymbol(symbol) {
|
|
567
567
|
return globalThis[symbol] || void 0;
|
|
@@ -710,7 +710,7 @@ function createRequestId() {
|
|
|
710
710
|
return Math.random().toString(16).slice(2);
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
713
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/resolveWebSocketUrl-C83-x9iE.mjs
|
|
714
714
|
function resolveWebSocketUrl(url) {
|
|
715
715
|
if (typeof url === "string") return resolveWebSocketUrl(new URL(url, typeof location !== "undefined" ? location.href : void 0));
|
|
716
716
|
if (url.protocol === "http:") url.protocol = "ws:";
|
|
@@ -721,7 +721,7 @@ function resolveWebSocketUrl(url) {
|
|
|
721
721
|
return url.href;
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
724
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/hasConfigurableGlobal-npXitu1-.mjs
|
|
725
725
|
async function emitAsync(emitter, eventName, ...data) {
|
|
726
726
|
const listeners = emitter.listeners(eventName);
|
|
727
727
|
if (listeners.length === 0) return;
|
|
@@ -805,7 +805,7 @@ var DeferredPromise = class extends Promise {
|
|
|
805
805
|
}
|
|
806
806
|
};
|
|
807
807
|
|
|
808
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
808
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/interceptors/WebSocket/index.mjs
|
|
809
809
|
function bindEvent(target, event) {
|
|
810
810
|
Object.defineProperties(event, {
|
|
811
811
|
target: {
|
|
@@ -1335,7 +1335,73 @@ function supportsReadableStreamTransfer() {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
1337
|
|
|
1338
|
-
// node_modules/.pnpm/@
|
|
1338
|
+
// node_modules/.pnpm/@open-draft+deferred-promise@3.0.0/node_modules/@open-draft/deferred-promise/build/index.mjs
|
|
1339
|
+
function createDeferredExecutor2() {
|
|
1340
|
+
const executor = ((resolve, reject) => {
|
|
1341
|
+
executor.state = "pending";
|
|
1342
|
+
executor.resolve = (data) => {
|
|
1343
|
+
if (executor.state !== "pending") return;
|
|
1344
|
+
executor.result = data;
|
|
1345
|
+
const onFulfilled = (value) => {
|
|
1346
|
+
executor.state = "fulfilled";
|
|
1347
|
+
return value;
|
|
1348
|
+
};
|
|
1349
|
+
return resolve(data instanceof Promise ? data : Promise.resolve(data).then(onFulfilled));
|
|
1350
|
+
};
|
|
1351
|
+
executor.reject = (reason) => {
|
|
1352
|
+
if (executor.state !== "pending") return;
|
|
1353
|
+
queueMicrotask(() => {
|
|
1354
|
+
executor.state = "rejected";
|
|
1355
|
+
});
|
|
1356
|
+
return reject(executor.rejectionReason = reason);
|
|
1357
|
+
};
|
|
1358
|
+
});
|
|
1359
|
+
return executor;
|
|
1360
|
+
}
|
|
1361
|
+
var DeferredPromise2 = class extends Promise {
|
|
1362
|
+
#executor;
|
|
1363
|
+
resolve;
|
|
1364
|
+
reject;
|
|
1365
|
+
constructor(executor = null) {
|
|
1366
|
+
const deferredExecutor = createDeferredExecutor2();
|
|
1367
|
+
super((originalResolve, originalReject) => {
|
|
1368
|
+
deferredExecutor(originalResolve, originalReject);
|
|
1369
|
+
executor?.(deferredExecutor.resolve, deferredExecutor.reject);
|
|
1370
|
+
});
|
|
1371
|
+
this.#executor = deferredExecutor;
|
|
1372
|
+
this.resolve = this.#executor.resolve;
|
|
1373
|
+
this.reject = this.#executor.reject;
|
|
1374
|
+
}
|
|
1375
|
+
get state() {
|
|
1376
|
+
return this.#executor.state;
|
|
1377
|
+
}
|
|
1378
|
+
get rejectionReason() {
|
|
1379
|
+
return this.#executor.rejectionReason;
|
|
1380
|
+
}
|
|
1381
|
+
then(onFulfilled, onRejected) {
|
|
1382
|
+
return this.#decorate(super.then(onFulfilled, onRejected));
|
|
1383
|
+
}
|
|
1384
|
+
catch(onRejected) {
|
|
1385
|
+
return this.#decorate(super.catch(onRejected));
|
|
1386
|
+
}
|
|
1387
|
+
finally(onfinally) {
|
|
1388
|
+
return this.#decorate(super.finally(onfinally));
|
|
1389
|
+
}
|
|
1390
|
+
#decorate(promise) {
|
|
1391
|
+
return Object.defineProperties(promise, {
|
|
1392
|
+
resolve: {
|
|
1393
|
+
configurable: true,
|
|
1394
|
+
value: this.resolve
|
|
1395
|
+
},
|
|
1396
|
+
reject: {
|
|
1397
|
+
configurable: true,
|
|
1398
|
+
value: this.reject
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/getRawRequest-BTaNLFr0.mjs
|
|
1339
1405
|
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
|
1340
1406
|
var InterceptorError = class InterceptorError2 extends Error {
|
|
1341
1407
|
constructor(message) {
|
|
@@ -1496,7 +1562,7 @@ function setRawRequest(request, rawRequest) {
|
|
|
1496
1562
|
Reflect.set(request, kRawRequest, rawRequest);
|
|
1497
1563
|
}
|
|
1498
1564
|
|
|
1499
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
1565
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/bufferUtils-BiiO6HZv.mjs
|
|
1500
1566
|
var encoder = new TextEncoder();
|
|
1501
1567
|
function encodeBuffer(text) {
|
|
1502
1568
|
return encoder.encode(text);
|
|
@@ -1605,7 +1671,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
1605
1671
|
return registrationResult;
|
|
1606
1672
|
};
|
|
1607
1673
|
|
|
1608
|
-
// node_modules/.pnpm/rettime@0.
|
|
1674
|
+
// node_modules/.pnpm/rettime@0.11.7/node_modules/rettime/build/lens-list.mjs
|
|
1609
1675
|
var LensList = class {
|
|
1610
1676
|
#list;
|
|
1611
1677
|
#lens;
|
|
@@ -1651,7 +1717,11 @@ var LensList = class {
|
|
|
1651
1717
|
delete(key, value) {
|
|
1652
1718
|
if (this.size === 0) return;
|
|
1653
1719
|
this.#list = this.#list.filter((item) => item[1] !== value);
|
|
1654
|
-
|
|
1720
|
+
const values = this.#lens.get(key);
|
|
1721
|
+
if (values) {
|
|
1722
|
+
const index = values.indexOf(value);
|
|
1723
|
+
if (index !== -1) values.splice(index, 1);
|
|
1724
|
+
}
|
|
1655
1725
|
}
|
|
1656
1726
|
/**
|
|
1657
1727
|
* Delete all values belogning to the given key.
|
|
@@ -1674,7 +1744,7 @@ var LensList = class {
|
|
|
1674
1744
|
}
|
|
1675
1745
|
};
|
|
1676
1746
|
|
|
1677
|
-
// node_modules/.pnpm/rettime@0.
|
|
1747
|
+
// node_modules/.pnpm/rettime@0.11.7/node_modules/rettime/build/index.mjs
|
|
1678
1748
|
var kDefaultPrevented2 = Symbol("kDefaultPrevented");
|
|
1679
1749
|
var kPropagationStopped = Symbol("kPropagationStopped");
|
|
1680
1750
|
var kImmediatePropagationStopped = Symbol("kImmediatePropagationStopped");
|
|
@@ -1704,11 +1774,39 @@ var TypedEvent = class extends MessageEvent {
|
|
|
1704
1774
|
this[kImmediatePropagationStopped] = true;
|
|
1705
1775
|
}
|
|
1706
1776
|
};
|
|
1707
|
-
var kListenerOptions = Symbol("kListenerOptions");
|
|
1708
1777
|
var Emitter2 = class {
|
|
1709
1778
|
#listeners;
|
|
1779
|
+
#listenerOptions;
|
|
1780
|
+
#typelessListeners;
|
|
1781
|
+
#hookListeners;
|
|
1782
|
+
#hookListenerOptions;
|
|
1783
|
+
hooks;
|
|
1710
1784
|
constructor() {
|
|
1711
1785
|
this.#listeners = new LensList();
|
|
1786
|
+
this.#listenerOptions = /* @__PURE__ */ new WeakMap();
|
|
1787
|
+
this.#typelessListeners = /* @__PURE__ */ new WeakSet();
|
|
1788
|
+
this.#hookListeners = new LensList();
|
|
1789
|
+
this.#hookListenerOptions = /* @__PURE__ */ new WeakMap();
|
|
1790
|
+
this.hooks = {
|
|
1791
|
+
on: (hook, callback, options) => {
|
|
1792
|
+
if (options?.once) {
|
|
1793
|
+
const original = callback;
|
|
1794
|
+
const wrapper = ((...args) => {
|
|
1795
|
+
this.#hookListeners.delete(hook, wrapper);
|
|
1796
|
+
return original(...args);
|
|
1797
|
+
});
|
|
1798
|
+
callback = wrapper;
|
|
1799
|
+
}
|
|
1800
|
+
this.#hookListeners.append(hook, callback);
|
|
1801
|
+
if (options) this.#hookListenerOptions.set(callback, options);
|
|
1802
|
+
if (options?.signal) options.signal.addEventListener("abort", () => {
|
|
1803
|
+
this.#hookListeners.delete(hook, callback);
|
|
1804
|
+
}, { once: true });
|
|
1805
|
+
},
|
|
1806
|
+
removeListener: (hook, callback) => {
|
|
1807
|
+
this.#hookListeners.delete(hook, callback);
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1712
1810
|
}
|
|
1713
1811
|
/**
|
|
1714
1812
|
* Adds a listener for the given event type.
|
|
@@ -1810,7 +1908,9 @@ var Emitter2 = class {
|
|
|
1810
1908
|
* Removes a listener for the given event type.
|
|
1811
1909
|
*/
|
|
1812
1910
|
removeListener(type, listener) {
|
|
1911
|
+
const options = this.#listenerOptions.get(listener);
|
|
1813
1912
|
this.#listeners.delete(type, listener);
|
|
1913
|
+
for (const hook of this.#hookListeners.get("removeListener")) hook(type, listener, options);
|
|
1814
1914
|
}
|
|
1815
1915
|
/**
|
|
1816
1916
|
* Removes all listeners for the given event type.
|
|
@@ -1819,6 +1919,7 @@ var Emitter2 = class {
|
|
|
1819
1919
|
removeAllListeners(type) {
|
|
1820
1920
|
if (type == null) {
|
|
1821
1921
|
this.#listeners.clear();
|
|
1922
|
+
for (const [hookType, hookListener] of this.#hookListeners) if (!this.#hookListenerOptions.get(hookListener)?.persist) this.#hookListeners.delete(hookType, hookListener);
|
|
1822
1923
|
return;
|
|
1823
1924
|
}
|
|
1824
1925
|
this.#listeners.deleteAll(type);
|
|
@@ -1840,14 +1941,12 @@ var Emitter2 = class {
|
|
|
1840
1941
|
return this.listeners(type).length;
|
|
1841
1942
|
}
|
|
1842
1943
|
#addListener(type, listener, options, insertMode = "append") {
|
|
1944
|
+
for (const hook of this.#hookListeners.get("newListener")) hook(type, listener, options);
|
|
1945
|
+
if (type === "*") this.#typelessListeners.add(listener);
|
|
1843
1946
|
if (insertMode === "prepend") this.#listeners.prepend(type, listener);
|
|
1844
1947
|
else this.#listeners.append(type, listener);
|
|
1845
1948
|
if (options) {
|
|
1846
|
-
|
|
1847
|
-
value: options,
|
|
1848
|
-
enumerable: false,
|
|
1849
|
-
writable: false
|
|
1850
|
-
});
|
|
1949
|
+
this.#listenerOptions.set(listener, options);
|
|
1851
1950
|
if (options.signal) options.signal.addEventListener("abort", () => {
|
|
1852
1951
|
this.removeListener(type, listener);
|
|
1853
1952
|
}, { once: true });
|
|
@@ -1855,10 +1954,10 @@ var Emitter2 = class {
|
|
|
1855
1954
|
}
|
|
1856
1955
|
#proxyEvent(event) {
|
|
1857
1956
|
const { stopPropagation } = event;
|
|
1858
|
-
event.stopPropagation =
|
|
1957
|
+
event.stopPropagation = () => {
|
|
1859
1958
|
event[kPropagationStopped] = this;
|
|
1860
|
-
|
|
1861
|
-
}
|
|
1959
|
+
stopPropagation.call(event);
|
|
1960
|
+
};
|
|
1862
1961
|
return {
|
|
1863
1962
|
event,
|
|
1864
1963
|
revoke() {
|
|
@@ -1867,10 +1966,13 @@ var Emitter2 = class {
|
|
|
1867
1966
|
};
|
|
1868
1967
|
}
|
|
1869
1968
|
#callListener(event, listener) {
|
|
1969
|
+
for (const hook of this.#hookListeners.get("beforeEmit")) if (hook(event) === false) return;
|
|
1870
1970
|
const returnValue = listener.call(this, event);
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
this.#
|
|
1971
|
+
const options = this.#listenerOptions.get(listener);
|
|
1972
|
+
if (options?.once) {
|
|
1973
|
+
const type = this.#isTypelessListener(listener) ? "*" : event.type;
|
|
1974
|
+
this.#listeners.delete(type, listener);
|
|
1975
|
+
for (const hook of this.#hookListeners.get("removeListener")) hook(type, listener, options);
|
|
1874
1976
|
}
|
|
1875
1977
|
return returnValue;
|
|
1876
1978
|
}
|
|
@@ -1882,7 +1984,7 @@ var Emitter2 = class {
|
|
|
1882
1984
|
for (const [key, listener] of this.#listeners) if (key === "*" || key === type) yield listener;
|
|
1883
1985
|
}
|
|
1884
1986
|
#isTypelessListener(listener) {
|
|
1885
|
-
return this.#
|
|
1987
|
+
return this.#typelessListeners.has(listener);
|
|
1886
1988
|
}
|
|
1887
1989
|
};
|
|
1888
1990
|
|
|
@@ -1915,21 +2017,31 @@ var WorkerEvent = class extends TypedEvent {
|
|
|
1915
2017
|
}
|
|
1916
2018
|
};
|
|
1917
2019
|
var WorkerChannel = class extends Emitter2 {
|
|
2020
|
+
#getWorker;
|
|
2021
|
+
#controller;
|
|
1918
2022
|
constructor(options) {
|
|
1919
2023
|
super();
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2024
|
+
invariant(
|
|
2025
|
+
SUPPORTS_SERVICE_WORKER,
|
|
2026
|
+
"Failed to open a WorkerChannel: Service Worker is not supported in this environment."
|
|
2027
|
+
);
|
|
2028
|
+
this.#getWorker = options.getWorker;
|
|
2029
|
+
this.#controller = new AbortController();
|
|
2030
|
+
navigator.serviceWorker.addEventListener(
|
|
2031
|
+
"message",
|
|
2032
|
+
async (event) => {
|
|
2033
|
+
const worker = await this.#getWorker();
|
|
2034
|
+
if (event.source != null && event.source !== worker) {
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
if (event.data && (0, import_isObject.isObject)(event.data) && "type" in event.data) {
|
|
2038
|
+
this.emit(new WorkerEvent(event));
|
|
2039
|
+
}
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
signal: this.#controller.signal
|
|
1931
2043
|
}
|
|
1932
|
-
|
|
2044
|
+
);
|
|
1933
2045
|
}
|
|
1934
2046
|
/**
|
|
1935
2047
|
* Send data to the Service Worker controlling this client.
|
|
@@ -1938,12 +2050,20 @@ var WorkerChannel = class extends Emitter2 {
|
|
|
1938
2050
|
postMessage(type) {
|
|
1939
2051
|
invariant(
|
|
1940
2052
|
SUPPORTS_SERVICE_WORKER,
|
|
1941
|
-
"Failed to post message on a WorkerChannel: the Service Worker API is unavailable in this
|
|
2053
|
+
"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"
|
|
1942
2054
|
);
|
|
1943
|
-
this.
|
|
2055
|
+
this.#getWorker().then((worker) => {
|
|
1944
2056
|
worker.postMessage(type);
|
|
1945
2057
|
});
|
|
1946
2058
|
}
|
|
2059
|
+
/**
|
|
2060
|
+
* Terminal teardown. Removes the `navigator.serviceWorker` message listener
|
|
2061
|
+
* and all emitter subscriptions. The channel is not usable afterwards.
|
|
2062
|
+
*/
|
|
2063
|
+
terminate() {
|
|
2064
|
+
this.#controller.abort();
|
|
2065
|
+
this.removeAllListeners();
|
|
2066
|
+
}
|
|
1947
2067
|
};
|
|
1948
2068
|
|
|
1949
2069
|
// src/browser/utils/pruneGetRequestBody.ts
|
|
@@ -1975,40 +2095,63 @@ function validateWorkerScope(registration) {
|
|
|
1975
2095
|
}
|
|
1976
2096
|
}
|
|
1977
2097
|
|
|
2098
|
+
// src/browser/utils/should-invalidate-worker.ts
|
|
2099
|
+
function shouldInvalidateWorker(prevOptions, nextOptions) {
|
|
2100
|
+
return prevOptions.findWorker !== nextOptions.findWorker || prevOptions.serviceWorker.url !== nextOptions.serviceWorker.url || JSON.stringify(prevOptions.serviceWorker.options) !== JSON.stringify(nextOptions.serviceWorker.options);
|
|
2101
|
+
}
|
|
2102
|
+
|
|
1978
2103
|
// src/browser/sources/service-worker-source.ts
|
|
1979
|
-
var ServiceWorkerSource = class extends import_network_source.NetworkSource {
|
|
2104
|
+
var ServiceWorkerSource = class _ServiceWorkerSource extends import_network_source.NetworkSource {
|
|
2105
|
+
static #current;
|
|
2106
|
+
/**
|
|
2107
|
+
* Create a new Service Worker source or reuse an existing one.
|
|
2108
|
+
* These sources act as a singleton and only get recreated if the options change.
|
|
2109
|
+
*/
|
|
2110
|
+
static async from(options) {
|
|
2111
|
+
if (_ServiceWorkerSource.#current == null) {
|
|
2112
|
+
_ServiceWorkerSource.#current = new _ServiceWorkerSource(options);
|
|
2113
|
+
} else if (shouldInvalidateWorker(_ServiceWorkerSource.#current.#options, options)) {
|
|
2114
|
+
await _ServiceWorkerSource.#current.terminate();
|
|
2115
|
+
_ServiceWorkerSource.#current = new _ServiceWorkerSource(options);
|
|
2116
|
+
}
|
|
2117
|
+
return _ServiceWorkerSource.#current;
|
|
2118
|
+
}
|
|
2119
|
+
#options;
|
|
2120
|
+
#frames;
|
|
2121
|
+
#channel;
|
|
2122
|
+
#listenerController;
|
|
2123
|
+
#clientPromise;
|
|
2124
|
+
#keepAliveInterval;
|
|
2125
|
+
#stoppedAt;
|
|
2126
|
+
workerPromise;
|
|
1980
2127
|
constructor(options) {
|
|
1981
2128
|
super();
|
|
1982
|
-
this.options = options;
|
|
1983
2129
|
invariant(
|
|
1984
2130
|
supportsServiceWorker(),
|
|
1985
2131
|
"Failed to use Service Worker as the network source: the Service Worker API is not supported in this environment"
|
|
1986
2132
|
);
|
|
2133
|
+
this.#options = options;
|
|
1987
2134
|
this.#frames = /* @__PURE__ */ new Map();
|
|
1988
|
-
this.workerPromise = new
|
|
2135
|
+
this.workerPromise = new DeferredPromise2();
|
|
1989
2136
|
this.#channel = new WorkerChannel({
|
|
1990
|
-
|
|
2137
|
+
getWorker: () => this.workerPromise.then(([worker]) => worker)
|
|
1991
2138
|
});
|
|
1992
2139
|
}
|
|
1993
|
-
#frames;
|
|
1994
|
-
#channel;
|
|
1995
|
-
#clientPromise;
|
|
1996
|
-
#keepAliveInterval;
|
|
1997
|
-
#stoppedAt;
|
|
1998
|
-
workerPromise;
|
|
1999
2140
|
async enable() {
|
|
2000
|
-
this.#stoppedAt
|
|
2001
|
-
if (this.workerPromise.state !== "pending") {
|
|
2141
|
+
if (this.workerPromise.state === "fulfilled" && typeof this.#stoppedAt == "undefined") {
|
|
2002
2142
|
import_devUtils3.devUtils.warn(
|
|
2003
2143
|
'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.'
|
|
2004
2144
|
);
|
|
2005
2145
|
return this.workerPromise.then(([, registration2]) => registration2);
|
|
2006
2146
|
}
|
|
2147
|
+
this.#stoppedAt = void 0;
|
|
2007
2148
|
this.#channel.removeAllListeners();
|
|
2149
|
+
this.#frames.clear();
|
|
2150
|
+
this.#listenerController = new AbortController();
|
|
2008
2151
|
const [worker, registration] = await this.#startWorker();
|
|
2009
2152
|
if (worker.state !== "activated") {
|
|
2010
2153
|
const controller = new AbortController();
|
|
2011
|
-
const activationPromise = new
|
|
2154
|
+
const activationPromise = new DeferredPromise2();
|
|
2012
2155
|
activationPromise.then(() => controller.abort());
|
|
2013
2156
|
worker.addEventListener(
|
|
2014
2157
|
"statechange",
|
|
@@ -2017,18 +2160,20 @@ var ServiceWorkerSource = class extends import_network_source.NetworkSource {
|
|
|
2017
2160
|
activationPromise.resolve();
|
|
2018
2161
|
}
|
|
2019
2162
|
},
|
|
2020
|
-
{
|
|
2163
|
+
{
|
|
2164
|
+
signal: controller.signal
|
|
2165
|
+
}
|
|
2021
2166
|
);
|
|
2022
2167
|
await activationPromise;
|
|
2023
2168
|
}
|
|
2024
2169
|
this.#channel.postMessage("MOCK_ACTIVATE");
|
|
2025
|
-
const clientConfirmationPromise = new
|
|
2170
|
+
const clientConfirmationPromise = new DeferredPromise2();
|
|
2026
2171
|
this.#clientPromise = clientConfirmationPromise;
|
|
2027
2172
|
this.#channel.once("MOCKING_ENABLED", (event) => {
|
|
2028
2173
|
clientConfirmationPromise.resolve(event.data.client);
|
|
2029
2174
|
});
|
|
2030
2175
|
await clientConfirmationPromise;
|
|
2031
|
-
if (!this
|
|
2176
|
+
if (!this.#options.quiet) {
|
|
2032
2177
|
this.#printStartMessage();
|
|
2033
2178
|
}
|
|
2034
2179
|
return registration;
|
|
@@ -2041,24 +2186,47 @@ var ServiceWorkerSource = class extends import_network_source.NetworkSource {
|
|
|
2041
2186
|
return;
|
|
2042
2187
|
}
|
|
2043
2188
|
this.#stoppedAt = Date.now();
|
|
2044
|
-
this.#
|
|
2045
|
-
this
|
|
2046
|
-
|
|
2189
|
+
this.#listenerController?.abort();
|
|
2190
|
+
this.#listenerController = void 0;
|
|
2191
|
+
this.#channel.postMessage("CLIENT_CLOSED");
|
|
2192
|
+
if (!this.#options.quiet) {
|
|
2047
2193
|
this.#printStopMessage();
|
|
2048
2194
|
}
|
|
2049
2195
|
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Terminal teardown. Unregisters the Service Worker, tears down the channel,
|
|
2198
|
+
* and clears timers. Called when the singleton is being replaced with one
|
|
2199
|
+
* that has different options. The instance is not usable afterwards.
|
|
2200
|
+
*/
|
|
2201
|
+
async terminate() {
|
|
2202
|
+
if (this.#keepAliveInterval != null) {
|
|
2203
|
+
clearInterval(this.#keepAliveInterval);
|
|
2204
|
+
this.#keepAliveInterval = void 0;
|
|
2205
|
+
}
|
|
2206
|
+
this.#frames.clear();
|
|
2207
|
+
this.#channel.terminate();
|
|
2208
|
+
this.#listenerController?.abort();
|
|
2209
|
+
this.#listenerController = void 0;
|
|
2210
|
+
if (this.workerPromise.state === "fulfilled") {
|
|
2211
|
+
const [, registration] = await this.workerPromise;
|
|
2212
|
+
await registration.unregister();
|
|
2213
|
+
}
|
|
2214
|
+
if (_ServiceWorkerSource.#current === this) {
|
|
2215
|
+
_ServiceWorkerSource.#current = void 0;
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2050
2218
|
async #startWorker() {
|
|
2051
2219
|
if (this.#keepAliveInterval) {
|
|
2052
2220
|
clearInterval(this.#keepAliveInterval);
|
|
2053
2221
|
}
|
|
2054
|
-
const workerUrl = this
|
|
2222
|
+
const workerUrl = this.#options.serviceWorker.url;
|
|
2055
2223
|
const [worker, registration] = await getWorkerInstance(
|
|
2056
2224
|
workerUrl,
|
|
2057
|
-
this
|
|
2058
|
-
this
|
|
2225
|
+
this.#options.serviceWorker.options,
|
|
2226
|
+
this.#options.findWorker || this.#defaultFindWorker
|
|
2059
2227
|
);
|
|
2060
2228
|
if (worker == null) {
|
|
2061
|
-
const missingWorkerMessage = this
|
|
2229
|
+
const missingWorkerMessage = this.#options?.findWorker ? import_devUtils3.devUtils.formatMessage(
|
|
2062
2230
|
`Failed to locate the Service Worker registration using a custom "findWorker" predicate.
|
|
2063
2231
|
|
|
2064
2232
|
Please ensure that the custom predicate properly locates the Service Worker registration at "%s".
|
|
@@ -2076,16 +2244,28 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
2076
2244
|
);
|
|
2077
2245
|
throw new Error(missingWorkerMessage);
|
|
2078
2246
|
}
|
|
2079
|
-
this.workerPromise.
|
|
2247
|
+
if (this.workerPromise.state === "pending") {
|
|
2248
|
+
this.workerPromise.resolve([worker, registration]);
|
|
2249
|
+
} else {
|
|
2250
|
+
this.workerPromise = new DeferredPromise2((resolve) => {
|
|
2251
|
+
resolve([worker, registration]);
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2080
2254
|
this.#channel.on("REQUEST", this.#handleRequest.bind(this));
|
|
2081
2255
|
this.#channel.on("RESPONSE", this.#handleResponse.bind(this));
|
|
2082
|
-
window.addEventListener(
|
|
2083
|
-
|
|
2084
|
-
|
|
2256
|
+
window.addEventListener(
|
|
2257
|
+
"beforeunload",
|
|
2258
|
+
() => {
|
|
2259
|
+
if (worker.state !== "redundant") {
|
|
2260
|
+
this.#channel.postMessage("CLIENT_CLOSED");
|
|
2261
|
+
}
|
|
2262
|
+
clearInterval(this.#keepAliveInterval);
|
|
2263
|
+
window.postMessage({ type: "msw/worker:stop" });
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
signal: this.#listenerController?.signal
|
|
2085
2267
|
}
|
|
2086
|
-
|
|
2087
|
-
window.postMessage({ type: "msw/worker:stop" });
|
|
2088
|
-
});
|
|
2268
|
+
);
|
|
2089
2269
|
await this.#checkWorkerIntegrity().catch((error2) => {
|
|
2090
2270
|
import_devUtils3.devUtils.error(
|
|
2091
2271
|
"Error while checking the worker script integrity. Please report this on GitHub (https://github.com/mswjs/msw/issues) and include the original error below."
|
|
@@ -2095,7 +2275,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
2095
2275
|
this.#keepAliveInterval = window.setInterval(() => {
|
|
2096
2276
|
this.#channel.postMessage("KEEPALIVE_REQUEST");
|
|
2097
2277
|
}, 5e3);
|
|
2098
|
-
if (!this
|
|
2278
|
+
if (!this.#options.quiet) {
|
|
2099
2279
|
validateWorkerScope(registration);
|
|
2100
2280
|
}
|
|
2101
2281
|
return [worker, registration];
|
|
@@ -2159,7 +2339,7 @@ Please consider using a custom "serviceWorker.url" option to point to the actual
|
|
|
2159
2339
|
return workerUrl === mockServiceWorkerUrl;
|
|
2160
2340
|
};
|
|
2161
2341
|
async #checkWorkerIntegrity() {
|
|
2162
|
-
const integrityCheckPromise = new
|
|
2342
|
+
const integrityCheckPromise = new DeferredPromise2();
|
|
2163
2343
|
this.#channel.postMessage("INTEGRITY_CHECK_REQUEST");
|
|
2164
2344
|
this.#channel.once("INTEGRITY_CHECK_RESPONSE", (event) => {
|
|
2165
2345
|
const { checksum, packageVersion } = event.data;
|
|
@@ -2283,7 +2463,7 @@ var until2 = async (promise) => {
|
|
|
2283
2463
|
}
|
|
2284
2464
|
};
|
|
2285
2465
|
|
|
2286
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
2466
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/handleRequest-D7kpTI5U.mjs
|
|
2287
2467
|
function isObject2(value, loose = false) {
|
|
2288
2468
|
return loose ? Object.prototype.toString.call(value).startsWith("[object ") : Object.prototype.toString.call(value) === "[object Object]";
|
|
2289
2469
|
}
|
|
@@ -2400,7 +2580,7 @@ async function handleRequest(options) {
|
|
|
2400
2580
|
return options.controller.handled;
|
|
2401
2581
|
}
|
|
2402
2582
|
|
|
2403
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
2583
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/fetch-DdKEdDOR.mjs
|
|
2404
2584
|
function createNetworkError(cause) {
|
|
2405
2585
|
return Object.assign(/* @__PURE__ */ new TypeError("Failed to fetch"), { cause });
|
|
2406
2586
|
}
|
|
@@ -2593,7 +2773,7 @@ var FetchInterceptor = class FetchInterceptor2 extends Interceptor {
|
|
|
2593
2773
|
}
|
|
2594
2774
|
};
|
|
2595
2775
|
|
|
2596
|
-
// node_modules/.pnpm/@mswjs+interceptors@0.41.
|
|
2776
|
+
// node_modules/.pnpm/@mswjs+interceptors@0.41.3/node_modules/@mswjs/interceptors/lib/browser/XMLHttpRequest-BvxZV0WU.mjs
|
|
2597
2777
|
function concatArrayBuffer(left, right) {
|
|
2598
2778
|
const result = new Uint8Array(left.byteLength + right.byteLength);
|
|
2599
2779
|
result.set(left, 0);
|
|
@@ -3284,7 +3464,7 @@ function setupWorker(...handlers) {
|
|
|
3284
3464
|
);
|
|
3285
3465
|
return;
|
|
3286
3466
|
}
|
|
3287
|
-
const httpSource = supportsServiceWorker() ?
|
|
3467
|
+
const httpSource = supportsServiceWorker() ? await ServiceWorkerSource.from({
|
|
3288
3468
|
serviceWorker: {
|
|
3289
3469
|
url: options?.serviceWorker?.url?.toString() || DEFAULT_WORKER_URL,
|
|
3290
3470
|
options: options?.serviceWorker?.options
|