Skip to content

Commit

Permalink
tools: update lint-md-dependencies to rollup@2.60.1
Browse files Browse the repository at this point in the history
PR-URL: #40929
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
nodejs-github-bot authored and Trott committed Nov 23, 2021
1 parent bb3ff81 commit d9de812
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2,701 deletions.
36 changes: 23 additions & 13 deletions tools/lint-md/lint-md.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5236,8 +5236,7 @@ const own$6 = {}.hasOwnProperty;
* @returns {string|false}
* Decoded reference.
*/
function decodeEntity(value) {
// @ts-expect-error: to do: use `Record` for `character-entities`.
function decodeNamedCharacterReference(value) {
return own$6.call(characterEntities, value) ? characterEntities[value] : false
}

Expand Down Expand Up @@ -5319,7 +5318,7 @@ function tokenizeCharacterReference(effects, ok, nok) {

if (
test === asciiAlphanumeric &&
!decodeEntity(self.sliceSerialize(token))
!decodeNamedCharacterReference(self.sliceSerialize(token))
) {
return nok(code)
}
Expand Down Expand Up @@ -10185,7 +10184,7 @@ function decode($0, $1, $2) {
return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)
}

return decodeEntity($2) || $0
return decodeNamedCharacterReference($2) || $0
}

/**
Expand Down Expand Up @@ -10680,7 +10679,7 @@ function compiler(options = {}) {
* @this {CompileContext}
* @param {N} node
* @param {Token} token
* @param {OnError} [errorHandler]
* @param {OnEnterError} [errorHandler]
* @returns {N}
*/

Expand Down Expand Up @@ -10714,9 +10713,15 @@ function compiler(options = {}) {
exit.call(this, token);
}
}
/** @type {CompileContext['exit']} */
/**
* @type {CompileContext['exit']}
* @this {CompileContext}
* @param {Token} token
* @param {OnExitError} [onExitError]
* @returns {Node}
*/

function exit(token) {
function exit(token, onExitError) {
const node = this.stack.pop();
const open = this.tokenStack.pop();

Expand All @@ -10732,8 +10737,12 @@ function compiler(options = {}) {
'): it’s not open'
)
} else if (open[0].type !== token.type) {
const handler = open[1] || defaultOnError;
handler.call(this, token, open[0]);
if (onExitError) {
onExitError.call(this, token, open[0]);
} else {
const handler = open[1] || defaultOnError;
handler.call(this, token, open[0]);
}
}

node.position.end = point(token.end);
Expand Down Expand Up @@ -11093,9 +11102,10 @@ function compiler(options = {}) {
);
setData('characterReferenceType');
} else {
// @ts-expect-error `decodeEntity` can return false for invalid named
// character references, but everything we’ve tokenized is valid.
value = decodeEntity(data);
// @ts-expect-error `decodeNamedCharacterReference` can return false for
// invalid named character references, but everything we’ve tokenized is
// valid.
value = decodeNamedCharacterReference(data);
}

const tail = this.stack.pop();
Expand Down Expand Up @@ -11325,7 +11335,7 @@ function extension(combined, extension) {
}
}
}
/** @type {OnError} */
/** @type {OnEnterError} */

function defaultOnError(left, right) {
if (left) {
Expand Down
Loading

0 comments on commit d9de812

Please sign in to comment.