UNPKG

3.48 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2016 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 { Document } from './document';
15import { Feature } from './feature';
16import { AstNodeWithLanguage, SourceRange } from './model';
17import { Resolvable } from './resolvable';
18import { FileRelativeUrl, ResolvedUrl } from './url';
19import { Warning } from './warning';
20/**
21 * Represents an import, such as an HTML import, an external script or style
22 * tag, or an JavaScript import.
23 *
24 * @template N The AST node type
25 */
26export declare class ScannedImport implements Resolvable {
27 readonly type: 'html-import' | 'html-script' | 'html-style' | 'js-import' | string;
28 /**
29 * URL of the import, relative to the base directory.
30 */
31 url: FileRelativeUrl | undefined;
32 sourceRange: SourceRange | undefined;
33 error: {
34 message?: string;
35 } | undefined;
36 /**
37 * The source range specifically for the URL or reference to the imported
38 * resource.
39 */
40 urlSourceRange: SourceRange | undefined;
41 astNode: AstNodeWithLanguage | undefined;
42 warnings: Warning[];
43 /**
44 * If true, the imported document may not be loaded until well after the
45 * containing document has been evaluated, and indeed may never load.
46 */
47 lazy: boolean;
48 constructor(type: string, url: FileRelativeUrl | undefined, sourceRange: SourceRange | undefined, urlSourceRange: SourceRange | undefined, ast: AstNodeWithLanguage | undefined, lazy: boolean);
49 resolve(document: Document): Import | undefined;
50 protected constructImport(resolvedUrl: ResolvedUrl, relativeUrl: FileRelativeUrl, importedDocument: Document | undefined, _containingDocument: Document): Import;
51 protected addCouldNotLoadWarning(document: Document, warning?: Warning): void;
52 /**
53 * Resolve the URL for this import and return it if the analyzer
54 */
55 protected getLoadableUrlOrWarn(document: Document): ResolvedUrl | undefined;
56}
57declare module './queryable' {
58 interface FeatureKindMap {
59 'import': Import;
60 'lazy-import': Import;
61 'html-import': Import;
62 'html-script': Import;
63 'html-style': Import;
64 'css-import': Import;
65 }
66}
67export declare class Import implements Feature {
68 readonly type: 'html-import' | 'html-script' | 'html-style' | string;
69 readonly url: ResolvedUrl;
70 readonly originalUrl: FileRelativeUrl;
71 readonly document: Document | undefined;
72 readonly identifiers: Set<any>;
73 readonly kinds: Set<string>;
74 readonly sourceRange: SourceRange | undefined;
75 readonly urlSourceRange: SourceRange | undefined;
76 readonly astNode: AstNodeWithLanguage | undefined;
77 readonly warnings: Warning[];
78 readonly lazy: boolean;
79 constructor(url: ResolvedUrl, originalUrl: FileRelativeUrl, type: string, document: Document | undefined, sourceRange: SourceRange | undefined, urlSourceRange: SourceRange | undefined, ast: AstNodeWithLanguage | undefined, warnings: Warning[], lazy: boolean);
80 toString(): string;
81}