Home / Function/ transform_lib_imports() — svelte Function Reference

transform_lib_imports() — svelte Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

playgrounds/sandbox/scripts/download.js lines 283–291

function transform_lib_imports(content) {
	// Replace $lib/ imports with relative paths to flattened files
	return content.replace(/from\s+['"](\$lib\/[^'"]+)['"]/g, (match, import_path) => {
		// Get just the filename from the lib path
		const lib_path = import_path.replace('$lib/', '');
		const filename = path.basename(lib_path);
		return `from './${filename}'`;
	});
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free