oxc-parser 0.57.0 → 0.58.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/README.md CHANGED
@@ -4,12 +4,15 @@
4
4
 
5
5
  ### ESTree
6
6
 
7
- The returned JavaScript AST follows the [ESTree](https://github.com/estree/estree) specification.
7
+ When parsing `.js` or `.jsx` files, the AST returned is fully conformant with the
8
+ [ESTree standard](https://github.com/estree/estree).
8
9
 
9
10
  It is fully aligned with Acorn's AST, and any deviation would be considered a bug.
10
11
 
11
12
  The returned TypeScript AST will conform to [@typescript-eslint/typescript-estree](https://www.npmjs.com/package/@typescript-eslint/typescript-estree) in the near future.
12
13
 
14
+ If you need all ASTs in the same with-TS-properties format, use the `astType: 'ts'` option.
15
+
13
16
  ### AST Types
14
17
 
15
18
  [@oxc-project/types](https://www.npmjs.com/package/@oxc-project/types) can be used. For example:
@@ -41,17 +44,6 @@ Fast mode is best suited for parser plugins, where other parts of your build pip
41
44
 
42
45
  Please note that turning off fast mode ​incurs​ a small performance overhead.
43
46
 
44
- ### ESTree compatibility
45
-
46
- When parsing JS or JSX files, the AST returned is fully conformant with the
47
- [ESTree standard](https://github.com/estree/estree).
48
-
49
- When parsing TS or TSX files, the AST has additional properties related to TypeScript syntax.
50
- These extra properties are broadly (but not entirely) in line with
51
- [TypeScript ESLint](https://typescript-eslint.io/packages/parser/)'s AST.
52
-
53
- If you need all ASTs in the same with-TS-properties format, use the `astType: 'ts'` option.
54
-
55
47
  ### Returns ESM information.
56
48
 
57
49
  It is likely that you are writing a parser plugin that requires ESM information.
package/deserialize-js.js CHANGED
@@ -894,13 +894,13 @@ function deserializeAccessorProperty(pos) {
894
894
  }
895
895
 
896
896
  function deserializeImportExpression(pos) {
897
- const args = deserializeVecExpression(pos + 24);
897
+ const options = deserializeVecExpression(pos + 24);
898
898
  return {
899
899
  type: 'ImportExpression',
900
900
  start: deserializeU32(pos),
901
901
  end: deserializeU32(pos + 4),
902
902
  source: deserializeExpression(pos + 8),
903
- options: args.length === 0 ? null : args[0],
903
+ options: options.length === 0 ? null : options[0],
904
904
  };
905
905
  }
906
906
 
@@ -1132,9 +1132,9 @@ function deserializeJSXOpeningElement(pos) {
1132
1132
  type: 'JSXOpeningElement',
1133
1133
  start: deserializeU32(pos),
1134
1134
  end: deserializeU32(pos + 4),
1135
- selfClosing: deserializeBool(pos + 8),
1136
- name: deserializeJSXElementName(pos + 16),
1137
1135
  attributes: deserializeVecJSXAttributeItem(pos + 32),
1136
+ name: deserializeJSXElementName(pos + 16),
1137
+ selfClosing: deserializeBool(pos + 8),
1138
1138
  };
1139
1139
  }
1140
1140
 
@@ -1163,6 +1163,8 @@ function deserializeJSXOpeningFragment(pos) {
1163
1163
  type: 'JSXOpeningFragment',
1164
1164
  start: deserializeU32(pos),
1165
1165
  end: deserializeU32(pos + 4),
1166
+ attributes: [],
1167
+ selfClosing: false,
1166
1168
  };
1167
1169
  }
1168
1170
 
@@ -1254,6 +1256,7 @@ function deserializeJSXText(pos) {
1254
1256
  start: deserializeU32(pos),
1255
1257
  end: deserializeU32(pos + 4),
1256
1258
  value: deserializeStr(pos + 8),
1259
+ raw: deserializeOptionStr(pos + 24),
1257
1260
  };
1258
1261
  }
1259
1262
 
package/deserialize-ts.js CHANGED
@@ -941,13 +941,13 @@ function deserializeAccessorProperty(pos) {
941
941
  }
942
942
 
943
943
  function deserializeImportExpression(pos) {
944
- const args = deserializeVecExpression(pos + 24);
944
+ const options = deserializeVecExpression(pos + 24);
945
945
  return {
946
946
  type: 'ImportExpression',
947
947
  start: deserializeU32(pos),
948
948
  end: deserializeU32(pos + 4),
949
949
  source: deserializeExpression(pos + 8),
950
- options: args.length === 0 ? null : args[0],
950
+ options: options.length === 0 ? null : options[0],
951
951
  };
952
952
  }
953
953
 
@@ -1184,9 +1184,9 @@ function deserializeJSXOpeningElement(pos) {
1184
1184
  type: 'JSXOpeningElement',
1185
1185
  start: deserializeU32(pos),
1186
1186
  end: deserializeU32(pos + 4),
1187
- selfClosing: deserializeBool(pos + 8),
1188
- name: deserializeJSXElementName(pos + 16),
1189
1187
  attributes: deserializeVecJSXAttributeItem(pos + 32),
1188
+ name: deserializeJSXElementName(pos + 16),
1189
+ selfClosing: deserializeBool(pos + 8),
1190
1190
  typeParameters: deserializeOptionBoxTSTypeParameterInstantiation(pos + 64),
1191
1191
  };
1192
1192
  }
@@ -1216,6 +1216,8 @@ function deserializeJSXOpeningFragment(pos) {
1216
1216
  type: 'JSXOpeningFragment',
1217
1217
  start: deserializeU32(pos),
1218
1218
  end: deserializeU32(pos + 4),
1219
+ attributes: [],
1220
+ selfClosing: false,
1219
1221
  };
1220
1222
  }
1221
1223
 
@@ -1307,6 +1309,7 @@ function deserializeJSXText(pos) {
1307
1309
  start: deserializeU32(pos),
1308
1310
  end: deserializeU32(pos + 4),
1309
1311
  value: deserializeStr(pos + 8),
1312
+ raw: deserializeOptionStr(pos + 24),
1310
1313
  };
1311
1314
  }
