Content-Length: 634061 | pFad | http://github.com/angular/angular/commit/6ce2672e651e919b65bc430f05ca3355aec5231c

CD docs: hide entries that are marked @docs-private (#61105) · angular/angular@6ce2672 · GitHub
Skip to content

Commit 6ce2672

Browse files
mmalerbaAndrewKushnir
authored andcommitted
docs: hide entries that are marked @docs-private (#61105)
PR Close #61105
1 parent 238441a commit 6ce2672

File tree

5 files changed

+41
-27
lines changed

5 files changed

+41
-27
lines changed

adev/shared-docs/pipeline/api-gen/manifest/generate_manifest.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
// @ts-ignore This compiles fine, but Webstorm doesn't like the ESM import in a CJS context.
10-
import type {DocEntry, EntryCollection, JsDocTagEntry, FunctionEntry} from '@angular/compiler-cli';
10+
import type {DocEntry, EntryCollection, FunctionEntry, JsDocTagEntry} from '@angular/compiler-cli';
1111

1212
export interface ManifestEntry {
1313
name: string;
@@ -43,6 +43,11 @@ function hasTag(entry: DocEntry | FunctionEntry, tag: string, every = false) {
4343
return jsdocTags.some(hasTagName);
4444
}
4545

46+
/** Gets whether the given entry is hidden. */
47+
export function isHiddenEntry<T extends DocEntry | FunctionEntry>(entry: T): boolean {
48+
return hasTag(entry, 'docs-private', /* every */ true);
49+
}
50+
4651
/** Gets whether the given entry is deprecated in the manifest. */
4752
function isDeprecated(entry: DocEntry): boolean {
4853
return hasTag(entry, 'deprecated', /* every */ true);
@@ -65,13 +70,15 @@ function isExperimental(entry: DocEntry): boolean {
6570
export function generateManifest(apiCollections: EntryCollection[]): Manifest {
6671
const manifest: Manifest = [];
6772
for (const collection of apiCollections) {
68-
const entries = collection.entries.map((entry: DocEntry) => ({
69-
name: entry.name,
70-
type: entry.entryType,
71-
isDeprecated: isDeprecated(entry),
72-
isDeveloperPreview: isDeveloperPreview(entry),
73-
isExperimental: isExperimental(entry),
74-
}));
73+
const entries = collection.entries
74+
.filter((entry) => !isHiddenEntry(entry))
75+
.map((entry: DocEntry) => ({
76+
name: entry.name,
77+
type: entry.entryType,
78+
isDeprecated: isDeprecated(entry),
79+
isDeveloperPreview: isDeveloperPreview(entry),
80+
isExperimental: isExperimental(entry),
81+
}));
7582

7683
const existingEntry = manifest.find((entry) => entry.moduleName === collection.moduleName);
7784
if (existingEntry) {

adev/shared-docs/pipeline/api-gen/rendering/entities/categorization.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {CliCommand} from '../cli-entities';
2828

2929
import {
3030
ClassEntryRenderable,
31-
CliCommandRenderable,
3231
ConstantEntryRenderable,
3332
DecoratorEntryRenderable,
3433
DocEntryRenderable,
@@ -132,6 +131,11 @@ export function isSetterEntry(entry: MemberEntry): entry is PropertyEntry {
132131
return entry.memberType === MemberType.Setter;
133132
}
134133

134+
/** Gets whether the given entry is hidden. */
135+
export function isHiddenEntry<T extends HasJsDocTags>(entry: T): boolean {
136+
return hasTag(entry, 'docs-private', /* every */ true);
137+
}
138+
135139
/** Gets whether the given entry is deprecated. */
136140
export function isDeprecatedEntry<T extends HasJsDocTags>(entry: T) {
137141
return hasTag(entry, 'deprecated', /* every */ true);
@@ -169,7 +173,6 @@ function hasTag<T extends HasJsDocTags | FunctionEntry>(entry: T, tag: string, e
169173
}
170174

171175
/** Gets whether the given entry is a cli entry. */
172-
export function isCliEntry(entry: unknown): entry is CliCommandRenderable;
173176
export function isCliEntry(entry: unknown): entry is CliCommand {
174177
return (entry as CliCommand).command !== undefined;
175178
}

adev/shared-docs/pipeline/api-gen/rendering/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {existsSync, mkdirSync, readFileSync, writeFileSync} from 'fs';
1010
import path from 'path';
1111
import {CliCommand} from './cli-entities';
1212
import {DocEntry} from './entities';
13-
import {isCliEntry} from './entities/categorization';
13+
import {isCliEntry, isHiddenEntry} from './entities/categorization';
1414
import {configureMarkedGlobally} from './marked/configuration';
1515
import {getRenderable} from './processing';
1616
import {renderEntry} from './rendering';
@@ -22,7 +22,7 @@ interface EntryCollection {
2222
moduleName: string;
2323
moduleLabel?: string;
2424
normalizedModuleName: string;
25-
entries: DocEntry[];
25+
entries: DocEntry[] | CliCommand[];
2626
symbols: Map<string, string>;
2727
}
2828

@@ -113,7 +113,9 @@ async function main() {
113113
const entryCollections: EntryCollection[] = parseEntryData(srcs.split(','));
114114

115115
for (const collection of entryCollections) {
116-
const extractedEntries = collection.entries;
116+
const extractedEntries = collection.entries.filter(
117+
(entry) => isCliEntry(entry) || !isHiddenEntry(entry),
118+
);
117119

118120
// Setting the symbols are a global context for the rendering templates of this entry
119121
setSymbols(collection.symbols);
@@ -126,10 +128,7 @@ async function main() {
126128
const htmlOutputs = renderableEntries.map(renderEntry);
127129

128130
for (let i = 0; i < htmlOutputs.length; i++) {
129-
const filename = getNormalizedFilename(
130-
collection.normalizedModuleName,
131-
collection.entries[i],
132-
);
131+
const filename = getNormalizedFilename(collection.normalizedModuleName, extractedEntries[i]);
133132
const outputPath = path.join(outputFilenameExecRootRelativePath, filename);
134133

135134
// in case the output path is nested, ensure the directory exists

adev/shared-docs/pipeline/api-gen/rendering/processing.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,16 @@ import {
3737
} from './transforms/jsdoc-transforms';
3838
import {addModuleName} from './transforms/module-name';
3939
import {getTypeAliasRenderable} from './transforms/type-alias-transforms';
40+
import {CliCommand} from './cli-entities';
4041

4142
export function getRenderable(
42-
entry: DocEntry,
43+
entry: DocEntry | CliCommand,
4344
moduleName: string,
4445
): DocEntryRenderable | CliCommandRenderable {
46+
if (isCliEntry(entry)) {
47+
return getCliRenderable(entry);
48+
}
49+
4550
if (isClassEntry(entry)) {
4651
return getClassRenderable(entry, moduleName);
4752
}
@@ -66,9 +71,6 @@ export function getRenderable(
6671
if (isInitializerApiFunctionEntry(entry)) {
6772
return getInitializerApiFunctionRenderable(entry, moduleName);
6873
}
69-
if (isCliEntry(entry)) {
70-
return getCliRenderable(entry);
71-
}
7274

7375
// Fallback to an uncategorized renderable.
7476
return setEntryFlags(

adev/shared-docs/pipeline/api-gen/rendering/transforms/member-transforms.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import {MemberEntry, MemberTags, MemberType} from '../entities';
10+
import {isHiddenEntry} from '../entities/categorization';
1011

1112
import {HasMembers, HasModuleName, HasRenderableMembers} from '../entities/traits';
1213

@@ -65,13 +66,15 @@ export function mergeGettersAndSetters(members: MemberEntry[]): MemberEntry[] {
6566
export function addRenderableMembers<T extends HasMembers & HasModuleName>(
6667
entry: T,
6768
): T & HasRenderableMembers {
68-
const members = entry.members.map((member) =>
69-
setEntryFlags(
70-
addHtmlDescription(
71-
addHtmlUsageNotes(addHtmlJsDocTagComments(addModuleName(member, entry.moduleName))),
69+
const members = entry.members
70+
.filter((member) => !isHiddenEntry(member))
71+
.map((member) =>
72+
setEntryFlags(
73+
addHtmlDescription(
74+
addHtmlUsageNotes(addHtmlJsDocTagComments(addModuleName(member, entry.moduleName))),
75+
),
7276
),
73-
),
74-
);
77+
);
7578

7679
return {
7780
...entry,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/angular/angular/commit/6ce2672e651e919b65bc430f05ca3355aec5231c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy