@@ -18,34 +18,27 @@ import { ExportNamedDeclaration, ExportDefaultDeclaration } from 'estree';
18
18
import { ExportDetails , Range , ExportClosureMapping } from '../types' ;
19
19
20
20
export function NamedDeclaration ( declaration : ExportNamedDeclaration ) : Array < ExportDetails > {
21
- const range : Range = declaration . range as Range ;
21
+ const exportDetails : Array < ExportDetails > = [ ] ;
22
22
const source : string | null =
23
23
typeof declaration ?. source ?. value === 'string' ? declaration . source . value : null ;
24
24
25
- if ( declaration . specifiers ) {
26
- const exportDetails : Array < ExportDetails > = [ ] ;
27
-
28
- for ( const specifier of declaration . specifiers ) {
29
- exportDetails . push ( {
30
- local : specifier . local . name ,
31
- exported : specifier . exported . name ,
32
- closureName : specifier . exported . name ,
33
- type : ExportClosureMapping . NAMED_CONSTANT ,
34
- range,
35
- source,
36
- } ) ;
37
- }
38
-
39
- return exportDetails ;
25
+ for ( const specifier of declaration . specifiers ) {
26
+ exportDetails . push ( {
27
+ local : specifier . local . name ,
28
+ exported : specifier . exported . name ,
29
+ closureName : specifier . exported . name ,
30
+ type : ExportClosureMapping . NAMED_CONSTANT ,
31
+ range : declaration . range as Range ,
32
+ source,
33
+ } ) ;
40
34
}
41
35
42
- return [ ] ;
36
+ return exportDetails ;
43
37
}
44
38
45
39
export function DefaultDeclaration (
46
40
defaultDeclaration : ExportDefaultDeclaration ,
47
41
) : Array < ExportDetails > {
48
- const range : Range = defaultDeclaration . range as Range ;
49
42
const { declaration } = defaultDeclaration ;
50
43
51
44
if ( declaration . type === 'Identifier' && declaration . name ) {
@@ -55,7 +48,7 @@ export function DefaultDeclaration(
55
48
exported : declaration . name ,
56
49
closureName : declaration . name ,
57
50
type : ExportClosureMapping . NAMED_DEFAULT_FUNCTION ,
58
- range,
51
+ range : defaultDeclaration . range as Range ,
59
52
source : null ,
60
53
} ,
61
54
] ;
0 commit comments