File tree 7 files changed +47
-0
lines changed
swc/tests/fixture/issues-9xxx/9685
7 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_ecma_transforms_base : patch
3
+ swc_core : patch
4
+ ---
5
+
6
+ fix(es/resolver): Skip resolving lowercase JSXIdentifiers
Original file line number Diff line number Diff line change
1
+ export namespace form {
2
+ export const input = null ;
3
+ export const test = < input />
4
+ }
Original file line number Diff line number Diff line change
1
+ ( function ( form ) {
2
+ form . input = null ;
3
+ form . test = /*#__PURE__*/ React . createElement ( "input" , null ) ;
4
+ } ) ( form || ( form = { } ) ) ;
5
+ export var form ;
Original file line number Diff line number Diff line change @@ -920,6 +920,28 @@ impl VisitMut for Resolver<'_> {
920
920
f. body . visit_mut_with ( self ) ;
921
921
}
922
922
923
+ fn visit_mut_jsx_element_name ( & mut self , node : & mut JSXElementName ) {
924
+ if let JSXElementName :: Ident ( i) = node {
925
+ if i. as_ref ( ) . starts_with ( |c : char | c. is_ascii_lowercase ( ) ) {
926
+ if cfg ! ( debug_assertions) && LOG {
927
+ debug ! ( "\t -> JSXElementName" ) ;
928
+ }
929
+
930
+ let ctxt = i. ctxt . apply_mark ( self . config . unresolved_mark ) ;
931
+
932
+ if cfg ! ( debug_assertions) && LOG {
933
+ debug ! ( "\t -> {:?}" , ctxt) ;
934
+ }
935
+
936
+ i. ctxt = ctxt;
937
+
938
+ return ;
939
+ }
940
+ }
941
+
942
+ node. visit_mut_children_with ( self ) ;
943
+ }
944
+
923
945
fn visit_mut_ident ( & mut self , i : & mut Ident ) {
924
946
if i. ctxt != SyntaxContext :: empty ( ) {
925
947
return ;
Original file line number Diff line number Diff line change @@ -84,10 +84,12 @@ fn test_resolver(input: PathBuf) {
84
84
}
85
85
86
86
#[ fixture( "tests/ts-resolver/**/input.ts" ) ]
87
+ #[ fixture( "tests/ts-resolver/**/input.tsx" ) ]
87
88
fn test_ts_resolver ( input : PathBuf ) {
88
89
run (
89
90
Syntax :: Typescript ( TsSyntax {
90
91
decorators : true ,
92
+ tsx : input. extension ( ) . filter ( |ext| * ext == "tsx" ) . is_some ( ) ,
91
93
..Default :: default ( )
92
94
} ) ,
93
95
& input,
Original file line number Diff line number Diff line change
1
+ export namespace form {
2
+ export const input = null ;
3
+ export const test = < input /> ;
4
+ }
Original file line number Diff line number Diff line change
1
+ export namespace form__2 {
2
+ export const input__3 = null ;
3
+ export const test__3 = < input /> ;
4
+ }
You can’t perform that action at this time.
0 commit comments