@@ -124,7 +124,7 @@ export class ApiModelGenerator {
124
124
//
125
125
// This could be improved in the future, but it requires a stable mechanism for choosing an associated parent.
126
126
// For thoughts about this: https://github.com/microsoft/rushstack/issues/1308
127
- this . _processAstModule ( astEntity . astModule , exportedName , parentApiItem ) ;
127
+ this . _processAstNamespaceImport ( astEntity , exportedName , parentApiItem ) ;
128
128
return ;
129
129
}
130
130
@@ -133,13 +133,15 @@ export class ApiModelGenerator {
133
133
// form "export { X } from 'external-package'". We can also use this to solve GitHub issue #950.
134
134
}
135
135
136
- private _processAstModule (
137
- astModule : AstModule ,
136
+ private _processAstNamespaceImport (
137
+ astNamespaceImport : AstNamespaceImport ,
138
138
exportedName : string | undefined ,
139
139
parentApiItem : ApiItemContainerMixin
140
140
) : void {
141
+ const astModule : AstModule = astNamespaceImport . astModule ;
141
142
const name : string = exportedName ? exportedName : astModule . moduleSymbol . name ;
142
143
const containerKey : string = ApiNamespace . getContainerKey ( name ) ;
144
+ const isExported : boolean = this . _isExported ( astNamespaceImport ) ;
143
145
144
146
let apiNamespace : ApiNamespace | undefined = parentApiItem . tryGetMemberByKey (
145
147
containerKey
@@ -151,7 +153,7 @@ export class ApiModelGenerator {
151
153
docComment : undefined ,
152
154
releaseTag : ReleaseTag . None ,
153
155
excerptTokens : [ ] ,
154
- isExported : true
156
+ isExported
155
157
} ) ;
156
158
parentApiItem . addMember ( apiNamespace ) ;
157
159
}
@@ -400,7 +402,7 @@ export class ApiModelGenerator {
400
402
const apiItemMetadata : ApiItemMetadata = this . _collector . fetchApiItemMetadata ( astDeclaration ) ;
401
403
const docComment : tsdoc . DocComment | undefined = apiItemMetadata . tsdocComment ;
402
404
const releaseTag : ReleaseTag = apiItemMetadata . effectiveReleaseTag ;
403
- const isExported : boolean = this . _isExported ( astDeclaration ) ;
405
+ const isExported : boolean = this . _isExported ( astDeclaration . astSymbol . rootAstSymbol ) ;
404
406
405
407
apiClass = new ApiClass ( {
406
408
name,
@@ -486,7 +488,7 @@ export class ApiModelGenerator {
486
488
const releaseTag : ReleaseTag = apiItemMetadata . effectiveReleaseTag ;
487
489
const preserveMemberOrder : boolean =
488
490
this . _collector . extractorConfig . enumMemberOrder === EnumMemberOrder . Preserve ;
489
- const isExported : boolean = this . _isExported ( astDeclaration ) ;
491
+ const isExported : boolean = this . _isExported ( astDeclaration . astSymbol . rootAstSymbol ) ;
490
492
491
493
apiEnum = new ApiEnum ( { name, docComment, releaseTag, excerptTokens, preserveMemberOrder, isExported } ) ;
492
494
parentApiItem . addMember ( apiEnum ) ;
@@ -570,7 +572,7 @@ export class ApiModelGenerator {
570
572
const apiItemMetadata : ApiItemMetadata = this . _collector . fetchApiItemMetadata ( astDeclaration ) ;
571
573
const docComment : tsdoc . DocComment | undefined = apiItemMetadata . tsdocComment ;
572
574
const releaseTag : ReleaseTag = apiItemMetadata . effectiveReleaseTag ;
573
- const isExported : boolean = this . _isExported ( astDeclaration ) ;
575
+ const isExported : boolean = this . _isExported ( astDeclaration . astSymbol . rootAstSymbol ) ;
574
576
575
577
apiFunction = new ApiFunction ( {
576
578
name,
@@ -673,7 +675,7 @@ export class ApiModelGenerator {
673
675
const apiItemMetadata : ApiItemMetadata = this . _collector . fetchApiItemMetadata ( astDeclaration ) ;
674
676
const docComment : tsdoc . DocComment | undefined = apiItemMetadata . tsdocComment ;
675
677
const releaseTag : ReleaseTag = apiItemMetadata . effectiveReleaseTag ;
676
- const isExported : boolean = this . _isExported ( astDeclaration ) ;
678
+ const isExported : boolean = this . _isExported ( astDeclaration . astSymbol . rootAstSymbol ) ;
677
679
678
680
apiInterface = new ApiInterface ( {
679
681
name,
@@ -823,7 +825,7 @@ export class ApiModelGenerator {
823
825
const apiItemMetadata : ApiItemMetadata = this . _collector . fetchApiItemMetadata ( astDeclaration ) ;
824
826
const docComment : tsdoc . DocComment | undefined = apiItemMetadata . tsdocComment ;
825
827
const releaseTag : ReleaseTag = apiItemMetadata . effectiveReleaseTag ;
826
- const isExported : boolean = this . _isExported ( astDeclaration ) ;
828
+ const isExported : boolean = this . _isExported ( astDeclaration . astSymbol . rootAstSymbol ) ;
827
829
828
830
apiNamespace = new ApiNamespace ( { name, docComment, releaseTag, excerptTokens, isExported } ) ;
829
831
parentApiItem . addMember ( apiNamespace ) ;
@@ -973,7 +975,7 @@ export class ApiModelGenerator {
973
975
const apiItemMetadata : ApiItemMetadata = this . _collector . fetchApiItemMetadata ( astDeclaration ) ;
974
976
const docComment : tsdoc . DocComment | undefined = apiItemMetadata . tsdocComment ;
975
977
const releaseTag : ReleaseTag = apiItemMetadata . effectiveReleaseTag ;
976
- const isExported : boolean = this . _isExported ( astDeclaration ) ;
978
+ const isExported : boolean = this . _isExported ( astDeclaration . astSymbol . rootAstSymbol ) ;
977
979
978
980
apiTypeAlias = new ApiTypeAlias ( {
979
981
name,
@@ -1020,7 +1022,7 @@ export class ApiModelGenerator {
1020
1022
const docComment : tsdoc . DocComment | undefined = apiItemMetadata . tsdocComment ;
1021
1023
const releaseTag : ReleaseTag = apiItemMetadata . effectiveReleaseTag ;
1022
1024
const isReadonly : boolean = this . _isReadonly ( astDeclaration ) ;
1023
- const isExported : boolean = this . _isExported ( astDeclaration ) ;
1025
+ const isExported : boolean = this . _isExported ( astDeclaration . astSymbol . rootAstSymbol ) ;
1024
1026
1025
1027
apiVariable = new ApiVariable ( {
1026
1028
name,
@@ -1136,17 +1138,13 @@ export class ApiModelGenerator {
1136
1138
}
1137
1139
}
1138
1140
1139
- private _isExported ( astDeclaration : AstDeclaration ) : boolean {
1141
+ private _isExported ( astEntity : AstEntity ) : boolean {
1140
1142
// Collector entities are only created for root symbols.
1141
- const entity : CollectorEntity | undefined = this . _collector . tryGetCollectorEntity (
1142
- astDeclaration . astSymbol . rootAstSymbol
1143
- ) ;
1143
+ const entity : CollectorEntity | undefined = this . _collector . tryGetCollectorEntity ( astEntity ) ;
1144
1144
1145
1145
if ( ! entity ) {
1146
1146
// This should never happen.
1147
- throw new InternalError (
1148
- `Failed to get collector entity for root symbol of declaration ${ astDeclaration . astSymbol . localName } `
1149
- ) ;
1147
+ throw new InternalError ( `Failed to get collector entity for AstEntity "${ astEntity . localName } "` ) ;
1150
1148
}
1151
1149
1152
1150
return entity . exported ;
0 commit comments