@serwist/strategies 9.0.0-preview.4 → 9.0.0-preview.5

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.
@@ -1,7 +1,7 @@
1
1
  import type { StrategyOptions } from "./Strategy.js";
2
2
  import { Strategy } from "./Strategy.js";
3
3
  import type { StrategyHandler } from "./StrategyHandler.js";
4
- declare class StaleWhileRevalidate extends Strategy {
4
+ export declare class StaleWhileRevalidate extends Strategy {
5
5
  /**
6
6
  * An implementation of the
7
7
  * [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate)
@@ -31,5 +31,4 @@ declare class StaleWhileRevalidate extends Strategy {
31
31
  */
32
32
  _handle(request: Request, handler: StrategyHandler): Promise<Response>;
33
33
  }
34
- export { StaleWhileRevalidate };
35
34
  //# sourceMappingURL=StaleWhileRevalidate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StaleWhileRevalidate.d.ts","sourceRoot":"","sources":["../src/StaleWhileRevalidate.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,cAAM,oBAAqB,SAAQ,QAAQ;IACzC;;;;;;;;;;;;;;;;;;;OAmBG;gBACS,OAAO,GAAE,eAAoB;IAUzC;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;CAsD7E;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"StaleWhileRevalidate.d.ts","sourceRoot":"","sources":["../src/StaleWhileRevalidate.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,qBAAa,oBAAqB,SAAQ,QAAQ;IAChD;;;;;;;;;;;;;;;;;;;OAmBG;gBACS,OAAO,GAAE,eAAoB;IAUzC;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;CAsD7E"}
@@ -27,7 +27,7 @@ export interface StrategyOptions {
27
27
  * fetching and cache logic, which will ensure all relevant cache, cache options,
28
28
  * fetch options and plugins are used (per the current strategy instance).
29
29
  */
30
- declare abstract class Strategy implements RouteHandlerObject {
30
+ export declare abstract class Strategy implements RouteHandlerObject {
31
31
  cacheName: string;
32
32
  plugins: SerwistPlugin[];
33
33
  fetchOptions?: RequestInit;
@@ -80,5 +80,4 @@ declare abstract class Strategy implements RouteHandlerObject {
80
80
  _getResponse(handler: StrategyHandler, request: Request, event: ExtendableEvent): Promise<Response>;
81
81
  _awaitComplete(responseDone: Promise<Response>, handler: StrategyHandler, request: Request, event: ExtendableEvent): Promise<void>;
82
82
  }
83
- export { Strategy };
84
83
  //# sourceMappingURL=Strategy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Strategy.d.ts","sourceRoot":"","sources":["../src/Strategy.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG/F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,iBAAiB,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": "A service worker helper library implementing common caching strategies.",
6
6
  "files": [
@@ -30,12 +30,12 @@
30
30
  "./package.json": "./package.json"
31
31
  },
32
32
  "dependencies": {
33
- "@serwist/core": "9.0.0-preview.4"
33
+ "@serwist/core": "9.0.0-preview.5"
34
34
  },
35
35
  "devDependencies": {
36
36
  "rollup": "4.9.6",
37
37
  "typescript": "5.4.0-dev.20240206",
38
- "@serwist/constants": "9.0.0-preview.4"
38
+ "@serwist/constants": "9.0.0-preview.5"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "typescript": ">=5.0.0"
@@ -30,7 +30,7 @@ export class NetworkOnly extends Strategy {
30
30
  * This class is useful if you want to take advantage of any Serwist plugin.
31
31
  *
32
32
  * If the network request fails, this will throw a `SerwistError` exception.
33
- *
33
+ *
34
34
  * @param options
35
35
  */
36
36
  constructor(options: NetworkOnlyOptions = {}) {
@@ -14,7 +14,7 @@ import type { StrategyHandler } from "./StrategyHandler.js";
14
14
  import { cacheOkAndOpaquePlugin } from "./plugins/cacheOkAndOpaquePlugin.js";
15
15
  import { messages } from "./utils/messages.js";
16
16
 
17
- class StaleWhileRevalidate extends Strategy {
17
+ export class StaleWhileRevalidate extends Strategy {
18
18
  /**
19
19
  * An implementation of the
20
20
  * [stale-while-revalidate](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#stale-while-revalidate)
@@ -106,5 +106,3 @@ class StaleWhileRevalidate extends Strategy {
106
106
  return response;
107
107
  }
108
108
  }
109
-
110
- export { StaleWhileRevalidate };
package/src/Strategy.ts CHANGED
@@ -39,7 +39,7 @@ export interface StrategyOptions {
39
39
  * fetching and cache logic, which will ensure all relevant cache, cache options,
40
40
  * fetch options and plugins are used (per the current strategy instance).
41
41
  */
42
- abstract class Strategy implements RouteHandlerObject {
42
+ export abstract class Strategy implements RouteHandlerObject {
43
43
  cacheName: string;
44
44
  plugins: SerwistPlugin[];
45
45
  fetchOptions?: RequestInit;
@@ -201,5 +201,3 @@ abstract class Strategy implements RouteHandlerObject {
201
201
  }
202
202
  }
203
203
  }
204
-
205
- export { Strategy };