@serwist/strategies
Advanced tools
Comparing version 9.0.0-preview.8 to 9.0.0-preview.9
@@ -144,6 +144,2 @@ import { assert, Deferred, logger, getFriendlyURL, SerwistError, timeout, cacheMatchIgnoreParams, executeQuotaErrorCallbacks, privateCacheNames } from '@serwist/core/internal'; | ||
} | ||
const vary = response.headers.get("Vary"); | ||
if (vary) { | ||
logger.debug(`The response for ${getFriendlyURL(effectiveRequest.url)} has a 'Vary: ${vary}' header. Consider setting the {ignoreVary: true} option on your strategy to ensure cache matching and deletion works as expected.`); | ||
} | ||
} | ||
@@ -167,2 +163,8 @@ if (!response) { | ||
const cache = await self.caches.open(cacheName); | ||
if (process.env.NODE_ENV !== "production") { | ||
const vary = response.headers.get("Vary"); | ||
if (vary && matchOptions?.ignoreVary !== true) { | ||
logger.debug(`The response for ${getFriendlyURL(effectiveRequest.url)} has a 'Vary: ${vary}' header. Consider setting the {ignoreVary: true} option on your strategy to ensure cache matching and deletion works as expected.`); | ||
} | ||
} | ||
const hasCacheUpdateCallback = this.hasCallback("cacheDidUpdate"); | ||
@@ -173,3 +175,3 @@ const oldResponse = hasCacheUpdateCallback ? await cacheMatchIgnoreParams(cache, effectiveRequest.clone(), [ | ||
if (process.env.NODE_ENV !== "production") { | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response ` + `for ${getFriendlyURL(effectiveRequest.url)}.`); | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ${getFriendlyURL(effectiveRequest.url)}.`); | ||
} | ||
@@ -176,0 +178,0 @@ try { |
@@ -9,3 +9,3 @@ import type { HandlerCallbackOptions, SerwistPlugin, SerwistPluginCallbackParam } from "@serwist/core"; | ||
*/ | ||
declare class StrategyHandler { | ||
export declare class StrategyHandler { | ||
/** | ||
@@ -188,3 +188,2 @@ * The request the strategy is performing (passed to the strategy's | ||
} | ||
export { StrategyHandler }; | ||
//# sourceMappingURL=StrategyHandler.d.ts.map |
{ | ||
"name": "@serwist/strategies", | ||
"version": "9.0.0-preview.8", | ||
"version": "9.0.0-preview.9", | ||
"type": "module", | ||
@@ -33,3 +33,3 @@ "description": "A service worker helper library implementing common caching strategies.", | ||
"dependencies": { | ||
"@serwist/core": "9.0.0-preview.8" | ||
"@serwist/core": "9.0.0-preview.9" | ||
}, | ||
@@ -39,3 +39,3 @@ "devDependencies": { | ||
"typescript": "5.4.0-dev.20240206", | ||
"@serwist/constants": "9.0.0-preview.8" | ||
"@serwist/constants": "9.0.0-preview.9" | ||
}, | ||
@@ -42,0 +42,0 @@ "peerDependencies": { |
@@ -33,3 +33,3 @@ /* | ||
*/ | ||
class StrategyHandler { | ||
export class StrategyHandler { | ||
/** | ||
@@ -285,12 +285,2 @@ * The request the strategy is performing (passed to the strategy's | ||
} | ||
// See https://github.com/GoogleChrome/workbox/issues/2818 | ||
const vary = response.headers.get("Vary"); | ||
if (vary) { | ||
logger.debug( | ||
`The response for ${getFriendlyURL( | ||
effectiveRequest.url, | ||
)} has a 'Vary: ${vary}' header. Consider setting the {ignoreVary: true} option on your strategy to ensure cache matching and deletion works as expected.`, | ||
); | ||
} | ||
} | ||
@@ -320,2 +310,14 @@ | ||
if (process.env.NODE_ENV !== "production") { | ||
// See https://github.com/GoogleChrome/workbox/issues/2818 | ||
const vary = response.headers.get("Vary"); | ||
if (vary && matchOptions?.ignoreVary !== true) { | ||
logger.debug( | ||
`The response for ${getFriendlyURL( | ||
effectiveRequest.url, | ||
)} has a 'Vary: ${vary}' header. Consider setting the {ignoreVary: true} option on your strategy to ensure cache matching and deletion works as expected.`, | ||
); | ||
} | ||
} | ||
const hasCacheUpdateCallback = this.hasCallback("cacheDidUpdate"); | ||
@@ -335,3 +337,3 @@ const oldResponse = hasCacheUpdateCallback | ||
if (process.env.NODE_ENV !== "production") { | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response ` + `for ${getFriendlyURL(effectiveRequest.url)}.`); | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ${getFriendlyURL(effectiveRequest.url)}.`); | ||
} | ||
@@ -386,4 +388,3 @@ | ||
event: this.event, | ||
// params has a type any can't change right now. | ||
params: this.params, // eslint-disable-line | ||
params: this.params, | ||
}), | ||
@@ -549,3 +550,1 @@ ); | ||
} | ||
export { StrategyHandler }; |
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
103009
2414
32
+ Added@serwist/core@9.0.0-preview.9(transitive)
- Removed@serwist/core@9.0.0-preview.8(transitive)