@@ -14,6 +14,7 @@ import type { IFetchAstSymbolOptions } from './AstSymbolTable';
14
14
import type { AstEntity } from './AstEntity' ;
15
15
import { AstNamespaceImport } from './AstNamespaceImport' ;
16
16
import { SyntaxHelpers } from './SyntaxHelpers' ;
17
+ import { AstNamespaceExport } from './AstNamespaceExport' ;
17
18
18
19
/**
19
20
* Exposes the minimal APIs from AstSymbolTable that are needed by ExportAnalyzer.
@@ -562,11 +563,9 @@ export class ExportAnalyzer {
562
563
// SemicolonToken: pre=[;]
563
564
564
565
// Issue tracking this feature: https://github.com/microsoft/rushstack/issues/2780
565
- throw new Error (
566
- `The "export * as ___" syntax is not supported yet; as a workaround,` +
567
- ` use "import * as ___" with a separate "export { ___ }" declaration\n` +
568
- SourceFileLocationFormatter . formatDeclaration ( declaration )
569
- ) ;
566
+
567
+ const astModule : AstModule = this . _fetchSpecifierAstModule ( exportDeclaration , declarationSymbol ) ;
568
+ return this . _getAstNamespaceExport ( astModule , declarationSymbol , declaration ) ;
570
569
} else {
571
570
throw new InternalError (
572
571
`Unimplemented export declaration kind: ${ declaration . getText ( ) } \n` +
@@ -594,6 +593,25 @@ export class ExportAnalyzer {
594
593
return undefined ;
595
594
}
596
595
596
+ private _getAstNamespaceExport (
597
+ astModule : AstModule ,
598
+ declarationSymbol : ts . Symbol ,
599
+ declaration : ts . Declaration
600
+ ) : AstNamespaceExport {
601
+ const imoprtNamespace : AstNamespaceImport = this . _getAstNamespaceImport (
602
+ astModule ,
603
+ declarationSymbol ,
604
+ declaration
605
+ ) ;
606
+
607
+ return new AstNamespaceExport ( {
608
+ namespaceName : imoprtNamespace . localName ,
609
+ astModule : astModule ,
610
+ declaration,
611
+ symbol : declarationSymbol
612
+ } ) ;
613
+ }
614
+
597
615
private _tryMatchImportDeclaration (
598
616
declaration : ts . Declaration ,
599
617
declarationSymbol : ts . Symbol
@@ -621,18 +639,7 @@ export class ExportAnalyzer {
621
639
622
640
if ( externalModulePath === undefined ) {
623
641
const astModule : AstModule = this . _fetchSpecifierAstModule ( importDeclaration , declarationSymbol ) ;
624
- let namespaceImport : AstNamespaceImport | undefined =
625
- this . _astNamespaceImportByModule . get ( astModule ) ;
626
- if ( namespaceImport === undefined ) {
627
- namespaceImport = new AstNamespaceImport ( {
628
- namespaceName : declarationSymbol . name ,
629
- astModule : astModule ,
630
- declaration : declaration ,
631
- symbol : declarationSymbol
632
- } ) ;
633
- this . _astNamespaceImportByModule . set ( astModule , namespaceImport ) ;
634
- }
635
- return namespaceImport ;
642
+ return this . _getAstNamespaceImport ( astModule , declarationSymbol , declaration ) ;
636
643
}
637
644
638
645
// Here importSymbol=undefined because {@inheritDoc } and such are not going to work correctly for
@@ -759,6 +766,25 @@ export class ExportAnalyzer {
759
766
return undefined ;
760
767
}
761
768
769
+ private _getAstNamespaceImport (
770
+ astModule : AstModule ,
771
+ declarationSymbol : ts . Symbol ,
772
+ declaration : ts . Declaration
773
+ ) : AstNamespaceImport {
774
+ let namespaceImport : AstNamespaceImport | undefined = this . _astNamespaceImportByModule . get ( astModule ) ;
775
+ if ( namespaceImport === undefined ) {
776
+ namespaceImport = new AstNamespaceImport ( {
777
+ namespaceName : declarationSymbol . name ,
778
+ astModule : astModule ,
779
+ declaration : declaration ,
780
+ symbol : declarationSymbol
781
+ } ) ;
782
+ this . _astNamespaceImportByModule . set ( astModule , namespaceImport ) ;
783
+ }
784
+
785
+ return namespaceImport ;
786
+ }
787
+
762
788
private static _getIsTypeOnly ( importDeclaration : ts . ImportDeclaration ) : boolean {
763
789
if ( importDeclaration . importClause ) {
764
790
return ! ! importDeclaration . importClause . isTypeOnly ;
0 commit comments