| [9af201e] | 1 | /*
|
|---|
| 2 | Copyright 2018 Google LLC
|
|---|
| 3 |
|
|---|
| 4 | Use of this source code is governed by an MIT-style
|
|---|
| 5 | license that can be found in the LICENSE file or at
|
|---|
| 6 | https://opensource.org/licenses/MIT.
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | import {getFileManifestEntries} from './lib/get-file-manifest-entries';
|
|---|
| 10 | import {GetManifestOptions, GetManifestResult} from './types';
|
|---|
| 11 | import {validateGetManifestOptions} from './lib/validate-options';
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | * This method returns a list of URLs to precache, referred to as a "precache
|
|---|
| 15 | * manifest", along with details about the number of entries and their size,
|
|---|
| 16 | * based on the options you provide.
|
|---|
| 17 | *
|
|---|
| 18 | * ```
|
|---|
| 19 | * // The following lists some common options; see the rest of the documentation
|
|---|
| 20 | * // for the full set of options and defaults.
|
|---|
| 21 | * const {count, manifestEntries, size, warnings} = await getManifest({
|
|---|
| 22 | * dontCacheBustURLsMatching: [new RegExp('...')],
|
|---|
| 23 | * globDirectory: '...',
|
|---|
| 24 | * globPatterns: ['...', '...'],
|
|---|
| 25 | * maximumFileSizeToCacheInBytes: ...,
|
|---|
| 26 | * });
|
|---|
| 27 | * ```
|
|---|
| 28 | *
|
|---|
| 29 | * @memberof workbox-build
|
|---|
| 30 | */
|
|---|
| 31 | export async function getManifest(
|
|---|
| 32 | config: GetManifestOptions,
|
|---|
| 33 | ): Promise<GetManifestResult> {
|
|---|
| 34 | const options = validateGetManifestOptions(config);
|
|---|
| 35 |
|
|---|
| 36 | return await getFileManifestEntries(options);
|
|---|
| 37 | }
|
|---|