0
0
Fork 0
mirror of https://github.com/DavidAnson/markdownlint-cli2-action.git synced 2024-11-24 07:06:23 +01:00

Freshen generated index.js file.

This commit is contained in:
David Anson 2024-06-03 21:27:31 -07:00
parent 4e30c06580
commit e94f7fb325

112
dist/index.js vendored
View file

@ -2778,8 +2778,8 @@ const braces = (input, options = {}) => {
let output = [];
if (Array.isArray(input)) {
for (let pattern of input) {
let result = braces.create(pattern, options);
for (const pattern of input) {
const result = braces.create(pattern, options);
if (Array.isArray(result)) {
output.push(...result);
} else {
@ -2937,30 +2937,32 @@ const fill = __nccwpck_require__(6330);
const utils = __nccwpck_require__(5207);
const compile = (ast, options = {}) => {
let walk = (node, parent = {}) => {
let invalidBlock = utils.isInvalidBrace(parent);
let invalidNode = node.invalid === true && options.escapeInvalid === true;
let invalid = invalidBlock === true || invalidNode === true;
let prefix = options.escapeInvalid === true ? '\\' : '';
const walk = (node, parent = {}) => {
const invalidBlock = utils.isInvalidBrace(parent);
const invalidNode = node.invalid === true && options.escapeInvalid === true;
const invalid = invalidBlock === true || invalidNode === true;
const prefix = options.escapeInvalid === true ? '\\' : '';
let output = '';
if (node.isOpen === true) {
return prefix + node.value;
}
if (node.isClose === true) {
console.log('node.isClose', prefix, node.value);
return prefix + node.value;
}
if (node.type === 'open') {
return invalid ? (prefix + node.value) : '(';
return invalid ? prefix + node.value : '(';
}
if (node.type === 'close') {
return invalid ? (prefix + node.value) : ')';
return invalid ? prefix + node.value : ')';
}
if (node.type === 'comma') {
return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
}
if (node.value) {
@ -2968,8 +2970,8 @@ const compile = (ast, options = {}) => {
}
if (node.nodes && node.ranges > 0) {
let args = utils.reduce(node.nodes);
let range = fill(...args, { ...options, wrap: false, toRegex: true });
const args = utils.reduce(node.nodes);
const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
if (range.length !== 0) {
return args.length > 1 && range.length > 1 ? `(${range})` : range;
@ -2977,10 +2979,11 @@ const compile = (ast, options = {}) => {
}
if (node.nodes) {
for (let child of node.nodes) {
for (const child of node.nodes) {
output += walk(child, node);
}
}
return output;
};
@ -2999,7 +3002,7 @@ module.exports = compile;
module.exports = {
MAX_LENGTH: 1024 * 64,
MAX_LENGTH: 10000,
// Digits
CHAR_0: '0', /* 0 */
@ -3068,7 +3071,7 @@ const stringify = __nccwpck_require__(8750);
const utils = __nccwpck_require__(5207);
const append = (queue = '', stash = '', enclose = false) => {
let result = [];
const result = [];
queue = [].concat(queue);
stash = [].concat(stash);
@ -3078,15 +3081,15 @@ const append = (queue = '', stash = '', enclose = false) => {
return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
}
for (let item of queue) {
for (const item of queue) {
if (Array.isArray(item)) {
for (let value of item) {
for (const value of item) {
result.push(append(value, stash, enclose));
}
} else {
for (let ele of stash) {
if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
}
}
}
@ -3094,9 +3097,9 @@ const append = (queue = '', stash = '', enclose = false) => {
};
const expand = (ast, options = {}) => {
let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
let walk = (node, parent = {}) => {
const walk = (node, parent = {}) => {
node.queue = [];
let p = parent;
@ -3118,7 +3121,7 @@ const expand = (ast, options = {}) => {
}
if (node.nodes && node.ranges > 0) {
let args = utils.reduce(node.nodes);
const args = utils.reduce(node.nodes);
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
@ -3134,7 +3137,7 @@ const expand = (ast, options = {}) => {
return;
}
let enclose = utils.encloseBrace(node);
const enclose = utils.encloseBrace(node);
let queue = node.queue;
let block = node;
@ -3144,7 +3147,7 @@ const expand = (ast, options = {}) => {
}
for (let i = 0; i < node.nodes.length; i++) {
let child = node.nodes[i];
const child = node.nodes[i];
if (child.type === 'comma' && node.type === 'brace') {
if (i === 1) queue.push('');
@ -3217,22 +3220,21 @@ const parse = (input, options = {}) => {
throw new TypeError('Expected a string');
}
let opts = options || {};
let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
const opts = options || {};
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
if (input.length > max) {
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
}
let ast = { type: 'root', input, nodes: [] };
let stack = [ast];
const ast = { type: 'root', input, nodes: [] };
const stack = [ast];
let block = ast;
let prev = ast;
let brackets = 0;
let length = input.length;
const length = input.length;
let index = 0;
let depth = 0;
let value;
let memo = {};
/**
* Helpers
@ -3295,7 +3297,6 @@ const parse = (input, options = {}) => {
if (value === CHAR_LEFT_SQUARE_BRACKET) {
brackets++;
let closed = true;
let next;
while (index < length && (next = advance())) {
@ -3351,7 +3352,7 @@ const parse = (input, options = {}) => {
*/
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
let open = value;
const open = value;
let next;
if (options.keepQuotes !== true) {
@ -3383,8 +3384,8 @@ const parse = (input, options = {}) => {
if (value === CHAR_LEFT_CURLY_BRACE) {
depth++;
let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
let brace = {
const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
const brace = {
type: 'brace',
open: true,
close: false,
@ -3411,7 +3412,7 @@ const parse = (input, options = {}) => {
continue;
}
let type = 'close';
const type = 'close';
block = stack.pop();
block.close = true;
@ -3429,7 +3430,7 @@ const parse = (input, options = {}) => {
if (value === CHAR_COMMA && depth > 0) {
if (block.ranges > 0) {
block.ranges = 0;
let open = block.nodes.shift();
const open = block.nodes.shift();
block.nodes = [open, { type: 'text', value: stringify(block) }];
}
@ -3443,7 +3444,7 @@ const parse = (input, options = {}) => {
*/
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
let siblings = block.nodes;
const siblings = block.nodes;
if (depth === 0 || siblings.length === 0) {
push({ type: 'text', value });
@ -3470,7 +3471,7 @@ const parse = (input, options = {}) => {
if (prev.type === 'range') {
siblings.pop();
let before = siblings[siblings.length - 1];
const before = siblings[siblings.length - 1];
before.value += prev.value + value;
prev = before;
block.ranges--;
@ -3503,8 +3504,8 @@ const parse = (input, options = {}) => {
});
// get the location of the block on parent.nodes (block's siblings)
let parent = stack[stack.length - 1];
let index = parent.nodes.indexOf(block);
const parent = stack[stack.length - 1];
const index = parent.nodes.indexOf(block);
// replace the (invalid) block with it's nodes
parent.nodes.splice(index, 1, ...block.nodes);
}
@ -3528,9 +3529,9 @@ module.exports = parse;
const utils = __nccwpck_require__(5207);
module.exports = (ast, options = {}) => {
let stringify = (node, parent = {}) => {
let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
let invalidNode = node.invalid === true && options.escapeInvalid === true;
const stringify = (node, parent = {}) => {
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
const invalidNode = node.invalid === true && options.escapeInvalid === true;
let output = '';
if (node.value) {
@ -3545,7 +3546,7 @@ module.exports = (ast, options = {}) => {
}
if (node.nodes) {
for (let child of node.nodes) {
for (const child of node.nodes) {
output += stringify(child);
}
}
@ -3596,7 +3597,7 @@ exports.exceedsLimit = (min, max, step = 1, limit) => {
*/
exports.escapeNode = (block, n = 0, type) => {
let node = block.nodes[n];
const node = block.nodes[n];
if (!node) return;
if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
@ -3665,13 +3666,23 @@ exports.reduce = nodes => nodes.reduce((acc, node) => {
exports.flatten = (...args) => {
const result = [];
const flat = arr => {
for (let i = 0; i < arr.length; i++) {
let ele = arr[i];
Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
const ele = arr[i];
if (Array.isArray(ele)) {
flat(ele);
continue;
}
if (ele !== undefined) {
result.push(ele);
}
}
return result;
};
flat(args);
return result;
};
@ -6497,7 +6508,7 @@ const toMaxLen = (input, maxLength) => {
return negative ? ('-' + input) : input;
};
const toSequence = (parts, options) => {
const toSequence = (parts, options, maxLen) => {
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
@ -6507,11 +6518,11 @@ const toSequence = (parts, options) => {
let result;
if (parts.positives.length) {
positives = parts.positives.join('|');
positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|');
}
if (parts.negatives.length) {
negatives = `-(${prefix}${parts.negatives.join('|')})`;
negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`;
}
if (positives && negatives) {
@ -6609,7 +6620,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
if (options.toRegex === true) {
return step > 1
? toSequence(parts, options)
? toSequence(parts, options, maxLen)
: toRegex(range, null, { wrap: false, ...options });
}
@ -6621,7 +6632,6 @@ const fillLetters = (start, end, step = 1, options = {}) => {
return invalidRange(start, end, options);
}
let format = options.transform || (val => String.fromCharCode(val));
let a = `${start}`.charCodeAt(0);
let b = `${end}`.charCodeAt(0);