UNPKG

3.46 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 types="node" />
15import { PackageRelativeUrl } from 'polymer-analyzer';
16import { ProjectConfig, ProjectOptions } from 'polymer-project-config';
17import { BuildAnalyzer } from './analyzer';
18import { BuildBundler, Options as BuildBundlerOptions } from './bundle';
19import { LocalFsPath } from './path-transformers';
20export declare class PolymerProject {
21 config: ProjectConfig;
22 /**
23 * A `Transform` stream that uses polymer-analyzer to analyze the files. It
24 * can be used to get information on dependencies and fragments for the
25 * project once the source & dependency streams have been piped into it.
26 */
27 analyzer: BuildAnalyzer;
28 constructor(config: ProjectConfig | ProjectOptions | string);
29 /**
30 * Returns a `Transform` stream that modifies the files that pass through it
31 * based on the dependency analysis done by the `analyzer` transform. It
32 * "bundles" a project by injecting its dependencies into the application
33 * fragments themselves, so that a minimum number of requests need to be made
34 * to load.
35 *
36 * (NOTE: The analyzer stream must be in the pipeline somewhere before this.)
37 */
38 bundler(options?: BuildBundlerOptions): BuildBundler;
39 /**
40 * Returns the analyzer's stream of this project's source files - files
41 * matched by the project's `config.sources` value.
42 */
43 sources(): NodeJS.ReadableStream;
44 /**
45 * Returns the analyzer's stream of this project's dependency files - files
46 * loaded inside the analyzed project that are not considered source files.
47 */
48 dependencies(): NodeJS.ReadableStream;
49 /**
50 * Returns a stream transformer that injects 'prefetch' link tags into HTML
51 * documents based on the transitive dependencies of the document.
52 * For entrypoint documents without `<base>` tag, absolute urls are used in
53 * prefetch link hrefs. In all other cases, link hrefs will be relative urls.
54 */
55 addPrefetchLinks(): NodeJS.ReadWriteStream;
56 /**
57 * Returns a stream transformer that adds a push manifest file to the set
58 * of all input files that pass through.
59 */
60 addPushManifest(outPath?: LocalFsPath, basePath?: PackageRelativeUrl): NodeJS.ReadWriteStream;
61 /**
62 * Returns a stream transformer that injects `custom-elements-es5-adapter.js`
63 * into the entry point HTML file. This adapter is needed when serving ES5
64 * to browsers that support the native Custom Elements API.
65 */
66 addCustomElementsEs5Adapter(): NodeJS.ReadWriteStream;
67 addBabelHelpersInEntrypoint(entrypoint?: string): NodeJS.ReadWriteStream;
68 /**
69 * Return a stream transformer that updates the `<base>` tag of the project's
70 * entrypoint HTML file with the given new value. No change is made if a
71 * `<base>` tag does not already exist.
72 */
73 updateBaseTag(baseHref: string): NodeJS.ReadWriteStream;
74}