UNPKG

2.06 kBTypeScriptView Raw
1/**
2 * @license Angular v10.2.3
3 * (c) 2010-2020 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7
8/**
9 * Configuration for a particular group of assets.
10 *
11 * @publicApi
12 */
13export declare interface AssetGroup {
14 name: string;
15 installMode?: 'prefetch' | 'lazy';
16 updateMode?: 'prefetch' | 'lazy';
17 resources: {
18 files?: Glob[];
19 urls?: Glob[];
20 };
21 cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
22}
23
24/**
25 * A top-level Angular Service Worker configuration object.
26 *
27 * @publicApi
28 */
29export declare interface Config {
30 appData?: {};
31 index: string;
32 assetGroups?: AssetGroup[];
33 dataGroups?: DataGroup[];
34 navigationUrls?: string[];
35}
36
37/**
38 * Configuration for a particular group of dynamic URLs.
39 *
40 * @publicApi
41 */
42export declare interface DataGroup {
43 name: string;
44 urls: Glob[];
45 version?: number;
46 cacheConfig: {
47 maxSize: number;
48 maxAge: Duration;
49 timeout?: Duration;
50 strategy?: 'freshness' | 'performance';
51 };
52 cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
53}
54
55/**
56 * @publicApi
57 */
58export declare type Duration = string;
59
60
61/**
62 * An abstraction over a virtual file system used to enable testing and operation
63 * of the config generator in different environments.
64 *
65 * @publicApi
66 */
67export declare interface Filesystem {
68 list(dir: string): Promise<string[]>;
69 read(file: string): Promise<string>;
70 hash(file: string): Promise<string>;
71 write(file: string, contents: string): Promise<void>;
72}
73
74/**
75 * Consumes service worker configuration files and processes them into control files.
76 *
77 * @publicApi
78 */
79export declare class Generator {
80 readonly fs: Filesystem;
81 private baseHref;
82 constructor(fs: Filesystem, baseHref: string);
83 process(config: Config): Promise<Object>;
84 private processAssetGroups;
85 private processDataGroups;
86}
87
88
89/**
90 * @publicApi
91 */
92export declare type Glob = string;
93
94export { }