UNPKG

1.63 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 * as babel from '@babel/types';
15import { ScannedInlineDocument } from '../model/model';
16import { Visitor } from './estree-visitor';
17import { JavaScriptDocument } from './javascript-document';
18import { JavaScriptScanner } from './javascript-scanner';
19/**
20 * Finds inline HTML documents in Javascript source.
21 *
22 * e.g.
23 * html`<div></div>`;
24 */
25export declare class InlineHtmlDocumentScanner implements JavaScriptScanner {
26 scan(document: JavaScriptDocument, visit: (visitor: Visitor) => Promise<void>): Promise<{
27 features: ScannedInlineDocument[];
28 }>;
29}
30export interface Options {
31 /**
32 * If true, uses the "raw" template string contents rather than the "cooked"
33 * contents. For example: raw contents yields `\n` as two characters, cooked
34 * yields it as a newline.
35 */
36 useRawContents?: boolean;
37}
38/**
39 * Parses the given string as an inline HTML document.
40 */
41export declare function getInlineDocument(node: babel.TaggedTemplateExpression, parsedDocument: JavaScriptDocument, options?: Options): ScannedInlineDocument | undefined;