@@ -92,16 +92,7 @@ function getFileInfo(ast, filepath) {
92
92
) {
93
93
isRNEntry = true
94
94
}
95
- } ,
96
-
97
- ExportNamedDeclaration : path => {
98
- path . node . specifiers . forEach ( spe => {
99
- const name = spe . exported . name
100
- ex [ name ] = {
101
-
102
- }
103
- } )
104
- } ,
95
+ }
105
96
} )
106
97
107
98
@@ -115,6 +106,13 @@ function getFileInfo(ast, filepath) {
115
106
return
116
107
}
117
108
109
+ // export {A} from './A'
110
+ if ( path . type === 'ExportNamedDeclaration' && ( path . node as t . ExportNamedDeclaration ) . source ) {
111
+ // TODO
112
+ handleExportSource ( path , filepath , JSXElements , im )
113
+ return
114
+ }
115
+
118
116
// @ts -ignore
119
117
if ( path . type === 'CallExpression' && path . node . callee . name === 'require' && path . key === 'init' ) {
120
118
handleRequire ( path , filepath , JSXElements , im )
@@ -204,3 +202,29 @@ function handleImport(path, filepath, JSXElements, im) {
204
202
}
205
203
206
204
205
+ function handleExportSource ( path , filepath , JSXElements , im ) {
206
+ const relativePath = path . node . source . value
207
+
208
+ const idens = [ ]
209
+ path . node . specifiers . forEach ( spe => {
210
+ //spe = spe as t.ImportSpecifier
211
+ const name = spe . exported . name
212
+ im [ name ] = {
213
+ source : relativePath ,
214
+ defaultSpecifier : spe . type === 'ImportDefaultSpecifier' ,
215
+ // @ts -ignore
216
+ imported : spe . type === 'ImportSpecifier' ? spe . imported . name : null ,
217
+ }
218
+
219
+ idens . push ( name )
220
+ } )
221
+
222
+ const isLibPath = judgeLibPath ( relativePath )
223
+ if ( ! isLibPath ) return
224
+
225
+ const isCompPack = idens . some ( iden => JSXElements . has ( iden ) )
226
+ if ( ! isCompPack ) return
227
+
228
+ getLibCompInfos ( idens , JSXElements , filepath , relativePath )
229
+ }
230
+
0 commit comments