forked from buehler/node-typescript-parser
-
Notifications
You must be signed in to change notification settings - Fork 2
/
TypescriptParser.d.ts
68 lines (68 loc) · 2.06 KB
/
TypescriptParser.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { ScriptKind } from 'typescript';
import { File } from './resources/File';
/**
* Magic.happens('here');
* This class is the parser of the whole extension. It uses the typescript compiler to parse a file or given
* source code into the token stream and therefore into the AST of the source. Afterwards an array of
* resources is generated and returned.
*
* @export
* @class TypescriptParser
*/
export declare class TypescriptParser {
/**
* Parses the given source into an anonymous File resource.
* Mainly used to parse source code of a document.
*
* @param {string} source
* @param {ScriptKind} [scriptKind=ScriptKind.TS]
* @returns {Promise<File>}
*
* @memberof TsResourceParser
*/
parseSource(source: string, scriptKind?: ScriptKind): Promise<File>;
/**
* Parses a single file into a parsed file.
*
* @param {string} filePath
* @param {string} rootPath
* @returns {Promise<File>}
*
* @memberof TsResourceParser
*/
parseFile(filePath: string, rootPath: string): Promise<File>;
/**
* Parses multiple files into parsed files.
*
* @param {string[]} filePathes
* @param {string} rootPath
* @returns {Promise<File[]>}
*
* @memberof TsResourceParser
*/
parseFiles(filePathes: string[], rootPath: string): Promise<File[]>;
/**
* Parses the typescript source into the file instance. Calls .parse afterwards to
* get the declarations and other information about the source.
*
* @private
* @param {SourceFile} source
* @param {string} rootPath
* @returns {TsFile}
*
* @memberof TsResourceParser
*/
private parseTypescript;
/**
* Recursive function that runs through the AST of a source and parses the nodes.
* Creates the class / function / etc declarations and instanciates a new module / namespace
* resource if needed.
*
* @private
* @param {Resource} resource
* @param {Node} node
*
* @memberof TsResourceParser
*/
private parse;
}