UNPKG

2.11 kBTypeScriptView Raw
1/**
2 * @license Angular v14.1.2
3 * (c) 2010-2022 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 navigationRequestStrategy?: 'freshness' | 'performance';
36}
37
38/**
39 * Configuration for a particular group of dynamic URLs.
40 *
41 * @publicApi
42 */
43export declare interface DataGroup {
44 name: string;
45 urls: Glob[];
46 version?: number;
47 cacheConfig: {
48 maxSize: number;
49 maxAge: Duration;
50 timeout?: Duration;
51 strategy?: 'freshness' | 'performance';
52 cacheOpaqueResponses?: boolean;
53 };
54 cacheQueryOptions?: Pick<CacheQueryOptions, 'ignoreSearch'>;
55}
56
57/**
58 * @publicApi
59 */
60export declare type Duration = string;
61
62
63/**
64 * An abstraction over a virtual file system used to enable testing and operation
65 * of the config generator in different environments.
66 *
67 * @publicApi
68 */
69export declare interface Filesystem {
70 list(dir: string): Promise<string[]>;
71 read(file: string): Promise<string>;
72 hash(file: string): Promise<string>;
73 write(file: string, contents: string): Promise<void>;
74}
75
76/**
77 * Consumes service worker configuration files and processes them into control files.
78 *
79 * @publicApi
80 */
81declare class Generator_2 {
82 readonly fs: Filesystem;
83 private baseHref;
84 constructor(fs: Filesystem, baseHref: string);
85 process(config: Config): Promise<Object>;
86 private processAssetGroups;
87 private processDataGroups;
88}
89export { Generator_2 as Generator }
90
91
92/**
93 * @publicApi
94 */
95export declare type Glob = string;
96
97export { }