Skip to content

Commit

Permalink
tools: avoid pending deprecation in doc generator
Browse files Browse the repository at this point in the history
`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>
  • Loading branch information
targos authored and danielleadams committed Feb 16, 2021
1 parent d96a97a commit 1ff375b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 86 deletions.
9 changes: 7 additions & 2 deletions tools/doc/html.js
Expand Up @@ -24,7 +24,6 @@
const common = require('./common.js');
const fs = require('fs');
const unified = require('unified');
const find = require('unist-util-find');
const visit = require('unist-util-visit');
const markdown = require('remark-parse');
const gfm = require('remark-gfm');
Expand Down Expand Up @@ -97,7 +96,13 @@ function toHTML({ input, content, filename, nodeVersion, versions }) {
// Set the section name based on the first header. Default to 'Index'.
function firstHeader() {
return (tree, file) => {
const heading = find(tree, { type: 'heading' });
let heading;
visit(tree, (node) => {
if (node.type === 'heading') {
heading = node;
return false;
}
});

if (heading && heading.children.length) {
const recursiveTextContent = (node) =>
Expand Down
83 changes: 0 additions & 83 deletions tools/doc/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tools/doc/package.json
Expand Up @@ -17,7 +17,6 @@
"remark-rehype": "8.0.0",
"to-vfile": "6.1.0",
"unified": "9.2.0",
"unist-util-find": "^1.0.2",
"unist-util-select": "3.0.4",
"unist-util-visit": "2.0.3"
},
Expand Down

0 comments on commit 1ff375b

Please sign in to comment.