Skip to content

Commit 76d2d88

Browse files
committed
Merge branch 'master' of https://github.com/microsoft/web-build-tools into sachinjoseph/ImproveSupportForPnpmLockfile5_1
2 parents 9e50e9a + f7a39bc commit 76d2d88

File tree

125 files changed

+933
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+933
-198
lines changed

apps/api-documenter/CHANGELOG.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
{
22
"name": "@microsoft/api-documenter",
33
"entries": [
4+
{
5+
"version": "7.4.7",
6+
"tag": "@microsoft/api-documenter_v7.4.7",
7+
"date": "Wed, 25 Sep 2019 15:15:31 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "Disambiguate output files for items with colliding names"
12+
}
13+
],
14+
"dependency": [
15+
{
16+
"comment": "Updating dependency \"@microsoft/api-extractor-model\" from `7.4.2` to `7.5.0`"
17+
},
18+
{
19+
"comment": "Updating dependency \"@microsoft/rush-stack-compiler-3.4\" from `0.2.1` to `0.2.2`"
20+
},
21+
{
22+
"comment": "Updating dependency \"@microsoft/node-library-build\" from `6.2.1` to `6.2.2`"
23+
}
24+
]
25+
}
26+
},
427
{
528
"version": "7.4.6",
629
"tag": "@microsoft/api-documenter_v7.4.6",

apps/api-documenter/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log - @microsoft/api-documenter
22

3-
This log was last generated on Tue, 24 Sep 2019 02:58:49 GMT and should not be manually modified.
3+
This log was last generated on Wed, 25 Sep 2019 15:15:31 GMT and should not be manually modified.
4+
5+
## 7.4.7
6+
Wed, 25 Sep 2019 15:15:31 GMT
7+
8+
### Patches
9+
10+
- Disambiguate output files for items with colliding names
411

512
## 7.4.6
613
Tue, 24 Sep 2019 02:58:49 GMT

apps/api-documenter/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-documenter",
3-
"version": "7.4.6",
3+
"version": "7.4.7",
44
"description": "Read JSON files from api-extractor, generate documentation pages",
55
"repository": {
66
"type": "git",
@@ -17,7 +17,7 @@
1717
"main": "lib/index.js",
1818
"typings": "dist/rollup.d.ts",
1919
"dependencies": {
20-
"@microsoft/api-extractor-model": "7.4.2",
20+
"@microsoft/api-extractor-model": "7.5.0",
2121
"@microsoft/node-core-library": "3.15.0",
2222
"@microsoft/ts-command-line": "4.3.1",
2323
"@microsoft/tsdoc": "0.12.14",
@@ -26,8 +26,8 @@
2626
"resolve": "1.8.1"
2727
},
2828
"devDependencies": {
29-
"@microsoft/rush-stack-compiler-3.4": "0.2.1",
30-
"@microsoft/node-library-build": "6.2.1",
29+
"@microsoft/rush-stack-compiler-3.4": "0.2.2",
30+
"@microsoft/node-library-build": "6.2.2",
3131
"@types/jest": "23.3.11",
3232
"@types/js-yaml": "3.12.1",
3333
"@types/node": "8.10.54",

apps/api-documenter/src/documenters/ExperimentalYamlDocumenter.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import { PackageName } from '@microsoft/node-core-library';
54
import { DocComment, DocInlineTag } from '@microsoft/tsdoc';
65
import { ApiModel, ApiItem, ApiItemKind, ApiDocumentedItem } from '@microsoft/api-extractor-model';
76

@@ -42,24 +41,20 @@ export class ExperimentalYamlDocumenter extends YamlDocumenter {
4241
if (apiItem.kind === ApiItemKind.Namespace) {
4342
// Namespaces don't have nodes yet
4443
tocItem = {
45-
name: apiItem.displayName
44+
name: this._getTocItemName(apiItem)
4645
};
4746
} else {
4847
if (this._shouldEmbed(apiItem.kind)) {
4948
// Don't generate table of contents items for embedded definitions
5049
continue;
5150
}
5251

53-
if (apiItem.kind === ApiItemKind.Package) {
54-
tocItem = {
55-
name: PackageName.getUnscopedName(apiItem.displayName),
56-
uid: this._getUid(apiItem)
57-
};
58-
} else {
59-
tocItem = {
60-
name: apiItem.displayName,
61-
uid: this._getUid(apiItem)
62-
};
52+
tocItem = {
53+
name: this._getTocItemName(apiItem),
54+
uid: this._getUid(apiItem)
55+
};
56+
57+
if (apiItem.kind !== ApiItemKind.Package) {
6358
this._filterItem(apiItem, tocItem);
6459
}
6560
}

apps/api-documenter/src/documenters/YamlDocumenter.ts

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export class YamlDocumenter {
7575

7676
private _apiItemsByCanonicalReference: Map<string, ApiItem>;
7777
private _yamlReferences: IYamlReferences | undefined;
78-
7978
private _outputFolder: string;
8079

8180
public constructor(apiModel: ApiModel) {
@@ -232,25 +231,18 @@ export class YamlDocumenter {
232231
if (apiItem.kind === ApiItemKind.Namespace) {
233232
// Namespaces don't have nodes yet
234233
tocItem = {
235-
name: apiItem.displayName
234+
name: this._getTocItemName(apiItem)
236235
};
237236
} else {
238237
if (this._shouldEmbed(apiItem.kind)) {
239238
// Don't generate table of contents items for embedded definitions
240239
continue;
241240
}
242241

243-
if (apiItem.kind === ApiItemKind.Package) {
244-
tocItem = {
245-
name: PackageName.getUnscopedName(apiItem.displayName),
246-
uid: this._getUid(apiItem)
247-
};
248-
} else {
249-
tocItem = {
250-
name: apiItem.displayName,
251-
uid: this._getUid(apiItem)
252-
};
253-
}
242+
tocItem = {
243+
name: this._getTocItemName(apiItem),
244+
uid: this._getUid(apiItem)
245+
};
254246
}
255247

256248
tocItems.push(tocItem);
@@ -271,6 +263,20 @@ export class YamlDocumenter {
271263
return tocItems;
272264
}
273265

266+
/** @virtual */
267+
protected _getTocItemName(apiItem: ApiItem): string {
268+
let name: string = apiItem.displayName;
269+
if (apiItem.kind === ApiItemKind.Package) {
270+
name = PackageName.getUnscopedName(name);
271+
}
272+
273+
if (apiItem.getMergedSiblings().length > 1) {
274+
name += ` (${apiItem.kind})`;
275+
}
276+
277+
return name;
278+
}
279+
274280
protected _shouldEmbed(apiItemKind: ApiItemKind): boolean {
275281
switch (apiItemKind) {
276282
case ApiItemKind.Class:
@@ -591,7 +597,6 @@ export class YamlDocumenter {
591597
*/
592598
private _initApiItems(): void {
593599
this._initApiItemsRecursive(this._apiModel);
594-
595600
}
596601

597602
/**
@@ -803,11 +808,17 @@ export class YamlDocumenter {
803808
break;
804809
}
805810
}
806-
return path.join(this._outputFolder, result + '.yml');
811+
812+
let disambiguator: string = '';
813+
if (apiItem.getMergedSiblings().length > 1) {
814+
disambiguator = `-${apiItem.kind.toLowerCase()}`;
815+
}
816+
817+
return path.join(this._outputFolder, result + disambiguator + '.yml');
807818
}
808819

809820
private _deleteOldOutputFiles(): void {
810821
console.log('Deleting old output from ' + this._outputFolder);
811822
FileSystem.ensureEmptyFolder(this._outputFolder);
812823
}
813-
}
824+
}

apps/api-extractor-model/CHANGELOG.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"name": "@microsoft/api-extractor-model",
33
"entries": [
4+
{
5+
"version": "7.5.0",
6+
"tag": "@microsoft/api-extractor-model_v7.5.0",
7+
"date": "Wed, 25 Sep 2019 15:15:31 GMT",
8+
"comments": {
9+
"minor": [
10+
{
11+
"comment": "Add ApiItem.getMergedSiblings() API"
12+
}
13+
]
14+
}
15+
},
416
{
517
"version": "7.4.2",
618
"tag": "@microsoft/api-extractor-model_v7.4.2",

apps/api-extractor-model/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log - @microsoft/api-extractor-model
22

3-
This log was last generated on Mon, 23 Sep 2019 15:14:55 GMT and should not be manually modified.
3+
This log was last generated on Wed, 25 Sep 2019 15:15:31 GMT and should not be manually modified.
4+
5+
## 7.5.0
6+
Wed, 25 Sep 2019 15:15:31 GMT
7+
8+
### Minor changes
9+
10+
- Add ApiItem.getMergedSiblings() API
411

512
## 7.4.2
613
Mon, 23 Sep 2019 15:14:55 GMT

apps/api-extractor-model/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-extractor-model",
3-
"version": "7.4.2",
3+
"version": "7.5.0",
44
"description": "A helper library for loading and saving the .api.json files created by API Extractor",
55
"repository": {
66
"type": "git",

apps/api-extractor-model/src/items/ApiItem.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ApiPackage } from '../model/ApiPackage';
77
import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';
88
import { DeserializerContext } from '../model/DeserializerContext';
99
import { InternalError } from '@microsoft/node-core-library';
10+
import { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';
1011

1112
/**
1213
* The type returned by the {@link ApiItem.kind} property, which can be used to easily distinguish subclasses of
@@ -173,6 +174,24 @@ export class ApiItem {
173174
return [];
174175
}
175176

177+
/**
178+
* If this item has a name (i.e. extends `ApiNameMixin`), then return all items that have the same parent
179+
* and the same name. Otherwise, return all items that have the same parent and the same `ApiItemKind`.
180+
*
181+
* @remarks
182+
* Examples: For a function, this would return all overloads for the function. For a constructor, this would
183+
* return all overloads for the constructor. For a merged declaration (e.g. a `namespace` and `enum` with the
184+
* same name), this would return both declarations. If this item does not have a parent, or if it is the only
185+
* item of its name/kind, then the result is an array containing only this item.
186+
*/
187+
public getMergedSiblings(): ReadonlyArray<ApiItem> {
188+
const parent: ApiItem | undefined = this._parent;
189+
if (parent && ApiItemContainerMixin.isBaseClassOf(parent)) {
190+
return parent._getMergedSiblingsForMember(this);
191+
}
192+
return [];
193+
}
194+
176195
/**
177196
* Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.
178197
*/

0 commit comments

Comments
 (0)