oxc-parser 0.46.0 → 0.47.1
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/bindings.js +6 -3
- package/index.d.ts +45 -3
- package/index.js +7 -1
- package/package.json +10 -10
package/bindings.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// prettier-ignore
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
3
4
|
/* auto-generated by NAPI-RS */
|
|
4
5
|
|
|
5
|
-
const {
|
|
6
|
+
const { createRequire } = require('node:module')
|
|
7
|
+
require = createRequire(__filename)
|
|
6
8
|
|
|
9
|
+
const { readFileSync } = require('node:fs')
|
|
7
10
|
let nativeBinding = null
|
|
8
11
|
const loadErrors = []
|
|
9
12
|
|
|
@@ -336,7 +339,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
336
339
|
nativeBinding = require('./parser.wasi.cjs')
|
|
337
340
|
} catch (err) {
|
|
338
341
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
339
|
-
|
|
342
|
+
loadErrors.push(err)
|
|
340
343
|
}
|
|
341
344
|
}
|
|
342
345
|
if (!nativeBinding) {
|
|
@@ -344,7 +347,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
344
347
|
nativeBinding = require('@oxc-parser/binding-wasm32-wasi')
|
|
345
348
|
} catch (err) {
|
|
346
349
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
347
|
-
|
|
350
|
+
loadErrors.push(err)
|
|
348
351
|
}
|
|
349
352
|
}
|
|
350
353
|
}
|
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class MagicString {
|
|
|
11
11
|
getUtf16ByteOffset(offset: number): number
|
|
12
12
|
length(): number
|
|
13
13
|
toString(): string
|
|
14
|
+
hasChanged(): boolean
|
|
14
15
|
append(input: string): this
|
|
15
16
|
appendLeft(index: number, input: string): this
|
|
16
17
|
appendRight(index: number, input: string): this
|
|
@@ -20,6 +21,20 @@ export declare class MagicString {
|
|
|
20
21
|
prependRight(index: number, input: string): this
|
|
21
22
|
relocate(start: number, end: number, to: number): this
|
|
22
23
|
remove(start: number, end: number): this
|
|
24
|
+
generateMap(options?: Partial<GenerateDecodedMapOptions>): {
|
|
25
|
+
toString: () => string;
|
|
26
|
+
toUrl: () => string;
|
|
27
|
+
toMap: () => {
|
|
28
|
+
file?: string
|
|
29
|
+
mappings: string
|
|
30
|
+
names: Array<string>
|
|
31
|
+
sourceRoot?: string
|
|
32
|
+
sources: Array<string>
|
|
33
|
+
sourcesContent?: Array<string>
|
|
34
|
+
version: number
|
|
35
|
+
x_google_ignoreList?: Array<number>
|
|
36
|
+
}
|
|
37
|
+
}
|
|
23
38
|
}
|
|
24
39
|
|
|
25
40
|
export declare class ParseResult {
|
|
@@ -37,6 +52,12 @@ export interface Comment {
|
|
|
37
52
|
end: number
|
|
38
53
|
}
|
|
39
54
|
|
|
55
|
+
export interface DynamicImport {
|
|
56
|
+
start: number
|
|
57
|
+
end: number
|
|
58
|
+
moduleRequest: Span
|
|
59
|
+
}
|
|
60
|
+
|
|
40
61
|
export interface EcmaScriptModule {
|
|
41
62
|
/**
|
|
42
63
|
* Has ESM syntax.
|
|
@@ -46,10 +67,12 @@ export interface EcmaScriptModule {
|
|
|
46
67
|
* Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
|
|
47
68
|
*/
|
|
48
69
|
hasModuleSyntax: boolean
|
|
49
|
-
/** Import
|
|
70
|
+
/** Import statements. */
|
|
50
71
|
staticImports: Array<StaticImport>
|
|
51
|
-
/** Export
|
|
72
|
+
/** Export statements. */
|
|
52
73
|
staticExports: Array<StaticExport>
|
|
74
|
+
/** Dynamic import expressions. */
|
|
75
|
+
dynamicImports: Array<DynamicImport>
|
|
53
76
|
/** Span positions` of `import.meta` */
|
|
54
77
|
importMetas: Array<Span>
|
|
55
78
|
}
|
|
@@ -113,6 +136,15 @@ export declare const enum ExportLocalNameKind {
|
|
|
113
136
|
None = 'None'
|
|
114
137
|
}
|
|
115
138
|
|
|
139
|
+
export interface GenerateDecodedMapOptions {
|
|
140
|
+
/** The filename of the file containing the original source. */
|
|
141
|
+
source?: string
|
|
142
|
+
/** Whether to include the original content in the map's `sourcesContent` array. */
|
|
143
|
+
includeContent: boolean
|
|
144
|
+
/** Whether the mapping should be high-resolution. */
|
|
145
|
+
hires: boolean | 'boundary'
|
|
146
|
+
}
|
|
147
|
+
|
|
116
148
|
export interface ImportName {
|
|
117
149
|
kind: ImportNameKind
|
|
118
150
|
name?: string
|
|
@@ -184,6 +216,17 @@ export declare const enum Severity {
|
|
|
184
216
|
Advice = 'Advice'
|
|
185
217
|
}
|
|
186
218
|
|
|
219
|
+
export interface SourceMap {
|
|
220
|
+
file?: string
|
|
221
|
+
mappings: string
|
|
222
|
+
names: Array<string>
|
|
223
|
+
sourceRoot?: string
|
|
224
|
+
sources: Array<string>
|
|
225
|
+
sourcesContent?: Array<string>
|
|
226
|
+
version: number
|
|
227
|
+
x_google_ignoreList?: Array<number>
|
|
228
|
+
}
|
|
229
|
+
|
|
187
230
|
export interface SourceMapOptions {
|
|
188
231
|
includeContent?: boolean
|
|
189
232
|
source?: string
|
|
@@ -274,4 +317,3 @@ export interface ValueSpan {
|
|
|
274
317
|
start: number
|
|
275
318
|
end: number
|
|
276
319
|
}
|
|
277
|
-
|
package/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const bindings = require('./bindings.js');
|
|
2
2
|
|
|
3
|
-
module.exports.MagicString = bindings.MagicString;
|
|
4
3
|
module.exports.ParseResult = bindings.ParseResult;
|
|
5
4
|
module.exports.ExportExportNameKind = bindings.ExportExportNameKind;
|
|
6
5
|
module.exports.ExportImportNameKind = bindings.ExportImportNameKind;
|
|
@@ -30,6 +29,13 @@ function wrap(result) {
|
|
|
30
29
|
},
|
|
31
30
|
get magicString() {
|
|
32
31
|
if (!magicString) magicString = result.magicString;
|
|
32
|
+
magicString.generateMap = function generateMap(options) {
|
|
33
|
+
return {
|
|
34
|
+
toString: () => magicString.toSourcemapString(options),
|
|
35
|
+
toUrl: () => magicString.toSourcemapUrl(options),
|
|
36
|
+
toMap: () => magicString.toSourcemapObject(options),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
33
39
|
return magicString;
|
|
34
40
|
},
|
|
35
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.1",
|
|
4
4
|
"description": "Oxc Parser Node API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Parser"
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"bindings.js"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@oxc-project/types": "^0.
|
|
27
|
+
"@oxc-project/types": "^0.47.1"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.
|
|
31
|
-
"@oxc-parser/binding-win32-arm64-msvc": "0.
|
|
32
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.
|
|
33
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.
|
|
34
|
-
"@oxc-parser/binding-linux-x64-musl": "0.
|
|
35
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.
|
|
36
|
-
"@oxc-parser/binding-darwin-x64": "0.
|
|
37
|
-
"@oxc-parser/binding-darwin-arm64": "0.
|
|
30
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.47.1",
|
|
31
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.47.1",
|
|
32
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.47.1",
|
|
33
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.47.1",
|
|
34
|
+
"@oxc-parser/binding-linux-x64-musl": "0.47.1",
|
|
35
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.47.1",
|
|
36
|
+
"@oxc-parser/binding-darwin-x64": "0.47.1",
|
|
37
|
+
"@oxc-parser/binding-darwin-arm64": "0.47.1"
|
|
38
38
|
}
|
|
39
39
|
}
|