George Kalpakas 1d378e2987 fix(service-worker): deprecate versionedFiles in asset-group resources (#23584)
Since `versionedFiles` behaves in the exact same way as `files`, there
is no reaason to have both. Users should use `files` instead.

This commit deprecates the property and prints a warning when coming
across an asset-group that uses it. It should be completely removed in
a future version.

Note, it has also been removed from the default `ngsw-config.json`
template in angular/devkit#754.

PR Close #23584
2018-05-15 12:19:08 -07:00

63 lines
1.2 KiB
TypeScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @experimental
*/
export type Glob = string;
/**
* @experimental
*/
export type Duration = string;
/**
* A top-level Angular Service Worker configuration object.
*
* @experimental
*/
export interface Config {
appData?: {};
index: string;
assetGroups?: AssetGroup[];
dataGroups?: DataGroup[];
navigationUrls?: string[];
}
/**
* Configuration for a particular group of assets.
*
* @experimental
*/
export interface AssetGroup {
name: string;
installMode?: 'prefetch'|'lazy';
updateMode?: 'prefetch'|'lazy';
resources: {
files?: Glob[];
/** @deprecated As of v6 `versionedFiles` and `files` options have the same behavior. Use
`files` instead. */
versionedFiles?: Glob[];
urls?: Glob[];
};
}
/**
* Configuration for a particular group of dynamic URLs.
*
* @experimental
*/
export interface DataGroup {
name: string;
urls: Glob[];
version?: number;
cacheConfig: {
maxSize: number; maxAge: Duration; timeout?: Duration; strategy?: 'freshness' | 'performance';
};
}