Home / Function/ buildMappings() — astro Function Reference

buildMappings() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  83cae376_4307_8290_1999_12a3fa77a3a2["buildMappings()"]
  18a90012_a9fe_857c_0c4e_1491c91fd354["buildMappings.ts"]
  83cae376_4307_8290_1999_12a3fa77a3a2 -->|defined in| 18a90012_a9fe_857c_0c4e_1491c91fd354
  63417ab6_763d_1ad1_771b_10c76ce5a8e7["mergeJSContexts()"]
  63417ab6_763d_1ad1_771b_10c76ce5a8e7 -->|calls| 83cae376_4307_8290_1999_12a3fa77a3a2
  style 83cae376_4307_8290_1999_12a3fa77a3a2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/language-tools/language-server/src/buildMappings.ts lines 4–21

export function buildMappings<T>(chunks: Segment<T>[]) {
	let length = 0;
	const mappings: Mapping<T>[] = [];
	for (const segment of chunks) {
		if (typeof segment === 'string') {
			length += segment.length;
		} else {
			mappings.push({
				sourceOffsets: [segment[2]],
				generatedOffsets: [length],
				lengths: [segment[0].length],
				data: segment[3]!,
			});
			length += segment[0].length;
		}
	}
	return mappings;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does buildMappings() do?
buildMappings() is a function in the astro codebase, defined in packages/language-tools/language-server/src/buildMappings.ts.
Where is buildMappings() defined?
buildMappings() is defined in packages/language-tools/language-server/src/buildMappings.ts at line 4.
What calls buildMappings()?
buildMappings() is called by 1 function(s): mergeJSContexts.

Analyze Your Own Codebase

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

Try Supermodel Free