serwist 9.5.7 → 9.5.8

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.
Files changed (242) hide show
  1. package/dist/chunks/Route-wAAof_Tq.d.ts +36 -0
  2. package/dist/chunks/Route-wAAof_Tq.d.ts.map +1 -0
  3. package/dist/chunks/cacheNames-DZwJpopB.d.ts +35 -0
  4. package/dist/chunks/cacheNames-DZwJpopB.d.ts.map +1 -0
  5. package/dist/chunks/index.internal-Dxj9Ni9X.js +65 -0
  6. package/dist/chunks/index.internal-Dxj9Ni9X.js.map +1 -0
  7. package/dist/chunks/printInstallDetails-c9A08ZVZ.js +2026 -0
  8. package/dist/chunks/printInstallDetails-c9A08ZVZ.js.map +1 -0
  9. package/dist/chunks/types-CKER0KBv.d.ts +786 -0
  10. package/dist/chunks/types-CKER0KBv.d.ts.map +1 -0
  11. package/dist/chunks/waitUntil-BHDx3Rgo.js +486 -0
  12. package/dist/chunks/waitUntil-BHDx3Rgo.js.map +1 -0
  13. package/dist/index.d.mts +1525 -0
  14. package/dist/index.d.mts.map +1 -0
  15. package/dist/index.internal.d.mts +337 -0
  16. package/dist/index.internal.d.mts.map +1 -0
  17. package/dist/index.internal.mjs +3 -0
  18. package/dist/index.legacy.d.mts +892 -0
  19. package/dist/index.legacy.d.mts.map +1 -0
  20. package/dist/index.legacy.mjs +1162 -0
  21. package/dist/index.legacy.mjs.map +1 -0
  22. package/dist/index.mjs +1847 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/package.json +16 -17
  25. package/dist/NavigationRoute.d.ts +0 -56
  26. package/dist/NavigationRoute.d.ts.map +0 -1
  27. package/dist/PrecacheRoute.d.ts +0 -16
  28. package/dist/PrecacheRoute.d.ts.map +0 -1
  29. package/dist/RegExpRoute.d.ts +0 -24
  30. package/dist/RegExpRoute.d.ts.map +0 -1
  31. package/dist/Route.d.ts +0 -33
  32. package/dist/Route.d.ts.map +0 -1
  33. package/dist/Serwist.d.ts +0 -299
  34. package/dist/Serwist.d.ts.map +0 -1
  35. package/dist/cacheNames.d.ts +0 -20
  36. package/dist/cacheNames.d.ts.map +0 -1
  37. package/dist/chunks/printInstallDetails.js +0 -1575
  38. package/dist/chunks/resultingClientExists.js +0 -32
  39. package/dist/chunks/waitUntil.js +0 -449
  40. package/dist/constants.d.ts +0 -15
  41. package/dist/constants.d.ts.map +0 -1
  42. package/dist/copyResponse.d.ts +0 -18
  43. package/dist/copyResponse.d.ts.map +0 -1
  44. package/dist/disableDevLogs.d.ts +0 -7
  45. package/dist/disableDevLogs.d.ts.map +0 -1
  46. package/dist/index.d.ts +0 -50
  47. package/dist/index.d.ts.map +0 -1
  48. package/dist/index.internal.d.ts +0 -18
  49. package/dist/index.internal.d.ts.map +0 -1
  50. package/dist/index.internal.js +0 -23
  51. package/dist/index.js +0 -1533
  52. package/dist/index.legacy.d.ts +0 -28
  53. package/dist/index.legacy.d.ts.map +0 -1
  54. package/dist/index.legacy.js +0 -790
  55. package/dist/legacy/PrecacheController.d.ts +0 -145
  56. package/dist/legacy/PrecacheController.d.ts.map +0 -1
  57. package/dist/legacy/PrecacheFallbackPlugin.d.ts +0 -61
  58. package/dist/legacy/PrecacheFallbackPlugin.d.ts.map +0 -1
  59. package/dist/legacy/PrecacheRoute.d.ts +0 -19
  60. package/dist/legacy/PrecacheRoute.d.ts.map +0 -1
  61. package/dist/legacy/Router.d.ts +0 -151
  62. package/dist/legacy/Router.d.ts.map +0 -1
  63. package/dist/legacy/addPlugins.d.ts +0 -9
  64. package/dist/legacy/addPlugins.d.ts.map +0 -1
  65. package/dist/legacy/addRoute.d.ts +0 -14
  66. package/dist/legacy/addRoute.d.ts.map +0 -1
  67. package/dist/legacy/constants.d.ts +0 -10
  68. package/dist/legacy/constants.d.ts.map +0 -1
  69. package/dist/legacy/createHandlerBoundToURL.d.ts +0 -17
  70. package/dist/legacy/createHandlerBoundToURL.d.ts.map +0 -1
  71. package/dist/legacy/fallbacks.d.ts +0 -59
  72. package/dist/legacy/fallbacks.d.ts.map +0 -1
  73. package/dist/legacy/getCacheKeyForURL.d.ts +0 -20
  74. package/dist/legacy/getCacheKeyForURL.d.ts.map +0 -1
  75. package/dist/legacy/handlePrecaching.d.ts +0 -54
  76. package/dist/legacy/handlePrecaching.d.ts.map +0 -1
  77. package/dist/legacy/initializeGoogleAnalytics.d.ts +0 -38
  78. package/dist/legacy/initializeGoogleAnalytics.d.ts.map +0 -1
  79. package/dist/legacy/installSerwist.d.ts +0 -81
  80. package/dist/legacy/installSerwist.d.ts.map +0 -1
  81. package/dist/legacy/matchPrecache.d.ts +0 -15
  82. package/dist/legacy/matchPrecache.d.ts.map +0 -1
  83. package/dist/legacy/precache.d.ts +0 -20
  84. package/dist/legacy/precache.d.ts.map +0 -1
  85. package/dist/legacy/precacheAndRoute.d.ts +0 -14
  86. package/dist/legacy/precacheAndRoute.d.ts.map +0 -1
  87. package/dist/legacy/registerRoute.d.ts +0 -16
  88. package/dist/legacy/registerRoute.d.ts.map +0 -1
  89. package/dist/legacy/registerRuntimeCaching.d.ts +0 -11
  90. package/dist/legacy/registerRuntimeCaching.d.ts.map +0 -1
  91. package/dist/legacy/setCatchHandler.d.ts +0 -10
  92. package/dist/legacy/setCatchHandler.d.ts.map +0 -1
  93. package/dist/legacy/setDefaultHandler.d.ts +0 -13
  94. package/dist/legacy/setDefaultHandler.d.ts.map +0 -1
  95. package/dist/legacy/singletonPrecacheController.d.ts +0 -34
  96. package/dist/legacy/singletonPrecacheController.d.ts.map +0 -1
  97. package/dist/legacy/singletonRouter.d.ts +0 -41
  98. package/dist/legacy/singletonRouter.d.ts.map +0 -1
  99. package/dist/legacy/unregisterRoute.d.ts +0 -9
  100. package/dist/legacy/unregisterRoute.d.ts.map +0 -1
  101. package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts +0 -16
  102. package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
  103. package/dist/legacy/utils/getCacheKeyForURL.d.ts +0 -14
  104. package/dist/legacy/utils/getCacheKeyForURL.d.ts.map +0 -1
  105. package/dist/lib/backgroundSync/BackgroundSyncPlugin.d.ts +0 -23
  106. package/dist/lib/backgroundSync/BackgroundSyncPlugin.d.ts.map +0 -1
  107. package/dist/lib/backgroundSync/BackgroundSyncQueue.d.ts +0 -182
  108. package/dist/lib/backgroundSync/BackgroundSyncQueue.d.ts.map +0 -1
  109. package/dist/lib/backgroundSync/BackgroundSyncQueueDb.d.ts +0 -90
  110. package/dist/lib/backgroundSync/BackgroundSyncQueueDb.d.ts.map +0 -1
  111. package/dist/lib/backgroundSync/BackgroundSyncQueueStore.d.ts +0 -75
  112. package/dist/lib/backgroundSync/BackgroundSyncQueueStore.d.ts.map +0 -1
  113. package/dist/lib/backgroundSync/StorableRequest.d.ts +0 -51
  114. package/dist/lib/backgroundSync/StorableRequest.d.ts.map +0 -1
  115. package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts +0 -44
  116. package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +0 -1
  117. package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts +0 -24
  118. package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +0 -1
  119. package/dist/lib/broadcastUpdate/constants.d.ts +0 -5
  120. package/dist/lib/broadcastUpdate/constants.d.ts.map +0 -1
  121. package/dist/lib/broadcastUpdate/responsesAreSame.d.ts +0 -11
  122. package/dist/lib/broadcastUpdate/responsesAreSame.d.ts.map +0 -1
  123. package/dist/lib/broadcastUpdate/types.d.ts +0 -35
  124. package/dist/lib/broadcastUpdate/types.d.ts.map +0 -1
  125. package/dist/lib/cacheableResponse/CacheableResponse.d.ts +0 -40
  126. package/dist/lib/cacheableResponse/CacheableResponse.d.ts.map +0 -1
  127. package/dist/lib/cacheableResponse/CacheableResponsePlugin.d.ts +0 -27
  128. package/dist/lib/cacheableResponse/CacheableResponsePlugin.d.ts.map +0 -1
  129. package/dist/lib/expiration/CacheExpiration.d.ts +0 -66
  130. package/dist/lib/expiration/CacheExpiration.d.ts.map +0 -1
  131. package/dist/lib/expiration/ExpirationPlugin.d.ts +0 -116
  132. package/dist/lib/expiration/ExpirationPlugin.d.ts.map +0 -1
  133. package/dist/lib/expiration/models/CacheTimestampsModel.d.ts +0 -73
  134. package/dist/lib/expiration/models/CacheTimestampsModel.d.ts.map +0 -1
  135. package/dist/lib/googleAnalytics/constants.d.ts +0 -10
  136. package/dist/lib/googleAnalytics/constants.d.ts.map +0 -1
  137. package/dist/lib/googleAnalytics/initializeGoogleAnalytics.d.ts +0 -30
  138. package/dist/lib/googleAnalytics/initializeGoogleAnalytics.d.ts.map +0 -1
  139. package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts +0 -49
  140. package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts.map +0 -1
  141. package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts +0 -18
  142. package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts.map +0 -1
  143. package/dist/lib/rangeRequests/createPartialResponse.d.ts +0 -18
  144. package/dist/lib/rangeRequests/createPartialResponse.d.ts.map +0 -1
  145. package/dist/lib/rangeRequests/utils/calculateEffectiveBoundaries.d.ts +0 -14
  146. package/dist/lib/rangeRequests/utils/calculateEffectiveBoundaries.d.ts.map +0 -1
  147. package/dist/lib/rangeRequests/utils/parseRangeHeader.d.ts +0 -12
  148. package/dist/lib/rangeRequests/utils/parseRangeHeader.d.ts.map +0 -1
  149. package/dist/lib/strategies/CacheFirst.d.ts +0 -23
  150. package/dist/lib/strategies/CacheFirst.d.ts.map +0 -1
  151. package/dist/lib/strategies/CacheOnly.d.ts +0 -20
  152. package/dist/lib/strategies/CacheOnly.d.ts.map +0 -1
  153. package/dist/lib/strategies/NetworkFirst.d.ts +0 -61
  154. package/dist/lib/strategies/NetworkFirst.d.ts.map +0 -1
  155. package/dist/lib/strategies/NetworkOnly.d.ts +0 -32
  156. package/dist/lib/strategies/NetworkOnly.d.ts.map +0 -1
  157. package/dist/lib/strategies/PrecacheStrategy.d.ts +0 -69
  158. package/dist/lib/strategies/PrecacheStrategy.d.ts.map +0 -1
  159. package/dist/lib/strategies/StaleWhileRevalidate.d.ts +0 -35
  160. package/dist/lib/strategies/StaleWhileRevalidate.d.ts.map +0 -1
  161. package/dist/lib/strategies/Strategy.d.ts +0 -81
  162. package/dist/lib/strategies/Strategy.d.ts.map +0 -1
  163. package/dist/lib/strategies/StrategyHandler.d.ts +0 -190
  164. package/dist/lib/strategies/StrategyHandler.d.ts.map +0 -1
  165. package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts +0 -3
  166. package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +0 -1
  167. package/dist/lib/strategies/utils/messages.d.ts +0 -5
  168. package/dist/lib/strategies/utils/messages.d.ts.map +0 -1
  169. package/dist/models/messages/messageGenerator.d.ts +0 -4
  170. package/dist/models/messages/messageGenerator.d.ts.map +0 -1
  171. package/dist/models/messages/messages.d.ts +0 -44
  172. package/dist/models/messages/messages.d.ts.map +0 -1
  173. package/dist/models/pluginEvents.d.ts +0 -10
  174. package/dist/models/pluginEvents.d.ts.map +0 -1
  175. package/dist/models/quotaErrorCallbacks.d.ts +0 -3
  176. package/dist/models/quotaErrorCallbacks.d.ts.map +0 -1
  177. package/dist/navigationPreload.d.ts +0 -24
  178. package/dist/navigationPreload.d.ts.map +0 -1
  179. package/dist/registerQuotaErrorCallback.d.ts +0 -8
  180. package/dist/registerQuotaErrorCallback.d.ts.map +0 -1
  181. package/dist/setCacheNameDetails.d.ts +0 -9
  182. package/dist/setCacheNameDetails.d.ts.map +0 -1
  183. package/dist/types.d.ts +0 -445
  184. package/dist/types.d.ts.map +0 -1
  185. package/dist/utils/Deferred.d.ts +0 -19
  186. package/dist/utils/Deferred.d.ts.map +0 -1
  187. package/dist/utils/PrecacheCacheKeyPlugin.d.ts +0 -16
  188. package/dist/utils/PrecacheCacheKeyPlugin.d.ts.map +0 -1
  189. package/dist/utils/PrecacheInstallReportPlugin.d.ts +0 -14
  190. package/dist/utils/PrecacheInstallReportPlugin.d.ts.map +0 -1
  191. package/dist/utils/SerwistError.d.ts +0 -24
  192. package/dist/utils/SerwistError.d.ts.map +0 -1
  193. package/dist/utils/assert.d.ts +0 -11
  194. package/dist/utils/assert.d.ts.map +0 -1
  195. package/dist/utils/cacheMatchIgnoreParams.d.ts +0 -15
  196. package/dist/utils/cacheMatchIgnoreParams.d.ts.map +0 -1
  197. package/dist/utils/cacheNames.d.ts +0 -40
  198. package/dist/utils/cacheNames.d.ts.map +0 -1
  199. package/dist/utils/canConstructReadableStream.d.ts +0 -12
  200. package/dist/utils/canConstructReadableStream.d.ts.map +0 -1
  201. package/dist/utils/canConstructResponseFromBodyStream.d.ts +0 -11
  202. package/dist/utils/canConstructResponseFromBodyStream.d.ts.map +0 -1
  203. package/dist/utils/cleanupOutdatedCaches.d.ts +0 -6
  204. package/dist/utils/cleanupOutdatedCaches.d.ts.map +0 -1
  205. package/dist/utils/clientsClaim.d.ts +0 -6
  206. package/dist/utils/clientsClaim.d.ts.map +0 -1
  207. package/dist/utils/createCacheKey.d.ts +0 -16
  208. package/dist/utils/createCacheKey.d.ts.map +0 -1
  209. package/dist/utils/deleteOutdatedCaches.d.ts +0 -18
  210. package/dist/utils/deleteOutdatedCaches.d.ts.map +0 -1
  211. package/dist/utils/dontWaitFor.d.ts +0 -7
  212. package/dist/utils/dontWaitFor.d.ts.map +0 -1
  213. package/dist/utils/executeQuotaErrorCallbacks.d.ts +0 -8
  214. package/dist/utils/executeQuotaErrorCallbacks.d.ts.map +0 -1
  215. package/dist/utils/generateURLVariations.d.ts +0 -12
  216. package/dist/utils/generateURLVariations.d.ts.map +0 -1
  217. package/dist/utils/getFriendlyURL.d.ts +0 -3
  218. package/dist/utils/getFriendlyURL.d.ts.map +0 -1
  219. package/dist/utils/logger.d.ts +0 -24
  220. package/dist/utils/logger.d.ts.map +0 -1
  221. package/dist/utils/normalizeHandler.d.ts +0 -10
  222. package/dist/utils/normalizeHandler.d.ts.map +0 -1
  223. package/dist/utils/parsePrecacheOptions.d.ts +0 -26
  224. package/dist/utils/parsePrecacheOptions.d.ts.map +0 -1
  225. package/dist/utils/parseRoute.d.ts +0 -16
  226. package/dist/utils/parseRoute.d.ts.map +0 -1
  227. package/dist/utils/pluginUtils.d.ts +0 -5
  228. package/dist/utils/pluginUtils.d.ts.map +0 -1
  229. package/dist/utils/printCleanupDetails.d.ts +0 -6
  230. package/dist/utils/printCleanupDetails.d.ts.map +0 -1
  231. package/dist/utils/printInstallDetails.d.ts +0 -7
  232. package/dist/utils/printInstallDetails.d.ts.map +0 -1
  233. package/dist/utils/removeIgnoredSearchParams.d.ts +0 -12
  234. package/dist/utils/removeIgnoredSearchParams.d.ts.map +0 -1
  235. package/dist/utils/resultingClientExists.d.ts +0 -12
  236. package/dist/utils/resultingClientExists.d.ts.map +0 -1
  237. package/dist/utils/timeout.d.ts +0 -10
  238. package/dist/utils/timeout.d.ts.map +0 -1
  239. package/dist/utils/waitUntil.d.ts +0 -11
  240. package/dist/utils/waitUntil.d.ts.map +0 -1
  241. package/dist/utils/welcome.d.ts +0 -2
  242. package/dist/utils/welcome.d.ts.map +0 -1
