oxc-parser 0.70.0 → 0.71.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/README.md +13 -5
- package/bindings.js +2 -1
- package/generated/deserialize/js.js +191 -195
- package/generated/deserialize/ts.js +228 -233
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -8,15 +8,23 @@ See https://stackblitz.com/edit/oxc-parser for usage example.
|
|
|
8
8
|
|
|
9
9
|
### ESTree
|
|
10
10
|
|
|
11
|
-
When parsing
|
|
12
|
-
[ESTree standard](https://github.com/estree/estree)
|
|
11
|
+
When parsing JS or JSX files, the AST returned is fully conformant with the
|
|
12
|
+
[ESTree standard](https://github.com/estree/estree), the same as produced by
|
|
13
|
+
[Acorn](https://www.npmjs.com/package/acorn).
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
The returned TypeScript AST will conform to [@typescript-eslint/typescript-estree](https://www.npmjs.com/package/@typescript-eslint/typescript-estree) in the near future.
|
|
15
|
+
When parsing TypeScript, the AST conforms to [@typescript-eslint/typescript-estree](https://www.npmjs.com/package/@typescript-eslint/typescript-estree)'s TS-ESTree format.
|
|
17
16
|
|
|
18
17
|
If you need all ASTs in the same with-TS-properties format, use the `astType: 'ts'` option.
|
|
19
18
|
|
|
19
|
+
The only differences between Oxc's AST and ESTree / TS-ESTree are:
|
|
20
|
+
|
|
21
|
+
- Support for Stage 3 ECMA features [`import defer`](https://github.com/tc39/proposal-defer-import-eval)
|
|
22
|
+
and [`import source`](https://github.com/tc39/proposal-source-phase-imports).
|
|
23
|
+
- Addition of a non-standard `hashbang` field to `Program`.
|
|
24
|
+
|
|
25
|
+
That aside, the AST should completely align with Acorn's ESTree AST or TS-ESLint's TS-ESTree.
|
|
26
|
+
Any deviation would be considered a bug.
|
|
27
|
+
|
|
20
28
|
### AST Types
|
|
21
29
|
|
|
22
30
|
[@oxc-project/types](https://www.npmjs.com/package/@oxc-project/types) can be used. For example:
|
package/bindings.js
CHANGED
|
@@ -68,7 +68,7 @@ function requireNative() {
|
|
|
68
68
|
try {
|
|
69
69
|
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
70
70
|
} catch (err) {
|
|
71
|
-
loadErrors.push(err)
|
|
71
|
+
loadErrors.push(err)
|
|
72
72
|
}
|
|
73
73
|
} else if (process.platform === 'android') {
|
|
74
74
|
if (process.arch === 'arm64') {
|
|
@@ -382,6 +382,7 @@ if (!nativeBinding) {
|
|
|
382
382
|
throw new Error(`Failed to load native binding`)
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
+
module.exports = nativeBinding
|
|
385
386
|
module.exports.ParseResult = nativeBinding.ParseResult
|
|
386
387
|
module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind
|
|
387
388
|
module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind
|