serwist 9.0.0-preview.24 → 9.0.0-preview.26

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 (232) hide show
  1. package/dist/NavigationRoute.d.ts +6 -7
  2. package/dist/NavigationRoute.d.ts.map +1 -1
  3. package/dist/PrecacheRoute.d.ts +2 -2
  4. package/dist/PrecacheRoute.d.ts.map +1 -1
  5. package/dist/RegExpRoute.d.ts +4 -4
  6. package/dist/RegExpRoute.d.ts.map +1 -1
  7. package/dist/Route.d.ts +10 -10
  8. package/dist/Route.d.ts.map +1 -1
  9. package/dist/Serwist.d.ts +39 -44
  10. package/dist/Serwist.d.ts.map +1 -1
  11. package/dist/chunks/printInstallDetails.js +1587 -0
  12. package/dist/chunks/resultingClientExists.js +1 -1
  13. package/dist/chunks/waitUntil.js +426 -1
  14. package/dist/copyResponse.d.ts +8 -10
  15. package/dist/copyResponse.d.ts.map +1 -1
  16. package/dist/disableDevLogs.d.ts +1 -1
  17. package/dist/index.d.ts +41 -12
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.internal.d.ts +3 -1
  20. package/dist/index.internal.d.ts.map +1 -1
  21. package/dist/index.internal.js +1 -2
  22. package/dist/index.js +1464 -8
  23. package/dist/index.legacy.d.ts +4 -8
  24. package/dist/index.legacy.d.ts.map +1 -1
  25. package/dist/index.legacy.js +166 -16
  26. package/dist/legacy/PrecacheController.d.ts +1 -1
  27. package/dist/legacy/PrecacheController.d.ts.map +1 -1
  28. package/dist/legacy/PrecacheRoute.d.ts.map +1 -1
  29. package/dist/legacy/Router.d.ts +1 -1
  30. package/dist/legacy/Router.d.ts.map +1 -1
  31. package/dist/legacy/constants.d.ts.map +1 -0
  32. package/dist/legacy/fallbacks.d.ts +1 -1
  33. package/dist/legacy/fallbacks.d.ts.map +1 -1
  34. package/dist/legacy/handlePrecaching.d.ts.map +1 -1
  35. package/dist/legacy/initializeGoogleAnalytics.d.ts +38 -0
  36. package/dist/legacy/initializeGoogleAnalytics.d.ts.map +1 -0
  37. package/dist/legacy/installSerwist.d.ts +69 -3
  38. package/dist/legacy/installSerwist.d.ts.map +1 -1
  39. package/dist/legacy/registerRoute.d.ts +1 -1
  40. package/dist/legacy/registerRoute.d.ts.map +1 -1
  41. package/dist/{plugins → lib}/backgroundSync/BackgroundSyncPlugin.d.ts +3 -3
  42. package/dist/lib/backgroundSync/BackgroundSyncPlugin.d.ts.map +1 -0
  43. package/dist/{plugins/backgroundSync/Queue.d.ts → lib/backgroundSync/BackgroundSyncQueue.d.ts} +29 -13
  44. package/dist/lib/backgroundSync/BackgroundSyncQueue.d.ts.map +1 -0
  45. package/dist/{plugins/backgroundSync/QueueDb.d.ts → lib/backgroundSync/BackgroundSyncQueueDb.d.ts} +7 -7
  46. package/dist/lib/backgroundSync/BackgroundSyncQueueDb.d.ts.map +1 -0
  47. package/dist/{plugins/backgroundSync/QueueStore.d.ts → lib/backgroundSync/BackgroundSyncQueueStore.d.ts} +7 -7
  48. package/dist/lib/backgroundSync/BackgroundSyncQueueStore.d.ts.map +1 -0
  49. package/dist/lib/backgroundSync/StorableRequest.d.ts.map +1 -0
  50. package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +1 -0
  51. package/dist/{plugins → lib}/broadcastUpdate/BroadcastUpdatePlugin.d.ts +1 -1
  52. package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +1 -0
  53. package/dist/lib/broadcastUpdate/constants.d.ts +5 -0
  54. package/dist/lib/broadcastUpdate/constants.d.ts.map +1 -0
  55. package/dist/lib/broadcastUpdate/responsesAreSame.d.ts.map +1 -0
  56. package/dist/{plugins → lib}/broadcastUpdate/types.d.ts +3 -3
  57. package/dist/lib/broadcastUpdate/types.d.ts.map +1 -0
  58. package/dist/lib/cacheableResponse/CacheableResponse.d.ts.map +1 -0
  59. package/dist/lib/cacheableResponse/CacheableResponsePlugin.d.ts.map +1 -0
  60. package/dist/{plugins → lib}/expiration/CacheExpiration.d.ts +1 -1
  61. package/dist/lib/expiration/CacheExpiration.d.ts.map +1 -0
  62. package/dist/{plugins → lib}/expiration/ExpirationPlugin.d.ts +1 -1
  63. package/dist/lib/expiration/ExpirationPlugin.d.ts.map +1 -0
  64. package/dist/lib/expiration/models/CacheTimestampsModel.d.ts.map +1 -0
  65. package/dist/lib/googleAnalytics/constants.d.ts +10 -0
  66. package/dist/lib/googleAnalytics/constants.d.ts.map +1 -0
  67. package/dist/{plugins/googleAnalytics/initialize.d.ts → lib/googleAnalytics/initializeGoogleAnalytics.d.ts} +2 -2
  68. package/dist/lib/googleAnalytics/initializeGoogleAnalytics.d.ts.map +1 -0
  69. package/dist/{plugins → lib}/precaching/PrecacheFallbackPlugin.d.ts +1 -1
  70. package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts.map +1 -0
  71. package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts.map +1 -0
  72. package/dist/lib/rangeRequests/createPartialResponse.d.ts.map +1 -0
  73. package/dist/lib/rangeRequests/utils/calculateEffectiveBoundaries.d.ts.map +1 -0
  74. package/dist/lib/rangeRequests/utils/parseRangeHeader.d.ts.map +1 -0
  75. package/dist/{strategies → lib/strategies}/CacheFirst.d.ts +1 -1
  76. package/dist/lib/strategies/CacheFirst.d.ts.map +1 -0
  77. package/dist/{strategies → lib/strategies}/CacheOnly.d.ts +2 -2
  78. package/dist/lib/strategies/CacheOnly.d.ts.map +1 -0
  79. package/dist/{strategies → lib/strategies}/NetworkFirst.d.ts +2 -2
  80. package/dist/lib/strategies/NetworkFirst.d.ts.map +1 -0
  81. package/dist/{strategies → lib/strategies}/NetworkOnly.d.ts +2 -2
  82. package/dist/lib/strategies/NetworkOnly.d.ts.map +1 -0
  83. package/dist/{PrecacheStrategy.d.ts → lib/strategies/PrecacheStrategy.d.ts} +5 -5
  84. package/dist/lib/strategies/PrecacheStrategy.d.ts.map +1 -0
  85. package/dist/{strategies → lib/strategies}/StaleWhileRevalidate.d.ts +1 -1
  86. package/dist/lib/strategies/StaleWhileRevalidate.d.ts.map +1 -0
  87. package/dist/{strategies → lib/strategies}/Strategy.d.ts +15 -17
  88. package/dist/lib/strategies/Strategy.d.ts.map +1 -0
  89. package/dist/{strategies → lib/strategies}/StrategyHandler.d.ts +35 -41
  90. package/dist/lib/strategies/StrategyHandler.d.ts.map +1 -0
  91. package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts +3 -0
  92. package/dist/lib/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +1 -0
  93. package/dist/lib/strategies/utils/messages.d.ts.map +1 -0
  94. package/dist/navigationPreload.d.ts +3 -3
  95. package/dist/types.d.ts +12 -7
  96. package/dist/types.d.ts.map +1 -1
  97. package/dist/utils/PrecacheCacheKeyPlugin.d.ts +1 -1
  98. package/dist/utils/PrecacheCacheKeyPlugin.d.ts.map +1 -1
  99. package/dist/utils/assert.d.ts.map +1 -1
  100. package/dist/utils/cleanupOutdatedCaches.d.ts.map +1 -0
  101. package/dist/utils/clientsClaim.d.ts.map +1 -0
  102. package/dist/{parseRoute.d.ts → utils/parseRoute.d.ts} +3 -3
  103. package/dist/utils/parseRoute.d.ts.map +1 -0
  104. package/package.json +7 -21
  105. package/src/NavigationRoute.ts +6 -7
  106. package/src/PrecacheRoute.ts +5 -5
  107. package/src/RegExpRoute.ts +5 -5
  108. package/src/Route.ts +11 -11
  109. package/src/Serwist.ts +73 -80
  110. package/src/copyResponse.ts +7 -9
  111. package/src/disableDevLogs.ts +1 -1
  112. package/src/index.internal.ts +4 -0
  113. package/src/index.legacy.ts +14 -18
  114. package/src/index.ts +105 -19
  115. package/src/legacy/PrecacheController.ts +8 -8
  116. package/src/legacy/PrecacheFallbackPlugin.ts +1 -1
  117. package/src/legacy/PrecacheRoute.ts +3 -3
  118. package/src/legacy/Router.ts +5 -5
  119. package/src/legacy/fallbacks.ts +3 -3
  120. package/src/legacy/handlePrecaching.ts +1 -1
  121. package/src/legacy/initializeGoogleAnalytics.ts +218 -0
  122. package/src/legacy/installSerwist.ts +156 -5
  123. package/src/legacy/registerRoute.ts +1 -1
  124. package/src/{plugins → lib}/backgroundSync/BackgroundSyncPlugin.ts +6 -6
  125. package/src/{plugins/backgroundSync/Queue.ts → lib/backgroundSync/BackgroundSyncQueue.ts} +47 -26
  126. package/src/{plugins/backgroundSync/QueueDb.ts → lib/backgroundSync/BackgroundSyncQueueDb.ts} +16 -16
  127. package/src/{plugins/backgroundSync/QueueStore.ts → lib/backgroundSync/BackgroundSyncQueueStore.ts} +13 -13
  128. package/src/{plugins → lib}/backgroundSync/StorableRequest.ts +2 -2
  129. package/src/{plugins → lib}/broadcastUpdate/BroadcastCacheUpdate.ts +14 -9
  130. package/src/{plugins → lib}/broadcastUpdate/BroadcastUpdatePlugin.ts +1 -1
  131. package/src/lib/broadcastUpdate/constants.ts +12 -0
  132. package/src/{plugins → lib}/broadcastUpdate/types.ts +3 -3
  133. package/src/{plugins → lib}/cacheableResponse/CacheableResponse.ts +5 -5
  134. package/src/{plugins → lib}/expiration/CacheExpiration.ts +7 -7
  135. package/src/{plugins → lib}/expiration/ExpirationPlugin.ts +10 -10
  136. package/src/lib/googleAnalytics/constants.ts +22 -0
  137. package/src/{plugins/googleAnalytics/initialize.ts → lib/googleAnalytics/initializeGoogleAnalytics.ts} +9 -9
  138. package/src/{strategies → lib/strategies}/CacheFirst.ts +5 -5
  139. package/src/{strategies → lib/strategies}/CacheOnly.ts +6 -6
  140. package/src/{strategies → lib/strategies}/NetworkFirst.ts +7 -7
  141. package/src/{strategies → lib/strategies}/NetworkOnly.ts +7 -7
  142. package/src/{PrecacheStrategy.ts → lib/strategies/PrecacheStrategy.ts} +14 -10
  143. package/src/{strategies → lib/strategies}/StaleWhileRevalidate.ts +5 -5
  144. package/src/{strategies → lib/strategies}/Strategy.ts +19 -21
  145. package/src/{strategies → lib/strategies}/StrategyHandler.ts +45 -51
  146. package/src/{strategies → lib/strategies}/plugins/cacheOkAndOpaquePlugin.ts +1 -1
  147. package/src/{strategies → lib/strategies}/utils/messages.ts +2 -2
  148. package/src/models/messages/messages.ts +1 -1
  149. package/src/navigationPreload.ts +3 -3
  150. package/src/registerQuotaErrorCallback.ts +1 -1
  151. package/src/types.ts +12 -7
  152. package/src/utils/PrecacheCacheKeyPlugin.ts +1 -1
  153. package/src/utils/assert.ts +1 -1
  154. package/src/{cleanupOutdatedCaches.ts → utils/cleanupOutdatedCaches.ts} +3 -4
  155. package/src/utils/executeQuotaErrorCallbacks.ts +1 -1
  156. package/src/{parseRoute.ts → utils/parseRoute.ts} +21 -23
  157. package/src/utils/welcome.ts +1 -1
  158. package/dist/PrecacheStrategy.d.ts.map +0 -1
  159. package/dist/chunks/NetworkOnly.js +0 -599
  160. package/dist/chunks/PrecacheFallbackPlugin.js +0 -634
  161. package/dist/chunks/Serwist.js +0 -1034
  162. package/dist/chunks/registerQuotaErrorCallback.js +0 -17
  163. package/dist/chunks/timeout.js +0 -400
  164. package/dist/cleanupOutdatedCaches.d.ts.map +0 -1
  165. package/dist/clientsClaim.d.ts.map +0 -1
  166. package/dist/index.plugins.d.ts +0 -41
  167. package/dist/index.plugins.d.ts.map +0 -1
  168. package/dist/index.plugins.js +0 -669
  169. package/dist/index.strategies.d.ts +0 -22
  170. package/dist/index.strategies.d.ts.map +0 -1
  171. package/dist/index.strategies.js +0 -144
  172. package/dist/parseRoute.d.ts.map +0 -1
  173. package/dist/plugins/backgroundSync/BackgroundSyncPlugin.d.ts.map +0 -1
  174. package/dist/plugins/backgroundSync/Queue.d.ts.map +0 -1
  175. package/dist/plugins/backgroundSync/QueueDb.d.ts.map +0 -1
  176. package/dist/plugins/backgroundSync/QueueStore.d.ts.map +0 -1
  177. package/dist/plugins/backgroundSync/StorableRequest.d.ts.map +0 -1
  178. package/dist/plugins/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +0 -1
  179. package/dist/plugins/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +0 -1
  180. package/dist/plugins/broadcastUpdate/constants.d.ts +0 -5
  181. package/dist/plugins/broadcastUpdate/constants.d.ts.map +0 -1
  182. package/dist/plugins/broadcastUpdate/responsesAreSame.d.ts.map +0 -1
  183. package/dist/plugins/broadcastUpdate/types.d.ts.map +0 -1
  184. package/dist/plugins/cacheableResponse/CacheableResponse.d.ts.map +0 -1
  185. package/dist/plugins/cacheableResponse/CacheableResponsePlugin.d.ts.map +0 -1
  186. package/dist/plugins/expiration/CacheExpiration.d.ts.map +0 -1
  187. package/dist/plugins/expiration/ExpirationPlugin.d.ts.map +0 -1
  188. package/dist/plugins/expiration/models/CacheTimestampsModel.d.ts.map +0 -1
  189. package/dist/plugins/googleAnalytics/constants.d.ts.map +0 -1
  190. package/dist/plugins/googleAnalytics/initialize.d.ts.map +0 -1
  191. package/dist/plugins/precaching/PrecacheFallbackPlugin.d.ts.map +0 -1
  192. package/dist/plugins/rangeRequests/RangeRequestsPlugin.d.ts.map +0 -1
  193. package/dist/plugins/rangeRequests/createPartialResponse.d.ts.map +0 -1
  194. package/dist/plugins/rangeRequests/utils/calculateEffectiveBoundaries.d.ts.map +0 -1
  195. package/dist/plugins/rangeRequests/utils/parseRangeHeader.d.ts.map +0 -1
  196. package/dist/strategies/CacheFirst.d.ts.map +0 -1
  197. package/dist/strategies/CacheOnly.d.ts.map +0 -1
  198. package/dist/strategies/NetworkFirst.d.ts.map +0 -1
  199. package/dist/strategies/NetworkOnly.d.ts.map +0 -1
  200. package/dist/strategies/StaleWhileRevalidate.d.ts.map +0 -1
  201. package/dist/strategies/Strategy.d.ts.map +0 -1
  202. package/dist/strategies/StrategyHandler.d.ts.map +0 -1
  203. package/dist/strategies/plugins/cacheOkAndOpaquePlugin.d.ts +0 -3
  204. package/dist/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +0 -1
  205. package/dist/strategies/utils/messages.d.ts.map +0 -1
  206. package/src/index.plugins.ts +0 -95
  207. package/src/index.strategies.ts +0 -26
  208. package/src/plugins/broadcastUpdate/constants.ts +0 -12
  209. package/dist/{plugins/googleAnalytics → legacy}/constants.d.ts +0 -0
  210. package/dist/{plugins → lib}/backgroundSync/StorableRequest.d.ts +0 -0
  211. package/dist/{plugins → lib}/broadcastUpdate/BroadcastCacheUpdate.d.ts +0 -0
  212. package/dist/{plugins → lib}/broadcastUpdate/responsesAreSame.d.ts +0 -0
  213. package/dist/{plugins → lib}/cacheableResponse/CacheableResponse.d.ts +0 -0
  214. package/dist/{plugins → lib}/cacheableResponse/CacheableResponsePlugin.d.ts +0 -0
  215. package/dist/{plugins → lib}/expiration/models/CacheTimestampsModel.d.ts +0 -0
  216. package/dist/{plugins → lib}/rangeRequests/RangeRequestsPlugin.d.ts +0 -0
  217. package/dist/{plugins → lib}/rangeRequests/createPartialResponse.d.ts +0 -0
  218. package/dist/{plugins → lib}/rangeRequests/utils/calculateEffectiveBoundaries.d.ts +0 -0
  219. package/dist/{plugins → lib}/rangeRequests/utils/parseRangeHeader.d.ts +0 -0
  220. package/dist/{strategies → lib/strategies}/utils/messages.d.ts +0 -0
  221. package/dist/{cleanupOutdatedCaches.d.ts → utils/cleanupOutdatedCaches.d.ts} +0 -0
  222. package/dist/{clientsClaim.d.ts → utils/clientsClaim.d.ts} +0 -0
  223. package/src/{plugins/googleAnalytics → legacy}/constants.ts +0 -0
  224. package/src/{plugins → lib}/broadcastUpdate/responsesAreSame.ts +0 -0
  225. package/src/{plugins → lib}/cacheableResponse/CacheableResponsePlugin.ts +0 -0
  226. package/src/{plugins → lib}/expiration/models/CacheTimestampsModel.ts +0 -0
  227. package/src/{plugins → lib}/precaching/PrecacheFallbackPlugin.ts +1 -1
  228. package/src/{plugins → lib}/rangeRequests/RangeRequestsPlugin.ts +0 -0
  229. package/src/{plugins → lib}/rangeRequests/createPartialResponse.ts +1 -1
  230. package/src/{plugins → lib}/rangeRequests/utils/calculateEffectiveBoundaries.ts +1 -1
  231. package/src/{plugins → lib}/rangeRequests/utils/parseRangeHeader.ts +1 -1
  232. /package/src/{clientsClaim.ts → utils/clientsClaim.ts} +0 -0
