serwist 10.0.0-preview.1 → 10.0.0-preview.11
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/chunks/{resultingClientExists.js → waitUntil.js} +144 -144
- package/dist/index.d.ts +22 -50
- package/dist/index.d.ts.map +1 -1
- package/dist/index.internal.d.ts +16 -16
- package/dist/index.internal.d.ts.map +1 -1
- package/dist/index.internal.js +3 -3
- package/dist/index.js +1925 -1803
- package/dist/lib/{backgroundSync → background-sync}/BackgroundSyncPlugin.d.ts +1 -1
- package/dist/lib/background-sync/BackgroundSyncPlugin.d.ts.map +1 -0
- package/dist/lib/background-sync/BackgroundSyncQueue.d.ts.map +1 -0
- package/dist/lib/background-sync/BackgroundSyncQueueDb.d.ts.map +1 -0
- package/dist/lib/background-sync/BackgroundSyncQueueStore.d.ts.map +1 -0
- package/dist/lib/{backgroundSync → background-sync}/StorableRequest.d.ts +1 -1
- package/dist/lib/background-sync/StorableRequest.d.ts.map +1 -0
- package/dist/lib/background-sync/index.d.ts +6 -0
- package/dist/lib/background-sync/index.d.ts.map +1 -0
- package/dist/lib/{broadcastUpdate → broadcast-update}/BroadcastCacheUpdate.d.ts +1 -1
- package/dist/lib/broadcast-update/BroadcastCacheUpdate.d.ts.map +1 -0
- package/dist/lib/{broadcastUpdate → broadcast-update}/BroadcastUpdatePlugin.d.ts +1 -1
- package/dist/lib/broadcast-update/BroadcastUpdatePlugin.d.ts.map +1 -0
- package/dist/lib/broadcast-update/constants.d.ts.map +1 -0
- package/dist/lib/broadcast-update/index.d.ts +6 -0
- package/dist/lib/broadcast-update/index.d.ts.map +1 -0
- package/dist/lib/broadcast-update/responsesAreSame.d.ts.map +1 -0
- package/dist/lib/{broadcastUpdate → broadcast-update}/types.d.ts +1 -1
- package/dist/lib/broadcast-update/types.d.ts.map +1 -0
- package/dist/{cacheNames.d.ts → lib/cache-name.d.ts} +1 -1
- package/dist/lib/cache-name.d.ts.map +1 -0
- package/dist/lib/cacheable-response/CacheableResponse.d.ts.map +1 -0
- package/dist/lib/{cacheableResponse → cacheable-response}/CacheableResponsePlugin.d.ts +1 -1
- package/dist/lib/cacheable-response/CacheableResponsePlugin.d.ts.map +1 -0
- package/dist/lib/cacheable-response/index.d.ts +4 -0
- package/dist/lib/cacheable-response/index.d.ts.map +1 -0
- package/dist/{constants.d.ts → lib/constants.d.ts} +1 -1
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/core.d.ts +62 -0
- package/dist/lib/core.d.ts.map +1 -0
- package/dist/lib/expiration/ExpirationPlugin.d.ts +1 -1
- package/dist/lib/expiration/ExpirationPlugin.d.ts.map +1 -1
- package/dist/lib/expiration/index.d.ts +4 -0
- package/dist/lib/expiration/index.d.ts.map +1 -0
- package/dist/lib/extension.d.ts +30 -0
- package/dist/lib/extension.d.ts.map +1 -0
- package/dist/lib/extensions/google-analytics/constants.d.ts.map +1 -0
- package/dist/lib/extensions/google-analytics/extension.d.ts +79 -0
- package/dist/lib/extensions/google-analytics/extension.d.ts.map +1 -0
- package/dist/lib/extensions/google-analytics/index.d.ts +2 -0
- package/dist/lib/extensions/google-analytics/index.d.ts.map +1 -0
- package/dist/lib/extensions/google-analytics/initialize.d.ts +12 -0
- package/dist/lib/extensions/google-analytics/initialize.d.ts.map +1 -0
- package/dist/lib/extensions/index.d.ts +14 -0
- package/dist/lib/extensions/index.d.ts.map +1 -0
- package/dist/{controllers/PrecacheController/PrecacheController.d.ts → lib/extensions/precache/extension.d.ts} +19 -38
- package/dist/lib/extensions/precache/extension.d.ts.map +1 -0
- package/dist/{controllers/PrecacheController/parsePrecacheOptions.d.ts → lib/extensions/precache/options.d.ts} +6 -5
- package/dist/lib/extensions/precache/options.d.ts.map +1 -0
- package/dist/{controllers/PrecacheController/PrecacheCacheKeyPlugin.d.ts → lib/extensions/precache/plugin-cache-key.d.ts} +4 -4
- package/dist/lib/extensions/precache/plugin-cache-key.d.ts.map +1 -0
- package/dist/lib/{precaching/PrecacheFallbackPlugin.d.ts → extensions/precache/plugin-fallback.d.ts} +11 -11
- package/dist/lib/extensions/precache/plugin-fallback.d.ts.map +1 -0
- package/dist/{controllers/PrecacheController/PrecacheInstallReportPlugin.d.ts → lib/extensions/precache/plugin-install-report.d.ts} +2 -2
- package/dist/lib/extensions/precache/plugin-install-report.d.ts.map +1 -0
- package/dist/lib/extensions/precache/route.d.ts +42 -0
- package/dist/lib/extensions/precache/route.d.ts.map +1 -0
- package/dist/{controllers/PrecacheController/PrecacheStrategy.d.ts → lib/extensions/precache/strategy.d.ts} +5 -5
- package/dist/lib/extensions/precache/strategy.d.ts.map +1 -0
- package/dist/{controllers/RuntimeCacheController.d.ts → lib/extensions/runtime-cache.d.ts} +16 -10
- package/dist/lib/extensions/runtime-cache.d.ts.map +1 -0
- package/dist/lib/functions/handlers.d.ts +60 -0
- package/dist/lib/functions/handlers.d.ts.map +1 -0
- package/dist/lib/functions/router.d.ts +60 -0
- package/dist/lib/functions/router.d.ts.map +1 -0
- package/dist/{navigationPreload.d.ts → lib/navigation-preload.d.ts} +1 -1
- package/dist/lib/navigation-preload.d.ts.map +1 -0
- package/dist/lib/{rangeRequests → range-requests}/RangeRequestsPlugin.d.ts +1 -1
- package/dist/lib/range-requests/RangeRequestsPlugin.d.ts.map +1 -0
- package/dist/lib/range-requests/createPartialResponse.d.ts.map +1 -0
- package/dist/lib/range-requests/index.d.ts +3 -0
- package/dist/lib/range-requests/index.d.ts.map +1 -0
- package/dist/lib/range-requests/utils/calculateEffectiveBoundaries.d.ts.map +1 -0
- package/dist/lib/range-requests/utils/parseRangeHeader.d.ts.map +1 -0
- package/dist/lib/route.d.ts +106 -0
- package/dist/lib/route.d.ts.map +1 -0
- package/dist/{Serwist.d.ts → lib/serwist.d.ts} +28 -41
- package/dist/lib/serwist.d.ts.map +1 -0
- package/dist/lib/strategies/NetworkFirst.d.ts.map +1 -1
- package/dist/lib/strategies/StaleWhileRevalidate.d.ts.map +1 -1
- package/dist/lib/strategies/Strategy.d.ts +1 -1
- package/dist/lib/strategies/Strategy.d.ts.map +1 -1
- package/dist/lib/strategies/StrategyHandler.d.ts +1 -1
- package/dist/lib/strategies/StrategyHandler.d.ts.map +1 -1
- package/dist/lib/strategies/index.d.ts +11 -0
- package/dist/lib/strategies/index.d.ts.map +1 -0
- package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts +1 -1
- package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +1 -1
- package/dist/{types.d.ts → lib/types.d.ts} +15 -24
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/{copyResponse.d.ts → lib/utils.d.ts} +22 -1
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/models/messages/messageGenerator.d.ts +1 -1
- package/dist/models/messages/messageGenerator.d.ts.map +1 -1
- package/dist/utils/SerwistError.d.ts +2 -2
- package/dist/utils/SerwistError.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +1 -1
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils/cacheNames.d.ts.map +1 -1
- package/dist/utils/cleanupOutdatedCaches.d.ts.map +1 -1
- package/dist/utils/createCacheKey.d.ts +1 -1
- package/dist/utils/createCacheKey.d.ts.map +1 -1
- package/dist/utils/deleteOutdatedCaches.d.ts.map +1 -1
- package/dist/utils/generateURLVariations.d.ts +1 -1
- package/dist/utils/generateURLVariations.d.ts.map +1 -1
- package/dist/utils/getFriendlyURL.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/normalizeHandler.d.ts +1 -1
- package/dist/utils/normalizeHandler.d.ts.map +1 -1
- package/dist/utils/parseRoute.d.ts +3 -3
- package/dist/utils/parseRoute.d.ts.map +1 -1
- package/dist/utils/pluginUtils.d.ts +1 -1
- package/dist/utils/pluginUtils.d.ts.map +1 -1
- package/dist/utils/printCleanupDetails.d.ts.map +1 -1
- package/dist/utils/printInstallDetails.d.ts.map +1 -1
- package/dist/utils/removeIgnoredSearchParams.d.ts.map +1 -1
- package/dist/utils/waitUntil.d.ts.map +1 -1
- package/package.json +30 -6
- package/src/index.internal.ts +16 -16
- package/src/index.ts +100 -110
- package/src/lib/{backgroundSync → background-sync}/BackgroundSyncPlugin.ts +1 -1
- package/src/lib/{backgroundSync → background-sync}/BackgroundSyncQueue.ts +7 -7
- package/src/lib/{backgroundSync → background-sync}/BackgroundSyncQueueDb.ts +1 -1
- package/src/lib/{backgroundSync → background-sync}/BackgroundSyncQueueStore.ts +1 -3
- package/src/lib/{backgroundSync → background-sync}/StorableRequest.ts +2 -2
- package/src/lib/background-sync/index.ts +5 -0
- package/src/lib/{broadcastUpdate → broadcast-update}/BroadcastCacheUpdate.ts +5 -5
- package/src/lib/{broadcastUpdate → broadcast-update}/BroadcastUpdatePlugin.ts +1 -1
- package/src/lib/broadcast-update/index.ts +5 -0
- package/src/lib/{broadcastUpdate → broadcast-update}/responsesAreSame.ts +2 -2
- package/src/lib/{broadcastUpdate → broadcast-update}/types.ts +1 -1
- package/src/{cacheNames.ts → lib/cache-name.ts} +1 -1
- package/src/lib/{cacheableResponse → cacheable-response}/CacheableResponse.ts +4 -4
- package/src/lib/{cacheableResponse → cacheable-response}/CacheableResponsePlugin.ts +1 -1
- package/src/lib/cacheable-response/index.ts +3 -0
- package/src/lib/core.ts +128 -0
- package/src/lib/expiration/CacheExpiration.ts +3 -3
- package/src/lib/expiration/ExpirationPlugin.ts +9 -10
- package/src/lib/expiration/index.ts +3 -0
- package/src/lib/extension.ts +37 -0
- package/src/lib/{googleAnalytics/initializeGoogleAnalytics.ts → extensions/google-analytics/extension.ts} +43 -49
- package/src/lib/extensions/google-analytics/index.ts +0 -0
- package/src/lib/extensions/google-analytics/initialize.ts +48 -0
- package/src/lib/extensions/index.ts +13 -0
- package/src/{controllers/PrecacheController/PrecacheController.ts → lib/extensions/precache/extension.ts} +37 -56
- package/src/{controllers/PrecacheController/parsePrecacheOptions.ts → lib/extensions/precache/options.ts} +11 -8
- package/src/{controllers/PrecacheController/PrecacheCacheKeyPlugin.ts → lib/extensions/precache/plugin-cache-key.ts} +4 -4
- package/src/lib/{precaching/PrecacheFallbackPlugin.ts → extensions/precache/plugin-fallback.ts} +26 -16
- package/src/{controllers/PrecacheController/PrecacheInstallReportPlugin.ts → lib/extensions/precache/plugin-install-report.ts} +1 -1
- package/src/lib/extensions/precache/route.ts +72 -0
- package/src/{controllers/PrecacheController/PrecacheStrategy.ts → lib/extensions/precache/strategy.ts} +11 -11
- package/src/{controllers/RuntimeCacheController.ts → lib/extensions/runtime-cache.ts} +24 -17
- package/src/lib/functions/handlers.ts +149 -0
- package/src/lib/functions/router.ts +314 -0
- package/src/{navigationPreload.ts → lib/navigation-preload.ts} +1 -1
- package/src/lib/{rangeRequests → range-requests}/RangeRequestsPlugin.ts +1 -1
- package/src/lib/{rangeRequests → range-requests}/createPartialResponse.ts +3 -3
- package/src/lib/range-requests/index.ts +2 -0
- package/src/lib/{rangeRequests → range-requests}/utils/calculateEffectiveBoundaries.ts +2 -2
- package/src/lib/{rangeRequests → range-requests}/utils/parseRangeHeader.ts +2 -2
- package/src/lib/route.ts +234 -0
- package/src/lib/serwist.ts +443 -0
- package/src/lib/strategies/CacheFirst.ts +4 -4
- package/src/lib/strategies/CacheOnly.ts +3 -3
- package/src/lib/strategies/NetworkFirst.ts +6 -6
- package/src/lib/strategies/NetworkOnly.ts +5 -5
- package/src/lib/strategies/StaleWhileRevalidate.ts +5 -5
- package/src/lib/strategies/Strategy.ts +9 -9
- package/src/lib/strategies/StrategyHandler.ts +11 -11
- package/src/lib/strategies/index.ts +10 -0
- package/src/lib/strategies/plugins/cacheOkAndOpaquePlugin.ts +1 -1
- package/src/lib/strategies/utils/messages.ts +2 -2
- package/src/{types.ts → lib/types.ts} +17 -26
- package/src/lib/utils.ts +137 -0
- package/src/models/messages/messageGenerator.ts +1 -1
- package/src/models/messages/messages.ts +3 -3
- package/src/utils/SerwistError.ts +3 -3
- package/src/utils/assert.ts +1 -2
- package/src/utils/cacheNames.ts +0 -2
- package/src/utils/canConstructReadableStream.ts +1 -1
- package/src/utils/canConstructResponseFromBodyStream.ts +1 -1
- package/src/utils/createCacheKey.ts +1 -2
- package/src/utils/executeQuotaErrorCallbacks.ts +1 -1
- package/src/utils/generateURLVariations.ts +1 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils/normalizeHandler.ts +1 -1
- package/src/utils/parseRoute.ts +4 -5
- package/src/utils/pluginUtils.ts +1 -1
- package/src/utils/resultingClientExists.ts +1 -1
- package/dist/NavigationRoute.d.ts +0 -56
- package/dist/NavigationRoute.d.ts.map +0 -1
- package/dist/RegExpRoute.d.ts +0 -24
- package/dist/RegExpRoute.d.ts.map +0 -1
- package/dist/Route.d.ts +0 -33
- package/dist/Route.d.ts.map +0 -1
- package/dist/Serwist.d.ts.map +0 -1
- package/dist/cacheNames.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/controllers/PrecacheController/PrecacheCacheKeyPlugin.d.ts.map +0 -1
- package/dist/controllers/PrecacheController/PrecacheController.d.ts.map +0 -1
- package/dist/controllers/PrecacheController/PrecacheInstallReportPlugin.d.ts.map +0 -1
- package/dist/controllers/PrecacheController/PrecacheRoute.d.ts +0 -15
- package/dist/controllers/PrecacheController/PrecacheRoute.d.ts.map +0 -1
- package/dist/controllers/PrecacheController/PrecacheStrategy.d.ts.map +0 -1
- package/dist/controllers/PrecacheController/parsePrecacheOptions.d.ts.map +0 -1
- package/dist/controllers/RuntimeCacheController.d.ts.map +0 -1
- package/dist/copyResponse.d.ts.map +0 -1
- package/dist/disableDevLogs.d.ts +0 -7
- package/dist/disableDevLogs.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncPlugin.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncQueue.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncQueueDb.d.ts.map +0 -1
- package/dist/lib/backgroundSync/BackgroundSyncQueueStore.d.ts.map +0 -1
- package/dist/lib/backgroundSync/StorableRequest.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/constants.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/responsesAreSame.d.ts.map +0 -1
- package/dist/lib/broadcastUpdate/types.d.ts.map +0 -1
- package/dist/lib/cacheableResponse/CacheableResponse.d.ts.map +0 -1
- package/dist/lib/cacheableResponse/CacheableResponsePlugin.d.ts.map +0 -1
- package/dist/lib/googleAnalytics/constants.d.ts.map +0 -1
- package/dist/lib/googleAnalytics/initializeGoogleAnalytics.d.ts +0 -30
- package/dist/lib/googleAnalytics/initializeGoogleAnalytics.d.ts.map +0 -1
- package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts.map +0 -1
- package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts.map +0 -1
- package/dist/lib/rangeRequests/createPartialResponse.d.ts.map +0 -1
- package/dist/lib/rangeRequests/utils/calculateEffectiveBoundaries.d.ts.map +0 -1
- package/dist/lib/rangeRequests/utils/parseRangeHeader.d.ts.map +0 -1
- package/dist/navigationPreload.d.ts.map +0 -1
- package/dist/registerQuotaErrorCallback.d.ts +0 -8
- package/dist/registerQuotaErrorCallback.d.ts.map +0 -1
- package/dist/setCacheNameDetails.d.ts +0 -9
- package/dist/setCacheNameDetails.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/src/NavigationRoute.ts +0 -118
- package/src/RegExpRoute.ts +0 -74
- package/src/Route.ts +0 -67
- package/src/Serwist.ts +0 -762
- package/src/controllers/PrecacheController/PrecacheRoute.ts +0 -44
- package/src/copyResponse.ts +0 -58
- package/src/disableDevLogs.ts +0 -10
- package/src/registerQuotaErrorCallback.ts +0 -34
- package/src/setCacheNameDetails.ts +0 -53
- /package/dist/lib/{backgroundSync → background-sync}/BackgroundSyncQueue.d.ts +0 -0
- /package/dist/lib/{backgroundSync → background-sync}/BackgroundSyncQueueDb.d.ts +0 -0
- /package/dist/lib/{backgroundSync → background-sync}/BackgroundSyncQueueStore.d.ts +0 -0
- /package/dist/lib/{broadcastUpdate → broadcast-update}/constants.d.ts +0 -0
- /package/dist/lib/{broadcastUpdate → broadcast-update}/responsesAreSame.d.ts +0 -0
- /package/dist/lib/{cacheableResponse → cacheable-response}/CacheableResponse.d.ts +0 -0
- /package/dist/lib/{googleAnalytics → extensions/google-analytics}/constants.d.ts +0 -0
- /package/dist/lib/{rangeRequests → range-requests}/createPartialResponse.d.ts +0 -0
- /package/dist/lib/{rangeRequests → range-requests}/utils/calculateEffectiveBoundaries.d.ts +0 -0
- /package/dist/lib/{rangeRequests → range-requests}/utils/parseRangeHeader.d.ts +0 -0
- /package/src/lib/{broadcastUpdate → broadcast-update}/constants.ts +0 -0
- /package/src/{constants.ts → lib/constants.ts} +0 -0
- /package/src/lib/{googleAnalytics → extensions/google-analytics}/constants.ts +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serwist",
|
|
3
|
-
"version": "10.0.0-preview.
|
|
3
|
+
"version": "10.0.0-preview.11",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
5
6
|
"description": "A Swiss Army knife for service workers.",
|
|
6
7
|
"files": [
|
|
7
8
|
"src",
|
|
@@ -30,6 +31,28 @@
|
|
|
30
31
|
]
|
|
31
32
|
}
|
|
32
33
|
},
|
|
34
|
+
"imports": {
|
|
35
|
+
"#lib/*.js": {
|
|
36
|
+
"local": "./src/lib/*.ts",
|
|
37
|
+
"types": "./dist/lib/*.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"#index": {
|
|
40
|
+
"local": "./src/index.ts",
|
|
41
|
+
"types": "./dist/index.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"#index.internal": {
|
|
44
|
+
"local": "./src/index.internal.ts",
|
|
45
|
+
"types": "./dist/index.internal.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"#models/*.js": {
|
|
48
|
+
"local": "./src/models/*.ts",
|
|
49
|
+
"types": "./dist/models/*.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"#utils/*.js": {
|
|
52
|
+
"local": "./src/utils/*.ts",
|
|
53
|
+
"types": "./dist/utils/*.d.ts"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
33
56
|
"exports": {
|
|
34
57
|
".": {
|
|
35
58
|
"types": "./dist/index.d.ts",
|
|
@@ -42,13 +65,13 @@
|
|
|
42
65
|
"./package.json": "./package.json"
|
|
43
66
|
},
|
|
44
67
|
"dependencies": {
|
|
45
|
-
"idb": "8.0.
|
|
46
|
-
"@serwist/utils": "10.0.0-preview.
|
|
68
|
+
"idb": "8.0.3",
|
|
69
|
+
"@serwist/utils": "10.0.0-preview.11"
|
|
47
70
|
},
|
|
48
71
|
"devDependencies": {
|
|
49
|
-
"rollup": "4.
|
|
50
|
-
"typescript": "5.
|
|
51
|
-
"@serwist/configs": "10.0.0-preview.
|
|
72
|
+
"rollup": "4.45.1",
|
|
73
|
+
"typescript": "5.8.3",
|
|
74
|
+
"@serwist/configs": "10.0.0-preview.11"
|
|
52
75
|
},
|
|
53
76
|
"peerDependencies": {
|
|
54
77
|
"typescript": ">=5.0.0"
|
|
@@ -62,6 +85,7 @@
|
|
|
62
85
|
"build": "rimraf dist && NODE_ENV=production rollup --config rollup.config.js",
|
|
63
86
|
"dev": "rollup --config rollup.config.js --watch",
|
|
64
87
|
"lint": "biome lint ./src",
|
|
88
|
+
"qcheck": "biome check ./src",
|
|
65
89
|
"typecheck": "tsc"
|
|
66
90
|
}
|
|
67
91
|
}
|
package/src/index.internal.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { timeout } from "
|
|
16
|
-
import { waitUntil } from "
|
|
1
|
+
import { assert } from "#utils/assert.js";
|
|
2
|
+
import { cacheMatchIgnoreParams } from "#utils/cacheMatchIgnoreParams.js";
|
|
3
|
+
import { cacheNames as privateCacheNames } from "#utils/cacheNames.js";
|
|
4
|
+
import { canConstructReadableStream } from "#utils/canConstructReadableStream.js";
|
|
5
|
+
import { canConstructResponseFromBodyStream } from "#utils/canConstructResponseFromBodyStream.js";
|
|
6
|
+
import { cleanupOutdatedCaches } from "#utils/cleanupOutdatedCaches.js";
|
|
7
|
+
import { clientsClaim } from "#utils/clientsClaim.js";
|
|
8
|
+
import { Deferred } from "#utils/Deferred.js";
|
|
9
|
+
import { dontWaitFor } from "#utils/dontWaitFor.js";
|
|
10
|
+
import { executeQuotaErrorCallbacks } from "#utils/executeQuotaErrorCallbacks.js";
|
|
11
|
+
import { getFriendlyURL } from "#utils/getFriendlyURL.js";
|
|
12
|
+
import { logger } from "#utils/logger.js";
|
|
13
|
+
import { resultingClientExists } from "#utils/resultingClientExists.js";
|
|
14
|
+
import { SerwistError } from "#utils/SerwistError.js";
|
|
15
|
+
import { timeout } from "#utils/timeout.js";
|
|
16
|
+
import { waitUntil } from "#utils/waitUntil.js";
|
|
17
17
|
|
|
18
18
|
// Serwist's internal functions, classes, variables, and more. Feel free to use them,
|
|
19
19
|
// but they are not documented. Note: they do follow semver.
|
package/src/index.ts
CHANGED
|
@@ -1,128 +1,118 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import type { NavigationRouteMatchOptions } from "
|
|
5
|
-
import { NavigationRoute } from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Serwist, type SerwistOptions } from "./Serwist.js";
|
|
9
|
-
import { cacheNames } from "./cacheNames.js";
|
|
10
|
-
import type { HTTPMethod } from "./constants.js";
|
|
11
|
-
import { copyResponse } from "./copyResponse.js";
|
|
12
|
-
import { disableDevLogs } from "./disableDevLogs.js";
|
|
13
|
-
import { BackgroundSyncPlugin } from "./lib/backgroundSync/BackgroundSyncPlugin.js";
|
|
14
|
-
import type { BackgroundSyncQueueEntry, BackgroundSyncQueueOptions } from "./lib/backgroundSync/BackgroundSyncQueue.js";
|
|
15
|
-
import { BackgroundSyncQueue } from "./lib/backgroundSync/BackgroundSyncQueue.js";
|
|
16
|
-
import { BackgroundSyncQueueStore } from "./lib/backgroundSync/BackgroundSyncQueueStore.js";
|
|
17
|
-
import { StorableRequest } from "./lib/backgroundSync/StorableRequest.js";
|
|
18
|
-
import { BroadcastCacheUpdate } from "./lib/broadcastUpdate/BroadcastCacheUpdate.js";
|
|
19
|
-
import { BroadcastUpdatePlugin } from "./lib/broadcastUpdate/BroadcastUpdatePlugin.js";
|
|
20
|
-
import { BROADCAST_UPDATE_DEFAULT_HEADERS } from "./lib/broadcastUpdate/constants.js";
|
|
21
|
-
import { responsesAreSame } from "./lib/broadcastUpdate/responsesAreSame.js";
|
|
22
|
-
import type { BroadcastCacheUpdateOptions, BroadcastMessage, BroadcastPayload, BroadcastPayloadGenerator } from "./lib/broadcastUpdate/types.js";
|
|
23
|
-
import { CacheableResponse } from "./lib/cacheableResponse/CacheableResponse.js";
|
|
24
|
-
import type { CacheableResponseOptions } from "./lib/cacheableResponse/CacheableResponse.js";
|
|
25
|
-
import { CacheableResponsePlugin } from "./lib/cacheableResponse/CacheableResponsePlugin.js";
|
|
26
|
-
import { CacheExpiration } from "./lib/expiration/CacheExpiration.js";
|
|
27
|
-
import type { ExpirationPluginOptions } from "./lib/expiration/ExpirationPlugin.js";
|
|
28
|
-
import { ExpirationPlugin } from "./lib/expiration/ExpirationPlugin.js";
|
|
29
|
-
import { initializeGoogleAnalytics } from "./lib/googleAnalytics/initializeGoogleAnalytics.js";
|
|
30
|
-
import type { GoogleAnalyticsInitializeOptions } from "./lib/googleAnalytics/initializeGoogleAnalytics.js";
|
|
31
|
-
import type { PrecacheFallbackEntry, PrecacheFallbackPluginOptions } from "./lib/precaching/PrecacheFallbackPlugin.js";
|
|
32
|
-
import { PrecacheFallbackPlugin } from "./lib/precaching/PrecacheFallbackPlugin.js";
|
|
33
|
-
import { RangeRequestsPlugin } from "./lib/rangeRequests/RangeRequestsPlugin.js";
|
|
34
|
-
import { createPartialResponse } from "./lib/rangeRequests/createPartialResponse.js";
|
|
35
|
-
import { CacheFirst } from "./lib/strategies/CacheFirst.js";
|
|
36
|
-
import { CacheOnly } from "./lib/strategies/CacheOnly.js";
|
|
37
|
-
import type { NetworkFirstOptions } from "./lib/strategies/NetworkFirst.js";
|
|
38
|
-
import { NetworkFirst } from "./lib/strategies/NetworkFirst.js";
|
|
39
|
-
import type { NetworkOnlyOptions } from "./lib/strategies/NetworkOnly.js";
|
|
40
|
-
import { NetworkOnly } from "./lib/strategies/NetworkOnly.js";
|
|
41
|
-
import { StaleWhileRevalidate } from "./lib/strategies/StaleWhileRevalidate.js";
|
|
42
|
-
import type { StrategyOptions } from "./lib/strategies/Strategy.js";
|
|
43
|
-
import { Strategy } from "./lib/strategies/Strategy.js";
|
|
44
|
-
import { StrategyHandler } from "./lib/strategies/StrategyHandler.js";
|
|
45
|
-
import { disableNavigationPreload, enableNavigationPreload, isNavigationPreloadSupported } from "./navigationPreload.js";
|
|
46
|
-
import { registerQuotaErrorCallback } from "./registerQuotaErrorCallback.js";
|
|
47
|
-
import { setCacheNameDetails } from "./setCacheNameDetails.js";
|
|
1
|
+
import { cacheNames } from "#lib/cache-name.js";
|
|
2
|
+
import type { HTTPMethod } from "#lib/constants.js";
|
|
3
|
+
import { disableNavigationPreload, enableNavigationPreload, isNavigationPreloadSupported } from "#lib/navigation-preload.js";
|
|
4
|
+
import type { NavigationRouteMatchOptions } from "#lib/route.js";
|
|
5
|
+
import { NavigationRoute, RegExpRoute, Route } from "#lib/route.js";
|
|
6
|
+
import { Serwist, type SerwistOptions } from "#lib/serwist.js";
|
|
7
|
+
import { copyResponse, disableDevLogs, registerQuotaErrorCallback, setCacheNameDetails } from "#lib/utils.js";
|
|
48
8
|
|
|
9
|
+
// Background synchronizing
|
|
49
10
|
export {
|
|
50
|
-
// Core
|
|
51
|
-
Serwist,
|
|
52
|
-
cacheNames,
|
|
53
|
-
copyResponse,
|
|
54
|
-
disableDevLogs,
|
|
55
|
-
disableNavigationPreload,
|
|
56
|
-
enableNavigationPreload,
|
|
57
|
-
isNavigationPreloadSupported,
|
|
58
|
-
registerQuotaErrorCallback,
|
|
59
|
-
setCacheNameDetails,
|
|
60
|
-
// Controllers
|
|
61
|
-
RuntimeCacheController,
|
|
62
|
-
// Caching strategies
|
|
63
|
-
CacheFirst,
|
|
64
|
-
CacheOnly,
|
|
65
|
-
NetworkFirst,
|
|
66
|
-
NetworkOnly,
|
|
67
|
-
PrecacheStrategy,
|
|
68
|
-
StaleWhileRevalidate,
|
|
69
|
-
Strategy,
|
|
70
|
-
StrategyHandler,
|
|
71
|
-
// Routing
|
|
72
|
-
NavigationRoute,
|
|
73
|
-
PrecacheRoute,
|
|
74
|
-
RegExpRoute,
|
|
75
|
-
Route,
|
|
76
|
-
// Background synchronizing
|
|
77
11
|
BackgroundSyncPlugin,
|
|
78
12
|
BackgroundSyncQueue,
|
|
13
|
+
type BackgroundSyncQueueEntry,
|
|
14
|
+
type BackgroundSyncQueueOptions,
|
|
79
15
|
BackgroundSyncQueueStore,
|
|
80
16
|
StorableRequest,
|
|
81
|
-
|
|
17
|
+
} from "#lib/background-sync/index.js";
|
|
18
|
+
|
|
19
|
+
// Broadcasting updates
|
|
20
|
+
export {
|
|
21
|
+
BROADCAST_UPDATE_DEFAULT_HEADERS,
|
|
82
22
|
BroadcastCacheUpdate,
|
|
23
|
+
type BroadcastCacheUpdateOptions,
|
|
24
|
+
type BroadcastMessage,
|
|
25
|
+
type BroadcastPayload,
|
|
26
|
+
type BroadcastPayloadGenerator,
|
|
83
27
|
BroadcastUpdatePlugin,
|
|
84
|
-
BROADCAST_UPDATE_DEFAULT_HEADERS,
|
|
85
28
|
responsesAreSame,
|
|
86
|
-
|
|
29
|
+
} from "#lib/broadcast-update/index.js";
|
|
30
|
+
|
|
31
|
+
// Setting cacheability criteria
|
|
32
|
+
export {
|
|
87
33
|
CacheableResponse,
|
|
34
|
+
type CacheableResponseOptions,
|
|
88
35
|
CacheableResponsePlugin,
|
|
89
|
-
|
|
36
|
+
} from "#lib/cacheable-response/index.js";
|
|
37
|
+
|
|
38
|
+
// Controllers
|
|
39
|
+
|
|
40
|
+
// Expiring outdated responses
|
|
41
|
+
export {
|
|
90
42
|
CacheExpiration,
|
|
91
43
|
ExpirationPlugin,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
44
|
+
type ExpirationPluginOptions,
|
|
45
|
+
} from "#lib/expiration/index.js";
|
|
46
|
+
|
|
47
|
+
// Extensions
|
|
48
|
+
export {
|
|
49
|
+
GoogleAnalytics,
|
|
50
|
+
type GoogleAnalyticsInitializeOptions,
|
|
51
|
+
type GoogleAnalyticsOptions,
|
|
95
52
|
initializeGoogleAnalytics,
|
|
96
|
-
|
|
53
|
+
type PrecacheFallbackEntry,
|
|
54
|
+
PrecacheFallbackPlugin,
|
|
55
|
+
type PrecacheFallbackPluginOptions,
|
|
56
|
+
PrecacheRoute,
|
|
57
|
+
PrecacheStrategy,
|
|
58
|
+
RuntimeCache,
|
|
59
|
+
type RuntimeCacheOptions,
|
|
60
|
+
} from "#lib/extensions/index.js";
|
|
61
|
+
|
|
62
|
+
// Handling range requests
|
|
63
|
+
export {
|
|
97
64
|
createPartialResponse,
|
|
98
65
|
RangeRequestsPlugin,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
66
|
+
} from "#lib/range-requests/index.js";
|
|
67
|
+
|
|
68
|
+
// Built-in caching strategies
|
|
69
|
+
export {
|
|
70
|
+
CacheFirst,
|
|
71
|
+
CacheOnly,
|
|
72
|
+
NetworkFirst,
|
|
73
|
+
type NetworkFirstOptions,
|
|
74
|
+
NetworkOnly,
|
|
75
|
+
type NetworkOnlyOptions,
|
|
76
|
+
StaleWhileRevalidate,
|
|
77
|
+
Strategy,
|
|
78
|
+
StrategyHandler,
|
|
79
|
+
type StrategyOptions,
|
|
80
|
+
} from "#lib/strategies/index.js";
|
|
81
|
+
|
|
82
|
+
// Core
|
|
83
|
+
export {
|
|
84
|
+
Serwist,
|
|
85
|
+
cacheNames,
|
|
86
|
+
copyResponse,
|
|
87
|
+
disableDevLogs,
|
|
88
|
+
disableNavigationPreload,
|
|
89
|
+
enableNavigationPreload,
|
|
90
|
+
isNavigationPreloadSupported,
|
|
91
|
+
registerQuotaErrorCallback,
|
|
92
|
+
setCacheNameDetails,
|
|
108
93
|
// Routing
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
BackgroundSyncQueueEntry,
|
|
113
|
-
// Broadcasting updates
|
|
114
|
-
BroadcastCacheUpdateOptions,
|
|
115
|
-
BroadcastPayload,
|
|
116
|
-
BroadcastPayloadGenerator,
|
|
117
|
-
BroadcastMessage,
|
|
118
|
-
// Setting cacheability criteria
|
|
119
|
-
CacheableResponseOptions,
|
|
120
|
-
// Expiring outdated responses
|
|
121
|
-
ExpirationPluginOptions,
|
|
122
|
-
// Precaching
|
|
123
|
-
PrecacheFallbackEntry,
|
|
124
|
-
PrecacheFallbackPluginOptions,
|
|
125
|
-
// Google Analytics
|
|
126
|
-
GoogleAnalyticsInitializeOptions,
|
|
94
|
+
NavigationRoute,
|
|
95
|
+
RegExpRoute,
|
|
96
|
+
Route,
|
|
127
97
|
};
|
|
128
|
-
|
|
98
|
+
|
|
99
|
+
// Core (modern)
|
|
100
|
+
// TODO(v11): rename once we remove legacy `Serwist` and `SerwistOptions`
|
|
101
|
+
export type { Serwist as SerwistState, SerwistOptions as CreateSerwistOptions } from "#lib/core.js";
|
|
102
|
+
export { createSerwist } from "#lib/core.js";
|
|
103
|
+
// Extension
|
|
104
|
+
export type * from "#lib/extension.js";
|
|
105
|
+
export {
|
|
106
|
+
addEventListeners,
|
|
107
|
+
createActivateHandler,
|
|
108
|
+
createCacheHandler,
|
|
109
|
+
createFetchHandler,
|
|
110
|
+
createInstallHandler,
|
|
111
|
+
iterateExtensions,
|
|
112
|
+
setCatchHandler,
|
|
113
|
+
setDefaultHandler,
|
|
114
|
+
} from "#lib/functions/handlers.js";
|
|
115
|
+
export { findMatchingRoute, handleRequest, registerCapture, registerRoute, unregisterRoute } from "#lib/functions/router.js";
|
|
116
|
+
|
|
117
|
+
export type { HTTPMethod, SerwistOptions, NavigationRouteMatchOptions };
|
|
118
|
+
export type * from "#lib/types.js";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { FetchDidFailCallbackParam, StrategyPlugin } from "
|
|
9
|
+
import type { FetchDidFailCallbackParam, StrategyPlugin } from "#lib/types.js";
|
|
10
10
|
import type { BackgroundSyncQueueOptions } from "./BackgroundSyncQueue.js";
|
|
11
11
|
import { BackgroundSyncQueue } from "./BackgroundSyncQueue.js";
|
|
12
12
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SerwistError } from "../../utils/SerwistError.js";
|
|
2
1
|
/*
|
|
3
2
|
Copyright 2018 Google LLC
|
|
4
3
|
|
|
@@ -6,9 +5,10 @@ import { SerwistError } from "../../utils/SerwistError.js";
|
|
|
6
5
|
license that can be found in the LICENSE file or at
|
|
7
6
|
https://opensource.org/licenses/MIT.
|
|
8
7
|
*/
|
|
9
|
-
import { assert } from "
|
|
10
|
-
import { getFriendlyURL } from "
|
|
11
|
-
import { logger } from "
|
|
8
|
+
import { assert } from "#utils/assert.js";
|
|
9
|
+
import { getFriendlyURL } from "#utils/getFriendlyURL.js";
|
|
10
|
+
import { logger } from "#utils/logger.js";
|
|
11
|
+
import { SerwistError } from "#utils/SerwistError.js";
|
|
12
12
|
import type { BackgroundSyncQueueStoreEntry, UnidentifiedQueueStoreEntry } from "./BackgroundSyncQueueDb.js";
|
|
13
13
|
import { BackgroundSyncQueueStore } from "./BackgroundSyncQueueStore.js";
|
|
14
14
|
import { StorableRequest } from "./StorableRequest.js";
|
|
@@ -350,7 +350,7 @@ export class BackgroundSyncQueue {
|
|
|
350
350
|
* the queue (which registers a retry for the next sync event).
|
|
351
351
|
*/
|
|
352
352
|
async replayRequests(): Promise<void> {
|
|
353
|
-
let entry: BackgroundSyncQueueEntry | undefined
|
|
353
|
+
let entry: BackgroundSyncQueueEntry | undefined;
|
|
354
354
|
while ((entry = await this.shiftRequest())) {
|
|
355
355
|
try {
|
|
356
356
|
await fetch(entry.request.clone());
|
|
@@ -358,7 +358,7 @@ export class BackgroundSyncQueue {
|
|
|
358
358
|
if (process.env.NODE_ENV !== "production") {
|
|
359
359
|
logger.log(`Request for '${getFriendlyURL(entry.request.url)}' ` + `has been replayed in queue '${this._name}'`);
|
|
360
360
|
}
|
|
361
|
-
} catch
|
|
361
|
+
} catch {
|
|
362
362
|
await this.unshiftRequest(entry);
|
|
363
363
|
|
|
364
364
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -409,7 +409,7 @@ export class BackgroundSyncQueue {
|
|
|
409
409
|
const syncComplete = async () => {
|
|
410
410
|
this._syncInProgress = true;
|
|
411
411
|
|
|
412
|
-
let syncError: Error | undefined
|
|
412
|
+
let syncError: Error | undefined;
|
|
413
413
|
try {
|
|
414
414
|
await this._onSync({ queue: this });
|
|
415
415
|
} catch (error) {
|
|
@@ -81,7 +81,7 @@ export class BackgroundSyncQueueDb {
|
|
|
81
81
|
async getAllEntriesByQueueName(queueName: string): Promise<BackgroundSyncQueueStoreEntry[]> {
|
|
82
82
|
const db = await this.getDb();
|
|
83
83
|
const results = await db.getAllFromIndex(REQUEST_OBJECT_STORE_NAME, QUEUE_NAME_INDEX, IDBKeyRange.only(queueName));
|
|
84
|
-
return results ? results :
|
|
84
|
+
return results ? results : ([] as BackgroundSyncQueueStoreEntry[]);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
license that can be found in the LICENSE file or at
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
|
-
import { assert } from "
|
|
8
|
+
import { assert } from "#utils/assert.js";
|
|
9
9
|
import type { BackgroundSyncQueueStoreEntry, UnidentifiedQueueStoreEntry } from "./BackgroundSyncQueueDb.js";
|
|
10
10
|
import { BackgroundSyncQueueDb } from "./BackgroundSyncQueueDb.js";
|
|
11
11
|
|
|
@@ -52,7 +52,6 @@ export class BackgroundSyncQueueStore {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// biome-ignore lint/performance/noDelete: Don't specify an ID since one is automatically generated.
|
|
56
55
|
delete entry.id;
|
|
57
56
|
entry.queueName = this._queueName;
|
|
58
57
|
|
|
@@ -86,7 +85,6 @@ export class BackgroundSyncQueueStore {
|
|
|
86
85
|
// Pick an ID one less than the lowest ID in the object store.
|
|
87
86
|
entry.id = firstId - 1;
|
|
88
87
|
} else {
|
|
89
|
-
// biome-ignore lint/performance/noDelete: Let the auto-incrementor assign the ID.
|
|
90
88
|
delete entry.id;
|
|
91
89
|
}
|
|
92
90
|
entry.queueName = this._queueName;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { MapLikeObject } from "
|
|
10
|
-
import { assert } from "
|
|
9
|
+
import type { MapLikeObject } from "#lib/types.js";
|
|
10
|
+
import { assert } from "#utils/assert.js";
|
|
11
11
|
|
|
12
12
|
type SerializableProperties = "method" | "referrer" | "referrerPolicy" | "mode" | "credentials" | "cache" | "redirect" | "integrity" | "keepalive";
|
|
13
13
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { BackgroundSyncPlugin } from "./BackgroundSyncPlugin.js";
|
|
2
|
+
export type { BackgroundSyncQueueEntry, BackgroundSyncQueueOptions } from "./BackgroundSyncQueue.js";
|
|
3
|
+
export { BackgroundSyncQueue } from "./BackgroundSyncQueue.js";
|
|
4
|
+
export { BackgroundSyncQueueStore } from "./BackgroundSyncQueueStore.js";
|
|
5
|
+
export { StorableRequest } from "./StorableRequest.js";
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { CacheDidUpdateCallbackParam } from "
|
|
10
|
-
import { assert } from "
|
|
11
|
-
import { logger } from "
|
|
12
|
-
import { resultingClientExists } from "
|
|
13
|
-
import { timeout } from "
|
|
9
|
+
import type { CacheDidUpdateCallbackParam } from "#lib/types.js";
|
|
10
|
+
import { assert } from "#utils/assert.js";
|
|
11
|
+
import { logger } from "#utils/logger.js";
|
|
12
|
+
import { resultingClientExists } from "#utils/resultingClientExists.js";
|
|
13
|
+
import { timeout } from "#utils/timeout.js";
|
|
14
14
|
import {
|
|
15
15
|
BROADCAST_UPDATE_DEFAULT_HEADERS,
|
|
16
16
|
BROADCAST_UPDATE_DEFAULT_NOTIFY,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { CacheDidUpdateCallbackParam, StrategyPlugin } from "
|
|
9
|
+
import type { CacheDidUpdateCallbackParam, StrategyPlugin } from "#lib/types.js";
|
|
10
10
|
import { BroadcastCacheUpdate } from "./BroadcastCacheUpdate.js";
|
|
11
11
|
import type { BroadcastCacheUpdateOptions } from "./types.js";
|
|
12
12
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { BroadcastCacheUpdate } from "./BroadcastCacheUpdate.js";
|
|
2
|
+
export { BroadcastUpdatePlugin } from "./BroadcastUpdatePlugin.js";
|
|
3
|
+
export { BROADCAST_UPDATE_DEFAULT_HEADERS } from "./constants.js";
|
|
4
|
+
export { responsesAreSame } from "./responsesAreSame.js";
|
|
5
|
+
export type { BroadcastCacheUpdateOptions, BroadcastMessage, BroadcastPayload, BroadcastPayloadGenerator } from "./types.js";
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { logger } from "#utils/logger.js";
|
|
10
|
+
import { SerwistError } from "#utils/SerwistError.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Given two responses, compares several header values to see if they are
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CacheDidUpdateCallbackParam } from "
|
|
1
|
+
import type { CacheDidUpdateCallbackParam } from "#lib/types.js";
|
|
2
2
|
import type { BROADCAST_UPDATE_MESSAGE_META, BROADCAST_UPDATE_MESSAGE_TYPE } from "./constants.js";
|
|
3
3
|
|
|
4
4
|
export interface BroadcastCacheUpdateOptions {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { cacheNames as privateCacheNames } from "
|
|
9
|
+
import { cacheNames as privateCacheNames } from "#utils/cacheNames.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Get the current cache names and prefix/suffix used by Serwist.
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { assert } from "#utils/assert.js";
|
|
10
|
+
import { getFriendlyURL } from "#utils/getFriendlyURL.js";
|
|
11
|
+
import { logger } from "#utils/logger.js";
|
|
12
|
+
import { SerwistError } from "#utils/SerwistError.js";
|
|
13
13
|
|
|
14
14
|
export interface CacheableResponseOptions {
|
|
15
15
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { StrategyPlugin } from "
|
|
9
|
+
import type { StrategyPlugin } from "#lib/types.js";
|
|
10
10
|
import type { CacheableResponseOptions } from "./CacheableResponse.js";
|
|
11
11
|
import { CacheableResponse } from "./CacheableResponse.js";
|
|
12
12
|
|