Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create API review for JS packages with namespace in api extractor model #5292

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tools/apiview/parsers/js-api-parser/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ function appendMembers(builder: TokensBuilder, navigation: IApiViewNavItem[], it
builder.lineId(item.canonicalReference.toString());
builder.indent();
if (item instanceof ApiDeclaredItem) {
if ( item.kind === ApiItemKind.Namespace) {
builder.splitAppend(`declare namespace ${item.displayName} `, item.canonicalReference.toString(), item.displayName);
}
for (const token of item.excerptTokens) {
if (token.kind === ExcerptTokenKind.Reference)
{
Expand All @@ -35,6 +38,7 @@ function appendMembers(builder: TokensBuilder, navigation: IApiViewNavItem[], it
{
case ApiItemKind.Interface:
case ApiItemKind.Class:
case ApiItemKind.Namespace:
typeKind = item.kind.toLowerCase();
break
case ApiItemKind.TypeAlias:
Expand All @@ -56,7 +60,8 @@ function appendMembers(builder: TokensBuilder, navigation: IApiViewNavItem[], it
}

if (item.kind === ApiItemKind.Interface ||
item.kind === ApiItemKind.Class)
item.kind === ApiItemKind.Class ||
item.kind === ApiItemKind.Namespace)
{
if (item.members.length > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion tools/apiview/parsers/js-api-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/ts-genapi",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"main": "index.js",
"publishConfig":{"registry":"https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/"},
Expand Down
1 change: 1 addition & 0 deletions tools/apiview/parsers/js-api-parser/tokensBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class TokensBuilder
"import",
"in",
"instanceof",
"namespace",
"new",
"null",
"return",
Expand Down