serwist 9.0.0-preview.24

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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/NavigationRoute.d.ts +57 -0
  4. package/dist/NavigationRoute.d.ts.map +1 -0
  5. package/dist/PrecacheRoute.d.ts +17 -0
  6. package/dist/PrecacheRoute.d.ts.map +1 -0
  7. package/dist/PrecacheStrategy.d.ts +66 -0
  8. package/dist/PrecacheStrategy.d.ts.map +1 -0
  9. package/dist/RegExpRoute.d.ts +24 -0
  10. package/dist/RegExpRoute.d.ts.map +1 -0
  11. package/dist/Route.d.ts +33 -0
  12. package/dist/Route.d.ts.map +1 -0
  13. package/dist/Serwist.d.ts +331 -0
  14. package/dist/Serwist.d.ts.map +1 -0
  15. package/dist/cacheNames.d.ts +20 -0
  16. package/dist/cacheNames.d.ts.map +1 -0
  17. package/dist/chunks/NetworkOnly.js +599 -0
  18. package/dist/chunks/PrecacheFallbackPlugin.js +634 -0
  19. package/dist/chunks/Serwist.js +1034 -0
  20. package/dist/chunks/registerQuotaErrorCallback.js +17 -0
  21. package/dist/chunks/resultingClientExists.js +32 -0
  22. package/dist/chunks/timeout.js +400 -0
  23. package/dist/chunks/waitUntil.js +24 -0
  24. package/dist/cleanupOutdatedCaches.d.ts +6 -0
  25. package/dist/cleanupOutdatedCaches.d.ts.map +1 -0
  26. package/dist/clientsClaim.d.ts +6 -0
  27. package/dist/clientsClaim.d.ts.map +1 -0
  28. package/dist/constants.d.ts +15 -0
  29. package/dist/constants.d.ts.map +1 -0
  30. package/dist/copyResponse.d.ts +20 -0
  31. package/dist/copyResponse.d.ts.map +1 -0
  32. package/dist/disableDevLogs.d.ts +7 -0
  33. package/dist/disableDevLogs.d.ts.map +1 -0
  34. package/dist/index.d.ts +21 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.internal.d.ts +16 -0
  37. package/dist/index.internal.d.ts.map +1 -0
  38. package/dist/index.internal.js +24 -0
  39. package/dist/index.js +27 -0
  40. package/dist/index.legacy.d.ts +32 -0
  41. package/dist/index.legacy.d.ts.map +1 -0
  42. package/dist/index.legacy.js +640 -0
  43. package/dist/index.plugins.d.ts +41 -0
  44. package/dist/index.plugins.d.ts.map +1 -0
  45. package/dist/index.plugins.js +669 -0
  46. package/dist/index.strategies.d.ts +22 -0
  47. package/dist/index.strategies.d.ts.map +1 -0
  48. package/dist/index.strategies.js +144 -0
  49. package/dist/legacy/PrecacheController.d.ts +146 -0
  50. package/dist/legacy/PrecacheController.d.ts.map +1 -0
  51. package/dist/legacy/PrecacheFallbackPlugin.d.ts +62 -0
  52. package/dist/legacy/PrecacheFallbackPlugin.d.ts.map +1 -0
  53. package/dist/legacy/PrecacheRoute.d.ts +19 -0
  54. package/dist/legacy/PrecacheRoute.d.ts.map +1 -0
  55. package/dist/legacy/Router.d.ts +151 -0
  56. package/dist/legacy/Router.d.ts.map +1 -0
  57. package/dist/legacy/addPlugins.d.ts +9 -0
  58. package/dist/legacy/addPlugins.d.ts.map +1 -0
  59. package/dist/legacy/addRoute.d.ts +16 -0
  60. package/dist/legacy/addRoute.d.ts.map +1 -0
  61. package/dist/legacy/createHandlerBoundToURL.d.ts +18 -0
  62. package/dist/legacy/createHandlerBoundToURL.d.ts.map +1 -0
  63. package/dist/legacy/fallbacks.d.ts +59 -0
  64. package/dist/legacy/fallbacks.d.ts.map +1 -0
  65. package/dist/legacy/getCacheKeyForURL.d.ts +20 -0
  66. package/dist/legacy/getCacheKeyForURL.d.ts.map +1 -0
  67. package/dist/legacy/handlePrecaching.d.ts +54 -0
  68. package/dist/legacy/handlePrecaching.d.ts.map +1 -0
  69. package/dist/legacy/installSerwist.d.ts +15 -0
  70. package/dist/legacy/installSerwist.d.ts.map +1 -0
  71. package/dist/legacy/matchPrecache.d.ts +15 -0
  72. package/dist/legacy/matchPrecache.d.ts.map +1 -0
  73. package/dist/legacy/precache.d.ts +20 -0
  74. package/dist/legacy/precache.d.ts.map +1 -0
  75. package/dist/legacy/precacheAndRoute.d.ts +15 -0
  76. package/dist/legacy/precacheAndRoute.d.ts.map +1 -0
  77. package/dist/legacy/registerRoute.d.ts +16 -0
  78. package/dist/legacy/registerRoute.d.ts.map +1 -0
  79. package/dist/legacy/registerRuntimeCaching.d.ts +11 -0
  80. package/dist/legacy/registerRuntimeCaching.d.ts.map +1 -0
  81. package/dist/legacy/setCatchHandler.d.ts +10 -0
  82. package/dist/legacy/setCatchHandler.d.ts.map +1 -0
  83. package/dist/legacy/setDefaultHandler.d.ts +13 -0
  84. package/dist/legacy/setDefaultHandler.d.ts.map +1 -0
  85. package/dist/legacy/singletonPrecacheController.d.ts +34 -0
  86. package/dist/legacy/singletonPrecacheController.d.ts.map +1 -0
  87. package/dist/legacy/singletonRouter.d.ts +41 -0
  88. package/dist/legacy/singletonRouter.d.ts.map +1 -0
  89. package/dist/legacy/unregisterRoute.d.ts +9 -0
  90. package/dist/legacy/unregisterRoute.d.ts.map +1 -0
  91. package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts +16 -0
  92. package/dist/legacy/utils/PrecacheCacheKeyPlugin.d.ts.map +1 -0
  93. package/dist/legacy/utils/getCacheKeyForURL.d.ts +14 -0
  94. package/dist/legacy/utils/getCacheKeyForURL.d.ts.map +1 -0
  95. package/dist/models/messages/messageGenerator.d.ts +4 -0
  96. package/dist/models/messages/messageGenerator.d.ts.map +1 -0
  97. package/dist/models/messages/messages.d.ts +44 -0
  98. package/dist/models/messages/messages.d.ts.map +1 -0
  99. package/dist/models/pluginEvents.d.ts +10 -0
  100. package/dist/models/pluginEvents.d.ts.map +1 -0
  101. package/dist/models/quotaErrorCallbacks.d.ts +3 -0
  102. package/dist/models/quotaErrorCallbacks.d.ts.map +1 -0
  103. package/dist/navigationPreload.d.ts +24 -0
  104. package/dist/navigationPreload.d.ts.map +1 -0
  105. package/dist/parseRoute.d.ts +16 -0
  106. package/dist/parseRoute.d.ts.map +1 -0
  107. package/dist/plugins/backgroundSync/BackgroundSyncPlugin.d.ts +23 -0
  108. package/dist/plugins/backgroundSync/BackgroundSyncPlugin.d.ts.map +1 -0
  109. package/dist/plugins/backgroundSync/Queue.d.ts +166 -0
  110. package/dist/plugins/backgroundSync/Queue.d.ts.map +1 -0
  111. package/dist/plugins/backgroundSync/QueueDb.d.ts +90 -0
  112. package/dist/plugins/backgroundSync/QueueDb.d.ts.map +1 -0
  113. package/dist/plugins/backgroundSync/QueueStore.d.ts +75 -0
  114. package/dist/plugins/backgroundSync/QueueStore.d.ts.map +1 -0
  115. package/dist/plugins/backgroundSync/StorableRequest.d.ts +51 -0
  116. package/dist/plugins/backgroundSync/StorableRequest.d.ts.map +1 -0
  117. package/dist/plugins/broadcastUpdate/BroadcastCacheUpdate.d.ts +45 -0
  118. package/dist/plugins/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +1 -0
  119. package/dist/plugins/broadcastUpdate/BroadcastUpdatePlugin.d.ts +27 -0
  120. package/dist/plugins/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +1 -0
  121. package/dist/plugins/broadcastUpdate/constants.d.ts +5 -0
  122. package/dist/plugins/broadcastUpdate/constants.d.ts.map +1 -0
  123. package/dist/plugins/broadcastUpdate/responsesAreSame.d.ts +11 -0
  124. package/dist/plugins/broadcastUpdate/responsesAreSame.d.ts.map +1 -0
  125. package/dist/plugins/broadcastUpdate/types.d.ts +34 -0
  126. package/dist/plugins/broadcastUpdate/types.d.ts.map +1 -0
  127. package/dist/plugins/cacheableResponse/CacheableResponse.d.ts +40 -0
  128. package/dist/plugins/cacheableResponse/CacheableResponse.d.ts.map +1 -0
  129. package/dist/plugins/cacheableResponse/CacheableResponsePlugin.d.ts +27 -0
  130. package/dist/plugins/cacheableResponse/CacheableResponsePlugin.d.ts.map +1 -0
  131. package/dist/plugins/expiration/CacheExpiration.d.ts +66 -0
  132. package/dist/plugins/expiration/CacheExpiration.d.ts.map +1 -0
  133. package/dist/plugins/expiration/ExpirationPlugin.d.ts +116 -0
  134. package/dist/plugins/expiration/ExpirationPlugin.d.ts.map +1 -0
  135. package/dist/plugins/expiration/models/CacheTimestampsModel.d.ts +73 -0
  136. package/dist/plugins/expiration/models/CacheTimestampsModel.d.ts.map +1 -0
  137. package/dist/plugins/googleAnalytics/constants.d.ts +10 -0
  138. package/dist/plugins/googleAnalytics/constants.d.ts.map +1 -0
  139. package/dist/plugins/googleAnalytics/initialize.d.ts +30 -0
  140. package/dist/plugins/googleAnalytics/initialize.d.ts.map +1 -0
  141. package/dist/plugins/precaching/PrecacheFallbackPlugin.d.ts +53 -0
  142. package/dist/plugins/precaching/PrecacheFallbackPlugin.d.ts.map +1 -0
  143. package/dist/plugins/rangeRequests/RangeRequestsPlugin.d.ts +19 -0
  144. package/dist/plugins/rangeRequests/RangeRequestsPlugin.d.ts.map +1 -0
  145. package/dist/plugins/rangeRequests/createPartialResponse.d.ts +18 -0
  146. package/dist/plugins/rangeRequests/createPartialResponse.d.ts.map +1 -0
  147. package/dist/plugins/rangeRequests/utils/calculateEffectiveBoundaries.d.ts +14 -0
  148. package/dist/plugins/rangeRequests/utils/calculateEffectiveBoundaries.d.ts.map +1 -0
  149. package/dist/plugins/rangeRequests/utils/parseRangeHeader.d.ts +12 -0
  150. package/dist/plugins/rangeRequests/utils/parseRangeHeader.d.ts.map +1 -0
  151. package/dist/registerQuotaErrorCallback.d.ts +8 -0
  152. package/dist/registerQuotaErrorCallback.d.ts.map +1 -0
  153. package/dist/setCacheNameDetails.d.ts +9 -0
  154. package/dist/setCacheNameDetails.d.ts.map +1 -0
  155. package/dist/strategies/CacheFirst.d.ts +23 -0
  156. package/dist/strategies/CacheFirst.d.ts.map +1 -0
  157. package/dist/strategies/CacheOnly.d.ts +20 -0
  158. package/dist/strategies/CacheOnly.d.ts.map +1 -0
  159. package/dist/strategies/NetworkFirst.d.ts +61 -0
  160. package/dist/strategies/NetworkFirst.d.ts.map +1 -0
  161. package/dist/strategies/NetworkOnly.d.ts +32 -0
  162. package/dist/strategies/NetworkOnly.d.ts.map +1 -0
  163. package/dist/strategies/StaleWhileRevalidate.d.ts +35 -0
  164. package/dist/strategies/StaleWhileRevalidate.d.ts.map +1 -0
  165. package/dist/strategies/Strategy.d.ts +83 -0
  166. package/dist/strategies/Strategy.d.ts.map +1 -0
  167. package/dist/strategies/StrategyHandler.d.ts +189 -0
  168. package/dist/strategies/StrategyHandler.d.ts.map +1 -0
  169. package/dist/strategies/plugins/cacheOkAndOpaquePlugin.d.ts +3 -0
  170. package/dist/strategies/plugins/cacheOkAndOpaquePlugin.d.ts.map +1 -0
  171. package/dist/strategies/utils/messages.d.ts +5 -0
  172. package/dist/strategies/utils/messages.d.ts.map +1 -0
  173. package/dist/types.d.ts +317 -0
  174. package/dist/types.d.ts.map +1 -0
  175. package/dist/utils/Deferred.d.ts +19 -0
  176. package/dist/utils/Deferred.d.ts.map +1 -0
  177. package/dist/utils/PrecacheCacheKeyPlugin.d.ts +16 -0
  178. package/dist/utils/PrecacheCacheKeyPlugin.d.ts.map +1 -0
  179. package/dist/utils/PrecacheInstallReportPlugin.d.ts +14 -0
  180. package/dist/utils/PrecacheInstallReportPlugin.d.ts.map +1 -0
  181. package/dist/utils/SerwistError.d.ts +24 -0
  182. package/dist/utils/SerwistError.d.ts.map +1 -0
  183. package/dist/utils/assert.d.ts +11 -0
  184. package/dist/utils/assert.d.ts.map +1 -0
  185. package/dist/utils/cacheMatchIgnoreParams.d.ts +15 -0
  186. package/dist/utils/cacheMatchIgnoreParams.d.ts.map +1 -0
  187. package/dist/utils/cacheNames.d.ts +40 -0
  188. package/dist/utils/cacheNames.d.ts.map +1 -0
  189. package/dist/utils/canConstructReadableStream.d.ts +12 -0
  190. package/dist/utils/canConstructReadableStream.d.ts.map +1 -0
  191. package/dist/utils/canConstructResponseFromBodyStream.d.ts +11 -0
  192. package/dist/utils/canConstructResponseFromBodyStream.d.ts.map +1 -0
  193. package/dist/utils/createCacheKey.d.ts +16 -0
  194. package/dist/utils/createCacheKey.d.ts.map +1 -0
  195. package/dist/utils/deleteOutdatedCaches.d.ts +18 -0
  196. package/dist/utils/deleteOutdatedCaches.d.ts.map +1 -0
  197. package/dist/utils/dontWaitFor.d.ts +7 -0
  198. package/dist/utils/dontWaitFor.d.ts.map +1 -0
  199. package/dist/utils/executeQuotaErrorCallbacks.d.ts +8 -0
  200. package/dist/utils/executeQuotaErrorCallbacks.d.ts.map +1 -0
  201. package/dist/utils/generateURLVariations.d.ts +12 -0
  202. package/dist/utils/generateURLVariations.d.ts.map +1 -0
  203. package/dist/utils/getFriendlyURL.d.ts +3 -0
  204. package/dist/utils/getFriendlyURL.d.ts.map +1 -0
  205. package/dist/utils/logger.d.ts +24 -0
  206. package/dist/utils/logger.d.ts.map +1 -0
  207. package/dist/utils/normalizeHandler.d.ts +10 -0
  208. package/dist/utils/normalizeHandler.d.ts.map +1 -0
  209. package/dist/utils/pluginUtils.d.ts +5 -0
  210. package/dist/utils/pluginUtils.d.ts.map +1 -0
  211. package/dist/utils/printCleanupDetails.d.ts +6 -0
  212. package/dist/utils/printCleanupDetails.d.ts.map +1 -0
  213. package/dist/utils/printInstallDetails.d.ts +7 -0
  214. package/dist/utils/printInstallDetails.d.ts.map +1 -0
  215. package/dist/utils/removeIgnoredSearchParams.d.ts +12 -0
  216. package/dist/utils/removeIgnoredSearchParams.d.ts.map +1 -0
  217. package/dist/utils/resultingClientExists.d.ts +12 -0
  218. package/dist/utils/resultingClientExists.d.ts.map +1 -0
  219. package/dist/utils/timeout.d.ts +10 -0
  220. package/dist/utils/timeout.d.ts.map +1 -0
  221. package/dist/utils/waitUntil.d.ts +11 -0
  222. package/dist/utils/waitUntil.d.ts.map +1 -0
  223. package/dist/utils/welcome.d.ts +2 -0
  224. package/dist/utils/welcome.d.ts.map +1 -0
  225. package/package.json +85 -0
  226. package/src/NavigationRoute.ts +119 -0
  227. package/src/PrecacheRoute.ts +46 -0
  228. package/src/PrecacheStrategy.ts +239 -0
  229. package/src/RegExpRoute.ts +74 -0
  230. package/src/Route.ts +67 -0
  231. package/src/Serwist.ts +920 -0
  232. package/src/cacheNames.ts +39 -0
  233. package/src/cleanupOutdatedCaches.ts +32 -0
  234. package/src/clientsClaim.ts +18 -0
  235. package/src/constants.ts +24 -0
  236. package/src/copyResponse.ts +60 -0
  237. package/src/disableDevLogs.ts +10 -0
  238. package/src/index.internal.ts +33 -0
  239. package/src/index.legacy.ts +66 -0
  240. package/src/index.plugins.ts +95 -0
  241. package/src/index.strategies.ts +26 -0
  242. package/src/index.ts +39 -0
  243. package/src/legacy/PrecacheController.ts +337 -0
  244. package/src/legacy/PrecacheFallbackPlugin.ts +93 -0
  245. package/src/legacy/PrecacheRoute.ts +48 -0
  246. package/src/legacy/Router.ts +484 -0
  247. package/src/legacy/addPlugins.ts +21 -0
  248. package/src/legacy/addRoute.ts +29 -0
  249. package/src/legacy/createHandlerBoundToURL.ts +30 -0
  250. package/src/legacy/fallbacks.ts +94 -0
  251. package/src/legacy/getCacheKeyForURL.ts +32 -0
  252. package/src/legacy/handlePrecaching.ts +86 -0
  253. package/src/legacy/installSerwist.ts +19 -0
  254. package/src/legacy/matchPrecache.ts +26 -0
  255. package/src/legacy/precache.ts +31 -0
  256. package/src/legacy/precacheAndRoute.ts +28 -0
  257. package/src/legacy/registerRoute.ts +27 -0
  258. package/src/legacy/registerRuntimeCaching.ts +17 -0
  259. package/src/legacy/setCatchHandler.ts +21 -0
  260. package/src/legacy/setDefaultHandler.ts +24 -0
  261. package/src/legacy/singletonPrecacheController.ts +53 -0
  262. package/src/legacy/singletonRouter.ts +70 -0
  263. package/src/legacy/unregisterRoute.ts +12 -0
  264. package/src/legacy/utils/PrecacheCacheKeyPlugin.ts +33 -0
  265. package/src/legacy/utils/getCacheKeyForURL.ts +36 -0
  266. package/src/models/messages/messageGenerator.ts +29 -0
  267. package/src/models/messages/messages.ts +233 -0
  268. package/src/models/pluginEvents.ts +17 -0
  269. package/src/models/quotaErrorCallbacks.ts +13 -0
  270. package/src/navigationPreload.ts +68 -0
  271. package/src/parseRoute.ts +78 -0
  272. package/src/plugins/backgroundSync/BackgroundSyncPlugin.ts +38 -0
  273. package/src/plugins/backgroundSync/Queue.ts +440 -0
  274. package/src/plugins/backgroundSync/QueueDb.ts +176 -0
  275. package/src/plugins/backgroundSync/QueueStore.ts +160 -0
  276. package/src/plugins/backgroundSync/StorableRequest.ts +142 -0
  277. package/src/plugins/broadcastUpdate/BroadcastCacheUpdate.ts +161 -0
  278. package/src/plugins/broadcastUpdate/BroadcastUpdatePlugin.ts +42 -0
  279. package/src/plugins/broadcastUpdate/constants.ts +12 -0
  280. package/src/plugins/broadcastUpdate/responsesAreSame.ts +49 -0
  281. package/src/plugins/broadcastUpdate/types.ts +37 -0
  282. package/src/plugins/cacheableResponse/CacheableResponse.ts +144 -0
  283. package/src/plugins/cacheableResponse/CacheableResponsePlugin.ts +45 -0
  284. package/src/plugins/expiration/CacheExpiration.ts +193 -0
  285. package/src/plugins/expiration/ExpirationPlugin.ts +300 -0
  286. package/src/plugins/expiration/models/CacheTimestampsModel.ts +184 -0
  287. package/src/plugins/googleAnalytics/constants.ts +22 -0
  288. package/src/plugins/googleAnalytics/initialize.ts +209 -0
  289. package/src/plugins/precaching/PrecacheFallbackPlugin.ts +83 -0
  290. package/src/plugins/rangeRequests/RangeRequestsPlugin.ts +38 -0
  291. package/src/plugins/rangeRequests/createPartialResponse.ts +93 -0
  292. package/src/plugins/rangeRequests/utils/calculateEffectiveBoundaries.ts +59 -0
  293. package/src/plugins/rangeRequests/utils/parseRangeHeader.ts +55 -0
  294. package/src/registerQuotaErrorCallback.ts +34 -0
  295. package/src/setCacheNameDetails.ts +53 -0
  296. package/src/strategies/CacheFirst.ts +88 -0
  297. package/src/strategies/CacheOnly.ts +59 -0
  298. package/src/strategies/NetworkFirst.ts +229 -0
  299. package/src/strategies/NetworkOnly.ts +98 -0
  300. package/src/strategies/StaleWhileRevalidate.ts +110 -0
  301. package/src/strategies/Strategy.ts +204 -0
  302. package/src/strategies/StrategyHandler.ts +554 -0
  303. package/src/strategies/plugins/cacheOkAndOpaquePlugin.ts +26 -0
  304. package/src/strategies/utils/messages.ts +21 -0
  305. package/src/types.ts +358 -0
  306. package/src/utils/Deferred.ts +33 -0
  307. package/src/utils/PrecacheCacheKeyPlugin.ts +33 -0
  308. package/src/utils/PrecacheInstallReportPlugin.ts +47 -0
  309. package/src/utils/SerwistError.ts +41 -0
  310. package/src/utils/assert.ts +89 -0
  311. package/src/utils/cacheMatchIgnoreParams.ts +54 -0
  312. package/src/utils/cacheNames.ts +87 -0
  313. package/src/utils/canConstructReadableStream.ts +34 -0
  314. package/src/utils/canConstructResponseFromBodyStream.ts +37 -0
  315. package/src/utils/createCacheKey.ts +68 -0
  316. package/src/utils/deleteOutdatedCaches.ts +40 -0
  317. package/src/utils/dontWaitFor.ts +16 -0
  318. package/src/utils/executeQuotaErrorCallbacks.ts +33 -0
  319. package/src/utils/generateURLVariations.ts +55 -0
  320. package/src/utils/getFriendlyURL.ts +16 -0
  321. package/src/utils/logger.ts +95 -0
  322. package/src/utils/normalizeHandler.ts +40 -0
  323. package/src/utils/pluginUtils.ts +15 -0
  324. package/src/utils/printCleanupDetails.ts +38 -0
  325. package/src/utils/printInstallDetails.ts +53 -0
  326. package/src/utils/removeIgnoredSearchParams.ts +29 -0
  327. package/src/utils/resultingClientExists.ts +58 -0
  328. package/src/utils/timeout.ts +19 -0
  329. package/src/utils/waitUntil.ts +21 -0
  330. package/src/utils/welcome.ts +19 -0
