mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-02 13:49:31 +08:00
85 lines
2.4 KiB
Text
85 lines
2.4 KiB
Text
/*
|
|
Copyright 2018 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';
|
|
|
|
export interface InstallResult {
|
|
updatedURLs: string[];
|
|
notUpdatedURLs: string[];
|
|
}
|
|
|
|
export interface CleanupResult {
|
|
deletedCacheRequests: string[];
|
|
}
|
|
|
|
export declare interface PrecacheEntry {
|
|
integrity?: string;
|
|
url: string;
|
|
revision?: string | null;
|
|
}
|
|
|
|
export interface PrecacheRouteOptions {
|
|
directoryIndex?: string;
|
|
ignoreURLParametersMatching?: RegExp[];
|
|
cleanURLs?: boolean;
|
|
urlManipulation?: urlManipulation;
|
|
}
|
|
|
|
export type urlManipulation = ({url}: {url: URL}) => URL[];
|
|
|
|
// * * * IMPORTANT! * * *
|
|
// ------------------------------------------------------------------------- //
|
|
// jdsoc type definitions cannot be declared above TypeScript definitions or
|
|
// they'll be stripped from the built `.js` files, and they'll only be in the
|
|
// `d.ts` files, which aren't read by the jsdoc generator. As a result we
|
|
// have to put declare them below.
|
|
|
|
/**
|
|
* @typedef {Object} InstallResult
|
|
* @property {Array<string>} updatedURLs List of URLs that were updated during
|
|
* installation.
|
|
* @property {Array<string>} notUpdatedURLs List of URLs that were already up to
|
|
* date.
|
|
*
|
|
* @memberof workbox-precaching
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Object} CleanupResult
|
|
* @property {Array<string>} deletedCacheRequests List of URLs that were deleted
|
|
* while cleaning up the cache.
|
|
*
|
|
* @memberof workbox-precaching
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Object} PrecacheEntry
|
|
* @property {string} url URL to precache.
|
|
* @property {string} [revision] Revision information for the URL.
|
|
* @property {string} [integrity] Integrity metadata that will be used when
|
|
* making the network request for the URL.
|
|
*
|
|
* @memberof workbox-precaching
|
|
*/
|
|
|
|
/**
|
|
* The "urlManipulation" callback can be used to determine if there are any
|
|
* additional permutations of a URL that should be used to check against
|
|
* the available precached files.
|
|
*
|
|
* For example, Workbox supports checking for '/index.html' when the URL
|
|
* '/' is provided. This callback allows additional, custom checks.
|
|
*
|
|
* @callback ~urlManipulation
|
|
* @param {Object} context
|
|
* @param {URL} context.url The request's URL.
|
|
* @return {Array<URL>} To add additional urls to test, return an Array of
|
|
* URLs. Please note that these **should not be strings**, but URL objects.
|
|
*
|
|
* @memberof workbox-precaching
|
|
*/
|