oxc 0.1.0-arm-linux-gnu → 0.149.0-arm-linux-gnu
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.
- checksums.yaml +4 -4
- data/README.md +173 -0
- data/ext/oxc/extconf.rb +2 -2
- data/lib/oxc/3.2/oxc.so +0 -0
- data/lib/oxc/3.3/oxc.so +0 -0
- data/lib/oxc/3.4/oxc.so +0 -0
- data/lib/oxc/4.0/oxc.so +0 -0
- data/lib/oxc/diagnostic.rb +1 -1
- data/lib/oxc/mutation_visitor.rb +128 -0
- data/lib/oxc/node.rb +186 -0
- data/lib/oxc/options.rb +2 -2
- data/lib/oxc/parse_result.rb +15 -5
- data/lib/oxc/result.rb +1 -1
- data/lib/oxc/version.rb +1 -1
- data/lib/oxc/visitor.rb +25 -0
- data/lib/oxc.rb +6 -3
- data/rust/Cargo.lock +47 -54
- data/rust/Cargo.toml +1 -2
- data/rust/build.rs +22 -0
- data/rust/src/lib.rs +2 -2
- data/rust/src/parse.rs +1 -1
- data/sig/oxc/mutation_visitor.rbs +80 -0
- data/sig/oxc/node.rbs +94 -0
- data/sig/oxc/options.rbs +2 -2
- data/sig/oxc/parse_result.rbs +9 -4
- data/sig/oxc/result.rbs +2 -2
- data/sig/oxc/visitor.rbs +11 -0
- metadata +8 -2
data/lib/oxc.rb
CHANGED
|
@@ -19,6 +19,9 @@ require_relative "oxc/diagnosed"
|
|
|
19
19
|
require_relative "oxc/result"
|
|
20
20
|
require_relative "oxc/minify_result"
|
|
21
21
|
require_relative "oxc/transform_result"
|
|
22
|
+
require_relative "oxc/node"
|
|
23
|
+
require_relative "oxc/visitor"
|
|
24
|
+
require_relative "oxc/mutation_visitor"
|
|
22
25
|
require_relative "oxc/parse_result"
|
|
23
26
|
require_relative "oxc/transformer"
|
|
24
27
|
require_relative "oxc/minifier"
|
|
@@ -28,21 +31,21 @@ module Oxc
|
|
|
28
31
|
def self.minify(source, **options)
|
|
29
32
|
serialized = Options.serialize(options, Options::MINIFY, "minify")
|
|
30
33
|
|
|
31
|
-
MinifyResult.from_json(Backend.minify(source.to_s, serialized)).validate!(strict: options[:strict])
|
|
34
|
+
MinifyResult.from_json(Backend.minify(source.to_s, serialized)).validate!(strict: options[:strict] ? true : false)
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
#: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?cwd: String?, ?target: targets?, ?jsx: jsx?, ?typescript: typescript?, ?assumptions: assumptions?, ?decorator: decorator?, ?helpers: helpers?, ?define: Hash[String, String]?, ?inject: inject?, ?minify: minify?, ?codegen: codegen?, ?sourcemap: bool, ?strict: bool) -> Oxc::TransformResult
|
|
35
38
|
def self.transform(source, **options)
|
|
36
39
|
serialized = Options.serialize(options, Options::TRANSFORM, "transform")
|
|
37
40
|
|
|
38
|
-
TransformResult.from_json(Backend.transform(source.to_s, serialized)).validate!(strict: options[:strict])
|
|
41
|
+
TransformResult.from_json(Backend.transform(source.to_s, serialized)).validate!(strict: options[:strict] ? true : false)
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
#: (String, ?filename: String?, ?lang: String?, ?source_type: String?, ?ast_type: String?, ?ast: bool, ?ranges: bool, ?preserve_parens: bool, ?comments: bool, ?module_record: bool, ?symbols: bool, ?semantic_errors: bool) -> Oxc::ParseResult
|
|
42
45
|
def self.parse(source, **options)
|
|
43
46
|
serialized = Options.serialize(options, Options::PARSE, "parse")
|
|
44
47
|
|
|
45
|
-
ParseResult.from_json(Backend.parse(source.to_s, serialized))
|
|
48
|
+
ParseResult.from_json(Backend.parse(source.to_s, serialized), source.to_s)
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
#: () -> String
|
data/rust/Cargo.lock
CHANGED
|
@@ -470,17 +470,11 @@ version = "0.5.2"
|
|
|
470
470
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
471
471
|
checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e"
|
|
472
472
|
|
|
473
|
-
[[package]]
|
|
474
|
-
name = "owo-colors"
|
|
475
|
-
version = "4.3.0"
|
|
476
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
477
|
-
checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d"
|
|
478
|
-
|
|
479
473
|
[[package]]
|
|
480
474
|
name = "oxc"
|
|
481
|
-
version = "0.
|
|
475
|
+
version = "0.149.0"
|
|
482
476
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
483
|
-
checksum = "
|
|
477
|
+
checksum = "689ab90be0e2cbd3448dc88794ef7645196b82da6f3943c20c8710c34ac5d290"
|
|
484
478
|
dependencies = [
|
|
485
479
|
"oxc_allocator",
|
|
486
480
|
"oxc_ast",
|
|
@@ -517,7 +511,7 @@ dependencies = [
|
|
|
517
511
|
|
|
518
512
|
[[package]]
|
|
519
513
|
name = "oxc-ruby-ffi"
|
|
520
|
-
version = "0.
|
|
514
|
+
version = "0.0.0"
|
|
521
515
|
dependencies = [
|
|
522
516
|
"cbindgen",
|
|
523
517
|
"oxc",
|
|
@@ -528,9 +522,9 @@ dependencies = [
|
|
|
528
522
|
|
|
529
523
|
[[package]]
|
|
530
524
|
name = "oxc_allocator"
|
|
531
|
-
version = "0.
|
|
525
|
+
version = "0.149.0"
|
|
532
526
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
533
|
-
checksum = "
|
|
527
|
+
checksum = "48c2dbd560f65d113e7114eb5857e346493062ac665d3bd49426d50a02cc1969"
|
|
534
528
|
dependencies = [
|
|
535
529
|
"allocator-api2",
|
|
536
530
|
"hashbrown",
|
|
@@ -542,9 +536,9 @@ dependencies = [
|
|
|
542
536
|
|
|
543
537
|
[[package]]
|
|
544
538
|
name = "oxc_ast"
|
|
545
|
-
version = "0.
|
|
539
|
+
version = "0.149.0"
|
|
546
540
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
547
|
-
checksum = "
|
|
541
|
+
checksum = "9e9bdb56efa22b6eb5c213f512a838521a2433905d25da4e3021d3fac0bc7d1d"
|
|
548
542
|
dependencies = [
|
|
549
543
|
"bitflags",
|
|
550
544
|
"oxc_allocator",
|
|
@@ -560,9 +554,9 @@ dependencies = [
|
|
|
560
554
|
|
|
561
555
|
[[package]]
|
|
562
556
|
name = "oxc_ast_macros"
|
|
563
|
-
version = "0.
|
|
557
|
+
version = "0.149.0"
|
|
564
558
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
565
|
-
checksum = "
|
|
559
|
+
checksum = "af8a6c6decb4887b04e0dc49c8dd862037d1f6b274cd32d931faf37184a5e5dd"
|
|
566
560
|
dependencies = [
|
|
567
561
|
"phf",
|
|
568
562
|
"proc-macro2",
|
|
@@ -572,9 +566,9 @@ dependencies = [
|
|
|
572
566
|
|
|
573
567
|
[[package]]
|
|
574
568
|
name = "oxc_ast_visit"
|
|
575
|
-
version = "0.
|
|
569
|
+
version = "0.149.0"
|
|
576
570
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
577
|
-
checksum = "
|
|
571
|
+
checksum = "83aaab313b5275faea8cee175d489589f6271a6223b128ec9abaa48339d0a66b"
|
|
578
572
|
dependencies = [
|
|
579
573
|
"oxc_allocator",
|
|
580
574
|
"oxc_ast",
|
|
@@ -584,9 +578,9 @@ dependencies = [
|
|
|
584
578
|
|
|
585
579
|
[[package]]
|
|
586
580
|
name = "oxc_codegen"
|
|
587
|
-
version = "0.
|
|
581
|
+
version = "0.149.0"
|
|
588
582
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
589
|
-
checksum = "
|
|
583
|
+
checksum = "a313a091df12abad72542deeba21e6b44e37dd4a2ed66bf3159acc1aa68f0ef0"
|
|
590
584
|
dependencies = [
|
|
591
585
|
"bitflags",
|
|
592
586
|
"cow-utils",
|
|
@@ -606,9 +600,9 @@ dependencies = [
|
|
|
606
600
|
|
|
607
601
|
[[package]]
|
|
608
602
|
name = "oxc_compat"
|
|
609
|
-
version = "0.
|
|
603
|
+
version = "0.149.0"
|
|
610
604
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
611
|
-
checksum = "
|
|
605
|
+
checksum = "367175d382eca8c9c2c931d4350fe66b7b10fc73f57b691acdf557fd8003c91d"
|
|
612
606
|
dependencies = [
|
|
613
607
|
"cow-utils",
|
|
614
608
|
"oxc-browserslist",
|
|
@@ -619,24 +613,23 @@ dependencies = [
|
|
|
619
613
|
|
|
620
614
|
[[package]]
|
|
621
615
|
name = "oxc_data_structures"
|
|
622
|
-
version = "0.
|
|
616
|
+
version = "0.149.0"
|
|
623
617
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
624
|
-
checksum = "
|
|
618
|
+
checksum = "ac25bee569c0af652786ab2e39dc7815957ca3767dc2c3e3e2776f5028f8d30d"
|
|
625
619
|
dependencies = [
|
|
626
620
|
"ropey",
|
|
627
621
|
]
|
|
628
622
|
|
|
629
623
|
[[package]]
|
|
630
624
|
name = "oxc_diagnostics"
|
|
631
|
-
version = "0.
|
|
625
|
+
version = "0.149.0"
|
|
632
626
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
633
|
-
checksum = "
|
|
627
|
+
checksum = "b92d1704adbad84b5d8a4e9d34e3937da7d230883726f0d96d7f2757a2b60aba"
|
|
634
628
|
dependencies = [
|
|
635
629
|
"bytecount",
|
|
636
630
|
"cow-utils",
|
|
637
631
|
"itoa",
|
|
638
632
|
"memchr",
|
|
639
|
-
"owo-colors",
|
|
640
633
|
"oxc_span",
|
|
641
634
|
"percent-encoding",
|
|
642
635
|
"smallvec",
|
|
@@ -647,9 +640,9 @@ dependencies = [
|
|
|
647
640
|
|
|
648
641
|
[[package]]
|
|
649
642
|
name = "oxc_ecmascript"
|
|
650
|
-
version = "0.
|
|
643
|
+
version = "0.149.0"
|
|
651
644
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
652
|
-
checksum = "
|
|
645
|
+
checksum = "1d3cb15b9e142737d38e50366be0ead824f7d16bee3ac47c79839d50deb2324b"
|
|
653
646
|
dependencies = [
|
|
654
647
|
"cow-utils",
|
|
655
648
|
"dragonbox_ecma",
|
|
@@ -668,9 +661,9 @@ dependencies = [
|
|
|
668
661
|
|
|
669
662
|
[[package]]
|
|
670
663
|
name = "oxc_estree"
|
|
671
|
-
version = "0.
|
|
664
|
+
version = "0.149.0"
|
|
672
665
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
673
|
-
checksum = "
|
|
666
|
+
checksum = "11c7a17be65f4c12b02e2e62eb9368272f2ed794801552b437fa654253ce06dd"
|
|
674
667
|
dependencies = [
|
|
675
668
|
"dragonbox_ecma",
|
|
676
669
|
"itoa",
|
|
@@ -689,9 +682,9 @@ dependencies = [
|
|
|
689
682
|
|
|
690
683
|
[[package]]
|
|
691
684
|
name = "oxc_isolated_declarations"
|
|
692
|
-
version = "0.
|
|
685
|
+
version = "0.149.0"
|
|
693
686
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
694
|
-
checksum = "
|
|
687
|
+
checksum = "f0993224aefb691db2297dd0a8d095fc15fe2ede8484273d8258004da0caa777"
|
|
695
688
|
dependencies = [
|
|
696
689
|
"bitflags",
|
|
697
690
|
"oxc_allocator",
|
|
@@ -707,9 +700,9 @@ dependencies = [
|
|
|
707
700
|
|
|
708
701
|
[[package]]
|
|
709
702
|
name = "oxc_mangler"
|
|
710
|
-
version = "0.
|
|
703
|
+
version = "0.149.0"
|
|
711
704
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
712
|
-
checksum = "
|
|
705
|
+
checksum = "53188efb7700e8c17a6c65a7cc89b8f964de3eea8cf0012def779f35f54c23b7"
|
|
713
706
|
dependencies = [
|
|
714
707
|
"itertools",
|
|
715
708
|
"oxc_allocator",
|
|
@@ -726,9 +719,9 @@ dependencies = [
|
|
|
726
719
|
|
|
727
720
|
[[package]]
|
|
728
721
|
name = "oxc_minifier"
|
|
729
|
-
version = "0.
|
|
722
|
+
version = "0.149.0"
|
|
730
723
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
731
|
-
checksum = "
|
|
724
|
+
checksum = "ab7fa9470010de2d1ac8388b18a4c4165d3fa0cd137cb03a2a5066e56c3a8f5f"
|
|
732
725
|
dependencies = [
|
|
733
726
|
"cow-utils",
|
|
734
727
|
"itoa",
|
|
@@ -752,9 +745,9 @@ dependencies = [
|
|
|
752
745
|
|
|
753
746
|
[[package]]
|
|
754
747
|
name = "oxc_parser"
|
|
755
|
-
version = "0.
|
|
748
|
+
version = "0.149.0"
|
|
756
749
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
757
|
-
checksum = "
|
|
750
|
+
checksum = "c6ac968fd0450309168e18c761dee4b68377bc0bbd4e1eb4e23d1c4d2e2cc825"
|
|
758
751
|
dependencies = [
|
|
759
752
|
"bitflags",
|
|
760
753
|
"cow-utils",
|
|
@@ -776,9 +769,9 @@ dependencies = [
|
|
|
776
769
|
|
|
777
770
|
[[package]]
|
|
778
771
|
name = "oxc_regular_expression"
|
|
779
|
-
version = "0.
|
|
772
|
+
version = "0.149.0"
|
|
780
773
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
781
|
-
checksum = "
|
|
774
|
+
checksum = "18ef364ac0d7e5beda9e59a3fea4ba050da6e34720c10c7c0a16b3993373ba52"
|
|
782
775
|
dependencies = [
|
|
783
776
|
"bitflags",
|
|
784
777
|
"oxc_allocator",
|
|
@@ -793,9 +786,9 @@ dependencies = [
|
|
|
793
786
|
|
|
794
787
|
[[package]]
|
|
795
788
|
name = "oxc_semantic"
|
|
796
|
-
version = "0.
|
|
789
|
+
version = "0.149.0"
|
|
797
790
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
798
|
-
checksum = "
|
|
791
|
+
checksum = "62853caf83c33ff2da0dd2d5a7b2ed6f907a29306aae34ec65807d8bf10c2c68"
|
|
799
792
|
dependencies = [
|
|
800
793
|
"itertools",
|
|
801
794
|
"memchr",
|
|
@@ -829,9 +822,9 @@ dependencies = [
|
|
|
829
822
|
|
|
830
823
|
[[package]]
|
|
831
824
|
name = "oxc_span"
|
|
832
|
-
version = "0.
|
|
825
|
+
version = "0.149.0"
|
|
833
826
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
834
|
-
checksum = "
|
|
827
|
+
checksum = "8305f2b3c5e2030658fba8457260d313dbf5fe442c40c184f54a3a50eb42365c"
|
|
835
828
|
dependencies = [
|
|
836
829
|
"compact_str",
|
|
837
830
|
"oxc_allocator",
|
|
@@ -843,9 +836,9 @@ dependencies = [
|
|
|
843
836
|
|
|
844
837
|
[[package]]
|
|
845
838
|
name = "oxc_str"
|
|
846
|
-
version = "0.
|
|
839
|
+
version = "0.149.0"
|
|
847
840
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
848
|
-
checksum = "
|
|
841
|
+
checksum = "16486b3832d8f1355283030ae048c5ae530d8a57e2cdfd9514e0d6cdbd4c5506"
|
|
849
842
|
dependencies = [
|
|
850
843
|
"compact_str",
|
|
851
844
|
"hashbrown",
|
|
@@ -856,9 +849,9 @@ dependencies = [
|
|
|
856
849
|
|
|
857
850
|
[[package]]
|
|
858
851
|
name = "oxc_syntax"
|
|
859
|
-
version = "0.
|
|
852
|
+
version = "0.149.0"
|
|
860
853
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
861
|
-
checksum = "
|
|
854
|
+
checksum = "8c10f6276b8d5e3df514299a6a93241276531f2801853c3309a86805be278664"
|
|
862
855
|
dependencies = [
|
|
863
856
|
"bitflags",
|
|
864
857
|
"cow-utils",
|
|
@@ -877,9 +870,9 @@ dependencies = [
|
|
|
877
870
|
|
|
878
871
|
[[package]]
|
|
879
872
|
name = "oxc_transformer"
|
|
880
|
-
version = "0.
|
|
873
|
+
version = "0.149.0"
|
|
881
874
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
882
|
-
checksum = "
|
|
875
|
+
checksum = "801fc17aeac563535b2809ba775a73f7ba343412e36943d5733855f7a3c7be3e"
|
|
883
876
|
dependencies = [
|
|
884
877
|
"base64",
|
|
885
878
|
"compact_str",
|
|
@@ -907,9 +900,9 @@ dependencies = [
|
|
|
907
900
|
|
|
908
901
|
[[package]]
|
|
909
902
|
name = "oxc_transformer_plugins"
|
|
910
|
-
version = "0.
|
|
903
|
+
version = "0.149.0"
|
|
911
904
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
912
|
-
checksum = "
|
|
905
|
+
checksum = "a36a4772e42d0c3c21de41f5cc6e2755af559aee0b326fc4dbc179e94fcdd1df"
|
|
913
906
|
dependencies = [
|
|
914
907
|
"cow-utils",
|
|
915
908
|
"itoa",
|
|
@@ -930,9 +923,9 @@ dependencies = [
|
|
|
930
923
|
|
|
931
924
|
[[package]]
|
|
932
925
|
name = "oxc_traverse"
|
|
933
|
-
version = "0.
|
|
926
|
+
version = "0.149.0"
|
|
934
927
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
935
|
-
checksum = "
|
|
928
|
+
checksum = "cdd746d75af6792d45df91d68a7252834a9aab30f0ea2cedf270137ad6e7dde6"
|
|
936
929
|
dependencies = [
|
|
937
930
|
"itoa",
|
|
938
931
|
"oxc_allocator",
|
data/rust/Cargo.toml
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[package]
|
|
4
4
|
name = "oxc-ruby-ffi"
|
|
5
|
-
version = "0.1.0"
|
|
6
5
|
edition = "2021"
|
|
7
6
|
authors = ["Marco Roth <marco.roth@intergga.ch>"]
|
|
8
7
|
description = "C FFI bindings for oxc, used by the oxc gem"
|
|
@@ -16,7 +15,7 @@ path = "src/lib.rs"
|
|
|
16
15
|
crate-type = ["cdylib", "staticlib", "rlib"]
|
|
17
16
|
|
|
18
17
|
[dependencies]
|
|
19
|
-
oxc = { version = "=0.
|
|
18
|
+
oxc = { version = "=0.149.0", features = ["full", "serialize"] }
|
|
20
19
|
oxc_sourcemap = "8"
|
|
21
20
|
serde = { version = "1", features = ["derive"] }
|
|
22
21
|
serde_json = { version = "1", features = ["raw_value"] }
|
data/rust/build.rs
CHANGED
|
@@ -28,7 +28,29 @@ fn main() {
|
|
|
28
28
|
PathBuf::from(&crate_dir).join("cbindgen.toml").display()
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
+
let version_rb_path = PathBuf::from(&crate_dir).join("../lib/oxc/version.rb");
|
|
32
|
+
|
|
33
|
+
println!("cargo:rerun-if-changed={}", version_rb_path.display());
|
|
34
|
+
|
|
31
35
|
println!("cargo:rustc-env=OXC_VERSION={}", locked_version(&lock_path, "oxc"));
|
|
36
|
+
|
|
37
|
+
println!("cargo:rustc-env=GEM_VERSION={}", gem_version(&version_rb_path));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fn gem_version(version_rb_path: &PathBuf) -> String {
|
|
41
|
+
let Ok(source) = fs::read_to_string(version_rb_path) else {
|
|
42
|
+
return "unknown".to_string();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
for line in source.lines() {
|
|
46
|
+
let Some(rest) = line.trim().strip_prefix("VERSION = ") else {
|
|
47
|
+
continue;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return rest.trim().trim_matches('"').to_string();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
"unknown".to_string()
|
|
32
54
|
}
|
|
33
55
|
|
|
34
56
|
fn locked_version(lock_path: &PathBuf, package: &str) -> String {
|
data/rust/src/lib.rs
CHANGED
|
@@ -37,7 +37,7 @@ use crate::result::{MinifyPayload, TransformPayload};
|
|
|
37
37
|
use crate::source_type::source_type_for;
|
|
38
38
|
use crate::transform::Compiler;
|
|
39
39
|
|
|
40
|
-
pub const VERSION: &str = env!("
|
|
40
|
+
pub const VERSION: &str = env!("GEM_VERSION");
|
|
41
41
|
pub const OXC_VERSION: &str = env!("OXC_VERSION");
|
|
42
42
|
|
|
43
43
|
#[repr(C)]
|
|
@@ -200,7 +200,7 @@ fn minify_source(source: &str, options: &MinifyOptions) -> Result<MinifyPayload,
|
|
|
200
200
|
map,
|
|
201
201
|
legal_comments,
|
|
202
202
|
errors: Diagnostic::from_diagnostics(&filename, source, parsed.diagnostics),
|
|
203
|
-
panicked: parsed.
|
|
203
|
+
panicked: parsed.fatal_error,
|
|
204
204
|
})
|
|
205
205
|
}
|
|
206
206
|
|
data/rust/src/parse.rs
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Generated from lib/oxc/mutation_visitor.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Oxc
|
|
4
|
+
# A visitor that rewrites the source it walked, by recording what to do to a node and splicing the
|
|
5
|
+
# original text at the end. Everything nothing touched survives byte for byte.
|
|
6
|
+
#
|
|
7
|
+
# class Renamer < Oxc::MutationVisitor
|
|
8
|
+
# def visit_identifier(node)
|
|
9
|
+
# replace(node, "renamed") if node["name"] == "count"
|
|
10
|
+
# end
|
|
11
|
+
# end
|
|
12
|
+
#
|
|
13
|
+
# Renamer.new.rewrite("let count = 1") #=> "let renamed = 1"
|
|
14
|
+
class MutationVisitor < Visitor
|
|
15
|
+
class Overlap < StandardError
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Invalid < Error
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Edit < Data
|
|
22
|
+
attr_reader start(): Integer
|
|
23
|
+
|
|
24
|
+
attr_reader finish(): Integer
|
|
25
|
+
|
|
26
|
+
attr_reader text(): String
|
|
27
|
+
|
|
28
|
+
attr_reader order(): Integer
|
|
29
|
+
|
|
30
|
+
def self.new: (Integer start, Integer finish, String text, Integer order) -> instance
|
|
31
|
+
| (start: Integer, finish: Integer, text: String, order: Integer) -> instance
|
|
32
|
+
|
|
33
|
+
def self.members: () -> [ :start, :finish, :text, :order ]
|
|
34
|
+
|
|
35
|
+
def members: () -> [ :start, :finish, :text, :order ]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
attr_reader source: String
|
|
39
|
+
|
|
40
|
+
attr_reader parsed: Oxc::ParseResult
|
|
41
|
+
|
|
42
|
+
# : (String, ?verify: bool, **untyped) -> String
|
|
43
|
+
def rewrite: (String, ?verify: bool, **untyped) -> String
|
|
44
|
+
|
|
45
|
+
# : (Oxc::Node, String) -> void
|
|
46
|
+
def replace: (Oxc::Node, String) -> void
|
|
47
|
+
|
|
48
|
+
# : (Oxc::Node) -> void
|
|
49
|
+
def remove: (Oxc::Node) -> void
|
|
50
|
+
|
|
51
|
+
# : (Oxc::Node, String) -> void
|
|
52
|
+
def insert_before: (Oxc::Node, String) -> void
|
|
53
|
+
|
|
54
|
+
# : (Oxc::Node, String) -> void
|
|
55
|
+
def insert_after: (Oxc::Node, String) -> void
|
|
56
|
+
|
|
57
|
+
# : (Oxc::Node, String, String) -> void
|
|
58
|
+
def wrap: (Oxc::Node, String, String) -> void
|
|
59
|
+
|
|
60
|
+
# : (Oxc::Node) -> void
|
|
61
|
+
def visit_children: (Oxc::Node) -> void
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
# : (String, Hash[Symbol, untyped]) -> String
|
|
66
|
+
def verified: (String, Hash[Symbol, untyped]) -> String
|
|
67
|
+
|
|
68
|
+
# : (Oxc::Node) -> bool
|
|
69
|
+
def replaced?: (Oxc::Node) -> bool
|
|
70
|
+
|
|
71
|
+
# : (Integer, Integer, String) -> void
|
|
72
|
+
def edit: (Integer, Integer, String) -> void
|
|
73
|
+
|
|
74
|
+
# : (Edit, Integer, Integer) -> bool
|
|
75
|
+
def overlaps?: (Edit, Integer, Integer) -> bool
|
|
76
|
+
|
|
77
|
+
# : () -> String
|
|
78
|
+
def apply: () -> String
|
|
79
|
+
end
|
|
80
|
+
end
|
data/sig/oxc/node.rbs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Generated from lib/oxc/node.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Oxc
|
|
4
|
+
class Node
|
|
5
|
+
include Enumerable[Oxc::Node]
|
|
6
|
+
|
|
7
|
+
ACRONYM: Regexp
|
|
8
|
+
|
|
9
|
+
BOUNDARY: Regexp
|
|
10
|
+
|
|
11
|
+
SPAN: Array[String]
|
|
12
|
+
|
|
13
|
+
attr_reader parent: Oxc::Node?
|
|
14
|
+
|
|
15
|
+
attr_reader attributes: Hash[String, untyped]
|
|
16
|
+
|
|
17
|
+
attr_reader text: String?
|
|
18
|
+
|
|
19
|
+
public
|
|
20
|
+
|
|
21
|
+
# : (Hash[String, untyped], ?Oxc::Node?, ?String?) -> void
|
|
22
|
+
def initialize: (Hash[String, untyped], ?Oxc::Node?, ?String?) -> void
|
|
23
|
+
|
|
24
|
+
# : () -> String
|
|
25
|
+
def type: () -> String
|
|
26
|
+
|
|
27
|
+
# : () -> Integer
|
|
28
|
+
def start: () -> Integer
|
|
29
|
+
|
|
30
|
+
# : () -> Integer
|
|
31
|
+
def finish: () -> Integer
|
|
32
|
+
|
|
33
|
+
# : () -> String
|
|
34
|
+
def underscored_type: () -> String
|
|
35
|
+
|
|
36
|
+
# : (String) -> untyped
|
|
37
|
+
def []: (String) -> untyped
|
|
38
|
+
|
|
39
|
+
# : (?String?) -> String?
|
|
40
|
+
def slice: (?String?) -> String?
|
|
41
|
+
|
|
42
|
+
# : () -> Array[String]
|
|
43
|
+
def keys: () -> Array[String]
|
|
44
|
+
|
|
45
|
+
# : () -> Hash[String, untyped]
|
|
46
|
+
def to_h: () -> Hash[String, untyped]
|
|
47
|
+
|
|
48
|
+
# : (?untyped) -> String
|
|
49
|
+
def to_json: (?untyped) -> String
|
|
50
|
+
|
|
51
|
+
# : (Array[Symbol]?) -> Hash[Symbol, untyped]
|
|
52
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, untyped]
|
|
53
|
+
|
|
54
|
+
# : () -> Array[Oxc::Node]
|
|
55
|
+
def child_nodes: () -> Array[Oxc::Node]
|
|
56
|
+
|
|
57
|
+
# : () { (Oxc::Node) -> void } -> void
|
|
58
|
+
# : () -> Enumerator[Oxc::Node, void]
|
|
59
|
+
def each: () { (Oxc::Node) -> void } -> void
|
|
60
|
+
| () -> Enumerator[Oxc::Node, void]
|
|
61
|
+
|
|
62
|
+
# : () -> Array[Oxc::Node]
|
|
63
|
+
def ancestors: () -> Array[Oxc::Node]
|
|
64
|
+
|
|
65
|
+
# : (Integer) -> Oxc::Node?
|
|
66
|
+
def at: (Integer) -> Oxc::Node?
|
|
67
|
+
|
|
68
|
+
# : (String) -> Array[Oxc::Node]
|
|
69
|
+
def every: (String) -> Array[Oxc::Node]
|
|
70
|
+
|
|
71
|
+
# : () -> Hash[String, untyped]
|
|
72
|
+
def fields: () -> Hash[String, untyped]
|
|
73
|
+
|
|
74
|
+
# : () -> String
|
|
75
|
+
def inspect: () -> String
|
|
76
|
+
|
|
77
|
+
# : (Symbol, *untyped) -> untyped
|
|
78
|
+
def method_missing: (Symbol, *untyped) -> untyped
|
|
79
|
+
|
|
80
|
+
# : (Symbol, ?bool) -> bool
|
|
81
|
+
def respond_to_missing?: (Symbol, ?bool) -> bool
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
# : (String, untyped) -> String
|
|
86
|
+
def described_field: (String, untyped) -> String
|
|
87
|
+
|
|
88
|
+
# : (String) -> String?
|
|
89
|
+
def field_for: (String) -> String?
|
|
90
|
+
|
|
91
|
+
# : (untyped) -> untyped
|
|
92
|
+
def wrap: (untyped) -> untyped
|
|
93
|
+
end
|
|
94
|
+
end
|
data/sig/oxc/options.rbs
CHANGED
|
@@ -25,8 +25,8 @@ module Oxc
|
|
|
25
25
|
# : (Hash[Symbol, untyped], ?Array[Symbol], ?String) -> void
|
|
26
26
|
def initialize: (Hash[Symbol, untyped], ?Array[Symbol], ?String) -> void
|
|
27
27
|
|
|
28
|
-
# : (?
|
|
29
|
-
def to_json: (?
|
|
28
|
+
# : (?JSON::options?) -> String
|
|
29
|
+
def to_json: (?JSON::options?) -> String
|
|
30
30
|
|
|
31
31
|
# : () -> String
|
|
32
32
|
def inspect: () -> String
|
data/sig/oxc/parse_result.rbs
CHANGED
|
@@ -4,6 +4,8 @@ module Oxc
|
|
|
4
4
|
class ParseResult
|
|
5
5
|
include Diagnosed
|
|
6
6
|
|
|
7
|
+
attr_reader source: String?
|
|
8
|
+
|
|
7
9
|
attr_reader program: Hash[String, untyped]?
|
|
8
10
|
|
|
9
11
|
attr_reader module_record: Hash[String, untyped]?
|
|
@@ -14,11 +16,14 @@ module Oxc
|
|
|
14
16
|
|
|
15
17
|
attr_reader diagnostics: Array[Oxc::Diagnostic]
|
|
16
18
|
|
|
17
|
-
# : (String) -> Oxc::ParseResult
|
|
18
|
-
def self.from_json: (String) -> Oxc::ParseResult
|
|
19
|
+
# : (String, ?String?) -> Oxc::ParseResult
|
|
20
|
+
def self.from_json: (String, ?String?) -> Oxc::ParseResult
|
|
21
|
+
|
|
22
|
+
# : (comments: Array[Oxc::Comment], diagnostics: Array[Oxc::Diagnostic], ?source: String?, ?program: Hash[String, untyped]?, ?module_record: Hash[String, untyped]?, ?symbols: Hash[String, untyped]?, ?panicked: bool) -> void
|
|
23
|
+
def initialize: (comments: Array[Oxc::Comment], diagnostics: Array[Oxc::Diagnostic], ?source: String?, ?program: Hash[String, untyped]?, ?module_record: Hash[String, untyped]?, ?symbols: Hash[String, untyped]?, ?panicked: bool) -> void
|
|
19
24
|
|
|
20
|
-
# : (
|
|
21
|
-
def
|
|
25
|
+
# : () -> Oxc::Node?
|
|
26
|
+
def root: () -> Oxc::Node?
|
|
22
27
|
|
|
23
28
|
# : () -> Oxc::ParseResult
|
|
24
29
|
def validate!: () -> Oxc::ParseResult
|
data/sig/oxc/result.rbs
CHANGED
|
@@ -15,8 +15,8 @@ module Oxc
|
|
|
15
15
|
# : (code: String, diagnostics: Array[Oxc::Diagnostic], ?map: String?, ?legal_comments: Array[String], ?panicked: bool) -> void
|
|
16
16
|
def initialize: (code: String, diagnostics: Array[Oxc::Diagnostic], ?map: String?, ?legal_comments: Array[String], ?panicked: bool) -> void
|
|
17
17
|
|
|
18
|
-
# : (?strict:
|
|
19
|
-
def validate!: (?strict:
|
|
18
|
+
# : (?strict: bool?) -> self
|
|
19
|
+
def validate!: (?strict: bool?) -> self
|
|
20
20
|
|
|
21
21
|
# : () -> String
|
|
22
22
|
def to_s: () -> String
|
data/sig/oxc/visitor.rbs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Generated from lib/oxc/visitor.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Oxc
|
|
4
|
+
class Visitor
|
|
5
|
+
# : (Oxc::Node | Oxc::ParseResult) -> void
|
|
6
|
+
def visit: (Oxc::Node | Oxc::ParseResult) -> void
|
|
7
|
+
|
|
8
|
+
# : (Oxc::Node) -> void
|
|
9
|
+
def visit_children: (Oxc::Node) -> void
|
|
10
|
+
end
|
|
11
|
+
end
|