serwist 9.0.2 → 9.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NavigationRoute.d.ts +2 -2
- package/dist/PrecacheRoute.d.ts +2 -3
- package/dist/PrecacheRoute.d.ts.map +1 -1
- package/dist/RegExpRoute.d.ts +2 -2
- package/dist/Route.d.ts +4 -4
- package/dist/Serwist.d.ts +19 -19
- package/dist/chunks/printInstallDetails.js +6 -10
- package/dist/copyResponse.d.ts.map +1 -1
- package/dist/legacy/PrecacheController.d.ts +1 -1
- package/dist/legacy/PrecacheFallbackPlugin.d.ts +6 -7
- package/dist/legacy/PrecacheFallbackPlugin.d.ts.map +1 -1
- package/dist/legacy/PrecacheRoute.d.ts +3 -3
- package/dist/legacy/Router.d.ts +23 -23
- package/dist/legacy/addRoute.d.ts +6 -8
- package/dist/legacy/addRoute.d.ts.map +1 -1
- package/dist/legacy/createHandlerBoundToURL.d.ts +5 -6
- package/dist/legacy/createHandlerBoundToURL.d.ts.map +1 -1
- package/dist/legacy/fallbacks.d.ts +3 -3
- package/dist/legacy/handlePrecaching.d.ts +3 -3
- package/dist/legacy/initializeGoogleAnalytics.d.ts +1 -1
- package/dist/legacy/installSerwist.d.ts +4 -4
- package/dist/legacy/matchPrecache.d.ts +4 -4
- package/dist/legacy/matchPrecache.d.ts.map +1 -1
- package/dist/legacy/precache.d.ts +2 -2
- package/dist/legacy/precache.d.ts.map +1 -1
- package/dist/legacy/precacheAndRoute.d.ts +3 -4
- package/dist/legacy/precacheAndRoute.d.ts.map +1 -1
- package/dist/legacy/registerRoute.d.ts +6 -6
- package/dist/legacy/registerRoute.d.ts.map +1 -1
- package/dist/legacy/registerRuntimeCaching.d.ts +1 -1
- package/dist/legacy/setCatchHandler.d.ts +2 -2
- package/dist/legacy/setDefaultHandler.d.ts +3 -3
- package/dist/legacy/singletonPrecacheController.d.ts +7 -7
- package/dist/legacy/singletonRouter.d.ts +9 -9
- package/dist/legacy/unregisterRoute.d.ts +1 -1
- package/dist/legacy/unregisterRoute.d.ts.map +1 -1
- package/dist/lib/backgroundSync/BackgroundSyncPlugin.d.ts +3 -3
- package/dist/lib/backgroundSync/BackgroundSyncQueue.d.ts +1 -1
- package/dist/lib/backgroundSync/StorableRequest.d.ts +1 -1
- package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts +1 -2
- package/dist/lib/broadcastUpdate/BroadcastCacheUpdate.d.ts.map +1 -1
- package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts +4 -7
- package/dist/lib/broadcastUpdate/BroadcastUpdatePlugin.d.ts.map +1 -1
- package/dist/lib/broadcastUpdate/types.d.ts +2 -1
- package/dist/lib/broadcastUpdate/types.d.ts.map +1 -1
- package/dist/lib/cacheableResponse/CacheableResponse.d.ts +6 -6
- package/dist/lib/cacheableResponse/CacheableResponsePlugin.d.ts +2 -2
- package/dist/lib/expiration/CacheExpiration.d.ts +2 -2
- package/dist/lib/expiration/ExpirationPlugin.d.ts +11 -11
- package/dist/lib/expiration/ExpirationPlugin.d.ts.map +1 -1
- package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts +4 -4
- package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts +3 -4
- package/dist/lib/rangeRequests/RangeRequestsPlugin.d.ts.map +1 -1
- package/dist/lib/rangeRequests/createPartialResponse.d.ts +7 -7
- package/dist/lib/rangeRequests/createPartialResponse.d.ts.map +1 -1
- package/dist/lib/rangeRequests/utils/parseRangeHeader.d.ts +2 -2
- package/dist/lib/strategies/CacheFirst.d.ts +1 -1
- package/dist/lib/strategies/CacheOnly.d.ts +1 -1
- package/dist/lib/strategies/NetworkFirst.d.ts +1 -1
- package/dist/lib/strategies/NetworkOnly.d.ts +1 -1
- package/dist/lib/strategies/PrecacheStrategy.d.ts +3 -3
- package/dist/lib/strategies/PrecacheStrategy.d.ts.map +1 -1
- package/dist/lib/strategies/StaleWhileRevalidate.d.ts +1 -1
- package/dist/lib/strategies/Strategy.d.ts +7 -7
- package/dist/lib/strategies/StrategyHandler.d.ts +12 -13
- package/dist/lib/strategies/StrategyHandler.d.ts.map +1 -1
- package/dist/types.d.ts +37 -36
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/cacheNames.d.ts +1 -1
- package/dist/utils/cacheNames.d.ts.map +1 -1
- package/dist/utils/canConstructResponseFromBodyStream.d.ts +2 -2
- package/dist/utils/deleteOutdatedCaches.d.ts.map +1 -1
- package/dist/utils/executeQuotaErrorCallbacks.d.ts.map +1 -1
- package/dist/utils/parseRoute.d.ts +8 -8
- package/dist/utils/waitUntil.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/NavigationRoute.ts +2 -2
- package/src/PrecacheRoute.ts +2 -3
- package/src/RegExpRoute.ts +2 -2
- package/src/Route.ts +4 -4
- package/src/Serwist.ts +19 -19
- package/src/legacy/PrecacheController.ts +1 -1
- package/src/legacy/PrecacheFallbackPlugin.ts +6 -7
- package/src/legacy/PrecacheRoute.ts +3 -3
- package/src/legacy/Router.ts +23 -23
- package/src/legacy/addRoute.ts +6 -8
- package/src/legacy/createHandlerBoundToURL.ts +6 -6
- package/src/legacy/fallbacks.ts +3 -3
- package/src/legacy/handlePrecaching.ts +3 -3
- package/src/legacy/initializeGoogleAnalytics.ts +1 -1
- package/src/legacy/installSerwist.ts +4 -4
- package/src/legacy/matchPrecache.ts +5 -4
- package/src/legacy/precache.ts +4 -2
- package/src/legacy/precacheAndRoute.ts +3 -4
- package/src/legacy/registerRoute.ts +8 -7
- package/src/legacy/registerRuntimeCaching.ts +1 -1
- package/src/legacy/setCatchHandler.ts +2 -2
- package/src/legacy/setDefaultHandler.ts +3 -3
- package/src/legacy/singletonPrecacheController.ts +7 -7
- package/src/legacy/singletonRouter.ts +9 -9
- package/src/legacy/unregisterRoute.ts +2 -1
- package/src/lib/backgroundSync/BackgroundSyncPlugin.ts +3 -3
- package/src/lib/backgroundSync/BackgroundSyncQueue.ts +1 -1
- package/src/lib/backgroundSync/StorableRequest.ts +1 -1
- package/src/lib/broadcastUpdate/BroadcastCacheUpdate.ts +1 -2
- package/src/lib/broadcastUpdate/BroadcastUpdatePlugin.ts +4 -7
- package/src/lib/broadcastUpdate/types.ts +2 -1
- package/src/lib/cacheableResponse/CacheableResponse.ts +6 -6
- package/src/lib/cacheableResponse/CacheableResponsePlugin.ts +2 -2
- package/src/lib/expiration/CacheExpiration.ts +2 -2
- package/src/lib/expiration/ExpirationPlugin.ts +12 -11
- package/src/lib/precaching/PrecacheFallbackPlugin.ts +4 -4
- package/src/lib/rangeRequests/RangeRequestsPlugin.ts +3 -4
- package/src/lib/rangeRequests/createPartialResponse.ts +7 -7
- package/src/lib/rangeRequests/utils/parseRangeHeader.ts +2 -2
- package/src/lib/strategies/CacheFirst.ts +1 -1
- package/src/lib/strategies/CacheOnly.ts +1 -1
- package/src/lib/strategies/NetworkFirst.ts +1 -1
- package/src/lib/strategies/NetworkOnly.ts +1 -1
- package/src/lib/strategies/PrecacheStrategy.ts +4 -3
- package/src/lib/strategies/StaleWhileRevalidate.ts +1 -1
- package/src/lib/strategies/Strategy.ts +7 -7
- package/src/lib/strategies/StrategyHandler.ts +21 -25
- package/src/types.ts +39 -36
- package/src/utils/cacheNames.ts +2 -1
- package/src/utils/canConstructResponseFromBodyStream.ts +2 -2
- package/src/utils/parseRoute.ts +8 -8
|
@@ -15,9 +15,9 @@ export interface NavigationRouteMatchOptions {
|
|
|
15
15
|
denylist?: RegExp[];
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* A class that makes it easy to create a {@linkcode Route} object that matches navigation requests.
|
|
19
19
|
*
|
|
20
|
-
* It will only match incoming
|
|
20
|
+
* It will only match incoming requests whose [`mode`](https://fetch.spec.whatwg.org/#concept-request-mode) is set to `"navigate"`.
|
|
21
21
|
*
|
|
22
22
|
* You can optionally only apply this route to a subset of navigation requests
|
|
23
23
|
* by using one or both of the `denylist` and `allowlist` parameters.
|
package/dist/PrecacheRoute.d.ts
CHANGED
|
@@ -2,13 +2,12 @@ import { Route } from "./Route.js";
|
|
|
2
2
|
import type { Serwist } from "./Serwist.js";
|
|
3
3
|
import type { PrecacheRouteOptions } from "./types.js";
|
|
4
4
|
/**
|
|
5
|
-
* A subclass of
|
|
5
|
+
* A subclass of {@linkcode Route} that takes a {@linkcode Serwist} instance and uses it to match
|
|
6
6
|
* incoming requests and handle fetching responses from the precache.
|
|
7
7
|
*/
|
|
8
8
|
export declare class PrecacheRoute extends Route {
|
|
9
9
|
/**
|
|
10
|
-
* @param serwist A
|
|
11
|
-
* and respond to fetch events.
|
|
10
|
+
* @param serwist A {@linkcode Serwist} instance.
|
|
12
11
|
* @param options Options to control how requests are matched
|
|
13
12
|
* against the list of precached URLs.
|
|
14
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheRoute.d.ts","sourceRoot":"","sources":["../src/PrecacheRoute.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAKvD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC
|
|
1
|
+
{"version":3,"file":"PrecacheRoute.d.ts","sourceRoot":"","sources":["../src/PrecacheRoute.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAKvD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC;;;;OAIG;gBACS,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,oBAAoB;CAkB7D"}
|
package/dist/RegExpRoute.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Route } from "./Route.js";
|
|
|
2
2
|
import type { HTTPMethod } from "./constants.js";
|
|
3
3
|
import type { RouteHandler } from "./types.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A class that makes it easy to create a {@linkcode Route} object with a regular expression.
|
|
6
6
|
*
|
|
7
7
|
* For same-origin requests the `RegExp` only needs to match part of the URL. For
|
|
8
8
|
* requests against third-party servers, you must define a `RegExp` that matches
|
|
@@ -16,7 +16,7 @@ export declare class RegExpRoute extends Route {
|
|
|
16
16
|
*
|
|
17
17
|
* @param regExp The regular expression to match against URLs.
|
|
18
18
|
* @param handler A callback function that returns a `Promise` resulting in a `Response`.
|
|
19
|
-
* @param method The HTTP method to match the
|
|
19
|
+
* @param method The HTTP method to match the {@linkcode Route} against. Defaults to `GET`.
|
|
20
20
|
* against.
|
|
21
21
|
*/
|
|
22
22
|
constructor(regExp: RegExp, handler: RouteHandler, method?: HTTPMethod);
|
package/dist/Route.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { HTTPMethod } from "./constants.js";
|
|
2
2
|
import type { RouteHandler, RouteHandlerObject, RouteMatchCallback } from "./types.js";
|
|
3
3
|
/**
|
|
4
|
-
* A `Route` consists of a pair of callback functions, `match and `handler
|
|
4
|
+
* A `Route` consists of a pair of callback functions, `match` and `handler`.
|
|
5
5
|
* The `match` callback determines if a route should be used to handle a
|
|
6
|
-
* request by returning a truthy value if it can. The `handler callback
|
|
7
|
-
* is called when the route matches and should return a
|
|
8
|
-
* to a
|
|
6
|
+
* request by returning a truthy value if it can. The `handler` callback
|
|
7
|
+
* is called when the route matches and should return a promise that resolves
|
|
8
|
+
* to a response.
|
|
9
9
|
*/
|
|
10
10
|
export declare class Route {
|
|
11
11
|
handler: RouteHandlerObject;
|
package/dist/Serwist.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export interface SerwistOptions {
|
|
|
100
100
|
*/
|
|
101
101
|
runtimeCaching?: RuntimeCaching[];
|
|
102
102
|
/**
|
|
103
|
-
* Your configuration for
|
|
103
|
+
* Your configuration for {@linkcode initializeGoogleAnalytics}. This plugin is
|
|
104
104
|
* only initialized when this option is not `undefined` or `false`.
|
|
105
105
|
*/
|
|
106
106
|
offlineAnalyticsConfig?: Omit<GoogleAnalyticsInitializeOptions, "serwist"> | boolean;
|
|
@@ -112,7 +112,7 @@ export interface SerwistOptions {
|
|
|
112
112
|
disableDevLogs?: boolean;
|
|
113
113
|
/**
|
|
114
114
|
* Precaches routes so that they can be used as a fallback when
|
|
115
|
-
* a
|
|
115
|
+
* a {@linkcode Strategy} fails to generate a response.
|
|
116
116
|
*
|
|
117
117
|
* Note: This option mutates `runtimeCaching`. It also expects the URLs
|
|
118
118
|
* defined in `entries` to have been precached beforehand.
|
|
@@ -135,11 +135,11 @@ export declare class Serwist {
|
|
|
135
135
|
private _catchHandler?;
|
|
136
136
|
constructor({ precacheEntries, precacheOptions, skipWaiting, importScripts, navigationPreload, cacheId, clientsClaim, runtimeCaching, offlineAnalyticsConfig, disableDevLogs, fallbacks, }?: SerwistOptions);
|
|
137
137
|
/**
|
|
138
|
-
* The strategy used to precache assets and respond to fetch events.
|
|
138
|
+
* The strategy used to precache assets and respond to `fetch` events.
|
|
139
139
|
*/
|
|
140
140
|
get precacheStrategy(): Strategy;
|
|
141
141
|
/**
|
|
142
|
-
* A `Map` of HTTP method name (`'GET'`, etc.) to an array of all corresponding registered
|
|
142
|
+
* A `Map` of HTTP method name (`'GET'`, etc.) to an array of all corresponding registered {@linkcode Route}
|
|
143
143
|
* instances.
|
|
144
144
|
*/
|
|
145
145
|
get routes(): Map<HTTPMethod, Route[]>;
|
|
@@ -189,7 +189,7 @@ export declare class Serwist {
|
|
|
189
189
|
*/
|
|
190
190
|
handleCache(event: ExtendableMessageEvent): void;
|
|
191
191
|
/**
|
|
192
|
-
* Define a default
|
|
192
|
+
* Define a default handler that's called when no routes explicitly
|
|
193
193
|
* match the incoming request.
|
|
194
194
|
*
|
|
195
195
|
* Each HTTP method (`'GET'`, `'POST'`, etc.) gets its own default handler.
|
|
@@ -203,34 +203,34 @@ export declare class Serwist {
|
|
|
203
203
|
*/
|
|
204
204
|
setDefaultHandler(handler: RouteHandler, method?: HTTPMethod): void;
|
|
205
205
|
/**
|
|
206
|
-
* If a
|
|
206
|
+
* If a {@linkcode Route} throws an error while handling a request, this handler
|
|
207
207
|
* will be called and given a chance to provide a response.
|
|
208
208
|
*
|
|
209
|
-
* @param handler A callback function that returns a Promise resulting
|
|
210
|
-
* in a Response
|
|
209
|
+
* @param handler A callback function that returns a `Promise` resulting
|
|
210
|
+
* in a `Response`.
|
|
211
211
|
*/
|
|
212
212
|
setCatchHandler(handler: RouteHandler): void;
|
|
213
213
|
/**
|
|
214
214
|
* Registers a `RegExp`, string, or function with a caching
|
|
215
215
|
* strategy to the router.
|
|
216
216
|
*
|
|
217
|
-
* @param capture If the capture param is a
|
|
217
|
+
* @param capture If the capture param is a {@linkcode Route} object, all other arguments will be ignored.
|
|
218
218
|
* @param handler A callback function that returns a `Promise` resulting in a `Response`.
|
|
219
|
-
* This parameter is required if `capture` is not a
|
|
220
|
-
* @param method The HTTP method to match the
|
|
221
|
-
* @returns The generated
|
|
219
|
+
* This parameter is required if `capture` is not a {@linkcode Route} object.
|
|
220
|
+
* @param method The HTTP method to match the route against. Defaults to `'GET'`.
|
|
221
|
+
* @returns The generated {@linkcode Route} object.
|
|
222
222
|
*/
|
|
223
223
|
registerCapture<T extends RegExp | string | RouteMatchCallback | Route>(capture: T, handler?: T extends Route ? never : RouteHandler, method?: T extends Route ? never : HTTPMethod): Route;
|
|
224
224
|
/**
|
|
225
|
-
* Registers a
|
|
225
|
+
* Registers a {@linkcode Route} with the router.
|
|
226
226
|
*
|
|
227
|
-
* @param route The
|
|
227
|
+
* @param route The {@linkcode Route} to register.
|
|
228
228
|
*/
|
|
229
229
|
registerRoute(route: Route): void;
|
|
230
230
|
/**
|
|
231
|
-
* Unregisters a
|
|
231
|
+
* Unregisters a route from the router.
|
|
232
232
|
*
|
|
233
|
-
* @param route The
|
|
233
|
+
* @param route The {@linkcode Route} object to unregister.
|
|
234
234
|
*/
|
|
235
235
|
unregisterRoute(route: Route): void;
|
|
236
236
|
/**
|
|
@@ -291,12 +291,12 @@ export declare class Serwist {
|
|
|
291
291
|
*/
|
|
292
292
|
createHandlerBoundToUrl(url: string): RouteHandlerCallback;
|
|
293
293
|
/**
|
|
294
|
-
* Applies the routing rules to a `FetchEvent` object to get a
|
|
295
|
-
* appropriate
|
|
294
|
+
* Applies the routing rules to a `FetchEvent` object to get a response from an
|
|
295
|
+
* appropriate route.
|
|
296
296
|
*
|
|
297
297
|
* @param options
|
|
298
298
|
* @returns A promise is returned if a registered route can handle the request.
|
|
299
|
-
* If there is no matching route and there's no
|
|
299
|
+
* If there is no matching route and there's no default handler, `undefined`
|
|
300
300
|
* is returned.
|
|
301
301
|
*/
|
|
302
302
|
handleRequest({ request, event, }: {
|
|
@@ -487,18 +487,14 @@ class StrategyHandler {
|
|
|
487
487
|
}
|
|
488
488
|
if (!pluginsUsed) {
|
|
489
489
|
if (responseToCache && responseToCache.status !== 200) {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
if (responseToCache.status === 0) {
|
|
496
|
-
logger.warn(`The response for '${this.request.url}' is an opaque response. The caching strategy that you're using will not cache opaque responses by default.`);
|
|
497
|
-
} else {
|
|
498
|
-
logger.debug(`The response for '${this.request.url}' returned a status code of '${response.status}' and won't be cached as a result.`);
|
|
499
|
-
}
|
|
490
|
+
if (process.env.NODE_ENV !== "production") {
|
|
491
|
+
if (responseToCache.status === 0) {
|
|
492
|
+
logger.warn(`The response for '${this.request.url}' is an opaque response. The caching strategy that you're using will not cache opaque responses by default.`);
|
|
493
|
+
} else {
|
|
494
|
+
logger.debug(`The response for '${this.request.url}' returned a status code of '${response.status}' and won't be cached as a result.`);
|
|
500
495
|
}
|
|
501
496
|
}
|
|
497
|
+
responseToCache = undefined;
|
|
502
498
|
}
|
|
503
499
|
}
|
|
504
500
|
return responseToCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyResponse.d.ts","sourceRoot":"","sources":["../src/copyResponse.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,aAAoB,QAAQ,aAAa,CAAC,YAAY,EAAE,YAAY,KAAK,YAAY,KAAG,
|
|
1
|
+
{"version":3,"file":"copyResponse.d.ts","sourceRoot":"","sources":["../src/copyResponse.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,aAAoB,QAAQ,aAAa,CAAC,YAAY,EAAE,YAAY,KAAK,YAAY,KAAG,OAAO,CAAC,QAAQ,CA8BhI,CAAC"}
|
|
@@ -42,7 +42,7 @@ export declare class PrecacheController {
|
|
|
42
42
|
constructor({ cacheName, plugins, fallbackToNetwork, concurrentPrecaching }?: PrecacheControllerOptions);
|
|
43
43
|
/**
|
|
44
44
|
* The strategy created by this controller and
|
|
45
|
-
* used to cache assets and respond to fetch events.
|
|
45
|
+
* used to cache assets and respond to `fetch` events.
|
|
46
46
|
*/
|
|
47
47
|
get strategy(): Strategy;
|
|
48
48
|
/**
|
|
@@ -24,22 +24,21 @@ export interface PrecacheFallbackPluginOptions {
|
|
|
24
24
|
*/
|
|
25
25
|
fallbackUrls: (string | PrecacheFallbackEntry)[];
|
|
26
26
|
/**
|
|
27
|
-
* An optional
|
|
28
|
-
*
|
|
27
|
+
* An optional {@linkcode PrecacheController} instance. If not provided,
|
|
28
|
+
* the default {@linkcode PrecacheController} will be used.
|
|
29
29
|
*/
|
|
30
30
|
precacheController?: PrecacheController;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* A class that allows you to specify offline fallbacks
|
|
34
34
|
* to be used when a given strategy is unable to generate a response.
|
|
35
35
|
*
|
|
36
36
|
* It does this by intercepting the `handlerDidError` plugin callback
|
|
37
37
|
* and returning a precached response, taking the expected revision parameter
|
|
38
38
|
* into account automatically.
|
|
39
39
|
*
|
|
40
|
-
* Unless you explicitly pass in a
|
|
41
|
-
* constructor, the default instance will be used.
|
|
42
|
-
* developers will end up using the default.
|
|
40
|
+
* Unless you explicitly pass in a {@linkcode PrecacheController} instance to the
|
|
41
|
+
* constructor, the default instance will be used.
|
|
43
42
|
*
|
|
44
43
|
* @deprecated
|
|
45
44
|
*/
|
|
@@ -47,7 +46,7 @@ export declare class PrecacheFallbackPlugin implements SerwistPlugin {
|
|
|
47
46
|
private readonly _fallbackUrls;
|
|
48
47
|
private readonly _precacheController;
|
|
49
48
|
/**
|
|
50
|
-
* Constructs a new
|
|
49
|
+
* Constructs a new instance with the associated `fallbackUrls`.
|
|
51
50
|
*
|
|
52
51
|
* @param config
|
|
53
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheFallbackPlugin.d.ts","sourceRoot":"","sources":["../../src/legacy/PrecacheFallbackPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,OAAO,CAAC;IAC1D;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,YAAY,EAAE,CAAC,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAC;IACjD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED
|
|
1
|
+
{"version":3,"file":"PrecacheFallbackPlugin.d.ts","sourceRoot":"","sources":["../../src/legacy/PrecacheFallbackPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,OAAO,CAAC;IAC1D;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,YAAY,EAAE,CAAC,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAC;IACjD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,YAAW,aAAa;IAC1D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqC;IACnE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD;;;;OAIG;gBACS,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAAE,6BAA6B;IAK/E;;;;OAIG;IACG,eAAe,CAAC,KAAK,EAAE,4BAA4B;CAgB1D"}
|
|
@@ -2,15 +2,15 @@ import { Route } from "../Route.js";
|
|
|
2
2
|
import type { PrecacheRouteOptions } from "../types.js";
|
|
3
3
|
import type { PrecacheController } from "./PrecacheController.js";
|
|
4
4
|
/**
|
|
5
|
-
* A subclass of
|
|
5
|
+
* A subclass of {@linkcode Route} that takes a {@linkcode PrecacheController}
|
|
6
6
|
* instance and uses it to match incoming requests and handle fetching
|
|
7
7
|
* responses from the precache.
|
|
8
8
|
* @deprecated
|
|
9
9
|
*/
|
|
10
10
|
export declare class PrecacheRoute extends Route {
|
|
11
11
|
/**
|
|
12
|
-
* @param precacheController A
|
|
13
|
-
* instance used to both match requests and respond to fetch events.
|
|
12
|
+
* @param precacheController A {@linkcode PrecacheController}
|
|
13
|
+
* instance used to both match requests and respond to `fetch` events.
|
|
14
14
|
* @param options Options to control how requests are matched
|
|
15
15
|
* against the list of precached URLs.
|
|
16
16
|
*/
|
package/dist/legacy/Router.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import type { Route } from "../Route.js";
|
|
|
2
2
|
import type { HTTPMethod } from "../constants.js";
|
|
3
3
|
import type { RouteHandler, RouteHandlerCallbackOptions, RouteMatchCallback, RouteMatchCallbackOptions } from "../types.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A class that can be used to process a `fetch` event using one or more route(s), responding with a response
|
|
6
6
|
* if a matching route exists.
|
|
7
7
|
*
|
|
8
|
-
* If no
|
|
8
|
+
* If no route matches given a request, the router will use the default handler if one is defined.
|
|
9
9
|
*
|
|
10
|
-
* Should the matching
|
|
11
|
-
* gracefully deal with issues and respond with a
|
|
10
|
+
* Should the matching route throw an error, the router will use the catch handler if one is defined to
|
|
11
|
+
* gracefully deal with issues and respond with a response.
|
|
12
12
|
*
|
|
13
|
-
* If a
|
|
13
|
+
* If a request matches multiple routes, the earliest registered route will be used to respond to the it.
|
|
14
14
|
* @deprecated
|
|
15
15
|
*/
|
|
16
16
|
export declare class Router {
|
|
@@ -24,13 +24,13 @@ export declare class Router {
|
|
|
24
24
|
*/
|
|
25
25
|
constructor();
|
|
26
26
|
/**
|
|
27
|
-
* @returns routes A `Map` of HTTP method name (`'GET'`, etc.) to an array of all
|
|
28
|
-
* instances that are registered.
|
|
27
|
+
* @returns routes A `Map` of HTTP method name (`'GET'`, etc.) to an array of all
|
|
28
|
+
* the corresponding {@linkcode Route} instances that are registered.
|
|
29
29
|
*/
|
|
30
30
|
get routes(): Map<HTTPMethod, Route[]>;
|
|
31
31
|
/**
|
|
32
|
-
* Adds a `fetch` event listener to respond to events when a
|
|
33
|
-
* the event's request. Effectively no-op if `
|
|
32
|
+
* Adds a `fetch` event listener to respond to events when a route matches
|
|
33
|
+
* the event's request. Effectively no-op if `addFetchListener` has been
|
|
34
34
|
* called, but `removeFetchListener` has not.
|
|
35
35
|
*/
|
|
36
36
|
addFetchListener(): void;
|
|
@@ -71,8 +71,8 @@ export declare class Router {
|
|
|
71
71
|
*/
|
|
72
72
|
removeCacheListener(): void;
|
|
73
73
|
/**
|
|
74
|
-
* Apply the routing rules to a `
|
|
75
|
-
* appropriate
|
|
74
|
+
* Apply the routing rules to a `fetch` event to get a response from an
|
|
75
|
+
* appropriate route.
|
|
76
76
|
*
|
|
77
77
|
* @param options
|
|
78
78
|
* @returns A promise is returned if a registered route can handle the request.
|
|
@@ -103,7 +103,7 @@ export declare class Router {
|
|
|
103
103
|
params?: RouteHandlerCallbackOptions["params"];
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
106
|
-
* Define a default
|
|
106
|
+
* Define a default handler that's called when no routes explicitly
|
|
107
107
|
* match the incoming request.
|
|
108
108
|
*
|
|
109
109
|
* Each HTTP method (`'GET'`, `'POST'`, etc.) gets its own default handler.
|
|
@@ -111,7 +111,7 @@ export declare class Router {
|
|
|
111
111
|
* Without a default handler, unmatched requests will go against the
|
|
112
112
|
* network as if there were no service worker present.
|
|
113
113
|
*
|
|
114
|
-
* @param handler A callback function that returns a
|
|
114
|
+
* @param handler A callback function that returns a promise resulting in a response.
|
|
115
115
|
* @param method The HTTP method to associate with this default handler. Each method
|
|
116
116
|
* has its own default. Defaults to `'GET'`.
|
|
117
117
|
*/
|
|
@@ -126,25 +126,25 @@ export declare class Router {
|
|
|
126
126
|
setCatchHandler(handler: RouteHandler): void;
|
|
127
127
|
/**
|
|
128
128
|
* Registers a `RegExp`, string, or function with a caching
|
|
129
|
-
* strategy to the
|
|
129
|
+
* strategy to the router.
|
|
130
130
|
*
|
|
131
|
-
* @param capture If the capture param is a
|
|
132
|
-
* @param handler A callback function that returns a
|
|
133
|
-
* This parameter is required if `capture` is not a
|
|
134
|
-
* @param method The HTTP method to match the
|
|
135
|
-
* @returns The generated
|
|
131
|
+
* @param capture If the capture param is a {@linkcode Route} object, all other arguments will be ignored.
|
|
132
|
+
* @param handler A callback function that returns a promise resulting in a response.
|
|
133
|
+
* This parameter is required if `capture` is not a {@linkcode Route} object.
|
|
134
|
+
* @param method The HTTP method to match the route against. Defaults to `'GET'`.
|
|
135
|
+
* @returns The generated {@linkcode Route} object.
|
|
136
136
|
*/
|
|
137
137
|
registerCapture(capture: RegExp | string | RouteMatchCallback | Route, handler?: RouteHandler, method?: HTTPMethod): Route;
|
|
138
138
|
/**
|
|
139
|
-
* Registers a
|
|
139
|
+
* Registers a route with the router.
|
|
140
140
|
*
|
|
141
|
-
* @param route The
|
|
141
|
+
* @param route The route to register.
|
|
142
142
|
*/
|
|
143
143
|
registerRoute(route: Route): void;
|
|
144
144
|
/**
|
|
145
|
-
* Unregisters a
|
|
145
|
+
* Unregisters a route from the router.
|
|
146
146
|
*
|
|
147
|
-
* @param route The
|
|
147
|
+
* @param route The route to unregister.
|
|
148
148
|
*/
|
|
149
149
|
unregisterRoute(route: Route): void;
|
|
150
150
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { PrecacheRouteOptions } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Add a `fetch` listener
|
|
4
|
-
* respond to
|
|
5
|
-
*
|
|
6
|
-
* with precached assets.
|
|
3
|
+
* Add a `fetch` listener that will
|
|
4
|
+
* respond to [network requests](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests)
|
|
5
|
+
* with precached assets to the service worker.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* responded to, allowing the event to fall through to other `fetch` event
|
|
10
|
-
* listeners.
|
|
7
|
+
* As for requests for assets that aren't precached, the `fetch` event will not be
|
|
8
|
+
* responded to, allowing the event to fall through to other `fetch` event listeners.
|
|
11
9
|
*
|
|
12
|
-
* @param options See
|
|
10
|
+
* @param options See {@linkcode PrecacheRouteOptions}.
|
|
13
11
|
* @deprecated
|
|
14
12
|
*/
|
|
15
13
|
export declare const addRoute: (options?: PrecacheRouteOptions) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addRoute.d.ts","sourceRoot":"","sources":["../../src/legacy/addRoute.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAKxD
|
|
1
|
+
{"version":3,"file":"addRoute.d.ts","sourceRoot":"","sources":["../../src/legacy/addRoute.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAKxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,aAAc,oBAAoB,KAAG,IAGzD,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { RouteHandlerCallback } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Helper function that calls
|
|
4
|
-
* on the default
|
|
3
|
+
* Helper function that calls {@linkcode PrecacheController.createHandlerBoundToURL}
|
|
4
|
+
* on the default {@linkcode PrecacheController} instance.
|
|
5
5
|
*
|
|
6
|
-
* If you are creating your own
|
|
7
|
-
*
|
|
6
|
+
* If you are creating your own {@linkcode PrecacheController}, then call the
|
|
7
|
+
* {@linkcode PrecacheController.createHandlerBoundToURL} function on that instance
|
|
8
8
|
* instead of using this function.
|
|
9
9
|
*
|
|
10
|
-
* @param url The precached URL which will be used to
|
|
11
|
-
* `Response`.
|
|
10
|
+
* @param url The precached URL which will be used to look up the response.
|
|
12
11
|
* @param fallbackToNetwork Whether to attempt to get the
|
|
13
12
|
* response from the network if there's a precache miss.
|
|
14
13
|
* @return
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHandlerBoundToURL.d.ts","sourceRoot":"","sources":["../../src/legacy/createHandlerBoundToURL.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"createHandlerBoundToURL.d.ts","sourceRoot":"","sources":["../../src/legacy/createHandlerBoundToURL.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIxD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,QAAS,MAAM,KAAG,oBAGrD,CAAC"}
|
|
@@ -21,12 +21,12 @@ export interface FallbacksOptions {
|
|
|
21
21
|
}
|
|
22
22
|
export interface FallbacksOptions {
|
|
23
23
|
/**
|
|
24
|
-
* An optional
|
|
25
|
-
*
|
|
24
|
+
* An optional {@linkcode PrecacheController} instance. If not provided, the singleton
|
|
25
|
+
* {@linkcode PrecacheController} will be used.
|
|
26
26
|
*/
|
|
27
27
|
precacheController?: PrecacheController;
|
|
28
28
|
/**
|
|
29
|
-
* An optional
|
|
29
|
+
* An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
|
|
30
30
|
* will be used.
|
|
31
31
|
*/
|
|
32
32
|
router?: Router;
|
|
@@ -6,12 +6,12 @@ import type { Router } from "./Router.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export interface HandlePrecachingOptions {
|
|
8
8
|
/**
|
|
9
|
-
* An optional
|
|
10
|
-
*
|
|
9
|
+
* An optional {@linkcode PrecacheController} instance. If not provided, the singleton
|
|
10
|
+
* {@linkcode PrecacheController} will be used.
|
|
11
11
|
*/
|
|
12
12
|
precacheController?: PrecacheController;
|
|
13
13
|
/**
|
|
14
|
-
* An optional
|
|
14
|
+
* An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
|
|
15
15
|
* will be used.
|
|
16
16
|
*/
|
|
17
17
|
router?: Router;
|
|
@@ -4,7 +4,7 @@ import { Router } from "./Router.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface GoogleAnalyticsInitializeOptions {
|
|
6
6
|
/**
|
|
7
|
-
* An optional
|
|
7
|
+
* An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
|
|
8
8
|
* will be used.
|
|
9
9
|
*/
|
|
10
10
|
router?: Router;
|
|
@@ -5,18 +5,18 @@ import type { FallbacksOptions } from "./fallbacks.js";
|
|
|
5
5
|
import { type HandlePrecachingOptions } from "./handlePrecaching.js";
|
|
6
6
|
import type { GoogleAnalyticsInitializeOptions } from "./initializeGoogleAnalytics.js";
|
|
7
7
|
/**
|
|
8
|
-
* Options for
|
|
8
|
+
* Options for {@linkcode installSerwist}.
|
|
9
9
|
*
|
|
10
10
|
* @deprecated
|
|
11
11
|
*/
|
|
12
12
|
export interface InstallSerwistOptions extends Omit<HandlePrecachingOptions, "precacheController" | "router"> {
|
|
13
13
|
/**
|
|
14
|
-
* An optional
|
|
15
|
-
*
|
|
14
|
+
* An optional {@linkcode PrecacheController} instance. If not provided, the singleton
|
|
15
|
+
* {@linkcode PrecacheController} will be used.
|
|
16
16
|
*/
|
|
17
17
|
precacheController?: PrecacheController;
|
|
18
18
|
/**
|
|
19
|
-
* An optional
|
|
19
|
+
* An optional {@linkcode Router} instance. If not provided, the singleton {@linkcode Router}
|
|
20
20
|
* will be used.
|
|
21
21
|
*/
|
|
22
22
|
router?: Router;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Helper function that calls
|
|
3
|
-
* on the default
|
|
2
|
+
* Helper function that calls {@linkcode PrecacheController.matchPrecache}
|
|
3
|
+
* on the default {@linkcode PrecacheController} instance.
|
|
4
4
|
*
|
|
5
|
-
* If you are creating your own
|
|
6
|
-
*
|
|
5
|
+
* If you are creating your own {@linkcode PrecacheController}, then call
|
|
6
|
+
* the {@linkcode PrecacheController.matchPrecache} function on that instance
|
|
7
7
|
* instead of using this function.
|
|
8
8
|
*
|
|
9
9
|
* @param request The key (without revisioning parameters)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchPrecache.d.ts","sourceRoot":"","sources":["../../src/legacy/matchPrecache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"matchPrecache.d.ts","sourceRoot":"","sources":["../../src/legacy/matchPrecache.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,YAAa,MAAM,GAAG,OAAO,KAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAErF,CAAC"}
|
|
@@ -8,10 +8,10 @@ import type { PrecacheEntry } from "../types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* Please note: This method **will not** serve any of the cached files for you.
|
|
10
10
|
* It only precaches files. To respond to a network request you call
|
|
11
|
-
*
|
|
11
|
+
* {@linkcode addRoute}.
|
|
12
12
|
*
|
|
13
13
|
* If you have a single array of files to precache, you can just call
|
|
14
|
-
*
|
|
14
|
+
* {@linkcode precacheAndRoute}.
|
|
15
15
|
*
|
|
16
16
|
* @param entries Array of entries to precache.
|
|
17
17
|
* @deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precache.d.ts","sourceRoot":"","sources":["../../src/legacy/precache.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"precache.d.ts","sourceRoot":"","sources":["../../src/legacy/precache.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,YAAa,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,KAAG,IAE9D,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { PrecacheEntry, PrecacheRouteOptions } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* This method will add entries to the precache list and add a route to
|
|
4
|
-
* respond to fetch events.
|
|
4
|
+
* respond to `fetch` events.
|
|
5
5
|
*
|
|
6
6
|
* This is a convenience method that will call
|
|
7
|
-
*
|
|
8
|
-
* `serwist/legacy.addRoute` in a single call.
|
|
7
|
+
* {@linkcode precache} and {@linkcode addRoute} in a single call.
|
|
9
8
|
*
|
|
10
9
|
* @param entries Array of entries to precache.
|
|
11
|
-
* @param options See the
|
|
10
|
+
* @param options See the {@linkcode PrecacheRouteOptions} options.
|
|
12
11
|
* @deprecated
|
|
13
12
|
*/
|
|
14
13
|
export declare const precacheAndRoute: (entries: (PrecacheEntry | string)[], options?: PrecacheRouteOptions) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precacheAndRoute.d.ts","sourceRoot":"","sources":["../../src/legacy/precacheAndRoute.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIvE
|
|
1
|
+
{"version":3,"file":"precacheAndRoute.d.ts","sourceRoot":"","sources":["../../src/legacy/precacheAndRoute.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,YAAa,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,YAAY,oBAAoB,KAAG,IAGtG,CAAC"}
|
|
@@ -3,13 +3,13 @@ import type { HTTPMethod } from "../constants.js";
|
|
|
3
3
|
import type { RouteHandler, RouteMatchCallback } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Registers a `RegExp`, string, or function with a caching
|
|
6
|
-
* strategy to a singleton
|
|
6
|
+
* strategy to a singleton {@linkcode Router} instance.
|
|
7
7
|
*
|
|
8
|
-
* @param capture If the capture param is a
|
|
9
|
-
* @param handler A callback function that returns a
|
|
10
|
-
* This parameter is required if `capture` is not a
|
|
11
|
-
* @param method The HTTP method to match the
|
|
12
|
-
* @returns The generated
|
|
8
|
+
* @param capture If the capture param is a {@linkcode Route}, all other arguments will be ignored.
|
|
9
|
+
* @param handler A callback function that returns a promise resulting in a response.
|
|
10
|
+
* This parameter is required if `capture` is not a {@linkcode Route} object.
|
|
11
|
+
* @param method The HTTP method to match the route against. Defaults to `'GET'`.
|
|
12
|
+
* @returns The generated {@linkcode Route} object, which can then be provided to {@linkcode unregisterRoute} if needed.
|
|
13
13
|
* @deprecated
|
|
14
14
|
*/
|
|
15
15
|
export declare const registerRoute: (capture: RegExp | string | RouteMatchCallback | Route, handler?: RouteHandler, method?: HTTPMethod) => Route;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerRoute.d.ts","sourceRoot":"","sources":["../../src/legacy/registerRoute.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"registerRoute.d.ts","sourceRoot":"","sources":["../../src/legacy/registerRoute.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIpE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,YAAa,MAAM,GAAG,MAAM,GAAG,kBAAkB,GAAG,KAAK,YAAY,YAAY,WAAW,UAAU,KAAG,KAElI,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RuntimeCaching } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Registers caching strategies to a singleton Router instance. It is a simple
|
|
4
|
-
* syntatic sugar for
|
|
4
|
+
* syntatic sugar for {@linkcode registerRoute}.
|
|
5
5
|
*
|
|
6
6
|
* @param runtimeCachingList
|
|
7
7
|
* @returns
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { RouteHandler } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
* If a
|
|
3
|
+
* If a route throws an error while handling a request, this handler
|
|
4
4
|
* will be called and given a chance to provide a response.
|
|
5
5
|
*
|
|
6
|
-
* @param handler A callback function that returns a
|
|
6
|
+
* @param handler A callback function that returns a promise resulting in a response.
|
|
7
7
|
* @deprecated
|
|
8
8
|
*/
|
|
9
9
|
export declare const setCatchHandler: (handler: RouteHandler) => void;
|