Skip to content

Commit 55fbd80

Browse files
authored
Merge branch 'master' into issue-1242
2 parents 5e8dab9 + 7d5fe37 commit 55fbd80

95 files changed

Lines changed: 636 additions & 147 deletions

File tree

Some content is hidden

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

apps/api-documenter/CHANGELOG.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
{
22
"name": "@microsoft/api-documenter",
33
"entries": [
4+
{
5+
"version": "7.1.3",
6+
"tag": "@microsoft/api-documenter_v7.1.3",
7+
"date": "Tue, 30 Apr 2019 23:08:02 GMT",
8+
"comments": {
9+
"dependency": [
10+
{
11+
"comment": "Updating dependency \"@microsoft/rush-stack-compiler-3.2\" from `0.3.8` to `0.3.9`"
12+
},
13+
{
14+
"comment": "Updating dependency \"@microsoft/node-library-build\" from `6.0.56` to `6.0.57`"
15+
}
16+
]
17+
}
18+
},
419
{
520
"version": "7.1.2",
621
"tag": "@microsoft/api-documenter_v7.1.2",

apps/api-documenter/CHANGELOG.md

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

3-
This log was last generated on Mon, 29 Apr 2019 19:13:03 GMT and should not be manually modified.
3+
This log was last generated on Tue, 30 Apr 2019 23:08:02 GMT and should not be manually modified.
4+
5+
## 7.1.3
6+
Tue, 30 Apr 2019 23:08:02 GMT
7+
8+
*Version update only*
49

510
## 7.1.2
611
Mon, 29 Apr 2019 19:13:03 GMT

apps/api-documenter/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-documenter",
3-
"version": "7.1.2",
3+
"version": "7.1.3",
44
"description": "Read JSON files from api-extractor, generate documentation pages",
55
"repository": {
66
"type": "git",
@@ -23,8 +23,8 @@
2323
"js-yaml": "~3.13.1"
2424
},
2525
"devDependencies": {
26-
"@microsoft/rush-stack-compiler-3.2": "0.3.8",
27-
"@microsoft/node-library-build": "6.0.56",
26+
"@microsoft/rush-stack-compiler-3.2": "0.3.9",
27+
"@microsoft/node-library-build": "6.0.57",
2828
"@types/js-yaml": "3.12.1",
2929
"@types/node": "8.5.8",
3030
"gulp": "~3.9.1",

apps/api-extractor/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",
33
"entries": [
4+
{
5+
"version": "7.1.1",
6+
"tag": "@microsoft/api-extractor_v7.1.1",
7+
"date": "Tue, 30 Apr 2019 23:08:02 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "Fix an issue where API signatures were sometimes truncated in the .api.json file (GitHub #1249)"
12+
}
13+
]
14+
}
15+
},
416
{
517
"version": "7.1.0",
618
"tag": "@microsoft/api-extractor_v7.1.0",

apps/api-extractor/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
22

3-
This log was last generated on Tue, 16 Apr 2019 11:01:37 GMT and should not be manually modified.
3+
This log was last generated on Tue, 30 Apr 2019 23:08:02 GMT and should not be manually modified.
4+
5+
## 7.1.1
6+
Tue, 30 Apr 2019 23:08:02 GMT
7+
8+
### Patches
9+
10+
- Fix an issue where API signatures were sometimes truncated in the .api.json file (GitHub #1249)
411

512
## 7.1.0
613
Tue, 16 Apr 2019 11:01:37 GMT

apps/api-extractor/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",
3-
"version": "7.1.0",
3+
"version": "7.1.1",
44
"description": "Analyze the exported API for a TypeScript library and generate reviews, documentation, and .d.ts rollups",
55
"keywords": [
66
"typescript",

apps/api-extractor/src/generators/ApiModelGenerator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export class ApiModelGenerator {
268268

269269
const excerptTokens: IExcerptToken[] = ExcerptBuilder.build({
270270
startingNode: astDeclaration.declaration,
271-
nodeToStopAt: ts.SyntaxKind.FirstPunctuation, // FirstPunctuation = "{"
271+
stopBeforeChildKind: ts.SyntaxKind.FirstPunctuation, // FirstPunctuation = "{"
272272
nodesToCapture
273273
});
274274
const docComment: tsdoc.DocComment | undefined = this._collector.fetchMetadata(astDeclaration).tsdocComment;
@@ -328,7 +328,7 @@ export class ApiModelGenerator {
328328
if (apiEnum === undefined) {
329329
const excerptTokens: IExcerptToken[] = ExcerptBuilder.build({
330330
startingNode: astDeclaration.declaration,
331-
nodeToStopAt: ts.SyntaxKind.FirstPunctuation // FirstPunctuation = "{"
331+
stopBeforeChildKind: ts.SyntaxKind.FirstPunctuation // FirstPunctuation = "{"
332332
});
333333

334334
const docComment: tsdoc.DocComment | undefined = this._collector.fetchMetadata(astDeclaration).tsdocComment;
@@ -467,7 +467,7 @@ export class ApiModelGenerator {
467467

468468
const excerptTokens: IExcerptToken[] = ExcerptBuilder.build({
469469
startingNode: astDeclaration.declaration,
470-
nodeToStopAt: ts.SyntaxKind.FirstPunctuation, // FirstPunctuation = "{"
470+
stopBeforeChildKind: ts.SyntaxKind.FirstPunctuation, // FirstPunctuation = "{"
471471
nodesToCapture
472472
});
473473

@@ -563,7 +563,7 @@ export class ApiModelGenerator {
563563
if (apiNamespace === undefined) {
564564
const excerptTokens: IExcerptToken[] = ExcerptBuilder.build({
565565
startingNode: astDeclaration.declaration,
566-
nodeToStopAt: ts.SyntaxKind.ModuleBlock // ModuleBlock = the "{ ... }" block
566+
stopBeforeChildKind: ts.SyntaxKind.ModuleBlock // ModuleBlock = the "{ ... }" block
567567
});
568568

569569
const docComment: tsdoc.DocComment | undefined = this._collector.fetchMetadata(astDeclaration).tsdocComment;

apps/api-extractor/src/generators/ExcerptBuilder.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,18 @@ export interface ISignatureBuilderOptions {
3232
/**
3333
* The AST node that we will traverse to extract tokens
3434
*/
35-
3635
startingNode: ts.Node;
36+
3737
/**
38-
* An AST node to stop at (e.g. the "{" after a class declaration).
39-
* If omitted, then all child nodes for `startingNode` will be processed
38+
* Normally, the excerpt will include all child nodes for `startingNode`; whereas if `childKindToStopBefore`
39+
* is specified, then the node traversal will stop before (i.e. excluding) the first immediate child
40+
* of `startingNode` with the specified syntax kind.
41+
*
42+
* @remarks
43+
* For example, suppose the signature is `interface X: Y { z: string }`. The token `{` has syntax kind
44+
* `ts.SyntaxKind.FirstPunctuation`, so we can specify that to truncate the excerpt to `interface X: Y`.
4045
*/
41-
nodeToStopAt?: ts.SyntaxKind;
46+
stopBeforeChildKind?: ts.SyntaxKind;
4247

4348
/**
4449
* A list of child nodes whose token ranges we want to capture
@@ -50,7 +55,9 @@ export interface ISignatureBuilderOptions {
5055
* Internal state for ExcerptBuilder
5156
*/
5257
interface IBuildSpanState {
53-
nodeToStopAt?: ts.SyntaxKind;
58+
startingNode: ts.Node;
59+
stopBeforeChildKind: ts.SyntaxKind | undefined;
60+
5461
tokenRangesByNode: Map<ts.Node, IExcerptTokenRange>;
5562

5663
/**
@@ -75,7 +82,8 @@ export class ExcerptBuilder {
7582
const excerptTokens: IExcerptToken[] = [];
7683

7784
ExcerptBuilder._buildSpan(excerptTokens, span, {
78-
nodeToStopAt: options.nodeToStopAt,
85+
startingNode: options.startingNode,
86+
stopBeforeChildKind: options.stopBeforeChildKind,
7987
tokenRangesByNode,
8088
disableMergingForNextToken: false
8189
});
@@ -88,11 +96,6 @@ export class ExcerptBuilder {
8896
}
8997

9098
private static _buildSpan(excerptTokens: IExcerptToken[], span: Span, state: IBuildSpanState): boolean {
91-
92-
if (state.nodeToStopAt && span.kind === state.nodeToStopAt) {
93-
return false;
94-
}
95-
9699
if (span.kind === ts.SyntaxKind.JSDocComment) {
97100
// Discard any comments
98101
return true;
@@ -119,6 +122,13 @@ export class ExcerptBuilder {
119122
}
120123

121124
for (const child of span.children) {
125+
if (span.node === state.startingNode) {
126+
if (state.stopBeforeChildKind && child.kind === state.stopBeforeChildKind) {
127+
// We reached the a child whose kind is stopBeforeChildKind, so stop traversing
128+
return false;
129+
}
130+
}
131+
122132
if (!this._buildSpan(excerptTokens, child, state)) {
123133
return false;
124134
}

apps/rush-lib/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"license": "MIT",
2323
"dependencies": {
2424
"@microsoft/node-core-library": "3.13.0",
25-
"@microsoft/package-deps-hash": "2.2.147",
26-
"@microsoft/stream-collator": "3.0.62",
25+
"@microsoft/package-deps-hash": "2.2.148",
26+
"@microsoft/stream-collator": "3.0.63",
2727
"@microsoft/ts-command-line": "4.2.3",
2828
"@pnpm/link-bins": "~1.0.1",
2929
"@pnpm/logger": "~1.0.1",
@@ -49,8 +49,8 @@
4949
"z-schema": "~3.18.3"
5050
},
5151
"devDependencies": {
52-
"@microsoft/rush-stack-compiler-3.2": "0.3.8",
53-
"@microsoft/node-library-build": "6.0.56",
52+
"@microsoft/rush-stack-compiler-3.2": "0.3.9",
53+
"@microsoft/node-library-build": "6.0.57",
5454
"@types/node": "8.5.8",
5555
"@types/node-fetch": "1.6.9",
5656
"@types/tar": "4.0.0",

apps/rush/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"semver": "~5.3.0"
3838
},
3939
"devDependencies": {
40-
"@microsoft/rush-stack-compiler-3.2": "0.3.8",
41-
"@microsoft/node-library-build": "6.0.56",
40+
"@microsoft/rush-stack-compiler-3.2": "0.3.9",
41+
"@microsoft/node-library-build": "6.0.57",
4242
"@types/chai": "3.4.34",
4343
"@types/mocha": "5.2.5",
4444
"@types/node": "8.5.8",

0 commit comments

Comments
 (0)