@@ -6,9 +6,9 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { assert } from "../utils/assert.js";
10
- import { SerwistError } from "../utils/SerwistError.js";
11
- import { logger } from "../utils/logger.js";
9
+ import { SerwistError } from "../../utils/SerwistError.js";
10
+ import { assert } from "../../utils/assert.js";
11
+ import { logger } from "../../utils/logger.js";
12
12
  import type { StrategyOptions } from "./Strategy.js";
13
13
  import { Strategy } from "./Strategy.js";
14
14
  import type { StrategyHandler } from "./StrategyHandler.js";
@@ -23,11 +23,11 @@ export interface NetworkFirstOptions extends StrategyOptions {
23
23
  }
24
24
 
25
25
  /**
26
- * An implementation of the [network first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-first-falling-back-to-cache)
26
+ * An implementation of the [network first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network_first_falling_back_to_cache)
27
27
  * request strategy.
28
28
  *
29
29
  * By default, this strategy will cache responses with a 200 status code as
30
- * well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
30
+ * well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque_responses).
31
31
  * Opaque responses are are cross-origin requests where the response doesn't
32
32
  * support [CORS](https://enable-cors.org/).
33
33
  *
@@ -55,7 +55,7 @@ export class NetworkFirst extends Strategy {
55
55
  if (process.env.NODE_ENV !== "production") {
56
56
  if (this._networkTimeoutSeconds) {
57
57
  assert!.isType(this._networkTimeoutSeconds, "number", {
58
- moduleName: "serwist/strategies",
58
+ moduleName: "serwist",
59
59
  className: this.constructor.name,
60
60
  funcName: "constructor",
61
61
  paramName: "networkTimeoutSeconds",
@@ -75,7 +75,7 @@ export class NetworkFirst extends Strategy {
75
75
 
76
76
  if (process.env.NODE_ENV !== "production") {
77
77
  assert!.isInstance(request, Request, {
78
- moduleName: "serwist/strategies",
78
+ moduleName: "serwist",
79
79
  className: this.constructor.name,
80
80
  funcName: "handle",
81
81
  paramName: "makeRequest",
@@ -6,10 +6,10 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { assert } from "../utils/assert.js";
10
- import { SerwistError } from "../utils/SerwistError.js";
11
- import { logger } from "../utils/logger.js";
12
- import { timeout } from "../utils/timeout.js";
9
+ import { SerwistError } from "../../utils/SerwistError.js";
10
+ import { assert } from "../../utils/assert.js";
11
+ import { logger } from "../../utils/logger.js";
12
+ import { timeout } from "../../utils/timeout.js";
13
13
  import type { StrategyOptions } from "./Strategy.js";
14
14
  import { Strategy } from "./Strategy.js";
15
15
  import type { StrategyHandler } from "./StrategyHandler.js";
@@ -23,10 +23,10 @@ export interface NetworkOnlyOptions extends Omit<StrategyOptions, "cacheName" |
23
23
  }
24
24
 
25
25
  /**
26
- * An implementation of the [network only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-only)
26
+ * An implementation of the [network only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network_only)
27
27
  * request strategy.
28
28
  *
29
- * This class is useful if you want to take advantage of any Serwist plugin.
29
+ * This class is useful if you require specific requests to only be fulfilled from the network.
30
30
  *
31
31
  * If the network request fails, this will throw a `SerwistError` exception.
32
32
  */
