File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,8 @@ export default class ExportMap {
149
149
} else if ( s . type === 'ExportSpecifier' && namespaces . has ( s . local . name ) ) {
150
150
let namespace = m . resolveReExport ( namespaces . get ( s . local . name ) , path )
151
151
if ( namespace ) exportMeta . namespace = namespace . named
152
+ } else if ( s . type === 'ExportNamespaceSpecifier' ) {
153
+ exportMeta . namespace = remoteMap . named
152
154
}
153
155
154
156
// todo: JSDoc
Original file line number Diff line number Diff line change @@ -195,4 +195,23 @@ describe('getExports', function () {
195
195
} )
196
196
} )
197
197
198
+ context ( 'exported static namespaces' , function ( ) {
199
+ const espreeContext = { parserPath : 'espree' , parserOptions : { sourceType : 'module' } , settings : { } }
200
+ const babelContext = { parserPath : 'babel-eslint' , parserOptions : { sourceType : 'module' } , settings : { } }
201
+
202
+ it ( 'works with espree & traditional namespace exports' , function ( ) {
203
+ const a = ExportMap . parse ( getFilename ( 'deep/a.js' ) , espreeContext )
204
+ expect ( a . errors ) . to . be . empty
205
+ expect ( a . named . get ( 'b' ) . namespace ) . to . exist
206
+ expect ( a . named . get ( 'b' ) . namespace . has ( 'c' ) ) . to . be . true
207
+ } )
208
+
209
+ it ( 'works with babel-eslint & ES7 namespace exports' , function ( ) {
210
+ const a = ExportMap . parse ( getFilename ( 'deep-es7/a.js' ) , babelContext )
211
+ expect ( a . errors ) . to . be . empty
212
+ expect ( a . named . get ( 'b' ) . namespace ) . to . exist
213
+ expect ( a . named . get ( 'b' ) . namespace . has ( 'c' ) ) . to . be . true
214
+ } )
215
+ } )
216
+
198
217
} )
You can’t perform that action at this time.
0 commit comments