From df66011c7c66500a7161470597042da41faaea0e Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sat, 15 Aug 2015 18:18:44 -0400 Subject: [PATCH] handle export * (all function tests now passing) --- src/Bundle.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Bundle.js b/src/Bundle.js index eb61c75..a0ac207 100644 --- a/src/Bundle.js +++ b/src/Bundle.js @@ -223,7 +223,18 @@ export default class Bundle { } const exportDeclaration = otherModule.exports[ importDeclaration.name ]; - return trace( otherModule, exportDeclaration.localName ); + if ( exportDeclaration ) return trace( otherModule, exportDeclaration.localName ); + + for ( let i = 0; i < otherModule.exportDelegates.length; i += 1 ) { + const delegate = otherModule.exportDelegates[i]; + const delegateExportDeclaration = delegate.module.exports[ importDeclaration.name ]; + + if ( delegateExportDeclaration ) { + return trace( delegate.module, delegateExportDeclaration.localName ); + } + } + + throw new Error( 'Could not trace binding' ); } function getSafeName ( name ) {