@@ -595,10 +595,15 @@ func (c *FileCompiler) Compile(ctx context.Context) error {
595
595
for _ , sourceFile := range sourceFiles {
596
596
functions := imports [sourceFile ]
597
597
if len (functions ) > 0 {
598
+ // Apply sanitization to function names
599
+ var sanitizedFunctions []string
600
+ for _ , fn := range functions {
601
+ sanitizedFunctions = append (sanitizedFunctions , sanitizeIdentifier (fn ))
602
+ }
598
603
// Sort functions for consistent output
599
- sort .Strings (functions )
604
+ sort .Strings (sanitizedFunctions )
600
605
c .codeWriter .WriteLinef ("import { %s } from \" ./%s.gs.js\" ;" ,
601
- strings .Join (functions , ", " ), sourceFile )
606
+ strings .Join (sanitizedFunctions , ", " ), sourceFile )
602
607
}
603
608
}
604
609
}
@@ -649,10 +654,15 @@ func (c *FileCompiler) Compile(ctx context.Context) error {
649
654
}
650
655
651
656
if len (nonProtobufTypes ) > 0 {
657
+ // Apply sanitization to type names
658
+ var sanitizedTypes []string
659
+ for _ , typeName := range nonProtobufTypes {
660
+ sanitizedTypes = append (sanitizedTypes , sanitizeIdentifier (typeName ))
661
+ }
652
662
// Sort types for consistent output
653
- sort .Strings (nonProtobufTypes )
663
+ sort .Strings (sanitizedTypes )
654
664
c .codeWriter .WriteLinef ("import { %s } from \" ./%s.gs.js\" ;" ,
655
- strings .Join (nonProtobufTypes , ", " ), sourceFile )
665
+ strings .Join (sanitizedTypes , ", " ), sourceFile )
656
666
}
657
667
}
658
668
}
0 commit comments