Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 229x 229x 229x 50x 50x 50x 229x 229x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1171x 1171x 353x 353x 818x 818x 1171x 1342x 1342x 362x 362x 1342x 89x 72x 72x 89x 1342x 456x 456x 456x | import { regex_whitespace } from '../phases/patterns.js';
const regex_svelte_ignore = /^\s*svelte-ignore\s+([\s\S]+)\s*$/m;
/**
* @param {string} text
* @returns {string[]}
*/
export function extract_svelte_ignore(text) {
const match = regex_svelte_ignore.exec(text);
return match
? match[1]
.split(regex_whitespace)
.map(/** @param {any} x */ (x) => x.trim())
.filter(Boolean)
: [];
}
/**
* @template {{ leadingComments?: Array<{ value: string }> }} Node
* @param {Node} node
* @returns {string[]}
*/
export function extract_svelte_ignore_from_comments(node) {
return (node.leadingComments || []).flatMap(
/** @param {any} comment */ (comment) => extract_svelte_ignore(comment.value)
);
}
/**
* @param {import('#compiler').TemplateNode} node
* @param {import('#compiler').TemplateNode[]} template_nodes
* @returns {string[]}
*/
export function extract_ignores_above_position(node, template_nodes) {
const previous_node_idx = template_nodes.indexOf(node) - 1;
if (previous_node_idx < 0) {
return [];
}
const ignores = [];
for (let i = previous_node_idx; i >= 0; i--) {
const node = template_nodes[i];
if (node.type !== 'Comment' && node.type !== 'Text') {
return ignores;
}
if (node.type === 'Comment') {
if (node.ignores.length) {
ignores.push(...node.ignores);
}
}
}
return ignores;
}
|