Home / Function/ viaLocal() — astro Function Reference

viaLocal() — astro Function Reference

Architecture documentation for the viaLocal() function in sirv.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  2025ed08_2d85_c00f_dfd5_7481eefc2824["viaLocal()"]
  afcb3082_013d_93cb_836e_f55956dc999b["sirv.ts"]
  2025ed08_2d85_c00f_dfd5_7481eefc2824 -->|defined in| afcb3082_013d_93cb_836e_f55956dc999b
  1988aca8_00d4_47ff_55c9_ecfe8b26f04a["toAssume()"]
  2025ed08_2d85_c00f_dfd5_7481eefc2824 -->|calls| 1988aca8_00d4_47ff_55c9_ecfe8b26f04a
  fcc6f6e1_b00f_7d7d_a9ee_5a33a05d47bf["toHeaders()"]
  2025ed08_2d85_c00f_dfd5_7481eefc2824 -->|calls| fcc6f6e1_b00f_7d7d_a9ee_5a33a05d47bf
  style 2025ed08_2d85_c00f_dfd5_7481eefc2824 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/partytown/src/sirv.ts lines 76–90

function viaLocal(dir, isEtag, uri, extns) {
	let i = 0,
		arr = toAssume(uri, extns);
	let abs, stats, name, headers;
	for (; i < arr.length; i++) {
		abs = normalize(join(dir, (name = arr[i])));
		if (abs.startsWith(dir) && fs.existsSync(abs)) {
			stats = fs.statSync(abs);
			if (stats.isDirectory()) continue;
			headers = toHeaders(name, stats, isEtag);
			headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store';
			return { abs, stats, headers };
		}
	}
}

Domain

Subdomains

Frequently Asked Questions

What does viaLocal() do?
viaLocal() is a function in the astro codebase, defined in packages/integrations/partytown/src/sirv.ts.
Where is viaLocal() defined?
viaLocal() is defined in packages/integrations/partytown/src/sirv.ts at line 76.
What does viaLocal() call?
viaLocal() calls 2 function(s): toAssume, toHeaders.

Analyze Your Own Codebase

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

Try Supermodel Free