UNPKG

4.63 kBTypeScriptView Raw
1import { GetManifestResult } from './types';
2/**
3 * This method returns a list of URLs to precache, referred to as a "precache
4 * manifest", along with details about the number of entries and their size,
5 * based on the options you provide.
6 *
7 * @param {Object} config The configuration to use.
8 *
9 * @param {string} config.globDirectory The local directory you wish to match
10 * `globPatterns` against. The path is relative to the current directory.
11 *
12 * @param {Array<module:workbox-build.ManifestEntry>} [config.additionalManifestEntries]
13 * A list of entries to be precached, in addition to any entries that are
14 * generated as part of the build configuration.
15 *
16 * @param {RegExp} [config.dontCacheBustURLsMatching] Assets that match this will be
17 * assumed to be uniquely versioned via their URL, and exempted from the normal
18 * HTTP cache-busting that's done when populating the precache. While not
19 * required, it's recommended that if your existing build process already
20 * inserts a `[hash]` value into each filename, you provide a RegExp that will
21 * detect that, as it will reduce the bandwidth consumed when precaching.
22 *
23 * @param {boolean} [config.globFollow=true] Determines whether or not symlinks
24 * are followed when generating the precache manifest. For more information, see
25 * the definition of `follow` in the `glob`
26 * [documentation](https://github.com/isaacs/node-glob#options).
27 *
28 * @param {Array<string>} [config.globIgnores=['node_modules/**']]
29 * A set of patterns matching files to always exclude when generating the
30 * precache manifest. For more information, see the definition of `ignore` in the `glob`
31 * [documentation](https://github.com/isaacs/node-glob#options).
32 *
33 * @param {Array<string>} [config.globPatterns=['**.{js,css,html}']]
34 * Files matching any of these patterns will be included in the precache
35 * manifest. For more information, see the
36 * [`glob` primer](https://github.com/isaacs/node-glob#glob-primer).
37 *
38 * @param {boolean} [config.globStrict=true] If true, an error reading a directory when
39 * generating a precache manifest will cause the build to fail. If false, the
40 * problematic directory will be skipped. For more information, see the
41 * definition of `strict` in the `glob`
42 * [documentation](https://github.com/isaacs/node-glob#options).
43 *
44 * @param {Array<module:workbox-build.ManifestTransform>} [config.manifestTransforms] One or more
45 * functions which will be applied sequentially against the generated manifest.
46 * If `modifyURLPrefix` or `dontCacheBustURLsMatching` are also specified, their
47 * corresponding transformations will be applied first.
48 *
49 * @param {number} [config.maximumFileSizeToCacheInBytes=2097152] This value can be
50 * used to determine the maximum size of files that will be precached. This
51 * prevents you from inadvertently precaching very large files that might have
52 * accidentally matched one of your patterns.
53 *
54 * @param {object<string, string>} [config.modifyURLPrefix] A mapping of prefixes
55 * that, if present in an entry in the precache manifest, will be replaced with
56 * the corresponding value. This can be used to, for example, remove or add a
57 * path prefix from a manifest entry if your web hosting setup doesn't match
58 * your local filesystem setup. As an alternative with more flexibility, you can
59 * use the `manifestTransforms` option and provide a function that modifies the
60 * entries in the manifest using whatever logic you provide.
61 *
62 * @param {Object} [config.templatedURLs] If a URL is rendered based on some
63 * server-side logic, its contents may depend on multiple files or on some other
64 * unique string value. The keys in this object are server-rendered URLs. If the
65 * values are an array of strings, they will be interpreted as `glob` patterns,
66 * and the contents of any files matching the patterns will be used to uniquely
67 * version the URL. If used with a single string, it will be interpreted as
68 * unique versioning information that you've generated for a given URL.
69 *
70 * @return {Promise<{count: number, manifestEntries: Array<module:workbox-build.ManifestEntry>, size: number, warnings: Array<string>}>}
71 * A promise that resolves once the precache manifest (available in the
72 * `manifestEntries` property) has been determined. The `size` property
73 * contains the aggregate size of all the precached entries, in bytes, and the
74 * `count` property contains the total number of precached entries. Any
75 * non-fatal warning messages will be returned via `warnings`.
76 *
77 * @memberof module:workbox-build
78 */
79export declare function getManifest(config: unknown): Promise<GetManifestResult>;