Skip to content

Commit

Permalink
tools: update lint-md-dependencies to @rollup/plugin-node-resolve@15.0.2
Browse files Browse the repository at this point in the history
PR-URL: #47431
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
  • Loading branch information
nodejs-github-bot authored and RafaelGSS committed Apr 13, 2023
1 parent 26b2584 commit b1f2ff1
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 119 deletions.
188 changes: 94 additions & 94 deletions tools/lint-md/lint-md.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -738,28 +738,39 @@ function looksLikeAVFileValue(value) {
return typeof value === 'string' || isBuffer(value)
}

const emptyOptions = {};
function toString(value, options) {
const includeImageAlt = (options || {}).includeImageAlt;
return one(
value,
typeof includeImageAlt === 'boolean' ? includeImageAlt : true
)
const settings = options || emptyOptions;
const includeImageAlt =
typeof settings.includeImageAlt === 'boolean'
? settings.includeImageAlt
: true;
const includeHtml =
typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true;
return one(value, includeImageAlt, includeHtml)
}
function one(value, includeImageAlt) {
return (
(node(value) &&
(('value' in value && value.value) ||
(includeImageAlt && 'alt' in value && value.alt) ||
('children' in value && all(value.children, includeImageAlt)))) ||
(Array.isArray(value) && all(value, includeImageAlt)) ||
''
)
function one(value, includeImageAlt, includeHtml) {
if (node(value)) {
if ('value' in value) {
return value.type === 'html' && !includeHtml ? '' : value.value
}
if (includeImageAlt && 'alt' in value && value.alt) {
return value.alt
}
if ('children' in value) {
return all(value.children, includeImageAlt, includeHtml)
}
}
if (Array.isArray(value)) {
return all(value, includeImageAlt, includeHtml)
}
return ''
}
function all(values, includeImageAlt) {
function all(values, includeImageAlt, includeHtml) {
const result = [];
let index = -1;
while (++index < values.length) {
result[index] = one(values[index], includeImageAlt);
result[index] = one(values[index], includeImageAlt, includeHtml);
}
return result.join('')
}
Expand Down Expand Up @@ -9827,7 +9838,7 @@ function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
end: self.now()
})
);
if (id.charCodeAt(0) !== 94 || !defined.includes(id.slice(1))) {
if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
return nok(code)
}
effects.enter('gfmFootnoteCallLabelMarker');
Expand Down Expand Up @@ -9915,24 +9926,32 @@ function tokenizeGfmFootnoteCall(effects, ok, nok) {
return callData
}
function callData(code) {
let token;
if (code === null || code === 91 || size++ > 999) {
if (
size > 999 ||
(code === 93 && !data) ||
code === null ||
code === 91 ||
markdownLineEndingOrSpace(code)
) {
return nok(code)
}
if (code === 93) {
if (!data) {
effects.exit('chunkString');
const token = effects.exit('gfmFootnoteCallString');
if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
return nok(code)
}
effects.exit('chunkString');
token = effects.exit('gfmFootnoteCallString');
return defined.includes(normalizeIdentifier(self.sliceSerialize(token)))
? end(code)
: nok(code)
effects.enter('gfmFootnoteCallLabelMarker');
effects.consume(code);
effects.exit('gfmFootnoteCallLabelMarker');
effects.exit('gfmFootnoteCall');
return ok
}
effects.consume(code);
if (!markdownLineEndingOrSpace(code)) {
data = true;
}
size++;
effects.consume(code);
return code === 92 ? callEscape : callData
}
function callEscape(code) {
Expand All @@ -9943,13 +9962,6 @@ function tokenizeGfmFootnoteCall(effects, ok, nok) {
}
return callData(code)
}
function end(code) {
effects.enter('gfmFootnoteCallLabelMarker');
effects.consume(code);
effects.exit('gfmFootnoteCallLabelMarker');
effects.exit('gfmFootnoteCall');
return ok
}
}
function tokenizeDefinitionStart(effects, ok, nok) {
const self = this;
Expand All @@ -9964,84 +9976,71 @@ function tokenizeDefinitionStart(effects, ok, nok) {
effects.enter('gfmFootnoteDefinitionLabelMarker');
effects.consume(code);
effects.exit('gfmFootnoteDefinitionLabelMarker');
return labelStart
return labelAtMarker
}
function labelStart(code) {
function labelAtMarker(code) {
if (code === 94) {
effects.enter('gfmFootnoteDefinitionMarker');
effects.consume(code);
effects.exit('gfmFootnoteDefinitionMarker');
effects.enter('gfmFootnoteDefinitionLabelString');
return atBreak
effects.enter('chunkString').contentType = 'string';
return labelInside
}
return nok(code)
}
function atBreak(code) {
let token;
if (code === null || code === 91 || size > 999) {
function labelInside(code) {
if (
size > 999 ||
(code === 93 && !data) ||
code === null ||
code === 91 ||
markdownLineEndingOrSpace(code)
) {
return nok(code)
}
if (code === 93) {
if (!data) {
return nok(code)
}
token = effects.exit('gfmFootnoteDefinitionLabelString');
effects.exit('chunkString');
const token = effects.exit('gfmFootnoteDefinitionLabelString');
identifier = normalizeIdentifier(self.sliceSerialize(token));
effects.enter('gfmFootnoteDefinitionLabelMarker');
effects.consume(code);
effects.exit('gfmFootnoteDefinitionLabelMarker');
effects.exit('gfmFootnoteDefinitionLabel');
return labelAfter
}
if (markdownLineEnding(code)) {
effects.enter('lineEnding');
effects.consume(code);
effects.exit('lineEnding');
size++;
return atBreak
}
effects.enter('chunkString').contentType = 'string';
return label(code)
}
function label(code) {
if (
code === null ||
markdownLineEnding(code) ||
code === 91 ||
code === 93 ||
size > 999
) {
effects.exit('chunkString');
return atBreak(code)
}
if (!markdownLineEndingOrSpace(code)) {
data = true;
}
size++;
effects.consume(code);
return code === 92 ? labelEscape : label
return code === 92 ? labelEscape : labelInside
}
function labelEscape(code) {
if (code === 91 || code === 92 || code === 93) {
effects.consume(code);
size++;
return label
return labelInside
}
return label(code)
return labelInside(code)
}
function labelAfter(code) {
if (code === 58) {
effects.enter('definitionMarker');
effects.consume(code);
effects.exit('definitionMarker');
return factorySpace(effects, done, 'gfmFootnoteDefinitionWhitespace')
if (!defined.includes(identifier)) {
defined.push(identifier);
}
return factorySpace(
effects,
whitespaceAfter,
'gfmFootnoteDefinitionWhitespace'
)
}
return nok(code)
}
function done(code) {
if (!defined.includes(identifier)) {
defined.push(identifier);
}
function whitespaceAfter(code) {
return ok(code)
}
}
Expand Down Expand Up @@ -10069,8 +10068,9 @@ function tokenizeIndent(effects, ok, nok) {
}
}

function gfmStrikethrough(options = {}) {
let single = options.singleTilde;
function gfmStrikethrough(options) {
const options_ = options || {};
let single = options_.singleTilde;
const tokenizer = {
tokenize: tokenizeStrikethrough,
resolveAll: resolveAllStrikethrough
Expand Down Expand Up @@ -10124,16 +10124,15 @@ function gfmStrikethrough(options = {}) {
['exit', events[open][1], context],
['enter', text, context]
];
splice(
nextEvents,
nextEvents.length,
0,
resolveAll(
context.parser.constructs.insideSpan.null,
events.slice(open + 1, index),
context
)
);
const insideSpan = context.parser.constructs.insideSpan.null;
if (insideSpan) {
splice(
nextEvents,
nextEvents.length,
0,
resolveAll(insideSpan, events.slice(open + 1, index), context)
);
}
splice(nextEvents, nextEvents.length, 0, [
['exit', text, context],
['enter', events[index][1], context],
Expand Down Expand Up @@ -10673,29 +10672,30 @@ function tokenizeTasklistCheck(effects, ok, nok) {
effects.consume(code);
effects.exit('taskListCheckMarker');
effects.exit('taskListCheck');
return after
}
return nok(code)
}
function after(code) {
if (markdownLineEnding(code)) {
return ok(code)
}
if (markdownSpace(code)) {
return effects.check(
{
tokenize: spaceThenNonSpace
},
ok,
nok
)
)(code)
}
return nok(code)
}
}
function spaceThenNonSpace(effects, ok, nok) {
const self = this;
return factorySpace(effects, after, 'whitespace')
function after(code) {
const tail = self.events[self.events.length - 1];
return (
((tail && tail[1].type === 'whitespace') ||
markdownLineEnding(code)) &&
code !== null
? ok(code)
: nok(code)
)
return code === null ? nok(code) : ok(code)
}
}

Expand Down
Loading

0 comments on commit b1f2ff1

Please sign in to comment.