1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | import { JsCompileTarget, ModuleResolutionStrategy } from 'polymer-project-config';
|
16 | import { Transform } from 'stream';
|
17 | import * as vinyl from 'vinyl';
|
18 | import File = require('vinyl');
|
19 | export declare type FileCB = (error?: Error, file?: File) => void;
|
20 | export declare type CSSOptimizeOptions = {
|
21 | stripWhitespace?: boolean;
|
22 | };
|
23 | export interface OptimizeOptions {
|
24 | html?: {
|
25 | minify?: boolean | {
|
26 | exclude?: string[];
|
27 | };
|
28 | };
|
29 | css?: {
|
30 | minify?: boolean | {
|
31 | exclude?: string[];
|
32 | };
|
33 | };
|
34 | js?: JsOptimizeOptions;
|
35 | entrypointPath?: string;
|
36 | rootDir?: string;
|
37 | }
|
38 | export declare type JsCompileOptions = boolean | JsCompileTarget | {
|
39 | target?: JsCompileTarget;
|
40 | exclude?: string[];
|
41 | };
|
42 | export interface JsOptimizeOptions {
|
43 | minify?: boolean | {
|
44 | exclude?: string[];
|
45 | };
|
46 | compile?: JsCompileOptions;
|
47 | moduleResolution?: ModuleResolutionStrategy;
|
48 | transformModulesToAmd?: boolean;
|
49 | }
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | export declare class GenericOptimizeTransform extends Transform {
|
58 | optimizer: (content: string, file: File) => string;
|
59 | optimizerName: string;
|
60 | constructor(optimizerName: string, optimizer: (content: string, file: File) => string);
|
61 | _transform(file: File, _encoding: string, callback: FileCB): void;
|
62 | }
|
63 | /**
|
64 | * Transform JavaScript.
|
65 | */
|
66 | export declare class JsTransform extends GenericOptimizeTransform {
|
67 | constructor(options: OptimizeOptions);
|
68 | }
|
69 | /**
|
70 | * Transform HTML.
|
71 | */
|
72 | export declare class HtmlTransform extends GenericOptimizeTransform {
|
73 | constructor(options: OptimizeOptions);
|
74 | }
|
75 | /**
|
76 | * CSSMinifyTransform minifies CSS that pass through it (via css-slam).
|
77 | */
|
78 | export declare class CSSMinifyTransform extends GenericOptimizeTransform {
|
79 | private options;
|
80 | constructor(options: CSSOptimizeOptions);
|
81 | _transform(file: File, encoding: string, callback: FileCB): void;
|
82 | }
|
83 | /**
|
84 | * InlineCSSOptimizeTransform minifies inlined CSS (found in HTML files) that
|
85 | * passes through it (via css-slam).
|
86 | */
|
87 | export declare class InlineCSSOptimizeTransform extends GenericOptimizeTransform {
|
88 | private options;
|
89 | constructor(options: CSSOptimizeOptions);
|
90 | _transform(file: File, encoding: string, callback: FileCB): void;
|
91 | }
|
92 | /**
|
93 | * Returns an array of optimization streams to use in your build, based on the
|
94 | * OptimizeOptions given.
|
95 | */
|
96 | export declare function getOptimizeStreams(options?: OptimizeOptions): NodeJS.ReadWriteStream[];
|
97 | export declare function matchesExt(extension: string): (fs: vinyl) => boolean;
|