@systemfsoftware/stryker-js-vitest-runner 6.0.0 → 7.0.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.
@@ -0,0 +1,1009 @@
1
+ import { createRequire } from "node:module";
2
+ import { createRequire as createRequire$1 } from "module";
3
+ //#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/bindings.js
4
+ const require$1 = createRequire$1(import.meta.url);
5
+ new URL(".", import.meta.url).pathname;
6
+ const { readFileSync } = require$1("fs");
7
+ let nativeBinding = null;
8
+ const loadErrors = [];
9
+ const isMusl = () => {
10
+ let musl = false;
11
+ if (process.platform === "linux") {
12
+ musl = isMuslFromFilesystem();
13
+ if (musl === null) musl = isMuslFromReport();
14
+ if (musl === null) musl = isMuslFromChildProcess();
15
+ }
16
+ return musl;
17
+ };
18
+ const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
19
+ const isMuslFromFilesystem = () => {
20
+ try {
21
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
22
+ } catch {
23
+ return null;
24
+ }
25
+ };
26
+ const isMuslFromReport = () => {
27
+ let report = null;
28
+ if (process.report && typeof process.report.getReport === "function") {
29
+ process.report.excludeNetwork = true;
30
+ report = process.report.getReport();
31
+ }
32
+ if (!report) return null;
33
+ if (report.header && report.header.glibcVersionRuntime) return false;
34
+ if (Array.isArray(report.sharedObjects)) {
35
+ if (report.sharedObjects.some(isFileMusl)) return true;
36
+ }
37
+ return false;
38
+ };
39
+ const isMuslFromChildProcess = () => {
40
+ try {
41
+ return require$1("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
42
+ } catch (e) {
43
+ return false;
44
+ }
45
+ };
46
+ function requireNative() {
47
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
48
+ return require$1(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
49
+ } catch (err) {
50
+ loadErrors.push(err);
51
+ }
52
+ else if (process.platform === "android") {
53
+ if (process.arch === "arm64") {
54
+ try {
55
+ return require$1("./parser.android-arm64.node");
56
+ } catch (e) {
57
+ loadErrors.push(e);
58
+ }
59
+ try {
60
+ const binding = require$1("@oxc-parser/binding-android-arm64");
61
+ const bindingPackageVersion = require$1("@oxc-parser/binding-android-arm64/package.json").version;
62
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
63
+ return binding;
64
+ } catch (e) {
65
+ loadErrors.push(e);
66
+ }
67
+ } else if (process.arch === "arm") {
68
+ try {
69
+ return require$1("./parser.android-arm-eabi.node");
70
+ } catch (e) {
71
+ loadErrors.push(e);
72
+ }
73
+ try {
74
+ const binding = require$1("@oxc-parser/binding-android-arm-eabi");
75
+ const bindingPackageVersion = require$1("@oxc-parser/binding-android-arm-eabi/package.json").version;
76
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
77
+ return binding;
78
+ } catch (e) {
79
+ loadErrors.push(e);
80
+ }
81
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
82
+ } else if (process.platform === "win32") {
83
+ if (process.arch === "x64") {
84
+ if (process.config && process.config.variables && process.config.variables.shlib_suffix === "dll.a" || process.config && process.config.variables && process.config.variables.node_target_type === "shared_library") {
85
+ try {
86
+ return require$1("./parser.win32-x64-gnu.node");
87
+ } catch (e) {
88
+ loadErrors.push(e);
89
+ }
90
+ try {
91
+ const binding = require$1("@oxc-parser/binding-win32-x64-gnu");
92
+ const bindingPackageVersion = require$1("@oxc-parser/binding-win32-x64-gnu/package.json").version;
93
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
94
+ return binding;
95
+ } catch (e) {
96
+ loadErrors.push(e);
97
+ }
98
+ } else {
99
+ try {
100
+ return require$1("./parser.win32-x64-msvc.node");
101
+ } catch (e) {
102
+ loadErrors.push(e);
103
+ }
104
+ try {
105
+ const binding = require$1("@oxc-parser/binding-win32-x64-msvc");
106
+ const bindingPackageVersion = require$1("@oxc-parser/binding-win32-x64-msvc/package.json").version;
107
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
108
+ return binding;
109
+ } catch (e) {
110
+ loadErrors.push(e);
111
+ }
112
+ }
113
+ } else if (process.arch === "ia32") {
114
+ try {
115
+ return require$1("./parser.win32-ia32-msvc.node");
116
+ } catch (e) {
117
+ loadErrors.push(e);
118
+ }
119
+ try {
120
+ const binding = require$1("@oxc-parser/binding-win32-ia32-msvc");
121
+ const bindingPackageVersion = require$1("@oxc-parser/binding-win32-ia32-msvc/package.json").version;
122
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
123
+ return binding;
124
+ } catch (e) {
125
+ loadErrors.push(e);
126
+ }
127
+ } else if (process.arch === "arm64") {
128
+ try {
129
+ return require$1("./parser.win32-arm64-msvc.node");
130
+ } catch (e) {
131
+ loadErrors.push(e);
132
+ }
133
+ try {
134
+ const binding = require$1("@oxc-parser/binding-win32-arm64-msvc");
135
+ const bindingPackageVersion = require$1("@oxc-parser/binding-win32-arm64-msvc/package.json").version;
136
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
137
+ return binding;
138
+ } catch (e) {
139
+ loadErrors.push(e);
140
+ }
141
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
142
+ } else if (process.platform === "darwin") {
143
+ try {
144
+ return require$1("./parser.darwin-universal.node");
145
+ } catch (e) {
146
+ loadErrors.push(e);
147
+ }
148
+ try {
149
+ const binding = require$1("@oxc-parser/binding-darwin-universal");
150
+ const bindingPackageVersion = require$1("@oxc-parser/binding-darwin-universal/package.json").version;
151
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
152
+ return binding;
153
+ } catch (e) {
154
+ loadErrors.push(e);
155
+ }
156
+ if (process.arch === "x64") {
157
+ try {
158
+ return require$1("./parser.darwin-x64.node");
159
+ } catch (e) {
160
+ loadErrors.push(e);
161
+ }
162
+ try {
163
+ const binding = require$1("@oxc-parser/binding-darwin-x64");
164
+ const bindingPackageVersion = require$1("@oxc-parser/binding-darwin-x64/package.json").version;
165
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
166
+ return binding;
167
+ } catch (e) {
168
+ loadErrors.push(e);
169
+ }
170
+ } else if (process.arch === "arm64") {
171
+ try {
172
+ return require$1("./parser.darwin-arm64.node");
173
+ } catch (e) {
174
+ loadErrors.push(e);
175
+ }
176
+ try {
177
+ const binding = require$1("@oxc-parser/binding-darwin-arm64");
178
+ const bindingPackageVersion = require$1("@oxc-parser/binding-darwin-arm64/package.json").version;
179
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
180
+ return binding;
181
+ } catch (e) {
182
+ loadErrors.push(e);
183
+ }
184
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
185
+ } else if (process.platform === "freebsd") {
186
+ if (process.arch === "x64") {
187
+ try {
188
+ return require$1("./parser.freebsd-x64.node");
189
+ } catch (e) {
190
+ loadErrors.push(e);
191
+ }
192
+ try {
193
+ const binding = require$1("@oxc-parser/binding-freebsd-x64");
194
+ const bindingPackageVersion = require$1("@oxc-parser/binding-freebsd-x64/package.json").version;
195
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
196
+ return binding;
197
+ } catch (e) {
198
+ loadErrors.push(e);
199
+ }
200
+ } else if (process.arch === "arm64") {
201
+ try {
202
+ return require$1("./parser.freebsd-arm64.node");
203
+ } catch (e) {
204
+ loadErrors.push(e);
205
+ }
206
+ try {
207
+ const binding = require$1("@oxc-parser/binding-freebsd-arm64");
208
+ const bindingPackageVersion = require$1("@oxc-parser/binding-freebsd-arm64/package.json").version;
209
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
210
+ return binding;
211
+ } catch (e) {
212
+ loadErrors.push(e);
213
+ }
214
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
215
+ } else if (process.platform === "linux") {
216
+ if (process.arch === "x64") {
217
+ if (isMusl()) {
218
+ try {
219
+ return require$1("./parser.linux-x64-musl.node");
220
+ } catch (e) {
221
+ loadErrors.push(e);
222
+ }
223
+ try {
224
+ const binding = require$1("@oxc-parser/binding-linux-x64-musl");
225
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-x64-musl/package.json").version;
226
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
227
+ return binding;
228
+ } catch (e) {
229
+ loadErrors.push(e);
230
+ }
231
+ } else {
232
+ try {
233
+ return require$1("./parser.linux-x64-gnu.node");
234
+ } catch (e) {
235
+ loadErrors.push(e);
236
+ }
237
+ try {
238
+ const binding = require$1("@oxc-parser/binding-linux-x64-gnu");
239
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-x64-gnu/package.json").version;
240
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
241
+ return binding;
242
+ } catch (e) {
243
+ loadErrors.push(e);
244
+ }
245
+ }
246
+ } else if (process.arch === "arm64") {
247
+ if (isMusl()) {
248
+ try {
249
+ return require$1("./parser.linux-arm64-musl.node");
250
+ } catch (e) {
251
+ loadErrors.push(e);
252
+ }
253
+ try {
254
+ const binding = require$1("@oxc-parser/binding-linux-arm64-musl");
255
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-arm64-musl/package.json").version;
256
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
257
+ return binding;
258
+ } catch (e) {
259
+ loadErrors.push(e);
260
+ }
261
+ } else {
262
+ try {
263
+ return require$1("./parser.linux-arm64-gnu.node");
264
+ } catch (e) {
265
+ loadErrors.push(e);
266
+ }
267
+ try {
268
+ const binding = require$1("@oxc-parser/binding-linux-arm64-gnu");
269
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-arm64-gnu/package.json").version;
270
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
271
+ return binding;
272
+ } catch (e) {
273
+ loadErrors.push(e);
274
+ }
275
+ }
276
+ } else if (process.arch === "arm") {
277
+ if (isMusl()) {
278
+ try {
279
+ return require$1("./parser.linux-arm-musleabihf.node");
280
+ } catch (e) {
281
+ loadErrors.push(e);
282
+ }
283
+ try {
284
+ const binding = require$1("@oxc-parser/binding-linux-arm-musleabihf");
285
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-arm-musleabihf/package.json").version;
286
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
287
+ return binding;
288
+ } catch (e) {
289
+ loadErrors.push(e);
290
+ }
291
+ } else {
292
+ try {
293
+ return require$1("./parser.linux-arm-gnueabihf.node");
294
+ } catch (e) {
295
+ loadErrors.push(e);
296
+ }
297
+ try {
298
+ const binding = require$1("@oxc-parser/binding-linux-arm-gnueabihf");
299
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-arm-gnueabihf/package.json").version;
300
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
301
+ return binding;
302
+ } catch (e) {
303
+ loadErrors.push(e);
304
+ }
305
+ }
306
+ } else if (process.arch === "loong64") {
307
+ if (isMusl()) {
308
+ try {
309
+ return require$1("./parser.linux-loong64-musl.node");
310
+ } catch (e) {
311
+ loadErrors.push(e);
312
+ }
313
+ try {
314
+ const binding = require$1("@oxc-parser/binding-linux-loong64-musl");
315
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-loong64-musl/package.json").version;
316
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
317
+ return binding;
318
+ } catch (e) {
319
+ loadErrors.push(e);
320
+ }
321
+ } else {
322
+ try {
323
+ return require$1("./parser.linux-loong64-gnu.node");
324
+ } catch (e) {
325
+ loadErrors.push(e);
326
+ }
327
+ try {
328
+ const binding = require$1("@oxc-parser/binding-linux-loong64-gnu");
329
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-loong64-gnu/package.json").version;
330
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
331
+ return binding;
332
+ } catch (e) {
333
+ loadErrors.push(e);
334
+ }
335
+ }
336
+ } else if (process.arch === "riscv64") {
337
+ if (isMusl()) {
338
+ try {
339
+ return require$1("./parser.linux-riscv64-musl.node");
340
+ } catch (e) {
341
+ loadErrors.push(e);
342
+ }
343
+ try {
344
+ const binding = require$1("@oxc-parser/binding-linux-riscv64-musl");
345
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-riscv64-musl/package.json").version;
346
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
347
+ return binding;
348
+ } catch (e) {
349
+ loadErrors.push(e);
350
+ }
351
+ } else {
352
+ try {
353
+ return require$1("./parser.linux-riscv64-gnu.node");
354
+ } catch (e) {
355
+ loadErrors.push(e);
356
+ }
357
+ try {
358
+ const binding = require$1("@oxc-parser/binding-linux-riscv64-gnu");
359
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-riscv64-gnu/package.json").version;
360
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
361
+ return binding;
362
+ } catch (e) {
363
+ loadErrors.push(e);
364
+ }
365
+ }
366
+ } else if (process.arch === "ppc64") {
367
+ try {
368
+ return require$1("./parser.linux-ppc64-gnu.node");
369
+ } catch (e) {
370
+ loadErrors.push(e);
371
+ }
372
+ try {
373
+ const binding = require$1("@oxc-parser/binding-linux-ppc64-gnu");
374
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-ppc64-gnu/package.json").version;
375
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
376
+ return binding;
377
+ } catch (e) {
378
+ loadErrors.push(e);
379
+ }
380
+ } else if (process.arch === "s390x") {
381
+ try {
382
+ return require$1("./parser.linux-s390x-gnu.node");
383
+ } catch (e) {
384
+ loadErrors.push(e);
385
+ }
386
+ try {
387
+ const binding = require$1("@oxc-parser/binding-linux-s390x-gnu");
388
+ const bindingPackageVersion = require$1("@oxc-parser/binding-linux-s390x-gnu/package.json").version;
389
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
390
+ return binding;
391
+ } catch (e) {
392
+ loadErrors.push(e);
393
+ }
394
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
395
+ } else if (process.platform === "openharmony") {
396
+ if (process.arch === "arm64") {
397
+ try {
398
+ return require$1("./parser.openharmony-arm64.node");
399
+ } catch (e) {
400
+ loadErrors.push(e);
401
+ }
402
+ try {
403
+ const binding = require$1("@oxc-parser/binding-openharmony-arm64");
404
+ const bindingPackageVersion = require$1("@oxc-parser/binding-openharmony-arm64/package.json").version;
405
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
406
+ return binding;
407
+ } catch (e) {
408
+ loadErrors.push(e);
409
+ }
410
+ } else if (process.arch === "x64") {
411
+ try {
412
+ return require$1("./parser.openharmony-x64.node");
413
+ } catch (e) {
414
+ loadErrors.push(e);
415
+ }
416
+ try {
417
+ const binding = require$1("@oxc-parser/binding-openharmony-x64");
418
+ const bindingPackageVersion = require$1("@oxc-parser/binding-openharmony-x64/package.json").version;
419
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
420
+ return binding;
421
+ } catch (e) {
422
+ loadErrors.push(e);
423
+ }
424
+ } else if (process.arch === "arm") {
425
+ try {
426
+ return require$1("./parser.openharmony-arm.node");
427
+ } catch (e) {
428
+ loadErrors.push(e);
429
+ }
430
+ try {
431
+ const binding = require$1("@oxc-parser/binding-openharmony-arm");
432
+ const bindingPackageVersion = require$1("@oxc-parser/binding-openharmony-arm/package.json").version;
433
+ if (bindingPackageVersion !== "0.140.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.140.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
434
+ return binding;
435
+ } catch (e) {
436
+ loadErrors.push(e);
437
+ }
438
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
439
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
440
+ }
441
+ nativeBinding = requireNative();
442
+ const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
443
+ if (!nativeBinding || forceWasi) {
444
+ let wasiBinding = null;
445
+ let wasiBindingError = null;
446
+ try {
447
+ wasiBinding = require$1("./parser.wasi.cjs");
448
+ nativeBinding = wasiBinding;
449
+ } catch (err) {
450
+ if (forceWasi) wasiBindingError = err;
451
+ }
452
+ if (!nativeBinding || forceWasi) try {
453
+ wasiBinding = require$1("@oxc-parser/binding-wasm32-wasi");
454
+ nativeBinding = wasiBinding;
455
+ } catch (err) {
456
+ if (forceWasi) {
457
+ if (!wasiBindingError) wasiBindingError = err;
458
+ else wasiBindingError.cause = err;
459
+ loadErrors.push(err);
460
+ }
461
+ }
462
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
463
+ const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
464
+ error.cause = wasiBindingError;
465
+ throw error;
466
+ }
467
+ }
468
+ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
469
+ nativeBinding = require$1("./webcontainer-fallback.cjs");
470
+ } catch (err) {
471
+ loadErrors.push(err);
472
+ }
473
+ if (!nativeBinding) {
474
+ if (loadErrors.length > 0) {
475
+ const error = /* @__PURE__ */ new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");
476
+ error.cause = loadErrors.reduce((err, cur) => {
477
+ cur.cause = err;
478
+ return cur;
479
+ });
480
+ throw error;
481
+ }
482
+ throw new Error(`Failed to load native binding`);
483
+ }
484
+ const { Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parse: parse$1, parseSync: parseSync$1, rawTransferSupported: rawTransferSupported$1 } = nativeBinding;
485
+ const { getBufferOffset, parseRaw: parseRaw$1, parseRawSync } = nativeBinding;
486
+ //#endregion
487
+ //#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/wrap.js
488
+ function wrap(result) {
489
+ let program, module, comments, errors;
490
+ return {
491
+ get program() {
492
+ if (!program) program = jsonParseAst(result.program);
493
+ return program;
494
+ },
495
+ get module() {
496
+ if (!module) module = result.module;
497
+ return module;
498
+ },
499
+ get comments() {
500
+ if (!comments) comments = result.comments;
501
+ return comments;
502
+ },
503
+ get errors() {
504
+ if (!errors) errors = result.errors;
505
+ return errors;
506
+ }
507
+ };
508
+ }
509
+ function jsonParseAst(programJson) {
510
+ const { node: program, fixes } = JSON.parse(programJson);
511
+ for (const fixPath of fixes) applyFix(program, fixPath);
512
+ return program;
513
+ }
514
+ function applyFix(program, fixPath) {
515
+ let node = program;
516
+ for (const key of fixPath) node = node[key];
517
+ if (node.bigint) node.value = BigInt(node.bigint);
518
+ else try {
519
+ node.value = RegExp(node.regex.pattern, node.regex.flags);
520
+ } catch {}
521
+ }
522
+ //#endregion
523
+ //#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/generated/visit/keys.js
524
+ const { freeze } = Object;
525
+ const $EMPTY = freeze([]);
526
+ const DECORATORS__KEY__TYPE_ANNOTATION__VALUE = freeze([
527
+ "decorators",
528
+ "key",
529
+ "typeAnnotation",
530
+ "value"
531
+ ]);
532
+ const LEFT__RIGHT = freeze(["left", "right"]);
533
+ const ARGUMENT = freeze(["argument"]);
534
+ const BODY = freeze(["body"]);
535
+ const LABEL = freeze(["label"]);
536
+ const CALLEE__TYPE_ARGUMENTS__ARGUMENTS = freeze([
537
+ "callee",
538
+ "typeArguments",
539
+ "arguments"
540
+ ]);
541
+ const EXPRESSION = freeze(["expression"]);
542
+ const DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY = freeze([
543
+ "decorators",
544
+ "id",
545
+ "typeParameters",
546
+ "superClass",
547
+ "superTypeArguments",
548
+ "implements",
549
+ "body"
550
+ ]);
551
+ const TEST__CONSEQUENT__ALTERNATE = freeze([
552
+ "test",
553
+ "consequent",
554
+ "alternate"
555
+ ]);
556
+ const LEFT__RIGHT__BODY = freeze([
557
+ "left",
558
+ "right",
559
+ "body"
560
+ ]);
561
+ const ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY = freeze([
562
+ "id",
563
+ "typeParameters",
564
+ "params",
565
+ "returnType",
566
+ "body"
567
+ ]);
568
+ const KEY__VALUE = freeze(["key", "value"]);
569
+ const LOCAL = freeze(["local"]);
570
+ const OBJECT__PROPERTY = freeze(["object", "property"]);
571
+ const DECORATORS__KEY__TYPE_ANNOTATION = freeze([
572
+ "decorators",
573
+ "key",
574
+ "typeAnnotation"
575
+ ]);
576
+ const EXPRESSION__TYPE_ANNOTATION = freeze(["expression", "typeAnnotation"]);
577
+ const TYPE_PARAMETERS__PARAMS__RETURN_TYPE = freeze([
578
+ "typeParameters",
579
+ "params",
580
+ "returnType"
581
+ ]);
582
+ const EXPRESSION__TYPE_ARGUMENTS = freeze(["expression", "typeArguments"]);
583
+ const MEMBERS = freeze(["members"]);
584
+ const ID__BODY = freeze(["id", "body"]);
585
+ const TYPES = freeze(["types"]);
586
+ const TYPE_ANNOTATION = freeze(["typeAnnotation"]);
587
+ const PARAMS = freeze(["params"]);
588
+ var keys_default = freeze({
589
+ DebuggerStatement: $EMPTY,
590
+ EmptyStatement: $EMPTY,
591
+ Literal: $EMPTY,
592
+ PrivateIdentifier: $EMPTY,
593
+ Super: $EMPTY,
594
+ TemplateElement: $EMPTY,
595
+ ThisExpression: $EMPTY,
596
+ JSXClosingFragment: $EMPTY,
597
+ JSXEmptyExpression: $EMPTY,
598
+ JSXIdentifier: $EMPTY,
599
+ JSXOpeningFragment: $EMPTY,
600
+ JSXText: $EMPTY,
601
+ TSAnyKeyword: $EMPTY,
602
+ TSBigIntKeyword: $EMPTY,
603
+ TSBooleanKeyword: $EMPTY,
604
+ TSIntrinsicKeyword: $EMPTY,
605
+ TSJSDocUnknownType: $EMPTY,
606
+ TSNeverKeyword: $EMPTY,
607
+ TSNullKeyword: $EMPTY,
608
+ TSNumberKeyword: $EMPTY,
609
+ TSObjectKeyword: $EMPTY,
610
+ TSStringKeyword: $EMPTY,
611
+ TSSymbolKeyword: $EMPTY,
612
+ TSThisType: $EMPTY,
613
+ TSUndefinedKeyword: $EMPTY,
614
+ TSUnknownKeyword: $EMPTY,
615
+ TSVoidKeyword: $EMPTY,
616
+ AccessorProperty: DECORATORS__KEY__TYPE_ANNOTATION__VALUE,
617
+ ArrayExpression: freeze(["elements"]),
618
+ ArrayPattern: freeze([
619
+ "decorators",
620
+ "elements",
621
+ "typeAnnotation"
622
+ ]),
623
+ ArrowFunctionExpression: freeze([
624
+ "typeParameters",
625
+ "params",
626
+ "returnType",
627
+ "body"
628
+ ]),
629
+ AssignmentExpression: LEFT__RIGHT,
630
+ AssignmentPattern: freeze([
631
+ "decorators",
632
+ "left",
633
+ "right",
634
+ "typeAnnotation"
635
+ ]),
636
+ AwaitExpression: ARGUMENT,
637
+ BinaryExpression: LEFT__RIGHT,
638
+ BlockStatement: BODY,
639
+ BreakStatement: LABEL,
640
+ CallExpression: CALLEE__TYPE_ARGUMENTS__ARGUMENTS,
641
+ CatchClause: freeze(["param", "body"]),
642
+ ChainExpression: EXPRESSION,
643
+ ClassBody: BODY,
644
+ ClassDeclaration: DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY,
645
+ ClassExpression: DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY,
646
+ ConditionalExpression: TEST__CONSEQUENT__ALTERNATE,
647
+ ContinueStatement: LABEL,
648
+ Decorator: EXPRESSION,
649
+ DoWhileStatement: freeze(["body", "test"]),
650
+ ExportAllDeclaration: freeze([
651
+ "exported",
652
+ "source",
653
+ "attributes"
654
+ ]),
655
+ ExportDefaultDeclaration: freeze(["declaration"]),
656
+ ExportNamedDeclaration: freeze([
657
+ "declaration",
658
+ "specifiers",
659
+ "source",
660
+ "attributes"
661
+ ]),
662
+ ExportSpecifier: freeze(["local", "exported"]),
663
+ ExpressionStatement: EXPRESSION,
664
+ ForInStatement: LEFT__RIGHT__BODY,
665
+ ForOfStatement: LEFT__RIGHT__BODY,
666
+ ForStatement: freeze([
667
+ "init",
668
+ "test",
669
+ "update",
670
+ "body"
671
+ ]),
672
+ FunctionDeclaration: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
673
+ FunctionExpression: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
674
+ Identifier: freeze(["decorators", "typeAnnotation"]),
675
+ IfStatement: TEST__CONSEQUENT__ALTERNATE,
676
+ ImportAttribute: KEY__VALUE,
677
+ ImportDeclaration: freeze([
678
+ "specifiers",
679
+ "source",
680
+ "attributes"
681
+ ]),
682
+ ImportDefaultSpecifier: LOCAL,
683
+ ImportExpression: freeze(["source", "options"]),
684
+ ImportNamespaceSpecifier: LOCAL,
685
+ ImportSpecifier: freeze(["imported", "local"]),
686
+ LabeledStatement: freeze(["label", "body"]),
687
+ LogicalExpression: LEFT__RIGHT,
688
+ MemberExpression: OBJECT__PROPERTY,
689
+ MetaProperty: freeze(["meta", "property"]),
690
+ MethodDefinition: freeze([
691
+ "decorators",
692
+ "key",
693
+ "value"
694
+ ]),
695
+ NewExpression: CALLEE__TYPE_ARGUMENTS__ARGUMENTS,
696
+ ObjectExpression: freeze(["properties"]),
697
+ ObjectPattern: freeze([
698
+ "decorators",
699
+ "properties",
700
+ "typeAnnotation"
701
+ ]),
702
+ ParenthesizedExpression: EXPRESSION,
703
+ Program: BODY,
704
+ Property: KEY__VALUE,
705
+ PropertyDefinition: DECORATORS__KEY__TYPE_ANNOTATION__VALUE,
706
+ RestElement: freeze([
707
+ "decorators",
708
+ "argument",
709
+ "typeAnnotation"
710
+ ]),
711
+ ReturnStatement: ARGUMENT,
712
+ SequenceExpression: freeze(["expressions"]),
713
+ SpreadElement: ARGUMENT,
714
+ StaticBlock: BODY,
715
+ SwitchCase: freeze(["test", "consequent"]),
716
+ SwitchStatement: freeze(["discriminant", "cases"]),
717
+ TaggedTemplateExpression: freeze([
718
+ "tag",
719
+ "typeArguments",
720
+ "quasi"
721
+ ]),
722
+ TemplateLiteral: freeze(["quasis", "expressions"]),
723
+ ThrowStatement: ARGUMENT,
724
+ TryStatement: freeze([
725
+ "block",
726
+ "handler",
727
+ "finalizer"
728
+ ]),
729
+ UnaryExpression: ARGUMENT,
730
+ UpdateExpression: ARGUMENT,
731
+ V8IntrinsicExpression: freeze(["name", "arguments"]),
732
+ VariableDeclaration: freeze(["declarations"]),
733
+ VariableDeclarator: freeze(["id", "init"]),
734
+ WhileStatement: freeze(["test", "body"]),
735
+ WithStatement: freeze(["object", "body"]),
736
+ YieldExpression: ARGUMENT,
737
+ JSXAttribute: freeze(["name", "value"]),
738
+ JSXClosingElement: freeze(["name"]),
739
+ JSXElement: freeze([
740
+ "openingElement",
741
+ "children",
742
+ "closingElement"
743
+ ]),
744
+ JSXExpressionContainer: EXPRESSION,
745
+ JSXFragment: freeze([
746
+ "openingFragment",
747
+ "children",
748
+ "closingFragment"
749
+ ]),
750
+ JSXMemberExpression: OBJECT__PROPERTY,
751
+ JSXNamespacedName: freeze(["namespace", "name"]),
752
+ JSXOpeningElement: freeze([
753
+ "name",
754
+ "typeArguments",
755
+ "attributes"
756
+ ]),
757
+ JSXSpreadAttribute: ARGUMENT,
758
+ JSXSpreadChild: EXPRESSION,
759
+ TSAbstractAccessorProperty: DECORATORS__KEY__TYPE_ANNOTATION,
760
+ TSAbstractMethodDefinition: KEY__VALUE,
761
+ TSAbstractPropertyDefinition: DECORATORS__KEY__TYPE_ANNOTATION,
762
+ TSArrayType: freeze(["elementType"]),
763
+ TSAsExpression: EXPRESSION__TYPE_ANNOTATION,
764
+ TSCallSignatureDeclaration: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
765
+ TSClassImplements: EXPRESSION__TYPE_ARGUMENTS,
766
+ TSConditionalType: freeze([
767
+ "checkType",
768
+ "extendsType",
769
+ "trueType",
770
+ "falseType"
771
+ ]),
772
+ TSConstructSignatureDeclaration: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
773
+ TSConstructorType: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
774
+ TSDeclareFunction: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
775
+ TSEmptyBodyFunctionExpression: freeze([
776
+ "id",
777
+ "typeParameters",
778
+ "params",
779
+ "returnType"
780
+ ]),
781
+ TSEnumBody: MEMBERS,
782
+ TSEnumDeclaration: ID__BODY,
783
+ TSEnumMember: freeze(["id", "initializer"]),
784
+ TSExportAssignment: EXPRESSION,
785
+ TSExternalModuleReference: EXPRESSION,
786
+ TSFunctionType: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
787
+ TSImportEqualsDeclaration: freeze(["id", "moduleReference"]),
788
+ TSImportType: freeze([
789
+ "source",
790
+ "options",
791
+ "qualifier",
792
+ "typeArguments"
793
+ ]),
794
+ TSIndexSignature: freeze(["parameters", "typeAnnotation"]),
795
+ TSIndexedAccessType: freeze(["objectType", "indexType"]),
796
+ TSInferType: freeze(["typeParameter"]),
797
+ TSInstantiationExpression: EXPRESSION__TYPE_ARGUMENTS,
798
+ TSInterfaceBody: BODY,
799
+ TSInterfaceDeclaration: freeze([
800
+ "id",
801
+ "typeParameters",
802
+ "extends",
803
+ "body"
804
+ ]),
805
+ TSInterfaceHeritage: EXPRESSION__TYPE_ARGUMENTS,
806
+ TSIntersectionType: TYPES,
807
+ TSJSDocNonNullableType: TYPE_ANNOTATION,
808
+ TSJSDocNullableType: TYPE_ANNOTATION,
809
+ TSLiteralType: freeze(["literal"]),
810
+ TSMappedType: freeze([
811
+ "key",
812
+ "constraint",
813
+ "nameType",
814
+ "typeAnnotation"
815
+ ]),
816
+ TSMethodSignature: freeze([
817
+ "key",
818
+ "typeParameters",
819
+ "params",
820
+ "returnType"
821
+ ]),
822
+ TSModuleBlock: BODY,
823
+ TSModuleDeclaration: ID__BODY,
824
+ TSNamedTupleMember: freeze(["label", "elementType"]),
825
+ TSNamespaceExportDeclaration: freeze(["id"]),
826
+ TSNonNullExpression: EXPRESSION,
827
+ TSOptionalType: TYPE_ANNOTATION,
828
+ TSParameterProperty: freeze(["decorators", "parameter"]),
829
+ TSParenthesizedType: TYPE_ANNOTATION,
830
+ TSPropertySignature: freeze(["key", "typeAnnotation"]),
831
+ TSQualifiedName: LEFT__RIGHT,
832
+ TSRestType: TYPE_ANNOTATION,
833
+ TSSatisfiesExpression: EXPRESSION__TYPE_ANNOTATION,
834
+ TSTemplateLiteralType: freeze(["quasis", "types"]),
835
+ TSTupleType: freeze(["elementTypes"]),
836
+ TSTypeAliasDeclaration: freeze([
837
+ "id",
838
+ "typeParameters",
839
+ "typeAnnotation"
840
+ ]),
841
+ TSTypeAnnotation: TYPE_ANNOTATION,
842
+ TSTypeAssertion: freeze(["typeAnnotation", "expression"]),
843
+ TSTypeLiteral: MEMBERS,
844
+ TSTypeOperator: TYPE_ANNOTATION,
845
+ TSTypeParameter: freeze([
846
+ "name",
847
+ "constraint",
848
+ "default"
849
+ ]),
850
+ TSTypeParameterDeclaration: PARAMS,
851
+ TSTypeParameterInstantiation: PARAMS,
852
+ TSTypePredicate: freeze(["parameterName", "typeAnnotation"]),
853
+ TSTypeQuery: freeze(["exprName", "typeArguments"]),
854
+ TSTypeReference: freeze(["typeName", "typeArguments"]),
855
+ TSUnionType: TYPES
856
+ });
857
+ //#endregion
858
+ //#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/visit/index.js
859
+ let walkProgram = null;
860
+ let addVisitorToCompiled;
861
+ let createCompiledVisitor;
862
+ let finalizeCompiledVisitor;
863
+ /**
864
+ * Visitor class for traversing AST.
865
+ */
866
+ var Visitor = class {
867
+ #compiledVisitor = null;
868
+ constructor(visitor) {
869
+ if (walkProgram === null) {
870
+ const require = createRequire(import.meta.url);
871
+ ({walkProgram} = require("../generated/visit/walk.js"));
872
+ ({addVisitorToCompiled, createCompiledVisitor, finalizeCompiledVisitor} = require("./visitor.js"));
873
+ }
874
+ const compiledVisitor = createCompiledVisitor();
875
+ addVisitorToCompiled(visitor);
876
+ if (finalizeCompiledVisitor()) this.#compiledVisitor = compiledVisitor;
877
+ }
878
+ /**
879
+ * Visit AST.
880
+ * @param program - The AST to visit.
881
+ * @returns {undefined}
882
+ */
883
+ visit(program) {
884
+ const compiledVisitor = this.#compiledVisitor;
885
+ if (compiledVisitor !== null) walkProgram(program, compiledVisitor);
886
+ }
887
+ };
888
+ //#endregion
889
+ //#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/raw-transfer/supported.js
890
+ let rawTransferIsSupported = null;
891
+ /**
892
+ * Returns `true` if `experimentalRawTransfer` is option is supported.
893
+ *
894
+ * Raw transfer is only supported on 64-bit little-endian systems,
895
+ * and NodeJS >= v22.0.0 or Deno >= v2.0.0.
896
+ *
897
+ * Versions of NodeJS prior to v22.0.0 do not support creating an `ArrayBuffer` larger than 4 GiB.
898
+ * Bun (as at v1.2.4) also does not support creating an `ArrayBuffer` larger than 4 GiB.
899
+ * Support on Deno v1 is unknown and it's EOL, so treating Deno before v2.0.0 as unsupported.
900
+ *
901
+ * No easy way to determining pointer width (64 bit or 32 bit) in JS,
902
+ * so call a function on Rust side to find out.
903
+ *
904
+ * @returns {boolean} - `true` if raw transfer is supported on this platform
905
+ */
906
+ function rawTransferSupported() {
907
+ if (rawTransferIsSupported === null) rawTransferIsSupported = rawTransferRuntimeSupported() && rawTransferSupported$1();
908
+ return rawTransferIsSupported;
909
+ }
910
+ function rawTransferRuntimeSupported() {
911
+ let global;
912
+ try {
913
+ global = globalThis;
914
+ } catch {
915
+ return false;
916
+ }
917
+ if (!!global.Bun || !!global.process?.versions?.bun) return false;
918
+ if (!!global.Deno) {
919
+ const match = Deno.version?.deno?.match(/^(\d+)\./);
920
+ return !!match && match[1] * 1 >= 2;
921
+ }
922
+ if (!(global.process?.release?.name === "node")) return false;
923
+ const match = process.version?.match(/^v(\d+)\./);
924
+ return !!match && match[1] * 1 >= 22;
925
+ }
926
+ //#endregion
927
+ //#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/index.js
928
+ const require = createRequire(import.meta.url);
929
+ let parseSyncRaw = null;
930
+ let parseRaw;
931
+ let parseSyncLazy = null;
932
+ let parseLazy;
933
+ let LazyVisitor;
934
+ /**
935
+ * Lazy-load code related to raw transfer.
936
+ * @returns {undefined}
937
+ */
938
+ function loadRawTransfer() {
939
+ if (parseSyncRaw === null) ({parseSyncRaw, parse: parseRaw} = require("./raw-transfer/eager.js"));
940
+ }
941
+ /**
942
+ * Lazy-load code related to raw transfer lazy deserialization.
943
+ * @returns {undefined}
944
+ */
945
+ function loadRawTransferLazy() {
946
+ if (parseSyncLazy === null) ({parseSyncLazy, parse: parseLazy, Visitor: LazyVisitor} = require("./raw-transfer/lazy.js"));
947
+ }
948
+ /**
949
+ * Parse JS/TS source synchronously on current thread.
950
+ *
951
+ * @param {string} filename - Filename
952
+ * @param {string} sourceText - Source text of file
953
+ * @param {Object|undefined} options - Parsing options
954
+ * @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`
955
+ * @throws {Error} - If `experimentalRawTransfer` or `experimentalLazy` option is enabled,
956
+ * and raw transfer is not supported on this platform
957
+ */
958
+ function parseSync(filename, sourceText, options) {
959
+ if (options?.experimentalRawTransfer) {
960
+ loadRawTransfer();
961
+ return parseSyncRaw(filename, sourceText, options);
962
+ }
963
+ if (options?.experimentalLazy) {
964
+ loadRawTransferLazy();
965
+ return parseSyncLazy(filename, sourceText, options);
966
+ }
967
+ return wrap(parseSync$1(filename, sourceText, options));
968
+ }
969
+ /**
970
+ * Parse JS/TS source asynchronously on a separate thread.
971
+ *
972
+ * Note that not all of the workload can happen on a separate thread.
973
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
974
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
975
+ * the asynchronous parsing by a factor of between 3 and 20.
976
+ *
977
+ * i.e. the majority of the workload cannot be parallelized by using this method.
978
+ *
979
+ * Generally `parseSync` is preferable to use as it does not have the overhead of spawning a thread.
980
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
981
+ *
982
+ * @param {string} filename - Filename
983
+ * @param {string} sourceText - Source text of file
984
+ * @param {Object|undefined} options - Parsing options
985
+ * @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`
986
+ * @throws {Error} - If `experimentalRawTransfer` or `experimentalLazy` option is enabled,
987
+ * and raw transfer is not supported on this platform
988
+ */
989
+ async function parse(filename, sourceText, options) {
990
+ if (options?.experimentalRawTransfer) {
991
+ loadRawTransfer();
992
+ return await parseRaw(filename, sourceText, options);
993
+ }
994
+ if (options?.experimentalLazy) {
995
+ loadRawTransferLazy();
996
+ return await parseLazy(filename, sourceText, options);
997
+ }
998
+ return wrap(await parse$1(filename, sourceText, options));
999
+ }
1000
+ /**
1001
+ * Get `Visitor` class to construct visitors with.
1002
+ * @returns {function} - `Visitor` class
1003
+ */
1004
+ function experimentalGetLazyVisitor() {
1005
+ loadRawTransferLazy();
1006
+ return LazyVisitor;
1007
+ }
1008
+ //#endregion
1009
+ export { ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, ParseResult, Severity, Visitor, experimentalGetLazyVisitor, parse, parseSync, rawTransferSupported, keys_default as visitorKeys };