UNPKG

1.85 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * The complete set of authors may be found at
7 * http://polymer.github.io/AUTHORS.txt
8 * The complete set of contributors may be found at
9 * http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at
12 * http://polymer.github.io/PATENTS.txt
13 */
14/// <reference path="../custom_typings/sw-precache.d.ts" />
15/// <reference types="node" />
16import { SWConfig } from 'sw-precache';
17import { LocalFsPath } from './path-transformers';
18import { PolymerProject } from './polymer-project';
19export interface AddServiceWorkerOptions {
20 project: PolymerProject;
21 buildRoot: LocalFsPath;
22 bundled?: boolean;
23 path?: LocalFsPath;
24 swPrecacheConfig?: SWConfig | null;
25 basePath?: LocalFsPath;
26}
27export declare const hasNoFileExtension: RegExp;
28/**
29 * Returns a promise that resolves with a generated service worker
30 * configuration.
31 */
32export declare function generateServiceWorkerConfig(options: AddServiceWorkerOptions): Promise<SWConfig>;
33/**
34 * Returns a promise that resolves with a generated service worker (the file
35 * contents), based off of the options provided.
36 */
37export declare function generateServiceWorker(options: AddServiceWorkerOptions): Promise<Buffer>;
38/**
39 * Returns a promise that resolves when a service worker has been generated
40 * and written to the build directory. This uses generateServiceWorker() to
41 * generate a service worker, which it then writes to the file system based on
42 * the buildRoot & path (if provided) options.
43 */
44export declare function addServiceWorker(options: AddServiceWorkerOptions): Promise<void>;