@@ -0,0 +1,17 @@
1
+ import { f as finalAssertExports, q as quotaErrorCallbacks, l as logger } from './timeout.js';
2
+
3
+ const registerQuotaErrorCallback = (callback)=>{
4
+ if (process.env.NODE_ENV !== "production") {
5
+ finalAssertExports.isType(callback, "function", {
6
+ moduleName: "@serwist/core",
7
+ funcName: "register",
8
+ paramName: "callback"
9
+ });
10
+ }
11
+ quotaErrorCallbacks.add(callback);
12
+ if (process.env.NODE_ENV !== "production") {
13
+ logger.log("Registered a callback to respond to quota errors.", callback);
14
+ }
15
+ };
16
+
17
+ export { registerQuotaErrorCallback as r };
@@ -0,0 +1,32 @@
1
+ import { t as timeout } from './timeout.js';
2
+
3
+ const MAX_RETRY_TIME = 2000;
4
+ async function resultingClientExists(resultingClientId) {
5
+ if (!resultingClientId) {
6
+ return;
7
+ }
8
+ let existingWindows = await self.clients.matchAll({
9
+ type: "window"
10
+ });
11
+ const existingWindowIds = new Set(existingWindows.map((w)=>w.id));
12
+ let resultingWindow = undefined;
13
+ const startTime = performance.now();
14
+ while(performance.now() - startTime < MAX_RETRY_TIME){
15
+ existingWindows = await self.clients.matchAll({
16
+ type: "window"
17
+ });
18
+ resultingWindow = existingWindows.find((w)=>{
19
+ if (resultingClientId) {
20
+ return w.id === resultingClientId;
21
+ }
22
+ return !existingWindowIds.has(w.id);
23
+ });
24
+ if (resultingWindow) {
25
+ break;
26
+ }
27
+ await timeout(100);
28
+ }
29
+ return resultingWindow;
30
+ }
31
+
32
+ export { resultingClientExists as r };
@@ -0,0 +1,400 @@
1
+ const _cacheNameDetails = {
2
+ googleAnalytics: "googleAnalytics",
3
+ precache: "precache-v2",
4
+ prefix: "serwist",
5
+ runtime: "runtime",
6
+ suffix: typeof registration !== "undefined" ? registration.scope : ""
7
+ };
8
+ const _createCacheName = (cacheName)=>{
9
+ return [
10
+ _cacheNameDetails.prefix,
11
+ cacheName,
12
+ _cacheNameDetails.suffix
13
+ ].filter((value)=>value && value.length > 0).join("-");
14
+ };
15
+ const eachCacheNameDetail = (fn)=>{
16
+ for (const key of Object.keys(_cacheNameDetails)){
17
+ fn(key);
18
+ }
19
+ };
20
+ const cacheNames = {
21
+ updateDetails: (details)=>{
22
+ eachCacheNameDetail((key)=>{
23
+ const detail = details[key];
24
+ if (typeof detail === "string") {
25
+ _cacheNameDetails[key] = detail;
26
+ }
27
+ });
28
+ },
29
+ getGoogleAnalyticsName: (userCacheName)=>{
30
+ return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);
31
+ },
32
+ getPrecacheName: (userCacheName)=>{
33
+ return userCacheName || _createCacheName(_cacheNameDetails.precache);
34
+ },
35
+ getPrefix: ()=>{
36
+ return _cacheNameDetails.prefix;
37
+ },
38
+ getRuntimeName: (userCacheName)=>{
39
+ return userCacheName || _createCacheName(_cacheNameDetails.runtime);
40
+ },
41
+ getSuffix: ()=>{
42
+ return _cacheNameDetails.suffix;
43
+ }
44
+ };
45
+
46
+ const logger = process.env.NODE_ENV === "production" ? null : (()=>{
47
+ if (!("__WB_DISABLE_DEV_LOGS" in globalThis)) {
48
+ self.__WB_DISABLE_DEV_LOGS = false;
49
+ }
50
+ let inGroup = false;
51
+ const methodToColorMap = {
52
+ debug: "#7f8c8d",
53
+ log: "#2ecc71",
54
+ warn: "#f39c12",
55
+ error: "#c0392b",
56
+ groupCollapsed: "#3498db",
57
+ groupEnd: null
58
+ };
59
+ const print = (method, args)=>{
60
+ if (self.__WB_DISABLE_DEV_LOGS) {
61
+ return;
62
+ }
63
+ if (method === "groupCollapsed") {
64
+ if (typeof navigator !== "undefined" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
65
+ console[method](...args);
66
+ return;
67
+ }
68
+ }
69
+ const styles = [
70
+ `background: ${methodToColorMap[method]}`,
71
+ "border-radius: 0.5em",
72
+ "color: white",
73
+ "font-weight: bold",
74
+ "padding: 2px 0.5em"
75
+ ];
76
+ const logPrefix = inGroup ? [] : [
77
+ "%cserwist",
78
+ styles.join(";")
79
+ ];
80
+ console[method](...logPrefix, ...args);
81
+ if (method === "groupCollapsed") {
82
+ inGroup = true;
83
+ }
84
+ if (method === "groupEnd") {
85
+ inGroup = false;
86
+ }
87
+ };
88
+ const loggerMethods = Object.keys(methodToColorMap);
89
+ return loggerMethods.reduce((api, method)=>{
90
+ api[method] = (...args)=>{
91
+ print(method, args);
92
+ };
93
+ return api;
94
+ }, {});
95
+ })();
96
+
97
+ const messages = {
98
+ "invalid-value": ({ paramName, validValueDescription, value })=>{
99
+ if (!paramName || !validValueDescription) {
100
+ throw new Error(`Unexpected input to 'invalid-value' error.`);
101
+ }
102
+ return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;
103
+ },
104
+ "not-an-array": ({ moduleName, className, funcName, paramName })=>{
105
+ if (!moduleName || !className || !funcName || !paramName) {
106
+ throw new Error(`Unexpected input to 'not-an-array' error.`);
107
+ }
108
+ return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;
109
+ },
110
+ "incorrect-type": ({ expectedType, paramName, moduleName, className, funcName })=>{
111
+ if (!expectedType || !paramName || !moduleName || !funcName) {
112
+ throw new Error(`Unexpected input to 'incorrect-type' error.`);
113
+ }
114
+ const classNameStr = className ? `${className}.` : "";
115
+ return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}` + `${funcName}()' must be of type ${expectedType}.`;
116
+ },
117
+ "incorrect-class": ({ expectedClassName, paramName, moduleName, className, funcName, isReturnValueProblem })=>{
118
+ if (!expectedClassName || !moduleName || !funcName) {
119
+ throw new Error(`Unexpected input to 'incorrect-class' error.`);
120
+ }
121
+ const classNameStr = className ? `${className}.` : "";
122
+ if (isReturnValueProblem) {
123
+ return `The return value from '${moduleName}.${classNameStr}${funcName}()' must be an instance of class ${expectedClassName}.`;
124
+ }
125
+ return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}${funcName}()' ` + `must be an instance of class ${expectedClassName}.`;
126
+ },
127
+ "missing-a-method": ({ expectedMethod, paramName, moduleName, className, funcName })=>{
128
+ if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {
129
+ throw new Error(`Unexpected input to 'missing-a-method' error.`);
130
+ }
131
+ return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;
132
+ },
133
+ "add-to-cache-list-unexpected-type": ({ entry })=>{
134
+ return `An unexpected entry was passed to 'serwist.Serwist.addToPrecacheList()' The entry '${JSON.stringify(entry)}' isn't supported. You must supply an array of strings with one or more characters, objects with a url property or Request objects.`;
135
+ },
136
+ "add-to-cache-list-conflicting-entries": ({ firstEntry, secondEntry })=>{
137
+ if (!firstEntry || !secondEntry) {
138
+ throw new Error("Unexpected input to " + `'add-to-cache-list-duplicate-entries' error.`);
139
+ }
140
+ return `Two of the entries passed to 'serwist.Serwist.addToPrecacheList()' had the URL ${firstEntry} but different revision details. Serwist is unable to cache and version the asset correctly. Please remove one of the entries.`;
141
+ },
142
+ "plugin-error-request-will-fetch": ({ thrownErrorMessage })=>{
143
+ if (!thrownErrorMessage) {
144
+ throw new Error("Unexpected input to " + `'plugin-error-request-will-fetch', error.`);
145
+ }
146
+ return `An error was thrown by a plugin's 'requestWillFetch()' method. The thrown error message was: '${thrownErrorMessage}'.`;
147
+ },
148
+ "invalid-cache-name": ({ cacheNameId, value })=>{
149
+ if (!cacheNameId) {
150
+ throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);
151
+ }
152
+ return `You must provide a name containing at least one character for setCacheDetails({${cacheNameId}: '...'}). Received a value of '${JSON.stringify(value)}'`;
153
+ },
154
+ "unregister-route-but-not-found-with-method": ({ method })=>{
155
+ if (!method) {
156
+ throw new Error("Unexpected input to " + `'unregister-route-but-not-found-with-method' error.`);
157
+ }
158
+ return `The route you're trying to unregister was not previously registered for the method type '${method}'.`;
159
+ },
160
+ "unregister-route-route-not-registered": ()=>{
161
+ return `The route you're trying to unregister was not previously ` + "registered.";
162
+ },
163
+ "queue-replay-failed": ({ name })=>{
164
+ return `Replaying the background sync queue '${name}' failed.`;
165
+ },
166
+ "duplicate-queue-name": ({ name })=>{
167
+ return `The Queue name '${name}' is already being used. All instances of backgroundSync.Queue must be given unique names.`;
168
+ },
169
+ "expired-test-without-max-age": ({ methodName, paramName })=>{
170
+ return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;
171
+ },
172
+ "unsupported-route-type": ({ moduleName, className, funcName, paramName })=>{
173
+ return `The supplied '${paramName}' parameter was an unsupported type. Please check the docs for ${moduleName}.${className}.${funcName} for valid input types.`;
174
+ },
175
+ "not-array-of-class": ({ value, expectedClass, moduleName, className, funcName, paramName })=>{
176
+ return `The supplied '${paramName}' parameter must be an array of '${expectedClass}' objects. Received '${JSON.stringify(value)},'. Please check the call to ${moduleName}.${className}.${funcName}() to fix the issue.`;
177
+ },
178
+ "max-entries-or-age-required": ({ moduleName, className, funcName })=>{
179
+ return `You must define either 'config.maxEntries' or 'config.maxAgeSeconds' in '${moduleName}.${className}.${funcName}'`;
180
+ },
181
+ "statuses-or-headers-required": ({ moduleName, className, funcName })=>{
182
+ return `You must define either 'config.statuses' or 'config.headers' in '${moduleName}.${className}.${funcName}'`;
183
+ },
184
+ "invalid-string": ({ moduleName, funcName, paramName })=>{
185
+ if (!paramName || !moduleName || !funcName) {
186
+ throw new Error(`Unexpected input to 'invalid-string' error.`);
187
+ }
188
+ return `When using strings, the '${paramName}' parameter must start with 'http' (for cross-origin matches) or '/' (for same-origin matches). Please see the docs for ${moduleName}.${funcName}() for more info.`;
189
+ },
190
+ "channel-name-required": ()=>{
191
+ return "You must provide a channelName to construct a " + "BroadcastCacheUpdate instance.";
192
+ },
193
+ "invalid-responses-are-same-args": ()=>{
194
+ return "The arguments passed into responsesAreSame() appear to be " + "invalid. Please ensure valid Responses are used.";
195
+ },
196
+ "expire-custom-caches-only": ()=>{
197
+ return `You must provide a 'cacheName' property when using the ` + "expiration plugin with a runtime caching strategy.";
198
+ },
199
+ "unit-must-be-bytes": ({ normalizedRangeHeader })=>{
200
+ if (!normalizedRangeHeader) {
201
+ throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);
202
+ }
203
+ return `The 'unit' portion of the Range header must be set to 'bytes'. The Range header provided was "${normalizedRangeHeader}"`;
204
+ },
205
+ "single-range-only": ({ normalizedRangeHeader })=>{
206
+ if (!normalizedRangeHeader) {
207
+ throw new Error(`Unexpected input to 'single-range-only' error.`);
208
+ }
209
+ return `Multiple ranges are not supported. Please use a single start value, and optional end value. The Range header provided was "${normalizedRangeHeader}"`;
210
+ },
211
+ "invalid-range-values": ({ normalizedRangeHeader })=>{
212
+ if (!normalizedRangeHeader) {
213
+ throw new Error(`Unexpected input to 'invalid-range-values' error.`);
214
+ }
215
+ return `The Range header is missing both start and end values. At least one of those values is needed. The Range header provided was "${normalizedRangeHeader}"`;
216
+ },
217
+ "no-range-header": ()=>{
218
+ return "No Range header was found in the Request provided.";
219
+ },
220
+ "range-not-satisfiable": ({ size, start, end })=>{
221
+ return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;
222
+ },
223
+ "attempt-to-cache-non-get-request": ({ url, method })=>{
224
+ return `Unable to cache '${url}' because it is a '${method}' request and only 'GET' requests can be cached.`;
225
+ },
226
+ "cache-put-with-no-response": ({ url })=>{
227
+ return `There was an attempt to cache '${url}' but the response was not defined.`;
228
+ },
229
+ "no-response": ({ url, error })=>{
230
+ let message = `The strategy could not generate a response for '${url}'.`;
231
+ if (error) {
232
+ message += ` The underlying error is ${error}.`;
233
+ }
234
+ return message;
235
+ },
236
+ "bad-precaching-response": ({ url, status })=>{
237
+ return `The precaching request for '${url}' failed${status ? ` with an HTTP status of ${status}.` : "."}`;
238
+ },
239
+ "non-precached-url": ({ url })=>{
240
+ return `'createHandlerBoundToURL("${url}")' was called, but that URL is not precached. Please pass in a URL that is precached instead.`;
241
+ },
242
+ "add-to-cache-list-conflicting-integrities": ({ url })=>{
243
+ return `Two of the entries passed to 'serwist.Serwist.addToPrecacheList()' had the URL ${url} with different integrity values. Please remove one of them.`;
244
+ },
245
+ "missing-precache-entry": ({ cacheName, url })=>{
246
+ return `Unable to find a precached response in ${cacheName} for ${url}.`;
247
+ },
248
+ "cross-origin-copy-response": ({ origin })=>{
249
+ return `'@serwist/core.copyResponse()' can only be used with same-origin responses. It was passed a response with origin ${origin}.`;
250
+ },
251
+ "opaque-streams-source": ({ type })=>{
252
+ const message = `One of the '@serwist/streams' sources resulted in an '${type}' response.`;
253
+ if (type === "opaqueredirect") {
254
+ return `${message} Please do not use a navigation request that results in a redirect as a source.`;
255
+ }
256
+ return `${message} Please ensure your sources are CORS-enabled.`;
257
+ }
258
+ };
259
+
260
+ const fallback = (code, ...args)=>{
261
+ let msg = code;
262
+ if (args.length > 0) {
263
+ msg += ` :: ${JSON.stringify(args)}`;
264
+ }
265
+ return msg;
266
+ };
267
+ const generatorFunction = (code, details = {})=>{
268
+ const message = messages[code];
269
+ if (!message) {
270
+ throw new Error(`Unable to find message for code '${code}'.`);
271
+ }
272
+ return message(details);
273
+ };
274
+ const messageGenerator = process.env.NODE_ENV === "production" ? fallback : generatorFunction;
275
+
276
+ class SerwistError extends Error {
277
+ details;
278
+ constructor(errorCode, details){
279
+ const message = messageGenerator(errorCode, details);
280
+ super(message);
281
+ this.name = errorCode;
282
+ this.details = details;
283
+ }
284
+ }
285
+
286
+ const isArray = (value, details)=>{
287
+ if (!Array.isArray(value)) {
288
+ throw new SerwistError("not-an-array", details);
289
+ }
290
+ };
291
+ const hasMethod = (object, expectedMethod, details)=>{
292
+ const type = typeof object[expectedMethod];
293
+ if (type !== "function") {
294
+ details.expectedMethod = expectedMethod;
295
+ throw new SerwistError("missing-a-method", details);
296
+ }
297
+ };
298
+ const isType = (object, expectedType, details)=>{
299
+ if (typeof object !== expectedType) {
300
+ details.expectedType = expectedType;
301
+ throw new SerwistError("incorrect-type", details);
302
+ }
303
+ };
304
+ const isInstance = (object, expectedClass, details)=>{
305
+ if (!(object instanceof expectedClass)) {
306
+ details.expectedClassName = expectedClass.name;
307
+ throw new SerwistError("incorrect-class", details);
308
+ }
309
+ };
310
+ const isOneOf = (value, validValues, details)=>{
311
+ if (!validValues.includes(value)) {
312
+ details.validValueDescription = `Valid values are ${JSON.stringify(validValues)}.`;
313
+ throw new SerwistError("invalid-value", details);
314
+ }
315
+ };
316
+ const isArrayOfClass = (value, expectedClass, details)=>{
317
+ const error = new SerwistError("not-array-of-class", details);
318
+ if (!Array.isArray(value)) {
319
+ throw error;
320
+ }
321
+ for (const item of value){
322
+ if (!(item instanceof expectedClass)) {
323
+ throw error;
324
+ }
325
+ }
326
+ };
327
+ const finalAssertExports = process.env.NODE_ENV === "production" ? null : {
328
+ hasMethod,
329
+ isArray,
330
+ isInstance,
331
+ isOneOf,
332
+ isType,
333
+ isArrayOfClass
334
+ };
335
+
336
+ const getFriendlyURL = (url)=>{
337
+ const urlObj = new URL(String(url), location.href);
338
+ return urlObj.href.replace(new RegExp(`^${location.origin}`), "");
339
+ };
340
+
341
+ class Deferred {
342
+ promise;
343
+ resolve;
344
+ reject;
345
+ constructor(){
346
+ this.promise = new Promise((resolve, reject)=>{
347
+ this.resolve = resolve;
348
+ this.reject = reject;
349
+ });
350
+ }
351
+ }
352
+
353
+ function stripParams(fullURL, ignoreParams) {
354
+ const strippedURL = new URL(fullURL);
355
+ for (const param of ignoreParams){
356
+ strippedURL.searchParams.delete(param);
357
+ }
358
+ return strippedURL.href;
359
+ }
360
+ async function cacheMatchIgnoreParams(cache, request, ignoreParams, matchOptions) {
361
+ const strippedRequestURL = stripParams(request.url, ignoreParams);
362
+ if (request.url === strippedRequestURL) {
363
+ return cache.match(request, matchOptions);
364
+ }
365
+ const keysOptions = {
366
+ ...matchOptions,
367
+ ignoreSearch: true
368
+ };
369
+ const cacheKeys = await cache.keys(request, keysOptions);
370
+ for (const cacheKey of cacheKeys){
371
+ const strippedCacheKeyURL = stripParams(cacheKey.url, ignoreParams);
372
+ if (strippedRequestURL === strippedCacheKeyURL) {
373
+ return cache.match(cacheKey, matchOptions);
374
+ }
375
+ }
376
+ return;
377
+ }
378
+
379
+ const quotaErrorCallbacks = new Set();
380
+
381
+ const executeQuotaErrorCallbacks = async ()=>{
382
+ if (process.env.NODE_ENV !== "production") {
383
+ logger.log(`About to run ${quotaErrorCallbacks.size} callbacks to clean up caches.`);
384
+ }
385
+ for (const callback of quotaErrorCallbacks){
386
+ await callback();
387
+ if (process.env.NODE_ENV !== "production") {
388
+ logger.log(callback, "is complete.");
389
+ }
390
+ }
391
+ if (process.env.NODE_ENV !== "production") {
392
+ logger.log("Finished running callbacks.");
393
+ }
394
+ };
395
+
396
+ function timeout(ms) {
397
+ return new Promise((resolve)=>setTimeout(resolve, ms));
398
+ }
399
+
400
+ export { Deferred as D, SerwistError as S, cacheMatchIgnoreParams as a, cacheNames as c, executeQuotaErrorCallbacks as e, finalAssertExports as f, getFriendlyURL as g, logger as l, quotaErrorCallbacks as q, timeout as t };
@@ -0,0 +1,24 @@
1
+ let supportStatus;
2
+ function canConstructResponseFromBodyStream() {
3
+ if (supportStatus === undefined) {
4
+ const testResponse = new Response("");
5
+ if ("body" in testResponse) {
6
+ try {
7
+ new Response(testResponse.body);
8
+ supportStatus = true;
9
+ } catch (error) {
10
+ supportStatus = false;
11
+ }
12
+ }
13
+ supportStatus = false;
14
+ }
15
+ return supportStatus;
16
+ }
17
+
18
+ const waitUntil = (event, asyncFn)=>{
19
+ const returnPromise = asyncFn();
20
+ event.waitUntil(returnPromise);
21
+ return returnPromise;
22
+ };
23
+
24
+ export { canConstructResponseFromBodyStream as c, waitUntil as w };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Adds an `activate` event listener which will clean up incompatible
3
+ * precaches that were created by older versions of Serwist.
4
+ */
5
+ export declare const cleanupOutdatedCaches: (cacheName?: string) => void;
6
+ //# sourceMappingURL=cleanupOutdatedCaches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanupOutdatedCaches.d.ts","sourceRoot":"","sources":["../src/cleanupOutdatedCaches.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,eAAgB,MAAM,KAAG,IAY1D,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Claims any currently available clients once the service worker
3
+ * becomes active. This is normally used in conjunction with `skipWaiting()`.
4
+ */
5
+ export declare const clientsClaim: () => void;
6
+ //# sourceMappingURL=clientsClaim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientsClaim.d.ts","sourceRoot":"","sources":["../src/clientsClaim.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAC"}
@@ -0,0 +1,15 @@
1
+ export type HTTPMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
2
+ /**
3
+ * The default HTTP method, 'GET', used when there's no specific method
4
+ * configured for a route.
5
+ *
6
+ * @private
7
+ */
8
+ export declare const defaultMethod = "GET";
9
+ /**
10
+ * The list of valid HTTP methods associated with requests that could be routed.
11
+ *
12
+ * @private
13
+ */
14
+ export declare const validMethods: ("DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT")[];
15
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAA6B,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,YAAY,0DAA2E,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Allows developers to copy a response and modify its `headers`, `status`,
3
+ * or `statusText` values (the values settable via a
4
+ * [`ResponseInit`](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#Syntax)
5
+ * object in the constructor).
6
+ * To modify these values, pass a function as the second argument. That
7
+ * function will be invoked with a single object with the response properties
8
+ * `{headers, status, statusText}`. The return value of this function will
9
+ * be used as the `ResponseInit` for the new `Response`. To change the values
10
+ * either modify the passed parameter(s) and return it, or return a totally
11
+ * new object.
12
+ *
13
+ * This method is intentionally limited to same-origin responses, regardless of
14
+ * whether CORS was used or not.
15
+ *
16
+ * @param response
17
+ * @param modifier
18
+ */
19
+ export declare const copyResponse: (response: Response, modifier?: ((responseInit: ResponseInit) => ResponseInit) | undefined) => Promise<Response>;
20
+ //# sourceMappingURL=copyResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copyResponse.d.ts","sourceRoot":"","sources":["../src/copyResponse.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,aAAoB,QAAQ,6BAA4B,YAAY,KAAK,YAAY,kBAAG,QAAQ,QAAQ,CA8BhI,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Disables Serwist's logging in development mode.
3
+ *
4
+ * @see https://serwist.pages.dev/docs/sw/abstractions/disable-dev-logs
5
+ */
6
+ export declare const disableDevLogs: () => void;
7
+ //# sourceMappingURL=disableDevLogs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disableDevLogs.d.ts","sourceRoot":"","sources":["../src/disableDevLogs.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAO,IAEjC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { HTTPMethod } from "./constants.js";
2
+ import { cacheNames } from "./cacheNames.js";
3
+ import { cleanupOutdatedCaches } from "./cleanupOutdatedCaches.js";
4
+ import { clientsClaim } from "./clientsClaim.js";
5
+ import { copyResponse } from "./copyResponse.js";
6
+ import { disableDevLogs } from "./disableDevLogs.js";
7
+ import { disableNavigationPreload, enableNavigationPreload, isNavigationPreloadSupported } from "./navigationPreload.js";
8
+ import type { NavigationRouteMatchOptions } from "./NavigationRoute.js";
9
+ import { NavigationRoute } from "./NavigationRoute.js";
10
+ import { parseRoute } from "./parseRoute.js";
11
+ import { PrecacheRoute } from "./PrecacheRoute.js";
12
+ import { PrecacheStrategy } from "./PrecacheStrategy.js";
13
+ import { RegExpRoute } from "./RegExpRoute.js";
14
+ import { registerQuotaErrorCallback } from "./registerQuotaErrorCallback.js";
15
+ import { Route } from "./Route.js";
16
+ import { Serwist, type SerwistOptions } from "./Serwist.js";
17
+ import { setCacheNameDetails } from "./setCacheNameDetails.js";
18
+ export { NavigationRoute, cacheNames, cleanupOutdatedCaches, clientsClaim, copyResponse, disableDevLogs, disableNavigationPreload, enableNavigationPreload, isNavigationPreloadSupported, parseRoute, PrecacheRoute, PrecacheStrategy, RegExpRoute, registerQuotaErrorCallback, Route, Serwist, setCacheNameDetails, };
19
+ export type { HTTPMethod, NavigationRouteMatchOptions, SerwistOptions };
20
+ export type * from "./types.js";
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACzH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EACL,eAAe,EACf,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,0BAA0B,EAC1B,KAAK,EACL,OAAO,EACP,mBAAmB,GACpB,CAAC;AACF,YAAY,EAAE,UAAU,EAAE,2BAA2B,EAAE,cAAc,EAAE,CAAC;AACxE,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Deferred } from "./utils/Deferred.js";
2
+ import { SerwistError } from "./utils/SerwistError.js";
3
+ import { assert } from "./utils/assert.js";
4
+ import { cacheMatchIgnoreParams } from "./utils/cacheMatchIgnoreParams.js";
5
+ import { cacheNames as privateCacheNames } from "./utils/cacheNames.js";
6
+ import { canConstructReadableStream } from "./utils/canConstructReadableStream.js";
7
+ import { canConstructResponseFromBodyStream } from "./utils/canConstructResponseFromBodyStream.js";
8
+ import { dontWaitFor } from "./utils/dontWaitFor.js";
9
+ import { executeQuotaErrorCallbacks } from "./utils/executeQuotaErrorCallbacks.js";
10
+ import { getFriendlyURL } from "./utils/getFriendlyURL.js";
11
+ import { logger } from "./utils/logger.js";
12
+ import { resultingClientExists } from "./utils/resultingClientExists.js";
13
+ import { timeout } from "./utils/timeout.js";
14
+ import { waitUntil } from "./utils/waitUntil.js";
15
+ export { Deferred, SerwistError, assert, cacheMatchIgnoreParams, privateCacheNames, canConstructReadableStream, canConstructResponseFromBodyStream, dontWaitFor, executeQuotaErrorCallbacks, getFriendlyURL, logger, resultingClientExists, timeout, waitUntil, };
16
+ //# sourceMappingURL=index.internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.internal.d.ts","sourceRoot":"","sources":["../src/index.internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,kCAAkC,EAAE,MAAM,+CAA+C,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIjD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,kCAAkC,EAClC,WAAW,EACX,0BAA0B,EAC1B,cAAc,EACd,MAAM,EACN,qBAAqB,EACrB,OAAO,EACP,SAAS,GACV,CAAC"}
@@ -0,0 +1,24 @@
1
+ export { D as Deferred, S as SerwistError, f as assert, a as cacheMatchIgnoreParams, e as executeQuotaErrorCallbacks, g as getFriendlyURL, l as logger, c as privateCacheNames, t as timeout } from './chunks/timeout.js';
2
+ export { c as canConstructResponseFromBodyStream, w as waitUntil } from './chunks/waitUntil.js';
3
+ export { r as resultingClientExists } from './chunks/resultingClientExists.js';
4
+
5
+ let supportStatus;
6
+ function canConstructReadableStream() {
7
+ if (supportStatus === undefined) {
8
+ try {
9
+ new ReadableStream({
10
+ start () {}
11
+ });
12
+ supportStatus = true;
13
+ } catch (error) {
14
+ supportStatus = false;
15
+ }
16
+ }
17
+ return supportStatus;
18
+ }
19
+
20
+ function dontWaitFor(promise) {
21
+ void promise.then(()=>{});
22
+ }
23
+
24
+ export { canConstructReadableStream, dontWaitFor };
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { c as cacheNames$1 } from './chunks/timeout.js';
2
+ export { N as NavigationRoute, P as PrecacheRoute, g as PrecacheStrategy, R as RegExpRoute, S as Serwist, c as cleanupOutdatedCaches, a as clientsClaim, b as copyResponse, d as disableDevLogs, e as disableNavigationPreload, f as enableNavigationPreload, i as isNavigationPreloadSupported, p as parseRoute, s as setCacheNameDetails } from './chunks/Serwist.js';
3
+ export { r as registerQuotaErrorCallback } from './chunks/registerQuotaErrorCallback.js';
4
+ export { R as Route } from './chunks/PrecacheFallbackPlugin.js';
5
+ import './chunks/waitUntil.js';
6
+ import './chunks/NetworkOnly.js';
7
+ import 'idb';
8
+
9
+ const cacheNames = {
10
+ get googleAnalytics () {
11
+ return cacheNames$1.getGoogleAnalyticsName();
12
+ },
13
+ get precache () {
14
+ return cacheNames$1.getPrecacheName();
15
+ },
16
+ get prefix () {
17
+ return cacheNames$1.getPrefix();
18
+ },
19
+ get runtime () {
20
+ return cacheNames$1.getRuntimeName();
21
+ },
22
+ get suffix () {
23
+ return cacheNames$1.getSuffix();
24
+ }
25
+ };
26
+
27
+ export { cacheNames };