@serwist/sw 8.1.0 → 8.1.1
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/fallbacks.d.ts +18 -2
- package/dist/index.js +5 -5
- package/dist/index.old.cjs +5 -5
- package/package.json +14 -14
package/dist/fallbacks.d.ts
CHANGED
|
@@ -3,14 +3,30 @@ import type { HandlerDidErrorCallbackParam } from "@serwist/core";
|
|
|
3
3
|
import type { PrecacheRouteOptions } from "@serwist/precaching";
|
|
4
4
|
export type FallbackMatcher = (_: HandlerDidErrorCallbackParam) => boolean;
|
|
5
5
|
export interface FallbackEntry {
|
|
6
|
+
/**
|
|
7
|
+
* The matcher, which checks whether the fallback entry can be used
|
|
8
|
+
* for a Request.
|
|
9
|
+
*/
|
|
6
10
|
matcher: FallbackMatcher;
|
|
11
|
+
/**
|
|
12
|
+
* The fallback URL.
|
|
13
|
+
*/
|
|
7
14
|
url: URL | string;
|
|
15
|
+
/**
|
|
16
|
+
* The revision used for precaching.
|
|
17
|
+
*/
|
|
8
18
|
revision: string;
|
|
19
|
+
/**
|
|
20
|
+
* How the Response in the cache should be matched.
|
|
21
|
+
*
|
|
22
|
+
* @default
|
|
23
|
+
* { ignoreSearch: true }
|
|
24
|
+
*/
|
|
25
|
+
cacheMatchOptions?: MultiCacheQueryOptions;
|
|
9
26
|
}
|
|
10
27
|
export interface FallbacksOptions {
|
|
11
28
|
runtimeCaching: RuntimeCaching[];
|
|
12
29
|
entries: FallbackEntry[];
|
|
13
30
|
precacheOptions?: PrecacheRouteOptions;
|
|
14
|
-
matchOptions?: MultiCacheQueryOptions;
|
|
15
31
|
}
|
|
16
|
-
export declare const fallbacks: ({ runtimeCaching, entries, precacheOptions
|
|
32
|
+
export declare const fallbacks: ({ runtimeCaching, entries, precacheOptions }: FallbacksOptions) => RuntimeCaching[];
|
package/dist/index.js
CHANGED
|
@@ -14,9 +14,7 @@ const disableDevLogs = ()=>{
|
|
|
14
14
|
self.__WB_DISABLE_DEV_LOGS = true;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const fallbacks = ({ runtimeCaching, entries, precacheOptions
|
|
18
|
-
ignoreSearch: true
|
|
19
|
-
} })=>{
|
|
17
|
+
const fallbacks = ({ runtimeCaching, entries, precacheOptions })=>{
|
|
20
18
|
precacheAndRoute(entries.map(({ url, revision })=>({
|
|
21
19
|
url: typeof url === "string" ? url : url.toString(),
|
|
22
20
|
revision
|
|
@@ -30,9 +28,11 @@ const fallbacks = ({ runtimeCaching, entries, precacheOptions, matchOptions = {
|
|
|
30
28
|
}
|
|
31
29
|
cacheEntry.options.plugins.push({
|
|
32
30
|
async handlerDidError (info) {
|
|
33
|
-
for (const { matcher, url
|
|
31
|
+
for (const { matcher, url, cacheMatchOptions = {
|
|
32
|
+
ignoreSearch: true
|
|
33
|
+
} } of entries){
|
|
34
34
|
if (matcher(info)) {
|
|
35
|
-
return caches.match(url,
|
|
35
|
+
return caches.match(url, cacheMatchOptions);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
return Response.error();
|
package/dist/index.old.cjs
CHANGED
|
@@ -16,9 +16,7 @@ const disableDevLogs = ()=>{
|
|
|
16
16
|
self.__WB_DISABLE_DEV_LOGS = true;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const fallbacks = ({ runtimeCaching, entries, precacheOptions
|
|
20
|
-
ignoreSearch: true
|
|
21
|
-
} })=>{
|
|
19
|
+
const fallbacks = ({ runtimeCaching, entries, precacheOptions })=>{
|
|
22
20
|
precaching.precacheAndRoute(entries.map(({ url, revision })=>({
|
|
23
21
|
url: typeof url === "string" ? url : url.toString(),
|
|
24
22
|
revision
|
|
@@ -32,9 +30,11 @@ const fallbacks = ({ runtimeCaching, entries, precacheOptions, matchOptions = {
|
|
|
32
30
|
}
|
|
33
31
|
cacheEntry.options.plugins.push({
|
|
34
32
|
async handlerDidError (info) {
|
|
35
|
-
for (const { matcher, url
|
|
33
|
+
for (const { matcher, url, cacheMatchOptions = {
|
|
34
|
+
ignoreSearch: true
|
|
35
|
+
} } of entries){
|
|
36
36
|
if (matcher(info)) {
|
|
37
|
-
return caches.match(url,
|
|
37
|
+
return caches.match(url, cacheMatchOptions);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return Response.error();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/sw",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "This module makes it easy to get started with the Serwist service worker libraries.",
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
"./package.json": "./package.json"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@serwist/background-sync": "8.1.
|
|
39
|
-
"@serwist/broadcast-update": "8.1.
|
|
40
|
-
"@serwist/cacheable-response": "8.1.
|
|
41
|
-
"@serwist/core": "8.1.
|
|
42
|
-
"@serwist/expiration": "8.1.
|
|
43
|
-
"@serwist/google-analytics": "8.1.
|
|
44
|
-
"@serwist/navigation-preload": "8.1.
|
|
45
|
-
"@serwist/precaching": "8.1.
|
|
46
|
-
"@serwist/range-requests": "8.1.
|
|
47
|
-
"@serwist/routing": "8.1.
|
|
48
|
-
"@serwist/strategies": "8.1.
|
|
38
|
+
"@serwist/background-sync": "8.1.1",
|
|
39
|
+
"@serwist/broadcast-update": "8.1.1",
|
|
40
|
+
"@serwist/cacheable-response": "8.1.1",
|
|
41
|
+
"@serwist/core": "8.1.1",
|
|
42
|
+
"@serwist/expiration": "8.1.1",
|
|
43
|
+
"@serwist/google-analytics": "8.1.1",
|
|
44
|
+
"@serwist/navigation-preload": "8.1.1",
|
|
45
|
+
"@serwist/precaching": "8.1.1",
|
|
46
|
+
"@serwist/range-requests": "8.1.1",
|
|
47
|
+
"@serwist/routing": "8.1.1",
|
|
48
|
+
"@serwist/strategies": "8.1.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"rollup": "4.9.1",
|
|
52
|
-
"@serwist/build": "8.1.
|
|
53
|
-
"@serwist/constants": "8.1.
|
|
52
|
+
"@serwist/build": "8.1.1",
|
|
53
|
+
"@serwist/constants": "8.1.1"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "rimraf dist && cross-env NODE_ENV=production rollup --config rollup.config.js",
|