1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import { NodePath } from '@babel/traverse';
|
15 | import * as babel from '@babel/types';
|
16 | import { Document, FileRelativeUrl, Import, JsAstNode, ResolvedUrl, ScannedImport, Warning } from '../model/model';
|
17 | import { Visitor } from './estree-visitor';
|
18 | import { JavaScriptDocument } from './javascript-document';
|
19 | import { JavaScriptScanner } from './javascript-scanner';
|
20 | import { SourceRange } from '../model/model';
|
21 | import { DeclaredWithStatement } from '../model/document';
|
22 | export interface JavaScriptImportScannerOptions {
|
23 | |
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | moduleResolution?: 'node';
|
32 | }
|
33 | export declare type ImportNode = babel.ImportDeclaration | babel.CallExpression | babel.ExportAllDeclaration | babel.ExportNamedDeclaration;
|
34 | export declare class ScannedJavascriptImport extends ScannedImport {
|
35 | readonly type: 'js-import';
|
36 | readonly specifier: string;
|
37 | readonly statementAst: babel.Statement | undefined;
|
38 | readonly astNode: JsAstNode<ImportNode>;
|
39 | readonly astNodePath: NodePath<babel.Node>;
|
40 | constructor(url: FileRelativeUrl | undefined, sourceRange: SourceRange | undefined, urlSourceRange: SourceRange | undefined, ast: JsAstNode<ImportNode>, astNodePath: NodePath<babel.Node>, lazy: boolean, originalSpecifier: string, statementAst: babel.Statement | undefined);
|
41 | protected constructImport(resolvedUrl: ResolvedUrl, relativeUrl: FileRelativeUrl, importedDocument: Document | undefined, _containingDocument: Document): JavascriptImport;
|
42 | }
|
43 | declare module '../model/queryable' {
|
44 | interface FeatureKindMap {
|
45 | 'js-import': JavascriptImport;
|
46 | }
|
47 | }
|
48 | export declare class JavascriptImport extends Import implements DeclaredWithStatement {
|
49 | |
50 |
|
51 |
|
52 |
|
53 | readonly specifier: string;
|
54 | readonly statementAst: babel.Statement | undefined;
|
55 | readonly astNode: JsAstNode<ImportNode>;
|
56 | readonly astNodePath: NodePath<babel.Node>;
|
57 | constructor(url: ResolvedUrl, originalUrl: FileRelativeUrl, type: string, document: Document | undefined, sourceRange: SourceRange | undefined, urlSourceRange: SourceRange | undefined, ast: JsAstNode<ImportNode>, astNodePath: NodePath<babel.Node>, warnings: Warning[], lazy: boolean, specifier: string, statementAst: babel.Statement | undefined);
|
58 | }
|
59 | export declare class JavaScriptImportScanner implements JavaScriptScanner {
|
60 | moduleResolution?: 'node';
|
61 | constructor(options?: JavaScriptImportScannerOptions);
|
62 | scan(document: JavaScriptDocument, visit: (visitor: Visitor) => Promise<void>): Promise<{
|
63 | features: ScannedJavascriptImport[];
|
64 | warnings: Warning[];
|
65 | }>;
|
66 | private _resolveSpecifier;
|
67 | }
|