1312
1315
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-parser",
3
- "version": "0.57.0",
3
+ "version": "0.58.1",
4
4
  "main": "index.js",
5
5
  "browser": "browser.js",
6
6
  "engines": {
@@ -36,7 +36,7 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "@oxc-project/types": "^0.57.0"
39
+ "@oxc-project/types": "^0.58.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@codspeed/vitest-plugin": "^4.0.0",
@@ -65,16 +65,16 @@
65
65
  "dtsHeaderFile": "header.js"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@oxc-parser/binding-win32-x64-msvc": "0.57.0",
69
- "@oxc-parser/binding-win32-arm64-msvc": "0.57.0",
70
- "@oxc-parser/binding-linux-x64-gnu": "0.57.0",
71
- "@oxc-parser/binding-linux-x64-musl": "0.57.0",
72
- "@oxc-parser/binding-linux-arm64-gnu": "0.57.0",
73
- "@oxc-parser/binding-linux-arm64-musl": "0.57.0",
74
- "@oxc-parser/binding-linux-arm-gnueabihf": "0.57.0",
75
- "@oxc-parser/binding-darwin-x64": "0.57.0",
76
- "@oxc-parser/binding-darwin-arm64": "0.57.0",
77
- "@oxc-parser/binding-wasm32-wasi": "0.57.0"
68
+ "@oxc-parser/binding-win32-x64-msvc": "0.58.1",
69
+ "@oxc-parser/binding-win32-arm64-msvc": "0.58.1",
70
+ "@oxc-parser/binding-linux-x64-gnu": "0.58.1",
71
+ "@oxc-parser/binding-linux-x64-musl": "0.58.1",
72
+ "@oxc-parser/binding-linux-arm64-gnu": "0.58.1",
73
+ "@oxc-parser/binding-linux-arm64-musl": "0.58.1",
74
+ "@oxc-parser/binding-linux-arm-gnueabihf": "0.58.1",
75
+ "@oxc-parser/binding-darwin-x64": "0.58.1",
76
+ "@oxc-parser/binding-darwin-arm64": "0.58.1",
77
+ "@oxc-parser/binding-wasm32-wasi": "0.58.1"
78
78
  },
79
79
  "scripts": {
80
80
  "build-dev": "napi build --no-dts-cache --platform --js bindings.js",