@serwist/sw 9.0.0-preview.21 → 9.0.0-preview.24
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/dist/index.d.ts +4 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -156
- package/package.json +5 -40
- package/src/index.ts +5 -22
- package/README.md +0 -1
- package/dist/abstractions/Serwist.d.ts +0 -82
- package/dist/abstractions/Serwist.d.ts.map +0 -1
- package/dist/abstractions/disableDevLogs.d.ts +0 -7
- package/dist/abstractions/disableDevLogs.d.ts.map +0 -1
- package/dist/abstractions/fallbacks.d.ts +0 -39
- package/dist/abstractions/fallbacks.d.ts.map +0 -1
- package/dist/abstractions/handlePrecaching.d.ts +0 -39
- package/dist/abstractions/handlePrecaching.d.ts.map +0 -1
- package/dist/abstractions/installSerwist.d.ts +0 -15
- package/dist/abstractions/installSerwist.d.ts.map +0 -1
- package/dist/abstractions/navigationPreload.d.ts +0 -20
- package/dist/abstractions/navigationPreload.d.ts.map +0 -1
- package/dist/abstractions/registerRuntimeCaching.d.ts +0 -11
- package/dist/abstractions/registerRuntimeCaching.d.ts.map +0 -1
- package/dist/abstractions/types.d.ts +0 -29
- package/dist/abstractions/types.d.ts.map +0 -1
- package/dist/chunks/NavigationRoute.js +0 -54
- package/dist/chunks/NetworkOnly.js +0 -193
- package/dist/chunks/PrecacheFallbackPlugin.js +0 -573
- package/dist/chunks/Strategy.js +0 -410
- package/dist/chunks/precacheAndRoute.js +0 -113
- package/dist/chunks/registerRoute.js +0 -7
- package/dist/chunks/singletonPrecacheController.js +0 -433
- package/dist/chunks/singletonRouter.js +0 -435
- package/dist/index.plugins.d.ts +0 -41
- package/dist/index.plugins.d.ts.map +0 -1
- package/dist/index.plugins.js +0 -671
- package/dist/index.precaching.d.ts +0 -25
- package/dist/index.precaching.d.ts.map +0 -1
- package/dist/index.precaching.js +0 -24
- package/dist/index.routing.d.ts +0 -15
- package/dist/index.routing.d.ts.map +0 -1
- package/dist/index.routing.js +0 -19
- package/dist/index.strategies.d.ts +0 -22
- package/dist/index.strategies.d.ts.map +0 -1
- package/dist/index.strategies.js +0 -146
- package/dist/plugins/backgroundSync/BackgroundSyncPlugin.d.ts +0 -23
- package/dist/plugins/backgroundSync/BackgroundSyncPlugin.d.ts.map +0 -1
- package/dist/plugins/backgroundSync/Queue.d.ts +0 -166
- package/dist/plugins/backgroundSync/Queue.d.ts.map +0 -1
- package/dist/plugins/backgroundSync/QueueDb.d.ts +0 -90
- package/dist/plugins/backgroundSync/QueueDb.d.ts.map +0 -1
- package/dist/plugins/backgroundSync/QueueStore.d.ts +0 -75
- package/dist/plugins/backgroundSync/QueueStore.d.ts.map +0 -1
- package/dist/plugins/backgroundSync/StorableRequest.d.ts +0 -51
- package/dist/plugins/backgroundSync/StorableRequest.d.ts.map +0 -1
- package/dist/plugins/broadcastUpdate/BroadcastCacheUpdate.d.ts +0 -45
- package/dist/plugins/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +0 -1
- package/dist/plugins/broadcastUpdate/BroadcastUpdatePlugin.d.ts +0 -27
- package/dist/plugins/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +0 -1
- package/dist/plugins/broadcastUpdate/constants.d.ts +0 -5
- package/dist/plugins/broadcastUpdate/constants.d.ts.map +0 -1
- package/dist/plugins/broadcastUpdate/responsesAreSame.d.ts +0 -11
- package/dist/plugins/broadcastUpdate/responsesAreSame.d.ts.map +0 -1
- package/dist/plugins/broadcastUpdate/types.d.ts +0 -34
- package/dist/plugins/broadcastUpdate/types.d.ts.map +0 -1
- package/dist/plugins/cacheableResponse/CacheableResponse.d.ts +0 -40
- package/dist/plugins/cacheableResponse/CacheableResponse.d.ts.map +0 -1
- package/dist/plugins/cacheableResponse/CacheableResponsePlugin.d.ts +0 -27
- package/dist/plugins/cacheableResponse/CacheableResponsePlugin.d.ts.map +0 -1
- package/dist/plugins/expiration/CacheExpiration.d.ts +0 -66
- package/dist/plugins/expiration/CacheExpiration.d.ts.map +0 -1
- package/dist/plugins/expiration/ExpirationPlugin.d.ts +0 -116
- package/dist/plugins/expiration/ExpirationPlugin.d.ts.map +0 -1
- package/dist/plugins/expiration/models/CacheTimestampsModel.d.ts +0 -73
- package/dist/plugins/expiration/models/CacheTimestampsModel.d.ts.map +0 -1
- package/dist/plugins/googleAnalytics/constants.d.ts +0 -10
- package/dist/plugins/googleAnalytics/constants.d.ts.map +0 -1
- package/dist/plugins/googleAnalytics/initialize.d.ts +0 -34
- package/dist/plugins/googleAnalytics/initialize.d.ts.map +0 -1
- package/dist/plugins/precaching/PrecacheFallbackPlugin.d.ts +0 -54
- package/dist/plugins/precaching/PrecacheFallbackPlugin.d.ts.map +0 -1
- package/dist/plugins/rangeRequests/RangeRequestsPlugin.d.ts +0 -19
- package/dist/plugins/rangeRequests/RangeRequestsPlugin.d.ts.map +0 -1
- package/dist/plugins/rangeRequests/createPartialResponse.d.ts +0 -18
- package/dist/plugins/rangeRequests/createPartialResponse.d.ts.map +0 -1
- package/dist/plugins/rangeRequests/utils/calculateEffectiveBoundaries.d.ts +0 -14
- package/dist/plugins/rangeRequests/utils/calculateEffectiveBoundaries.d.ts.map +0 -1
- package/dist/plugins/rangeRequests/utils/parseRangeHeader.d.ts +0 -12
- package/dist/plugins/rangeRequests/utils/parseRangeHeader.d.ts.map +0 -1
- package/dist/precaching/PrecacheController.d.ts +0 -145
- package/dist/precaching/PrecacheController.d.ts.map +0 -1
- package/dist/precaching/PrecacheRoute.d.ts +0 -20
- package/dist/precaching/PrecacheRoute.d.ts.map +0 -1
- package/dist/precaching/PrecacheStrategy.d.ts +0 -68
- package/dist/precaching/PrecacheStrategy.d.ts.map +0 -1
- package/dist/precaching/addPlugins.d.ts +0 -8
- package/dist/precaching/addPlugins.d.ts.map +0 -1
- package/dist/precaching/addRoute.d.ts +0 -15
- package/dist/precaching/addRoute.d.ts.map +0 -1
- package/dist/precaching/cleanupOutdatedCaches.d.ts +0 -6
- package/dist/precaching/cleanupOutdatedCaches.d.ts.map +0 -1
- package/dist/precaching/createHandlerBoundToURL.d.ts +0 -17
- package/dist/precaching/createHandlerBoundToURL.d.ts.map +0 -1
- package/dist/precaching/getCacheKeyForURL.d.ts +0 -20
- package/dist/precaching/getCacheKeyForURL.d.ts.map +0 -1
- package/dist/precaching/matchPrecache.d.ts +0 -14
- package/dist/precaching/matchPrecache.d.ts.map +0 -1
- package/dist/precaching/precache.d.ts +0 -19
- package/dist/precaching/precache.d.ts.map +0 -1
- package/dist/precaching/precacheAndRoute.d.ts +0 -14
- package/dist/precaching/precacheAndRoute.d.ts.map +0 -1
- package/dist/precaching/singletonPrecacheController.d.ts +0 -38
- package/dist/precaching/singletonPrecacheController.d.ts.map +0 -1
- package/dist/precaching/types.d.ts +0 -37
- package/dist/precaching/types.d.ts.map +0 -1
- package/dist/precaching/utils/PrecacheCacheKeyPlugin.d.ts +0 -17
- package/dist/precaching/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
- package/dist/precaching/utils/PrecacheInstallReportPlugin.d.ts +0 -15
- package/dist/precaching/utils/PrecacheInstallReportPlugin.d.ts.map +0 -1
- package/dist/precaching/utils/createCacheKey.d.ts +0 -16
- package/dist/precaching/utils/createCacheKey.d.ts.map +0 -1
- package/dist/precaching/utils/deleteOutdatedCaches.d.ts +0 -18
- package/dist/precaching/utils/deleteOutdatedCaches.d.ts.map +0 -1
- package/dist/precaching/utils/generateURLVariations.d.ts +0 -12
- package/dist/precaching/utils/generateURLVariations.d.ts.map +0 -1
- package/dist/precaching/utils/getCacheKeyForURL.d.ts +0 -14
- package/dist/precaching/utils/getCacheKeyForURL.d.ts.map +0 -1
- package/dist/precaching/utils/printCleanupDetails.d.ts +0 -6
- package/dist/precaching/utils/printCleanupDetails.d.ts.map +0 -1
- package/dist/precaching/utils/printInstallDetails.d.ts +0 -7
- package/dist/precaching/utils/printInstallDetails.d.ts.map +0 -1
- package/dist/precaching/utils/removeIgnoredSearchParams.d.ts +0 -12
- package/dist/precaching/utils/removeIgnoredSearchParams.d.ts.map +0 -1
- package/dist/routing/NavigationRoute.d.ts +0 -57
- package/dist/routing/NavigationRoute.d.ts.map +0 -1
- package/dist/routing/RegExpRoute.d.ts +0 -24
- package/dist/routing/RegExpRoute.d.ts.map +0 -1
- package/dist/routing/Route.d.ts +0 -33
- package/dist/routing/Route.d.ts.map +0 -1
- package/dist/routing/Router.d.ts +0 -150
- package/dist/routing/Router.d.ts.map +0 -1
- package/dist/routing/parseRoute.d.ts +0 -16
- package/dist/routing/parseRoute.d.ts.map +0 -1
- package/dist/routing/registerRoute.d.ts +0 -15
- package/dist/routing/registerRoute.d.ts.map +0 -1
- package/dist/routing/setCatchHandler.d.ts +0 -9
- package/dist/routing/setCatchHandler.d.ts.map +0 -1
- package/dist/routing/setDefaultHandler.d.ts +0 -12
- package/dist/routing/setDefaultHandler.d.ts.map +0 -1
- package/dist/routing/singletonRouter.d.ts +0 -47
- package/dist/routing/singletonRouter.d.ts.map +0 -1
- package/dist/routing/unregisterRoute.d.ts +0 -8
- package/dist/routing/unregisterRoute.d.ts.map +0 -1
- package/dist/routing/utils/constants.d.ts +0 -15
- package/dist/routing/utils/constants.d.ts.map +0 -1
- package/dist/routing/utils/normalizeHandler.d.ts +0 -10
- package/dist/routing/utils/normalizeHandler.d.ts.map +0 -1
- package/dist/strategies/CacheFirst.d.ts +0 -23
- package/dist/strategies/CacheFirst.d.ts.map +0 -1
- package/dist/strategies/CacheOnly.d.ts +0 -20
- package/dist/strategies/CacheOnly.d.ts.map +0 -1
- package/dist/strategies/NetworkFirst.d.ts +0 -61
- package/dist/strategies/NetworkFirst.d.ts.map +0 -1
- package/dist/strategies/NetworkOnly.d.ts +0 -32
- package/dist/strategies/NetworkOnly.d.ts.map +0 -1
- package/dist/strategies/StaleWhileRevalidate.d.ts +0 -35
- package/dist/strategies/StaleWhileRevalidate.d.ts.map +0 -1
- package/dist/strategies/Strategy.d.ts +0 -83
- package/dist/strategies/Strategy.d.ts.map +0 -1
- package/dist/strategies/StrategyHandler.d.ts +0 -189
- package/dist/strategies/StrategyHandler.d.ts.map +0 -1
- package/dist/strategies/plugins/cacheOkAndOpaquePlugin.d.ts +0 -3
- package/dist/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +0 -1
- package/dist/strategies/utils/messages.d.ts +0 -5
- package/dist/strategies/utils/messages.d.ts.map +0 -1
- package/src/abstractions/Serwist.ts +0 -177
- package/src/abstractions/disableDevLogs.ts +0 -10
- package/src/abstractions/fallbacks.ts +0 -65
- package/src/abstractions/handlePrecaching.ts +0 -65
- package/src/abstractions/installSerwist.ts +0 -28
- package/src/abstractions/navigationPreload.ts +0 -64
- package/src/abstractions/registerRuntimeCaching.ts +0 -17
- package/src/abstractions/types.ts +0 -29
- package/src/index.plugins.ts +0 -95
- package/src/index.precaching.ts +0 -41
- package/src/index.routing.ts +0 -28
- package/src/index.strategies.ts +0 -26
- package/src/plugins/backgroundSync/BackgroundSyncPlugin.ts +0 -39
- package/src/plugins/backgroundSync/Queue.ts +0 -438
- package/src/plugins/backgroundSync/QueueDb.ts +0 -176
- package/src/plugins/backgroundSync/QueueStore.ts +0 -161
- package/src/plugins/backgroundSync/StorableRequest.ts +0 -142
- package/src/plugins/broadcastUpdate/BroadcastCacheUpdate.ts +0 -159
- package/src/plugins/broadcastUpdate/BroadcastUpdatePlugin.ts +0 -43
- package/src/plugins/broadcastUpdate/constants.ts +0 -12
- package/src/plugins/broadcastUpdate/responsesAreSame.ts +0 -48
- package/src/plugins/broadcastUpdate/types.ts +0 -37
- package/src/plugins/cacheableResponse/CacheableResponse.ts +0 -141
- package/src/plugins/cacheableResponse/CacheableResponsePlugin.ts +0 -46
- package/src/plugins/expiration/CacheExpiration.ts +0 -192
- package/src/plugins/expiration/ExpirationPlugin.ts +0 -297
- package/src/plugins/expiration/models/CacheTimestampsModel.ts +0 -184
- package/src/plugins/googleAnalytics/constants.ts +0 -22
- package/src/plugins/googleAnalytics/initialize.ts +0 -213
- package/src/plugins/precaching/PrecacheFallbackPlugin.ts +0 -86
- package/src/plugins/rangeRequests/RangeRequestsPlugin.ts +0 -39
- package/src/plugins/rangeRequests/createPartialResponse.ts +0 -92
- package/src/plugins/rangeRequests/utils/calculateEffectiveBoundaries.ts +0 -58
- package/src/plugins/rangeRequests/utils/parseRangeHeader.ts +0 -54
- package/src/precaching/PrecacheController.ts +0 -332
- package/src/precaching/PrecacheRoute.ts +0 -50
- package/src/precaching/PrecacheStrategy.ts +0 -238
- package/src/precaching/addPlugins.ts +0 -21
- package/src/precaching/addRoute.ts +0 -30
- package/src/precaching/cleanupOutdatedCaches.ts +0 -33
- package/src/precaching/createHandlerBoundToURL.ts +0 -30
- package/src/precaching/getCacheKeyForURL.ts +0 -33
- package/src/precaching/matchPrecache.ts +0 -25
- package/src/precaching/precache.ts +0 -31
- package/src/precaching/precacheAndRoute.ts +0 -27
- package/src/precaching/singletonPrecacheController.ts +0 -57
- package/src/precaching/types.ts +0 -46
- package/src/precaching/utils/PrecacheCacheKeyPlugin.ts +0 -36
- package/src/precaching/utils/PrecacheInstallReportPlugin.ts +0 -49
- package/src/precaching/utils/createCacheKey.ts +0 -68
- package/src/precaching/utils/deleteOutdatedCaches.ts +0 -40
- package/src/precaching/utils/generateURLVariations.ts +0 -55
- package/src/precaching/utils/getCacheKeyForURL.ts +0 -36
- package/src/precaching/utils/printCleanupDetails.ts +0 -38
- package/src/precaching/utils/printInstallDetails.ts +0 -53
- package/src/precaching/utils/removeIgnoredSearchParams.ts +0 -29
- package/src/routing/NavigationRoute.ts +0 -119
- package/src/routing/RegExpRoute.ts +0 -74
- package/src/routing/Route.ts +0 -68
- package/src/routing/Router.ts +0 -481
- package/src/routing/parseRoute.ts +0 -78
- package/src/routing/registerRoute.ts +0 -27
- package/src/routing/setCatchHandler.ts +0 -21
- package/src/routing/setDefaultHandler.ts +0 -24
- package/src/routing/singletonRouter.ts +0 -76
- package/src/routing/unregisterRoute.ts +0 -11
- package/src/routing/utils/constants.ts +0 -24
- package/src/routing/utils/normalizeHandler.ts +0 -40
- package/src/strategies/CacheFirst.ts +0 -87
- package/src/strategies/CacheOnly.ts +0 -58
- package/src/strategies/NetworkFirst.ts +0 -228
- package/src/strategies/NetworkOnly.ts +0 -96
- package/src/strategies/StaleWhileRevalidate.ts +0 -109
- package/src/strategies/Strategy.ts +0 -202
- package/src/strategies/StrategyHandler.ts +0 -557
- package/src/strategies/plugins/cacheOkAndOpaquePlugin.ts +0 -26
- package/src/strategies/utils/messages.ts +0 -20
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a `Request` and `Response` objects as input, this will return a
|
|
3
|
-
* promise for a new `Response`.
|
|
4
|
-
*
|
|
5
|
-
* If the original `Response` already contains partial content (i.e. it has
|
|
6
|
-
* a status of 206), then this assumes it already fulfills the `Range:`
|
|
7
|
-
* requirements, and will return it as-is.
|
|
8
|
-
*
|
|
9
|
-
* @param request A request, which should contain a Range:
|
|
10
|
-
* header.
|
|
11
|
-
* @param originalResponse A response.
|
|
12
|
-
* @returns Either a `206 Partial Content` response, with
|
|
13
|
-
* the response body set to the slice of content specified by the request's
|
|
14
|
-
* `Range:` header, or a `416 Range Not Satisfiable` response if the
|
|
15
|
-
* conditions of the `Range:` header can't be met.
|
|
16
|
-
*/
|
|
17
|
-
export declare const createPartialResponse: (request: Request, originalResponse: Response) => Promise<Response>;
|
|
18
|
-
//# sourceMappingURL=createPartialResponse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createPartialResponse.d.ts","sourceRoot":"","sources":["../../../src/plugins/rangeRequests/createPartialResponse.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,YAAmB,OAAO,oBAAoB,QAAQ,KAAG,QAAQ,QAAQ,CA8D1G,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param blob A source blob.
|
|
3
|
-
* @param start The offset to use as the start of the
|
|
4
|
-
* slice.
|
|
5
|
-
* @param end The offset to use as the end of the slice.
|
|
6
|
-
* @returns An object with `start` and `end` properties, reflecting
|
|
7
|
-
* the effective boundaries to use given the size of the blob.
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
export declare const calculateEffectiveBoundaries: (blob: Blob, start?: number, end?: number) => {
|
|
11
|
-
start: number;
|
|
12
|
-
end: number;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=calculateEffectiveBoundaries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculateEffectiveBoundaries.d.ts","sourceRoot":"","sources":["../../../../src/plugins/rangeRequests/utils/calculateEffectiveBoundaries.ts"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,SAAU,IAAI,UAAU,MAAM,QAAQ,MAAM;WAAY,MAAM;SAAO,MAAM;CAsCnH,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param rangeHeader A Range: header value.
|
|
3
|
-
* @returns An object with `start` and `end` properties, reflecting
|
|
4
|
-
* the parsed value of the Range: header. If either the `start` or `end` are
|
|
5
|
-
* omitted, then `null` will be returned.
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
export declare const parseRangeHeader: (rangeHeader: string) => {
|
|
9
|
-
start?: number;
|
|
10
|
-
end?: number;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=parseRangeHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRangeHeader.d.ts","sourceRoot":"","sources":["../../../../src/plugins/rangeRequests/utils/parseRangeHeader.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,gBACd,MAAM,KAClB;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CAgCd,CAAC"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import type { RouteHandlerCallback, SerwistPlugin } from "@serwist/core";
|
|
2
|
-
import type { Strategy } from "../strategies/Strategy.js";
|
|
3
|
-
import type { CleanupResult, InstallResult, PrecacheEntry } from "./types.js";
|
|
4
|
-
interface PrecacheControllerOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The cache to use for precaching.
|
|
7
|
-
*/
|
|
8
|
-
cacheName?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Plugins to use when precaching as well as responding to fetch
|
|
11
|
-
* events for precached assets.
|
|
12
|
-
*/
|
|
13
|
-
plugins?: SerwistPlugin[];
|
|
14
|
-
/**
|
|
15
|
-
* Whether to attempt to get the response from the network if there's
|
|
16
|
-
* a precache miss.
|
|
17
|
-
*/
|
|
18
|
-
fallbackToNetwork?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* A number of how many precache requests should be made concurrently.
|
|
21
|
-
*
|
|
22
|
-
* @default 1
|
|
23
|
-
*/
|
|
24
|
-
concurrentPrecaching?: number;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Performs efficient precaching of assets.
|
|
28
|
-
*/
|
|
29
|
-
export declare class PrecacheController {
|
|
30
|
-
private _installAndActiveListenersAdded?;
|
|
31
|
-
private _concurrentPrecaching;
|
|
32
|
-
private readonly _strategy;
|
|
33
|
-
private readonly _urlsToCacheKeys;
|
|
34
|
-
private readonly _urlsToCacheModes;
|
|
35
|
-
private readonly _cacheKeysToIntegrities;
|
|
36
|
-
/**
|
|
37
|
-
* Create a new PrecacheController.
|
|
38
|
-
*
|
|
39
|
-
* @param options
|
|
40
|
-
*/
|
|
41
|
-
constructor({ cacheName, plugins, fallbackToNetwork, concurrentPrecaching }?: PrecacheControllerOptions);
|
|
42
|
-
/**
|
|
43
|
-
* The strategy created by this controller and
|
|
44
|
-
* used to cache assets and respond to fetch events.
|
|
45
|
-
*/
|
|
46
|
-
get strategy(): Strategy;
|
|
47
|
-
/**
|
|
48
|
-
* Adds items to the precache list, removing any duplicates and
|
|
49
|
-
* stores the files in the precache cache when the service
|
|
50
|
-
* worker installs.
|
|
51
|
-
*
|
|
52
|
-
* This method can be called multiple times.
|
|
53
|
-
*
|
|
54
|
-
* @param entries Array of entries to precache.
|
|
55
|
-
*/
|
|
56
|
-
precache(entries: (PrecacheEntry | string)[]): void;
|
|
57
|
-
/**
|
|
58
|
-
* This method will add items to the precache list, removing duplicates
|
|
59
|
-
* and ensuring the information is valid.
|
|
60
|
-
*
|
|
61
|
-
* @param entries Array of entries to precache.
|
|
62
|
-
*/
|
|
63
|
-
addToCacheList(entries: (PrecacheEntry | string)[]): void;
|
|
64
|
-
/**
|
|
65
|
-
* Precaches new and updated assets. Call this method from the service worker
|
|
66
|
-
* install event.
|
|
67
|
-
*
|
|
68
|
-
* Note: this method calls `event.waitUntil()` for you, so you do not need
|
|
69
|
-
* to call it yourself in your event handlers.
|
|
70
|
-
*
|
|
71
|
-
* @param event
|
|
72
|
-
* @returns
|
|
73
|
-
*/
|
|
74
|
-
install(event: ExtendableEvent): Promise<InstallResult>;
|
|
75
|
-
/**
|
|
76
|
-
* Deletes assets that are no longer present in the current precache manifest.
|
|
77
|
-
* Call this method from the service worker activate event.
|
|
78
|
-
*
|
|
79
|
-
* Note: this method calls `event.waitUntil()` for you, so you do not need
|
|
80
|
-
* to call it yourself in your event handlers.
|
|
81
|
-
*
|
|
82
|
-
* @param event
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
activate(event: ExtendableEvent): Promise<CleanupResult>;
|
|
86
|
-
/**
|
|
87
|
-
* Returns a mapping of a precached URL to the corresponding cache key, taking
|
|
88
|
-
* into account the revision information for the URL.
|
|
89
|
-
*
|
|
90
|
-
* @returns A URL to cache key mapping.
|
|
91
|
-
*/
|
|
92
|
-
getURLsToCacheKeys(): Map<string, string>;
|
|
93
|
-
/**
|
|
94
|
-
* Returns a list of all the URLs that have been precached by the current
|
|
95
|
-
* service worker.
|
|
96
|
-
*
|
|
97
|
-
* @returns The precached URLs.
|
|
98
|
-
*/
|
|
99
|
-
getCachedURLs(): string[];
|
|
100
|
-
/**
|
|
101
|
-
* Returns the cache key used for storing a given URL. If that URL is
|
|
102
|
-
* unversioned, like `/index.html', then the cache key will be the original
|
|
103
|
-
* URL with a search parameter appended to it.
|
|
104
|
-
*
|
|
105
|
-
* @param url A URL whose cache key you want to look up.
|
|
106
|
-
* @returns The versioned URL that corresponds to a cache key
|
|
107
|
-
* for the original URL, or undefined if that URL isn't precached.
|
|
108
|
-
*/
|
|
109
|
-
getCacheKeyForURL(url: string): string | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* @param url A cache key whose SRI you want to look up.
|
|
112
|
-
* @returns The subresource integrity associated with the cache key,
|
|
113
|
-
* or undefined if it's not set.
|
|
114
|
-
*/
|
|
115
|
-
getIntegrityForCacheKey(cacheKey: string): string | undefined;
|
|
116
|
-
/**
|
|
117
|
-
* This acts as a drop-in replacement for
|
|
118
|
-
* [`cache.match()`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/match)
|
|
119
|
-
* with the following differences:
|
|
120
|
-
*
|
|
121
|
-
* - It knows what the name of the precache is, and only checks in that cache.
|
|
122
|
-
* - It allows you to pass in an "original" URL without versioning parameters,
|
|
123
|
-
* and it will automatically look up the correct cache key for the currently
|
|
124
|
-
* active revision of that URL.
|
|
125
|
-
*
|
|
126
|
-
* E.g., `matchPrecache('index.html')` will find the correct precached
|
|
127
|
-
* response for the currently active service worker, even if the actual cache
|
|
128
|
-
* key is `'/index.html?__WB_REVISION__=1234abcd'`.
|
|
129
|
-
*
|
|
130
|
-
* @param request The key (without revisioning parameters)
|
|
131
|
-
* to look up in the precache.
|
|
132
|
-
* @returns
|
|
133
|
-
*/
|
|
134
|
-
matchPrecache(request: string | Request): Promise<Response | undefined>;
|
|
135
|
-
/**
|
|
136
|
-
* Returns a function that looks up `url` in the precache (taking into
|
|
137
|
-
* account revision information), and returns the corresponding `Response`.
|
|
138
|
-
*
|
|
139
|
-
* @param url The precached URL which will be used to lookup the response.
|
|
140
|
-
* @return
|
|
141
|
-
*/
|
|
142
|
-
createHandlerBoundToURL(url: string): RouteHandlerCallback;
|
|
143
|
-
}
|
|
144
|
-
export {};
|
|
145
|
-
//# sourceMappingURL=PrecacheController.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheController.d.ts","sourceRoot":"","sources":["../../src/precaching/PrecacheController.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAU9E,UAAU,yBAAyB;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,+BAA+B,CAAC,CAAU;IAClD,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkC;IACnE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6G;IAC/I,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAkC;IAE1E;;;;OAIG;gBACS,EAAE,SAAS,EAAE,OAAY,EAAE,iBAAwB,EAAE,oBAAwB,EAAE,GAAE,yBAA8B;IAY3H;;;OAGG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,GAAG,IAAI;IAUnD;;;;;OAKG;IACH,cAAc,CAAC,OAAO,EAAE,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,GAAG,IAAI;IAwDzD;;;;;;;;;OASG;IACH,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAmCvD;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAuBxD;;;;;OAKG;IACH,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAIzC;;;;;OAKG;IACH,aAAa,IAAI,MAAM,EAAE;IAIzB;;;;;;;;OAQG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKlD;;;;OAIG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI7D;;;;;;;;;;;;;;;;;OAiBG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAU7E;;;;;;OAMG;IACH,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB;CAY3D"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Route } from "../routing/Route.js";
|
|
2
|
-
import type { PrecacheController } from "./PrecacheController.js";
|
|
3
|
-
import type { PrecacheRouteOptions } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* A subclass of `@serwist/routing.Route` that takes a
|
|
6
|
-
* `@serwist/precaching.PrecacheController`
|
|
7
|
-
* instance and uses it to match incoming requests and handle fetching
|
|
8
|
-
* responses from the precache.
|
|
9
|
-
*/
|
|
10
|
-
declare class PrecacheRoute extends Route {
|
|
11
|
-
/**
|
|
12
|
-
* @param precacheController A `PrecacheController`
|
|
13
|
-
* instance used to both match requests and respond to fetch events.
|
|
14
|
-
* @param options Options to control how requests are matched
|
|
15
|
-
* against the list of precached URLs.
|
|
16
|
-
*/
|
|
17
|
-
constructor(precacheController: PrecacheController, options?: PrecacheRouteOptions);
|
|
18
|
-
}
|
|
19
|
-
export { PrecacheRoute };
|
|
20
|
-
//# sourceMappingURL=PrecacheRoute.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheRoute.d.ts","sourceRoot":"","sources":["../../src/precaching/PrecacheRoute.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;GAKG;AACH,cAAM,aAAc,SAAQ,KAAK;IAC/B;;;;;OAKG;gBACS,kBAAkB,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,oBAAoB;CAkBnF;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { SerwistPlugin } from "@serwist/core";
|
|
2
|
-
import type { StrategyOptions } from "../strategies/Strategy.js";
|
|
3
|
-
import { Strategy } from "../strategies/Strategy.js";
|
|
4
|
-
import type { StrategyHandler } from "../strategies/StrategyHandler.js";
|
|
5
|
-
interface PrecacheStrategyOptions extends StrategyOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Whether to attempt to get the response from the network
|
|
8
|
-
* if there's a precache miss.
|
|
9
|
-
*/
|
|
10
|
-
fallbackToNetwork?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A `@serwist/strategies.Strategy` implementation
|
|
14
|
-
* specifically designed to work with
|
|
15
|
-
* `@serwist/precaching.PrecacheController`
|
|
16
|
-
* to both cache and fetch precached assets.
|
|
17
|
-
*
|
|
18
|
-
* Note: an instance of this class is created automatically when creating a
|
|
19
|
-
* `PrecacheController`; it's generally not necessary to create this yourself.
|
|
20
|
-
*/
|
|
21
|
-
export declare class PrecacheStrategy extends Strategy {
|
|
22
|
-
private readonly _fallbackToNetwork;
|
|
23
|
-
static readonly defaultPrecacheCacheabilityPlugin: SerwistPlugin;
|
|
24
|
-
static readonly copyRedirectedCacheableResponsesPlugin: SerwistPlugin;
|
|
25
|
-
/**
|
|
26
|
-
* @param options
|
|
27
|
-
*/
|
|
28
|
-
constructor(options?: PrecacheStrategyOptions);
|
|
29
|
-
/**
|
|
30
|
-
* @private
|
|
31
|
-
* @param request A request to run this strategy for.
|
|
32
|
-
* @param handler The event that triggered the request.
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
_handle(request: Request, handler: StrategyHandler): Promise<Response>;
|
|
36
|
-
_handleFetch(request: Request, handler: StrategyHandler): Promise<Response>;
|
|
37
|
-
_handleInstall(request: Request, handler: StrategyHandler): Promise<Response>;
|
|
38
|
-
/**
|
|
39
|
-
* This method is complex, as there a number of things to account for:
|
|
40
|
-
*
|
|
41
|
-
* The `plugins` array can be set at construction, and/or it might be added to
|
|
42
|
-
* to at any time before the strategy is used.
|
|
43
|
-
*
|
|
44
|
-
* At the time the strategy is used (i.e. during an `install` event), there
|
|
45
|
-
* needs to be at least one plugin that implements `cacheWillUpdate` in the
|
|
46
|
-
* array, other than `copyRedirectedCacheableResponsesPlugin`.
|
|
47
|
-
*
|
|
48
|
-
* - If this method is called and there are no suitable `cacheWillUpdate`
|
|
49
|
-
* plugins, we need to add `defaultPrecacheCacheabilityPlugin`.
|
|
50
|
-
*
|
|
51
|
-
* - If this method is called and there is exactly one `cacheWillUpdate`, then
|
|
52
|
-
* we don't have to do anything (this might be a previously added
|
|
53
|
-
* `defaultPrecacheCacheabilityPlugin`, or it might be a custom plugin).
|
|
54
|
-
*
|
|
55
|
-
* - If this method is called and there is more than one `cacheWillUpdate`,
|
|
56
|
-
* then we need to check if one is `defaultPrecacheCacheabilityPlugin`. If so,
|
|
57
|
-
* we need to remove it. (This situation is unlikely, but it could happen if
|
|
58
|
-
* the strategy is used multiple times, the first without a `cacheWillUpdate`,
|
|
59
|
-
* and then later on after manually adding a custom `cacheWillUpdate`.)
|
|
60
|
-
*
|
|
61
|
-
* See https://github.com/GoogleChrome/workbox/issues/2737 for more context.
|
|
62
|
-
*
|
|
63
|
-
* @private
|
|
64
|
-
*/
|
|
65
|
-
_useDefaultCacheabilityPluginIfNeeded(): void;
|
|
66
|
-
}
|
|
67
|
-
export {};
|
|
68
|
-
//# sourceMappingURL=PrecacheStrategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheStrategy.d.ts","sourceRoot":"","sources":["../../src/precaching/PrecacheStrategy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,UAAU,uBAAwB,SAAQ,eAAe;IACvD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAU;IAE7C,MAAM,CAAC,QAAQ,CAAC,iCAAiC,EAAE,aAAa,CAQ9D;IAEF,MAAM,CAAC,QAAQ,CAAC,sCAAsC,EAAE,aAAa,CAInE;IAEF;;OAEG;gBACS,OAAO,GAAE,uBAA4B;IAajD;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiBtE,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAwE3E,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAoBnF;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,qCAAqC,IAAI,IAAI;CA4B9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addPlugins.d.ts","sourceRoot":"","sources":["../../src/precaching/addPlugins.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD;;;;GAIG;AACH,eAAO,MAAM,UAAU,YAAa,aAAa,EAAE,KAAG,IAGrD,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PrecacheRouteOptions } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Add a `fetch` listener to the service worker that will
|
|
4
|
-
* respond to
|
|
5
|
-
* [network requests](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests)
|
|
6
|
-
* with precached assets.
|
|
7
|
-
*
|
|
8
|
-
* Requests for assets that aren't precached, the `FetchEvent` will not be
|
|
9
|
-
* responded to, allowing the event to fall through to other `fetch` event
|
|
10
|
-
* listeners.
|
|
11
|
-
*
|
|
12
|
-
* @param options See the `@serwist/precaching.PrecacheRoute` options.
|
|
13
|
-
*/
|
|
14
|
-
export declare const addRoute: (options?: PrecacheRouteOptions) => void;
|
|
15
|
-
//# sourceMappingURL=addRoute.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addRoute.d.ts","sourceRoot":"","sources":["../../src/precaching/addRoute.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,aAAc,oBAAoB,KAAG,IAKzD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cleanupOutdatedCaches.d.ts","sourceRoot":"","sources":["../../src/precaching/cleanupOutdatedCaches.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,IAcxC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { RouteHandlerCallback } from "@serwist/core";
|
|
2
|
-
/**
|
|
3
|
-
* Helper function that calls `PrecacheController#createHandlerBoundToURL`
|
|
4
|
-
* on the default `PrecacheController` instance.
|
|
5
|
-
*
|
|
6
|
-
* If you are creating your own `PrecacheController`, then call the
|
|
7
|
-
* `PrecacheController#createHandlerBoundToURL` on that instance,
|
|
8
|
-
* instead of using this function.
|
|
9
|
-
*
|
|
10
|
-
* @param url The precached URL which will be used to lookup the
|
|
11
|
-
* `Response`.
|
|
12
|
-
* @param fallbackToNetwork Whether to attempt to get the
|
|
13
|
-
* response from the network if there's a precache miss.
|
|
14
|
-
* @return
|
|
15
|
-
*/
|
|
16
|
-
export declare const createHandlerBoundToURL: (url: string) => RouteHandlerCallback;
|
|
17
|
-
//# sourceMappingURL=createHandlerBoundToURL.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createHandlerBoundToURL.d.ts","sourceRoot":"","sources":["../../src/precaching/createHandlerBoundToURL.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAI1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,QAAS,MAAM,KAAG,oBAGrD,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Takes in a URL, and returns the corresponding URL that could be used to
|
|
3
|
-
* lookup the entry in the precache.
|
|
4
|
-
*
|
|
5
|
-
* If a relative URL is provided, the location of the service worker file will
|
|
6
|
-
* be used as the base.
|
|
7
|
-
*
|
|
8
|
-
* For precached entries without revision information, the cache key will be the
|
|
9
|
-
* same as the original URL.
|
|
10
|
-
*
|
|
11
|
-
* For precached entries with revision information, the cache key will be the
|
|
12
|
-
* original URL with the addition of a query parameter used for keeping track of
|
|
13
|
-
* the revision info.
|
|
14
|
-
*
|
|
15
|
-
* @param url The URL whose cache key to look up.
|
|
16
|
-
* @returns The cache key that corresponds to that URL.
|
|
17
|
-
*/
|
|
18
|
-
declare function getCacheKeyForURL(url: string): string | undefined;
|
|
19
|
-
export { getCacheKeyForURL };
|
|
20
|
-
//# sourceMappingURL=getCacheKeyForURL.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCacheKeyForURL.d.ts","sourceRoot":"","sources":["../../src/precaching/getCacheKeyForURL.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1D;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper function that calls `PrecacheController#matchPrecache`
|
|
3
|
-
* on the default `PrecacheController` instance.
|
|
4
|
-
*
|
|
5
|
-
* If you are creating your own `PrecacheController`, then call
|
|
6
|
-
* `PrecacheController#matchPrecache` on that instance,
|
|
7
|
-
* instead of using this function.
|
|
8
|
-
*
|
|
9
|
-
* @param request The key (without revisioning parameters)
|
|
10
|
-
* to look up in the precache.
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
export declare const matchPrecache: (request: string | Request) => Promise<Response | undefined>;
|
|
14
|
-
//# sourceMappingURL=matchPrecache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchPrecache.d.ts","sourceRoot":"","sources":["../../src/precaching/matchPrecache.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,YAAa,MAAM,GAAG,OAAO,KAAG,QAAQ,QAAQ,GAAG,SAAS,CAErF,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { PrecacheEntry } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Adds items to the precache list, removing any duplicates and
|
|
4
|
-
* stores the files in the precache cache when the service
|
|
5
|
-
* worker installs.
|
|
6
|
-
*
|
|
7
|
-
* This method can be called multiple times.
|
|
8
|
-
*
|
|
9
|
-
* Please note: This method **will not** serve any of the cached files for you.
|
|
10
|
-
* It only precaches files. To respond to a network request you call
|
|
11
|
-
* `@serwist/precaching.addRoute`.
|
|
12
|
-
*
|
|
13
|
-
* If you have a single array of files to precache, you can just call
|
|
14
|
-
* `@serwist/precaching.precacheAndRoute`.
|
|
15
|
-
*
|
|
16
|
-
* @param entries Array of entries to precache.
|
|
17
|
-
*/
|
|
18
|
-
export declare const precache: (entries: (PrecacheEntry | string)[]) => void;
|
|
19
|
-
//# sourceMappingURL=precache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"precache.d.ts","sourceRoot":"","sources":["../../src/precaching/precache.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,YAAa,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,KAAG,IAG9D,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { PrecacheEntry, PrecacheRouteOptions } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* This method will add entries to the precache list and add a route to
|
|
4
|
-
* respond to fetch events.
|
|
5
|
-
*
|
|
6
|
-
* This is a convenience method that will call
|
|
7
|
-
* `@serwist/precaching.precache` and
|
|
8
|
-
* `@serwist/precaching.addRoute` in a single call.
|
|
9
|
-
*
|
|
10
|
-
* @param entries Array of entries to precache.
|
|
11
|
-
* @param options See the `@serwist/precaching.PrecacheRoute` options.
|
|
12
|
-
*/
|
|
13
|
-
export declare const precacheAndRoute: (entries: (PrecacheEntry | string)[], options?: PrecacheRouteOptions) => void;
|
|
14
|
-
//# sourceMappingURL=precacheAndRoute.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"precacheAndRoute.d.ts","sourceRoot":"","sources":["../../src/precaching/precacheAndRoute.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,YAAa,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,YAAY,oBAAoB,KAAG,IAGtG,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { PrecacheController } from "./PrecacheController.js";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a new, singleton `PrecacheController` if one does not exist. If one does
|
|
4
|
-
* already exist, that instance is returned. This instance is used by Serwist's
|
|
5
|
-
* `PrecacheController`-dependent functions and classes unless you provide a different
|
|
6
|
-
* `Router` to them.
|
|
7
|
-
*
|
|
8
|
-
* @returns The singleton `PrecacheController`.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getSingletonPrecacheController: () => PrecacheController;
|
|
11
|
-
/**
|
|
12
|
-
* Changes the singleton `PrecacheController` to a different instance. This is meant for when you do not
|
|
13
|
-
* want to pass your own `PrecacheController` to every one of Serwist's `PrecacheController`-dependent
|
|
14
|
-
* functions and classes.
|
|
15
|
-
*
|
|
16
|
-
* It is highly recommended that you call this before anything else, if you plan on doing so.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```js
|
|
20
|
-
* import { PrecacheController, setSingletonPrecacheController } from "@serwist/sw/precaching";
|
|
21
|
-
*
|
|
22
|
-
* const controller = new PrecacheController();
|
|
23
|
-
*
|
|
24
|
-
* setSingletonPrecacheController(controller);
|
|
25
|
-
*
|
|
26
|
-
* // Do something with your controller...
|
|
27
|
-
*
|
|
28
|
-
* // This class now automatically picks up your `PrecacheController`! Without `setSingletonPrecacheController`,
|
|
29
|
-
* // you'd need to write this instead: `new Serwist({ controller })`
|
|
30
|
-
* const serwist = new Serwist();
|
|
31
|
-
*
|
|
32
|
-
* serwist.install();
|
|
33
|
-
* ```
|
|
34
|
-
* @param router
|
|
35
|
-
* @returns The new singleton `PrecacheController`.
|
|
36
|
-
*/
|
|
37
|
-
export declare const setSingletonPrecacheController: (precacheController: PrecacheController) => PrecacheController;
|
|
38
|
-
//# sourceMappingURL=singletonPrecacheController.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"singletonPrecacheController.d.ts","sourceRoot":"","sources":["../../src/precaching/singletonPrecacheController.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAI7D;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,QAAO,kBAKjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,8BAA8B,uBAAwB,kBAAkB,KAAG,kBAGvF,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface InstallResult {
|
|
2
|
-
updatedURLs: string[];
|
|
3
|
-
notUpdatedURLs: string[];
|
|
4
|
-
}
|
|
5
|
-
export interface CleanupResult {
|
|
6
|
-
deletedCacheRequests: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare interface PrecacheEntry {
|
|
9
|
-
integrity?: string;
|
|
10
|
-
url: string;
|
|
11
|
-
revision?: string | null;
|
|
12
|
-
}
|
|
13
|
-
export interface PrecacheRouteOptions {
|
|
14
|
-
/**
|
|
15
|
-
* The `directoryIndex` will check cache entries for a URL ending with '/'
|
|
16
|
-
* to see if there is a hit when appending the `directoryIndex` value.
|
|
17
|
-
*/
|
|
18
|
-
directoryIndex?: string | null;
|
|
19
|
-
/**
|
|
20
|
-
* An array of RegExp's to remove search params when looking for a cache match.
|
|
21
|
-
*/
|
|
22
|
-
ignoreURLParametersMatching?: RegExp[];
|
|
23
|
-
/**
|
|
24
|
-
* The `cleanURLs` option will check the cache for the URL with a `.html` added
|
|
25
|
-
* to the end of the end.
|
|
26
|
-
*/
|
|
27
|
-
cleanURLs?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* This is a function that should take a URL and return an array of
|
|
30
|
-
* alternative URLs that should be checked for precache matches.
|
|
31
|
-
*/
|
|
32
|
-
urlManipulation?: UrlManipulation;
|
|
33
|
-
}
|
|
34
|
-
export type UrlManipulation = ({ url }: {
|
|
35
|
-
url: URL;
|
|
36
|
-
}) => URL[];
|
|
37
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/precaching/types.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,WAAW,aAAa;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { SerwistPlugin } from "@serwist/core";
|
|
2
|
-
import type { PrecacheController } from "../PrecacheController.js";
|
|
3
|
-
/**
|
|
4
|
-
* A plugin, designed to be used with PrecacheController, to translate URLs into
|
|
5
|
-
* the corresponding cache key, based on the current revision info.
|
|
6
|
-
*
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
declare class PrecacheCacheKeyPlugin implements SerwistPlugin {
|
|
10
|
-
private readonly _precacheController;
|
|
11
|
-
constructor({ precacheController }: {
|
|
12
|
-
precacheController: PrecacheController;
|
|
13
|
-
});
|
|
14
|
-
cacheKeyWillBeUsed: SerwistPlugin["cacheKeyWillBeUsed"];
|
|
15
|
-
}
|
|
16
|
-
export { PrecacheCacheKeyPlugin };
|
|
17
|
-
//# sourceMappingURL=PrecacheCacheKeyPlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheCacheKeyPlugin.d.ts","sourceRoot":"","sources":["../../../src/precaching/utils/PrecacheCacheKeyPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAA8B,MAAM,eAAe,CAAC;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;GAKG;AACH,cAAM,sBAAuB,YAAW,aAAa;IACnD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;gBAE7C,EAAE,kBAAkB,EAAE,EAAE;QAAE,kBAAkB,EAAE,kBAAkB,CAAA;KAAE;IAI9E,kBAAkB,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAOrD;CACH;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { SerwistPlugin } from "@serwist/core";
|
|
2
|
-
/**
|
|
3
|
-
* A plugin, designed to be used with PrecacheController, to determine the
|
|
4
|
-
* of assets that were updated (or not updated) during the install event.
|
|
5
|
-
*
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
declare class PrecacheInstallReportPlugin implements SerwistPlugin {
|
|
9
|
-
updatedURLs: string[];
|
|
10
|
-
notUpdatedURLs: string[];
|
|
11
|
-
handlerWillStart: SerwistPlugin["handlerWillStart"];
|
|
12
|
-
cachedResponseWillBeUsed: SerwistPlugin["cachedResponseWillBeUsed"];
|
|
13
|
-
}
|
|
14
|
-
export { PrecacheInstallReportPlugin };
|
|
15
|
-
//# sourceMappingURL=PrecacheInstallReportPlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheInstallReportPlugin.d.ts","sourceRoot":"","sources":["../../../src/precaching/utils/PrecacheInstallReportPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAA8B,MAAM,eAAe,CAAC;AAE/E;;;;;GAKG;AACH,cAAM,2BAA4B,YAAW,aAAa;IACxD,WAAW,EAAE,MAAM,EAAE,CAAM;IAC3B,cAAc,EAAE,MAAM,EAAE,CAAM;IAE9B,gBAAgB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAKjD;IAEF,wBAAwB,EAAE,aAAa,CAAC,0BAA0B,CAAC,CAkBjE;CACH;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PrecacheEntry } from "../types.js";
|
|
2
|
-
interface CacheKey {
|
|
3
|
-
cacheKey: string;
|
|
4
|
-
url: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Converts a manifest entry into a versioned URL suitable for precaching.
|
|
8
|
-
*
|
|
9
|
-
* @param entry
|
|
10
|
-
* @returns A URL with versioning info.
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
export declare function createCacheKey(entry: PrecacheEntry | string): CacheKey;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=createCacheKey.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createCacheKey.d.ts","sourceRoot":"","sources":["../../../src/precaching/utils/createCacheKey.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,UAAU,QAAQ;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAKD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,QAAQ,CAuCtE"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cleans up incompatible precaches that were created by older versions of
|
|
3
|
-
* Serwist, by a service worker registered under the current scope.
|
|
4
|
-
*
|
|
5
|
-
* This is meant to be called as part of the `activate` event.
|
|
6
|
-
*
|
|
7
|
-
* This should be safe to use as long as you don't include `substringToFind`
|
|
8
|
-
* (defaulting to `-precache-`) in your non-precache cache names.
|
|
9
|
-
*
|
|
10
|
-
* @param currentPrecacheName The cache name currently in use for
|
|
11
|
-
* precaching. This cache won't be deleted.
|
|
12
|
-
* @param substringToFind Cache names which include this
|
|
13
|
-
* substring will be deleted (excluding `currentPrecacheName`).
|
|
14
|
-
* @returns A list of all the cache names that were deleted.
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
17
|
-
export declare const deleteOutdatedCaches: (currentPrecacheName: string, substringToFind?: string) => Promise<string[]>;
|
|
18
|
-
//# sourceMappingURL=deleteOutdatedCaches.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteOutdatedCaches.d.ts","sourceRoot":"","sources":["../../../src/precaching/utils/deleteOutdatedCaches.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,wBAA+B,MAAM,oBAAmB,MAAM,KAAuB,QAAQ,MAAM,EAAE,CAUrI,CAAC"}
|