@pobammer-ts/eslint-cease-nonsense-rules 1.3.0 → 1.4.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/dist/index.js CHANGED
@@ -11368,6 +11368,1289 @@ var useExhaustiveDependencies = {
11368
11368
  };
11369
11369
  var use_exhaustive_dependencies_default = useExhaustiveDependencies;
11370
11370
 
11371
+ // src/rules/no-commented-code.ts
11372
+ import path from "node:path";
11373
+
11374
+ // node_modules/oxc-parser/src-js/index.js
11375
+ import { createRequire as createRequire3 } from "node:module";
11376
+
11377
+ // node_modules/oxc-parser/src-js/bindings.js
11378
+ import { createRequire } from "node:module";
11379
+ var require2 = createRequire(import.meta.url);
11380
+ var __dirname2 = new URL(".", import.meta.url).pathname;
11381
+ var { readFileSync } = require2("node:fs");
11382
+ var nativeBinding = null;
11383
+ var loadErrors = [];
11384
+ var isMusl = () => {
11385
+ let musl = false;
11386
+ if (process.platform === "linux") {
11387
+ musl = isMuslFromFilesystem();
11388
+ if (musl === null) {
11389
+ musl = isMuslFromReport();
11390
+ }
11391
+ if (musl === null) {
11392
+ musl = isMuslFromChildProcess();
11393
+ }
11394
+ }
11395
+ return musl;
11396
+ };
11397
+ var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
11398
+ var isMuslFromFilesystem = () => {
11399
+ try {
11400
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
11401
+ } catch {
11402
+ return null;
11403
+ }
11404
+ };
11405
+ var isMuslFromReport = () => {
11406
+ let report = null;
11407
+ if (typeof process.report?.getReport === "function") {
11408
+ process.report.excludeNetwork = true;
11409
+ report = process.report.getReport();
11410
+ }
11411
+ if (!report) {
11412
+ return null;
11413
+ }
11414
+ if (report.header && report.header.glibcVersionRuntime) {
11415
+ return false;
11416
+ }
11417
+ if (Array.isArray(report.sharedObjects)) {
11418
+ if (report.sharedObjects.some(isFileMusl)) {
11419
+ return true;
11420
+ }
11421
+ }
11422
+ return false;
11423
+ };
11424
+ var isMuslFromChildProcess = () => {
11425
+ try {
11426
+ return require2("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
11427
+ } catch (e) {
11428
+ return false;
11429
+ }
11430
+ };
11431
+ function requireNative() {
11432
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
11433
+ try {
11434
+ return require2(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
11435
+ } catch (err) {
11436
+ loadErrors.push(err);
11437
+ }
11438
+ } else if (process.platform === "android") {
11439
+ if (process.arch === "arm64") {
11440
+ try {
11441
+ return require2("./parser.android-arm64.node");
11442
+ } catch (e) {
11443
+ loadErrors.push(e);
11444
+ }
11445
+ try {
11446
+ const binding = require2("@oxc-parser/binding-android-arm64");
11447
+ const bindingPackageVersion = require2("@oxc-parser/binding-android-arm64/package.json").version;
11448
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11449
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11450
+ }
11451
+ return binding;
11452
+ } catch (e) {
11453
+ loadErrors.push(e);
11454
+ }
11455
+ } else if (process.arch === "arm") {
11456
+ try {
11457
+ return require2("./parser.android-arm-eabi.node");
11458
+ } catch (e) {
11459
+ loadErrors.push(e);
11460
+ }
11461
+ try {
11462
+ const binding = require2("@oxc-parser/binding-android-arm-eabi");
11463
+ const bindingPackageVersion = require2("@oxc-parser/binding-android-arm-eabi/package.json").version;
11464
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11465
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11466
+ }
11467
+ return binding;
11468
+ } catch (e) {
11469
+ loadErrors.push(e);
11470
+ }
11471
+ } else {
11472
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
11473
+ }
11474
+ } else if (process.platform === "win32") {
11475
+ if (process.arch === "x64") {
11476
+ if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
11477
+ try {
11478
+ return require2("./parser.win32-x64-gnu.node");
11479
+ } catch (e) {
11480
+ loadErrors.push(e);
11481
+ }
11482
+ try {
11483
+ const binding = require2("@oxc-parser/binding-win32-x64-gnu");
11484
+ const bindingPackageVersion = require2("@oxc-parser/binding-win32-x64-gnu/package.json").version;
11485
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11486
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11487
+ }
11488
+ return binding;
11489
+ } catch (e) {
11490
+ loadErrors.push(e);
11491
+ }
11492
+ } else {
11493
+ try {
11494
+ return require2("./parser.win32-x64-msvc.node");
11495
+ } catch (e) {
11496
+ loadErrors.push(e);
11497
+ }
11498
+ try {
11499
+ const binding = require2("@oxc-parser/binding-win32-x64-msvc");
11500
+ const bindingPackageVersion = require2("@oxc-parser/binding-win32-x64-msvc/package.json").version;
11501
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11502
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11503
+ }
11504
+ return binding;
11505
+ } catch (e) {
11506
+ loadErrors.push(e);
11507
+ }
11508
+ }
11509
+ } else if (process.arch === "ia32") {
11510
+ try {
11511
+ return require2("./parser.win32-ia32-msvc.node");
11512
+ } catch (e) {
11513
+ loadErrors.push(e);
11514
+ }
11515
+ try {
11516
+ const binding = require2("@oxc-parser/binding-win32-ia32-msvc");
11517
+ const bindingPackageVersion = require2("@oxc-parser/binding-win32-ia32-msvc/package.json").version;
11518
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11519
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11520
+ }
11521
+ return binding;
11522
+ } catch (e) {
11523
+ loadErrors.push(e);
11524
+ }
11525
+ } else if (process.arch === "arm64") {
11526
+ try {
11527
+ return require2("./parser.win32-arm64-msvc.node");
11528
+ } catch (e) {
11529
+ loadErrors.push(e);
11530
+ }
11531
+ try {
11532
+ const binding = require2("@oxc-parser/binding-win32-arm64-msvc");
11533
+ const bindingPackageVersion = require2("@oxc-parser/binding-win32-arm64-msvc/package.json").version;
11534
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11535
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11536
+ }
11537
+ return binding;
11538
+ } catch (e) {
11539
+ loadErrors.push(e);
11540
+ }
11541
+ } else {
11542
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
11543
+ }
11544
+ } else if (process.platform === "darwin") {
11545
+ try {
11546
+ return require2("./parser.darwin-universal.node");
11547
+ } catch (e) {
11548
+ loadErrors.push(e);
11549
+ }
11550
+ try {
11551
+ const binding = require2("@oxc-parser/binding-darwin-universal");
11552
+ const bindingPackageVersion = require2("@oxc-parser/binding-darwin-universal/package.json").version;
11553
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11554
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11555
+ }
11556
+ return binding;
11557
+ } catch (e) {
11558
+ loadErrors.push(e);
11559
+ }
11560
+ if (process.arch === "x64") {
11561
+ try {
11562
+ return require2("./parser.darwin-x64.node");
11563
+ } catch (e) {
11564
+ loadErrors.push(e);
11565
+ }
11566
+ try {
11567
+ const binding = require2("@oxc-parser/binding-darwin-x64");
11568
+ const bindingPackageVersion = require2("@oxc-parser/binding-darwin-x64/package.json").version;
11569
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11570
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11571
+ }
11572
+ return binding;
11573
+ } catch (e) {
11574
+ loadErrors.push(e);
11575
+ }
11576
+ } else if (process.arch === "arm64") {
11577
+ try {
11578
+ return require2("./parser.darwin-arm64.node");
11579
+ } catch (e) {
11580
+ loadErrors.push(e);
11581
+ }
11582
+ try {
11583
+ const binding = require2("@oxc-parser/binding-darwin-arm64");
11584
+ const bindingPackageVersion = require2("@oxc-parser/binding-darwin-arm64/package.json").version;
11585
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11586
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11587
+ }
11588
+ return binding;
11589
+ } catch (e) {
11590
+ loadErrors.push(e);
11591
+ }
11592
+ } else {
11593
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
11594
+ }
11595
+ } else if (process.platform === "freebsd") {
11596
+ if (process.arch === "x64") {
11597
+ try {
11598
+ return require2("./parser.freebsd-x64.node");
11599
+ } catch (e) {
11600
+ loadErrors.push(e);
11601
+ }
11602
+ try {
11603
+ const binding = require2("@oxc-parser/binding-freebsd-x64");
11604
+ const bindingPackageVersion = require2("@oxc-parser/binding-freebsd-x64/package.json").version;
11605
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11606
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11607
+ }
11608
+ return binding;
11609
+ } catch (e) {
11610
+ loadErrors.push(e);
11611
+ }
11612
+ } else if (process.arch === "arm64") {
11613
+ try {
11614
+ return require2("./parser.freebsd-arm64.node");
11615
+ } catch (e) {
11616
+ loadErrors.push(e);
11617
+ }
11618
+ try {
11619
+ const binding = require2("@oxc-parser/binding-freebsd-arm64");
11620
+ const bindingPackageVersion = require2("@oxc-parser/binding-freebsd-arm64/package.json").version;
11621
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11622
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11623
+ }
11624
+ return binding;
11625
+ } catch (e) {
11626
+ loadErrors.push(e);
11627
+ }
11628
+ } else {
11629
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
11630
+ }
11631
+ } else if (process.platform === "linux") {
11632
+ if (process.arch === "x64") {
11633
+ if (isMusl()) {
11634
+ try {
11635
+ return require2("./parser.linux-x64-musl.node");
11636
+ } catch (e) {
11637
+ loadErrors.push(e);
11638
+ }
11639
+ try {
11640
+ const binding = require2("@oxc-parser/binding-linux-x64-musl");
11641
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-x64-musl/package.json").version;
11642
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11643
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11644
+ }
11645
+ return binding;
11646
+ } catch (e) {
11647
+ loadErrors.push(e);
11648
+ }
11649
+ } else {
11650
+ try {
11651
+ return require2("./parser.linux-x64-gnu.node");
11652
+ } catch (e) {
11653
+ loadErrors.push(e);
11654
+ }
11655
+ try {
11656
+ const binding = require2("@oxc-parser/binding-linux-x64-gnu");
11657
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-x64-gnu/package.json").version;
11658
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11659
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11660
+ }
11661
+ return binding;
11662
+ } catch (e) {
11663
+ loadErrors.push(e);
11664
+ }
11665
+ }
11666
+ } else if (process.arch === "arm64") {
11667
+ if (isMusl()) {
11668
+ try {
11669
+ return require2("./parser.linux-arm64-musl.node");
11670
+ } catch (e) {
11671
+ loadErrors.push(e);
11672
+ }
11673
+ try {
11674
+ const binding = require2("@oxc-parser/binding-linux-arm64-musl");
11675
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm64-musl/package.json").version;
11676
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11677
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11678
+ }
11679
+ return binding;
11680
+ } catch (e) {
11681
+ loadErrors.push(e);
11682
+ }
11683
+ } else {
11684
+ try {
11685
+ return require2("./parser.linux-arm64-gnu.node");
11686
+ } catch (e) {
11687
+ loadErrors.push(e);
11688
+ }
11689
+ try {
11690
+ const binding = require2("@oxc-parser/binding-linux-arm64-gnu");
11691
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm64-gnu/package.json").version;
11692
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11693
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11694
+ }
11695
+ return binding;
11696
+ } catch (e) {
11697
+ loadErrors.push(e);
11698
+ }
11699
+ }
11700
+ } else if (process.arch === "arm") {
11701
+ if (isMusl()) {
11702
+ try {
11703
+ return require2("./parser.linux-arm-musleabihf.node");
11704
+ } catch (e) {
11705
+ loadErrors.push(e);
11706
+ }
11707
+ try {
11708
+ const binding = require2("@oxc-parser/binding-linux-arm-musleabihf");
11709
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm-musleabihf/package.json").version;
11710
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11711
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11712
+ }
11713
+ return binding;
11714
+ } catch (e) {
11715
+ loadErrors.push(e);
11716
+ }
11717
+ } else {
11718
+ try {
11719
+ return require2("./parser.linux-arm-gnueabihf.node");
11720
+ } catch (e) {
11721
+ loadErrors.push(e);
11722
+ }
11723
+ try {
11724
+ const binding = require2("@oxc-parser/binding-linux-arm-gnueabihf");
11725
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-arm-gnueabihf/package.json").version;
11726
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11727
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11728
+ }
11729
+ return binding;
11730
+ } catch (e) {
11731
+ loadErrors.push(e);
11732
+ }
11733
+ }
11734
+ } else if (process.arch === "loong64") {
11735
+ if (isMusl()) {
11736
+ try {
11737
+ return require2("./parser.linux-loong64-musl.node");
11738
+ } catch (e) {
11739
+ loadErrors.push(e);
11740
+ }
11741
+ try {
11742
+ const binding = require2("@oxc-parser/binding-linux-loong64-musl");
11743
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-loong64-musl/package.json").version;
11744
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11745
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11746
+ }
11747
+ return binding;
11748
+ } catch (e) {
11749
+ loadErrors.push(e);
11750
+ }
11751
+ } else {
11752
+ try {
11753
+ return require2("./parser.linux-loong64-gnu.node");
11754
+ } catch (e) {
11755
+ loadErrors.push(e);
11756
+ }
11757
+ try {
11758
+ const binding = require2("@oxc-parser/binding-linux-loong64-gnu");
11759
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-loong64-gnu/package.json").version;
11760
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11761
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11762
+ }
11763
+ return binding;
11764
+ } catch (e) {
11765
+ loadErrors.push(e);
11766
+ }
11767
+ }
11768
+ } else if (process.arch === "riscv64") {
11769
+ if (isMusl()) {
11770
+ try {
11771
+ return require2("./parser.linux-riscv64-musl.node");
11772
+ } catch (e) {
11773
+ loadErrors.push(e);
11774
+ }
11775
+ try {
11776
+ const binding = require2("@oxc-parser/binding-linux-riscv64-musl");
11777
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-riscv64-musl/package.json").version;
11778
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11779
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11780
+ }
11781
+ return binding;
11782
+ } catch (e) {
11783
+ loadErrors.push(e);
11784
+ }
11785
+ } else {
11786
+ try {
11787
+ return require2("./parser.linux-riscv64-gnu.node");
11788
+ } catch (e) {
11789
+ loadErrors.push(e);
11790
+ }
11791
+ try {
11792
+ const binding = require2("@oxc-parser/binding-linux-riscv64-gnu");
11793
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-riscv64-gnu/package.json").version;
11794
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11795
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11796
+ }
11797
+ return binding;
11798
+ } catch (e) {
11799
+ loadErrors.push(e);
11800
+ }
11801
+ }
11802
+ } else if (process.arch === "ppc64") {
11803
+ try {
11804
+ return require2("./parser.linux-ppc64-gnu.node");
11805
+ } catch (e) {
11806
+ loadErrors.push(e);
11807
+ }
11808
+ try {
11809
+ const binding = require2("@oxc-parser/binding-linux-ppc64-gnu");
11810
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-ppc64-gnu/package.json").version;
11811
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11812
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11813
+ }
11814
+ return binding;
11815
+ } catch (e) {
11816
+ loadErrors.push(e);
11817
+ }
11818
+ } else if (process.arch === "s390x") {
11819
+ try {
11820
+ return require2("./parser.linux-s390x-gnu.node");
11821
+ } catch (e) {
11822
+ loadErrors.push(e);
11823
+ }
11824
+ try {
11825
+ const binding = require2("@oxc-parser/binding-linux-s390x-gnu");
11826
+ const bindingPackageVersion = require2("@oxc-parser/binding-linux-s390x-gnu/package.json").version;
11827
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11828
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11829
+ }
11830
+ return binding;
11831
+ } catch (e) {
11832
+ loadErrors.push(e);
11833
+ }
11834
+ } else {
11835
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
11836
+ }
11837
+ } else if (process.platform === "openharmony") {
11838
+ if (process.arch === "arm64") {
11839
+ try {
11840
+ return require2("./parser.openharmony-arm64.node");
11841
+ } catch (e) {
11842
+ loadErrors.push(e);
11843
+ }
11844
+ try {
11845
+ const binding = require2("@oxc-parser/binding-openharmony-arm64");
11846
+ const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-arm64/package.json").version;
11847
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11848
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11849
+ }
11850
+ return binding;
11851
+ } catch (e) {
11852
+ loadErrors.push(e);
11853
+ }
11854
+ } else if (process.arch === "x64") {
11855
+ try {
11856
+ return require2("./parser.openharmony-x64.node");
11857
+ } catch (e) {
11858
+ loadErrors.push(e);
11859
+ }
11860
+ try {
11861
+ const binding = require2("@oxc-parser/binding-openharmony-x64");
11862
+ const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-x64/package.json").version;
11863
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11864
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11865
+ }
11866
+ return binding;
11867
+ } catch (e) {
11868
+ loadErrors.push(e);
11869
+ }
11870
+ } else if (process.arch === "arm") {
11871
+ try {
11872
+ return require2("./parser.openharmony-arm.node");
11873
+ } catch (e) {
11874
+ loadErrors.push(e);
11875
+ }
11876
+ try {
11877
+ const binding = require2("@oxc-parser/binding-openharmony-arm");
11878
+ const bindingPackageVersion = require2("@oxc-parser/binding-openharmony-arm/package.json").version;
11879
+ if (bindingPackageVersion !== "0.101.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
11880
+ throw new Error(`Native binding package version mismatch, expected 0.101.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
11881
+ }
11882
+ return binding;
11883
+ } catch (e) {
11884
+ loadErrors.push(e);
11885
+ }
11886
+ } else {
11887
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
11888
+ }
11889
+ } else {
11890
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
11891
+ }
11892
+ }
11893
+ nativeBinding = requireNative();
11894
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
11895
+ let wasiBinding = null;
11896
+ let wasiBindingError = null;
11897
+ try {
11898
+ wasiBinding = require2("./parser.wasi.cjs");
11899
+ nativeBinding = wasiBinding;
11900
+ } catch (err) {
11901
+ if (process.env.NAPI_RS_FORCE_WASI) {
11902
+ wasiBindingError = err;
11903
+ }
11904
+ }
11905
+ if (!nativeBinding) {
11906
+ try {
11907
+ wasiBinding = require2("@oxc-parser/binding-wasm32-wasi");
11908
+ nativeBinding = wasiBinding;
11909
+ } catch (err) {
11910
+ if (process.env.NAPI_RS_FORCE_WASI) {
11911
+ wasiBindingError.cause = err;
11912
+ loadErrors.push(err);
11913
+ }
11914
+ }
11915
+ }
11916
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
11917
+ const error2 = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
11918
+ error2.cause = wasiBindingError;
11919
+ throw error2;
11920
+ }
11921
+ }
11922
+ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
11923
+ try {
11924
+ nativeBinding = require2("./webcontainer-fallback.cjs");
11925
+ } catch (err) {
11926
+ loadErrors.push(err);
11927
+ }
11928
+ }
11929
+ if (!nativeBinding) {
11930
+ if (loadErrors.length > 0) {
11931
+ throw 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.", {
11932
+ cause: loadErrors.reduce((err, cur) => {
11933
+ cur.cause = err;
11934
+ return cur;
11935
+ })
11936
+ });
11937
+ }
11938
+ throw new Error(`Failed to load native binding`);
11939
+ }
11940
+ var { Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parse: parse3, parseSync, rawTransferSupported } = nativeBinding;
11941
+
11942
+ // node_modules/oxc-parser/src-js/wrap.js
11943
+ function wrap(result) {
11944
+ let program, module3, comments, errors4;
11945
+ return {
11946
+ get program() {
11947
+ if (!program)
11948
+ program = jsonParseAst(result.program);
11949
+ return program;
11950
+ },
11951
+ get module() {
11952
+ if (!module3)
11953
+ module3 = result.module;
11954
+ return module3;
11955
+ },
11956
+ get comments() {
11957
+ if (!comments)
11958
+ comments = result.comments;
11959
+ return comments;
11960
+ },
11961
+ get errors() {
11962
+ if (!errors4)
11963
+ errors4 = result.errors;
11964
+ return errors4;
11965
+ }
11966
+ };
11967
+ }
11968
+ function jsonParseAst(programJson) {
11969
+ const { node: program, fixes } = JSON.parse(programJson);
11970
+ for (const fixPath of fixes) {
11971
+ applyFix(program, fixPath);
11972
+ }
11973
+ return program;
11974
+ }
11975
+ function applyFix(program, fixPath) {
11976
+ let node = program;
11977
+ for (const key of fixPath) {
11978
+ node = node[key];
11979
+ }
11980
+ if (node.bigint) {
11981
+ node.value = BigInt(node.bigint);
11982
+ } else {
11983
+ try {
11984
+ node.value = RegExp(node.regex.pattern, node.regex.flags);
11985
+ } catch {}
11986
+ }
11987
+ }
11988
+
11989
+ // node_modules/oxc-parser/generated/visit/keys.js
11990
+ var { freeze } = Object;
11991
+ var $EMPTY = freeze([]);
11992
+ var DECORATORS__KEY__TYPE_ANNOTATION__VALUE = freeze([
11993
+ "decorators",
11994
+ "key",
11995
+ "typeAnnotation",
11996
+ "value"
11997
+ ]);
11998
+ var LEFT__RIGHT = freeze(["left", "right"]);
11999
+ var ARGUMENT = freeze(["argument"]);
12000
+ var BODY = freeze(["body"]);
12001
+ var LABEL = freeze(["label"]);
12002
+ var CALLEE__TYPE_ARGUMENTS__ARGUMENTS = freeze(["callee", "typeArguments", "arguments"]);
12003
+ var EXPRESSION = freeze(["expression"]);
12004
+ var DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY = freeze([
12005
+ "decorators",
12006
+ "id",
12007
+ "typeParameters",
12008
+ "superClass",
12009
+ "superTypeArguments",
12010
+ "implements",
12011
+ "body"
12012
+ ]);
12013
+ var TEST__CONSEQUENT__ALTERNATE = freeze(["test", "consequent", "alternate"]);
12014
+ var LEFT__RIGHT__BODY = freeze(["left", "right", "body"]);
12015
+ var ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY = freeze([
12016
+ "id",
12017
+ "typeParameters",
12018
+ "params",
12019
+ "returnType",
12020
+ "body"
12021
+ ]);
12022
+ var KEY__VALUE = freeze(["key", "value"]);
12023
+ var LOCAL = freeze(["local"]);
12024
+ var OBJECT__PROPERTY = freeze(["object", "property"]);
12025
+ var DECORATORS__KEY__TYPE_ANNOTATION = freeze(["decorators", "key", "typeAnnotation"]);
12026
+ var EXPRESSION__TYPE_ANNOTATION = freeze(["expression", "typeAnnotation"]);
12027
+ var TYPE_PARAMETERS__PARAMS__RETURN_TYPE = freeze(["typeParameters", "params", "returnType"]);
12028
+ var EXPRESSION__TYPE_ARGUMENTS = freeze(["expression", "typeArguments"]);
12029
+ var MEMBERS = freeze(["members"]);
12030
+ var ID__BODY = freeze(["id", "body"]);
12031
+ var TYPES = freeze(["types"]);
12032
+ var TYPE_ANNOTATION = freeze(["typeAnnotation"]);
12033
+ var PARAMS = freeze(["params"]);
12034
+ var keys_default = freeze({
12035
+ DebuggerStatement: $EMPTY,
12036
+ EmptyStatement: $EMPTY,
12037
+ Literal: $EMPTY,
12038
+ PrivateIdentifier: $EMPTY,
12039
+ Super: $EMPTY,
12040
+ TemplateElement: $EMPTY,
12041
+ ThisExpression: $EMPTY,
12042
+ JSXClosingFragment: $EMPTY,
12043
+ JSXEmptyExpression: $EMPTY,
12044
+ JSXIdentifier: $EMPTY,
12045
+ JSXOpeningFragment: $EMPTY,
12046
+ JSXText: $EMPTY,
12047
+ TSAnyKeyword: $EMPTY,
12048
+ TSBigIntKeyword: $EMPTY,
12049
+ TSBooleanKeyword: $EMPTY,
12050
+ TSIntrinsicKeyword: $EMPTY,
12051
+ TSJSDocUnknownType: $EMPTY,
12052
+ TSNeverKeyword: $EMPTY,
12053
+ TSNullKeyword: $EMPTY,
12054
+ TSNumberKeyword: $EMPTY,
12055
+ TSObjectKeyword: $EMPTY,
12056
+ TSStringKeyword: $EMPTY,
12057
+ TSSymbolKeyword: $EMPTY,
12058
+ TSThisType: $EMPTY,
12059
+ TSUndefinedKeyword: $EMPTY,
12060
+ TSUnknownKeyword: $EMPTY,
12061
+ TSVoidKeyword: $EMPTY,
12062
+ AccessorProperty: DECORATORS__KEY__TYPE_ANNOTATION__VALUE,
12063
+ ArrayExpression: freeze(["elements"]),
12064
+ ArrayPattern: freeze(["decorators", "elements", "typeAnnotation"]),
12065
+ ArrowFunctionExpression: freeze(["typeParameters", "params", "returnType", "body"]),
12066
+ AssignmentExpression: LEFT__RIGHT,
12067
+ AssignmentPattern: freeze(["decorators", "left", "right", "typeAnnotation"]),
12068
+ AwaitExpression: ARGUMENT,
12069
+ BinaryExpression: LEFT__RIGHT,
12070
+ BlockStatement: BODY,
12071
+ BreakStatement: LABEL,
12072
+ CallExpression: CALLEE__TYPE_ARGUMENTS__ARGUMENTS,
12073
+ CatchClause: freeze(["param", "body"]),
12074
+ ChainExpression: EXPRESSION,
12075
+ ClassBody: BODY,
12076
+ ClassDeclaration: DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY,
12077
+ ClassExpression: DECORATORS__ID__TYPE_PARAMETERS__SUPER_CLASS__SUPER_TYPE_ARGUMENTS__IMPLEMENTS__BODY,
12078
+ ConditionalExpression: TEST__CONSEQUENT__ALTERNATE,
12079
+ ContinueStatement: LABEL,
12080
+ Decorator: EXPRESSION,
12081
+ DoWhileStatement: freeze(["body", "test"]),
12082
+ ExportAllDeclaration: freeze(["exported", "source", "attributes"]),
12083
+ ExportDefaultDeclaration: freeze(["declaration"]),
12084
+ ExportNamedDeclaration: freeze(["declaration", "specifiers", "source", "attributes"]),
12085
+ ExportSpecifier: freeze(["local", "exported"]),
12086
+ ExpressionStatement: EXPRESSION,
12087
+ ForInStatement: LEFT__RIGHT__BODY,
12088
+ ForOfStatement: LEFT__RIGHT__BODY,
12089
+ ForStatement: freeze(["init", "test", "update", "body"]),
12090
+ FunctionDeclaration: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
12091
+ FunctionExpression: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
12092
+ Identifier: freeze(["decorators", "typeAnnotation"]),
12093
+ IfStatement: TEST__CONSEQUENT__ALTERNATE,
12094
+ ImportAttribute: KEY__VALUE,
12095
+ ImportDeclaration: freeze(["specifiers", "source", "attributes"]),
12096
+ ImportDefaultSpecifier: LOCAL,
12097
+ ImportExpression: freeze(["source", "options"]),
12098
+ ImportNamespaceSpecifier: LOCAL,
12099
+ ImportSpecifier: freeze(["imported", "local"]),
12100
+ LabeledStatement: freeze(["label", "body"]),
12101
+ LogicalExpression: LEFT__RIGHT,
12102
+ MemberExpression: OBJECT__PROPERTY,
12103
+ MetaProperty: freeze(["meta", "property"]),
12104
+ MethodDefinition: freeze(["decorators", "key", "value"]),
12105
+ NewExpression: CALLEE__TYPE_ARGUMENTS__ARGUMENTS,
12106
+ ObjectExpression: freeze(["properties"]),
12107
+ ObjectPattern: freeze(["decorators", "properties", "typeAnnotation"]),
12108
+ ParenthesizedExpression: EXPRESSION,
12109
+ Program: BODY,
12110
+ Property: KEY__VALUE,
12111
+ PropertyDefinition: DECORATORS__KEY__TYPE_ANNOTATION__VALUE,
12112
+ RestElement: freeze(["decorators", "argument", "typeAnnotation"]),
12113
+ ReturnStatement: ARGUMENT,
12114
+ SequenceExpression: freeze(["expressions"]),
12115
+ SpreadElement: ARGUMENT,
12116
+ StaticBlock: BODY,
12117
+ SwitchCase: freeze(["test", "consequent"]),
12118
+ SwitchStatement: freeze(["discriminant", "cases"]),
12119
+ TaggedTemplateExpression: freeze(["tag", "typeArguments", "quasi"]),
12120
+ TemplateLiteral: freeze(["quasis", "expressions"]),
12121
+ ThrowStatement: ARGUMENT,
12122
+ TryStatement: freeze(["block", "handler", "finalizer"]),
12123
+ UnaryExpression: ARGUMENT,
12124
+ UpdateExpression: ARGUMENT,
12125
+ V8IntrinsicExpression: freeze(["name", "arguments"]),
12126
+ VariableDeclaration: freeze(["declarations"]),
12127
+ VariableDeclarator: freeze(["id", "init"]),
12128
+ WhileStatement: freeze(["test", "body"]),
12129
+ WithStatement: freeze(["object", "body"]),
12130
+ YieldExpression: ARGUMENT,
12131
+ JSXAttribute: freeze(["name", "value"]),
12132
+ JSXClosingElement: freeze(["name"]),
12133
+ JSXElement: freeze(["openingElement", "children", "closingElement"]),
12134
+ JSXExpressionContainer: EXPRESSION,
12135
+ JSXFragment: freeze(["openingFragment", "children", "closingFragment"]),
12136
+ JSXMemberExpression: OBJECT__PROPERTY,
12137
+ JSXNamespacedName: freeze(["namespace", "name"]),
12138
+ JSXOpeningElement: freeze(["name", "typeArguments", "attributes"]),
12139
+ JSXSpreadAttribute: ARGUMENT,
12140
+ JSXSpreadChild: EXPRESSION,
12141
+ TSAbstractAccessorProperty: DECORATORS__KEY__TYPE_ANNOTATION,
12142
+ TSAbstractMethodDefinition: KEY__VALUE,
12143
+ TSAbstractPropertyDefinition: DECORATORS__KEY__TYPE_ANNOTATION,
12144
+ TSArrayType: freeze(["elementType"]),
12145
+ TSAsExpression: EXPRESSION__TYPE_ANNOTATION,
12146
+ TSCallSignatureDeclaration: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
12147
+ TSClassImplements: EXPRESSION__TYPE_ARGUMENTS,
12148
+ TSConditionalType: freeze(["checkType", "extendsType", "trueType", "falseType"]),
12149
+ TSConstructSignatureDeclaration: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
12150
+ TSConstructorType: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
12151
+ TSDeclareFunction: ID__TYPE_PARAMETERS__PARAMS__RETURN_TYPE__BODY,
12152
+ TSEmptyBodyFunctionExpression: freeze(["id", "typeParameters", "params", "returnType"]),
12153
+ TSEnumBody: MEMBERS,
12154
+ TSEnumDeclaration: ID__BODY,
12155
+ TSEnumMember: freeze(["id", "initializer"]),
12156
+ TSExportAssignment: EXPRESSION,
12157
+ TSExternalModuleReference: EXPRESSION,
12158
+ TSFunctionType: TYPE_PARAMETERS__PARAMS__RETURN_TYPE,
12159
+ TSImportEqualsDeclaration: freeze(["id", "moduleReference"]),
12160
+ TSImportType: freeze(["argument", "options", "qualifier", "typeArguments"]),
12161
+ TSIndexSignature: freeze(["parameters", "typeAnnotation"]),
12162
+ TSIndexedAccessType: freeze(["objectType", "indexType"]),
12163
+ TSInferType: freeze(["typeParameter"]),
12164
+ TSInstantiationExpression: EXPRESSION__TYPE_ARGUMENTS,
12165
+ TSInterfaceBody: BODY,
12166
+ TSInterfaceDeclaration: freeze(["id", "typeParameters", "extends", "body"]),
12167
+ TSInterfaceHeritage: EXPRESSION__TYPE_ARGUMENTS,
12168
+ TSIntersectionType: TYPES,
12169
+ TSJSDocNonNullableType: TYPE_ANNOTATION,
12170
+ TSJSDocNullableType: TYPE_ANNOTATION,
12171
+ TSLiteralType: freeze(["literal"]),
12172
+ TSMappedType: freeze(["key", "constraint", "nameType", "typeAnnotation"]),
12173
+ TSMethodSignature: freeze(["key", "typeParameters", "params", "returnType"]),
12174
+ TSModuleBlock: BODY,
12175
+ TSModuleDeclaration: ID__BODY,
12176
+ TSNamedTupleMember: freeze(["label", "elementType"]),
12177
+ TSNamespaceExportDeclaration: freeze(["id"]),
12178
+ TSNonNullExpression: EXPRESSION,
12179
+ TSOptionalType: TYPE_ANNOTATION,
12180
+ TSParameterProperty: freeze(["decorators", "parameter"]),
12181
+ TSParenthesizedType: TYPE_ANNOTATION,
12182
+ TSPropertySignature: freeze(["key", "typeAnnotation"]),
12183
+ TSQualifiedName: LEFT__RIGHT,
12184
+ TSRestType: TYPE_ANNOTATION,
12185
+ TSSatisfiesExpression: EXPRESSION__TYPE_ANNOTATION,
12186
+ TSTemplateLiteralType: freeze(["quasis", "types"]),
12187
+ TSTupleType: freeze(["elementTypes"]),
12188
+ TSTypeAliasDeclaration: freeze(["id", "typeParameters", "typeAnnotation"]),
12189
+ TSTypeAnnotation: TYPE_ANNOTATION,
12190
+ TSTypeAssertion: freeze(["typeAnnotation", "expression"]),
12191
+ TSTypeLiteral: MEMBERS,
12192
+ TSTypeOperator: TYPE_ANNOTATION,
12193
+ TSTypeParameter: freeze(["name", "constraint", "default"]),
12194
+ TSTypeParameterDeclaration: PARAMS,
12195
+ TSTypeParameterInstantiation: PARAMS,
12196
+ TSTypePredicate: freeze(["parameterName", "typeAnnotation"]),
12197
+ TSTypeQuery: freeze(["exprName", "typeArguments"]),
12198
+ TSTypeReference: freeze(["typeName", "typeArguments"]),
12199
+ TSUnionType: TYPES
12200
+ });
12201
+ // node_modules/oxc-parser/src-js/visit/index.js
12202
+ import { createRequire as createRequire2 } from "node:module";
12203
+ var walkProgram = null;
12204
+ var addVisitorToCompiled;
12205
+ var createCompiledVisitor;
12206
+ var finalizeCompiledVisitor;
12207
+
12208
+ class Visitor {
12209
+ #compiledVisitor = null;
12210
+ constructor(visitor) {
12211
+ if (walkProgram === null) {
12212
+ const require3 = createRequire2(import.meta.url);
12213
+ ({ walkProgram } = require3("../../generated/visit/walk.js"));
12214
+ ({
12215
+ addVisitorToCompiled,
12216
+ createCompiledVisitor,
12217
+ finalizeCompiledVisitor
12218
+ } = require3("./visitor.js"));
12219
+ }
12220
+ const compiledVisitor = createCompiledVisitor();
12221
+ addVisitorToCompiled(visitor);
12222
+ const needsVisit = finalizeCompiledVisitor();
12223
+ if (needsVisit)
12224
+ this.#compiledVisitor = compiledVisitor;
12225
+ }
12226
+ visit(program) {
12227
+ const compiledVisitor = this.#compiledVisitor;
12228
+ if (compiledVisitor !== null)
12229
+ walkProgram(program, compiledVisitor);
12230
+ }
12231
+ }
12232
+
12233
+ // node_modules/oxc-parser/src-js/index.js
12234
+ var require3 = createRequire3(import.meta.url);
12235
+ var parseSyncRaw = null;
12236
+ var parseRaw;
12237
+ var parseSyncLazy = null;
12238
+ var parseLazy;
12239
+ var LazyVisitor;
12240
+ function loadRawTransfer() {
12241
+ if (parseSyncRaw === null) {
12242
+ ({ parseSyncRaw, parse: parseRaw } = require3("./raw-transfer/eager.js"));
12243
+ }
12244
+ }
12245
+ function loadRawTransferLazy() {
12246
+ if (parseSyncLazy === null) {
12247
+ ({ parseSyncLazy, parse: parseLazy, Visitor: LazyVisitor } = require3("./raw-transfer/lazy.js"));
12248
+ }
12249
+ }
12250
+ function parseSync2(filename, sourceText, options3) {
12251
+ if (options3?.experimentalRawTransfer) {
12252
+ loadRawTransfer();
12253
+ return parseSyncRaw(filename, sourceText, options3);
12254
+ }
12255
+ if (options3?.experimentalLazy) {
12256
+ loadRawTransferLazy();
12257
+ return parseSyncLazy(filename, sourceText, options3);
12258
+ }
12259
+ return wrap(parseSync(filename, sourceText, options3));
12260
+ }
12261
+
12262
+ // src/recognizers/detector.ts
12263
+ function recognize(detector, line) {
12264
+ const matches = detector.scan(line);
12265
+ if (matches === 0)
12266
+ return 0;
12267
+ return 1 - (1 - detector.probability) ** matches;
12268
+ }
12269
+
12270
+ // src/recognizers/code-recognizer.ts
12271
+ var PROBABILITY_THRESHOLD = 0.9;
12272
+ function computeProbability(detectors, line) {
12273
+ let probability = 0;
12274
+ for (const detector of detectors) {
12275
+ const detected = recognize(detector, line);
12276
+ probability = 1 - (1 - probability) * (1 - detected);
12277
+ }
12278
+ return probability;
12279
+ }
12280
+ function isLikelyCode(detectors, line) {
12281
+ return computeProbability(detectors, line) >= PROBABILITY_THRESHOLD;
12282
+ }
12283
+ function hasCodeLines(detectors, lines) {
12284
+ return lines.some((line) => isLikelyCode(detectors, line));
12285
+ }
12286
+
12287
+ // src/recognizers/camel-case-detector.ts
12288
+ function createCamelCaseDetector(probability) {
12289
+ return {
12290
+ probability,
12291
+ scan(line) {
12292
+ for (let index2 = 0;index2 < line.length - 1; index2 += 1) {
12293
+ const current = line.charAt(index2);
12294
+ const next = line.charAt(index2 + 1);
12295
+ if (current === current.toLowerCase() && next === next.toUpperCase() && next !== next.toLowerCase()) {
12296
+ return 1;
12297
+ }
12298
+ }
12299
+ return 0;
12300
+ }
12301
+ };
12302
+ }
12303
+
12304
+ // src/recognizers/contains-detector.ts
12305
+ var WHITESPACE_GLOBAL_REGEX = /\s+/g;
12306
+ var ESCAPE = /[-/\\^$*+?.()|[\]{}]/g;
12307
+ function escapeForRegex(value) {
12308
+ return value.replaceAll(ESCAPE, String.raw`\$&`);
12309
+ }
12310
+ function createContainsDetector(probability, patterns2) {
12311
+ const compiledPatterns = patterns2.map((pattern4) => typeof pattern4 === "string" ? new RegExp(escapeForRegex(pattern4), "g") : new RegExp(pattern4.source, "g"));
12312
+ return {
12313
+ probability,
12314
+ scan(line) {
12315
+ const compressed = line.replace(WHITESPACE_GLOBAL_REGEX, "");
12316
+ let total = 0;
12317
+ for (const pattern4 of compiledPatterns) {
12318
+ pattern4.lastIndex = 0;
12319
+ const matches = compressed.match(pattern4);
12320
+ if (matches)
12321
+ total += matches.length;
12322
+ }
12323
+ return total;
12324
+ }
12325
+ };
12326
+ }
12327
+
12328
+ // src/recognizers/end-with-detector.ts
12329
+ var WHITESPACE_REGEX = /\s/;
12330
+ function createEndWithDetector(probability, endings) {
12331
+ const endingsSet = new Set(endings);
12332
+ return {
12333
+ probability,
12334
+ scan(line) {
12335
+ for (let index2 = line.length - 1;index2 >= 0; index2 -= 1) {
12336
+ const char = line.charAt(index2);
12337
+ if (endingsSet.has(char))
12338
+ return 1;
12339
+ if (!WHITESPACE_REGEX.test(char) && char !== "*" && char !== "/")
12340
+ return 0;
12341
+ }
12342
+ return 0;
12343
+ }
12344
+ };
12345
+ }
12346
+
12347
+ // src/recognizers/keywords-detector.ts
12348
+ var WORD_SPLIT_REGEX = /[ \t(),{}]/;
12349
+ function createKeywordsDetector(probability, keywords) {
12350
+ const keywordsSet = new Set(keywords);
12351
+ return {
12352
+ probability,
12353
+ scan(line) {
12354
+ const words = line.split(WORD_SPLIT_REGEX);
12355
+ let count = 0;
12356
+ for (const word of words)
12357
+ if (keywordsSet.has(word))
12358
+ count += 1;
12359
+ return count;
12360
+ }
12361
+ };
12362
+ }
12363
+
12364
+ // src/recognizers/javascript-footprint.ts
12365
+ var JS_KEYWORDS = [
12366
+ "public",
12367
+ "abstract",
12368
+ "class",
12369
+ "implements",
12370
+ "extends",
12371
+ "return",
12372
+ "throw",
12373
+ "private",
12374
+ "protected",
12375
+ "enum",
12376
+ "continue",
12377
+ "assert",
12378
+ "boolean",
12379
+ "this",
12380
+ "instanceof",
12381
+ "interface",
12382
+ "static",
12383
+ "void",
12384
+ "super",
12385
+ "true",
12386
+ "case:",
12387
+ "let",
12388
+ "const",
12389
+ "var",
12390
+ "async",
12391
+ "await",
12392
+ "break",
12393
+ "yield",
12394
+ "typeof",
12395
+ "import",
12396
+ "export"
12397
+ ];
12398
+ var OPERATORS2 = ["++", "||", "&&", "===", "?.", "??"];
12399
+ var CODE_PATTERNS = [
12400
+ "for(",
12401
+ "if(",
12402
+ "while(",
12403
+ "catch(",
12404
+ "switch(",
12405
+ "try{",
12406
+ "else{",
12407
+ "this.",
12408
+ "window.",
12409
+ /;\s+\/\//,
12410
+ "import '",
12411
+ 'import "',
12412
+ "require("
12413
+ ];
12414
+ var LINE_ENDINGS = ["}", ";", "{"];
12415
+ function createJavaScriptDetectors() {
12416
+ return [
12417
+ createEndWithDetector(0.95, LINE_ENDINGS),
12418
+ createKeywordsDetector(0.7, OPERATORS2),
12419
+ createKeywordsDetector(0.3, JS_KEYWORDS),
12420
+ createContainsDetector(0.95, CODE_PATTERNS),
12421
+ createCamelCaseDetector(0.5)
12422
+ ];
12423
+ }
12424
+
12425
+ // src/rules/no-commented-code.ts
12426
+ var EXCLUDED_STATEMENTS = new Set(["BreakStatement", "LabeledStatement", "ContinueStatement"]);
12427
+ var detectors = createJavaScriptDetectors();
12428
+ function isCommentWithLocation(comment) {
12429
+ return comment.loc !== undefined && comment.range !== undefined;
12430
+ }
12431
+ function areAdjacentLineComments(previous, next, sourceCode) {
12432
+ const previousLine = previous.loc.start.line;
12433
+ const nextLine = next.loc.start.line;
12434
+ if (previousLine + 1 !== nextLine)
12435
+ return false;
12436
+ const commentForApi = {
12437
+ loc: previous.loc,
12438
+ range: previous.range,
12439
+ type: previous.type,
12440
+ value: previous.value
12441
+ };
12442
+ const tokenAfterPrevious = sourceCode.getTokenAfter(commentForApi);
12443
+ return !tokenAfterPrevious || tokenAfterPrevious.loc.start.line > nextLine;
12444
+ }
12445
+ function groupComments(comments, sourceCode) {
12446
+ const groups = new Array;
12447
+ let groupsSize = 0;
12448
+ let currentLineComments = new Array;
12449
+ let size = 0;
12450
+ for (const comment of comments) {
12451
+ if (!isCommentWithLocation(comment))
12452
+ continue;
12453
+ if (comment.type === "Block") {
12454
+ if (size > 0) {
12455
+ groups[groupsSize++] = {
12456
+ comments: currentLineComments,
12457
+ value: currentLineComments.map((c) => c.value).join(`
12458
+ `)
12459
+ };
12460
+ currentLineComments = [];
12461
+ size = 0;
12462
+ }
12463
+ groups[groupsSize++] = {
12464
+ comments: [comment],
12465
+ value: comment.value
12466
+ };
12467
+ } else if (size === 0)
12468
+ currentLineComments[size++] = comment;
12469
+ else {
12470
+ const lastComment = currentLineComments.at(-1);
12471
+ if (lastComment && areAdjacentLineComments(lastComment, comment, sourceCode)) {
12472
+ currentLineComments[size++] = comment;
12473
+ } else {
12474
+ groups[groupsSize++] = {
12475
+ comments: currentLineComments,
12476
+ value: currentLineComments.map(({ value }) => value).join(`
12477
+ `)
12478
+ };
12479
+ currentLineComments = [comment];
12480
+ size = 1;
12481
+ }
12482
+ }
12483
+ }
12484
+ if (size > 0) {
12485
+ groups[groupsSize++] = {
12486
+ comments: currentLineComments,
12487
+ value: currentLineComments.map(({ value }) => value).join(`
12488
+ `)
12489
+ };
12490
+ }
12491
+ return groups;
12492
+ }
12493
+ function injectMissingBraces(value) {
12494
+ const openCount = (value.match(/{/g) ?? []).length;
12495
+ const closeCount = (value.match(/}/g) ?? []).length;
12496
+ const diff2 = openCount - closeCount;
12497
+ if (diff2 > 0)
12498
+ return value + "}".repeat(diff2);
12499
+ if (diff2 < 0)
12500
+ return "{".repeat(-diff2) + value;
12501
+ return value;
12502
+ }
12503
+ function couldBeJsCode(input) {
12504
+ const lines = input.split(`
12505
+ `);
12506
+ return hasCodeLines(detectors, lines);
12507
+ }
12508
+ function isReturnOrThrowExclusion(statement) {
12509
+ if (statement.type !== "ReturnStatement" && statement.type !== "ThrowStatement")
12510
+ return false;
12511
+ return statement.argument === undefined || statement.argument.type === "Identifier";
12512
+ }
12513
+ function isUnaryPlusMinus(expression) {
12514
+ return expression.type === "UnaryExpression" && (expression.operator === "+" || expression.operator === "-");
12515
+ }
12516
+ function isExcludedLiteral(expression) {
12517
+ if (expression.type !== "Literal")
12518
+ return false;
12519
+ return typeof expression.value === "string" || typeof expression.value === "number";
12520
+ }
12521
+ function isRecord2(value) {
12522
+ return typeof value === "object" && value !== undefined;
12523
+ }
12524
+ function isParsedStatement(value) {
12525
+ if (!isRecord2(value))
12526
+ return false;
12527
+ return typeof value.type === "string";
12528
+ }
12529
+ function toParsedStatements(body) {
12530
+ const result = [];
12531
+ for (const item of body) {
12532
+ if (isParsedStatement(item))
12533
+ result.push(item);
12534
+ }
12535
+ return result;
12536
+ }
12537
+ function isExpressionExclusion(statement, codeText) {
12538
+ if (statement.type !== "ExpressionStatement")
12539
+ return false;
12540
+ const expression = statement.expression;
12541
+ if (!expression)
12542
+ return false;
12543
+ if (expression.type === "Identifier")
12544
+ return true;
12545
+ if (expression.type === "SequenceExpression")
12546
+ return true;
12547
+ if (isUnaryPlusMinus(expression))
12548
+ return true;
12549
+ if (isExcludedLiteral(expression))
12550
+ return true;
12551
+ if (!codeText.trimEnd().endsWith(";"))
12552
+ return true;
12553
+ return false;
12554
+ }
12555
+ function isExclusion(statements, codeText) {
12556
+ if (statements.length !== 1)
12557
+ return false;
12558
+ const statement = statements.at(0);
12559
+ if (!statement)
12560
+ return false;
12561
+ if (EXCLUDED_STATEMENTS.has(statement.type))
12562
+ return true;
12563
+ if (isReturnOrThrowExclusion(statement))
12564
+ return true;
12565
+ if (isExpressionExclusion(statement, codeText))
12566
+ return true;
12567
+ return false;
12568
+ }
12569
+ var ALLOWED_PARSE_ERROR_PATTERNS = [/A 'return' statement can only be used within a function body/];
12570
+ function hasOnlyAllowedErrors(errors4) {
12571
+ return errors4.every((error2) => ALLOWED_PARSE_ERROR_PATTERNS.some((pattern4) => pattern4.test(error2.message)));
12572
+ }
12573
+ function isValidParseResult(result) {
12574
+ const hasValidErrors = result.errors.length === 0 || hasOnlyAllowedErrors(result.errors);
12575
+ return hasValidErrors && result.program.body.length > 0;
12576
+ }
12577
+ function tryParse(value, filename) {
12578
+ const ext = path.extname(filename);
12579
+ const parseFilename = `file${ext || ".js"}`;
12580
+ const result = parseSync2(parseFilename, value);
12581
+ if (isValidParseResult(result))
12582
+ return result;
12583
+ if (ext !== ".tsx" && ext !== ".jsx") {
12584
+ const jsxResult = parseSync2("file.tsx", value);
12585
+ if (isValidParseResult(jsxResult))
12586
+ return jsxResult;
12587
+ }
12588
+ return;
12589
+ }
12590
+ function containsCode(value, filename) {
12591
+ if (!couldBeJsCode(value))
12592
+ return false;
12593
+ try {
12594
+ const result = tryParse(value, filename);
12595
+ if (!result)
12596
+ return false;
12597
+ const statements = toParsedStatements(result.program.body);
12598
+ return !isExclusion(statements, value);
12599
+ } catch {
12600
+ return false;
12601
+ }
12602
+ }
12603
+ var noCommentedCode = {
12604
+ create(context) {
12605
+ return {
12606
+ "Program:exit"() {
12607
+ const allComments = context.sourceCode.getAllComments();
12608
+ const groups = groupComments(allComments, context.sourceCode);
12609
+ for (const group of groups) {
12610
+ const trimmedValue = group.value.trim();
12611
+ if (trimmedValue === "}")
12612
+ continue;
12613
+ const balanced = injectMissingBraces(trimmedValue);
12614
+ if (containsCode(balanced, context.filename)) {
12615
+ const firstComment = group.comments.at(0);
12616
+ const lastComment = group.comments.at(-1);
12617
+ if (!firstComment || !lastComment)
12618
+ continue;
12619
+ context.report({
12620
+ loc: {
12621
+ end: lastComment.loc.end,
12622
+ start: firstComment.loc.start
12623
+ },
12624
+ messageId: "commentedCode",
12625
+ suggest: [
12626
+ {
12627
+ desc: "Remove this commented out code",
12628
+ fix(fixer) {
12629
+ return fixer.removeRange([firstComment.range[0], lastComment.range[1]]);
12630
+ }
12631
+ }
12632
+ ]
12633
+ });
12634
+ }
12635
+ }
12636
+ }
12637
+ };
12638
+ },
12639
+ meta: {
12640
+ docs: {
12641
+ description: "Disallow commented-out code",
12642
+ recommended: false
12643
+ },
12644
+ hasSuggestions: true,
12645
+ messages: {
12646
+ commentedCode: "Remove this commented out code."
12647
+ },
12648
+ schema: [],
12649
+ type: "suggestion"
12650
+ }
12651
+ };
12652
+ var no_commented_code_default = noCommentedCode;
12653
+
11371
12654
  // src/rules/use-hook-at-top-level.ts
11372
12655
  import { TSESTree as TSESTree10 } from "@typescript-eslint/types";
11373
12656
  var HOOK_NAME_PATTERN = /^use[A-Z]/;
@@ -11790,6 +13073,7 @@ var rules = {
11790
13073
  "enforce-ianitor-check-type": enforce_ianitor_check_type_default,
11791
13074
  "no-async-constructor": no_async_constructor_default,
11792
13075
  "no-color3-constructor": no_color3_constructor_default,
13076
+ "no-commented-code": no_commented_code_default,
11793
13077
  "no-instance-methods-without-this": no_instance_methods_without_this_default,
11794
13078
  "no-print": no_print_default,
11795
13079
  "no-shorthand-names": no_shorthand_names_default,
@@ -11846,4 +13130,4 @@ export {
11846
13130
  createBanInstancesOptions
11847
13131
  };
11848
13132
 
11849
- //# debugId=734DB8BE5C92D79464756E2164756E21
13133
+ //# debugId=F981FE172662E0F564756E2164756E21