diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2021-02-07 19:18:16 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-02-16 17:16:07 +0300 |
commit | 1ff375beb3fac33e673153b7064647b6cbc00326 (patch) | |
tree | a87f9916956c893ac20a66e66e2c2242458552b3 /tools | |
parent | d96a97a2b9b14a4f5475129fbfe495588798f36a (diff) |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/doc/html.js | 9 | ||||
-rw-r--r-- | tools/doc/package-lock.json | 83 | ||||
-rw-r--r-- | tools/doc/package.json | 1 |
3 files changed, 7 insertions, 86 deletions
diff --git a/tools/doc/html.js b/tools/doc/html.js index 6eb3484052b..07a3e5ef405 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -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'); @@ -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) => diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index e93d935aece..586e90b4bb6 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -21,7 +21,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" }, @@ -441,12 +440,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/lodash.iteratee": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.iteratee/-/lodash.iteratee-4.7.0.tgz", - "integrity": "sha1-vkF32yiajMw8CZDx2ya1si/BVUw=", - "dev": true - }, "node_modules/longest-streak": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz", @@ -958,40 +951,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/unist-util-find": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unist-util-find/-/unist-util-find-1.0.2.tgz", - "integrity": "sha512-ft06UDYzqi9o9RmGP0sZWI/zvLLQiBW2/MD+rW6mDqbOWDcmknGX9orQPspfuGRYWr8eSJAmfsBcvOpfGRJseA==", - "dev": true, - "dependencies": { - "lodash.iteratee": "^4.5.0", - "unist-util-visit": "^1.1.0" - } - }, - "node_modules/unist-util-find/node_modules/unist-util-is": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", - "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", - "dev": true - }, - "node_modules/unist-util-find/node_modules/unist-util-visit": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", - "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", - "dev": true, - "dependencies": { - "unist-util-visit-parents": "^2.0.0" - } - }, - "node_modules/unist-util-find/node_modules/unist-util-visit-parents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", - "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", - "dev": true, - "dependencies": { - "unist-util-is": "^3.0.0" - } - }, "node_modules/unist-util-generated": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.6.tgz", @@ -1442,12 +1401,6 @@ "argparse": "^2.0.1" } }, - "lodash.iteratee": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.iteratee/-/lodash.iteratee-4.7.0.tgz", - "integrity": "sha1-vkF32yiajMw8CZDx2ya1si/BVUw=", - "dev": true - }, "longest-streak": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz", @@ -1815,42 +1768,6 @@ "integrity": "sha512-f98yt5pnlMWlzP539tPc4grGMsFaQQlP/vM396b00jngsiINumNmsY8rkXjfoi1c6QaM8nQ3vaGDuoKWbe/1Uw==", "dev": true }, - "unist-util-find": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unist-util-find/-/unist-util-find-1.0.2.tgz", - "integrity": "sha512-ft06UDYzqi9o9RmGP0sZWI/zvLLQiBW2/MD+rW6mDqbOWDcmknGX9orQPspfuGRYWr8eSJAmfsBcvOpfGRJseA==", - "dev": true, - "requires": { - "lodash.iteratee": "^4.5.0", - "unist-util-visit": "^1.1.0" - }, - "dependencies": { - "unist-util-is": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", - "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", - "dev": true - }, - "unist-util-visit": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", - "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", - "dev": true, - "requires": { - "unist-util-visit-parents": "^2.0.0" - } - }, - "unist-util-visit-parents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", - "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", - "dev": true, - "requires": { - "unist-util-is": "^3.0.0" - } - } - } - }, "unist-util-generated": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.6.tgz", diff --git a/tools/doc/package.json b/tools/doc/package.json index d13ac4f30e8..441249f3282 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -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" }, |