File tree Expand file tree Collapse file tree 3 files changed +8
-18
lines changed
generators/legacy-json/utils Expand file tree Collapse file tree 3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -109,10 +109,11 @@ export const createSectionBuilder = () => {
109109 section . stability = Number ( stabilityNode . data . index ) ;
110110 section . stabilityText = stabilityNode . data . description ;
111111
112- const nodeToRemove = content . children . findIndex (
113- ( { data } ) => data === stabilityNode . data
114- ) ;
115- nodes . splice ( nodeToRemove - 1 , 1 ) ;
112+ const stabilityIdx = content . children . indexOf ( stability . children [ 0 ] ) ;
113+
114+ if ( stabilityIdx ) {
115+ nodes . splice ( stabilityIdx - 1 , 1 ) ;
116+ }
116117 }
117118 } ;
118119
Original file line number Diff line number Diff line change @@ -47,11 +47,8 @@ const createMetadata = slugger => {
4747 *
4848 * @param {StabilityIndexParent } stability The stability index node to be added
4949 */
50- addStability : stability => {
51- // We clone the stability to ensure that we don't accidentally override it
52- // with later mutations below on the `.create` method
53- internalMetadata . stability . children . push ( { ...stability } ) ;
54- } ,
50+ addStability : stability =>
51+ internalMetadata . stability . children . push ( stability ) ,
5552 /**
5653 * Set the Metadata (from YAML if exists) properties to the current Metadata entry
5754 * it also allows for extra data (such as Stability Index) and miscellaneous data to be set
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- import { u as createTree } from 'unist-builder' ;
43import { SKIP } from 'unist-util-visit' ;
54
65import { DOC_API_STABILITY_SECTION_REF_URL } from './constants.mjs' ;
@@ -142,15 +141,8 @@ const createQueries = typeMap => {
142141 description : matches [ 2 ] . replace ( / \n / g, ' ' ) . trim ( ) ,
143142 } ;
144143
145- // Creates a new Tree node containing the Stability Index metadata
146- const stabilityIndexNode = createTree (
147- 'root' ,
148- { data : node . data } ,
149- node . children
150- ) ;
151-
152144 // Adds the Stability Index metadata to the current Metadata entry
153- apiEntryMetadata ?. addStability ( stabilityIndexNode ) ;
145+ apiEntryMetadata ?. addStability ( node ) ;
154146 }
155147
156148 return [ SKIP ] ;
You can’t perform that action at this time.
0 commit comments