@@ -32,8 +32,8 @@ export const promoteMiscChildren = (section, parent) => {
3232 */
3333export const createSectionBuilder = ( ) => {
3434 /**
35- * Creates metadata from a hierarchized entry.
36- * @param {import('../types.d.ts ').HierarchizedEntry } entry - The entry to create metadata from.
35+ * Creates metadata from a metadata entry.
36+ * @param {import('../../metadata/types ').MetadataEntry } entry - The entry to create metadata from.
3737 * @returns {import('../types.d.ts').Meta | undefined } The created metadata, or undefined if all fields are empty.
3838 */
3939 const createMeta = ( {
@@ -73,7 +73,7 @@ export const createSectionBuilder = () => {
7373
7474 /**
7575 * Creates a section from an entry and its heading.
76- * @param {import('../types.d.ts ').HierarchizedEntry } entry - The AST entry.
76+ * @param {import('../../metadata/types ').MetadataEntry } entry - The AST entry.
7777 * @param {import('../../metadata/types').HeadingNode } head - The head node of the entry.
7878 * @returns {import('../types.d.ts').Section } The created section.
7979 */
@@ -98,7 +98,7 @@ export const createSectionBuilder = () => {
9898 * Parses stability metadata and adds it to the section.
9999 * @param {import('../types.d.ts').Section } section - The section to update.
100100 * @param {Array } nodes - The remaining AST nodes.
101- * @param {import('../types.d.ts ').HierarchizedEntry } entry - The entry providing stability information.
101+ * @param {import('../../metadata/types ').MetadataEntry } entry - The entry providing stability information.
102102 */
103103 const parseStability = ( section , nodes , { stability, content } ) => {
104104 if ( stability ) {
@@ -161,26 +161,18 @@ export const createSectionBuilder = () => {
161161 } ;
162162
163163 /**
164- * Processes children of a given entry and updates the section.
165- * @param {import('../types.d.ts').HierarchizedEntry } entry - The current entry.
166- * @param {import('../types.d.ts').Section } section - The current section.
167- */
168- const handleChildren = ( { hierarchyChildren } , section ) =>
169- hierarchyChildren ?. forEach ( child => handleEntry ( child , section ) ) ;
170-
171- /**
172- * Handles an entry and updates the parent section.
173- * @param {import('../types.d.ts').HierarchizedEntry } entry - The entry to process.
164+ * Handles a hierarchy node and updates the parent section.
165+ * @param {import('../types.d.ts').HierarchizedEntry } node - The hierarchy node to process.
174166 * @param {import('../types.d.ts').Section } parent - The parent section.
175167 */
176- const handleEntry = ( entry , parent ) => {
168+ const handleEntry = ( { entry, children } , parent ) => {
177169 const [ headingNode , ...nodes ] = entry . content . children ;
178170 const section = createSection ( entry , headingNode ) ;
179171
180172 parseStability ( section , nodes , entry ) ;
181173 parseList ( section , nodes ) ;
182174 addDescription ( section , nodes ) ;
183- handleChildren ( entry , section ) ;
175+ children . forEach ( child => handleEntry ( child , section ) ) ;
184176 addAdditionalMetadata ( section , parent , headingNode ) ;
185177 addToParent ( section , parent ) ;
186178 promoteMiscChildren ( section , parent ) ;
@@ -200,7 +192,7 @@ export const createSectionBuilder = () => {
200192 source : `doc/api/${ head . api } .md` ,
201193 } ;
202194
203- buildHierarchy ( entries ) . forEach ( entry => handleEntry ( entry , rootModule ) ) ;
195+ buildHierarchy ( entries ) . forEach ( node => handleEntry ( node , rootModule ) ) ;
204196
205197 return rootModule ;
206198 } ;
0 commit comments