File tree 1 file changed +7
-3
lines changed
packages/cli/src/sourcegen
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,17 @@ import { IdentifierValue } from './identifier'
6
6
type Content = Declaration | Value
7
7
8
8
export class Program {
9
- #imports = new Map < string , string [ ] > ( )
9
+ #imports = new Map < string , Set < string > > ( )
10
10
#variables = new Map < string , IdentifierValue > ( )
11
11
#counters = new Map < string , number > ( )
12
12
#sections: Content [ ] = [ ]
13
13
14
14
import ( type : string , from : string ) {
15
- this . #imports. set ( from , ( this . #imports. get ( from ) || [ ] ) . concat ( [ type ] ) )
15
+ if ( this . #imports. has ( from ) ) {
16
+ this . #imports. get ( from ) ?. add ( type )
17
+ } else {
18
+ this . #imports. set ( from , new Set ( [ type ] ) )
19
+ }
16
20
}
17
21
18
22
#inc ( key : string ) : number {
@@ -46,7 +50,7 @@ export class Program {
46
50
output . cosmeticWhitespace ( )
47
51
output . append ( '{' )
48
52
let first = true
49
- for ( const type of types ) {
53
+ for ( const type of Array . from ( types ) . sort ( ) ) {
50
54
if ( ! first ) {
51
55
output . append ( ',' )
52
56
}
You can’t perform that action at this time.
0 commit comments