Skip to content

Commit 2ba6db3

Browse files
committed
tools: avoid pending deprecation in doc generator
`unist-util-find` depends on `lodash.iteratee` which uses `process.binding()`. Let's remove this dependency which is used in one place to do a very simple thing. PR-URL: #37267 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 4cdd9b6 commit 2ba6db3

3 files changed

Lines changed: 7 additions & 86 deletions

File tree

‎tools/doc/html.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
constcommon=require('./common.js');
2525
constfs=require('fs');
2626
constunified=require('unified');
27-
constfind=require('unist-util-find');
2827
constvisit=require('unist-util-visit');
2928
constmarkdown=require('remark-parse');
3029
constgfm=require('remark-gfm');
@@ -97,7 +96,13 @@ function toHTML({ input, content, filename, nodeVersion, versions }) {
9796
// Set the section name based on the first header. Default to 'Index'.
9897
functionfirstHeader(){
9998
return(tree,file)=>{
100-
constheading=find(tree,{type: 'heading'});
99+
letheading;
100+
visit(tree,(node)=>{
101+
if(node.type==='heading'){
102+
heading=node;
103+
returnfalse;
104+
}
105+
});
101106

102107
if(heading&&heading.children.length){
103108
constrecursiveTextContent=(node)=>

‎tools/doc/package-lock.json‎

Lines changed: 0 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tools/doc/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"remark-rehype": "8.0.0",
1818
"to-vfile": "6.1.0",
1919
"unified": "9.2.0",
20-
"unist-util-find": "^1.0.2",
2120
"unist-util-select": "3.0.4",
2221
"unist-util-visit": "2.0.3"
2322
},

0 commit comments

Comments
 (0)