@serwist/sw 9.0.0-preview.14 → 9.0.0-preview.16
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.js +8 -23
- package/dist/index.plugins.d.ts +12 -0
- package/dist/index.plugins.d.ts.map +1 -0
- package/dist/index.plugins.js +5 -0
- package/dist/index.strategies.d.ts +5 -0
- package/dist/index.strategies.d.ts.map +1 -0
- package/dist/index.strategies.js +1 -0
- package/dist/installSerwist.d.ts.map +1 -1
- package/dist/registerRuntimeCaching.d.ts.map +1 -1
- package/package.json +33 -15
- package/src/index.plugins.ts +46 -0
- package/src/index.strategies.ts +6 -0
- package/src/installSerwist.ts +3 -11
- package/src/registerRuntimeCaching.ts +2 -13
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { registerRoute, NavigationRoute } from '@serwist/routing';
|
|
|
4
4
|
import { setCacheNameDetails, clientsClaim } from '@serwist/core';
|
|
5
5
|
import { initialize } from '@serwist/google-analytics/initialize';
|
|
6
6
|
import { enable } from '@serwist/navigation-preload';
|
|
7
|
-
import { logger } from '@serwist/core/internal';
|
|
8
7
|
|
|
9
8
|
const disableDevLogs = ()=>{
|
|
10
9
|
self.__WB_DISABLE_DEV_LOGS = true;
|
|
@@ -38,15 +37,8 @@ const handlePrecaching = ({ precacheEntries, precacheOptions, cleanupOutdatedCac
|
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
const registerRuntimeCaching = (...runtimeCachingList)=>{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
if (!self.__WB_FORCE_RUNTIME_CACHING && process.env.NODE_ENV !== "production") {
|
|
45
|
-
logger.log("registerRuntimeCaching is disabled in development mode.");
|
|
46
|
-
} else {
|
|
47
|
-
for (const entry of runtimeCachingList){
|
|
48
|
-
registerRoute(entry.matcher, entry.handler, entry.method);
|
|
49
|
-
}
|
|
40
|
+
for (const entry of runtimeCachingList){
|
|
41
|
+
registerRoute(entry.matcher, entry.handler, entry.method);
|
|
50
42
|
}
|
|
51
43
|
};
|
|
52
44
|
|
|
@@ -86,20 +78,13 @@ const installSerwist = ({ precacheEntries, precacheOptions, cleanupOutdatedCache
|
|
|
86
78
|
}
|
|
87
79
|
}
|
|
88
80
|
if (runtimeCaching !== undefined) {
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
} else {
|
|
95
|
-
if (fallbacks$1 !== undefined) {
|
|
96
|
-
fallbacks({
|
|
97
|
-
...fallbacks$1,
|
|
98
|
-
runtimeCaching
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
registerRuntimeCaching(...runtimeCaching);
|
|
81
|
+
if (fallbacks$1 !== undefined) {
|
|
82
|
+
fallbacks({
|
|
83
|
+
...fallbacks$1,
|
|
84
|
+
runtimeCaching
|
|
85
|
+
});
|
|
102
86
|
}
|
|
87
|
+
registerRuntimeCaching(...runtimeCaching);
|
|
103
88
|
}
|
|
104
89
|
if (disableDevLogs$1) disableDevLogs();
|
|
105
90
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QueueEntry, QueueOptions } from "@serwist/background-sync";
|
|
2
|
+
import { BackgroundSyncPlugin, Queue, QueueStore, StorableRequest } from "@serwist/background-sync";
|
|
3
|
+
import type { BroadcastCacheUpdateOptions, BroadcastMessage, BroadcastPayload, BroadcastPayloadGenerator } from "@serwist/broadcast-update";
|
|
4
|
+
import { BroadcastCacheUpdate, BroadcastUpdatePlugin, CACHE_UPDATED_MESSAGE_META as BROADCAST_UPDATE_MESSAGE_META, CACHE_UPDATED_MESSAGE_TYPE as BROADCAST_UPDATE_MESSAGE_TYPE, defaultHeadersToCheck as BROADCAST_UPDATE_DEFAULT_HEADERS, responsesAreSame } from "@serwist/broadcast-update";
|
|
5
|
+
import type { CacheableResponseOptions } from "@serwist/cacheable-response";
|
|
6
|
+
import { CacheableResponse, CacheableResponsePlugin } from "@serwist/cacheable-response";
|
|
7
|
+
import type { ExpirationPluginOptions } from "@serwist/expiration";
|
|
8
|
+
import { CacheExpiration, ExpirationPlugin } from "@serwist/expiration";
|
|
9
|
+
import { RangeRequestsPlugin, createPartialResponse } from "@serwist/range-requests";
|
|
10
|
+
export { BackgroundSyncPlugin, Queue as BackgroundSyncQueue, QueueStore as BackgroundSyncQueueStore, StorableRequest, BroadcastCacheUpdate, BroadcastUpdatePlugin, responsesAreSame, BROADCAST_UPDATE_MESSAGE_META, BROADCAST_UPDATE_MESSAGE_TYPE, BROADCAST_UPDATE_DEFAULT_HEADERS, CacheableResponse, CacheableResponsePlugin, CacheExpiration, ExpirationPlugin, createPartialResponse, RangeRequestsPlugin, };
|
|
11
|
+
export type { QueueOptions as BackgroundSyncQueueOptions, QueueEntry as BackgroundSyncQueueEntry, BroadcastCacheUpdateOptions, BroadcastPayload, BroadcastPayloadGenerator, BroadcastMessage, CacheableResponseOptions, ExpirationPluginOptions, };
|
|
12
|
+
//# sourceMappingURL=index.plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.plugins.d.ts","sourceRoot":"","sources":["../src/index.plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACpG,OAAO,KAAK,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC5I,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,IAAI,6BAA6B,EAC3D,0BAA0B,IAAI,6BAA6B,EAC3D,qBAAqB,IAAI,gCAAgC,EACzD,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErF,OAAO,EACL,oBAAoB,EACpB,KAAK,IAAI,mBAAmB,EAC5B,UAAU,IAAI,wBAAwB,EACtC,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,6BAA6B,EAC7B,6BAA6B,EAC7B,gCAAgC,EAChC,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,GACpB,CAAC;AAEF,YAAY,EACV,YAAY,IAAI,0BAA0B,EAC1C,UAAU,IAAI,wBAAwB,EACtC,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,GACxB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { BackgroundSyncPlugin, Queue as BackgroundSyncQueue, QueueStore as BackgroundSyncQueueStore, StorableRequest } from '@serwist/background-sync';
|
|
2
|
+
export { defaultHeadersToCheck as BROADCAST_UPDATE_DEFAULT_HEADERS, CACHE_UPDATED_MESSAGE_META as BROADCAST_UPDATE_MESSAGE_META, CACHE_UPDATED_MESSAGE_TYPE as BROADCAST_UPDATE_MESSAGE_TYPE, BroadcastCacheUpdate, BroadcastUpdatePlugin, responsesAreSame } from '@serwist/broadcast-update';
|
|
3
|
+
export { CacheableResponse, CacheableResponsePlugin } from '@serwist/cacheable-response';
|
|
4
|
+
export { CacheExpiration, ExpirationPlugin } from '@serwist/expiration';
|
|
5
|
+
export { RangeRequestsPlugin, createPartialResponse } from '@serwist/range-requests';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NetworkFirstOptions, NetworkOnlyOptions, StrategyOptions } from "@serwist/strategies";
|
|
2
|
+
import { CacheFirst, CacheOnly, NetworkFirst, NetworkOnly, StaleWhileRevalidate, Strategy, StrategyHandler } from "@serwist/strategies";
|
|
3
|
+
export { CacheFirst, CacheOnly, NetworkFirst, NetworkOnly, StaleWhileRevalidate, Strategy, StrategyHandler };
|
|
4
|
+
export type { NetworkFirstOptions, NetworkOnlyOptions, StrategyOptions };
|
|
5
|
+
//# sourceMappingURL=index.strategies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.strategies.d.ts","sourceRoot":"","sources":["../src/index.strategies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAExI,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;AAE7G,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CacheFirst, CacheOnly, NetworkFirst, NetworkOnly, StaleWhileRevalidate, Strategy, StrategyHandler } from '@serwist/strategies';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installSerwist.d.ts","sourceRoot":"","sources":["../src/installSerwist.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gCAAgC,EAAc,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"installSerwist.d.ts","sourceRoot":"","sources":["../src/installSerwist.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gCAAgC,EAAc,MAAM,sCAAsC,CAAC;AAKzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,KAAK,uBAAuB,EAAoB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,GAAG;IAC5D;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC;IAClC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,gCAAgC,GAAG,OAAO,CAAC;IACpE;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;CACtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,qNAexB,qBAAqB,KAAG,IAkD1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerRuntimeCaching.d.ts","sourceRoot":"","sources":["../src/registerRuntimeCaching.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerRuntimeCaching.d.ts","sourceRoot":"","sources":["../src/registerRuntimeCaching.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,0BAA2B,cAAc,EAAE,KAAG,IAIhF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/sw",
|
|
3
|
-
"version": "9.0.0-preview.
|
|
3
|
+
"version": "9.0.0-preview.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that makes it easy to get started with the Serwist service worker libraries.",
|
|
6
6
|
"files": [
|
|
@@ -20,31 +20,49 @@
|
|
|
20
20
|
"homepage": "https://serwist.pages.dev",
|
|
21
21
|
"main": "./dist/index.js",
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
"*": {
|
|
25
|
+
"plugins": [
|
|
26
|
+
"./dist/index.plugins.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"strategies": [
|
|
29
|
+
"./dist/index.strategies.d.ts"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
23
33
|
"exports": {
|
|
24
34
|
".": {
|
|
25
35
|
"types": "./dist/index.d.ts",
|
|
26
36
|
"default": "./dist/index.js"
|
|
27
37
|
},
|
|
38
|
+
"./plugins": {
|
|
39
|
+
"types": "./dist/index.plugins.d.ts",
|
|
40
|
+
"default": "./dist/index.plugins.js"
|
|
41
|
+
},
|
|
42
|
+
"./strategies": {
|
|
43
|
+
"types": "./dist/index.strategies.d.ts",
|
|
44
|
+
"default": "./dist/index.strategies.js"
|
|
45
|
+
},
|
|
28
46
|
"./package.json": "./package.json"
|
|
29
47
|
},
|
|
30
48
|
"dependencies": {
|
|
31
|
-
"@serwist/background-sync": "9.0.0-preview.
|
|
32
|
-
"@serwist/broadcast-update": "9.0.0-preview.
|
|
33
|
-
"@serwist/cacheable-response": "9.0.0-preview.
|
|
34
|
-
"@serwist/core": "9.0.0-preview.
|
|
35
|
-
"@serwist/expiration": "9.0.0-preview.
|
|
36
|
-
"@serwist/google-analytics": "9.0.0-preview.
|
|
37
|
-
"@serwist/navigation-preload": "9.0.0-preview.
|
|
38
|
-
"@serwist/precaching": "9.0.0-preview.
|
|
39
|
-
"@serwist/range-requests": "9.0.0-preview.
|
|
40
|
-
"@serwist/routing": "9.0.0-preview.
|
|
41
|
-
"@serwist/strategies": "9.0.0-preview.
|
|
49
|
+
"@serwist/background-sync": "9.0.0-preview.16",
|
|
50
|
+
"@serwist/broadcast-update": "9.0.0-preview.16",
|
|
51
|
+
"@serwist/cacheable-response": "9.0.0-preview.16",
|
|
52
|
+
"@serwist/core": "9.0.0-preview.16",
|
|
53
|
+
"@serwist/expiration": "9.0.0-preview.16",
|
|
54
|
+
"@serwist/google-analytics": "9.0.0-preview.16",
|
|
55
|
+
"@serwist/navigation-preload": "9.0.0-preview.16",
|
|
56
|
+
"@serwist/precaching": "9.0.0-preview.16",
|
|
57
|
+
"@serwist/range-requests": "9.0.0-preview.16",
|
|
58
|
+
"@serwist/routing": "9.0.0-preview.16",
|
|
59
|
+
"@serwist/strategies": "9.0.0-preview.16"
|
|
42
60
|
},
|
|
43
61
|
"devDependencies": {
|
|
44
62
|
"rollup": "4.13.0",
|
|
45
|
-
"typescript": "5.5.0-dev.
|
|
46
|
-
"@serwist/constants": "9.0.0-preview.
|
|
47
|
-
"@serwist/utils": "9.0.0-preview.
|
|
63
|
+
"typescript": "5.5.0-dev.20240323",
|
|
64
|
+
"@serwist/constants": "9.0.0-preview.16",
|
|
65
|
+
"@serwist/utils": "9.0.0-preview.16"
|
|
48
66
|
},
|
|
49
67
|
"peerDependencies": {
|
|
50
68
|
"typescript": ">=5.0.0"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { QueueEntry, QueueOptions } from "@serwist/background-sync";
|
|
2
|
+
import { BackgroundSyncPlugin, Queue, QueueStore, StorableRequest } from "@serwist/background-sync";
|
|
3
|
+
import type { BroadcastCacheUpdateOptions, BroadcastMessage, BroadcastPayload, BroadcastPayloadGenerator } from "@serwist/broadcast-update";
|
|
4
|
+
import {
|
|
5
|
+
BroadcastCacheUpdate,
|
|
6
|
+
BroadcastUpdatePlugin,
|
|
7
|
+
CACHE_UPDATED_MESSAGE_META as BROADCAST_UPDATE_MESSAGE_META,
|
|
8
|
+
CACHE_UPDATED_MESSAGE_TYPE as BROADCAST_UPDATE_MESSAGE_TYPE,
|
|
9
|
+
defaultHeadersToCheck as BROADCAST_UPDATE_DEFAULT_HEADERS,
|
|
10
|
+
responsesAreSame,
|
|
11
|
+
} from "@serwist/broadcast-update";
|
|
12
|
+
import type { CacheableResponseOptions } from "@serwist/cacheable-response";
|
|
13
|
+
import { CacheableResponse, CacheableResponsePlugin } from "@serwist/cacheable-response";
|
|
14
|
+
import type { ExpirationPluginOptions } from "@serwist/expiration";
|
|
15
|
+
import { CacheExpiration, ExpirationPlugin } from "@serwist/expiration";
|
|
16
|
+
import { RangeRequestsPlugin, createPartialResponse } from "@serwist/range-requests";
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
BackgroundSyncPlugin,
|
|
20
|
+
Queue as BackgroundSyncQueue,
|
|
21
|
+
QueueStore as BackgroundSyncQueueStore,
|
|
22
|
+
StorableRequest,
|
|
23
|
+
BroadcastCacheUpdate,
|
|
24
|
+
BroadcastUpdatePlugin,
|
|
25
|
+
responsesAreSame,
|
|
26
|
+
BROADCAST_UPDATE_MESSAGE_META,
|
|
27
|
+
BROADCAST_UPDATE_MESSAGE_TYPE,
|
|
28
|
+
BROADCAST_UPDATE_DEFAULT_HEADERS,
|
|
29
|
+
CacheableResponse,
|
|
30
|
+
CacheableResponsePlugin,
|
|
31
|
+
CacheExpiration,
|
|
32
|
+
ExpirationPlugin,
|
|
33
|
+
createPartialResponse,
|
|
34
|
+
RangeRequestsPlugin,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type {
|
|
38
|
+
QueueOptions as BackgroundSyncQueueOptions,
|
|
39
|
+
QueueEntry as BackgroundSyncQueueEntry,
|
|
40
|
+
BroadcastCacheUpdateOptions,
|
|
41
|
+
BroadcastPayload,
|
|
42
|
+
BroadcastPayloadGenerator,
|
|
43
|
+
BroadcastMessage,
|
|
44
|
+
CacheableResponseOptions,
|
|
45
|
+
ExpirationPluginOptions,
|
|
46
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NetworkFirstOptions, NetworkOnlyOptions, StrategyOptions } from "@serwist/strategies";
|
|
2
|
+
import { CacheFirst, CacheOnly, NetworkFirst, NetworkOnly, StaleWhileRevalidate, Strategy, StrategyHandler } from "@serwist/strategies";
|
|
3
|
+
|
|
4
|
+
export { CacheFirst, CacheOnly, NetworkFirst, NetworkOnly, StaleWhileRevalidate, Strategy, StrategyHandler };
|
|
5
|
+
|
|
6
|
+
export type { NetworkFirstOptions, NetworkOnlyOptions, StrategyOptions };
|
package/src/installSerwist.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { clientsClaim as clientsClaimImpl, setCacheNameDetails } from "@serwist/
|
|
|
2
2
|
import { type GoogleAnalyticsInitializeOptions, initialize } from "@serwist/google-analytics/initialize";
|
|
3
3
|
import { enable } from "@serwist/navigation-preload";
|
|
4
4
|
|
|
5
|
-
import { logger } from "@serwist/core/internal";
|
|
6
5
|
import { disableDevLogs as disableDevLogsImpl } from "./disableDevLogs.js";
|
|
7
6
|
import { fallbacks as fallbacksImpl } from "./fallbacks.js";
|
|
8
7
|
import type { FallbacksOptions } from "./fallbacks.js";
|
|
@@ -133,17 +132,10 @@ export const installSerwist = ({
|
|
|
133
132
|
}
|
|
134
133
|
|
|
135
134
|
if (runtimeCaching !== undefined) {
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
if (!self.__WB_FORCE_RUNTIME_CACHING && process.env.NODE_ENV !== "production") {
|
|
140
|
-
logger.log("runtimeCaching and fallbacks are disabled in development mode.");
|
|
141
|
-
} else {
|
|
142
|
-
if (fallbacks !== undefined) {
|
|
143
|
-
fallbacksImpl({ ...fallbacks, runtimeCaching });
|
|
144
|
-
}
|
|
145
|
-
registerRuntimeCaching(...runtimeCaching);
|
|
135
|
+
if (fallbacks !== undefined) {
|
|
136
|
+
fallbacksImpl({ ...fallbacks, runtimeCaching });
|
|
146
137
|
}
|
|
138
|
+
registerRuntimeCaching(...runtimeCaching);
|
|
147
139
|
}
|
|
148
140
|
|
|
149
141
|
if (disableDevLogs) disableDevLogsImpl();
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { logger } from "@serwist/core/internal";
|
|
2
1
|
import { registerRoute } from "@serwist/routing";
|
|
3
2
|
|
|
4
3
|
import type { RuntimeCaching } from "./types.js";
|
|
5
4
|
|
|
6
|
-
declare const self: ServiceWorkerGlobalScope;
|
|
7
|
-
|
|
8
5
|
/**
|
|
9
6
|
* Registers caching strategies to a singleton Router instance. It is a simple
|
|
10
7
|
* syntatic sugar for `@serwist/routing.registerRoute`.
|
|
@@ -14,15 +11,7 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
14
11
|
* @returns
|
|
15
12
|
*/
|
|
16
13
|
export const registerRuntimeCaching = (...runtimeCachingList: RuntimeCaching[]): void => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!self.__WB_FORCE_RUNTIME_CACHING && process.env.NODE_ENV !== "production") {
|
|
22
|
-
logger.log("registerRuntimeCaching is disabled in development mode.");
|
|
23
|
-
} else {
|
|
24
|
-
for (const entry of runtimeCachingList) {
|
|
25
|
-
registerRoute(entry.matcher, entry.handler, entry.method);
|
|
26
|
-
}
|
|
14
|
+
for (const entry of runtimeCachingList) {
|
|
15
|
+
registerRoute(entry.matcher, entry.handler, entry.method);
|
|
27
16
|
}
|
|
28
17
|
};
|