oxc/napi/parser/index.d.ts
Boshen 943462f22c feat(module_lexer)!: remove oxc_module_lexer (#7595)
This crate will no longer be relevant after we export esm information
directly from the parser.

Besides, `ex-module-lexer`'s output data is too limited for plugin
authors to use.
2024-12-03 04:22:51 +00:00

63 lines
1.6 KiB
TypeScript

/* auto-generated by NAPI-RS */
/* eslint-disable */
export * from '@oxc-project/types';
export interface Comment {
type: 'Line' | 'Block'
value: string
start: number
end: number
}
/**
* # Panics
*
* * Tokio crashes
*/
export declare function parseAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>
export interface ParseResult {
program: import("@oxc-project/types").Program
comments: Array<Comment>
errors: Array<string>
}
/**
* Babel Parser Options
*
* <https://github.com/babel/babel/blob/v7.26.2/packages/babel-parser/typings/babel-parser.d.ts>
*/
export interface ParserOptions {
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
sourceFilename?: string
/**
* Emit `ParenthesizedExpression` in AST.
*
* If this option is true, parenthesized expressions are represented by
* (non-standard) `ParenthesizedExpression` nodes that have a single `expression` property
* containing the expression inside parentheses.
*
* Default: true
*/
preserveParens?: boolean
}
/**
* # Panics
*
* * File extension is invalid
* * Serde JSON serialization
*/
export declare function parseSync(sourceText: string, options?: ParserOptions | undefined | null): ParseResult
/**
* Parse without returning anything.
* This is for benchmark purposes such as measuring napi communication overhead.
*
* # Panics
*
* * File extension is invalid
* * Serde JSON serialization
*/
export declare function parseWithoutReturn(sourceText: string, options?: ParserOptions | undefined | null): void