Home / Function/ transform_layout_content() — svelte Function Reference

transform_layout_content() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0499fbdd_15ce_f4d2_c38f_990a15ec7429["transform_layout_content()"]
  65d20932_41e6_eeee_7338_5dd0682e5e42["download.js"]
  0499fbdd_15ce_f4d2_c38f_990a15ec7429 -->|defined in| 65d20932_41e6_eeee_7338_5dd0682e5e42
  04de3495_cffc_dc6d_e930_d1c6d03a3a34["convert_sveltekit_project()"]
  04de3495_cffc_dc6d_e930_d1c6d03a3a34 -->|calls| 0499fbdd_15ce_f4d2_c38f_990a15ec7429
  style 0499fbdd_15ce_f4d2_c38f_990a15ec7429 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playgrounds/sandbox/scripts/download.js lines 354–372

function transform_layout_content(content, child_component_name) {
	// Add import for the child component at the top of the script
	const import_statement = `import ${child_component_name} from './${child_component_name}.svelte';`;

	// Check if there's already a script tag
	if (/<script[^>]*>/.test(content)) {
		// Add import after the opening script tag
		content = content.replace(/(<script[^>]*>)/, `$1\n\t${import_statement}`);
	} else {
		// Add a new script block at the beginning
		content = `<script>\n\t${import_statement}\n</script>\n\n${content}`;
	}

	// Replace {@render children()} or {@render children?.()} with the component
	content = content.replace(/\{@render\s+children\?\.\(\)\}/g, `<${child_component_name} />`);
	content = content.replace(/\{@render\s+children\(\)\}/g, `<${child_component_name} />`);

	return content;
}

Domain

Subdomains

Frequently Asked Questions

What does transform_layout_content() do?
transform_layout_content() is a function in the svelte codebase, defined in playgrounds/sandbox/scripts/download.js.
Where is transform_layout_content() defined?
transform_layout_content() is defined in playgrounds/sandbox/scripts/download.js at line 354.
What calls transform_layout_content()?
transform_layout_content() is called by 1 function(s): convert_sveltekit_project.

Analyze Your Own Codebase

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

Try Supermodel Free