@@ -76,7 +76,7 @@ export class ImportBuilder {
7676
7777 private add ( name : string , from : string , isAll : boolean ) : void {
7878 // biome-ignore lint/style/noParameterAssign: <explanation>
79- from = this . normalizeFrom ( from )
79+ from = ImportBuilder . normalizeFrom ( from , this . unit ?. filename )
8080 // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
8181 const imports = ( this . imports [ from ] =
8282 this . imports [ from ] ?? new Set < string > ( ) )
@@ -88,14 +88,15 @@ export class ImportBuilder {
8888 }
8989 }
9090
91- private normalizeFrom ( from : string ) {
91+ public static normalizeFrom ( from : string , filename ? : string ) {
9292 if ( from . endsWith ( ".ts" ) ) {
9393 // biome-ignore lint/style/noParameterAssign: <explanation>
9494 from = from . substring ( 0 , from . length - ".ts" . length )
9595 }
9696
97- if ( this . unit && from . startsWith ( "./" ) ) {
98- const unitDirname = path . dirname ( this . unit . filename )
97+ // TODO: does this work on windows?
98+ if ( filename && from . startsWith ( "./" ) ) {
99+ const unitDirname = path . dirname ( filename )
99100 const fromDirname = path . dirname ( from )
100101
101102 const relative = path . relative ( unitDirname , fromDirname )
0 commit comments