UNPKG

1.59 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2017 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 */
14import { ResolvedUrl, UrlResolver } from 'polymer-analyzer';
15import { ProjectConfig } from 'polymer-project-config';
16import File = require('vinyl');
17import { AsyncTransformStream } from './streams';
18/**
19 * A stream that modifies HTML files to include prefetch links for all of the
20 * file's transitive dependencies.
21 */
22export declare class AddPrefetchLinks extends AsyncTransformStream<File, File> {
23 files: Map<ResolvedUrl, File>;
24 private _analyzer;
25 private _config;
26 constructor(config: ProjectConfig);
27 protected _transformIter(files: AsyncIterable<File>): AsyncIterable<File>;
28}
29/**
30 * Returns the given HTML updated with import or prefetch links for the given
31 * dependencies. The given url and deps are expected to be project-relative
32 * URLs (e.g. "index.html" or "src/view.html") unless absolute parameter is
33 * `true` and there is no base tag in the document.
34 */
35export declare function createLinks(urlResolver: UrlResolver, html: string, baseUrl: ResolvedUrl, deps: Set<ResolvedUrl>, absolute?: boolean): string;