From 4817b1ff1b8bce31e17daa87e1040663169c8293 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 22 May 2022 13:04:38 +0200 Subject: [PATCH] tools: update lint-md-dependencies to rollup@2.74.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/43172 Reviewed-By: Rich Trott Reviewed-By: Tobias Nießen Reviewed-By: Mohammed Keyvanzadeh --- tools/lint-md/lint-md.mjs | 172 ++++++++++++++++---------------- tools/lint-md/package-lock.json | 106 ++++++++++---------- tools/lint-md/package.json | 2 +- 3 files changed, 141 insertions(+), 139 deletions(-) diff --git a/tools/lint-md/lint-md.mjs b/tools/lint-md/lint-md.mjs index 2c10a6bfde9f75..4ad5dccdf98a65 100644 --- a/tools/lint-md/lint-md.mjs +++ b/tools/lint-md/lint-md.mjs @@ -10797,80 +10797,6 @@ function escapeStringRegexp(string) { .replace(/-/g, '\\x2d'); } -function color$1(d) { - return '\u001B[33m' + d + '\u001B[39m' -} - -const CONTINUE = true; -const SKIP = 'skip'; -const EXIT = false; -const visitParents = - ( - function (tree, test, visitor, reverse) { - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - test = null; - } - var is = convert(test); - var step = reverse ? -1 : 1; - factory(tree, null, [])(); - function factory(node, index, parents) { - var value = typeof node === 'object' && node !== null ? node : {}; - var name; - if (typeof value.type === 'string') { - name = - typeof value.tagName === 'string' - ? value.tagName - : typeof value.name === 'string' - ? value.name - : undefined; - Object.defineProperty(visit, 'name', { - value: - 'node (' + - color$1(value.type + (name ? '<' + name + '>' : '')) + - ')' - }); - } - return visit - function visit() { - var result = []; - var subresult; - var offset; - var grandparents; - if (!test || is(node, index, parents[parents.length - 1] || null)) { - result = toResult(visitor(node, parents)); - if (result[0] === EXIT) { - return result - } - } - if (node.children && result[0] !== SKIP) { - offset = (reverse ? node.children.length : -1) + step; - grandparents = parents.concat(node); - while (offset > -1 && offset < node.children.length) { - subresult = factory(node.children[offset], offset, grandparents)(); - if (subresult[0] === EXIT) { - return subresult - } - offset = - typeof subresult[1] === 'number' ? subresult[1] : offset + step; - } - } - return result - } - } - } - ); -function toResult(value) { - if (Array.isArray(value)) { - return value - } - if (typeof value === 'number') { - return [CONTINUE, value] - } - return [value] -} - const own$3 = {}.hasOwnProperty; const findAndReplace = ( @@ -10891,7 +10817,7 @@ const findAndReplace = const pairs = toPairs(schema); let pairIndex = -1; while (++pairIndex < pairs.length) { - visitParents(tree, 'text', visitor); + visitParents$1(tree, 'text', visitor); } return tree function visitor(node, parents) { @@ -10911,28 +10837,33 @@ const findAndReplace = grandparent = parent; } if (grandparent) { - return handler(node, grandparent) + return handler(node, parents) } } - function handler(node, parent) { + function handler(node, parents) { + const parent = parents[parents.length - 1]; const find = pairs[pairIndex][0]; const replace = pairs[pairIndex][1]; let start = 0; - let index = parent.children.indexOf(node); + const index = parent.children.indexOf(node); let nodes = []; let position; find.lastIndex = 0; let match = find.exec(node.value); while (match) { position = match.index; - let value = replace(...match, { + const matchObject = { index: match.index, - input: match.input - }); + input: match.input, + stack: [...parents, node] + }; + let value = replace(...match, matchObject); if (typeof value === 'string') { value = value.length > 0 ? {type: 'text', value} : undefined; } - if (value !== false) { + if (value === false) { + position = undefined; + } else { if (start !== position) { nodes.push({ type: 'text', @@ -10953,14 +10884,13 @@ const findAndReplace = } if (position === undefined) { nodes = [node]; - index--; } else { if (start < node.value.length) { nodes.push({type: 'text', value: node.value.slice(start)}); } parent.children.splice(index, 1, ...nodes); } - return index + nodes.length + 1 + return index + nodes.length } } ); @@ -11747,6 +11677,80 @@ function location(file) { } } +function color$1(d) { + return '\u001B[33m' + d + '\u001B[39m' +} + +const CONTINUE = true; +const SKIP = 'skip'; +const EXIT = false; +const visitParents = + ( + function (tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor; + visitor = test; + test = null; + } + var is = convert(test); + var step = reverse ? -1 : 1; + factory(tree, null, [])(); + function factory(node, index, parents) { + var value = typeof node === 'object' && node !== null ? node : {}; + var name; + if (typeof value.type === 'string') { + name = + typeof value.tagName === 'string' + ? value.tagName + : typeof value.name === 'string' + ? value.name + : undefined; + Object.defineProperty(visit, 'name', { + value: + 'node (' + + color$1(value.type + (name ? '<' + name + '>' : '')) + + ')' + }); + } + return visit + function visit() { + var result = []; + var subresult; + var offset; + var grandparents; + if (!test || is(node, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(node, parents)); + if (result[0] === EXIT) { + return result + } + } + if (node.children && result[0] !== SKIP) { + offset = (reverse ? node.children.length : -1) + step; + grandparents = parents.concat(node); + while (offset > -1 && offset < node.children.length) { + subresult = factory(node.children[offset], offset, grandparents)(); + if (subresult[0] === EXIT) { + return subresult + } + offset = + typeof subresult[1] === 'number' ? subresult[1] : offset + step; + } + } + return result + } + } + } + ); +function toResult(value) { + if (Array.isArray(value)) { + return value + } + if (typeof value === 'number') { + return [CONTINUE, value] + } + return [value] +} + const visit = ( function (tree, test, visitor, reverse) { diff --git a/tools/lint-md/package-lock.json b/tools/lint-md/package-lock.json index 55b7aaa18bd4cd..ca9c27f8ade7ed 100644 --- a/tools/lint-md/package-lock.json +++ b/tools/lint-md/package-lock.json @@ -18,7 +18,7 @@ "devDependencies": { "@rollup/plugin-commonjs": "^22.0.0", "@rollup/plugin-node-resolve": "^13.3.0", - "rollup": "^2.73.0", + "rollup": "^2.74.1", "rollup-plugin-cleanup": "^3.2.1" } }, @@ -129,9 +129,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "node_modules/@types/node": { - "version": "17.0.33", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.33.tgz", - "integrity": "sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ==", + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", + "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==", "dev": true }, "node_modules/@types/resolve": { @@ -353,9 +353,9 @@ "dev": true }, "node_modules/glob": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.2.tgz", - "integrity": "sha512-NzDgHDiJwKYByLrL5lONmQFpK/2G78SMMfo+E9CuGlX4IkvfKDsiQSNPwAYxEy+e6p7ZQ3uslSLlwlJcqezBmQ==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -556,13 +556,13 @@ } }, "node_modules/mdast-util-find-and-replace": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.1.0.tgz", - "integrity": "sha512-1w1jbqAd13oU78QPBf5223+xB+37ecNtQ1JElq2feWols5oEYAl+SgNDnOZipe7NfLemoEt362yUS15/wip4mw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.0.tgz", + "integrity": "sha512-bz8hUWkMX7UcasORORcyBEsTKJ+dBiFwRPrm43hHC9NMRylIMLbfO5rwfeCN+UtY4AAi7s8WqXftb9eX6ZsqCg==", "dependencies": { "escape-string-regexp": "^5.0.0", "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^4.0.0" + "unist-util-visit-parents": "^5.0.0" }, "funding": { "type": "opencollective", @@ -2209,9 +2209,9 @@ } }, "node_modules/rollup": { - "version": "2.73.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.73.0.tgz", - "integrity": "sha512-h/UngC3S4Zt28mB3g0+2YCMegT5yoftnQplwzPqGZcKvlld5e+kT/QRmJiL+qxGyZKOYpgirWGdLyEO1b0dpLQ==", + "version": "2.74.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.74.1.tgz", + "integrity": "sha512-K2zW7kV8Voua5eGkbnBtWYfMIhYhT9Pel2uhBk2WO5eMee161nPze/XRfvEQPFYz7KgrCCnmh2Wy0AMFLGGmMA==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -2438,6 +2438,19 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unified-message-control/node_modules/unist-util-visit-parents": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", + "integrity": "sha512-1xAFJXAKpnnJl8G7K5KgU7FY55y3GcLIXqkzUj5QF/QVP7biUm0K0O2oqVkYsdjzJKifYeWn9+o6piAK2hGSHw==", + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-generated": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-2.0.0.tgz", @@ -2495,19 +2508,6 @@ } }, "node_modules/unist-util-visit-parents": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", - "integrity": "sha512-1xAFJXAKpnnJl8G7K5KgU7FY55y3GcLIXqkzUj5QF/QVP7biUm0K0O2oqVkYsdjzJKifYeWn9+o6piAK2hGSHw==", - "dependencies": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit/node_modules/unist-util-visit-parents": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.0.tgz", "integrity": "sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg==", @@ -2741,9 +2741,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "@types/node": { - "version": "17.0.33", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.33.tgz", - "integrity": "sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ==", + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.35.tgz", + "integrity": "sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==", "dev": true }, "@types/resolve": { @@ -2907,9 +2907,9 @@ "dev": true }, "glob": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.2.tgz", - "integrity": "sha512-NzDgHDiJwKYByLrL5lONmQFpK/2G78SMMfo+E9CuGlX4IkvfKDsiQSNPwAYxEy+e6p7ZQ3uslSLlwlJcqezBmQ==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -3048,13 +3048,13 @@ } }, "mdast-util-find-and-replace": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.1.0.tgz", - "integrity": "sha512-1w1jbqAd13oU78QPBf5223+xB+37ecNtQ1JElq2feWols5oEYAl+SgNDnOZipe7NfLemoEt362yUS15/wip4mw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.0.tgz", + "integrity": "sha512-bz8hUWkMX7UcasORORcyBEsTKJ+dBiFwRPrm43hHC9NMRylIMLbfO5rwfeCN+UtY4AAi7s8WqXftb9eX6ZsqCg==", "requires": { "escape-string-regexp": "^5.0.0", "unist-util-is": "^5.0.0", - "unist-util-visit-parents": "^4.0.0" + "unist-util-visit-parents": "^5.0.0" } }, "mdast-util-from-markdown": { @@ -4199,9 +4199,9 @@ } }, "rollup": { - "version": "2.73.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.73.0.tgz", - "integrity": "sha512-h/UngC3S4Zt28mB3g0+2YCMegT5yoftnQplwzPqGZcKvlld5e+kT/QRmJiL+qxGyZKOYpgirWGdLyEO1b0dpLQ==", + "version": "2.74.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.74.1.tgz", + "integrity": "sha512-K2zW7kV8Voua5eGkbnBtWYfMIhYhT9Pel2uhBk2WO5eMee161nPze/XRfvEQPFYz7KgrCCnmh2Wy0AMFLGGmMA==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -4357,6 +4357,15 @@ "unist-util-is": "^5.0.0", "unist-util-visit-parents": "^4.0.0" } + }, + "unist-util-visit-parents": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", + "integrity": "sha512-1xAFJXAKpnnJl8G7K5KgU7FY55y3GcLIXqkzUj5QF/QVP7biUm0K0O2oqVkYsdjzJKifYeWn9+o6piAK2hGSHw==", + "requires": { + "@types/unist": "^2.0.0", + "unist-util-is": "^5.0.0" + } } } }, @@ -4394,23 +4403,12 @@ "@types/unist": "^2.0.0", "unist-util-is": "^5.0.0", "unist-util-visit-parents": "^5.0.0" - }, - "dependencies": { - "unist-util-visit-parents": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.0.tgz", - "integrity": "sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg==", - "requires": { - "@types/unist": "^2.0.0", - "unist-util-is": "^5.0.0" - } - } } }, "unist-util-visit-parents": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-4.1.1.tgz", - "integrity": "sha512-1xAFJXAKpnnJl8G7K5KgU7FY55y3GcLIXqkzUj5QF/QVP7biUm0K0O2oqVkYsdjzJKifYeWn9+o6piAK2hGSHw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-5.1.0.tgz", + "integrity": "sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg==", "requires": { "@types/unist": "^2.0.0", "unist-util-is": "^5.0.0" diff --git a/tools/lint-md/package.json b/tools/lint-md/package.json index fc9f67fdc3eac1..ff12ce676a57f4 100644 --- a/tools/lint-md/package.json +++ b/tools/lint-md/package.json @@ -16,7 +16,7 @@ "devDependencies": { "@rollup/plugin-commonjs": "^22.0.0", "@rollup/plugin-node-resolve": "^13.3.0", - "rollup": "^2.73.0", + "rollup": "^2.74.1", "rollup-plugin-cleanup": "^3.2.1" } }