oxc-parser 0.91.0 → 0.92.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.
@@ -7,7 +7,15 @@ const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
7
7
  decodeStr = textDecoder.decode.bind(textDecoder),
8
8
  { fromCodePoint } = String;
9
9
 
10
- export function deserialize(buffer, sourceTextInput, sourceByteLenInput, preserveParensInput) {
10
+ export function deserialize(buffer, sourceText, sourceByteLen, preserveParens) {
11
+ return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeRawTransferData);
12
+ }
13
+
14
+ export function deserializeProgramOnly(buffer, sourceText, sourceByteLen, preserveParens) {
15
+ return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeProgram);
16
+ }
17
+
18
+ function deserializeWith(buffer, sourceTextInput, sourceByteLenInput, preserveParensInput, deserialize) {
11
19
  uint8 = buffer;
12
20
  uint32 = buffer.uint32;
13
21
  float64 = buffer.float64;
@@ -17,7 +25,7 @@ export function deserialize(buffer, sourceTextInput, sourceByteLenInput, preserv
17
25
  sourceIsAscii = sourceText.length === sourceByteLen;
18
26
  preserveParens = preserveParensInput;
19
27
 
20
- const data = deserializeRawTransferData(uint32[536870902]);
28
+ const data = deserialize(uint32[536870902]);
21
29
 
22
30
  uint8 =
23
31
  uint32 =
@@ -7,7 +7,15 @@ const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
7
7
  decodeStr = textDecoder.decode.bind(textDecoder),
8
8
  { fromCodePoint } = String;
9
9
 
10
- export function deserialize(buffer, sourceTextInput, sourceByteLenInput, preserveParensInput) {
10
+ export function deserialize(buffer, sourceText, sourceByteLen, preserveParens) {
11
+ return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeRawTransferData);
12
+ }
13
+
14
+ export function deserializeProgramOnly(buffer, sourceText, sourceByteLen, preserveParens) {
15
+ return deserializeWith(buffer, sourceText, sourceByteLen, preserveParens, deserializeProgram);
16
+ }
17
+
18
+ function deserializeWith(buffer, sourceTextInput, sourceByteLenInput, preserveParensInput, deserialize) {
11
19
  uint8 = buffer;
12
20
  uint32 = buffer.uint32;
13
21
  float64 = buffer.float64;
@@ -17,7 +25,7 @@ export function deserialize(buffer, sourceTextInput, sourceByteLenInput, preserv
17
25
  sourceIsAscii = sourceText.length === sourceByteLen;
18
26
  preserveParens = preserveParensInput;
19
27
 
20
- const data = deserializeRawTransferData(uint32[536870902]);
28
+ const data = deserialize(uint32[536870902]);
21
29
 
22
30
  uint8 =
23
31
  uint32 =
@@ -1,8 +1,8 @@
1
1
  // Auto-generated code, DO NOT EDIT DIRECTLY!
2
2
  // To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer_lazy.rs`.
3
3
 
4
- import { constructorError, TOKEN } from '../../src-js/raw-transfer/lazy-common.mjs';
5
- import { NodeArray } from '../../src-js/raw-transfer/node-array.mjs';
4
+ import { constructorError, TOKEN } from '../../src-js/raw-transfer/lazy-common.js';
5
+ import { NodeArray } from '../../src-js/raw-transfer/node-array.js';
6
6
 
7
7
  const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
8
8
  decodeStr = textDecoder.decode.bind(textDecoder),
@@ -181,7 +181,7 @@ import {
181
181
  WhileStatement,
182
182
  WithStatement,
183
183
  YieldExpression,
184
- } from './constructors.mjs';
184
+ } from './constructors.js';
185
185
 
186
186
  export { walkProgram };
187
187
 
@@ -1,7 +1,7 @@
1
1
  // Auto-generated code, DO NOT EDIT DIRECTLY!
2
2
  // To edit this generated file you have to edit `tasks/ast_tools/src/generators/estree_visit.rs`.
3
3
 
4
- export default {
4
+ export default Object.freeze({
5
5
  // Leaf nodes
6
6
  DebuggerStatement: [],
7
7
  EmptyStatement: [],
@@ -169,4 +169,4 @@ export default {
169
169
  TSTypeQuery: ['exprName', 'typeArguments'],
170
170
  TSTypeReference: ['typeName', 'typeArguments'],
171
171
  TSUnionType: ['types'],
172
- };
172
+ });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "oxc-parser",
3
- "version": "0.91.0",
4
- "type": "commonjs",
5
- "main": "src-js/index.mjs",
6
- "browser": "src-js/wasm.mjs",
3
+ "version": "0.92.0",
4
+ "type": "module",
5
+ "main": "src-js/index.js",
6
+ "browser": "src-js/wasm.js",
7
7
  "engines": {
8
8
  "node": "^20.19.0 || >=22.12.0"
9
9
  },
@@ -25,38 +25,38 @@
25
25
  "url": "https://github.com/sponsors/Boshen"
26
26
  },
27
27
  "files": [
28
- "generated/constants.mjs",
29
- "generated/deserialize/js.mjs",
30
- "generated/deserialize/ts.mjs",
31
- "generated/lazy/constructors.mjs",
32
- "generated/lazy/types.mjs",
33
- "generated/lazy/walk.mjs",
34
- "generated/visit/keys.mjs",
35
- "generated/visit/types.mjs",
28
+ "generated/constants.js",
29
+ "generated/deserialize/js.js",
30
+ "generated/deserialize/ts.js",
31
+ "generated/lazy/constructors.js",
32
+ "generated/lazy/types.js",
33
+ "generated/lazy/walk.js",
34
+ "generated/visit/keys.js",
35
+ "generated/visit/types.js",
36
36
  "generated/visit/visitor.d.ts",
37
- "generated/visit/walk.mjs",
38
- "src-js/bindings.mjs",
37
+ "generated/visit/walk.js",
38
+ "src-js/bindings.js",
39
39
  "src-js/index.d.ts",
40
- "src-js/index.mjs",
41
- "src-js/wasm.mjs",
42
- "src-js/webcontainer-fallback.js",
43
- "src-js/wrap.mjs",
44
- "src-js/raw-transfer/common.mjs",
45
- "src-js/raw-transfer/eager.mjs",
46
- "src-js/raw-transfer/lazy.mjs",
47
- "src-js/raw-transfer/lazy-common.mjs",
48
- "src-js/raw-transfer/node-array.mjs",
49
- "src-js/raw-transfer/supported.mjs",
50
- "src-js/raw-transfer/visitor.mjs",
51
- "src-js/visit/index.mjs",
52
- "src-js/visit/visitor.mjs"
40
+ "src-js/index.js",
41
+ "src-js/wasm.js",
42
+ "src-js/webcontainer-fallback.cjs",
43
+ "src-js/wrap.js",
44
+ "src-js/raw-transfer/common.js",
45
+ "src-js/raw-transfer/eager.js",
46
+ "src-js/raw-transfer/lazy.js",
47
+ "src-js/raw-transfer/lazy-common.js",
48
+ "src-js/raw-transfer/node-array.js",
49
+ "src-js/raw-transfer/supported.js",
50
+ "src-js/raw-transfer/visitor.js",
51
+ "src-js/visit/index.js",
52
+ "src-js/visit/visitor.js"
53
53
  ],
54
54
  "publishConfig": {
55
55
  "registry": "https://registry.npmjs.org/",
56
56
  "access": "public"
57
57
  },
58
58
  "dependencies": {
59
- "@oxc-project/types": "^0.91.0"
59
+ "@oxc-project/types": "^0.92.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@codspeed/vitest-plugin": "^4.0.0",
@@ -97,33 +97,33 @@
97
97
  "dtsHeaderFile": "src-js/header.d.ts"
98
98
  },
99
99
  "optionalDependencies": {
100
- "@oxc-parser/binding-win32-x64-msvc": "0.91.0",
101
- "@oxc-parser/binding-win32-arm64-msvc": "0.91.0",
102
- "@oxc-parser/binding-linux-x64-gnu": "0.91.0",
103
- "@oxc-parser/binding-linux-x64-musl": "0.91.0",
104
- "@oxc-parser/binding-freebsd-x64": "0.91.0",
105
- "@oxc-parser/binding-linux-arm64-gnu": "0.91.0",
106
- "@oxc-parser/binding-linux-arm64-musl": "0.91.0",
107
- "@oxc-parser/binding-linux-arm-gnueabihf": "0.91.0",
108
- "@oxc-parser/binding-linux-arm-musleabihf": "0.91.0",
109
- "@oxc-parser/binding-linux-s390x-gnu": "0.91.0",
110
- "@oxc-parser/binding-linux-riscv64-gnu": "0.91.0",
111
- "@oxc-parser/binding-darwin-x64": "0.91.0",
112
- "@oxc-parser/binding-darwin-arm64": "0.91.0",
113
- "@oxc-parser/binding-android-arm64": "0.91.0",
114
- "@oxc-parser/binding-wasm32-wasi": "0.91.0"
100
+ "@oxc-parser/binding-win32-x64-msvc": "0.92.0",
101
+ "@oxc-parser/binding-win32-arm64-msvc": "0.92.0",
102
+ "@oxc-parser/binding-linux-x64-gnu": "0.92.0",
103
+ "@oxc-parser/binding-linux-x64-musl": "0.92.0",
104
+ "@oxc-parser/binding-freebsd-x64": "0.92.0",
105
+ "@oxc-parser/binding-linux-arm64-gnu": "0.92.0",
106
+ "@oxc-parser/binding-linux-arm64-musl": "0.92.0",
107
+ "@oxc-parser/binding-linux-arm-gnueabihf": "0.92.0",
108
+ "@oxc-parser/binding-linux-arm-musleabihf": "0.92.0",
109
+ "@oxc-parser/binding-linux-s390x-gnu": "0.92.0",
110
+ "@oxc-parser/binding-linux-riscv64-gnu": "0.92.0",
111
+ "@oxc-parser/binding-darwin-x64": "0.92.0",
112
+ "@oxc-parser/binding-darwin-arm64": "0.92.0",
113
+ "@oxc-parser/binding-android-arm64": "0.92.0",
114
+ "@oxc-parser/binding-wasm32-wasi": "0.92.0"
115
115
  },
116
116
  "scripts": {
117
- "build-dev": "napi build --esm --platform --js bindings.mjs --output-dir src-js",
117
+ "build-dev": "napi build --esm --platform --js bindings.js --dts index.d.ts --output-dir src-js",
118
118
  "build-test": "pnpm run build-dev --profile coverage",
119
119
  "build": "pnpm run build-dev --features allocator --release",
120
- "postbuild-dev": "node scripts/patch.mjs",
120
+ "postbuild-dev": "node scripts/patch.js",
121
121
  "build-wasi": "pnpm run build-dev --release --target wasm32-wasip1-threads",
122
122
  "build-npm-dir": "rm -rf npm-dir && napi create-npm-dirs --npm-dir npm-dir && pnpm napi artifacts --npm-dir npm-dir --output-dir src-js",
123
- "build-browser-bundle": "node scripts/build-browser-bundle.mjs",
123
+ "build-browser-bundle": "node scripts/build-browser-bundle.js",
124
124
  "test": "tsc && pnpm run test-node run",
125
125
  "test-node": "vitest --dir ./test",
126
- "test-browser": "vitest -c vitest.config.browser.mts",
127
- "bench": "vitest bench --run ./bench.bench.mjs"
126
+ "test-browser": "vitest -c vitest.config.browser.ts",
127
+ "bench": "vitest bench --run ./bench.bench.js"
128
128
  }
129
129
  }
@@ -81,8 +81,8 @@ function requireNative() {
81
81
  try {
82
82
  const binding = require('@oxc-parser/binding-android-arm64')
83
83
  const bindingPackageVersion = require('@oxc-parser/binding-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
86
  }
87
87
  return binding
88
88
  } catch (e) {
@@ -97,8 +97,8 @@ function requireNative() {
97
97
  try {
98
98
  const binding = require('@oxc-parser/binding-android-arm-eabi')
99
99
  const bindingPackageVersion = require('@oxc-parser/binding-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
102
  }
103
103
  return binding
104
104
  } catch (e) {
@@ -117,8 +117,8 @@ function requireNative() {
117
117
  try {
118
118
  const binding = require('@oxc-parser/binding-win32-x64-msvc')
119
119
  const bindingPackageVersion = require('@oxc-parser/binding-win32-x64-msvc/package.json').version
120
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
120
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
122
  }
123
123
  return binding
124
124
  } catch (e) {
@@ -133,8 +133,8 @@ function requireNative() {
133
133
  try {
134
134
  const binding = require('@oxc-parser/binding-win32-ia32-msvc')
135
135
  const bindingPackageVersion = require('@oxc-parser/binding-win32-ia32-msvc/package.json').version
136
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
138
  }
139
139
  return binding
140
140
  } catch (e) {
@@ -149,8 +149,8 @@ function requireNative() {
149
149
  try {
150
150
  const binding = require('@oxc-parser/binding-win32-arm64-msvc')
151
151
  const bindingPackageVersion = require('@oxc-parser/binding-win32-arm64-msvc/package.json').version
152
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
154
  }
155
155
  return binding
156
156
  } catch (e) {
@@ -168,8 +168,8 @@ function requireNative() {
168
168
  try {
169
169
  const binding = require('@oxc-parser/binding-darwin-universal')
170
170
  const bindingPackageVersion = require('@oxc-parser/binding-darwin-universal/package.json').version
171
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
171
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
173
173
  }
174
174
  return binding
175
175
  } catch (e) {
@@ -184,8 +184,8 @@ function requireNative() {
184
184
  try {
185
185
  const binding = require('@oxc-parser/binding-darwin-x64')
186
186
  const bindingPackageVersion = require('@oxc-parser/binding-darwin-x64/package.json').version
187
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
189
  }
190
190
  return binding
191
191
  } catch (e) {
@@ -200,8 +200,8 @@ function requireNative() {
200
200
  try {
201
201
  const binding = require('@oxc-parser/binding-darwin-arm64')
202
202
  const bindingPackageVersion = require('@oxc-parser/binding-darwin-arm64/package.json').version
203
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
205
  }
206
206
  return binding
207
207
  } catch (e) {
@@ -220,8 +220,8 @@ function requireNative() {
220
220
  try {
221
221
  const binding = require('@oxc-parser/binding-freebsd-x64')
222
222
  const bindingPackageVersion = require('@oxc-parser/binding-freebsd-x64/package.json').version
223
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
225
225
  }
226
226
  return binding
227
227
  } catch (e) {
@@ -236,8 +236,8 @@ function requireNative() {
236
236
  try {
237
237
  const binding = require('@oxc-parser/binding-freebsd-arm64')
238
238
  const bindingPackageVersion = require('@oxc-parser/binding-freebsd-arm64/package.json').version
239
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
241
  }
242
242
  return binding
243
243
  } catch (e) {
@@ -257,8 +257,8 @@ function requireNative() {
257
257
  try {
258
258
  const binding = require('@oxc-parser/binding-linux-x64-musl')
259
259
  const bindingPackageVersion = require('@oxc-parser/binding-linux-x64-musl/package.json').version
260
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
260
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
262
262
  }
263
263
  return binding
264
264
  } catch (e) {
@@ -273,8 +273,8 @@ function requireNative() {
273
273
  try {
274
274
  const binding = require('@oxc-parser/binding-linux-x64-gnu')
275
275
  const bindingPackageVersion = require('@oxc-parser/binding-linux-x64-gnu/package.json').version
276
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
278
  }
279
279
  return binding
280
280
  } catch (e) {
@@ -291,8 +291,8 @@ function requireNative() {
291
291
  try {
292
292
  const binding = require('@oxc-parser/binding-linux-arm64-musl')
293
293
  const bindingPackageVersion = require('@oxc-parser/binding-linux-arm64-musl/package.json').version
294
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
296
  }
297
297
  return binding
298
298
  } catch (e) {
@@ -307,8 +307,8 @@ function requireNative() {
307
307
  try {
308
308
  const binding = require('@oxc-parser/binding-linux-arm64-gnu')
309
309
  const bindingPackageVersion = require('@oxc-parser/binding-linux-arm64-gnu/package.json').version
310
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
312
  }
313
313
  return binding
314
314
  } catch (e) {
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('@oxc-parser/binding-linux-arm-musleabihf')
327
327
  const bindingPackageVersion = require('@oxc-parser/binding-linux-arm-musleabihf/package.json').version
328
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
330
  }
331
331
  return binding
332
332
  } catch (e) {
@@ -341,8 +341,8 @@ function requireNative() {
341
341
  try {
342
342
  const binding = require('@oxc-parser/binding-linux-arm-gnueabihf')
343
343
  const bindingPackageVersion = require('@oxc-parser/binding-linux-arm-gnueabihf/package.json').version
344
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
346
  }
347
347
  return binding
348
348
  } catch (e) {
@@ -359,8 +359,8 @@ function requireNative() {
359
359
  try {
360
360
  const binding = require('@oxc-parser/binding-linux-loong64-musl')
361
361
  const bindingPackageVersion = require('@oxc-parser/binding-linux-loong64-musl/package.json').version
362
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
364
  }
365
365
  return binding
366
366
  } catch (e) {
@@ -375,8 +375,8 @@ function requireNative() {
375
375
  try {
376
376
  const binding = require('@oxc-parser/binding-linux-loong64-gnu')
377
377
  const bindingPackageVersion = require('@oxc-parser/binding-linux-loong64-gnu/package.json').version
378
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
380
  }
381
381
  return binding
382
382
  } catch (e) {
@@ -393,8 +393,8 @@ function requireNative() {
393
393
  try {
394
394
  const binding = require('@oxc-parser/binding-linux-riscv64-musl')
395
395
  const bindingPackageVersion = require('@oxc-parser/binding-linux-riscv64-musl/package.json').version
396
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
398
  }
399
399
  return binding
400
400
  } catch (e) {
@@ -409,8 +409,8 @@ function requireNative() {
409
409
  try {
410
410
  const binding = require('@oxc-parser/binding-linux-riscv64-gnu')
411
411
  const bindingPackageVersion = require('@oxc-parser/binding-linux-riscv64-gnu/package.json').version
412
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
413
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
413
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
414
414
  }
415
415
  return binding
416
416
  } catch (e) {
@@ -426,8 +426,8 @@ function requireNative() {
426
426
  try {
427
427
  const binding = require('@oxc-parser/binding-linux-ppc64-gnu')
428
428
  const bindingPackageVersion = require('@oxc-parser/binding-linux-ppc64-gnu/package.json').version
429
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
429
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
431
431
  }
432
432
  return binding
433
433
  } catch (e) {
@@ -442,8 +442,8 @@ function requireNative() {
442
442
  try {
443
443
  const binding = require('@oxc-parser/binding-linux-s390x-gnu')
444
444
  const bindingPackageVersion = require('@oxc-parser/binding-linux-s390x-gnu/package.json').version
445
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
446
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
446
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
447
  }
448
448
  return binding
449
449
  } catch (e) {
@@ -462,8 +462,8 @@ function requireNative() {
462
462
  try {
463
463
  const binding = require('@oxc-parser/binding-openharmony-arm64')
464
464
  const bindingPackageVersion = require('@oxc-parser/binding-openharmony-arm64/package.json').version
465
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
466
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
466
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
467
467
  }
468
468
  return binding
469
469
  } catch (e) {
@@ -478,8 +478,8 @@ function requireNative() {
478
478
  try {
479
479
  const binding = require('@oxc-parser/binding-openharmony-x64')
480
480
  const bindingPackageVersion = require('@oxc-parser/binding-openharmony-x64/package.json').version
481
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
482
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
482
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
483
483
  }
484
484
  return binding
485
485
  } catch (e) {
@@ -494,8 +494,8 @@ function requireNative() {
494
494
  try {
495
495
  const binding = require('@oxc-parser/binding-openharmony-arm')
496
496
  const bindingPackageVersion = require('@oxc-parser/binding-openharmony-arm/package.json').version
497
- if (bindingPackageVersion !== '0.91.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
498
- throw new Error(`Native binding package version mismatch, expected 0.91.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
+ if (bindingPackageVersion !== '0.92.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
498
+ throw new Error(`Native binding package version mismatch, expected 0.92.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
499
499
  }
500
500
  return binding
501
501
  } catch (e) {
@@ -542,7 +542,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
542
542
 
543
543
  if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
544
544
  try {
545
- nativeBinding = require('./webcontainer-fallback.js');
545
+ nativeBinding = require('./webcontainer-fallback.cjs');
546
546
  } catch (err) {
547
547
  loadErrors.push(err)
548
548
  }
package/src-js/index.d.ts CHANGED
@@ -8,6 +8,8 @@ export * from '@oxc-project/types';
8
8
 
9
9
  export { VisitorObject };
10
10
 
11
+ export const visitorKeys: Record<string, string[]>;
12
+
11
13
  export class Visitor {
12
14
  constructor(visitor: VisitorObject);
13
15
  visit(program: Program): void;
@@ -1,9 +1,9 @@
1
1
  import { createRequire } from 'node:module';
2
- import { parseAsync as parseAsyncBinding, parseSync as parseSyncBinding } from './bindings.mjs';
3
- import { wrap } from './wrap.mjs';
2
+ import { parseAsync as parseAsyncBinding, parseSync as parseSyncBinding } from './bindings.js';
3
+ import { wrap } from './wrap.js';
4
4
 
5
- export { default as visitorKeys } from '../generated/visit/keys.mjs';
6
- export { Visitor } from './visit/index.mjs';
5
+ export { default as visitorKeys } from '../generated/visit/keys.js';
6
+ export { Visitor } from './visit/index.js';
7
7
 
8
8
  export {
9
9
  ExportExportNameKind,
@@ -12,8 +12,8 @@ export {
12
12
  ImportNameKind,
13
13
  ParseResult,
14
14
  Severity,
15
- } from './bindings.mjs';
16
- export { rawTransferSupported } from './raw-transfer/supported.mjs';
15
+ } from './bindings.js';
16
+ export { rawTransferSupported } from './raw-transfer/supported.js';
17
17
 
18
18
  const require = createRequire(import.meta.url);
19
19
 
@@ -30,7 +30,7 @@ let parseSyncRaw = null,
30
30
  */
31
31
  function loadRawTransfer() {
32
32
  if (parseSyncRaw === null) {
33
- ({ parseSyncRaw, parseAsyncRaw } = require('./raw-transfer/eager.mjs'));
33
+ ({ parseSyncRaw, parseAsyncRaw } = require('./raw-transfer/eager.js'));
34
34
  }
35
35
  }
36
36
 
@@ -40,7 +40,7 @@ function loadRawTransfer() {
40
40
  */
41
41
  function loadRawTransferLazy() {
42
42
  if (parseSyncLazy === null) {
43
- ({ parseSyncLazy, parseAsyncLazy, Visitor: LazyVisitor } = require('./raw-transfer/lazy.mjs'));
43
+ ({ parseSyncLazy, parseAsyncLazy, Visitor: LazyVisitor } = require('./raw-transfer/lazy.js'));
44
44
  }
45
45
  }
46
46
 
@@ -1,11 +1,11 @@
1
1
  import os from 'node:os';
2
- import { BUFFER_ALIGN, BUFFER_SIZE, IS_TS_FLAG_POS } from '../../generated/constants.mjs';
2
+ import { BUFFER_ALIGN, BUFFER_SIZE, IS_TS_FLAG_POS } from '../../generated/constants.js';
3
3
  import {
4
4
  getBufferOffset,
5
5
  parseAsyncRaw as parseAsyncRawBinding,
6
6
  parseSyncRaw as parseSyncRawBinding,
7
- } from '../bindings.mjs';
8
- import { rawTransferSupported } from './supported.mjs';
7
+ } from '../bindings.js';
8
+ import { rawTransferSupported } from './supported.js';
9
9
 
10
10
  // Throw an error if running on a platform which raw transfer doesn't support.
11
11
  //
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'node:module';
2
- import { isJsAst, parseAsyncRawImpl, parseSyncRawImpl, returnBufferToCache } from './common.mjs';
2
+ import { isJsAst, parseAsyncRawImpl, parseSyncRawImpl, returnBufferToCache } from './common.js';
3
3
 
4
4
  const require = createRequire(import.meta.url);
5
5
 
@@ -55,7 +55,7 @@ function deserialize(buffer, sourceText, sourceByteLen) {
55
55
  // Lazy load deserializer, and deserialize buffer to JS objects
56
56
  let data;
57
57
  if (isJsAst(buffer)) {
58
- if (deserializeJS === null) deserializeJS = require('../../generated/deserialize/js.mjs').deserialize;
58
+ if (deserializeJS === null) deserializeJS = require('../../generated/deserialize/js.js').deserialize;
59
59
 
60
60
  // `preserveParens` argument is unconditionally `true` here. If `options` contains `preserveParens: false`,
61
61
  // `ParenthesizedExpression` nodes won't be in AST anyway, so the value is irrelevant.
@@ -67,7 +67,7 @@ function deserialize(buffer, sourceText, sourceByteLen) {
67
67
  data.comments.unshift({ type: 'Line', value: hashbang.value, start: hashbang.start, end: hashbang.end });
68
68
  }
69
69
  } else {
70
- if (deserializeTS === null) deserializeTS = require('../../generated/deserialize/ts.mjs').deserialize;
70
+ if (deserializeTS === null) deserializeTS = require('../../generated/deserialize/ts.js').deserialize;
71
71
 
72
72
  // `preserveParens` argument is unconditionally `true` here. If `options` contains `preserveParens: false`,
73
73
  // `ParenthesizedExpression` nodes won't be in AST anyway, so the value is irrelevant.
@@ -1,10 +1,10 @@
1
- import { DATA_POINTER_POS_32, PROGRAM_OFFSET } from '../../generated/constants.mjs';
2
- import { RawTransferData } from '../../generated/lazy/constructors.mjs';
3
- import { walkProgram } from '../../generated/lazy/walk.mjs';
4
- import { parseAsyncRawImpl, parseSyncRawImpl, returnBufferToCache } from './common.mjs';
5
- import { TOKEN } from './lazy-common.mjs';
6
- import { getVisitorsArr } from './visitor.mjs';
7
- export { Visitor } from './visitor.mjs';
1
+ import { DATA_POINTER_POS_32, PROGRAM_OFFSET } from '../../generated/constants.js';
2
+ import { RawTransferData } from '../../generated/lazy/constructors.js';
3
+ import { walkProgram } from '../../generated/lazy/walk.js';
4
+ import { parseAsyncRawImpl, parseSyncRawImpl, returnBufferToCache } from './common.js';
5
+ import { TOKEN } from './lazy-common.js';
6
+ import { getVisitorsArr } from './visitor.js';
7
+ export { Visitor } from './visitor.js';
8
8
 
9
9
  /**
10
10
  * Parse JS/TS source synchronously on current thread.
@@ -1,4 +1,4 @@
1
- import { constructorError, TOKEN } from './lazy-common.mjs';
1
+ import { constructorError, TOKEN } from './lazy-common.js';
2
2
 
3
3
  // Internal symbol to get `NodeArray` from a proxy wrapping a `NodeArray`.
4
4
  //
@@ -1,4 +1,4 @@
1
- import { rawTransferSupported as rawTransferSupportedBinding } from '../bindings.mjs';
1
+ import { rawTransferSupported as rawTransferSupportedBinding } from '../bindings.js';
2
2
 
3
3
  let rawTransferIsSupported = null;
4
4
 
@@ -1,4 +1,4 @@
1
- import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/lazy/types.mjs';
1
+ import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/lazy/types.js';
2
2
 
3
3
  // Getter for private `#visitorsArr` property of `Visitor` class. Initialized in class body below.
4
4
  let getVisitorsArrTemp;
@@ -12,8 +12,8 @@ export class Visitor {
12
12
  constructor(visitor) {
13
13
  if (walkProgram === null) {
14
14
  const require = createRequire(import.meta.url);
15
- ({ walkProgram } = require('../../generated/visit/walk.mjs'));
16
- ({ addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor } = require('./visitor.mjs'));
15
+ ({ walkProgram } = require('../../generated/visit/walk.js'));
16
+ ({ addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor } = require('./visitor.js'));
17
17
  }
18
18
 
19
19
  const compiledVisitor = createCompiledVisitor();
@@ -74,7 +74,7 @@
74
74
 
75
75
  // TODO(camc314): we need to generate `.d.ts` file for this module.
76
76
  // @ts-expect-error
77
- import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/visit/types.mjs';
77
+ import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/visit/types.js';
78
78
 
79
79
  const { isArray } = Array;
80
80
 
@@ -1,6 +1,6 @@
1
1
  export * from '@oxc-parser/binding-wasm32-wasi';
2
2
  import * as bindings from '@oxc-parser/binding-wasm32-wasi';
3
- import { wrap } from './wrap.mjs';
3
+ import { wrap } from './wrap.js';
4
4
 
5
5
  export async function parseAsync(...args) {
6
6
  return wrap(await bindings.parseAsync(...args));
@@ -20,7 +20,7 @@ export function wrap(result) {
20
20
  };
21
21
  }
22
22
 
23
- // Used by `napi/playground/patch.mjs`.
23
+ // Used by `napi/playground/scripts/patch.js`.
24
24
  //
25
25
  // Set `value` field of `Literal`s which are `BigInt`s or `RegExp`s.
26
26
  //
File without changes
File without changes
File without changes
File without changes