Home / Function/ extract_svelte_ignore() — svelte Function Reference

extract_svelte_ignore() — svelte Function Reference

Architecture documentation for the extract_svelte_ignore() function in extract_svelte_ignore.js from the svelte codebase.

Function javascript Compiler Transformer calls 3 called by 3

Entity Profile

Dependency Diagram

graph TD
  4422a3ac_4abf_f704_22f3_7d5d175ce307["extract_svelte_ignore()"]
  d1869e84_a713_3c60_3aae_40e1a6b78424["extract_svelte_ignore.js"]
  4422a3ac_4abf_f704_22f3_7d5d175ce307 -->|defined in| d1869e84_a713_3c60_3aae_40e1a6b78424
  739544c3_ed59_a35e_6bea_b1b4d2b50e81["convert()"]
  739544c3_ed59_a35e_6bea_b1b4d2b50e81 -->|calls| 4422a3ac_4abf_f704_22f3_7d5d175ce307
  78a6ba9a_5003_f569_a638_76e4f1977809["analyze_component()"]
  78a6ba9a_5003_f569_a638_76e4f1977809 -->|calls| 4422a3ac_4abf_f704_22f3_7d5d175ce307
  e511a3c6_68c7_d02e_710d_edc19c11b9e3["Text()"]
  e511a3c6_68c7_d02e_710d_edc19c11b9e3 -->|calls| 4422a3ac_4abf_f704_22f3_7d5d175ce307
  b9e65a4f_7928_feaf_dd47_8ada06ddcd1a["legacy_code()"]
  4422a3ac_4abf_f704_22f3_7d5d175ce307 -->|calls| b9e65a4f_7928_feaf_dd47_8ada06ddcd1a
  0913e53f_3cfc_070a_7b42_568cf6860af3["fuzzymatch()"]
  4422a3ac_4abf_f704_22f3_7d5d175ce307 -->|calls| 0913e53f_3cfc_070a_7b42_568cf6860af3
  e0bd3be9_7853_8f1c_d76d_85096252ba85["unknown_code()"]
  4422a3ac_4abf_f704_22f3_7d5d175ce307 -->|calls| e0bd3be9_7853_8f1c_d76d_85096252ba85
  style 4422a3ac_4abf_f704_22f3_7d5d175ce307 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/utils/extract_svelte_ignore.js lines 28–82

export function extract_svelte_ignore(offset, text, runes) {
	const match = regex_svelte_ignore.exec(text);
	if (!match) return [];

	let length = match[0].length;
	offset += length;

	/** @type {string[]} */
	const ignores = [];

	if (runes) {
		// Warnings have to be separated by commas, everything after is interpreted as prose
		for (const match of text.slice(length).matchAll(/([\w$-]+)(,)?/gm)) {
			const code = match[1];

			if (codes.includes(code)) {
				ignores.push(code);
			} else {
				const replacement = replacements[code] ?? code.replace(/-/g, '_');

				// The type cast is for some reason necessary to pass the type check in CI
				const start = offset + /** @type {number} */ (match.index);
				const end = start + code.length;

				if (codes.includes(replacement)) {
					w.legacy_code({ start, end }, code, replacement);
				} else {
					const suggestion = fuzzymatch(code, codes);
					w.unknown_code({ start, end }, code, suggestion);
				}
			}

			if (!match[2]) {
				break;
			}
		}
	} else {
		// Non-runes mode: lax parsing, backwards compat with old codes
		for (const match of text.slice(length).matchAll(/[\w$-]+/gm)) {
			const code = match[0];

			ignores.push(code);

			if (!codes.includes(code)) {
				const replacement = replacements[code] ?? code.replace(/-/g, '_');

				if (codes.includes(replacement)) {
					ignores.push(replacement);
				}
			}
		}
	}

	return ignores;
}

Domain

Subdomains

Frequently Asked Questions

What does extract_svelte_ignore() do?
extract_svelte_ignore() is a function in the svelte codebase, defined in packages/svelte/src/compiler/utils/extract_svelte_ignore.js.
Where is extract_svelte_ignore() defined?
extract_svelte_ignore() is defined in packages/svelte/src/compiler/utils/extract_svelte_ignore.js at line 28.
What does extract_svelte_ignore() call?
extract_svelte_ignore() calls 3 function(s): fuzzymatch, legacy_code, unknown_code.
What calls extract_svelte_ignore()?
extract_svelte_ignore() is called by 3 function(s): Text, analyze_component, convert.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free