serwist 9.0.0-preview.26 → 9.0.2
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/README.md +1 -1
- package/dist/lib/backgroundSync/StorableRequest.d.ts +4 -4
- package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts +0 -4
- package/dist/lib/precaching/PrecacheFallbackPlugin.d.ts.map +1 -1
- package/dist/lib/strategies/StrategyHandler.d.ts +3 -3
- package/package.json +4 -4
- package/src/lib/backgroundSync/StorableRequest.ts +4 -4
- package/src/lib/precaching/PrecacheFallbackPlugin.ts +0 -4
- package/src/lib/strategies/Strategy.ts +4 -4
- package/src/lib/strategies/StrategyHandler.ts +3 -3
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This module's documentation can be found at https://serwist.pages.dev/docs/serwist
|
|
1
|
+
This module's documentation can be found at https://serwist.pages.dev/docs/serwist.
|
|
@@ -15,7 +15,7 @@ export declare class StorableRequest {
|
|
|
15
15
|
private readonly _requestData;
|
|
16
16
|
/**
|
|
17
17
|
* Converts a Request object to a plain object that can be structured
|
|
18
|
-
* cloned or JSON
|
|
18
|
+
* cloned or stringified to JSON.
|
|
19
19
|
*
|
|
20
20
|
* @param request
|
|
21
21
|
* @returns
|
|
@@ -25,12 +25,12 @@ export declare class StorableRequest {
|
|
|
25
25
|
* Accepts an object of request data that can be used to construct a
|
|
26
26
|
* `Request` but can also be stored in IndexedDB.
|
|
27
27
|
*
|
|
28
|
-
* @param requestData An object of request data that includes the `url` plus any relevant
|
|
29
|
-
* [requestInit](https://fetch.spec.whatwg.org/#requestinit).
|
|
28
|
+
* @param requestData An object of request data that includes the `url` plus any relevant property of
|
|
29
|
+
* [`requestInit`](https://fetch.spec.whatwg.org/#requestinit).
|
|
30
30
|
*/
|
|
31
31
|
constructor(requestData: RequestData);
|
|
32
32
|
/**
|
|
33
|
-
* Returns a deep clone of the
|
|
33
|
+
* Returns a deep clone of the instance's `requestData` object.
|
|
34
34
|
*
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
@@ -29,10 +29,6 @@ export interface PrecacheFallbackPluginOptions {
|
|
|
29
29
|
* It does this by intercepting the `handlerDidError` plugin callback
|
|
30
30
|
* and returning a precached response, taking the expected revision parameter
|
|
31
31
|
* into account automatically.
|
|
32
|
-
*
|
|
33
|
-
* Unless you explicitly pass in a `PrecacheController` instance to the
|
|
34
|
-
* constructor, the default instance will be used. Generally speaking, most
|
|
35
|
-
* developers will end up using the default.
|
|
36
32
|
*/
|
|
37
33
|
export declare class PrecacheFallbackPlugin implements SerwistPlugin {
|
|
38
34
|
private readonly _fallbackUrls;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrecacheFallbackPlugin.d.ts","sourceRoot":"","sources":["../../../src/lib/precaching/PrecacheFallbackPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAElF,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,OAAO,CAAC;IAC1D;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,YAAY,EAAE,CAAC,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAC;IACjD;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED
|
|
1
|
+
{"version":3,"file":"PrecacheFallbackPlugin.d.ts","sourceRoot":"","sources":["../../../src/lib/precaching/PrecacheFallbackPlugin.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAElF,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,OAAO,CAAC;IAC1D;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,YAAY,EAAE,CAAC,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAC;IACjD;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAuB,YAAW,aAAa;IAC1D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqC;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC;;;;OAIG;gBACS,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,6BAA6B;IAKpE;;;;OAIG;IACG,eAAe,CAAC,KAAK,EAAE,4BAA4B;CAgB1D"}
|
|
@@ -80,8 +80,8 @@ export declare class StrategyHandler {
|
|
|
80
80
|
* provided to the `Strategy` object.
|
|
81
81
|
*
|
|
82
82
|
* The following lifecycle methods are invoked when using this method:
|
|
83
|
-
* - `
|
|
84
|
-
* - `
|
|
83
|
+
* - `cacheKeyWillBeUsed`
|
|
84
|
+
* - `cachedResponseWillBeUsed`
|
|
85
85
|
*
|
|
86
86
|
* @param key The `Request` or `URL` object to use as the cache key.
|
|
87
87
|
* @returns A matching response, if found.
|
|
@@ -93,7 +93,7 @@ export declare class StrategyHandler {
|
|
|
93
93
|
* the `Strategy` object.
|
|
94
94
|
*
|
|
95
95
|
* The following plugin lifecycle methods are invoked when using this method:
|
|
96
|
-
* - `
|
|
96
|
+
* - `cacheKeyWillBeUsed`
|
|
97
97
|
* - `cacheWillUpdate`
|
|
98
98
|
* - `cacheDidUpdate`
|
|
99
99
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serwist",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Swiss Army knife for service workers.",
|
|
6
6
|
"files": [
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"rollup": "4.14.3",
|
|
53
53
|
"typescript": "5.5.0-dev.20240415",
|
|
54
|
-
"@serwist/configs": "9.0.
|
|
55
|
-
"@serwist/utils": "9.0.
|
|
54
|
+
"@serwist/configs": "9.0.2",
|
|
55
|
+
"@serwist/utils": "9.0.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"typescript": ">=5.0.0"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
|
-
"build": "rimraf dist &&
|
|
66
|
+
"build": "rimraf dist && NODE_ENV=production rollup --config rollup.config.js",
|
|
67
67
|
"dev": "rollup --config rollup.config.js --watch",
|
|
68
68
|
"lint": "biome lint ./src",
|
|
69
69
|
"typecheck": "tsc"
|
|
@@ -41,7 +41,7 @@ export class StorableRequest {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Converts a Request object to a plain object that can be structured
|
|
44
|
-
* cloned or JSON
|
|
44
|
+
* cloned or stringified to JSON.
|
|
45
45
|
*
|
|
46
46
|
* @param request
|
|
47
47
|
* @returns
|
|
@@ -79,8 +79,8 @@ export class StorableRequest {
|
|
|
79
79
|
* Accepts an object of request data that can be used to construct a
|
|
80
80
|
* `Request` but can also be stored in IndexedDB.
|
|
81
81
|
*
|
|
82
|
-
* @param requestData An object of request data that includes the `url` plus any relevant
|
|
83
|
-
* [requestInit](https://fetch.spec.whatwg.org/#requestinit).
|
|
82
|
+
* @param requestData An object of request data that includes the `url` plus any relevant property of
|
|
83
|
+
* [`requestInit`](https://fetch.spec.whatwg.org/#requestinit).
|
|
84
84
|
*/
|
|
85
85
|
constructor(requestData: RequestData) {
|
|
86
86
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -108,7 +108,7 @@ export class StorableRequest {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
* Returns a deep clone of the
|
|
111
|
+
* Returns a deep clone of the instance's `requestData` object.
|
|
112
112
|
*
|
|
113
113
|
* @returns
|
|
114
114
|
*/
|
|
@@ -40,10 +40,6 @@ export interface PrecacheFallbackPluginOptions {
|
|
|
40
40
|
* It does this by intercepting the `handlerDidError` plugin callback
|
|
41
41
|
* and returning a precached response, taking the expected revision parameter
|
|
42
42
|
* into account automatically.
|
|
43
|
-
*
|
|
44
|
-
* Unless you explicitly pass in a `PrecacheController` instance to the
|
|
45
|
-
* constructor, the default instance will be used. Generally speaking, most
|
|
46
|
-
* developers will end up using the default.
|
|
47
43
|
*/
|
|
48
44
|
export class PrecacheFallbackPlugin implements SerwistPlugin {
|
|
49
45
|
private readonly _fallbackUrls: (string | PrecacheFallbackEntry)[];
|
|
@@ -36,8 +36,8 @@ export interface StrategyOptions {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
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,
|
|
39
|
+
*
|
|
40
|
+
* Custom strategies should extend this class and leverage `StrategyHandler`, which will ensure all relevant cache options,
|
|
41
41
|
* fetch options, and plugins are used (per the current strategy instance), to perform all fetching and caching logic.
|
|
42
42
|
*/
|
|
43
43
|
export abstract class Strategy implements RouteHandlerObject {
|
|
@@ -87,8 +87,8 @@ export abstract class Strategy implements RouteHandlerObject {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
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,
|
|
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
92
|
* where `response` is equivalent to what `handle()` returns, and `done` is a
|
|
93
93
|
* `Promise` that will resolve once all promises added to `event.waitUntil()` as a part
|
|
94
94
|
* of performing the strategy have completed.
|
|
@@ -222,8 +222,8 @@ export class StrategyHandler {
|
|
|
222
222
|
* provided to the `Strategy` object.
|
|
223
223
|
*
|
|
224
224
|
* The following lifecycle methods are invoked when using this method:
|
|
225
|
-
* - `
|
|
226
|
-
* - `
|
|
225
|
+
* - `cacheKeyWillBeUsed`
|
|
226
|
+
* - `cachedResponseWillBeUsed`
|
|
227
227
|
*
|
|
228
228
|
* @param key The `Request` or `URL` object to use as the cache key.
|
|
229
229
|
* @returns A matching response, if found.
|
|
@@ -265,7 +265,7 @@ export class StrategyHandler {
|
|
|
265
265
|
* the `Strategy` object.
|
|
266
266
|
*
|
|
267
267
|
* The following plugin lifecycle methods are invoked when using this method:
|
|
268
|
-
* - `
|
|
268
|
+
* - `cacheKeyWillBeUsed`
|
|
269
269
|
* - `cacheWillUpdate`
|
|
270
270
|
* - `cacheDidUpdate`
|
|
271
271
|
*
|