1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import { Analyzer, Document, ResolvedUrl } from 'polymer-analyzer';
|
15 | import { BundleManifest, BundleStrategy, BundleUrlMapper } from './bundle-manifest';
|
16 | import { DocumentCollection } from './document-collection';
|
17 | export * from './bundle-manifest';
|
18 | export interface Options {
|
19 | analyzer?: Analyzer;
|
20 | excludes?: ResolvedUrl[];
|
21 | inlineCss?: boolean;
|
22 | inlineScripts?: boolean;
|
23 | rewriteUrlsInTemplates?: boolean;
|
24 | sourcemaps?: boolean;
|
25 | stripComments?: boolean;
|
26 | strategy?: BundleStrategy;
|
27 | treeshake?: boolean;
|
28 | urlMapper?: BundleUrlMapper;
|
29 | }
|
30 | export interface BundleResult {
|
31 | documents: DocumentCollection;
|
32 | manifest: BundleManifest;
|
33 | }
|
34 | export declare class Bundler {
|
35 | analyzer: Analyzer;
|
36 | enableCssInlining: boolean;
|
37 | enableScriptInlining: boolean;
|
38 | excludes: ResolvedUrl[];
|
39 | rewriteUrlsInTemplates: boolean;
|
40 | sourcemaps: boolean;
|
41 | stripComments: boolean;
|
42 | strategy: BundleStrategy;
|
43 | treeshake: boolean;
|
44 | urlMapper: BundleUrlMapper;
|
45 | private _overlayUrlLoader;
|
46 | constructor(options?: Options);
|
47 | /**
|
48 | * Analyze an HTML URL using the given contents in place of what would
|
49 | * otherwise have been loaded.
|
50 | */
|
51 | analyzeContents(url: ResolvedUrl, contents: string, permanent?: boolean): Promise<Document>;
|
52 | /**
|
53 | * Given a manifest describing the bundles, produce a collection of bundled
|
54 | * documents with HTML imports, external stylesheets and external scripts
|
55 | * inlined according to the options for this Bundler.
|
56 | *
|
57 | * @param manifest - The manifest that describes the bundles to be produced.
|
58 | */
|
59 | bundle(manifest: BundleManifest): Promise<BundleResult>;
|
60 | /**
|
61 | * Generates a BundleManifest with all bundles defined, using entrypoints,
|
62 | * strategy and mapper.
|
63 | *
|
64 | * @param entrypoints - The list of entrypoints that will be analyzed for
|
65 | * dependencies. The results of the analysis will be passed to the
|
66 | * `strategy`.
|
67 | * @param strategy - The strategy used to construct the output bundles.
|
68 | * See 'polymer-analyzer/src/bundle-manifest'.
|
69 | * @param mapper - A function that produces URLs for the generated bundles.
|
70 | * See 'polymer-analyzer/src/bundle-manifest'.
|
71 | */
|
72 | generateManifest(entrypoints: ResolvedUrl[]): Promise<BundleManifest>;
|
73 | /**
|
74 | * Given an array of Bundles, remove all files from bundles which are in the
|
75 | * "excludes" set. Remove any bundles which are left empty after excluded
|
76 | * files are removed.
|
77 | */
|
78 | private _filterExcludesFromBundles;
|
79 | }
|