@@ -0,0 +1,892 @@
1
+ import { B as RouteHandler, E as InstallResult, G as RouteMatchCallbackOptions, H as RouteHandlerCallbackOptions, J as SerwistPlugin, K as RuntimeCaching, M as PrecacheEntry, P as PrecacheRouteOptions, Q as Strategy, V as RouteHandlerCallback, W as RouteMatchCallback, l as CleanupResult, tt as HTTPMethod, v as HandlerDidErrorCallbackParam } from "./chunks/types-CKER0KBv.js";
2
+ import { t as Route } from "./chunks/Route-wAAof_Tq.js";
3
+
4
+ //#region src/legacy/addPlugins.d.ts
5
+ /**
6
+ * Adds plugins to the precaching strategy.
7
+ *
8
+ * @param plugins
9
+ * @deprecated
10
+ */
11
+ declare const addPlugins: (plugins: SerwistPlugin[]) => void;
12
+ //#endregion
13
+ //#region src/legacy/addRoute.d.ts
14
+ /**
15
+ * Add a `fetch` listener that will
16
+ * respond to [network requests](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests)
17
+ * with precached assets to the service worker.
18
+ *
19
+ * As for requests for assets that aren't precached, the `fetch` event will not be
20
+ * responded to, allowing the event to fall through to other `fetch` event listeners.
21
+ *
22
+ * @param options See {@linkcode PrecacheRouteOptions}.
23
+ * @deprecated
24
+ */
25
+ declare const addRoute: (options?: PrecacheRouteOptions) => void;
26
+ //#endregion
27
+ //#region src/legacy/createHandlerBoundToURL.d.ts
28
+ /**
29
+ * Helper function that calls {@linkcode PrecacheController.createHandlerBoundToURL}
30
+ * on the default {@linkcode PrecacheController} instance.
31
+ *
32
+ * If you are creating your own {@linkcode PrecacheController}, then call the
33
+ * {@linkcode PrecacheController.createHandlerBoundToURL} function on that instance
34
+ * instead of using this function.
35
+ *
36
+ * @param url The precached URL which will be used to look up the response.
37
+ * @param fallbackToNetwork Whether to attempt to get the
38
+ * response from the network if there's a precache miss.
39
+ * @return
40
+ * @deprecated
41
+ */
42
+ declare const createHandlerBoundToURL: (url: string) => RouteHandlerCallback;
43
+ //#endregion
44
+ //#region src/legacy/PrecacheController.d.ts
45
+ interface PrecacheControllerOptions {
46
+ /**
47
+ * The cache to use for precaching.
48
+ */
49
+ cacheName?: string;
50
+ /**
51
+ * Plugins to use when precaching as well as responding to fetch
52
+ * events for precached assets.
53
+ */
54
+ plugins?: SerwistPlugin[];
55
+ /**
56
+ * Whether to attempt to get the response from the network if there's
57
+ * a precache miss.
58
+ */
59
+ fallbackToNetwork?: boolean;
60
+ /**
61
+ * The number of precache requests that should be made concurrently.
62
+ *
63
+ * @default 1
64
+ */
65
+ concurrentPrecaching?: number;
66
+ }
67
+ /**
68
+ * Performs efficient precaching of assets.
69
+ * @deprecated
70
+ */
71
+ declare class PrecacheController {
72
+ private _installAndActiveListenersAdded?;
73
+ private _concurrentPrecaching;
74
+ private readonly _strategy;
75
+ private readonly _urlsToCacheKeys;
76
+ private readonly _urlsToCacheModes;
77
+ private readonly _cacheKeysToIntegrities;
78
+ /**
79
+ * Create a new PrecacheController.
80
+ *
81
+ * @param options
82
+ */
83
+ constructor({
84
+ cacheName,
85
+ plugins,
86
+ fallbackToNetwork,
87
+ concurrentPrecaching
88
+ }?: PrecacheControllerOptions);
89
+ /**
90
+ * The strategy created by this controller and
91
+ * used to cache assets and respond to `fetch` events.
92
+ */
93
+ get strategy(): Strategy;
94
+ /**
95
+ * Adds items to the precache list, removing any duplicates and
96
+ * stores the files in the precache cache when the service
97
+ * worker installs.
98
+ *
99
+ * This method can be called multiple times.
100
+ *
101
+ * @param entries Array of entries to precache.
102
+ */
103
+ precache(entries: (PrecacheEntry | string)[]): void;
104
+ /**
105
+ * This method will add items to the precache list, removing duplicates
106
+ * and ensuring the information is valid.
107
+ *
108
+ * @param entries Array of entries to precache.
109
+ */
110
+ addToCacheList(entries: (PrecacheEntry | string)[]): void;
111
+ /**
112
+ * Precaches new and updated assets. Call this method from the service worker
113
+ * install event.
114
+ *
115
+ * Note: this method calls `event.waitUntil()` for you, so you do not need
116
+ * to call it yourself in your event handlers.
117
+ *
118
+ * @param event
119
+ * @returns
120
+ */
121
+ install(event: ExtendableEvent): Promise<InstallResult>;
122
+ /**
123
+ * Deletes assets that are no longer present in the current precache manifest.
124
+ * Call this method from the service worker activate event.
125
+ *
126
+ * Note: this method calls `event.waitUntil()` for you, so you do not need
127
+ * to call it yourself in your event handlers.
128
+ *
129
+ * @param event
130
+ * @returns
131
+ */
132
+ activate(event: ExtendableEvent): Promise<CleanupResult>;
133
+ /**
134
+ * Returns a mapping of a precached URL to the corresponding cache key, taking
135
+ * into account the revision information for the URL.
136
+ *
137
+ * @returns A URL to cache key mapping.
138
+ */
139
+ getURLsToCacheKeys(): Map<string, string>;
140
+ /**
141
+ * Returns a list of all the URLs that have been precached by the current
142
+ * service worker.
143
+ *
144
+ * @returns The precached URLs.
145
+ */
146
+ getCachedURLs(): string[];
147
+ /**
148
+ * Returns the cache key used for storing a given URL. If that URL is
149
+ * unversioned, like `/index.html', then the cache key will be the original
150
+ * URL with a search parameter appended to it.
151
+ *
152
+ * @param url A URL whose cache key you want to look up.
153
+ * @returns The versioned URL that corresponds to a cache key
154
+ * for the original URL, or undefined if that URL isn't precached.
155
+ */
156
+ getCacheKeyForURL(url: string): string | undefined;
157
+ /**
158
+ * @param url A cache key whose SRI you want to look up.
159
+ * @returns The subresource integrity associated with the cache key,
160
+ * or undefined if it's not set.
161
+ */
162
+ getIntegrityForCacheKey(cacheKey: string): string | undefined;
163
+ /**
164
+ * This acts as a drop-in replacement for
165
+ * [`cache.match()`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/match)
166
+ * with the following differences:
167
+ *
168
+ * - It knows what the name of the precache is, and only checks in that cache.
169
+ * - It allows you to pass in an "original" URL without versioning parameters,
170
+ * and it will automatically look up the correct cache key for the currently
171
+ * active revision of that URL.
172
+ *
173
+ * E.g., `matchPrecache('index.html')` will find the correct precached
174
+ * response for the currently active service worker, even if the actual cache
175
+ * key is `'/index.html?__WB_REVISION__=1234abcd'`.
176
+ *
177
+ * @param request The key (without revisioning parameters)
178
+ * to look up in the precache.
179
+ * @returns
180
+ */
181
+ matchPrecache(request: string | Request): Promise<Response | undefined>;
182
+ /**
183
+ * Returns a function that looks up `url` in the precache (taking into
184
+ * account revision information), and returns the corresponding `Response`.
185
+ *
186
+ * @param url The precached URL which will be used to lookup the response.
187
+ * @return
188
+ */
189
+ createHandlerBoundToURL(url: string): RouteHandlerCallback;
190
+ }
191
+ //#endregion
192
+ //#region src/legacy/PrecacheFallbackPlugin.d.ts
193
+ /**
194
+ * @deprecated
195
+ */
196
+ interface PrecacheFallbackEntry {
197
+ /**
198
+ * A function that checks whether the fallback entry can be used
199
+ * for a request.
200
+ */
201
+ matcher: (param: HandlerDidErrorCallbackParam) => boolean;
202
+ /**
203
+ * A precached URL to be used as a fallback.
204
+ */
205
+ url: string;
206
+ }
207
+ /**
208
+ * @deprecated
209
+ */
210
+ interface PrecacheFallbackPluginOptions {
211
+ /**
212
+ * Precached URLs to be used as the fallback
213
+ * if the associated strategy can't generate a response.
214
+ */
215
+ fallbackUrls: (string | PrecacheFallbackEntry)[];
216
+ /**
217
+ * An optional {@linkcode PrecacheController} instance. If not provided,
218
+ * the default {@linkcode PrecacheController} will be used.
219
+ */
220
+ precacheController?: PrecacheController;
221
+ }
222
+ /**
223
+ * A class that allows you to specify offline fallbacks
224
+ * to be used when a given strategy is unable to generate a response.
225
+ *
226
+ * It does this by intercepting the `handlerDidError` plugin callback
227
+ * and returning a precached response, taking the expected revision parameter
228
+ * into account automatically.
229
+ *
230
+ * Unless you explicitly pass in a {@linkcode PrecacheController} instance to the
231
+ * constructor, the default instance will be used.
232
+ *
233
+ * @deprecated
234
+ */
235
+ declare class PrecacheFallbackPlugin implements SerwistPlugin {
236
+ private readonly _fallbackUrls;
237
+ private readonly _precacheController;
238
+ /**
239
+ * Constructs a new instance with the associated `fallbackUrls`.
240
+ *
241
+ * @param config
242
+ */
243
+ constructor({
244
+ fallbackUrls,
245
+ precacheController
246
+ }: PrecacheFallbackPluginOptions);
247
+ /**
248
+ * @returns The precache response for one of the fallback URLs, or `undefined` if
249
+ * nothing satisfies the conditions.
250
+ * @private
251
+ */
252
+ handlerDidError(param: HandlerDidErrorCallbackParam): Promise<Response | undefined>;
253
+ }
254
+ //#endregion
255
+ //#region src/legacy/Router.d.ts
256
+ /**
257
+ * A class that can be used to process a `fetch` event using one or more route(s), responding with a response
258
+ * if a matching route exists.
259
+ *
260
+ * If no route matches given a request, the router will use the default handler if one is defined.
261
+ *
262
+ * Should the matching route throw an error, the router will use the catch handler if one is defined to
263
+ * gracefully deal with issues and respond with a response.
264
+ *
265
+ * If a request matches multiple routes, the earliest registered route will be used to respond to the it.
266
+ * @deprecated
267
+ */
268
+ declare class Router {
269
+ private readonly _routes;
270
+ private readonly _defaultHandlerMap;
271
+ private _fetchListenerHandler;
272
+ private _cacheListenerHandler;
273
+ private _catchHandler?;
274
+ /**
275
+ * Initializes a new Router.
276
+ */
277
+ constructor();
278
+ /**
279
+ * @returns routes A `Map` of HTTP method name (`'GET'`, etc.) to an array of all
280
+ * the corresponding {@linkcode Route} instances that are registered.
281
+ */
282
+ get routes(): Map<HTTPMethod, Route[]>;
283
+ /**
284
+ * Adds a `fetch` event listener to respond to events when a route matches
285
+ * the event's request. Effectively no-op if `addFetchListener` has been
286
+ * called, but `removeFetchListener` has not.
287
+ */
288
+ addFetchListener(): void;
289
+ /**
290
+ * Removes `fetch` event listener added by `addFetchListener`.
291
+ * Effectively no-op if either `addFetchListener` has not been called or,
292
+ * if it has, so has `removeFetchListener`.
293
+ */
294
+ removeFetchListener(): void;
295
+ /**
296
+ * Adds a `message` event listener for URLs to cache from the window.
297
+ * This is useful to cache resources loaded on the page prior to when the
298
+ * service worker started controlling it. Effectively no-op if `addCacheListener`
299
+ * has been called, but `removeCacheListener` hasn't.
300
+ *
301
+ * The format of the message data sent from the window should be as follows.
302
+ * Where the `urlsToCache` array may consist of URL strings or an array of
303
+ * URL string + `requestInit` object (the same as you'd pass to `fetch()`).
304
+ *
305
+ * ```
306
+ * {
307
+ * type: 'CACHE_URLS',
308
+ * payload: {
309
+ * urlsToCache: [
310
+ * './script1.js',
311
+ * './script2.js',
312
+ * ['./script3.js', {mode: 'no-cors'}],
313
+ * ],
314
+ * },
315
+ * }
316
+ * ```
317
+ */
318
+ addCacheListener(): void;
319
+ /**
320
+ * Removes the `message` event listener added by `addCacheListener`.
321
+ * Effectively no-op if either `addCacheListener` has not been called or,
322
+ * if it has, so has `removeCacheListener`.
323
+ */
324
+ removeCacheListener(): void;
325
+ /**
326
+ * Apply the routing rules to a `fetch` event to get a response from an
327
+ * appropriate route.
328
+ *
329
+ * @param options
330
+ * @returns A promise is returned if a registered route can handle the request.
331
+ * If there is no matching route and there's no `defaultHandler`, `undefined`
332
+ * is returned.
333
+ */
334
+ handleRequest({
335
+ request,
336
+ event
337
+ }: {
338
+ /**
339
+ * The request to handle.
340
+ */
341
+ request: Request;
342
+ /**
343
+ * The event that triggered the request.
344
+ */
345
+ event: ExtendableEvent;
346
+ }): Promise<Response> | undefined;
347
+ /**
348
+ * Checks a request and URL (and optionally an event) against the list of
349
+ * registered routes, and if there's a match, returns the corresponding
350
+ * route along with any params generated by the match.
351
+ *
352
+ * @param options
353
+ * @returns An object with `route` and `params` properties. They are populated
354
+ * if a matching route was found or `undefined` otherwise.
355
+ */
356
+ findMatchingRoute({
357
+ url,
358
+ sameOrigin,
359
+ request,
360
+ event
361
+ }: RouteMatchCallbackOptions): {
362
+ route?: Route;
363
+ params?: RouteHandlerCallbackOptions["params"];
364
+ };
365
+ /**
366
+ * Define a default handler that's called when no routes explicitly
367
+ * match the incoming request.
368
+ *
369
+ * Each HTTP method (`'GET'`, `'POST'`, etc.) gets its own default handler.
370
+ *
371
+ * Without a default handler, unmatched requests will go against the
372
+ * network as if there were no service worker present.
373
+ *
374
+ * @param handler A callback function that returns a promise resulting in a response.
375
+ * @param method The HTTP method to associate with this default handler. Each method
376
+ * has its own default. Defaults to `'GET'`.
377
+ */
378
+ setDefaultHandler(handler: RouteHandler, method?: HTTPMethod): void;
379
+ /**
380
+ * If a `Route` throws an error while handling a request, this `handler`
381
+ * will be called and given a chance to provide a response.
382
+ *
383
+ * @param handler A callback function that returns a Promise resulting
384
+ * in a Response.
385
+ */
386
+ setCatchHandler(handler: RouteHandler): void;
387
+ /**
388
+ * Registers a `RegExp`, string, or function with a caching
389
+ * strategy to the router.
390
+ *
391
+ * @param capture If the capture param is a {@linkcode Route} object, all other arguments will be ignored.
392
+ * @param handler A callback function that returns a promise resulting in a response.
393
+ * This parameter is required if `capture` is not a {@linkcode Route} object.
394
+ * @param method The HTTP method to match the route against. Defaults to `'GET'`.
395
+ * @returns The generated {@linkcode Route} object.
396
+ */
397
+ registerCapture(capture: RegExp | string | RouteMatchCallback | Route, handler?: RouteHandler, method?: HTTPMethod): Route;
398
+ /**
399
+ * Registers a route with the router.
400
+ *
401
+ * @param route The route to register.
402
+ */
403
+ registerRoute(route: Route): void;
404
+ /**
405
+ * Unregisters a route from the router.
406
+ *
407
+ * @param route The route to unregister.
408
+ */
409
+ unregisterRoute(route: Route): void;
410
+ }
411
+ //#endregion
412
+ //#region src/legacy/fallbacks.d.ts
413
+ interface FallbackEntry extends PrecacheFallbackEntry {
414
+ /**
415
+ * The revision used for precaching.
416
+ */
417
+ revision: string;
418
+ }
419
+ interface FallbacksOptions {
420
+ /**
421
+ * A list of fallback entries.
422
+ */
423
+ entries: FallbackEntry[];
424
+ /**
425
+ * Precache options that will be used for your
426
+ * fallback entries.
427
+ */
428
+ precacheOptions?: PrecacheRouteOptions;
429
+ }
430
+ interface FallbacksOptions {
431
+ /**
432
+ * An optional {@linkcode PrecacheController} instance. If not provided, the singleton
433
+ * {@linkcode PrecacheController} will be used.
434
+ */
435
+ precacheController?: PrecacheController;
436
+ /**
437
+ * An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
438
+ * will be used.
439
+ */
440
+ router?: Router;
441
+ /**
442
+ * Your previous list of caching strategies.
443
+ */
444
+ runtimeCaching: RuntimeCaching[];
445
+ /**
446
+ * A list of fallback entries.
447
+ */
448
+ entries: FallbackEntry[];
449
+ /**
450
+ * Precache options that will be used for your
451
+ * fallback entries.
452
+ */
453
+ precacheOptions?: PrecacheRouteOptions;
454
+ }
455
+ /**
456
+ * Precaches routes so that they can be used as a fallback when
457
+ * a Strategy fails to generate a response.
458
+ *
459
+ * Note: This function mutates `runtimeCaching`. It also precaches the URLs
460
+ * defined in `entries`, so you must NOT precache any of them beforehand.
461
+ *
462
+ * @param options
463
+ * @returns The modified `runtimeCaching` array.
464
+ * @deprecated
465
+ */
466
+ declare const fallbacks$1: ({
467
+ precacheController,
468
+ router,
469
+ runtimeCaching,
470
+ entries,
471
+ precacheOptions
472
+ }: FallbacksOptions) => RuntimeCaching[];
473
+ //#endregion
474
+ //#region src/legacy/getCacheKeyForURL.d.ts
475
+ /**
476
+ * Takes in a URL, and returns the corresponding URL that could be used to
477
+ * lookup the entry in the precache.
478
+ *
479
+ * If a relative URL is provided, the location of the service worker file will
480
+ * be used as the base.
481
+ *
482
+ * For precached entries without revision information, the cache key will be the
483
+ * same as the original URL.
484
+ *
485
+ * For precached entries with revision information, the cache key will be the
486
+ * original URL with the addition of a query parameter used for keeping track of
487
+ * the revision info.
488
+ *
489
+ * @param url The URL whose cache key to look up.
490
+ * @returns The cache key that corresponds to that URL.
491
+ * @deprecated
492
+ */
493
+ declare const getCacheKeyForURL: (url: string) => string | undefined;
494
+ //#endregion
495
+ //#region src/legacy/handlePrecaching.d.ts
496
+ /**
497
+ * @deprecated
498
+ */
499
+ interface HandlePrecachingOptions {
500
+ /**
501
+ * An optional {@linkcode PrecacheController} instance. If not provided, the singleton
502
+ * {@linkcode PrecacheController} will be used.
503
+ */
504
+ precacheController?: PrecacheController;
505
+ /**
506
+ * An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
507
+ * will be used.
508
+ */
509
+ router?: Router;
510
+ /**
511
+ * A list of URLs that should be cached.
512
+ */
513
+ precacheEntries?: (PrecacheEntry | string)[];
514
+ /**
515
+ * Options to customize how Serwist precaches the URLs.
516
+ */
517
+ precacheOptions?: PrecacheRouteOptions;
518
+ /**
519
+ * Whether outdated caches should be removed.
520
+ *
521
+ * @default false
522
+ */
523
+ cleanupOutdatedCaches?: boolean;
524
+ /**
525
+ * An URL that should point to a HTML file with which navigation requests for URLs that aren't
526
+ * precached will be fulfilled.
527
+ */
528
+ navigateFallback?: string;
529
+ /**
530
+ * URLs that should be allowed to use the `navigateFallback` handler.
531
+ */
532
+ navigateFallbackAllowlist?: RegExp[];
533
+ /**
534
+ * URLs that should not be allowed to use the `navigateFallback` handler. This takes precedence
535
+ * over `navigateFallbackAllowlist`.
536
+ */
537
+ navigateFallbackDenylist?: RegExp[];
538
+ }
539
+ /**
540
+ * Handles a list of precache entries and cleans up outdated caches.
541
+ *
542
+ * @param options
543
+ * @deprecated
544
+ */
545
+ declare const handlePrecaching: ({
546
+ precacheController,
547
+ router,
548
+ precacheEntries,
549
+ precacheOptions,
550
+ cleanupOutdatedCaches,
551
+ navigateFallback,
552
+ navigateFallbackAllowlist,
553
+ navigateFallbackDenylist
554
+ }: HandlePrecachingOptions) => void;
555
+ //#endregion
556
+ //#region src/legacy/initializeGoogleAnalytics.d.ts
557
+ /**
558
+ * @deprecated
559
+ */
560
+ interface GoogleAnalyticsInitializeOptions {
561
+ /**
562
+ * An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
563
+ * will be used.
564
+ */
565
+ router?: Router;
566
+ /**
567
+ * The cache name to store and retrieve analytics.js. Defaults to Serwist's default cache names.
568
+ */
569
+ cacheName?: string;
570
+ /**
571
+ * [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),
572
+ * expressed as key/value pairs, to be added to replayed Google Analytics
573
+ * requests. This can be used to, e.g., set a custom dimension indicating
574
+ * that the request was replayed.
575
+ */
576
+ parameterOverrides?: {
577
+ [paramName: string]: string;
578
+ };
579
+ /**
580
+ * A function that allows you to modify the hit parameters prior to replaying
581
+ * the hit. The function is invoked with the original hit's URLSearchParams
582
+ * object as its only argument.
583
+ */
584
+ hitFilter?: (params: URLSearchParams) => void;
585
+ }
586
+ /**
587
+ * Initialize Serwist's offline Google Analytics v3 support.
588
+ *
589
+ * @param options
590
+ * @deprecated Use `serwist.initializeGoogleAnalytics` instead.
591
+ */
592
+ declare const initializeGoogleAnalytics: ({
593
+ router,
594
+ cacheName,
595
+ ...options
596
+ }?: GoogleAnalyticsInitializeOptions) => void;
597
+ //#endregion
598
+ //#region src/legacy/installSerwist.d.ts
599
+ /**
600
+ * Options for {@linkcode installSerwist}.
601
+ *
602
+ * @deprecated
603
+ */
604
+ interface InstallSerwistOptions extends Omit<HandlePrecachingOptions, "precacheController" | "router"> {
605
+ /**
606
+ * An optional {@linkcode PrecacheController} instance. If not provided, the singleton
607
+ * {@linkcode PrecacheController} will be used.
608
+ */
609
+ precacheController?: PrecacheController;
610
+ /**
611
+ * An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
612
+ * will be used.
613
+ */
614
+ router?: Router;
615
+ /**
616
+ * Forces the waiting service worker to become the active one.
617
+ *
618
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting
619
+ */
620
+ skipWaiting?: boolean;
621
+ /**
622
+ * Imports external scripts. They are executed in the order they
623
+ * are passed.
624
+ *
625
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts
626
+ */
627
+ importScripts?: string[];
628
+ /**
629
+ * Enables navigation preloading if it is supported.
630
+ *
631
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/navigationPreload
632
+ */
633
+ navigationPreload?: boolean;
634
+ /**
635
+ * Modifies the prefix of the default cache names used by Serwist packages.
636
+ */
637
+ cacheId?: string | undefined;
638
+ /**
639
+ * Claims any currently available clients once the service worker
640
+ * becomes active. This is normally used in conjunction with `skipWaiting()`.
641
+ *
642
+ * @default false
643
+ */
644
+ clientsClaim?: boolean;
645
+ /**
646
+ * A list of caching strategies.
647
+ */
648
+ runtimeCaching?: RuntimeCaching[];
649
+ /**
650
+ * Your configuration for `@serwist/google-analytics`. This plugin is
651
+ * only initialized when this option is not `undefined` or `false`.
652
+ */
653
+ offlineAnalyticsConfig?: GoogleAnalyticsInitializeOptions | boolean;
654
+ /**
655
+ * Disables Serwist's logging in development mode.
656
+ *
657
+ * @default false
658
+ */
659
+ disableDevLogs?: boolean;
660
+ /**
661
+ * Precaches routes so that they can be used as a fallback when
662
+ * a Strategy fails to generate a response.
663
+ */
664
+ fallbacks?: Pick<FallbacksOptions, "entries">;
665
+ }
666
+ /**
667
+ * Abstracts away the core APIs of Serwist.
668
+ *
669
+ * @param options - `installSerwist` options.
670
+ * @deprecated
671
+ */
672
+ declare const installSerwist: ({
673
+ precacheController,
674
+ router,
675
+ precacheEntries,
676
+ precacheOptions,
677
+ cleanupOutdatedCaches,
678
+ navigateFallback,
679
+ navigateFallbackAllowlist,
680
+ navigateFallbackDenylist,
681
+ skipWaiting,
682
+ importScripts,
683
+ navigationPreload,
684
+ cacheId,
685
+ clientsClaim,
686
+ runtimeCaching,
687
+ offlineAnalyticsConfig,
688
+ disableDevLogs,
689
+ fallbacks
690
+ }: InstallSerwistOptions) => void;
691
+ //#endregion
692
+ //#region src/legacy/matchPrecache.d.ts
693
+ /**
694
+ * Helper function that calls {@linkcode PrecacheController.matchPrecache}
695
+ * on the default {@linkcode PrecacheController} instance.
696
+ *
697
+ * If you are creating your own {@linkcode PrecacheController}, then call
698
+ * the {@linkcode PrecacheController.matchPrecache} function on that instance
699
+ * instead of using this function.
700
+ *
701
+ * @param request The key (without revisioning parameters)
702
+ * to look up in the precache.
703
+ * @returns
704
+ * @deprecated
705
+ */
706
+ declare const matchPrecache: (request: string | Request) => Promise<Response | undefined>;
707
+ //#endregion
708
+ //#region src/legacy/PrecacheRoute.d.ts
709
+ /**
710
+ * A subclass of {@linkcode Route} that takes a {@linkcode PrecacheController}
711
+ * instance and uses it to match incoming requests and handle fetching
712
+ * responses from the precache.
713
+ * @deprecated
714
+ */
715
+ declare class PrecacheRoute extends Route {
716
+ /**
717
+ * @param precacheController A {@linkcode PrecacheController}
718
+ * instance used to both match requests and respond to `fetch` events.
719
+ * @param options Options to control how requests are matched
720
+ * against the list of precached URLs.
721
+ */
722
+ constructor(precacheController: PrecacheController, options?: PrecacheRouteOptions);
723
+ }
724
+ //#endregion
725
+ //#region src/legacy/precache.d.ts
726
+ /**
727
+ * Adds items to the precache list, removing any duplicates and
728
+ * stores the files in the precache cache when the service
729
+ * worker installs.
730
+ *
731
+ * This method can be called multiple times.
732
+ *
733
+ * Please note: This method **will not** serve any of the cached files for you.
734
+ * It only precaches files. To respond to a network request you call
735
+ * {@linkcode addRoute}.
736
+ *
737
+ * If you have a single array of files to precache, you can just call
738
+ * {@linkcode precacheAndRoute}.
739
+ *
740
+ * @param entries Array of entries to precache.
741
+ * @deprecated
742
+ */
743
+ declare const precache: (entries: (PrecacheEntry | string)[]) => void;
744
+ //#endregion
745
+ //#region src/legacy/precacheAndRoute.d.ts
746
+ /**
747
+ * This method will add entries to the precache list and add a route to
748
+ * respond to `fetch` events.
749
+ *
750
+ * This is a convenience method that will call
751
+ * {@linkcode precache} and {@linkcode addRoute} in a single call.
752
+ *
753
+ * @param entries Array of entries to precache.
754
+ * @param options See the {@linkcode PrecacheRouteOptions} options.
755
+ * @deprecated
756
+ */
757
+ declare const precacheAndRoute: (entries: (PrecacheEntry | string)[], options?: PrecacheRouteOptions) => void;
758
+ //#endregion
759
+ //#region src/legacy/registerRoute.d.ts
760
+ /**
761
+ * Registers a `RegExp`, string, or function with a caching
762
+ * strategy to a singleton {@linkcode Router} instance.
763
+ *
764
+ * @param capture If the capture param is a {@linkcode Route}, all other arguments will be ignored.
765
+ * @param handler A callback function that returns a promise resulting in a response.
766
+ * This parameter is required if `capture` is not a {@linkcode Route} object.
767
+ * @param method The HTTP method to match the route against. Defaults to `'GET'`.
768
+ * @returns The generated {@linkcode Route} object, which can then be provided to {@linkcode unregisterRoute} if needed.
769
+ * @deprecated
770
+ */
771
+ declare const registerRoute: (capture: RegExp | string | RouteMatchCallback | Route, handler?: RouteHandler, method?: HTTPMethod) => Route;
772
+ //#endregion
773
+ //#region src/legacy/registerRuntimeCaching.d.ts
774
+ /**
775
+ * Registers caching strategies to a singleton Router instance. It is a simple
776
+ * syntatic sugar for {@linkcode registerRoute}.
777
+ *
778
+ * @param runtimeCachingList
779
+ * @returns
780
+ * @deprecated
781
+ */
782
+ declare const registerRuntimeCaching: (...runtimeCachingList: RuntimeCaching[]) => void;
783
+ //#endregion
784
+ //#region src/legacy/setCatchHandler.d.ts
785
+ /**
786
+ * If a route throws an error while handling a request, this handler
787
+ * will be called and given a chance to provide a response.
788
+ *
789
+ * @param handler A callback function that returns a promise resulting in a response.
790
+ * @deprecated
791
+ */
792
+ declare const setCatchHandler: (handler: RouteHandler) => void;
793
+ //#endregion
794
+ //#region src/legacy/setDefaultHandler.d.ts
795
+ /**
796
+ * Defines a default handler that's called when no routes explicitly
797
+ * match the incoming request.
798
+ *
799
+ * Without a default handler, unmatched requests will go against the
800
+ * network as if there were no service worker present.
801
+ *
802
+ * @param handler A callback function that returns a promise resulting in a response.
803
+ * @deprecated
804
+ */
805
+ declare const setDefaultHandler: (handler: RouteHandler) => void;
806
+ //#endregion
807
+ //#region src/legacy/singletonPrecacheController.d.ts
808
+ /**
809
+ * Creates a new, singleton {@linkcode PrecacheController} if one does not exist. If one does
810
+ * already exist, that instance is returned. This instance is used by Serwist's
811
+ * {@linkcode PrecacheController}-dependent functions and classes unless you provide a different
812
+ * {@linkcode PrecacheController} to them.
813
+ *
814
+ * @returns The singleton {@linkcode PrecacheController}.
815
+ * @deprecated
816
+ */
817
+ declare const getSingletonPrecacheController: () => PrecacheController;
818
+ /**
819
+ * Changes the singleton {@linkcode PrecacheController} to a different instance. This is meant for when you do not
820
+ * want to pass your own {@linkcode PrecacheController} to every one of Serwist's {@linkcode PrecacheController}-dependent
821
+ * functions and classes.
822
+ *
823
+ * It is highly recommended that you call this before anything else, if you plan on doing so.
824
+ *
825
+ * @example
826
+ * ```js
827
+ * import { PrecacheController, setSingletonPrecacheController } from "serwist/legacy";
828
+ *
829
+ * const controller = new PrecacheController();
830
+ *
831
+ * setSingletonPrecacheController(controller);
832
+ *
833
+ * // Do something with your controller...
834
+ * ```
835
+ * @param router
836
+ * @returns The new singleton {@linkcode PrecacheController}.
837
+ * @deprecated
838
+ */
839
+ declare const setSingletonPrecacheController: (precacheController: PrecacheController) => PrecacheController;
840
+ //#endregion
841
+ //#region src/legacy/singletonRouter.d.ts
842
+ /**
843
+ * Creates a new, singleton {@linkcode Router} if one does not exist. If one does
844
+ * already exist, that instance is returned. This instance is used by
845
+ * Serwist's {@linkcode Router}-dependent functions and classes unless you provide
846
+ * a different {@linkcode Router} to them.
847
+ *
848
+ * @returns The singleton {@linkcode Router}.
849
+ * @deprecated
850
+ */
851
+ declare const getSingletonRouter: () => Router;
852
+ /**
853
+ * Changes the singleton {@linkcode Router} to a different instance. This is meant for when you do not
854
+ * want to pass your own {@linkcode Router} to every one of Serwist's {@linkcode Router}-dependent functions and classes.
855
+ * If this or {@linkcode getSingletonRouter} has been called before, it removes the listeners of the
856
+ * previous singleton {@linkcode Router}. It also adds those of the new one, so you need not do that yourself.
857
+ *
858
+ * It is highly recommended that you call this before anything else, if you plan on doing so.
859
+ *
860
+ * @example
861
+ * ```js
862
+ * import { Router, setSingletonRouter } from "serwist/legacy";
863
+ *
864
+ * const router = new Router();
865
+ *
866
+ * setSingletonRouter(router);
867
+ *
868
+ * router.registerRoute(
869
+ * new Route(
870
+ * /\/api\/.*\/*.json/,
871
+ * new NetworkOnly(),
872
+ * "POST",
873
+ * ),
874
+ * );
875
+ * ```
876
+ * @param router
877
+ * @returns The new singleton {@linkcode Router}.
878
+ * @deprecated
879
+ */
880
+ declare const setSingletonRouter: (router: Router) => Router;
881
+ //#endregion
882
+ //#region src/legacy/unregisterRoute.d.ts
883
+ /**
884
+ * Unregisters a route from the singleton {@linkcode Router} instance.
885
+ *
886
+ * @param route The route to unregister.
887
+ * @deprecated
888
+ */
889
+ declare const unregisterRoute: (route: Route) => void;
890
+ //#endregion
891
+ export { type FallbackEntry, type FallbacksOptions, type GoogleAnalyticsInitializeOptions, type HandlePrecachingOptions, type InstallSerwistOptions, PrecacheController, type PrecacheFallbackEntry, PrecacheFallbackPlugin, type PrecacheFallbackPluginOptions, PrecacheRoute, Router, addPlugins, addRoute, createHandlerBoundToURL, fallbacks$1 as fallbacks, getCacheKeyForURL, getSingletonPrecacheController, getSingletonRouter, handlePrecaching, initializeGoogleAnalytics, installSerwist, matchPrecache, precache, precacheAndRoute, registerRoute, registerRuntimeCaching, setCatchHandler, setDefaultHandler, setSingletonPrecacheController, setSingletonRouter, unregisterRoute };
892
+ //# sourceMappingURL=index.legacy.d.mts.map