serwist 9.1.1 → 10.0.0-preview.10
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/waitUntil.js +141 -134
- package/dist/index.d.ts +22 -49
- 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 +25 -3
- package/dist/index.js +2231 -452
- package/dist/lib/{backgroundSync → background-sync}/BackgroundSyncPlugin.d.ts +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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/{legacy/PrecacheController.d.ts → lib/extensions/precache/extension.d.ts} +56 -66
- package/dist/lib/extensions/precache/extension.d.ts.map +1 -0
- package/dist/lib/extensions/precache/options.d.ts +26 -0
- package/dist/lib/extensions/precache/options.d.ts.map +1 -0
- package/dist/lib/extensions/precache/plugin-cache-key.d.ts +16 -0
- 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} +4 -4
- package/dist/lib/extensions/precache/plugin-fallback.d.ts.map +1 -0
- package/dist/lib/extensions/precache/plugin-install-report.d.ts +14 -0
- 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/lib/{strategies/PrecacheStrategy.d.ts → extensions/precache/strategy.d.ts} +7 -7
- package/dist/lib/extensions/precache/strategy.d.ts.map +1 -0
- package/dist/lib/extensions/runtime-cache.d.ts +71 -0
- 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 +3 -3
- 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} +71 -62
- 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 +3 -3
- package/dist/lib/strategies/Strategy.d.ts.map +1 -1
- package/dist/lib/strategies/StrategyHandler.d.ts +4 -4
- 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 +2 -2
- package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +1 -1
- package/dist/{types.d.ts → lib/types.d.ts} +7 -65
- 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/createCacheKey.d.ts +1 -1
- package/dist/utils/createCacheKey.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/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 +2 -2
- package/dist/utils/pluginUtils.d.ts.map +1 -1
- package/package.json +28 -11
- package/src/index.internal.ts +16 -16
- package/src/index.ts +100 -107
- package/src/lib/{backgroundSync → background-sync}/BackgroundSyncPlugin.ts +2 -2
- package/src/lib/{backgroundSync → background-sync}/BackgroundSyncQueue.ts +4 -4
- package/src/lib/{backgroundSync → background-sync}/BackgroundSyncQueueStore.ts +1 -1
- 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 +2 -2
- 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 +3 -3
- 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} +42 -48
- 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/lib/extensions/precache/extension.ts +306 -0
- package/src/lib/extensions/precache/options.ts +49 -0
- package/src/{legacy/utils/PrecacheCacheKeyPlugin.ts → lib/extensions/precache/plugin-cache-key.ts} +7 -8
- package/src/lib/{precaching/PrecacheFallbackPlugin.ts → extensions/precache/plugin-fallback.ts} +19 -8
- package/src/{utils/PrecacheInstallReportPlugin.ts → lib/extensions/precache/plugin-install-report.ts} +5 -5
- package/src/lib/extensions/precache/route.ts +72 -0
- package/src/lib/{strategies/PrecacheStrategy.ts → extensions/precache/strategy.ts} +12 -12
- package/src/lib/extensions/runtime-cache.ts +126 -0
- 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 +3 -3
- 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 +3 -3
- package/src/lib/strategies/CacheOnly.ts +3 -3
- package/src/lib/strategies/NetworkFirst.ts +4 -4
- package/src/lib/strategies/NetworkOnly.ts +4 -4
- package/src/lib/strategies/StaleWhileRevalidate.ts +4 -4
- package/src/lib/strategies/Strategy.ts +7 -7
- package/src/lib/strategies/StrategyHandler.ts +18 -18
- package/src/lib/strategies/index.ts +10 -0
- package/src/lib/strategies/plugins/cacheOkAndOpaquePlugin.ts +2 -2
- package/src/lib/strategies/utils/messages.ts +2 -2
- package/src/{types.ts → lib/types.ts} +17 -70
- 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 -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 +2 -2
- package/dist/NavigationRoute.d.ts +0 -56
- package/dist/NavigationRoute.d.ts.map +0 -1
- package/dist/PrecacheRoute.d.ts +0 -16
- package/dist/PrecacheRoute.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/chunks/printInstallDetails.js +0 -1601
- package/dist/chunks/resultingClientExists.js +0 -32
- package/dist/constants.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/index.legacy.d.ts +0 -28
- package/dist/index.legacy.d.ts.map +0 -1
- package/dist/index.legacy.js +0 -790
- package/dist/legacy/PrecacheController.d.ts.map +0 -1
- package/dist/legacy/PrecacheFallbackPlugin.d.ts +0 -61
- package/dist/legacy/PrecacheFallbackPlugin.d.ts.map +0 -1
- package/dist/legacy/PrecacheRoute.d.ts +0 -19
- package/dist/legacy/PrecacheRoute.d.ts.map +0 -1
- package/dist/legacy/Router.d.ts +0 -151
- package/dist/legacy/Router.d.ts.map +0 -1
- package/dist/legacy/addPlugins.d.ts +0 -9
- package/dist/legacy/addPlugins.d.ts.map +0 -1
- package/dist/legacy/addRoute.d.ts +0 -14
- package/dist/legacy/addRoute.d.ts.map +0 -1
- package/dist/legacy/constants.d.ts.map +0 -1
- package/dist/legacy/createHandlerBoundToURL.d.ts +0 -17
- package/dist/legacy/createHandlerBoundToURL.d.ts.map +0 -1
- package/dist/legacy/fallbacks.d.ts +0 -59
- package/dist/legacy/fallbacks.d.ts.map +0 -1
- package/dist/legacy/getCacheKeyForURL.d.ts +0 -20
- package/dist/legacy/getCacheKeyForURL.d.ts.map +0 -1
- package/dist/legacy/handlePrecaching.d.ts +0 -54
- package/dist/legacy/handlePrecaching.d.ts.map +0 -1
- package/dist/legacy/initializeGoogleAnalytics.d.ts +0 -38
- package/dist/legacy/initializeGoogleAnalytics.d.ts.map +0 -1
- package/dist/legacy/installSerwist.d.ts +0 -81
- package/dist/legacy/installSerwist.d.ts.map +0 -1
- package/dist/legacy/matchPrecache.d.ts +0 -15
- package/dist/legacy/matchPrecache.d.ts.map +0 -1
- package/dist/legacy/precache.d.ts +0 -20
- package/dist/legacy/precache.d.ts.map +0 -1
- package/dist/legacy/precacheAndRoute.d.ts +0 -14
- package/dist/legacy/precacheAndRoute.d.ts.map +0 -1
- package/dist/legacy/registerRoute.d.ts +0 -16
- package/dist/legacy/registerRoute.d.ts.map +0 -1
- package/dist/legacy/registerRuntimeCaching.d.ts +0 -11
- package/dist/legacy/registerRuntimeCaching.d.ts.map +0 -1
- package/dist/legacy/setCatchHandler.d.ts +0 -10
- package/dist/legacy/setCatchHandler.d.ts.map +0 -1
- package/dist/legacy/setDefaultHandler.d.ts +0 -13
- package/dist/legacy/setDefaultHandler.d.ts.map +0 -1
- package/dist/legacy/singletonPrecacheController.d.ts +0 -34
- package/dist/legacy/singletonPrecacheController.d.ts.map +0 -1
- package/dist/legacy/singletonRouter.d.ts +0 -41
- package/dist/legacy/singletonRouter.d.ts.map +0 -1
- package/dist/legacy/unregisterRoute.d.ts +0 -9
- package/dist/legacy/unregisterRoute.d.ts.map +0 -1
- package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts +0 -16
- package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
- package/dist/legacy/utils/getCacheKeyForURL.d.ts +0 -14
- package/dist/legacy/utils/getCacheKeyForURL.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 +0 -10
- 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/lib/strategies/PrecacheStrategy.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/dist/utils/PrecacheCacheKeyPlugin.d.ts +0 -16
- package/dist/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
- package/dist/utils/PrecacheInstallReportPlugin.d.ts +0 -14
- package/dist/utils/PrecacheInstallReportPlugin.d.ts.map +0 -1
- package/dist/utils/parsePrecacheOptions.d.ts +0 -26
- package/dist/utils/parsePrecacheOptions.d.ts.map +0 -1
- package/src/NavigationRoute.ts +0 -118
- package/src/PrecacheRoute.ts +0 -45
- package/src/RegExpRoute.ts +0 -74
- package/src/Route.ts +0 -67
- package/src/Serwist.ts +0 -867
- package/src/copyResponse.ts +0 -58
- package/src/disableDevLogs.ts +0 -10
- package/src/index.legacy.ts +0 -62
- package/src/legacy/PrecacheController.ts +0 -337
- package/src/legacy/PrecacheFallbackPlugin.ts +0 -92
- package/src/legacy/PrecacheRoute.ts +0 -48
- package/src/legacy/Router.ts +0 -484
- package/src/legacy/addPlugins.ts +0 -21
- package/src/legacy/addRoute.ts +0 -27
- package/src/legacy/createHandlerBoundToURL.ts +0 -30
- package/src/legacy/fallbacks.ts +0 -94
- package/src/legacy/getCacheKeyForURL.ts +0 -32
- package/src/legacy/handlePrecaching.ts +0 -86
- package/src/legacy/initializeGoogleAnalytics.ts +0 -218
- package/src/legacy/installSerwist.ts +0 -170
- package/src/legacy/matchPrecache.ts +0 -27
- package/src/legacy/precache.ts +0 -33
- package/src/legacy/precacheAndRoute.ts +0 -27
- package/src/legacy/registerRoute.ts +0 -28
- package/src/legacy/registerRuntimeCaching.ts +0 -17
- package/src/legacy/setCatchHandler.ts +0 -21
- package/src/legacy/setDefaultHandler.ts +0 -24
- package/src/legacy/singletonPrecacheController.ts +0 -53
- package/src/legacy/singletonRouter.ts +0 -70
- package/src/legacy/unregisterRoute.ts +0 -13
- package/src/legacy/utils/getCacheKeyForURL.ts +0 -36
- package/src/lib/googleAnalytics/constants.ts +0 -22
- package/src/registerQuotaErrorCallback.ts +0 -34
- package/src/setCacheNameDetails.ts +0 -53
- package/src/utils/PrecacheCacheKeyPlugin.ts +0 -33
- package/src/utils/parsePrecacheOptions.ts +0 -47
- /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/{legacy → lib/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/{backgroundSync → background-sync}/BackgroundSyncQueueDb.ts +0 -0
- /package/src/lib/{broadcastUpdate → broadcast-update}/constants.ts +0 -0
- /package/src/{constants.ts → lib/constants.ts} +0 -0
- /package/src/{legacy → lib/extensions/google-analytics}/constants.ts +0 -0
package/dist/utils/assert.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MapLikeObject } from "
|
|
1
|
+
import type { MapLikeObject } from "#lib/types.js";
|
|
2
2
|
declare const finalAssertExports: {
|
|
3
3
|
hasMethod: (object: MapLikeObject, expectedMethod: string, details: MapLikeObject) => void;
|
|
4
4
|
isArray: (value: any[], details: MapLikeObject) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/utils/assert.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/utils/assert.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAmEnD,QAAA,MAAM,kBAAkB;wBApDG,aAAa,kBAAkB,MAAM,WAAW,aAAa;qBANhE,GAAG,EAAE,WAAW,aAAa;yBAsB3C,OAAO,iBAEA,QAAQ,WACd,aAAa;qBAQA,GAAG,eAAe,GAAG,EAAE,WAAW,aAAa;qBAnB/C,OAAO,gBAAgB,MAAM,WAAW,aAAa;4BA2BpE,GAAG,iBAEK,QAAQ,WACd,aAAa;QAwBjB,CAAC;AAER,OAAO,EAAE,kBAAkB,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCacheKey.d.ts","sourceRoot":"","sources":["../../src/utils/createCacheKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createCacheKey.d.ts","sourceRoot":"","sources":["../../src/utils/createCacheKey.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,UAAU,QAAQ;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAKD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,aAAa,GAAG,MAAM,KAAG,QAuC9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateURLVariations.d.ts","sourceRoot":"","sources":["../../src/utils/generateURLVariations.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"generateURLVariations.d.ts","sourceRoot":"","sources":["../../src/utils/generateURLVariations.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D;;;;;;;;GAQG;AACH,wBAAiB,qBAAqB,CACpC,GAAG,EAAE,MAAM,EACX,EACE,cAA6B,EAC7B,2BAAmD,EACnD,SAAgB,EAChB,eAAe,GAChB,GAAE,oBAAyB,GAC3B,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CA0BlC"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ declare global {
|
|
|
14
14
|
* before using it.
|
|
15
15
|
*/
|
|
16
16
|
export declare const logger: {
|
|
17
|
-
error: (...args: any[]) => void;
|
|
18
17
|
debug: (...args: any[]) => void;
|
|
19
18
|
log: (...args: any[]) => void;
|
|
20
19
|
warn: (...args: any[]) => void;
|
|
20
|
+
error: (...args: any[]) => void;
|
|
21
21
|
groupCollapsed: (...args: any[]) => void;
|
|
22
22
|
groupEnd: (...args: any[]) => void;
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAQA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,iBAAiB;QACzB,qBAAqB,EAAE,OAAO,CAAC;KAChC;IAED,UAAU,MAAM;QACd,qBAAqB,EAAE,OAAO,CAAC;KAChC;CACF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;qBAmEoC,GAAG,EAAE,KAAK,IAAI;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAQA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,iBAAiB;QACzB,qBAAqB,EAAE,OAAO,CAAC;KAChC;IAED,UAAU,MAAM;QACd,qBAAqB,EAAE,OAAO,CAAC;KAChC;CACF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;qBAmEoC,GAAG,EAAE,KAAK,IAAI;mBAAd,GAAG,EAAE,KAAK,IAAI;oBAAd,GAAG,EAAE,KAAK,IAAI;qBAAd,GAAG,EAAE,KAAK,IAAI;8BAAd,GAAG,EAAE,KAAK,IAAI;wBAAd,GAAG,EAAE,KAAK,IAAI;CAE3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeHandler.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeHandler.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"normalizeHandler.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeHandler.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGtE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,YAAY,KAAG,kBAqBxD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import type { RouteHandler, RouteMatchCallback } from "
|
|
1
|
+
import type { HTTPMethod } from "#lib/constants.js";
|
|
2
|
+
import { Route } from "#lib/route.js";
|
|
3
|
+
import type { RouteHandler, RouteMatchCallback } from "#lib/types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Parses a `RegExp`, string, or function with a caching strategy into a {@linkcode Route}. This is for
|
|
6
6
|
* when you want to create a {@linkcode Route}, but you don't want to register it just yet: sometimes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseRoute.d.ts","sourceRoot":"","sources":["../../src/utils/parseRoute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseRoute.d.ts","sourceRoot":"","sources":["../../src/utils/parseRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAe,KAAK,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAItE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,GAAG,MAAM,GAAG,kBAAkB,GAAG,KAAK,EAAE,UAAU,YAAY,EAAE,SAAS,UAAU,KAAG,KAyD/H,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StrategyPlugin } from "#lib/types.js";
|
|
2
2
|
export declare const pluginUtils: {
|
|
3
|
-
filter: (plugins:
|
|
3
|
+
filter: (plugins: StrategyPlugin[], callbackName: string) => StrategyPlugin[];
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=pluginUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginUtils.d.ts","sourceRoot":"","sources":["../../src/utils/pluginUtils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pluginUtils.d.ts","sourceRoot":"","sources":["../../src/utils/pluginUtils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,eAAO,MAAM,WAAW;sBACJ,cAAc,EAAE,gBAAgB,MAAM,KAAG,cAAc,EAAE;CAG5E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serwist",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-preview.10",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
5
6
|
"description": "A Swiss Army knife for service workers.",
|
|
6
7
|
"files": [
|
|
7
8
|
"src",
|
|
@@ -25,23 +26,38 @@
|
|
|
25
26
|
"types": "./dist/index.d.ts",
|
|
26
27
|
"typesVersions": {
|
|
27
28
|
"*": {
|
|
28
|
-
"legacy": [
|
|
29
|
-
"./dist/index.legacy.d.ts"
|
|
30
|
-
],
|
|
31
29
|
"internal": [
|
|
32
30
|
"./dist/index.internal.d.ts"
|
|
33
31
|
]
|
|
34
32
|
}
|
|
35
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
|
+
},
|
|
36
56
|
"exports": {
|
|
37
57
|
".": {
|
|
38
58
|
"types": "./dist/index.d.ts",
|
|
39
59
|
"default": "./dist/index.js"
|
|
40
60
|
},
|
|
41
|
-
"./legacy": {
|
|
42
|
-
"types": "./dist/index.legacy.d.ts",
|
|
43
|
-
"default": "./dist/index.legacy.js"
|
|
44
|
-
},
|
|
45
61
|
"./internal": {
|
|
46
62
|
"types": "./dist/index.internal.d.ts",
|
|
47
63
|
"default": "./dist/index.internal.js"
|
|
@@ -49,13 +65,13 @@
|
|
|
49
65
|
"./package.json": "./package.json"
|
|
50
66
|
},
|
|
51
67
|
"dependencies": {
|
|
52
|
-
"idb": "8.0.3"
|
|
68
|
+
"idb": "8.0.3",
|
|
69
|
+
"@serwist/utils": "10.0.0-preview.10"
|
|
53
70
|
},
|
|
54
71
|
"devDependencies": {
|
|
55
72
|
"rollup": "4.45.1",
|
|
56
73
|
"typescript": "5.8.3",
|
|
57
|
-
"@serwist/configs": "
|
|
58
|
-
"@serwist/utils": "9.1.1"
|
|
74
|
+
"@serwist/configs": "10.0.0-preview.10"
|
|
59
75
|
},
|
|
60
76
|
"peerDependencies": {
|
|
61
77
|
"typescript": ">=5.0.0"
|
|
@@ -69,6 +85,7 @@
|
|
|
69
85
|
"build": "rimraf dist && NODE_ENV=production rollup --config rollup.config.js",
|
|
70
86
|
"dev": "rollup --config rollup.config.js --watch",
|
|
71
87
|
"lint": "biome lint ./src",
|
|
88
|
+
"qcheck": "biome check ./src",
|
|
72
89
|
"typecheck": "tsc"
|
|
73
90
|
}
|
|
74
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,125 +1,118 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Route } from "
|
|
6
|
-
import { Serwist, type SerwistOptions } from "
|
|
7
|
-
import {
|
|
8
|
-
import type { HTTPMethod } from "./constants.js";
|
|
9
|
-
import { copyResponse } from "./copyResponse.js";
|
|
10
|
-
import { disableDevLogs } from "./disableDevLogs.js";
|
|
11
|
-
import { BackgroundSyncPlugin } from "./lib/backgroundSync/BackgroundSyncPlugin.js";
|
|
12
|
-
import type { BackgroundSyncQueueEntry, BackgroundSyncQueueOptions } from "./lib/backgroundSync/BackgroundSyncQueue.js";
|
|
13
|
-
import { BackgroundSyncQueue } from "./lib/backgroundSync/BackgroundSyncQueue.js";
|
|
14
|
-
import { BackgroundSyncQueueStore } from "./lib/backgroundSync/BackgroundSyncQueueStore.js";
|
|
15
|
-
import { StorableRequest } from "./lib/backgroundSync/StorableRequest.js";
|
|
16
|
-
import { BroadcastCacheUpdate } from "./lib/broadcastUpdate/BroadcastCacheUpdate.js";
|
|
17
|
-
import { BroadcastUpdatePlugin } from "./lib/broadcastUpdate/BroadcastUpdatePlugin.js";
|
|
18
|
-
import { BROADCAST_UPDATE_DEFAULT_HEADERS } from "./lib/broadcastUpdate/constants.js";
|
|
19
|
-
import { responsesAreSame } from "./lib/broadcastUpdate/responsesAreSame.js";
|
|
20
|
-
import type { BroadcastCacheUpdateOptions, BroadcastMessage, BroadcastPayload, BroadcastPayloadGenerator } from "./lib/broadcastUpdate/types.js";
|
|
21
|
-
import { CacheableResponse } from "./lib/cacheableResponse/CacheableResponse.js";
|
|
22
|
-
import type { CacheableResponseOptions } from "./lib/cacheableResponse/CacheableResponse.js";
|
|
23
|
-
import { CacheableResponsePlugin } from "./lib/cacheableResponse/CacheableResponsePlugin.js";
|
|
24
|
-
import { CacheExpiration } from "./lib/expiration/CacheExpiration.js";
|
|
25
|
-
import type { ExpirationPluginOptions } from "./lib/expiration/ExpirationPlugin.js";
|
|
26
|
-
import { ExpirationPlugin } from "./lib/expiration/ExpirationPlugin.js";
|
|
27
|
-
import { initializeGoogleAnalytics } from "./lib/googleAnalytics/initializeGoogleAnalytics.js";
|
|
28
|
-
import type { GoogleAnalyticsInitializeOptions } from "./lib/googleAnalytics/initializeGoogleAnalytics.js";
|
|
29
|
-
import type { PrecacheFallbackEntry, PrecacheFallbackPluginOptions } from "./lib/precaching/PrecacheFallbackPlugin.js";
|
|
30
|
-
import { PrecacheFallbackPlugin } from "./lib/precaching/PrecacheFallbackPlugin.js";
|
|
31
|
-
import { RangeRequestsPlugin } from "./lib/rangeRequests/RangeRequestsPlugin.js";
|
|
32
|
-
import { createPartialResponse } from "./lib/rangeRequests/createPartialResponse.js";
|
|
33
|
-
import { CacheFirst } from "./lib/strategies/CacheFirst.js";
|
|
34
|
-
import { CacheOnly } from "./lib/strategies/CacheOnly.js";
|
|
35
|
-
import type { NetworkFirstOptions } from "./lib/strategies/NetworkFirst.js";
|
|
36
|
-
import { NetworkFirst } from "./lib/strategies/NetworkFirst.js";
|
|
37
|
-
import type { NetworkOnlyOptions } from "./lib/strategies/NetworkOnly.js";
|
|
38
|
-
import { NetworkOnly } from "./lib/strategies/NetworkOnly.js";
|
|
39
|
-
import { PrecacheStrategy } from "./lib/strategies/PrecacheStrategy.js";
|
|
40
|
-
import { StaleWhileRevalidate } from "./lib/strategies/StaleWhileRevalidate.js";
|
|
41
|
-
import type { StrategyOptions } from "./lib/strategies/Strategy.js";
|
|
42
|
-
import { Strategy } from "./lib/strategies/Strategy.js";
|
|
43
|
-
import { StrategyHandler } from "./lib/strategies/StrategyHandler.js";
|
|
44
|
-
import { disableNavigationPreload, enableNavigationPreload, isNavigationPreloadSupported } from "./navigationPreload.js";
|
|
45
|
-
import { registerQuotaErrorCallback } from "./registerQuotaErrorCallback.js";
|
|
46
|
-
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";
|
|
47
8
|
|
|
9
|
+
// Background synchronizing
|
|
48
10
|
export {
|
|
49
|
-
// Core
|
|
50
|
-
Serwist,
|
|
51
|
-
cacheNames,
|
|
52
|
-
copyResponse,
|
|
53
|
-
disableDevLogs,
|
|
54
|
-
disableNavigationPreload,
|
|
55
|
-
enableNavigationPreload,
|
|
56
|
-
isNavigationPreloadSupported,
|
|
57
|
-
registerQuotaErrorCallback,
|
|
58
|
-
setCacheNameDetails,
|
|
59
|
-
// Caching strategies
|
|
60
|
-
CacheFirst,
|
|
61
|
-
CacheOnly,
|
|
62
|
-
NetworkFirst,
|
|
63
|
-
NetworkOnly,
|
|
64
|
-
PrecacheStrategy,
|
|
65
|
-
StaleWhileRevalidate,
|
|
66
|
-
Strategy,
|
|
67
|
-
StrategyHandler,
|
|
68
|
-
// Routing
|
|
69
|
-
NavigationRoute,
|
|
70
|
-
PrecacheRoute,
|
|
71
|
-
RegExpRoute,
|
|
72
|
-
Route,
|
|
73
|
-
// Background synchronizing
|
|
74
11
|
BackgroundSyncPlugin,
|
|
75
12
|
BackgroundSyncQueue,
|
|
13
|
+
type BackgroundSyncQueueEntry,
|
|
14
|
+
type BackgroundSyncQueueOptions,
|
|
76
15
|
BackgroundSyncQueueStore,
|
|
77
16
|
StorableRequest,
|
|
78
|
-
|
|
17
|
+
} from "#lib/background-sync/index.js";
|
|
18
|
+
|
|
19
|
+
// Broadcasting updates
|
|
20
|
+
export {
|
|
21
|
+
BROADCAST_UPDATE_DEFAULT_HEADERS,
|
|
79
22
|
BroadcastCacheUpdate,
|
|
23
|
+
type BroadcastCacheUpdateOptions,
|
|
24
|
+
type BroadcastMessage,
|
|
25
|
+
type BroadcastPayload,
|
|
26
|
+
type BroadcastPayloadGenerator,
|
|
80
27
|
BroadcastUpdatePlugin,
|
|
81
|
-
BROADCAST_UPDATE_DEFAULT_HEADERS,
|
|
82
28
|
responsesAreSame,
|
|
83
|
-
|
|
29
|
+
} from "#lib/broadcast-update/index.js";
|
|
30
|
+
|
|
31
|
+
// Setting cacheability criteria
|
|
32
|
+
export {
|
|
84
33
|
CacheableResponse,
|
|
34
|
+
type CacheableResponseOptions,
|
|
85
35
|
CacheableResponsePlugin,
|
|
86
|
-
|
|
36
|
+
} from "#lib/cacheable-response/index.js";
|
|
37
|
+
|
|
38
|
+
// Controllers
|
|
39
|
+
|
|
40
|
+
// Expiring outdated responses
|
|
41
|
+
export {
|
|
87
42
|
CacheExpiration,
|
|
88
43
|
ExpirationPlugin,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
44
|
+
type ExpirationPluginOptions,
|
|
45
|
+
} from "#lib/expiration/index.js";
|
|
46
|
+
|
|
47
|
+
// Extensions
|
|
48
|
+
export {
|
|
49
|
+
GoogleAnalytics,
|
|
50
|
+
type GoogleAnalyticsInitializeOptions,
|
|
51
|
+
type GoogleAnalyticsOptions,
|
|
92
52
|
initializeGoogleAnalytics,
|
|
93
|
-
|
|
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 {
|
|
94
64
|
createPartialResponse,
|
|
95
65
|
RangeRequestsPlugin,
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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,
|
|
105
93
|
// Routing
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
BackgroundSyncQueueEntry,
|
|
110
|
-
// Broadcasting updates
|
|
111
|
-
BroadcastCacheUpdateOptions,
|
|
112
|
-
BroadcastPayload,
|
|
113
|
-
BroadcastPayloadGenerator,
|
|
114
|
-
BroadcastMessage,
|
|
115
|
-
// Setting cacheability criteria
|
|
116
|
-
CacheableResponseOptions,
|
|
117
|
-
// Expiring outdated responses
|
|
118
|
-
ExpirationPluginOptions,
|
|
119
|
-
// Precaching
|
|
120
|
-
PrecacheFallbackEntry,
|
|
121
|
-
PrecacheFallbackPluginOptions,
|
|
122
|
-
// Google Analytics
|
|
123
|
-
GoogleAnalyticsInitializeOptions,
|
|
94
|
+
NavigationRoute,
|
|
95
|
+
RegExpRoute,
|
|
96
|
+
Route,
|
|
124
97
|
};
|
|
125
|
-
|
|
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,
|
|
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
|
|
|
@@ -14,7 +14,7 @@ import { BackgroundSyncQueue } from "./BackgroundSyncQueue.js";
|
|
|
14
14
|
* A class implementing the `fetchDidFail` lifecycle callback. This makes it
|
|
15
15
|
* easier to add failed requests to a {@linkcode BackgroundSyncQueue}.
|
|
16
16
|
*/
|
|
17
|
-
export class BackgroundSyncPlugin implements
|
|
17
|
+
export class BackgroundSyncPlugin implements StrategyPlugin {
|
|
18
18
|
private readonly _queue: BackgroundSyncQueue;
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -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";
|
|
@@ -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
|
|
|
@@ -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,
|
|
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
|
|
|
@@ -14,7 +14,7 @@ import type { BroadcastCacheUpdateOptions } from "./types.js";
|
|
|
14
14
|
* A class implementing the `cacheDidUpdate` lifecycle callback. It will automatically
|
|
15
15
|
* broadcast a message whenever a cached response is updated.
|
|
16
16
|
*/
|
|
17
|
-
export class BroadcastUpdatePlugin implements
|
|
17
|
+
export class BroadcastUpdatePlugin implements StrategyPlugin {
|
|
18
18
|
private readonly _broadcastUpdate: BroadcastCacheUpdate;
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -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 {
|
|
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
|
|
|
@@ -15,7 +15,7 @@ import { CacheableResponse } from "./CacheableResponse.js";
|
|
|
15
15
|
* easier to add in cacheability checks to requests made via Serwist's built-in
|
|
16
16
|
* strategies.
|
|
17
17
|
*/
|
|
18
|
-
export class CacheableResponsePlugin implements
|
|
18
|
+
export class CacheableResponsePlugin implements StrategyPlugin {
|
|
19
19
|
private readonly _cacheableResponse: CacheableResponse;
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -36,7 +36,7 @@ export class CacheableResponsePlugin implements SerwistPlugin {
|
|
|
36
36
|
* @returns
|
|
37
37
|
* @private
|
|
38
38
|
*/
|
|
39
|
-
cacheWillUpdate:
|
|
39
|
+
cacheWillUpdate: StrategyPlugin["cacheWillUpdate"] = async ({ response }) => {
|
|
40
40
|
if (this._cacheableResponse.isResponseCacheable(response)) {
|
|
41
41
|
return response;
|
|
42
42
|
}
|