Urara-Blog/node_modules/.pnpm-store/v3/files/04/abadae57f4e80fb93a7dcc5cd10a50858bb11684249f8fdb875fb6a2e0ff42032fa4412edc8e7445fbfd37b06942b63d017ce49797aaf006350b3b2798ff9b
2022-08-14 01:14:53 +08:00

30 lines
1 KiB
Text

/*
Copyright 2020 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
import '../_version.js';
/**
* A plugin, designed to be used with PrecacheController, to translate URLs into
* the corresponding cache key, based on the current revision info.
*
* @private
*/
class PrecacheCacheKeyPlugin {
constructor({ precacheController }) {
this.cacheKeyWillBeUsed = async ({ request, params, }) => {
// Params is type any, can't change right now.
/* eslint-disable */
const cacheKey = (params === null || params === void 0 ? void 0 : params.cacheKey) ||
this._precacheController.getCacheKeyForURL(request.url);
/* eslint-enable */
return cacheKey
? new Request(cacheKey, { headers: request.headers })
: request;
};
this._precacheController = precacheController;
}
}
export { PrecacheCacheKeyPlugin };