Skip to content

Commit

Permalink
chore: bump napi to v3 (#4365)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Jul 19, 2024
1 parent 557132f commit 27cbd55
Show file tree
Hide file tree
Showing 9 changed files with 3,005 additions and 675 deletions.
88 changes: 48 additions & 40 deletions napi/parser/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
/* tslint:disable */
/* auto-generated by NAPI-RS */
/* eslint-disable */
export interface Comment {
type: 'Line' | 'Block'
value: string
start: number
end: number
}

/* auto-generated by NAPI-RS */
export interface ExportSpecifier {
/** Exported name */
n: string
/** Local name, or undefined. */
ln?: string
/** Start of exported name */
s: number
/** End of exported name */
e: number
/** Start of local name */
ls?: number
/** End of local name */
le?: number
}

export interface ImportSpecifier {
/**
Expand Down Expand Up @@ -33,20 +52,7 @@ export interface ImportSpecifier {
*/
a: number
}
export interface ExportSpecifier {
/** Exported name */
n: string
/** Local name, or undefined. */
ln?: string
/** Start of exported name */
s: number
/** End of exported name */
e: number
/** Start of local name */
ls?: number
/** End of local name */
le?: number
}

export interface ModuleLexer {
imports: Array<ImportSpecifier>
exports: Array<ExportSpecifier>
Expand All @@ -59,6 +65,14 @@ export interface ModuleLexer {
/** Facade modules that only use import / export syntax */
facade: boolean
}

/**
* # Panics
*
* * Tokio crashes
*/
export declare function moduleLexerAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ModuleLexer>

/**
* Outputs the list of exports and locations of import specifiers,
* including dynamic import and import meta handling.
Expand All @@ -67,13 +81,21 @@ export interface ModuleLexer {
*
* * File extension is invalid
*/
export function moduleLexerSync(sourceText: string, options?: ParserOptions | undefined | null): ModuleLexer
export declare function moduleLexerSync(sourceText: string, options?: ParserOptions | undefined | null): ModuleLexer

/**
* # Panics
*
* * Tokio crashes
*/
export function moduleLexerAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ModuleLexer>
export declare function parseAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>

export interface ParseResult {
program: string
comments: Array<Comment>
errors: Array<string>
}

/**
* Babel Parser Options
*
Expand All @@ -93,37 +115,23 @@ export interface ParserOptions {
*/
preserveParens?: boolean
}
export interface ParseResult {
program: string
comments: Array<Comment>
errors: Array<string>
}
export interface Comment {
type: 'Line' | 'Block'
value: string
start: number
end: number
}

/**
* Parse without returning anything.
* This is for benchmark purposes such as measuring napi communication overhead.
*
* # Panics
*
* * File extension is invalid
* * Serde JSON serialization
*/
export function parseWithoutReturn(sourceText: string, options?: ParserOptions | undefined | null): void
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 function parseSync(sourceText: string, options?: ParserOptions | undefined | null): ParseResult
/**
* # Panics
*
* * Tokio crashes
*/
export function parseAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>
export declare function parseWithoutReturn(sourceText: string, options?: ParserOptions | undefined | null): void

Loading

0 comments on commit 27cbd55

Please sign in to comment.