Skip to content

Commit 3350c5e

Browse files
committed
Fix a small bug where the @packagedocumentation comment was sometimes getting mixed into the middle of the rollup *.d.ts file
1 parent 88b9d10 commit 3350c5e

4 files changed

Lines changed: 6 additions & 30 deletions

File tree

‎apps/api-extractor/src/generators/dtsRollup/DtsRollupGenerator.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ export class DtsRollupGenerator {
278278
let recurseChildren: boolean = true;
279279
switch (span.kind) {
280280
case ts.SyntaxKind.JSDocComment:
281+
// If the @packagedocumentation comment seems to be attached to one of the regular API items,
282+
// omit it. It gets explictly emitted at the top of the file.
283+
if (span.node.getText().match(/(?:\s|\*)@packagedocumentation(?:\s|\*)/g)) {
284+
span.modification.skipAll();
285+
}
286+
281287
// For now, we don't transform JSDoc comment nodes at all
282288
recurseChildren = false;
283289
break;

‎build-tests/api-extractor-test-01/dist/beta/api-extractor-test-01.d.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,6 @@ export declare interface IInterfaceAsDefaultExport {
176176

177177
/* Excluded from this release type: IMergedInterfaceReferencee */
178178

179-
/**
180-
* api-extractor-test-01
181-
*
182-
* @remarks
183-
* This library is consumed by api-extractor-test-02 and api-extractor-test-03.
184-
* It tests the basic types of definitions, and all the weird cases for following
185-
* chains of type aliases.
186-
*
187-
* @packagedocumentation
188-
*/
189179
/**
190180
* A simple, normal definition
191181
* @public

‎build-tests/api-extractor-test-01/dist/internal/api-extractor-test-01.d.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,6 @@ export declare interface IMergedInterface {
196196
export declare interface IMergedInterfaceReferencee {
197197
}
198198

199-
/**
200-
* api-extractor-test-01
201-
*
202-
* @remarks
203-
* This library is consumed by api-extractor-test-02 and api-extractor-test-03.
204-
* It tests the basic types of definitions, and all the weird cases for following
205-
* chains of type aliases.
206-
*
207-
* @packagedocumentation
208-
*/
209199
/**
210200
* A simple, normal definition
211201
* @public

‎build-tests/api-extractor-test-01/dist/public/api-extractor-test-01.d.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,6 @@ export declare interface IInterfaceAsDefaultExport {
169169

170170
/* Excluded from this release type: IMergedInterfaceReferencee */
171171

172-
/**
173-
* api-extractor-test-01
174-
*
175-
* @remarks
176-
* This library is consumed by api-extractor-test-02 and api-extractor-test-03.
177-
* It tests the basic types of definitions, and all the weird cases for following
178-
* chains of type aliases.
179-
*
180-
* @packagedocumentation
181-
*/
182172
/**
183173
* A simple, normal definition
184174
* @public

0 commit comments

Comments
 (0)