@@ -109,6 +109,21 @@ export default class ExportLookup {
109109 return exportsByModule ;
110110 }
111111
112+ getExportSpec ( moduleId ) {
113+ const { exports, recorder : rec } = module ( System , moduleId ) . getFrozenRecord ( ) ;
114+ const exportSpec = [ ] ;
115+ if ( ! rec . __module_exports__ ) return exportSpec ;
116+ for ( let exp of rec . __module_exports__ ) {
117+ if ( exp . startsWith ( '__rename__' ) ) {
118+ const [ local , exported ] = exp . replace ( '__rename__' , '' ) . split ( '->' ) ;
119+ exportSpec ( { local, exported, type : 'id' } ) ;
120+ }
121+ else if ( exp . startsWith ( '__reexport__' ) ) exportSpec . push ( ...this . getExportSpec ( exp . replace ( '__reexport__' , '' ) ) ) ;
122+ else exportSpec . push ( { local : exp , exported : exp , type : 'id' } )
123+ }
124+ return exports ;
125+ }
126+
112127 async rawExportsOfModule ( moduleId , opts = { } ) {
113128 let { System, exportByModuleCache : cache } = this ;
114129 let excludedPackages = opts . excludedPackages || [ ] ;
@@ -153,7 +168,9 @@ export default class ExportLookup {
153168 if ( [ 'register' , 'es6' , 'esm' ] . includes ( format ) ) {
154169 const cached = await System . _livelyModulesTranslationCache . fetchStoredModuleSource ( mod . id ) ;
155170 if ( cached && cached . exports ) result . exports = JSON . parse ( cached . exports ) ;
156- else result . exports = await mod . exports ( ) ;
171+ else if ( mod . _frozenModule ) {
172+ result . exports = getExportSpec ( mod . id ) ;
173+ } else result . exports = await mod . exports ( ) ;
157174 } else {
158175 await mod . load ( ) ;
159176 let moduleRecord = mod . _recorder ;
0 commit comments