@@ -51,7 +51,7 @@ export class NetworkOnly extends Strategy {
51
51
  async _handle(request: Request, handler: StrategyHandler): Promise<Response> {
52
52
  if (process.env.NODE_ENV !== "production") {
53
53
  assert!.isInstance(request, Request, {
54
- moduleName: "serwist/strategies",
54
+ moduleName: "serwist",
55
55
  className: this.constructor.name,
56
56
  funcName: "_handle",
57
57
  paramName: "request",
@@ -6,15 +6,15 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import type { SerwistPlugin } from "./types.js";
10
- import { copyResponse } from "./copyResponse.js";
11
- import { SerwistError } from "./utils/SerwistError.js";
12
- import { getFriendlyURL } from "./utils/getFriendlyURL.js";
13
- import { logger } from "./utils/logger.js";
14
- import { cacheNames as privateCacheNames } from "./utils/cacheNames.js";
15
- import type { StrategyOptions } from "./strategies/Strategy.js";
16
- import { Strategy } from "./strategies/Strategy.js";
17
- import type { StrategyHandler } from "./strategies/StrategyHandler.js";
9
+ import { copyResponse } from "../../copyResponse.js";
10
+ import type { SerwistPlugin } from "../../types.js";
11
+ import { SerwistError } from "../../utils/SerwistError.js";
12
+ import { cacheNames as privateCacheNames } from "../../utils/cacheNames.js";
13
+ import { getFriendlyURL } from "../../utils/getFriendlyURL.js";
14
+ import { logger } from "../../utils/logger.js";
15
+ import type { StrategyOptions } from "./Strategy.js";
16
+ import { Strategy } from "./Strategy.js";
17
+ import type { StrategyHandler } from "./StrategyHandler.js";
18
18
 
19
19
  interface PrecacheStrategyOptions extends StrategyOptions {
20
20
  /**
@@ -29,7 +29,7 @@ interface PrecacheStrategyOptions extends StrategyOptions {
29
29
  * specifically designed to both cache and fetch precached assets.
30
30
  *
31
31
  * Note: an instance of this class is created automatically when creating a
32
- * `PrecacheController`; it's generally not necessary to create this yourself.
32
+ * `Serwist` instance; it's generally not necessary to create this yourself.
33
33
  */
34
34
  export class PrecacheStrategy extends Strategy {
35
35
  private readonly _fallbackToNetwork: boolean;
@@ -55,6 +55,7 @@ export class PrecacheStrategy extends Strategy {
55
55
  */
56
56
  constructor(options: PrecacheStrategyOptions = {}) {
57
57
  options.cacheName = privateCacheNames.getPrecacheName(options.cacheName);
58
+
58
59
  super(options);
59
60
 
60
61
  this._fallbackToNetwork = options.fallbackToNetwork === false ? false : true;
@@ -74,6 +75,7 @@ export class PrecacheStrategy extends Strategy {
74
75
  */
75
76
  async _handle(request: Request, handler: StrategyHandler): Promise<Response> {
76
77
  const response = await handler.cacheMatch(request);
78
+
77
79
  if (response) {
78
80
  return response;
79
81
  }
@@ -91,6 +93,7 @@ export class PrecacheStrategy extends Strategy {
91
93
 
92
94
  async _handleFetch(request: Request, handler: StrategyHandler): Promise<Response> {
93
95
  let response: Response | undefined = undefined;
96
+
94
97
  const params = (handler.params || {}) as {
95
98
  cacheKey?: string;
96
99
  integrity?: string;
@@ -169,6 +172,7 @@ export class PrecacheStrategy extends Strategy {
169
172
  // Make sure we defer cachePut() until after we know the response
170
173
  // should be cached; see https://github.com/GoogleChrome/workbox/issues/2737
171
174
  const wasCached = await handler.cachePut(request, response.clone());
175
+
172
176
  if (!wasCached) {
173
177
  // Throwing here will lead to the `install` handler failing, which
174
178
  // we want to do if *any* of the responses aren't safe to cache.
@@ -6,9 +6,9 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { assert } from "../utils/assert.js";
10
- import { SerwistError } from "../utils/SerwistError.js";
11
- import { logger } from "../utils/logger.js";
9
+ import { SerwistError } from "../../utils/SerwistError.js";
10
+ import { assert } from "../../utils/assert.js";
11
+ import { logger } from "../../utils/logger.js";
12
12
  import type { StrategyOptions } from "./Strategy.js";
13
13
  import { Strategy } from "./Strategy.js";
14
14
  import type { StrategyHandler } from "./StrategyHandler.js";
@@ -17,7 +17,7 @@ import { messages } from "./utils/messages.js";
17
17
 
18
18
  /**
19
19
  * An implementation of the
20
- * [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate)
20
+ * [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale_while_revalidate)
21
21
  * request strategy.
22
22
  *
23
23
  * Resources are requested from both the cache and the network in parallel.
@@ -58,7 +58,7 @@ export class StaleWhileRevalidate extends Strategy {
58
58
 
59
59
  if (process.env.NODE_ENV !== "production") {
60
60
  assert!.isInstance(request, Request, {
61
- moduleName: "serwist/strategies",
61
+ moduleName: "serwist",
62
62
  className: this.constructor.name,
63
63
  funcName: "handle",
64
64
  paramName: "request",
@@ -6,11 +6,11 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import type { HandlerCallbackOptions, RouteHandlerObject, SerwistPlugin } from "../types.js";
10
- import { SerwistError } from "../utils/SerwistError.js";
11
- import { getFriendlyURL } from "../utils/getFriendlyURL.js";
12
- import { logger } from "../utils/logger.js";
13
- import { cacheNames as privateCacheNames } from "../utils/cacheNames.js";
9
+ import type { HandlerCallbackOptions, RouteHandlerObject, SerwistPlugin } from "../../types.js";
10
+ import { SerwistError } from "../../utils/SerwistError.js";
11
+ import { cacheNames as privateCacheNames } from "../../utils/cacheNames.js";
12
+ import { getFriendlyURL } from "../../utils/getFriendlyURL.js";
13
+ import { logger } from "../../utils/logger.js";
14
14
  import { StrategyHandler } from "./StrategyHandler.js";
15
15
 
16
16
  export interface StrategyOptions {
@@ -19,27 +19,26 @@ export interface StrategyOptions {
19
19
  */
20
20
  cacheName?: string;
21
21
  /**
22
- * [Plugins](https://developer.chrome.com/docs/workbox/using-plugins)
23
- * to use in conjunction with this caching strategy.
22
+ * [Plugins](https://serwist.pages.dev/docs/serwist/runtime-caching/plugins) to use in conjunction with this caching strategy.
24
23
  */
25
24
  plugins?: SerwistPlugin[];
26
25
  /**
27
- * Values passed along to the [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)
28
- * of [non-navigation](https://github.com/GoogleChrome/workbox/issues/1796) `fetch()` requests made by this strategy.
26
+ * Options passed to [non-navigation](https://github.com/GoogleChrome/workbox/issues/1796) `fetch()` calls made by
27
+ * this strategy.
29
28
  */
30
29
  fetchOptions?: RequestInit;
31
30
  /**
32
31
  * The [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)
33
- * for any `cache.match()` or `cache.put()` calls made by this strategy.
32
+ * passed to any `cache.match()` or `cache.put()` call made by this strategy.
34
33
  */
35
34
  matchOptions?: CacheQueryOptions;
36
35
  }
37
36
 
38
37
  /**
39
- * Classes extending the `Strategy` based class should implement this method,
40
- * and leverage `serwist/strategies`'s `StrategyHandler` arg to perform all
41
- * fetching and cache logic, which will ensure all relevant cache, cache options,
42
- * fetch options and plugins are used (per the current strategy instance).
38
+ * Abstract class for implementing runtime caching strategies.
39
+ *
40
+ * Custom strategies should extend this class and leverage `StrategyHandler`, which will ensure all relevant cache options,
41
+ * fetch options, and plugins are used (per the current strategy instance), to perform all fetching and caching logic.
43
42
  */
44
43
  export abstract class Strategy implements RouteHandlerObject {
45
44
  cacheName: string;
@@ -67,7 +66,7 @@ export abstract class Strategy implements RouteHandlerObject {
67
66
  }
68
67
 
69
68
  /**
70
- * Perform a request strategy and returns a `Promise` that will resolve with
69
+ * Performs a request strategy and returns a `Promise` that will resolve with
71
70
  * a `Response`, invoking all relevant plugin callbacks.
72
71
  *
73
72
  * When a strategy instance is registered with a `Route`, this method is automatically
@@ -88,12 +87,11 @@ export abstract class Strategy implements RouteHandlerObject {
88
87
  }
89
88
 
90
89
  /**
91
- * Similar to `serwist/strategies`'s `Strategy.handle`, but
92
- * instead of just returning a `Promise` that resolves to a `Response` it
93
- * it will return an tuple of `[response, done]` promises, where the former
94
- * (`response`) is equivalent to what `handle()` returns, and the latter is a
95
- * Promise that will resolve once any promises that were added to
96
- * `event.waitUntil()` as part of performing the strategy have completed.
90
+ * Similar to `handle()`, but instead of just returning a `Promise` that
91
+ * resolves to a `Response`, it will return an tuple of `[response, done]` promises,
92
+ * where `response` is equivalent to what `handle()` returns, and `done` is a
93
+ * `Promise` that will resolve once all promises added to `event.waitUntil()` as a part
94
+ * of performing the strategy have completed.
97
95
  *
98
96
  * You can await the `done` promise to ensure any extra work performed by
99
97
  * the strategy (usually caching responses) completes successfully.
@@ -6,15 +6,15 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import type { HandlerCallbackOptions, MapLikeObject, SerwistPlugin, SerwistPluginCallbackParam } from "../types.js";
10
- import { assert } from "../utils/assert.js";
11
- import { Deferred } from "../utils/Deferred.js";
12
- import { SerwistError } from "../utils/SerwistError.js";
13
- import { cacheMatchIgnoreParams } from "../utils/cacheMatchIgnoreParams.js";
14
- import { executeQuotaErrorCallbacks } from "../utils/executeQuotaErrorCallbacks.js";
15
- import { getFriendlyURL } from "../utils/getFriendlyURL.js";
16
- import { logger } from "../utils/logger.js";
17
- import { timeout } from "../utils/timeout.js";
9
+ import type { HandlerCallbackOptions, MapLikeObject, SerwistPlugin, SerwistPluginCallbackParam } from "../../types.js";
10
+ import { Deferred } from "../../utils/Deferred.js";
11
+ import { SerwistError } from "../../utils/SerwistError.js";
12
+ import { assert } from "../../utils/assert.js";
13
+ import { cacheMatchIgnoreParams } from "../../utils/cacheMatchIgnoreParams.js";
14
+ import { executeQuotaErrorCallbacks } from "../../utils/executeQuotaErrorCallbacks.js";
15
+ import { getFriendlyURL } from "../../utils/getFriendlyURL.js";
16
+ import { logger } from "../../utils/logger.js";
17
+ import { timeout } from "../../utils/timeout.js";
18
18
  import type { Strategy } from "./Strategy.js";
19
19
 
20
20
  function toRequest(input: RequestInfo) {
@@ -22,9 +22,9 @@ function toRequest(input: RequestInfo) {
22
22
  }
23
23
 
24
24
  /**
25
- * A class created every time a Strategy instance instance calls `Strategy.handle` or
25
+ * A class created every time a `Strategy` instance calls `Strategy.handle` or
26
26
  * `Strategy.handleAll` that wraps all fetch and cache actions around plugin callbacks
27
- * and keeps track of when the strategy is "done" (i.e. all added `event.waitUntil()` promises
27
+ * and keeps track of when the strategy is "done" (i.e. when all added `event.waitUntil()` promises
28
28
  * have resolved).
29
29
  */
30
30
  export class StrategyHandler {
@@ -33,23 +33,23 @@ export class StrategyHandler {
33
33
  */
34
34
  public event: ExtendableEvent;
35
35
  /**
36
- * The request the strategy is performing (passed to the strategy's
36
+ * The request the strategy is processing (passed to the strategy's
37
37
  * `handle()` or `handleAll()` method).
38
38
  */
39
39
  public request: Request;
40
40
  /**
41
41
  * A `URL` instance of `request.url` (if passed to the strategy's
42
42
  * `handle()` or `handleAll()` method).
43
- * Note: the `url` param will be present if the strategy was invoked
43
+ * Note: the `url` param will be present if the strategy is invoked
44
44
  * from a `Route` object.
45
45
  */
46
46
  public url?: URL;
47
47
  /**
48
- * A `param` value (if passed to the strategy's
48
+ * Some additional params (if passed to the strategy's
49
49
  * `handle()` or `handleAll()` method).
50
- * Note: the `param` param will be present if the strategy was invoked
51
- * from a `Route` object and the `serwist/strategies.matchCallback`
52
- * returned a truthy value (it will be that value).
50
+ * Note: the `params` param will be present if the strategy is invoked
51
+ * from a `Route` object and that route's matcher returned a truthy value
52
+ * (it will be that value).
53
53
  */
54
54
  public params?: string[] | MapLikeObject;
55
55
 
@@ -78,13 +78,13 @@ export class StrategyHandler {
78
78
  ) {
79
79
  if (process.env.NODE_ENV !== "production") {
80
80
  assert!.isInstance(options.event, ExtendableEvent, {
81
- moduleName: "serwist/strategies",
81
+ moduleName: "serwist",
82
82
  className: "StrategyHandler",
83
83
  funcName: "constructor",
84
84
  paramName: "options.event",
85
85
  });
86
86
  assert!.isInstance(options.request, Request, {
87
- moduleName: "serwist/strategies",
87
+ moduleName: "serwist",
88
88
  className: "StrategyHandler",
89
89
  funcName: "constructor",
90
90
  paramName: "options.request",
@@ -114,8 +114,8 @@ export class StrategyHandler {
114
114
 
115
115
  /**
116
116
  * Fetches a given request (and invokes any applicable plugin callback
117
- * methods) using the `fetchOptions` (for non-navigation requests) and
118
- * `plugins` defined on the `Strategy` object.
117
+ * methods), taking the `fetchOptions` (for non-navigation requests) and
118
+ * `plugins` provided to the `Strategy` object into account.
119
119
  *
120
120
  * The following plugin lifecycle methods are invoked when using this method:
121
121
  * - `requestWillFetch()`
@@ -199,11 +199,10 @@ export class StrategyHandler {
199
199
  }
200
200
 
201
201
  /**
202
- * Calls `this.fetch()` and (in the background) runs `this.cachePut()` on
203
- * the response generated by `this.fetch()`.
202
+ * Calls `this.fetch()` and (in the background) caches the generated response.
204
203
  *
205
204
  * The call to `this.cachePut()` automatically invokes `this.waitUntil()`,
206
- * so you do not have to manually call `waitUntil()` on the event.
205
+ * so you do not have to call `waitUntil()` yourself.
207
206
  *
208
207
  * @param input The request or URL to fetch and cache.
209
208
  * @returns
@@ -219,14 +218,14 @@ export class StrategyHandler {
219
218
 
220
219
  /**
221
220
  * Matches a request from the cache (and invokes any applicable plugin
222
- * callback methods) using the `cacheName`, `matchOptions`, and `plugins`
223
- * defined on the strategy object.
221
+ * callback method) using the `cacheName`, `matchOptions`, and `plugins`
222
+ * provided to the `Strategy` object.
224
223
  *
225
- * The following plugin lifecycle methods are invoked when using this method:
226
- * - cacheKeyWillByUsed()
227
- * - cachedResponseWillByUsed()
224
+ * The following lifecycle methods are invoked when using this method:
225
+ * - `cacheKeyWillByUsed`
226
+ * - `cachedResponseWillByUsed`
228
227
  *
229
- * @param key The Request or URL to use as the cache key.
228
+ * @param key The `Request` or `URL` object to use as the cache key.
230
229
  * @returns A matching response, if found.
231
230
  */
232
231
  async cacheMatch(key: RequestInfo): Promise<Response | undefined> {
@@ -261,14 +260,14 @@ export class StrategyHandler {
261
260
  }
262
261
 
263
262
  /**
264
- * Puts a request/response pair in the cache (and invokes any applicable
265
- * plugin callback methods) using the `cacheName` and `plugins` defined on
266
- * the strategy object.
263
+ * Puts a request/response pair into the cache (and invokes any applicable
264
+ * plugin callback method) using the `cacheName` and `plugins` provided to
265
+ * the `Strategy` object.
267
266
  *
268
267
  * The following plugin lifecycle methods are invoked when using this method:
269
- * - cacheKeyWillByUsed()
270
- * - cacheWillUpdate()
271
- * - cacheDidUpdate()
268
+ * - `cacheKeyWillByUsed`
269
+ * - `cacheWillUpdate`
270
+ * - `cacheDidUpdate`
272
271
  *
273
272
  * @param key The request or URL to use as the cache key.
274
273
  * @param response The response to cache.
@@ -370,11 +369,11 @@ export class StrategyHandler {
370
369
  }
371
370
 
372
371
  /**
373
- * Checks the list of plugins for the `cacheKeyWillBeUsed` callback, and
374
- * executes any of those callbacks found in sequence. The final `Request`
372
+ * Checks the `plugins` provided to the `Strategy` object for `cacheKeyWillBeUsed`
373
+ * callbacks and executes found callbacks in sequence. The final `Request`
375
374
  * object returned by the last plugin is treated as the cache key for cache
376
375
  * reads and/or writes. If no `cacheKeyWillBeUsed` plugin callbacks have
377
- * been registered, the passed request is returned unmodified
376
+ * been registered, the passed request is returned unmodified.
378
377
  *
379
378
  * @param request
380
379
  * @param mode
@@ -402,7 +401,7 @@ export class StrategyHandler {
402
401
  }
403
402
 
404
403
  /**
405
- * Returns true if the strategy has at least one plugin with the given
404
+ * Returns `true` if the strategy has at least one plugin with the given
406
405
  * callback.
407
406
  *
408
407
  * @param name The name of the callback to check for.
@@ -419,8 +418,7 @@ export class StrategyHandler {
419
418
 
420
419
  /**
421
420
  * Runs all plugin callbacks matching the given name, in order, passing the
422
- * given param object (merged ith the current plugin state) as the only
423
- * argument.
421
+ * given param object as the only argument.
424
422
  *
425
423
  * Note: since this method runs all plugins, it's not suitable for cases
426
424
  * where the return value of a callback needs to be applied prior to calling
@@ -439,10 +437,7 @@ export class StrategyHandler {
439
437
  }
440
438
 
441
439
  /**
442
- * Accepts a callback and returns an iterable of matching plugin callbacks,
443
- * where each callback is wrapped with the current handler state (i.e. when
444
- * you call each callback, whatever object parameter you pass it will
445
- * be merged with the plugin's current state).
440
+ * Accepts a callback name and returns an iterable of matching plugin callbacks.
446
441
  *
447
442
  * @param name The name fo the callback to run
448
443
  * @returns
@@ -482,12 +477,11 @@ export class StrategyHandler {
482
477
 
483
478
  /**
484
479
  * Returns a promise that resolves once all promises passed to
485
- * `serwist/strategies.StrategyHandler.waitUntil` have settled.
480
+ * `this.waitUntil()` have settled.
486
481
  *
487
482
  * Note: any work done after `doneWaiting()` settles should be manually
488
- * passed to an event's `waitUntil()` method (not this handler's
489
- * `waitUntil()` method), otherwise the service worker thread my be killed
490
- * prior to your work completing.
483
+ * passed to an event's `waitUntil()` method (not `this.waitUntil()`), otherwise
484
+ * the service worker thread may be killed prior to your work completing.
491
485
  */
492
486
  async doneWaiting(): Promise<void> {
493
487
  let promise: Promise<any> | undefined = undefined;
@@ -498,7 +492,7 @@ export class StrategyHandler {
498
492
 
499
493
  /**
500
494
  * Stops running the strategy and immediately resolves any pending
501
- * `waitUntil()` promises.
495
+ * `waitUntil()` promise.
502
496
  */
503
497
  destroy(): void {
504
498
  this._handlerDeferred.resolve(null);
@@ -6,7 +6,7 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import type { SerwistPlugin } from "../../types.js";
9
+ import type { SerwistPlugin } from "../../../types.js";
10
10
 
11
11
  export const cacheOkAndOpaquePlugin: SerwistPlugin = {
12
12
  /**
@@ -6,8 +6,8 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { getFriendlyURL } from "../../utils/getFriendlyURL.js";
10
- import { logger } from "../../utils/logger.js";
9
+ import { getFriendlyURL } from "../../../utils/getFriendlyURL.js";
10
+ import { logger } from "../../../utils/logger.js";
11
11
 
12
12
  export const messages = {
13
13
  strategyStart: (strategyName: string, request: Request): string => `Using ${strategyName} to respond to '${getFriendlyURL(request.url)}'`,
@@ -112,7 +112,7 @@ export const messages = {
112
112
  },
113
113
 
114
114
  "duplicate-queue-name": ({ name }) => {
115
- return `The Queue name '${name}' is already being used. All instances of backgroundSync.Queue must be given unique names.`;
115
+ return `The queue name '${name}' is already being used. All instances of 'serwist.BackgroundSyncQueue' must be given unique names.`;
116
116
  },
117
117
 
118
118
  "expired-test-without-max-age": ({ methodName, paramName }) => {
@@ -7,7 +7,7 @@ declare const self: ServiceWorkerGlobalScope;
7
7
  * navigation preloading.
8
8
  *
9
9
  * @returns
10
- * @see https://serwist.pages.dev/docs/sw/navigation-preloading/is-navigation-preload-supported
10
+ * @see https://serwist.pages.dev/docs/serwist/core/is-navigation-preload-supported
11
11
  */
12
12
  export const isNavigationPreloadSupported = (): boolean => {
13
13
  return Boolean(self.registration?.navigationPreload);
@@ -19,7 +19,7 @@ export const isNavigationPreloadSupported = (): boolean => {
19
19
  * @param headerValue Optional. Allows developers to override the value of
20
20
  * the `Service-Worker-Navigation-Preload` header which will be sent to the
21
21
  * server when making the navigation request.
22
- * @see https://serwist.pages.dev/docs/sw/navigation-preloading/enable-navigation-preload
22
+ * @see https://serwist.pages.dev/docs/serwist/core/enable-navigation-preload
23
23
  */
24
24
  export const enableNavigationPreload = (headerValue?: string): void => {
25
25
  if (isNavigationPreloadSupported()) {
@@ -47,7 +47,7 @@ export const enableNavigationPreload = (headerValue?: string): void => {
47
47
  /**
48
48
  * If the browser supports navigation preloading, then this will disable it.
49
49
  *
50
- * @see https://serwist.pages.dev/docs/sw/navigation-preloading/disable-navigation-preload
50
+ * @see https://serwist.pages.dev/docs/serwist/core/disable-navigation-preload
51
51
  */
52
52
  export const disableNavigationPreload = (): void => {
53
53
  if (isNavigationPreloadSupported()) {
@@ -6,9 +6,9 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
+ import { quotaErrorCallbacks } from "./models/quotaErrorCallbacks.js";
9
10
  import { assert } from "./utils/assert.js";
10
11
  import { logger } from "./utils/logger.js";
11
- import { quotaErrorCallbacks } from "./models/quotaErrorCallbacks.js";
12
12
 
13
13
  /**
14
14
  * Adds a function to the set of quotaErrorCallbacks that will be executed if
package/src/types.ts CHANGED
@@ -335,22 +335,27 @@ export declare interface PrecacheEntry {
335
335
 
336
336
  export interface PrecacheRouteOptions {
337
337
  /**
338
- * The `directoryIndex` will check cache entries for a URL ending with '/'
339
- * to see if there is a hit when appending the `directoryIndex` value.
338
+ * Tells Serwist to check the precache for an entry whose URL is the request URL appended
339
+ * with the specified value. Only applies if the request URL ends with "/".
340
+ *
341
+ * @default "index.html"
340
342
  */
341
343
  directoryIndex?: string | null;
342
344
  /**
343
- * An array of RegExp's to remove search params when looking for a cache match.
345
+ * An array of `RegExp` objects matching search params that should be removed when looking
346
+ * for a precache match.
344
347
  */
345
348
  ignoreURLParametersMatching?: RegExp[];
346
349
  /**
347
- * The `cleanURLs` option will check the cache for the URL with a `.html` added
348
- * to the end of the end.
350
+ * Tells Serwist to check the precache for an entry whose URL is the request URL appended
351
+ * with ".html".
352
+ *
353
+ * @default true
349
354
  */
350
355
  cleanURLs?: boolean;
351
356
  /**
352
- * This is a function that should take a URL and return an array of
353
- * alternative URLs that should be checked for precache matches.
357
+ * A function that should take a URL and return an array of alternative URLs that should
358
+ * be checked for precache matches.
354
359
  */
355
360
  urlManipulation?: UrlManipulation;
356
361
  }
@@ -6,8 +6,8 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import type { SerwistPlugin, SerwistPluginCallbackParam } from "../types.js";
10
9
  import type { Serwist } from "../Serwist.js";
10
+ import type { SerwistPlugin, SerwistPluginCallbackParam } from "../types.js";
11
11
 
12
12
  /**
13
13
  * A plugin, designed to be used with PrecacheController, to translate URLs into
@@ -6,8 +6,8 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { SerwistError } from "./SerwistError.js";
10
9
  import type { MapLikeObject } from "../types.js";
10
+ import { SerwistError } from "./SerwistError.js";
11
11
 
12
12
  /*
13
13
  * This method throws if the supplied value is not an array.
@@ -6,10 +6,9 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { logger } from "./utils/logger.js";
10
- import { cacheNames as privateCacheNames } from "./utils/cacheNames.js";
11
-
12
- import { deleteOutdatedCaches } from "./utils/deleteOutdatedCaches.js";
9
+ import { cacheNames as privateCacheNames } from "./cacheNames.js";
10
+ import { deleteOutdatedCaches } from "./deleteOutdatedCaches.js";
11
+ import { logger } from "./logger.js";
13
12
 
14
13
  declare const self: ServiceWorkerGlobalScope;
15
14
 
@@ -6,8 +6,8 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import { logger } from "./logger.js";
10
9
  import { quotaErrorCallbacks } from "../models/quotaErrorCallbacks.js";
10
+ import { logger } from "./logger.js";
11
11
 
12
12
  /**
13
13
  * Runs all of the callback functions, one at a time sequentially, in the order