oxc-parser 0.94.0 → 0.96.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/generated/deserialize/js.js +871 -1038
- package/generated/deserialize/js_range.js +250 -176
- package/generated/deserialize/ts.js +859 -1020
- package/generated/deserialize/ts_range.js +260 -188
- package/generated/lazy/constructors.js +119 -347
- package/generated/lazy/walk.js +581 -312
- package/generated/visit/walk.js +280 -140
- package/package.json +24 -23
- package/src-js/bindings.js +68 -50
- package/src-js/raw-transfer/common.js +2 -1
- package/src-js/raw-transfer/eager.js +1 -1
- package/src-js/raw-transfer/lazy.js +2 -3
- package/src-js/raw-transfer/node-array.js +3 -2
- package/src-js/raw-transfer/supported.js +1 -1
- package/src-js/raw-transfer/visitor.js +3 -3
- package/src-js/visit/index.js +4 -1
- package/src-js/visit/visitor.js +3 -4
- package/src-js/webcontainer-fallback.cjs +1 -3
- package/src-js/wrap.js +1 -1
- /package/generated/lazy/{types.js → type_ids.js} +0 -0
- /package/generated/visit/{types.js → type_ids.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src-js/index.js",
|
|
6
6
|
"browser": "src-js/wasm.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"generated/deserialize/js_range.js",
|
|
32
32
|
"generated/deserialize/ts_range.js",
|
|
33
33
|
"generated/lazy/constructors.js",
|
|
34
|
-
"generated/lazy/
|
|
34
|
+
"generated/lazy/type_ids.js",
|
|
35
35
|
"generated/lazy/walk.js",
|
|
36
36
|
"generated/visit/keys.js",
|
|
37
|
-
"generated/visit/
|
|
37
|
+
"generated/visit/type_ids.js",
|
|
38
38
|
"generated/visit/visitor.d.ts",
|
|
39
39
|
"generated/visit/walk.js",
|
|
40
40
|
"src-js/bindings.js",
|
|
@@ -58,18 +58,19 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@oxc-project/types": "^0.
|
|
61
|
+
"@oxc-project/types": "^0.96.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@codspeed/vitest-plugin": "^5.0.0",
|
|
65
|
-
"@napi-rs/wasm-runtime": "1.0.
|
|
65
|
+
"@napi-rs/wasm-runtime": "1.0.7",
|
|
66
66
|
"@typescript-eslint/visitor-keys": "^8.44.0",
|
|
67
|
-
"@vitest/browser": "
|
|
67
|
+
"@vitest/browser": "4.0.3",
|
|
68
|
+
"@vitest/browser-playwright": "4.0.3",
|
|
68
69
|
"esbuild": "^0.25.0",
|
|
69
70
|
"playwright": "^1.51.0",
|
|
70
71
|
"tinypool": "^2.0.0",
|
|
71
|
-
"typescript": "5.9.
|
|
72
|
-
"vitest": "
|
|
72
|
+
"typescript": "5.9.3",
|
|
73
|
+
"vitest": "4.0.3"
|
|
73
74
|
},
|
|
74
75
|
"napi": {
|
|
75
76
|
"binaryName": "parser",
|
|
@@ -99,21 +100,21 @@
|
|
|
99
100
|
"dtsHeaderFile": "src-js/header.d.ts"
|
|
100
101
|
},
|
|
101
102
|
"optionalDependencies": {
|
|
102
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.
|
|
103
|
-
"@oxc-parser/binding-win32-arm64-msvc": "0.
|
|
104
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.
|
|
105
|
-
"@oxc-parser/binding-linux-x64-musl": "0.
|
|
106
|
-
"@oxc-parser/binding-freebsd-x64": "0.
|
|
107
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.
|
|
108
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.
|
|
109
|
-
"@oxc-parser/binding-linux-arm-gnueabihf": "0.
|
|
110
|
-
"@oxc-parser/binding-linux-arm-musleabihf": "0.
|
|
111
|
-
"@oxc-parser/binding-linux-s390x-gnu": "0.
|
|
112
|
-
"@oxc-parser/binding-linux-riscv64-gnu": "0.
|
|
113
|
-
"@oxc-parser/binding-darwin-x64": "0.
|
|
114
|
-
"@oxc-parser/binding-darwin-arm64": "0.
|
|
115
|
-
"@oxc-parser/binding-android-arm64": "0.
|
|
116
|
-
"@oxc-parser/binding-wasm32-wasi": "0.
|
|
103
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.96.0",
|
|
104
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.96.0",
|
|
105
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.96.0",
|
|
106
|
+
"@oxc-parser/binding-linux-x64-musl": "0.96.0",
|
|
107
|
+
"@oxc-parser/binding-freebsd-x64": "0.96.0",
|
|
108
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.96.0",
|
|
109
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.96.0",
|
|
110
|
+
"@oxc-parser/binding-linux-arm-gnueabihf": "0.96.0",
|
|
111
|
+
"@oxc-parser/binding-linux-arm-musleabihf": "0.96.0",
|
|
112
|
+
"@oxc-parser/binding-linux-s390x-gnu": "0.96.0",
|
|
113
|
+
"@oxc-parser/binding-linux-riscv64-gnu": "0.96.0",
|
|
114
|
+
"@oxc-parser/binding-darwin-x64": "0.96.0",
|
|
115
|
+
"@oxc-parser/binding-darwin-arm64": "0.96.0",
|
|
116
|
+
"@oxc-parser/binding-android-arm64": "0.96.0",
|
|
117
|
+
"@oxc-parser/binding-wasm32-wasi": "0.96.0"
|
|
117
118
|
},
|
|
118
119
|
"scripts": {
|
|
119
120
|
"build-dev": "napi build --esm --platform --js bindings.js --dts index.d.ts --output-dir src-js",
|
package/src-js/bindings.js
CHANGED
|
@@ -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.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
84
|
+
if (bindingPackageVersion !== '0.96.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.96.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.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
100
|
+
if (bindingPackageVersion !== '0.96.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.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
102
|
}
|
|
103
103
|
return binding
|
|
104
104
|
} catch (e) {
|
|
@@ -109,7 +109,24 @@ function requireNative() {
|
|
|
109
109
|
}
|
|
110
110
|
} else if (process.platform === 'win32') {
|
|
111
111
|
if (process.arch === 'x64') {
|
|
112
|
+
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
|
113
|
+
try {
|
|
114
|
+
return require('./parser.win32-x64-gnu.node')
|
|
115
|
+
} catch (e) {
|
|
116
|
+
loadErrors.push(e)
|
|
117
|
+
}
|
|
112
118
|
try {
|
|
119
|
+
const binding = require('@oxc-parser/binding-win32-x64-gnu')
|
|
120
|
+
const bindingPackageVersion = require('@oxc-parser/binding-win32-x64-gnu/package.json').version
|
|
121
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
122
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
|
+
}
|
|
124
|
+
return binding
|
|
125
|
+
} catch (e) {
|
|
126
|
+
loadErrors.push(e)
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
try {
|
|
113
130
|
return require('./parser.win32-x64-msvc.node')
|
|
114
131
|
} catch (e) {
|
|
115
132
|
loadErrors.push(e)
|
|
@@ -117,13 +134,14 @@ function requireNative() {
|
|
|
117
134
|
try {
|
|
118
135
|
const binding = require('@oxc-parser/binding-win32-x64-msvc')
|
|
119
136
|
const bindingPackageVersion = require('@oxc-parser/binding-win32-x64-msvc/package.json').version
|
|
120
|
-
if (bindingPackageVersion !== '0.
|
|
121
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
137
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
138
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
122
139
|
}
|
|
123
140
|
return binding
|
|
124
141
|
} catch (e) {
|
|
125
142
|
loadErrors.push(e)
|
|
126
143
|
}
|
|
144
|
+
}
|
|
127
145
|
} else if (process.arch === 'ia32') {
|
|
128
146
|
try {
|
|
129
147
|
return require('./parser.win32-ia32-msvc.node')
|
|
@@ -133,8 +151,8 @@ function requireNative() {
|
|
|
133
151
|
try {
|
|
134
152
|
const binding = require('@oxc-parser/binding-win32-ia32-msvc')
|
|
135
153
|
const bindingPackageVersion = require('@oxc-parser/binding-win32-ia32-msvc/package.json').version
|
|
136
|
-
if (bindingPackageVersion !== '0.
|
|
137
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
154
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
155
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
138
156
|
}
|
|
139
157
|
return binding
|
|
140
158
|
} catch (e) {
|
|
@@ -149,8 +167,8 @@ function requireNative() {
|
|
|
149
167
|
try {
|
|
150
168
|
const binding = require('@oxc-parser/binding-win32-arm64-msvc')
|
|
151
169
|
const bindingPackageVersion = require('@oxc-parser/binding-win32-arm64-msvc/package.json').version
|
|
152
|
-
if (bindingPackageVersion !== '0.
|
|
153
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
170
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
154
172
|
}
|
|
155
173
|
return binding
|
|
156
174
|
} catch (e) {
|
|
@@ -168,8 +186,8 @@ function requireNative() {
|
|
|
168
186
|
try {
|
|
169
187
|
const binding = require('@oxc-parser/binding-darwin-universal')
|
|
170
188
|
const bindingPackageVersion = require('@oxc-parser/binding-darwin-universal/package.json').version
|
|
171
|
-
if (bindingPackageVersion !== '0.
|
|
172
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
189
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
190
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
173
191
|
}
|
|
174
192
|
return binding
|
|
175
193
|
} catch (e) {
|
|
@@ -184,8 +202,8 @@ function requireNative() {
|
|
|
184
202
|
try {
|
|
185
203
|
const binding = require('@oxc-parser/binding-darwin-x64')
|
|
186
204
|
const bindingPackageVersion = require('@oxc-parser/binding-darwin-x64/package.json').version
|
|
187
|
-
if (bindingPackageVersion !== '0.
|
|
188
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
205
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
206
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
189
207
|
}
|
|
190
208
|
return binding
|
|
191
209
|
} catch (e) {
|
|
@@ -200,8 +218,8 @@ function requireNative() {
|
|
|
200
218
|
try {
|
|
201
219
|
const binding = require('@oxc-parser/binding-darwin-arm64')
|
|
202
220
|
const bindingPackageVersion = require('@oxc-parser/binding-darwin-arm64/package.json').version
|
|
203
|
-
if (bindingPackageVersion !== '0.
|
|
204
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
221
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
222
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
205
223
|
}
|
|
206
224
|
return binding
|
|
207
225
|
} catch (e) {
|
|
@@ -220,8 +238,8 @@ function requireNative() {
|
|
|
220
238
|
try {
|
|
221
239
|
const binding = require('@oxc-parser/binding-freebsd-x64')
|
|
222
240
|
const bindingPackageVersion = require('@oxc-parser/binding-freebsd-x64/package.json').version
|
|
223
|
-
if (bindingPackageVersion !== '0.
|
|
224
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
241
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
225
243
|
}
|
|
226
244
|
return binding
|
|
227
245
|
} catch (e) {
|
|
@@ -236,8 +254,8 @@ function requireNative() {
|
|
|
236
254
|
try {
|
|
237
255
|
const binding = require('@oxc-parser/binding-freebsd-arm64')
|
|
238
256
|
const bindingPackageVersion = require('@oxc-parser/binding-freebsd-arm64/package.json').version
|
|
239
|
-
if (bindingPackageVersion !== '0.
|
|
240
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
257
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
258
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
241
259
|
}
|
|
242
260
|
return binding
|
|
243
261
|
} catch (e) {
|
|
@@ -257,8 +275,8 @@ function requireNative() {
|
|
|
257
275
|
try {
|
|
258
276
|
const binding = require('@oxc-parser/binding-linux-x64-musl')
|
|
259
277
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-x64-musl/package.json').version
|
|
260
|
-
if (bindingPackageVersion !== '0.
|
|
261
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
278
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
279
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
262
280
|
}
|
|
263
281
|
return binding
|
|
264
282
|
} catch (e) {
|
|
@@ -273,8 +291,8 @@ function requireNative() {
|
|
|
273
291
|
try {
|
|
274
292
|
const binding = require('@oxc-parser/binding-linux-x64-gnu')
|
|
275
293
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-x64-gnu/package.json').version
|
|
276
|
-
if (bindingPackageVersion !== '0.
|
|
277
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
294
|
+
if (bindingPackageVersion !== '0.96.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.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
278
296
|
}
|
|
279
297
|
return binding
|
|
280
298
|
} catch (e) {
|
|
@@ -291,8 +309,8 @@ function requireNative() {
|
|
|
291
309
|
try {
|
|
292
310
|
const binding = require('@oxc-parser/binding-linux-arm64-musl')
|
|
293
311
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-arm64-musl/package.json').version
|
|
294
|
-
if (bindingPackageVersion !== '0.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
312
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
313
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
314
|
}
|
|
297
315
|
return binding
|
|
298
316
|
} catch (e) {
|
|
@@ -307,8 +325,8 @@ function requireNative() {
|
|
|
307
325
|
try {
|
|
308
326
|
const binding = require('@oxc-parser/binding-linux-arm64-gnu')
|
|
309
327
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-arm64-gnu/package.json').version
|
|
310
|
-
if (bindingPackageVersion !== '0.
|
|
311
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
328
|
+
if (bindingPackageVersion !== '0.96.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.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
312
330
|
}
|
|
313
331
|
return binding
|
|
314
332
|
} catch (e) {
|
|
@@ -325,8 +343,8 @@ function requireNative() {
|
|
|
325
343
|
try {
|
|
326
344
|
const binding = require('@oxc-parser/binding-linux-arm-musleabihf')
|
|
327
345
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-arm-musleabihf/package.json').version
|
|
328
|
-
if (bindingPackageVersion !== '0.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
346
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
347
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
348
|
}
|
|
331
349
|
return binding
|
|
332
350
|
} catch (e) {
|
|
@@ -341,8 +359,8 @@ function requireNative() {
|
|
|
341
359
|
try {
|
|
342
360
|
const binding = require('@oxc-parser/binding-linux-arm-gnueabihf')
|
|
343
361
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-arm-gnueabihf/package.json').version
|
|
344
|
-
if (bindingPackageVersion !== '0.
|
|
345
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
362
|
+
if (bindingPackageVersion !== '0.96.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.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
346
364
|
}
|
|
347
365
|
return binding
|
|
348
366
|
} catch (e) {
|
|
@@ -359,8 +377,8 @@ function requireNative() {
|
|
|
359
377
|
try {
|
|
360
378
|
const binding = require('@oxc-parser/binding-linux-loong64-musl')
|
|
361
379
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-loong64-musl/package.json').version
|
|
362
|
-
if (bindingPackageVersion !== '0.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
380
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
381
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
382
|
}
|
|
365
383
|
return binding
|
|
366
384
|
} catch (e) {
|
|
@@ -375,8 +393,8 @@ function requireNative() {
|
|
|
375
393
|
try {
|
|
376
394
|
const binding = require('@oxc-parser/binding-linux-loong64-gnu')
|
|
377
395
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-loong64-gnu/package.json').version
|
|
378
|
-
if (bindingPackageVersion !== '0.
|
|
379
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
396
|
+
if (bindingPackageVersion !== '0.96.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.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
380
398
|
}
|
|
381
399
|
return binding
|
|
382
400
|
} catch (e) {
|
|
@@ -393,8 +411,8 @@ function requireNative() {
|
|
|
393
411
|
try {
|
|
394
412
|
const binding = require('@oxc-parser/binding-linux-riscv64-musl')
|
|
395
413
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-riscv64-musl/package.json').version
|
|
396
|
-
if (bindingPackageVersion !== '0.
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
414
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
415
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
416
|
}
|
|
399
417
|
return binding
|
|
400
418
|
} catch (e) {
|
|
@@ -409,8 +427,8 @@ function requireNative() {
|
|
|
409
427
|
try {
|
|
410
428
|
const binding = require('@oxc-parser/binding-linux-riscv64-gnu')
|
|
411
429
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-riscv64-gnu/package.json').version
|
|
412
|
-
if (bindingPackageVersion !== '0.
|
|
413
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
430
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
431
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
414
432
|
}
|
|
415
433
|
return binding
|
|
416
434
|
} catch (e) {
|
|
@@ -426,8 +444,8 @@ function requireNative() {
|
|
|
426
444
|
try {
|
|
427
445
|
const binding = require('@oxc-parser/binding-linux-ppc64-gnu')
|
|
428
446
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-ppc64-gnu/package.json').version
|
|
429
|
-
if (bindingPackageVersion !== '0.
|
|
430
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
447
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
448
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
431
449
|
}
|
|
432
450
|
return binding
|
|
433
451
|
} catch (e) {
|
|
@@ -442,8 +460,8 @@ function requireNative() {
|
|
|
442
460
|
try {
|
|
443
461
|
const binding = require('@oxc-parser/binding-linux-s390x-gnu')
|
|
444
462
|
const bindingPackageVersion = require('@oxc-parser/binding-linux-s390x-gnu/package.json').version
|
|
445
|
-
if (bindingPackageVersion !== '0.
|
|
446
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
463
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
464
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
447
465
|
}
|
|
448
466
|
return binding
|
|
449
467
|
} catch (e) {
|
|
@@ -462,8 +480,8 @@ function requireNative() {
|
|
|
462
480
|
try {
|
|
463
481
|
const binding = require('@oxc-parser/binding-openharmony-arm64')
|
|
464
482
|
const bindingPackageVersion = require('@oxc-parser/binding-openharmony-arm64/package.json').version
|
|
465
|
-
if (bindingPackageVersion !== '0.
|
|
466
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
483
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
484
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
467
485
|
}
|
|
468
486
|
return binding
|
|
469
487
|
} catch (e) {
|
|
@@ -478,8 +496,8 @@ function requireNative() {
|
|
|
478
496
|
try {
|
|
479
497
|
const binding = require('@oxc-parser/binding-openharmony-x64')
|
|
480
498
|
const bindingPackageVersion = require('@oxc-parser/binding-openharmony-x64/package.json').version
|
|
481
|
-
if (bindingPackageVersion !== '0.
|
|
482
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
499
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
500
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
483
501
|
}
|
|
484
502
|
return binding
|
|
485
503
|
} catch (e) {
|
|
@@ -494,8 +512,8 @@ function requireNative() {
|
|
|
494
512
|
try {
|
|
495
513
|
const binding = require('@oxc-parser/binding-openharmony-arm')
|
|
496
514
|
const bindingPackageVersion = require('@oxc-parser/binding-openharmony-arm/package.json').version
|
|
497
|
-
if (bindingPackageVersion !== '0.
|
|
498
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
515
|
+
if (bindingPackageVersion !== '0.96.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
516
|
+
throw new Error(`Native binding package version mismatch, expected 0.96.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
499
517
|
}
|
|
500
518
|
return binding
|
|
501
519
|
} catch (e) {
|
|
@@ -164,7 +164,8 @@ const ONE_GIB = 1 << 30;
|
|
|
164
164
|
// freed. We don't want to block it from freeing memory, but if it's not done that yet, there's no
|
|
165
165
|
// point creating a new buffer, when one already exists.
|
|
166
166
|
const CLEAR_BUFFERS_TIMEOUT = 10_000; // 10 seconds
|
|
167
|
-
const buffers = [],
|
|
167
|
+
const buffers = [],
|
|
168
|
+
oldBuffers = [];
|
|
168
169
|
let clearBuffersTimeout = null;
|
|
169
170
|
|
|
170
171
|
const textEncoder = new TextEncoder();
|
|
@@ -71,7 +71,7 @@ function deserialize(buffer, sourceText, sourceByteLen, options) {
|
|
|
71
71
|
parent = !!options.experimentalParent;
|
|
72
72
|
|
|
73
73
|
// Lazy load deserializer, and deserialize buffer to JS objects
|
|
74
|
-
const deserializerIndex =
|
|
74
|
+
const deserializerIndex = +isJs | (+range << 1) | (+parent << 2);
|
|
75
75
|
let deserializeThis = deserializers[deserializerIndex];
|
|
76
76
|
if (deserializeThis === null) {
|
|
77
77
|
deserializeThis = deserializers[deserializerIndex] = require(
|
|
@@ -75,9 +75,8 @@ export function parseAsyncLazy(filename, sourceText, options) {
|
|
|
75
75
|
// which don't support it. e.g. Prettier supports NodeJS v14.
|
|
76
76
|
// Raw transfer is disabled on NodeJS before v22, so it doesn't matter if this is `null` on old NodeJS
|
|
77
77
|
// - it'll never be accessed in that case.
|
|
78
|
-
const bufferRecycleRegistry =
|
|
79
|
-
? null
|
|
80
|
-
: new FinalizationRegistry(returnBufferToCache);
|
|
78
|
+
const bufferRecycleRegistry =
|
|
79
|
+
typeof FinalizationRegistry === 'undefined' ? null : new FinalizationRegistry(returnBufferToCache);
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
82
|
* Get an object with getters which lazy deserialize AST and other data from buffer.
|
|
@@ -125,14 +125,14 @@ export class NodeArray extends Array {
|
|
|
125
125
|
* @param {Proxy} proxy - Proxy wrapping `NodeArray` object
|
|
126
126
|
* @returns {Object} - Internal properties object
|
|
127
127
|
*/
|
|
128
|
-
getInternalFromProxy = proxy => proxy[ARRAY].#internal;
|
|
128
|
+
getInternalFromProxy = (proxy) => proxy[ARRAY].#internal;
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Get length of `NodeArray`.
|
|
132
132
|
* @param {NodeArray} arr - `NodeArray` object
|
|
133
133
|
* @returns {number} - Array length
|
|
134
134
|
*/
|
|
135
|
-
getLength = arr => arr.#internal.length;
|
|
135
|
+
getLength = (arr) => arr.#internal.length;
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* Get element of `NodeArray` at index `index`.
|
|
@@ -149,6 +149,7 @@ export class NodeArray extends Array {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
// oxlint-disable-next-line typescript/unbound-method
|
|
152
153
|
NodeArray.prototype[Symbol.iterator] = NodeArray.prototype.values;
|
|
153
154
|
|
|
154
155
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/lazy/
|
|
1
|
+
import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/lazy/type_ids.js';
|
|
2
2
|
|
|
3
3
|
// Getter for private `#visitorsArr` property of `Visitor` class. Initialized in class body below.
|
|
4
4
|
let getVisitorsArrTemp;
|
|
@@ -37,7 +37,7 @@ export class Visitor {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
static {
|
|
40
|
-
getVisitorsArrTemp = visitor => visitor.#visitorsArr;
|
|
40
|
+
getVisitorsArrTemp = (visitor) => visitor.#visitorsArr;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -116,7 +116,7 @@ function createVisitorsArr(visitor) {
|
|
|
116
116
|
* @returns {function} - Combined visitor function
|
|
117
117
|
*/
|
|
118
118
|
function combineVisitFunctions(visit1, visit2) {
|
|
119
|
-
return function(node) {
|
|
119
|
+
return function (node) {
|
|
120
120
|
visit1(node);
|
|
121
121
|
visit2(node);
|
|
122
122
|
};
|
package/src-js/visit/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
|
|
3
3
|
// Lazy-loaded when first construct a `Visitor`
|
|
4
|
-
let walkProgram = null,
|
|
4
|
+
let walkProgram = null,
|
|
5
|
+
addVisitorToCompiled,
|
|
6
|
+
createCompiledVisitor,
|
|
7
|
+
finalizeCompiledVisitor;
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Visitor class for traversing AST.
|
package/src-js/visit/visitor.js
CHANGED
|
@@ -72,9 +72,7 @@
|
|
|
72
72
|
// for objects created by user code in visitors. If ephemeral user-created objects all fit in new space,
|
|
73
73
|
// it will avoid full GC runs, which should greatly improve performance.
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
// @ts-expect-error
|
|
77
|
-
import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/visit/types.js';
|
|
75
|
+
import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../../generated/visit/type_ids.js';
|
|
78
76
|
|
|
79
77
|
const { isArray } = Array;
|
|
80
78
|
|
|
@@ -242,7 +240,7 @@ export function addVisitorToCompiled(visitor) {
|
|
|
242
240
|
} else {
|
|
243
241
|
// Not leaf node - store enter+exit pair
|
|
244
242
|
if (existing === null) {
|
|
245
|
-
const enterExit = compiledVisitor[typeId] = getEnterExitObject();
|
|
243
|
+
const enterExit = (compiledVisitor[typeId] = getEnterExitObject());
|
|
246
244
|
if (isExit) {
|
|
247
245
|
enterExit.exit = visitFn;
|
|
248
246
|
} else {
|
|
@@ -370,6 +368,7 @@ function createMerger(fnCount) {
|
|
|
370
368
|
}
|
|
371
369
|
body += '}';
|
|
372
370
|
args.push(body);
|
|
371
|
+
// oxlint-disable-next-line typescript/no-implied-eval
|
|
373
372
|
return new Function(...args);
|
|
374
373
|
}
|
|
375
374
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
const fs = require('node:fs');
|
|
2
2
|
const childProcess = require('node:child_process');
|
|
3
3
|
|
|
4
|
-
const pkg = JSON.parse(
|
|
5
|
-
fs.readFileSync(require.resolve('oxc-parser/package.json'), 'utf-8'),
|
|
6
|
-
);
|
|
4
|
+
const pkg = JSON.parse(fs.readFileSync(require.resolve('oxc-parser/package.json'), 'utf-8'));
|
|
7
5
|
const version = pkg.version;
|
|
8
6
|
const baseDir = `/tmp/oxc-parser-${version}`;
|
|
9
7
|
const bindingEntry = `${baseDir}/node_modules/@oxc-parser/binding-wasm32-wasi/parser.wasi.cjs`;
|
package/src-js/wrap.js
CHANGED
|
@@ -50,7 +50,7 @@ function applyFix(program, fixPath) {
|
|
|
50
50
|
} else {
|
|
51
51
|
try {
|
|
52
52
|
node.value = RegExp(node.regex.pattern, node.regex.flags);
|
|
53
|
-
} catch
|
|
53
|
+
} catch {
|
|
54
54
|
// Invalid regexp, or valid regexp using syntax not supported by this version of NodeJS
|
|
55
55
|
}
|
|
56
56
|
}
|
|
File without changes
|
|
File without changes
|