1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import * as babel from '@babel/types';
|
15 | import { InlineDocInfo, LocationOffset, Severity, SourceRange } from '../model/model';
|
16 | import { ResolvedUrl } from '../model/url';
|
17 | import { Parser } from '../parser/parser';
|
18 | import { UrlResolver } from '../url-loader/url-resolver';
|
19 | import { JavaScriptDocument } from './javascript-document';
|
20 | export declare type SourceType = 'script' | 'module';
|
21 | export declare class JavaScriptParser implements Parser<JavaScriptDocument> {
|
22 | readonly sourceType?: SourceType;
|
23 | parse(contents: string, url: ResolvedUrl, _urlResolver: UrlResolver, inlineInfo?: InlineDocInfo): JavaScriptDocument;
|
24 | }
|
25 | export declare class JavaScriptModuleParser extends JavaScriptParser {
|
26 | readonly sourceType: SourceType;
|
27 | }
|
28 | export declare class JavaScriptScriptParser extends JavaScriptParser {
|
29 | readonly sourceType: SourceType;
|
30 | }
|
31 | export declare type ParseResult = {
|
32 | type: 'success';
|
33 | sourceType: SourceType;
|
34 | parsedFile: babel.File;
|
35 | } | {
|
36 | type: 'failure';
|
37 | warningish: {
|
38 | sourceRange: SourceRange;
|
39 | severity: Severity;
|
40 | code: string;
|
41 | message: string;
|
42 | };
|
43 | };
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export declare function parseJs(contents: string, file: ResolvedUrl, locationOffset?: LocationOffset, warningCode?: string, sourceType?: SourceType): ParseResult;
|