@@ -26,11 +26,12 @@ class HarmonyExportImportedSpecifierDependency extends NullDependency {
2626 const active = HarmonyModulesHelpers . isActive ( this . originModule , this ) ;
2727 const importedModule = this . importDependency . module ;
2828
29- if ( ! importedModule || ! used || ! active ) return null ;
30- if ( ! this . originModule . usedExports ) return null ;
29+ if ( ! importedModule || ! used || ! active || ! this . originModule . usedExports ) return null ;
30+
31+ const hasUsedExports = Array . isArray ( this . originModule . usedExports ) ;
3132
3233 if ( name ) {
33- const nameIsNotInUsedExports = Array . isArray ( this . originModule . usedExports ) && this . originModule . usedExports . indexOf ( name ) < 0 ;
34+ const nameIsNotInUsedExports = hasUsedExports && this . originModule . usedExports . indexOf ( name ) < 0 ;
3435 if ( nameIsNotInUsedExports ) return null ;
3536
3637 // export { name as name }
@@ -48,33 +49,31 @@ class HarmonyExportImportedSpecifierDependency extends NullDependency {
4849 } ;
4950 }
5051
52+ const hasProvidedExports = Array . isArray ( importedModule . providedExports ) ;
53+
5154 // export *
52- if ( Array . isArray ( this . originModule . usedExports ) ) {
55+ if ( hasUsedExports ) {
5356 // reexport * with known used exports
54- var activeExports = HarmonyModulesHelpers . getActiveExports ( this . originModule , this ) ;
55- if ( Array . isArray ( importedModule . providedExports ) ) {
56- return {
57- module : importedModule ,
58- importedNames : this . originModule . usedExports . filter ( ( id ) => {
59- const notInActiveExports = activeExports . indexOf ( id ) < 0 ;
60- const notDefault = id !== "default" ;
61- const inProvidedExports = importedModule . providedExports . indexOf ( id ) >= 0 ;
62- return notInActiveExports && notDefault && inProvidedExports ;
63- } ) ,
64- } ;
65- }
57+ const activeExports = HarmonyModulesHelpers . getActiveExports ( this . originModule , this ) ;
58+ const importedNames = this . originModule . usedExports . filter ( id => {
59+ const notInActiveExports = activeExports . indexOf ( id ) < 0 ;
60+ const notDefault = id !== "default" ;
61+
62+ if ( hasProvidedExports ) {
63+ const inProvidedExports = importedModule . providedExports . indexOf ( id ) >= 0 ;
64+ return notInActiveExports && notDefault && inProvidedExports ;
65+ } else {
66+ return notInActiveExports && notDefault ;
67+ }
68+ } ) ;
6669
6770 return {
6871 module : importedModule ,
69- importedNames : this . originModule . usedExports . filter ( id => {
70- const notInActiveExports = activeExports . indexOf ( id ) < 0 ;
71- const notDefault = id !== "default" ;
72- return notInActiveExports && notDefault ;
73- } ) ,
72+ importedNames
7473 } ;
7574 }
7675
77- if ( Array . isArray ( importedModule . providedExports ) ) {
76+ if ( hasProvidedExports ) {
7877 return {
7978 module : importedModule ,
8079 importedNames : importedModule . providedExports . filter ( id => id !== "default" ) ,
0 commit comments