@serwist/precaching 9.0.0-preview.17 → 9.0.0-preview.18
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 +5 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -155
- package/package.json +3 -17
- package/src/index.ts +5 -39
- package/dist/PrecacheController.d.ts +0 -146
- package/dist/PrecacheController.d.ts.map +0 -1
- package/dist/PrecacheFallbackPlugin.d.ts +0 -54
- package/dist/PrecacheFallbackPlugin.d.ts.map +0 -1
- package/dist/PrecacheRoute.d.ts +0 -20
- package/dist/PrecacheRoute.d.ts.map +0 -1
- package/dist/PrecacheStrategy.d.ts +0 -67
- package/dist/PrecacheStrategy.d.ts.map +0 -1
- package/dist/_types.d.ts +0 -37
- package/dist/_types.d.ts.map +0 -1
- package/dist/addPlugins.d.ts +0 -9
- package/dist/addPlugins.d.ts.map +0 -1
- package/dist/addRoute.d.ts +0 -15
- package/dist/addRoute.d.ts.map +0 -1
- package/dist/chunks/getOrCreatePrecacheController.js +0 -436
- package/dist/cleanupOutdatedCaches.d.ts +0 -6
- package/dist/cleanupOutdatedCaches.d.ts.map +0 -1
- package/dist/createHandlerBoundToURL.d.ts +0 -17
- package/dist/createHandlerBoundToURL.d.ts.map +0 -1
- package/dist/getCacheKeyForURL.d.ts +0 -20
- package/dist/getCacheKeyForURL.d.ts.map +0 -1
- package/dist/index.internal.d.ts +0 -3
- package/dist/index.internal.d.ts.map +0 -1
- package/dist/index.internal.js +0 -4
- package/dist/matchPrecache.d.ts +0 -15
- package/dist/matchPrecache.d.ts.map +0 -1
- package/dist/precache.d.ts +0 -19
- package/dist/precache.d.ts.map +0 -1
- package/dist/precacheAndRoute.d.ts +0 -14
- package/dist/precacheAndRoute.d.ts.map +0 -1
- package/dist/utils/PrecacheCacheKeyPlugin.d.ts +0 -17
- package/dist/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
- package/dist/utils/PrecacheInstallReportPlugin.d.ts +0 -15
- package/dist/utils/PrecacheInstallReportPlugin.d.ts.map +0 -1
- package/dist/utils/createCacheKey.d.ts +0 -16
- package/dist/utils/createCacheKey.d.ts.map +0 -1
- package/dist/utils/deleteOutdatedCaches.d.ts +0 -18
- package/dist/utils/deleteOutdatedCaches.d.ts.map +0 -1
- package/dist/utils/generateURLVariations.d.ts +0 -12
- package/dist/utils/generateURLVariations.d.ts.map +0 -1
- package/dist/utils/getCacheKeyForURL.d.ts +0 -14
- package/dist/utils/getCacheKeyForURL.d.ts.map +0 -1
- package/dist/utils/getOrCreatePrecacheController.d.ts +0 -7
- package/dist/utils/getOrCreatePrecacheController.d.ts.map +0 -1
- package/dist/utils/printCleanupDetails.d.ts +0 -6
- package/dist/utils/printCleanupDetails.d.ts.map +0 -1
- package/dist/utils/printInstallDetails.d.ts +0 -7
- package/dist/utils/printInstallDetails.d.ts.map +0 -1
- package/dist/utils/removeIgnoredSearchParams.d.ts +0 -12
- package/dist/utils/removeIgnoredSearchParams.d.ts.map +0 -1
- package/src/PrecacheController.ts +0 -344
- package/src/PrecacheFallbackPlugin.ts +0 -86
- package/src/PrecacheRoute.ts +0 -50
- package/src/PrecacheStrategy.ts +0 -239
- package/src/_types.ts +0 -46
- package/src/addPlugins.ts +0 -23
- package/src/addRoute.ts +0 -31
- package/src/cleanupOutdatedCaches.ts +0 -33
- package/src/createHandlerBoundToURL.ts +0 -30
- package/src/getCacheKeyForURL.ts +0 -33
- package/src/index.internal.ts +0 -3
- package/src/matchPrecache.ts +0 -28
- package/src/precache.ts +0 -31
- package/src/precacheAndRoute.ts +0 -27
- package/src/utils/PrecacheCacheKeyPlugin.ts +0 -36
- package/src/utils/PrecacheInstallReportPlugin.ts +0 -49
- package/src/utils/createCacheKey.ts +0 -68
- package/src/utils/deleteOutdatedCaches.ts +0 -40
- package/src/utils/generateURLVariations.ts +0 -55
- package/src/utils/getCacheKeyForURL.ts +0 -36
- package/src/utils/getOrCreatePrecacheController.ts +0 -22
- package/src/utils/printCleanupDetails.ts +0 -38
- package/src/utils/printInstallDetails.ts +0 -53
- package/src/utils/removeIgnoredSearchParams.ts +0 -29
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { addPlugins } from "./addPlugins.js";
|
|
7
|
-
import { addRoute } from "./addRoute.js";
|
|
8
|
-
import { cleanupOutdatedCaches } from "./cleanupOutdatedCaches.js";
|
|
9
|
-
import { createHandlerBoundToURL } from "./createHandlerBoundToURL.js";
|
|
10
|
-
import { getCacheKeyForURL } from "./getCacheKeyForURL.js";
|
|
11
|
-
import { matchPrecache } from "./matchPrecache.js";
|
|
12
|
-
import { precache } from "./precache.js";
|
|
13
|
-
import { precacheAndRoute } from "./precacheAndRoute.js";
|
|
14
|
-
/**
|
|
15
|
-
* Most consumers of this module will want to use the
|
|
16
|
-
* `@serwist/precaching.precacheAndRoute`
|
|
17
|
-
* method to add assets to the cache and respond to network requests with these
|
|
18
|
-
* cached assets.
|
|
19
|
-
*
|
|
20
|
-
* If you require more control over caching and routing, you can use the
|
|
21
|
-
* `@serwist/precaching.PrecacheController`
|
|
22
|
-
* interface.
|
|
23
|
-
*/
|
|
24
|
-
export { addPlugins, addRoute, cleanupOutdatedCaches, createHandlerBoundToURL, getCacheKeyForURL, matchPrecache, precache, precacheAndRoute, PrecacheController, PrecacheFallbackPlugin, PrecacheRoute, PrecacheStrategy, };
|
|
25
|
-
export type * from "./_types.js";
|
|
26
|
-
export type { PrecacheFallbackPluginOptions, PrecacheFallbackEntry };
|
|
1
|
+
export { addPlugins, addRoute, cleanupOutdatedCaches, createHandlerBoundToURL, getCacheKeyForURL, matchPrecache, precache, precacheAndRoute, PrecacheController, PrecacheRoute, PrecacheStrategy, } from "@serwist/sw/precaching";
|
|
2
|
+
export { PrecacheFallbackPlugin } from "@serwist/sw/plugins";
|
|
3
|
+
export type * from "@serwist/sw/precaching";
|
|
4
|
+
export type { UrlManipulation as urlManipulation } from "@serwist/sw/precaching";
|
|
5
|
+
export type { PrecacheFallbackEntry, PrecacheFallbackPluginOptions } from "@serwist/sw/plugins";
|
|
27
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,mBAAmB,wBAAwB,CAAC;AAC5C,YAAY,EAAE,eAAe,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,155 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import { logger, getFriendlyURL, privateCacheNames } from '@serwist/core/internal';
|
|
4
|
-
import { Route, registerRoute } from '@serwist/routing';
|
|
5
|
-
import '@serwist/core';
|
|
6
|
-
import '@serwist/strategies';
|
|
7
|
-
|
|
8
|
-
class PrecacheFallbackPlugin {
|
|
9
|
-
_fallbackUrls;
|
|
10
|
-
_precacheController;
|
|
11
|
-
constructor({ fallbackUrls, precacheController }){
|
|
12
|
-
this._fallbackUrls = fallbackUrls;
|
|
13
|
-
this._precacheController = precacheController || getOrCreatePrecacheController();
|
|
14
|
-
}
|
|
15
|
-
async handlerDidError(param) {
|
|
16
|
-
for (const fallback of this._fallbackUrls){
|
|
17
|
-
if (typeof fallback === "string") {
|
|
18
|
-
const fallbackResponse = await this._precacheController.matchPrecache(fallback);
|
|
19
|
-
if (fallbackResponse !== undefined) {
|
|
20
|
-
return fallbackResponse;
|
|
21
|
-
}
|
|
22
|
-
} else if (fallback.matcher(param)) {
|
|
23
|
-
const fallbackResponse = await this._precacheController.matchPrecache(fallback.url);
|
|
24
|
-
if (fallbackResponse !== undefined) {
|
|
25
|
-
return fallbackResponse;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function removeIgnoredSearchParams(urlObject, ignoreURLParametersMatching = []) {
|
|
34
|
-
for (const paramName of [
|
|
35
|
-
...urlObject.searchParams.keys()
|
|
36
|
-
]){
|
|
37
|
-
if (ignoreURLParametersMatching.some((regExp)=>regExp.test(paramName))) {
|
|
38
|
-
urlObject.searchParams.delete(paramName);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return urlObject;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function* generateURLVariations(url, { ignoreURLParametersMatching = [
|
|
45
|
-
/^utm_/,
|
|
46
|
-
/^fbclid$/
|
|
47
|
-
], directoryIndex = "index.html", cleanURLs = true, urlManipulation } = {}) {
|
|
48
|
-
const urlObject = new URL(url, location.href);
|
|
49
|
-
urlObject.hash = "";
|
|
50
|
-
yield urlObject.href;
|
|
51
|
-
const urlWithoutIgnoredParams = removeIgnoredSearchParams(urlObject, ignoreURLParametersMatching);
|
|
52
|
-
yield urlWithoutIgnoredParams.href;
|
|
53
|
-
if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith("/")) {
|
|
54
|
-
const directoryURL = new URL(urlWithoutIgnoredParams.href);
|
|
55
|
-
directoryURL.pathname += directoryIndex;
|
|
56
|
-
yield directoryURL.href;
|
|
57
|
-
}
|
|
58
|
-
if (cleanURLs) {
|
|
59
|
-
const cleanURL = new URL(urlWithoutIgnoredParams.href);
|
|
60
|
-
cleanURL.pathname += ".html";
|
|
61
|
-
yield cleanURL.href;
|
|
62
|
-
}
|
|
63
|
-
if (urlManipulation) {
|
|
64
|
-
const additionalURLs = urlManipulation({
|
|
65
|
-
url: urlObject
|
|
66
|
-
});
|
|
67
|
-
for (const urlToAttempt of additionalURLs){
|
|
68
|
-
yield urlToAttempt.href;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
class PrecacheRoute extends Route {
|
|
74
|
-
constructor(precacheController, options){
|
|
75
|
-
const match = ({ request })=>{
|
|
76
|
-
const urlsToCacheKeys = precacheController.getURLsToCacheKeys();
|
|
77
|
-
for (const possibleURL of generateURLVariations(request.url, options)){
|
|
78
|
-
const cacheKey = urlsToCacheKeys.get(possibleURL);
|
|
79
|
-
if (cacheKey) {
|
|
80
|
-
const integrity = precacheController.getIntegrityForCacheKey(cacheKey);
|
|
81
|
-
return {
|
|
82
|
-
cacheKey,
|
|
83
|
-
integrity
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (process.env.NODE_ENV !== "production") {
|
|
88
|
-
logger.debug(`Precaching did not find a match for ${getFriendlyURL(request.url)}`);
|
|
89
|
-
}
|
|
90
|
-
return;
|
|
91
|
-
};
|
|
92
|
-
super(match, precacheController.strategy);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function addPlugins(plugins) {
|
|
97
|
-
const precacheController = getOrCreatePrecacheController();
|
|
98
|
-
precacheController.strategy.plugins.push(...plugins);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const addRoute = (options)=>{
|
|
102
|
-
const precacheController = getOrCreatePrecacheController();
|
|
103
|
-
const precacheRoute = new PrecacheRoute(precacheController, options);
|
|
104
|
-
registerRoute(precacheRoute);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const SUBSTRING_TO_FIND = "-precache-";
|
|
108
|
-
const deleteOutdatedCaches = async (currentPrecacheName, substringToFind = SUBSTRING_TO_FIND)=>{
|
|
109
|
-
const cacheNames = await self.caches.keys();
|
|
110
|
-
const cacheNamesToDelete = cacheNames.filter((cacheName)=>{
|
|
111
|
-
return cacheName.includes(substringToFind) && cacheName.includes(self.registration.scope) && cacheName !== currentPrecacheName;
|
|
112
|
-
});
|
|
113
|
-
await Promise.all(cacheNamesToDelete.map((cacheName)=>self.caches.delete(cacheName)));
|
|
114
|
-
return cacheNamesToDelete;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const cleanupOutdatedCaches = ()=>{
|
|
118
|
-
self.addEventListener("activate", (event)=>{
|
|
119
|
-
const cacheName = privateCacheNames.getPrecacheName();
|
|
120
|
-
event.waitUntil(deleteOutdatedCaches(cacheName).then((cachesDeleted)=>{
|
|
121
|
-
if (process.env.NODE_ENV !== "production") {
|
|
122
|
-
if (cachesDeleted.length > 0) {
|
|
123
|
-
logger.log("The following out-of-date precaches were cleaned up automatically:", cachesDeleted);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}));
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const createHandlerBoundToURL = (url)=>{
|
|
131
|
-
const precacheController = getOrCreatePrecacheController();
|
|
132
|
-
return precacheController.createHandlerBoundToURL(url);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
function getCacheKeyForURL(url) {
|
|
136
|
-
const precacheController = getOrCreatePrecacheController();
|
|
137
|
-
return precacheController.getCacheKeyForURL(url);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function matchPrecache(request) {
|
|
141
|
-
const precacheController = getOrCreatePrecacheController();
|
|
142
|
-
return precacheController.matchPrecache(request);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const precache = (entries)=>{
|
|
146
|
-
const precacheController = getOrCreatePrecacheController();
|
|
147
|
-
precacheController.precache(entries);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const precacheAndRoute = (entries, options)=>{
|
|
151
|
-
precache(entries);
|
|
152
|
-
addRoute(options);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export { PrecacheFallbackPlugin, PrecacheRoute, addPlugins, addRoute, cleanupOutdatedCaches, createHandlerBoundToURL, getCacheKeyForURL, matchPrecache, precache, precacheAndRoute };
|
|
1
|
+
export { PrecacheController, PrecacheRoute, PrecacheStrategy, addPlugins, addRoute, cleanupOutdatedCaches, createHandlerBoundToURL, getCacheKeyForURL, matchPrecache, precache, precacheAndRoute } from '@serwist/sw/precaching';
|
|
2
|
+
export { PrecacheFallbackPlugin } from '@serwist/sw/plugins';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/precaching",
|
|
3
|
-
"version": "9.0.0-preview.
|
|
3
|
+
"version": "9.0.0-preview.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that efficiently precaches assets.",
|
|
6
6
|
"files": [
|
|
@@ -20,34 +20,20 @@
|
|
|
20
20
|
"homepage": "https://serwist.pages.dev",
|
|
21
21
|
"main": "./dist/index.js",
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"*": {
|
|
25
|
-
"internal": [
|
|
26
|
-
"./dist/index.internal.d.ts"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
23
|
"exports": {
|
|
31
24
|
".": {
|
|
32
25
|
"types": "./dist/index.d.ts",
|
|
33
26
|
"default": "./dist/index.js"
|
|
34
27
|
},
|
|
35
|
-
"./internal": {
|
|
36
|
-
"types": "./dist/index.internal.d.ts",
|
|
37
|
-
"default": "./dist/index.internal.js"
|
|
38
|
-
},
|
|
39
28
|
"./package.json": "./package.json"
|
|
40
29
|
},
|
|
41
30
|
"dependencies": {
|
|
42
|
-
"@serwist/
|
|
43
|
-
"@serwist/routing": "9.0.0-preview.17",
|
|
44
|
-
"@serwist/strategies": "9.0.0-preview.17"
|
|
31
|
+
"@serwist/sw": "9.0.0-preview.18"
|
|
45
32
|
},
|
|
46
33
|
"devDependencies": {
|
|
47
34
|
"rollup": "4.13.0",
|
|
48
35
|
"typescript": "5.5.0-dev.20240323",
|
|
49
|
-
"@serwist/constants": "9.0.0-preview.
|
|
50
|
-
"@serwist/utils": "9.0.0-preview.17"
|
|
36
|
+
"@serwist/constants": "9.0.0-preview.18"
|
|
51
37
|
},
|
|
52
38
|
"peerDependencies": {
|
|
53
39
|
"typescript": ">=5.0.0"
|
package/src/index.ts
CHANGED
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2018 Google LLC
|
|
3
|
-
|
|
4
|
-
Use of this source code is governed by an MIT-style
|
|
5
|
-
license that can be found in the LICENSE file or at
|
|
6
|
-
https://opensource.org/licenses/MIT.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { PrecacheController } from "./PrecacheController.js";
|
|
10
|
-
import { PrecacheFallbackPlugin } from "./PrecacheFallbackPlugin.js";
|
|
11
|
-
import type { PrecacheFallbackEntry, PrecacheFallbackPluginOptions } from "./PrecacheFallbackPlugin.js";
|
|
12
|
-
import { PrecacheRoute } from "./PrecacheRoute.js";
|
|
13
|
-
import { PrecacheStrategy } from "./PrecacheStrategy.js";
|
|
14
|
-
import { addPlugins } from "./addPlugins.js";
|
|
15
|
-
import { addRoute } from "./addRoute.js";
|
|
16
|
-
import { cleanupOutdatedCaches } from "./cleanupOutdatedCaches.js";
|
|
17
|
-
import { createHandlerBoundToURL } from "./createHandlerBoundToURL.js";
|
|
18
|
-
import { getCacheKeyForURL } from "./getCacheKeyForURL.js";
|
|
19
|
-
import { matchPrecache } from "./matchPrecache.js";
|
|
20
|
-
import { precache } from "./precache.js";
|
|
21
|
-
import { precacheAndRoute } from "./precacheAndRoute.js";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Most consumers of this module will want to use the
|
|
25
|
-
* `@serwist/precaching.precacheAndRoute`
|
|
26
|
-
* method to add assets to the cache and respond to network requests with these
|
|
27
|
-
* cached assets.
|
|
28
|
-
*
|
|
29
|
-
* If you require more control over caching and routing, you can use the
|
|
30
|
-
* `@serwist/precaching.PrecacheController`
|
|
31
|
-
* interface.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
1
|
export {
|
|
35
2
|
addPlugins,
|
|
36
3
|
addRoute,
|
|
@@ -41,11 +8,10 @@ export {
|
|
|
41
8
|
precache,
|
|
42
9
|
precacheAndRoute,
|
|
43
10
|
PrecacheController,
|
|
44
|
-
PrecacheFallbackPlugin,
|
|
45
11
|
PrecacheRoute,
|
|
46
12
|
PrecacheStrategy,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type * from "
|
|
50
|
-
|
|
51
|
-
export type {
|
|
13
|
+
} from "@serwist/sw/precaching";
|
|
14
|
+
export { PrecacheFallbackPlugin } from "@serwist/sw/plugins";
|
|
15
|
+
export type * from "@serwist/sw/precaching";
|
|
16
|
+
export type { UrlManipulation as urlManipulation } from "@serwist/sw/precaching";
|
|
17
|
+
export type { PrecacheFallbackEntry, PrecacheFallbackPluginOptions } from "@serwist/sw/plugins";
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type { RouteHandlerCallback, SerwistPlugin } from "@serwist/core";
|
|
2
|
-
import type { Strategy } from "@serwist/strategies";
|
|
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
|
-
* By default, this value is set to 1, but this can be overriden by
|
|
22
|
-
* setting this option or `self.__WB_CONCURRENT_PRECACHING`. The former takes
|
|
23
|
-
* precedence over the latter.
|
|
24
|
-
*/
|
|
25
|
-
concurrentPrecaching?: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Performs efficient precaching of assets.
|
|
29
|
-
*/
|
|
30
|
-
export declare class PrecacheController {
|
|
31
|
-
private _installAndActiveListenersAdded?;
|
|
32
|
-
private _concurrentPrecaching;
|
|
33
|
-
private readonly _strategy;
|
|
34
|
-
private readonly _urlsToCacheKeys;
|
|
35
|
-
private readonly _urlsToCacheModes;
|
|
36
|
-
private readonly _cacheKeysToIntegrities;
|
|
37
|
-
/**
|
|
38
|
-
* Create a new PrecacheController.
|
|
39
|
-
*
|
|
40
|
-
* @param options
|
|
41
|
-
*/
|
|
42
|
-
constructor({ cacheName, plugins, fallbackToNetwork, concurrentPrecaching }?: PrecacheControllerOptions);
|
|
43
|
-
/**
|
|
44
|
-
* The strategy created by this controller and
|
|
45
|
-
* used to cache assets and respond to fetch events.
|
|
46
|
-
*/
|
|
47
|
-
get strategy(): Strategy;
|
|
48
|
-
/**
|
|
49
|
-
* Adds items to the precache list, removing any duplicates and
|
|
50
|
-
* stores the files in the precache cache when the service
|
|
51
|
-
* worker installs.
|
|
52
|
-
*
|
|
53
|
-
* This method can be called multiple times.
|
|
54
|
-
*
|
|
55
|
-
* @param entries Array of entries to precache.
|
|
56
|
-
*/
|
|
57
|
-
precache(entries: (PrecacheEntry | string)[]): void;
|
|
58
|
-
/**
|
|
59
|
-
* This method will add items to the precache list, removing duplicates
|
|
60
|
-
* and ensuring the information is valid.
|
|
61
|
-
*
|
|
62
|
-
* @param entries Array of entries to precache.
|
|
63
|
-
*/
|
|
64
|
-
addToCacheList(entries: (PrecacheEntry | string)[]): void;
|
|
65
|
-
/**
|
|
66
|
-
* Precaches new and updated assets. Call this method from the service worker
|
|
67
|
-
* install event.
|
|
68
|
-
*
|
|
69
|
-
* Note: this method calls `event.waitUntil()` for you, so you do not need
|
|
70
|
-
* to call it yourself in your event handlers.
|
|
71
|
-
*
|
|
72
|
-
* @param event
|
|
73
|
-
* @returns
|
|
74
|
-
*/
|
|
75
|
-
install(event: ExtendableEvent): Promise<InstallResult>;
|
|
76
|
-
/**
|
|
77
|
-
* Deletes assets that are no longer present in the current precache manifest.
|
|
78
|
-
* Call this method from the service worker activate event.
|
|
79
|
-
*
|
|
80
|
-
* Note: this method calls `event.waitUntil()` for you, so you do not need
|
|
81
|
-
* to call it yourself in your event handlers.
|
|
82
|
-
*
|
|
83
|
-
* @param event
|
|
84
|
-
* @returns
|
|
85
|
-
*/
|
|
86
|
-
activate(event: ExtendableEvent): Promise<CleanupResult>;
|
|
87
|
-
/**
|
|
88
|
-
* Returns a mapping of a precached URL to the corresponding cache key, taking
|
|
89
|
-
* into account the revision information for the URL.
|
|
90
|
-
*
|
|
91
|
-
* @returns A URL to cache key mapping.
|
|
92
|
-
*/
|
|
93
|
-
getURLsToCacheKeys(): Map<string, string>;
|
|
94
|
-
/**
|
|
95
|
-
* Returns a list of all the URLs that have been precached by the current
|
|
96
|
-
* service worker.
|
|
97
|
-
*
|
|
98
|
-
* @returns The precached URLs.
|
|
99
|
-
*/
|
|
100
|
-
getCachedURLs(): string[];
|
|
101
|
-
/**
|
|
102
|
-
* Returns the cache key used for storing a given URL. If that URL is
|
|
103
|
-
* unversioned, like `/index.html', then the cache key will be the original
|
|
104
|
-
* URL with a search parameter appended to it.
|
|
105
|
-
*
|
|
106
|
-
* @param url A URL whose cache key you want to look up.
|
|
107
|
-
* @returns The versioned URL that corresponds to a cache key
|
|
108
|
-
* for the original URL, or undefined if that URL isn't precached.
|
|
109
|
-
*/
|
|
110
|
-
getCacheKeyForURL(url: string): string | undefined;
|
|
111
|
-
/**
|
|
112
|
-
* @param url A cache key whose SRI you want to look up.
|
|
113
|
-
* @returns The subresource integrity associated with the cache key,
|
|
114
|
-
* or undefined if it's not set.
|
|
115
|
-
*/
|
|
116
|
-
getIntegrityForCacheKey(cacheKey: string): string | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* This acts as a drop-in replacement for
|
|
119
|
-
* [`cache.match()`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/match)
|
|
120
|
-
* with the following differences:
|
|
121
|
-
*
|
|
122
|
-
* - It knows what the name of the precache is, and only checks in that cache.
|
|
123
|
-
* - It allows you to pass in an "original" URL without versioning parameters,
|
|
124
|
-
* and it will automatically look up the correct cache key for the currently
|
|
125
|
-
* active revision of that URL.
|
|
126
|
-
*
|
|
127
|
-
* E.g., `matchPrecache('index.html')` will find the correct precached
|
|
128
|
-
* response for the currently active service worker, even if the actual cache
|
|
129
|
-
* key is `'/index.html?__WB_REVISION__=1234abcd'`.
|
|
130
|
-
*
|
|
131
|
-
* @param request The key (without revisioning parameters)
|
|
132
|
-
* to look up in the precache.
|
|
133
|
-
* @returns
|
|
134
|
-
*/
|
|
135
|
-
matchPrecache(request: string | Request): Promise<Response | undefined>;
|
|
136
|
-
/**
|
|
137
|
-
* Returns a function that looks up `url` in the precache (taking into
|
|
138
|
-
* account revision information), and returns the corresponding `Response`.
|
|
139
|
-
*
|
|
140
|
-
* @param url The precached URL which will be used to lookup the response.
|
|
141
|
-
* @return
|
|
142
|
-
*/
|
|
143
|
-
createHandlerBoundToURL(url: string): RouteHandlerCallback;
|
|
144
|
-
}
|
|
145
|
-
export {};
|
|
146
|
-
//# sourceMappingURL=PrecacheController.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheController.d.ts","sourceRoot":"","sources":["../src/PrecacheController.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAU/E,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;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,+BAA+B,CAAC,CAAU;IAClD,OAAO,CAAC,qBAAqB,CAAqB;IAClD,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,oBAAoB,EAAE,GAAE,yBAA8B;IAavH;;;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;IA4CvD;;;;;;;;;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,54 +0,0 @@
|
|
|
1
|
-
import type { HandlerDidErrorCallbackParam, SerwistPlugin } from "@serwist/core";
|
|
2
|
-
import type { PrecacheController } from "./PrecacheController.js";
|
|
3
|
-
export interface PrecacheFallbackEntry {
|
|
4
|
-
/**
|
|
5
|
-
* A function that checks whether the fallback entry can be used
|
|
6
|
-
* for a request.
|
|
7
|
-
*/
|
|
8
|
-
matcher: (param: HandlerDidErrorCallbackParam) => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* A precached URL to be used as a fallback.
|
|
11
|
-
*/
|
|
12
|
-
url: string;
|
|
13
|
-
}
|
|
14
|
-
export interface PrecacheFallbackPluginOptions {
|
|
15
|
-
/**
|
|
16
|
-
* Precached URLs to use as the fallback
|
|
17
|
-
* if the associated strategy can't generate a response.
|
|
18
|
-
*/
|
|
19
|
-
fallbackUrls: (string | PrecacheFallbackEntry)[];
|
|
20
|
-
/**
|
|
21
|
-
* An optional `PrecacheController` instance. If not provided, the default
|
|
22
|
-
* `PrecacheController` will be used.
|
|
23
|
-
*/
|
|
24
|
-
precacheController?: PrecacheController;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* `PrecacheFallbackPlugin` allows you to specify offline fallbacks
|
|
28
|
-
* to be used when a given strategy is unable to generate a response.
|
|
29
|
-
*
|
|
30
|
-
* It does this by intercepting the `handlerDidError` plugin callback
|
|
31
|
-
* and returning a precached response, taking the expected revision parameter
|
|
32
|
-
* into account automatically.
|
|
33
|
-
*
|
|
34
|
-
* Unless you explicitly pass in a `PrecacheController` instance to the
|
|
35
|
-
* constructor, the default instance will be used. Generally speaking, most
|
|
36
|
-
* developers will end up using the default.
|
|
37
|
-
*/
|
|
38
|
-
export declare class PrecacheFallbackPlugin implements SerwistPlugin {
|
|
39
|
-
private readonly _fallbackUrls;
|
|
40
|
-
private readonly _precacheController;
|
|
41
|
-
/**
|
|
42
|
-
* Constructs a new `PrecacheFallbackPlugin` with the associated `fallbackUrls`.
|
|
43
|
-
*
|
|
44
|
-
* @param config
|
|
45
|
-
*/
|
|
46
|
-
constructor({ fallbackUrls, precacheController }: PrecacheFallbackPluginOptions);
|
|
47
|
-
/**
|
|
48
|
-
* @returns The precache response for one of the fallback URLs, or `undefined` if
|
|
49
|
-
* nothing satisfies the conditions.
|
|
50
|
-
* @private
|
|
51
|
-
*/
|
|
52
|
-
handlerDidError(param: HandlerDidErrorCallbackParam): Promise<Response | undefined>;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=PrecacheFallbackPlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheFallbackPlugin.d.ts","sourceRoot":"","sources":["../src/PrecacheFallbackPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,OAAO,CAAC;IAC1D;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,YAAY,EAAE,CAAC,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAC;IACjD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,sBAAuB,YAAW,aAAa;IAC1D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqC;IACnE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD;;;;OAIG;gBACS,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAAE,6BAA6B;IAK/E;;;;OAIG;IACG,eAAe,CAAC,KAAK,EAAE,4BAA4B;CAgB1D"}
|
package/dist/PrecacheRoute.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Route } from "@serwist/routing";
|
|
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/PrecacheRoute.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxD;;;;;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,67 +0,0 @@
|
|
|
1
|
-
import type { SerwistPlugin } from "@serwist/core";
|
|
2
|
-
import type { StrategyHandler, StrategyOptions } from "@serwist/strategies";
|
|
3
|
-
import { Strategy } from "@serwist/strategies";
|
|
4
|
-
interface PrecacheStrategyOptions extends StrategyOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Whether to attempt to get the response from the network
|
|
7
|
-
* if there's a precache miss.
|
|
8
|
-
*/
|
|
9
|
-
fallbackToNetwork?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A `@serwist/strategies.Strategy` implementation
|
|
13
|
-
* specifically designed to work with
|
|
14
|
-
* `@serwist/precaching.PrecacheController`
|
|
15
|
-
* to both cache and fetch precached assets.
|
|
16
|
-
*
|
|
17
|
-
* Note: an instance of this class is created automatically when creating a
|
|
18
|
-
* `PrecacheController`; it's generally not necessary to create this yourself.
|
|
19
|
-
*/
|
|
20
|
-
declare class PrecacheStrategy extends Strategy {
|
|
21
|
-
private readonly _fallbackToNetwork;
|
|
22
|
-
static readonly defaultPrecacheCacheabilityPlugin: SerwistPlugin;
|
|
23
|
-
static readonly copyRedirectedCacheableResponsesPlugin: SerwistPlugin;
|
|
24
|
-
/**
|
|
25
|
-
* @param options
|
|
26
|
-
*/
|
|
27
|
-
constructor(options?: PrecacheStrategyOptions);
|
|
28
|
-
/**
|
|
29
|
-
* @private
|
|
30
|
-
* @param request A request to run this strategy for.
|
|
31
|
-
* @param handler The event that triggered the request.
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
_handle(request: Request, handler: StrategyHandler): Promise<Response>;
|
|
35
|
-
_handleFetch(request: Request, handler: StrategyHandler): Promise<Response>;
|
|
36
|
-
_handleInstall(request: Request, handler: StrategyHandler): Promise<Response>;
|
|
37
|
-
/**
|
|
38
|
-
* This method is complex, as there a number of things to account for:
|
|
39
|
-
*
|
|
40
|
-
* The `plugins` array can be set at construction, and/or it might be added to
|
|
41
|
-
* to at any time before the strategy is used.
|
|
42
|
-
*
|
|
43
|
-
* At the time the strategy is used (i.e. during an `install` event), there
|
|
44
|
-
* needs to be at least one plugin that implements `cacheWillUpdate` in the
|
|
45
|
-
* array, other than `copyRedirectedCacheableResponsesPlugin`.
|
|
46
|
-
*
|
|
47
|
-
* - If this method is called and there are no suitable `cacheWillUpdate`
|
|
48
|
-
* plugins, we need to add `defaultPrecacheCacheabilityPlugin`.
|
|
49
|
-
*
|
|
50
|
-
* - If this method is called and there is exactly one `cacheWillUpdate`, then
|
|
51
|
-
* we don't have to do anything (this might be a previously added
|
|
52
|
-
* `defaultPrecacheCacheabilityPlugin`, or it might be a custom plugin).
|
|
53
|
-
*
|
|
54
|
-
* - If this method is called and there is more than one `cacheWillUpdate`,
|
|
55
|
-
* then we need to check if one is `defaultPrecacheCacheabilityPlugin`. If so,
|
|
56
|
-
* we need to remove it. (This situation is unlikely, but it could happen if
|
|
57
|
-
* the strategy is used multiple times, the first without a `cacheWillUpdate`,
|
|
58
|
-
* and then later on after manually adding a custom `cacheWillUpdate`.)
|
|
59
|
-
*
|
|
60
|
-
* See https://github.com/GoogleChrome/workbox/issues/2737 for more context.
|
|
61
|
-
*
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
_useDefaultCacheabilityPluginIfNeeded(): void;
|
|
65
|
-
}
|
|
66
|
-
export { PrecacheStrategy };
|
|
67
|
-
//# sourceMappingURL=PrecacheStrategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheStrategy.d.ts","sourceRoot":"","sources":["../src/PrecacheStrategy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,UAAU,uBAAwB,SAAQ,eAAe;IACvD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,cAAM,gBAAiB,SAAQ,QAAQ;IACrC,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;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/_types.d.ts
DELETED
|
@@ -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
|
package/dist/_types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../src/_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"}
|
package/dist/addPlugins.d.ts
DELETED
package/dist/addPlugins.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addPlugins.d.ts","sourceRoot":"","sources":["../src/addPlugins.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,CAGlD;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|