UNPKG

1.94 kBTypeScriptView Raw
1import './_version.js';
2export interface InstallResult {
3 updatedURLs: string[];
4 notUpdatedURLs: string[];
5}
6export interface CleanupResult {
7 deletedCacheRequests: string[];
8}
9export declare interface PrecacheEntry {
10 integrity?: string;
11 url: string;
12 revision?: string | null;
13}
14export interface PrecacheRouteOptions {
15 directoryIndex?: string;
16 ignoreURLParametersMatching?: RegExp[];
17 cleanURLs?: boolean;
18 urlManipulation?: urlManipulation;
19}
20export type urlManipulation = ({ url }: {
21 url: URL;
22}) => URL[];
23/**
24 * @typedef {Object} InstallResult
25 * @property {Array<string>} updatedURLs List of URLs that were updated during
26 * installation.
27 * @property {Array<string>} notUpdatedURLs List of URLs that were already up to
28 * date.
29 *
30 * @memberof workbox-precaching
31 */
32/**
33 * @typedef {Object} CleanupResult
34 * @property {Array<string>} deletedCacheRequests List of URLs that were deleted
35 * while cleaning up the cache.
36 *
37 * @memberof workbox-precaching
38 */
39/**
40 * @typedef {Object} PrecacheEntry
41 * @property {string} url URL to precache.
42 * @property {string} [revision] Revision information for the URL.
43 * @property {string} [integrity] Integrity metadata that will be used when
44 * making the network request for the URL.
45 *
46 * @memberof workbox-precaching
47 */
48/**
49 * The "urlManipulation" callback can be used to determine if there are any
50 * additional permutations of a URL that should be used to check against
51 * the available precached files.
52 *
53 * For example, Workbox supports checking for '/index.html' when the URL
54 * '/' is provided. This callback allows additional, custom checks.
55 *
56 * @callback ~urlManipulation
57 * @param {Object} context
58 * @param {URL} context.url The request's URL.
59 * @return {Array<URL>} To add additional urls to test, return an Array of
60 * URLs. Please note that these **should not be strings**, but URL objects.
61 *
62 * @memberof workbox-precaching
63 */