1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import * as babel from '@babel/types';
|
15 | import * as dom5 from 'dom5/lib/index-next';
|
16 | import { ASTNode } from 'parse5';
|
17 | import * as shady from 'shady-css-parser';
|
18 | import { ParsedCssDocument } from '..';
|
19 | import { ParsedHtmlDocument } from '../html/html-document';
|
20 | import { JavaScriptDocument } from '../javascript/javascript-document';
|
21 | import { Document, ScannedDocument } from './document';
|
22 | import { ScannedFeature } from './feature';
|
23 | import { Resolvable } from './resolvable';
|
24 | import { LocationOffset, SourceRange } from './source-range';
|
25 | import { ResolvedUrl } from './url';
|
26 | import { Warning } from './warning';
|
27 | export interface InlineDocInfo {
|
28 | astNode?: AstNodeWithLanguage;
|
29 | locationOffset?: LocationOffset;
|
30 | baseUrl?: ResolvedUrl;
|
31 | }
|
32 | export interface HtmlAstNode {
|
33 | language: 'html';
|
34 | node: dom5.Node;
|
35 | containingDocument: ParsedHtmlDocument;
|
36 | }
|
37 | export interface JsAstNode<N extends babel.Node = babel.Node> {
|
38 | language: 'js';
|
39 | node: N;
|
40 | containingDocument: JavaScriptDocument;
|
41 | }
|
42 | export interface CssAstNode {
|
43 | language: 'css';
|
44 | node: shady.Node;
|
45 | containingDocument: ParsedCssDocument;
|
46 | }
|
47 | export declare type AstNodeWithLanguage = HtmlAstNode | JsAstNode | CssAstNode;
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | export declare class ScannedInlineDocument implements ScannedFeature, Resolvable {
|
55 | readonly type: 'html' | 'js' | 'css' | string;
|
56 | readonly contents: string;
|
57 |
|
58 | readonly locationOffset: LocationOffset;
|
59 | readonly attachedComment?: string;
|
60 | scannedDocument?: ScannedDocument;
|
61 | readonly sourceRange: SourceRange;
|
62 | readonly warnings: Warning[];
|
63 | readonly astNode: AstNodeWithLanguage;
|
64 | constructor(type: string, contents: string, locationOffset: LocationOffset, attachedComment: string, sourceRange: SourceRange, astNode: AstNodeWithLanguage);
|
65 | resolve(document: Document): Document | undefined;
|
66 | }
|
67 | declare module './queryable' {
|
68 | interface FeatureKindMap {
|
69 | 'inline-document': InlineDocument;
|
70 | }
|
71 | }
|
72 | export declare class InlineDocument extends Document {
|
73 | constructor(base: ScannedDocument, containerDocument: Document);
|
74 | }
|
75 | export declare function getAttachedCommentText(node: ASTNode): string | undefined;
|
76 | export declare function getLocationOffsetOfStartOfTextContent(node: ASTNode, parsedDocument: ParsedHtmlDocument): LocationOffset;
|