Skip to content

Commit f132fcb

Browse files
authored
fix(stability): don't mark definitions as deprecated (#456)
1 parent 76e62f7 commit f132fcb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// On "About this Documentation", we define the stability indices, and thus
2+
// we don't need to check it for stability references
3+
export const IGNORE_STABILITY_STEMS = ['documentation'];

src/generators/metadata/utils/parse.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import createMetadata from '../../../metadata.mjs';
1010
import createNodeSlugger from '../../../utils/parser/slugger.mjs';
1111
import createQueries from '../../../utils/queries/index.mjs';
1212
import { getRemark } from '../../../utils/remark.mjs';
13+
import { IGNORE_STABILITY_STEMS } from '../constants.mjs';
1314

1415
/**
1516
* This generator generates a flattened list of metadata entries from a API doc
@@ -74,6 +75,10 @@ export const parseApiDoc = ({ file, tree }) => {
7475
tree.children.unshift(createTree('heading', { depth: 1 }, []));
7576
}
7677

78+
// On "About this Documentation", we define the stability indices, and thus
79+
// we don't need to check it for stability references
80+
const ignoreStability = IGNORE_STABILITY_STEMS.includes(file.stem);
81+
7782
// Handles iterating the tree and creating subtrees for each API doc entry
7883
// where an API doc entry is defined by a Heading Node
7984
// (so all elements after a Heading until the next Heading)
@@ -110,7 +115,7 @@ export const parseApiDoc = ({ file, tree }) => {
110115
// Visits all Stability Index nodes from the current subtree if there's any
111116
// and then apply the Stability Index metadata to the current metadata entry
112117
visit(subTree, createQueries.UNIST.isStabilityNode, node =>
113-
addStabilityMetadata(node, apiEntryMetadata)
118+
addStabilityMetadata(node, ignoreStability ? undefined : apiEntryMetadata)
114119
);
115120

116121
// Visits all HTML nodes from the current subtree and if there's any that matches

src/utils/queries/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const createQueries = () => {
120120
* Parses a Stability Index Entry and updates the current Metadata
121121
*
122122
* @param {import('@types/mdast').Blockquote} node Thead Link Reference Node
123-
* @param {ReturnType<import('../../metadata.mjs').default>} apiEntryMetadata The API entry Metadata
123+
* @param {ReturnType<import('../../metadata.mjs').default>} [apiEntryMetadata] The API entry Metadata
124124
*/
125125
const addStabilityMetadata = (node, apiEntryMetadata) => {
126126
// `node` is a `blockquote` node, and the first child will always be
@@ -151,7 +151,7 @@ const createQueries = () => {
151151
);
152152

153153
// Adds the Stability Index metadata to the current Metadata entry
154-
apiEntryMetadata.addStability(stabilityIndexNode);
154+
apiEntryMetadata?.addStability(stabilityIndexNode);
155155
}
156156

157157
return [SKIP];

0 commit comments

Comments
 (0)