From 0f0afc76429f895af1bc9ce54d98be24898caec9 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sat, 29 Jan 2022 00:13:52 +0000 Subject: [PATCH] tools: update lint-md-dependencies to rollup@2.67.0 --- tools/lint-md/lint-md.mjs | 550 ++++++++++++++++++++++---------- tools/lint-md/package-lock.json | 172 +++++----- tools/lint-md/package.json | 2 +- 3 files changed, 476 insertions(+), 248 deletions(-) diff --git a/tools/lint-md/lint-md.mjs b/tools/lint-md/lint-md.mjs index b54fc15cbe2260..666b67dcc774e9 100644 --- a/tools/lint-md/lint-md.mjs +++ b/tools/lint-md/lint-md.mjs @@ -7913,9 +7913,33 @@ function configure(base, extension) { return base } -function containerFlow(parent, context) { +function track(options_) { + const options = options_ || {}; + const now = options.now || {}; + let lineShift = options.lineShift || 0; + let line = now.line || 1; + let column = now.column || 1; + return {move, current, shift} + function current() { + return {now: {line, column}, lineShift} + } + function shift(value) { + lineShift += value; + } + function move(value = '') { + const chunks = value.split(/\r?\n|\r/g); + const tail = chunks[chunks.length - 1]; + line += chunks.length - 1; + column = + chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift; + return value + } +} + +function containerFlow(parent, context, safeOptions) { const indexStack = context.indexStack; const children = parent.children || []; + const tracker = track(safeOptions); const results = []; let index = -1; indexStack.push(-1); @@ -7923,13 +7947,19 @@ function containerFlow(parent, context) { const child = children[index]; indexStack[indexStack.length - 1] = index; results.push( - context.handle(child, parent, context, {before: '\n', after: '\n'}) + tracker.move( + context.handle(child, parent, context, { + before: '\n', + after: '\n', + ...tracker.current() + }) + ) ); if (child.type !== 'list') { context.bulletLastUsed = undefined; } if (index < children.length - 1) { - results.push(between(child, children[index + 1])); + results.push(tracker.move(between(child, children[index + 1]))); } } indexStack.pop(); @@ -7971,9 +8001,15 @@ function indentLines(value, map) { } } -function blockquote(node, _, context) { +function blockquote(node, _, context, safeOptions) { const exit = context.enter('blockquote'); - const value = indentLines(containerFlow(node, context), map$2); + const tracker = track(safeOptions); + tracker.move('> '); + tracker.shift(2); + const value = indentLines( + containerFlow(node, context, tracker.current()), + map$2 + ); exit(); return value } @@ -8173,46 +8209,50 @@ function escapeBackslashes(value, after) { return results.join('') } -function code$1(node, _, context) { +function code$1(node, _, context, safeOptions) { const marker = checkFence(context); const raw = node.value || ''; const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'; - let value; - let exit; if (formatCodeAsIndented(node, context)) { - exit = context.enter('codeIndented'); - value = indentLines(raw, map$1); - } else { - const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3)); - let subexit; - exit = context.enter('codeFenced'); - value = sequence; - if (node.lang) { - subexit = context.enter('codeFencedLang' + suffix); - value += safe(context, node.lang, { - before: '`', + const exit = context.enter('codeIndented'); + const value = indentLines(raw, map$1); + exit(); + return value + } + const tracker = track(safeOptions); + const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3)); + const exit = context.enter('codeFenced'); + let value = tracker.move(sequence); + if (node.lang) { + const subexit = context.enter('codeFencedLang' + suffix); + value += tracker.move( + safe(context, node.lang, { + before: value, after: ' ', - encode: ['`'] - }); - subexit(); - } - if (node.lang && node.meta) { - subexit = context.enter('codeFencedMeta' + suffix); - value += - ' ' + - safe(context, node.meta, { - before: ' ', - after: '\n', - encode: ['`'] - }); - subexit(); - } - value += '\n'; - if (raw) { - value += raw + '\n'; - } - value += sequence; + encode: ['`'], + ...tracker.current() + }) + ); + subexit(); } + if (node.lang && node.meta) { + const subexit = context.enter('codeFencedMeta' + suffix); + value += tracker.move(' '); + value += tracker.move( + safe(context, node.meta, { + before: value, + after: '\n', + encode: ['`'], + ...tracker.current() + }) + ); + subexit(); + } + value += tracker.move('\n'); + if (raw) { + value += tracker.move(raw + '\n'); + } + value += tracker.move(sequence); exit(); return value } @@ -8239,32 +8279,54 @@ function checkQuote(context) { return marker } -function definition(node, _, context) { - const marker = checkQuote(context); - const suffix = marker === '"' ? 'Quote' : 'Apostrophe'; +function definition(node, _, context, safeOptions) { + const quote = checkQuote(context); + const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; const exit = context.enter('definition'); let subexit = context.enter('label'); - let value = - '[' + safe(context, association(node), {before: '[', after: ']'}) + ']: '; + const tracker = track(safeOptions); + let value = tracker.move('['); + value += tracker.move( + safe(context, association(node), { + before: value, + after: ']', + ...tracker.current() + }) + ); + value += tracker.move(']: '); subexit(); if ( !node.url || /[\0- \u007F]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); - value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'; + value += tracker.move('<'); + value += tracker.move( + safe(context, node.url, {before: value, after: '>', ...tracker.current()}) + ); + value += tracker.move('>'); } else { subexit = context.enter('destinationRaw'); - value += safe(context, node.url, {before: ' ', after: ' '}); + value += tracker.move( + safe(context, node.url, { + before: value, + after: node.title ? ' ' : '\n', + ...tracker.current() + }) + ); } subexit(); if (node.title) { subexit = context.enter('title' + suffix); - value += - ' ' + - marker + - safe(context, node.title, {before: marker, after: marker}) + - marker; + value += tracker.move(' ' + quote); + value += tracker.move( + safe(context, node.title, { + before: value, + after: quote, + ...tracker.current() + }) + ); + value += tracker.move(quote); subexit(); } exit(); @@ -8290,6 +8352,7 @@ function containerPhrasing(parent, context, safeOptions) { let index = -1; let before = safeOptions.before; indexStack.push(-1); + let tracker = track(safeOptions); while (++index < children.length) { const child = children[index]; let after; @@ -8300,7 +8363,8 @@ function containerPhrasing(parent, context, safeOptions) { after = handle ? handle(children[index + 1], parent, context, { before: '', - after: '' + after: '', + ...tracker.current() }).charAt(0) : ''; } else { @@ -8316,8 +8380,18 @@ function containerPhrasing(parent, context, safeOptions) { ' ' ); before = ' '; + tracker = track(safeOptions); + tracker.move(results.join('')); } - results.push(context.handle(child, parent, context, {before, after})); + results.push( + tracker.move( + context.handle(child, parent, context, { + ...tracker.current(), + before, + after + }) + ) + ); before = results[results.length - 1].slice(-1); } indexStack.pop(); @@ -8325,15 +8399,21 @@ function containerPhrasing(parent, context, safeOptions) { } emphasis.peek = emphasisPeek; -function emphasis(node, _, context) { +function emphasis(node, _, context, safeOptions) { const marker = checkEmphasis(context); const exit = context.enter('emphasis'); - const value = containerPhrasing(node, context, { - before: marker, - after: marker - }); + const tracker = track(safeOptions); + let value = tracker.move(marker); + value += tracker.move( + containerPhrasing(node, context, { + before: value, + after: marker, + ...tracker.current() + }) + ); + value += tracker.move(marker); exit(); - return marker + value + marker + return value } function emphasisPeek(_, _1, context) { return context.options.emphasis || '*' @@ -8510,12 +8590,17 @@ function formatHeadingAsSetext(node, context) { ) } -function heading(node, _, context) { +function heading(node, _, context, safeOptions) { const rank = Math.max(Math.min(6, node.depth || 1), 1); + const tracker = track(safeOptions); if (formatHeadingAsSetext(node, context)) { const exit = context.enter('headingSetext'); const subexit = context.enter('phrasing'); - const value = containerPhrasing(node, context, {before: '\n', after: '\n'}); + const value = containerPhrasing(node, context, { + ...tracker.current(), + before: '\n', + after: '\n' + }); subexit(); exit(); return ( @@ -8530,7 +8615,12 @@ function heading(node, _, context) { const sequence = '#'.repeat(rank); const exit = context.enter('headingAtx'); const subexit = context.enter('phrasing'); - let value = containerPhrasing(node, context, {before: '# ', after: '\n'}); + tracker.move(sequence + ' '); + let value = containerPhrasing(node, context, { + before: '# ', + after: '\n', + ...tracker.current() + }); if (/^[\t ]/.test(value)) { value = '&#x' + @@ -8556,37 +8646,53 @@ function htmlPeek() { } image.peek = imagePeek; -function image(node, _, context) { +function image(node, _, context, safeOptions) { const quote = checkQuote(context); const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; const exit = context.enter('image'); let subexit = context.enter('label'); - let value = '![' + safe(context, node.alt, {before: '[', after: ']'}) + ']('; + const tracker = track(safeOptions); + let value = tracker.move('!['); + value += tracker.move( + safe(context, node.alt, {before: value, after: ']', ...tracker.current()}) + ); + value += tracker.move(']('); subexit(); if ( (!node.url && node.title) || /[\0- \u007F]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); - value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'; + value += tracker.move('<'); + value += tracker.move( + safe(context, node.url, {before: value, after: '>', ...tracker.current()}) + ); + value += tracker.move('>'); } else { subexit = context.enter('destinationRaw'); - value += safe(context, node.url, { - before: '(', - after: node.title ? ' ' : ')' - }); + value += tracker.move( + safe(context, node.url, { + before: value, + after: node.title ? ' ' : ')', + ...tracker.current() + }) + ); } subexit(); if (node.title) { subexit = context.enter('title' + suffix); - value += - ' ' + - quote + - safe(context, node.title, {before: quote, after: quote}) + - quote; + value += tracker.move(' ' + quote); + value += tracker.move( + safe(context, node.title, { + before: value, + after: quote, + ...tracker.current() + }) + ); + value += tracker.move(quote); subexit(); } - value += ')'; + value += tracker.move(')'); exit(); return value } @@ -8595,24 +8701,36 @@ function imagePeek() { } imageReference.peek = imageReferencePeek; -function imageReference(node, _, context) { +function imageReference(node, _, context, safeOptions) { const type = node.referenceType; const exit = context.enter('imageReference'); let subexit = context.enter('label'); - const alt = safe(context, node.alt, {before: '[', after: ']'}); - let value = '![' + alt + ']'; + const tracker = track(safeOptions); + let value = tracker.move('!['); + const alt = safe(context, node.alt, { + before: value, + after: ']', + ...tracker.current() + }); + value += tracker.move(alt + ']['); subexit(); const stack = context.stack; context.stack = []; subexit = context.enter('reference'); - const reference = safe(context, association(node), {before: '[', after: ']'}); + const reference = safe(context, association(node), { + before: value, + after: ']', + ...tracker.current() + }); subexit(); context.stack = stack; exit(); if (type === 'full' || !alt || alt !== reference) { - value += '[' + reference + ']'; - } else if (type !== 'shortcut') { - value += '[]'; + value += tracker.move(reference + ']'); + } else if (type === 'shortcut') { + value = value.slice(0, -1); + } else { + value += tracker.move(']'); } return value } @@ -8672,51 +8790,76 @@ function formatLinkAsAutolink(node, context) { } link.peek = linkPeek; -function link(node, _, context) { +function link(node, _, context, safeOptions) { const quote = checkQuote(context); const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; + const tracker = track(safeOptions); let exit; let subexit; - let value; if (formatLinkAsAutolink(node, context)) { const stack = context.stack; context.stack = []; exit = context.enter('autolink'); - value = - '<' + containerPhrasing(node, context, {before: '<', after: '>'}) + '>'; + let value = tracker.move('<'); + value += tracker.move( + containerPhrasing(node, context, { + before: value, + after: '>', + ...tracker.current() + }) + ); + value += tracker.move('>'); exit(); context.stack = stack; return value } exit = context.enter('link'); subexit = context.enter('label'); - value = - '[' + containerPhrasing(node, context, {before: '[', after: ']'}) + ']('; + let value = tracker.move('['); + value += tracker.move( + containerPhrasing(node, context, { + before: value, + after: '](', + ...tracker.current() + }) + ); + value += tracker.move(']('); subexit(); if ( (!node.url && node.title) || /[\0- \u007F]/.test(node.url) ) { subexit = context.enter('destinationLiteral'); - value += '<' + safe(context, node.url, {before: '<', after: '>'}) + '>'; + value += tracker.move('<'); + value += tracker.move( + safe(context, node.url, {before: value, after: '>', ...tracker.current()}) + ); + value += tracker.move('>'); } else { subexit = context.enter('destinationRaw'); - value += safe(context, node.url, { - before: '(', - after: node.title ? ' ' : ')' - }); + value += tracker.move( + safe(context, node.url, { + before: value, + after: node.title ? ' ' : ')', + ...tracker.current() + }) + ); } subexit(); if (node.title) { subexit = context.enter('title' + suffix); - value += - ' ' + - quote + - safe(context, node.title, {before: quote, after: quote}) + - quote; + value += tracker.move(' ' + quote); + value += tracker.move( + safe(context, node.title, { + before: value, + after: quote, + ...tracker.current() + }) + ); + value += tracker.move(quote); subexit(); } - value += ')'; + value += tracker.move(')'); exit(); return value } @@ -8725,24 +8868,36 @@ function linkPeek(node, _, context) { } linkReference.peek = linkReferencePeek; -function linkReference(node, _, context) { +function linkReference(node, _, context, safeOptions) { const type = node.referenceType; const exit = context.enter('linkReference'); let subexit = context.enter('label'); - const text = containerPhrasing(node, context, {before: '[', after: ']'}); - let value = '[' + text + ']'; + const tracker = track(safeOptions); + let value = tracker.move('['); + const text = containerPhrasing(node, context, { + before: value, + after: ']', + ...tracker.current() + }); + value += tracker.move(text + ']['); subexit(); const stack = context.stack; context.stack = []; subexit = context.enter('reference'); - const reference = safe(context, association(node), {before: '[', after: ']'}); + const reference = safe(context, association(node), { + before: value, + after: ']', + ...tracker.current() + }); subexit(); context.stack = stack; exit(); if (type === 'full' || !text || text !== reference) { - value += '[' + reference + ']'; - } else if (type !== 'shortcut') { - value += '[]'; + value += tracker.move(reference + ']'); + } else if (type === 'shortcut') { + value = value.slice(0, -1); + } else { + value += tracker.move(']'); } return value } @@ -8836,7 +8991,7 @@ function checkRule(context) { return marker } -function list(node, parent, context) { +function list(node, parent, context, safeOptions) { const exit = context.enter('list'); const bulletCurrent = context.bulletCurrent; let bullet = node.ordered ? checkBulletOrdered(context) : checkBullet(context); @@ -8892,7 +9047,7 @@ function list(node, parent, context) { bullet = bulletOther; } context.bulletCurrent = bullet; - const value = containerFlow(node, context); + const value = containerFlow(node, context, safeOptions); context.bulletLastUsed = bullet; context.bulletCurrent = bulletCurrent; exit(); @@ -8914,7 +9069,7 @@ function checkListItemIndent(context) { return style } -function listItem(node, parent, context) { +function listItem(node, parent, context, safeOptions) { const listItemIndent = checkListItemIndent(context); let bullet = context.bulletCurrent || checkBullet(context); if (parent && parent.type === 'list' && parent.ordered) { @@ -8935,8 +9090,14 @@ function listItem(node, parent, context) { ) { size = Math.ceil(size / 4) * 4; } + const tracker = track(safeOptions); + tracker.move(bullet + ' '.repeat(size - bullet.length)); + tracker.shift(size); const exit = context.enter('listItem'); - const value = indentLines(containerFlow(node, context), map); + const value = indentLines( + containerFlow(node, context, tracker.current()), + map + ); exit(); return value function map(line, index, blank) { @@ -8947,17 +9108,17 @@ function listItem(node, parent, context) { } } -function paragraph(node, _, context) { +function paragraph(node, _, context, safeOptions) { const exit = context.enter('paragraph'); const subexit = context.enter('phrasing'); - const value = containerPhrasing(node, context, {before: '\n', after: '\n'}); + const value = containerPhrasing(node, context, safeOptions); subexit(); exit(); return value } -function root(node, _, context) { - return containerFlow(node, context) +function root(node, _, context, safeOptions) { + return containerFlow(node, context, safeOptions) } function checkStrong(context) { @@ -8973,15 +9134,21 @@ function checkStrong(context) { } strong.peek = strongPeek; -function strong(node, _, context) { +function strong(node, _, context, safeOptions) { const marker = checkStrong(context); const exit = context.enter('strong'); - const value = containerPhrasing(node, context, { - before: marker, - after: marker - }); + const tracker = track(safeOptions); + let value = tracker.move(marker + marker); + value += tracker.move( + containerPhrasing(node, context, { + before: value, + after: marker, + ...tracker.current() + }) + ); + value += tracker.move(marker + marker); exit(); - return marker + marker + value + marker + marker + return value } function strongPeek(_, _1, context) { return context.options.strong || '*' @@ -9181,7 +9348,12 @@ function toMarkdown(tree, options = {}) { unknown, handlers: context.handlers }); - let result = context.handle(tree, null, context, {before: '\n', after: '\n'}); + let result = context.handle(tree, null, context, { + before: '\n', + after: '\n', + now: {line: 1, column: 1}, + lineShift: 0 + }); if ( result && result.charCodeAt(result.length - 1) !== 10 && @@ -10980,8 +11152,6 @@ function previous(match, email) { ) } -let warningColonInFootnote = false; -let warningListInFootnote = false; function gfmFootnoteFromMarkdown() { return { enter: { @@ -11045,51 +11215,53 @@ function gfmFootnoteToMarkdown() { unsafe: [{character: '[', inConstruct: ['phrasing', 'label', 'reference']}], handlers: {footnoteDefinition, footnoteReference} } - function footnoteReference(node, _, context) { + function footnoteReference(node, _, context, safeOptions) { + const tracker = track(safeOptions); + let value = tracker.move('[^'); const exit = context.enter('footnoteReference'); const subexit = context.enter('reference'); - const reference = safe(context, association(node), { - before: '^', - after: ']' - }); + value += tracker.move( + safe(context, association(node), { + ...tracker.current(), + before: value, + after: ']' + }) + ); subexit(); exit(); - return '[^' + reference + ']' + value += tracker.move(']'); + return value } function footnoteReferencePeek() { return '[' } - function footnoteDefinition(node, _, context) { + function footnoteDefinition(node, _, context, safeOptions) { + const tracker = track(safeOptions); + let value = tracker.move('[^'); const exit = context.enter('footnoteDefinition'); const subexit = context.enter('label'); - const id = safe(context, association(node), {before: '^', after: ']'}); - const label = '[^' + id + ']:'; + value += tracker.move( + safe(context, association(node), { + ...tracker.current(), + before: value, + after: ']' + }) + ); subexit(); - const value = indentLines(containerFlow(node, context), map); + value += tracker.move( + ']:' + (node.children && node.children.length > 0 ? ' ' : '') + ); + tracker.shift(4); + value += tracker.move( + indentLines(containerFlow(node, context, tracker.current()), map) + ); exit(); - if (!warningColonInFootnote && id.includes(':')) { - console.warn( - '[mdast-util-gfm-footnote] Warning: Found a colon in footnote identifier `' + - id + - '`. GitHub currently crahes on colons in footnotes (see for more info)' - ); - warningColonInFootnote = true; - } - if (!warningListInFootnote) { - visit$1(node, 'list', () => { - console.warn( - '[mdast-util-gfm-footnote] Warning: Found a list in a footnote definition. GitHub currently crahes on lists in footnotes (see for more info)' - ); - warningListInFootnote = true; - return EXIT$1 - }); - } return value function map(line, index, blank) { if (index) { return (blank ? '' : ' ') + line } - return (blank ? label : label + ' ') + line + return line } } } @@ -11110,11 +11282,18 @@ function enterStrikethrough(token) { function exitStrikethrough(token) { this.exit(token); } -function handleDelete(node, _, context) { +function handleDelete(node, _, context, safeOptions) { + const tracker = track(safeOptions); const exit = context.enter('emphasis'); - const value = containerPhrasing(node, context, {before: '~', after: '~'}); + let value = tracker.move('~~'); + value += containerPhrasing(node, context, { + ...tracker.current(), + before: value, + after: '~' + }); + value += tracker.move('~~'); exit(); - return '~~' + value + '~~' + return value } function peekDelete() { return '~' @@ -11353,18 +11532,22 @@ function gfmTableToMarkdown(options) { inlineCode: inlineCodeWithTable } } - function handleTable(node, _, context) { - return serializeData(handleTableAsData(node, context), node.align) + function handleTable(node, _, context, safeOptions) { + return serializeData( + handleTableAsData(node, context, safeOptions), + node.align + ) } - function handleTableRow(node, _, context) { - const row = handleTableRowAsData(node, context); + function handleTableRow(node, _, context, safeOptions) { + const row = handleTableRowAsData(node, context, safeOptions); const value = serializeData([row]); return value.slice(0, value.indexOf('\n')) } - function handleTableCell(node, _, context) { + function handleTableCell(node, _, context, safeOptions) { const exit = context.enter('tableCell'); const subexit = context.enter('phrasing'); const value = containerPhrasing(node, context, { + ...safeOptions, before: around, after: around }); @@ -11380,24 +11563,33 @@ function gfmTableToMarkdown(options) { stringLength }) } - function handleTableAsData(node, context) { + function handleTableAsData(node, context, safeOptions) { const children = node.children; let index = -1; const result = []; const subexit = context.enter('table'); while (++index < children.length) { - result[index] = handleTableRowAsData(children[index], context); + result[index] = handleTableRowAsData( + children[index], + context, + safeOptions + ); } subexit(); return result } - function handleTableRowAsData(node, context) { + function handleTableRowAsData(node, context, safeOptions) { const children = node.children; let index = -1; const result = []; const subexit = context.enter('tableRow'); while (++index < children.length) { - result[index] = handleTableCell(children[index], node, context); + result[index] = handleTableCell( + children[index], + node, + context, + safeOptions + ); } subexit(); return result @@ -11423,12 +11615,12 @@ const gfmTaskListItemToMarkdown = { handlers: {listItem: listItemWithTaskListItem} }; function exitCheck(token) { - this.stack[this.stack.length - 2].checked = - token.type === 'taskListCheckValueChecked'; + const node = (this.stack[this.stack.length - 2]); + node.checked = token.type === 'taskListCheckValueChecked'; } function exitParagraphWithTaskListItem(token) { - const parent = this.stack[this.stack.length - 2]; - const node = this.stack[this.stack.length - 1]; + const parent = (this.stack[this.stack.length - 2]); + const node = (this.stack[this.stack.length - 1]); const siblings = parent.children; const head = node.children[0]; let index = -1; @@ -11451,7 +11643,11 @@ function exitParagraphWithTaskListItem(token) { head.value = head.value.slice(1); if (head.value.length === 0) { node.children.shift(); - } else { + } else if ( + node.position && + head.position && + typeof head.position.start.offset === 'number' + ) { head.position.start.column++; head.position.start.offset++; node.position.start = Object.assign({}, head.position.start); @@ -11460,15 +11656,25 @@ function exitParagraphWithTaskListItem(token) { } this.exit(token); } -function listItemWithTaskListItem(node, parent, context) { +function listItemWithTaskListItem(node, parent, context, safeOptions) { const head = node.children[0]; - let value = listItem(node, parent, context); - if (typeof node.checked === 'boolean' && head && head.type === 'paragraph') { + const checkable = + typeof node.checked === 'boolean' && head && head.type === 'paragraph'; + const checkbox = '[' + (node.checked ? 'x' : ' ') + '] '; + const tracker = track(safeOptions); + if (checkable) { + tracker.move(checkbox); + } + let value = listItem(node, parent, context, { + ...safeOptions, + ...tracker.current() + }); + if (checkable) { value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check); } return value function check($0) { - return $0 + '[' + (node.checked ? 'x' : ' ') + '] ' + return $0 + checkbox } } diff --git a/tools/lint-md/package-lock.json b/tools/lint-md/package-lock.json index d3b2fed5a476b5..f77182a6392fe7 100644 --- a/tools/lint-md/package-lock.json +++ b/tools/lint-md/package-lock.json @@ -18,7 +18,7 @@ "devDependencies": { "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-node-resolve": "^13.1.3", - "rollup": "^2.65.0", + "rollup": "^2.67.0", "rollup-plugin-cleanup": "^3.2.1" } }, @@ -107,6 +107,14 @@ "@types/estree": "*" } }, + "node_modules/@types/hast": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", + "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/mdast": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz", @@ -121,9 +129,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "node_modules/@types/node": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz", - "integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==", + "version": "17.0.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.15.tgz", + "integrity": "sha512-zWt4SDDv1S9WRBNxLFxFRHxdD9tvH8f5/kg5/IaLFdnSNXsDY4eL3Q3XXN+VxUnWIhyVFDwcsmAprvwXoM/ClA==", "dev": true }, "node_modules/@types/resolve": { @@ -604,14 +612,13 @@ } }, "node_modules/mdast-util-gfm-footnote": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-1.0.0.tgz", - "integrity": "sha512-qeg9YoS2YYP6OBmMyUFxKXb6BLwAsbGidIxgwDAXHIMYZQhIwe52L9BSJs+zP29Jp5nSERPkmG3tSwAN23/ZbQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-1.0.1.tgz", + "integrity": "sha512-p+PrYlkw9DeCRkTVw1duWqPRHX6Ywh2BNKJQcZbCwAuP/59B0Lk9kakuAd7KbQprVO4GzdW8eS5++A9PUSqIyw==", "dependencies": { "@types/mdast": "^3.0.0", - "mdast-util-to-markdown": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "unist-util-visit": "^4.0.0" + "mdast-util-to-markdown": "^1.3.0", + "micromark-util-normalize-identifier": "^1.0.0" }, "funding": { "type": "opencollective", @@ -619,12 +626,12 @@ } }, "node_modules/mdast-util-gfm-strikethrough": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-1.0.0.tgz", - "integrity": "sha512-gM9ipBUdRxYa6Yq1Hd8Otg6jEn/dRxFZ1F9ZX4QHosHOexLGqNZO2dh0A+YFbUEd10RcKjnjb4jOfJJzoXXUew==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-1.0.1.tgz", + "integrity": "sha512-zKJbEPe+JP6EUv0mZ0tQUyLQOC+FADt0bARldONot/nefuISkaZFlmVK4tU6JgfyZGrky02m/I6PmehgAgZgqg==", "dependencies": { - "@types/mdast": "^3.0.3", - "mdast-util-to-markdown": "^1.0.0" + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" }, "funding": { "type": "opencollective", @@ -632,12 +639,12 @@ } }, "node_modules/mdast-util-gfm-table": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-1.0.2.tgz", - "integrity": "sha512-pPekvCTChFBF8uCq8bVyQwar8NBU/TaXIy44jj/UzmjMgPBHIa1B1ge8a0JVgzhqgXQAMvGT+PgiKlicdLGfDQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-1.0.3.tgz", + "integrity": "sha512-B/tgpJjND1qIZM2WZst+NYnb0notPE6m0J+YOe3NOHXyEmvK38ytxaOsgz4BvrRPQQcNbRrTzSHMPnBkj1fCjg==", "dependencies": { "markdown-table": "^3.0.0", - "mdast-util-to-markdown": "^1.0.0" + "mdast-util-to-markdown": "^1.3.0" }, "funding": { "type": "opencollective", @@ -645,12 +652,12 @@ } }, "node_modules/mdast-util-gfm-task-list-item": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-1.0.0.tgz", - "integrity": "sha512-dwkzOTjQe8JCCHVE3Cb0pLHTYLudf7t9WCAnb20jI8/dW+VHjgWhjtIUVA3oigNkssgjEwX+i+3XesUdCnXGyA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-1.0.1.tgz", + "integrity": "sha512-KZ4KLmPdABXOsfnM6JHUIjxEvcx2ulk656Z/4Balw071/5qgnhz+H1uGtf2zIGnrnvDC8xR4Fj9uKbjAFGNIeA==", "dependencies": { - "@types/mdast": "^3.0.3", - "mdast-util-to-markdown": "^1.0.0" + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" }, "funding": { "type": "opencollective", @@ -670,11 +677,15 @@ } }, "node_modules/mdast-util-mdx-expression": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-1.1.1.tgz", - "integrity": "sha512-RDLRkBFmBKCJl6/fQdxxKL2BqNtoPFoNBmQAlj5ZNKOijIWRKjdhPkeufsUOaexLj+78mhJc+L7d1MYka8/LdQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-1.2.0.tgz", + "integrity": "sha512-wb36oi09XxqO9RVqgfD+xo8a7xaNgS+01+k3v0GKW0X0bYbeBmUZz22Z/IJ8SuphVlG+DNgNo9VoEaUJ3PKfJQ==", "dependencies": { - "@types/estree-jsx": "^0.0.1" + "@types/estree-jsx": "^0.0.1", + "@types/hast": "^2.0.0", + "@types/mdast": "^3.0.0", + "mdast-util-from-markdown": "^1.0.0", + "mdast-util-to-markdown": "^1.0.0" }, "funding": { "type": "opencollective", @@ -682,9 +693,9 @@ } }, "node_modules/mdast-util-to-markdown": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.2.6.tgz", - "integrity": "sha512-doJZmTEGagHypWvJ8ltinmwUsT9ZaNgNIQW6Gl7jNdsI1QZkTHTimYW561Niy2s8AEPAqEgV0dIh2UOVlSXUJA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.3.0.tgz", + "integrity": "sha512-6tUSs4r+KK4JGTTiQ7FfHmVOaDrLQJPmpjD6wPMlHGUVXoG9Vjc3jIeP+uyBWRf8clwB2blM+W7+KrlMYQnftA==", "dependencies": { "@types/mdast": "^3.0.0", "@types/unist": "^2.0.0", @@ -2165,12 +2176,12 @@ } }, "node_modules/resolve": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.1.tgz", - "integrity": "sha512-lfEImVbnolPuaSZuLQ52cAxPBHeI77sPwCOWRdy12UG/CNa8an7oBHH1R+Fp1/mUqSJi4c8TIP6FOIPSZAUrEQ==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", "dev": true, "dependencies": { - "is-core-module": "^2.8.0", + "is-core-module": "^2.8.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -2182,9 +2193,9 @@ } }, "node_modules/rollup": { - "version": "2.65.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.65.0.tgz", - "integrity": "sha512-ohZVYrhtVMTqqeqH26sngfMiyGDg6gCUReOsoflXvYpzUkDHp8sVG8F9FQxjs72OfnLWpXP2nNNqQ9I0vkRovA==", + "version": "2.67.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.0.tgz", + "integrity": "sha512-W83AaERwvDiHwHEF/dfAfS3z1Be5wf7n+pO3ZAO5IQadCT2lBTr7WQ2MwZZe+nodbD+n3HtC4OCOAdsOPPcKZQ==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -2689,6 +2700,14 @@ "@types/estree": "*" } }, + "@types/hast": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz", + "integrity": "sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==", + "requires": { + "@types/unist": "*" + } + }, "@types/mdast": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz", @@ -2703,9 +2722,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "@types/node": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz", - "integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==", + "version": "17.0.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.15.tgz", + "integrity": "sha512-zWt4SDDv1S9WRBNxLFxFRHxdD9tvH8f5/kg5/IaLFdnSNXsDY4eL3Q3XXN+VxUnWIhyVFDwcsmAprvwXoM/ClA==", "dev": true }, "@types/resolve": { @@ -3053,41 +3072,40 @@ } }, "mdast-util-gfm-footnote": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-1.0.0.tgz", - "integrity": "sha512-qeg9YoS2YYP6OBmMyUFxKXb6BLwAsbGidIxgwDAXHIMYZQhIwe52L9BSJs+zP29Jp5nSERPkmG3tSwAN23/ZbQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-1.0.1.tgz", + "integrity": "sha512-p+PrYlkw9DeCRkTVw1duWqPRHX6Ywh2BNKJQcZbCwAuP/59B0Lk9kakuAd7KbQprVO4GzdW8eS5++A9PUSqIyw==", "requires": { "@types/mdast": "^3.0.0", - "mdast-util-to-markdown": "^1.0.0", - "micromark-util-normalize-identifier": "^1.0.0", - "unist-util-visit": "^4.0.0" + "mdast-util-to-markdown": "^1.3.0", + "micromark-util-normalize-identifier": "^1.0.0" } }, "mdast-util-gfm-strikethrough": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-1.0.0.tgz", - "integrity": "sha512-gM9ipBUdRxYa6Yq1Hd8Otg6jEn/dRxFZ1F9ZX4QHosHOexLGqNZO2dh0A+YFbUEd10RcKjnjb4jOfJJzoXXUew==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-1.0.1.tgz", + "integrity": "sha512-zKJbEPe+JP6EUv0mZ0tQUyLQOC+FADt0bARldONot/nefuISkaZFlmVK4tU6JgfyZGrky02m/I6PmehgAgZgqg==", "requires": { - "@types/mdast": "^3.0.3", - "mdast-util-to-markdown": "^1.0.0" + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" } }, "mdast-util-gfm-table": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-1.0.2.tgz", - "integrity": "sha512-pPekvCTChFBF8uCq8bVyQwar8NBU/TaXIy44jj/UzmjMgPBHIa1B1ge8a0JVgzhqgXQAMvGT+PgiKlicdLGfDQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-1.0.3.tgz", + "integrity": "sha512-B/tgpJjND1qIZM2WZst+NYnb0notPE6m0J+YOe3NOHXyEmvK38ytxaOsgz4BvrRPQQcNbRrTzSHMPnBkj1fCjg==", "requires": { "markdown-table": "^3.0.0", - "mdast-util-to-markdown": "^1.0.0" + "mdast-util-to-markdown": "^1.3.0" } }, "mdast-util-gfm-task-list-item": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-1.0.0.tgz", - "integrity": "sha512-dwkzOTjQe8JCCHVE3Cb0pLHTYLudf7t9WCAnb20jI8/dW+VHjgWhjtIUVA3oigNkssgjEwX+i+3XesUdCnXGyA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-1.0.1.tgz", + "integrity": "sha512-KZ4KLmPdABXOsfnM6JHUIjxEvcx2ulk656Z/4Balw071/5qgnhz+H1uGtf2zIGnrnvDC8xR4Fj9uKbjAFGNIeA==", "requires": { - "@types/mdast": "^3.0.3", - "mdast-util-to-markdown": "^1.0.0" + "@types/mdast": "^3.0.0", + "mdast-util-to-markdown": "^1.3.0" } }, "mdast-util-heading-style": { @@ -3099,17 +3117,21 @@ } }, "mdast-util-mdx-expression": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-1.1.1.tgz", - "integrity": "sha512-RDLRkBFmBKCJl6/fQdxxKL2BqNtoPFoNBmQAlj5ZNKOijIWRKjdhPkeufsUOaexLj+78mhJc+L7d1MYka8/LdQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-1.2.0.tgz", + "integrity": "sha512-wb36oi09XxqO9RVqgfD+xo8a7xaNgS+01+k3v0GKW0X0bYbeBmUZz22Z/IJ8SuphVlG+DNgNo9VoEaUJ3PKfJQ==", "requires": { - "@types/estree-jsx": "^0.0.1" + "@types/estree-jsx": "^0.0.1", + "@types/hast": "^2.0.0", + "@types/mdast": "^3.0.0", + "mdast-util-from-markdown": "^1.0.0", + "mdast-util-to-markdown": "^1.0.0" } }, "mdast-util-to-markdown": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.2.6.tgz", - "integrity": "sha512-doJZmTEGagHypWvJ8ltinmwUsT9ZaNgNIQW6Gl7jNdsI1QZkTHTimYW561Niy2s8AEPAqEgV0dIh2UOVlSXUJA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-1.3.0.tgz", + "integrity": "sha512-6tUSs4r+KK4JGTTiQ7FfHmVOaDrLQJPmpjD6wPMlHGUVXoG9Vjc3jIeP+uyBWRf8clwB2blM+W7+KrlMYQnftA==", "requires": { "@types/mdast": "^3.0.0", "@types/unist": "^2.0.0", @@ -4134,20 +4156,20 @@ } }, "resolve": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.1.tgz", - "integrity": "sha512-lfEImVbnolPuaSZuLQ52cAxPBHeI77sPwCOWRdy12UG/CNa8an7oBHH1R+Fp1/mUqSJi4c8TIP6FOIPSZAUrEQ==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", "dev": true, "requires": { - "is-core-module": "^2.8.0", + "is-core-module": "^2.8.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } }, "rollup": { - "version": "2.65.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.65.0.tgz", - "integrity": "sha512-ohZVYrhtVMTqqeqH26sngfMiyGDg6gCUReOsoflXvYpzUkDHp8sVG8F9FQxjs72OfnLWpXP2nNNqQ9I0vkRovA==", + "version": "2.67.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.67.0.tgz", + "integrity": "sha512-W83AaERwvDiHwHEF/dfAfS3z1Be5wf7n+pO3ZAO5IQadCT2lBTr7WQ2MwZZe+nodbD+n3HtC4OCOAdsOPPcKZQ==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/tools/lint-md/package.json b/tools/lint-md/package.json index c21df37fe24ebb..5f95fbe1abf6ed 100644 --- a/tools/lint-md/package.json +++ b/tools/lint-md/package.json @@ -16,7 +16,7 @@ "devDependencies": { "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-node-resolve": "^13.1.3", - "rollup": "^2.65.0", + "rollup": "^2.67.0", "rollup-plugin-cleanup": "^3.2.1" } }