UNPKG

1.97 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2018 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 { JsTransformOptions } from './js-transform';
15/**
16 * Options for htmlTransform.
17 */
18export interface HtmlTransformOptions {
19 /**
20 * Transformations to apply to JavaScript within the HTML document.
21 */
22 js?: JsTransformOptions;
23 /**
24 * Whether to minify HTML.
25 */
26 minifyHtml?: boolean;
27 /**
28 * Whether and which Babel helpers to inject as an inline script. This is
29 * typically needed when this is the entry point HTML document and ES5
30 * compilation or AMD transform is enabled.
31 *
32 * If "none" (the default), no helpers are injected. If "full", includes the
33 * helpers needed for both ES5 compilation and the AMD transform. If "amd",
34 * includes only the helpers needed for the AMD transform.
35 */
36 injectBabelHelpers?: 'none' | 'full' | 'amd';
37 /**
38 * Whether to inject the regenerator runtime as an inline script. This is
39 * needed if you are compiling to ES5 and use async/await or generators.
40 */
41 injectRegeneratorRuntime?: boolean;
42 /**
43 * Whether to inject an AMD loader as an inline script. This is typically
44 * needed if ES to AMD module transformation is enabled and this is the entry
45 * point HTML document.
46 */
47 injectAmdLoader?: boolean;
48}
49/**
50 * Transform some HTML according to the given options.
51 */
52export declare function htmlTransform(html: string, options: HtmlTransformOptions): string;