oxc-parser 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +81 -9
- package/index.js +3 -2
- package/package.json +9 -9
package/index.d.ts
CHANGED
|
@@ -3,6 +3,77 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
+
export interface ImportSpecifier {
|
|
7
|
+
/**
|
|
8
|
+
* Module name
|
|
9
|
+
*
|
|
10
|
+
* To handle escape sequences in specifier strings, the .n field of imported specifiers will be provided where possible.
|
|
11
|
+
*
|
|
12
|
+
* For dynamic import expressions, this field will be empty if not a valid JS string.
|
|
13
|
+
*/
|
|
14
|
+
n?: string
|
|
15
|
+
/** Start of module specifier */
|
|
16
|
+
s: number
|
|
17
|
+
/** End of module specifier */
|
|
18
|
+
e: number
|
|
19
|
+
/** Start of import statement */
|
|
20
|
+
ss: number
|
|
21
|
+
/** End of import statement */
|
|
22
|
+
se: number
|
|
23
|
+
/**
|
|
24
|
+
* Import Type
|
|
25
|
+
* * If this import keyword is a dynamic import, this is the start value.
|
|
26
|
+
* * If this import keyword is a static import, this is -1.
|
|
27
|
+
* * If this import keyword is an import.meta expression, this is -2.
|
|
28
|
+
*/
|
|
29
|
+
d: number
|
|
30
|
+
/**
|
|
31
|
+
* If this import has an import assertion, this is the start value
|
|
32
|
+
* Otherwise this is `-1`.
|
|
33
|
+
*/
|
|
34
|
+
a: number
|
|
35
|
+
}
|
|
36
|
+
export interface ExportSpecifier {
|
|
37
|
+
/** Exported name */
|
|
38
|
+
n: string
|
|
39
|
+
/** Local name, or undefined. */
|
|
40
|
+
ln?: string
|
|
41
|
+
/** Start of exported name */
|
|
42
|
+
s: number
|
|
43
|
+
/** End of exported name */
|
|
44
|
+
e: number
|
|
45
|
+
/** Start of local name */
|
|
46
|
+
ls?: number
|
|
47
|
+
/** End of local name */
|
|
48
|
+
le?: number
|
|
49
|
+
}
|
|
50
|
+
export interface ModuleLexer {
|
|
51
|
+
imports: Array<ImportSpecifier>
|
|
52
|
+
exports: Array<ExportSpecifier>
|
|
53
|
+
/**
|
|
54
|
+
* ESM syntax detection
|
|
55
|
+
*
|
|
56
|
+
* The use of ESM syntax: import / export statements and `import.meta`
|
|
57
|
+
*/
|
|
58
|
+
hasModuleSyntax: boolean
|
|
59
|
+
/** Facade modules that only use import / export syntax */
|
|
60
|
+
facade: boolean
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Outputs the list of exports and locations of import specifiers,
|
|
64
|
+
* including dynamic import and import meta handling.
|
|
65
|
+
*
|
|
66
|
+
* # Panics
|
|
67
|
+
*
|
|
68
|
+
* * File extension is invalid
|
|
69
|
+
*/
|
|
70
|
+
export function moduleLexerSync(sourceText: string, options?: ParserOptions | undefined | null): ModuleLexer
|
|
71
|
+
/**
|
|
72
|
+
* # Panics
|
|
73
|
+
*
|
|
74
|
+
* * Tokio crashes
|
|
75
|
+
*/
|
|
76
|
+
export function moduleLexerAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ModuleLexer>
|
|
6
77
|
/**
|
|
7
78
|
* Babel Parser Options
|
|
8
79
|
*
|
|
@@ -11,6 +82,16 @@
|
|
|
11
82
|
export interface ParserOptions {
|
|
12
83
|
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
13
84
|
sourceFilename?: string
|
|
85
|
+
/**
|
|
86
|
+
* Emit `ParenthesizedExpression` in AST.
|
|
87
|
+
*
|
|
88
|
+
* If this option is true, parenthesized expressions are represented by
|
|
89
|
+
* (non-standard) `ParenthesizedExpression` nodes that have a single `expression` property
|
|
90
|
+
* containing the expression inside parentheses.
|
|
91
|
+
*
|
|
92
|
+
* Default: true
|
|
93
|
+
*/
|
|
94
|
+
preserveParens?: boolean
|
|
14
95
|
}
|
|
15
96
|
export interface ParseResult {
|
|
16
97
|
program: string
|
|
@@ -40,15 +121,6 @@ export function parseWithoutReturn(sourceText: string, options?: ParserOptions |
|
|
|
40
121
|
* * Serde JSON serialization
|
|
41
122
|
*/
|
|
42
123
|
export function parseSync(sourceText: string, options?: ParserOptions | undefined | null): ParseResult
|
|
43
|
-
/**
|
|
44
|
-
* Returns a binary AST in flexbuffers format.
|
|
45
|
-
* This is a POC API. Error handling is not done yet.
|
|
46
|
-
* # Panics
|
|
47
|
-
*
|
|
48
|
-
* * File extension is invalid
|
|
49
|
-
* * FlexbufferSerializer serialization error
|
|
50
|
-
*/
|
|
51
|
-
export function parseSyncBuffer(sourceText: string, options?: ParserOptions | undefined | null): Buffer
|
|
52
124
|
/**
|
|
53
125
|
* # Panics
|
|
54
126
|
*
|
package/index.js
CHANGED
|
@@ -295,9 +295,10 @@ if (!nativeBinding) {
|
|
|
295
295
|
throw new Error(`Failed to load native binding`)
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
const { parseWithoutReturn, parseSync,
|
|
298
|
+
const { moduleLexerSync, moduleLexerAsync, parseWithoutReturn, parseSync, parseAsync } = nativeBinding
|
|
299
299
|
|
|
300
|
+
module.exports.moduleLexerSync = moduleLexerSync
|
|
301
|
+
module.exports.moduleLexerAsync = moduleLexerAsync
|
|
300
302
|
module.exports.parseWithoutReturn = parseWithoutReturn
|
|
301
303
|
module.exports.parseSync = parseSync
|
|
302
|
-
module.exports.parseSyncBuffer = parseSyncBuffer
|
|
303
304
|
module.exports.parseAsync = parseAsync
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Oxc Parser Node API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Parser"
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"index.js"
|
|
24
24
|
],
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.
|
|
27
|
-
"@oxc-parser/binding-win32-arm64-msvc": "0.
|
|
28
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.
|
|
29
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.
|
|
30
|
-
"@oxc-parser/binding-linux-x64-musl": "0.
|
|
31
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.
|
|
32
|
-
"@oxc-parser/binding-darwin-x64": "0.
|
|
33
|
-
"@oxc-parser/binding-darwin-arm64": "0.
|
|
26
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.9.0",
|
|
27
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.9.0",
|
|
28
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.9.0",
|
|
29
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.9.0",
|
|
30
|
+
"@oxc-parser/binding-linux-x64-musl": "0.9.0",
|
|
31
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.9.0",
|
|
32
|
+
"@oxc-parser/binding-darwin-x64": "0.9.0",
|
|
33
|
+
"@oxc-parser/binding-darwin-arm64": "0.9.0"
|
|
34
34
|
}
|
|
35
35
|
}
|