Home / Function/ detect_project_type() — svelte Function Reference

detect_project_type() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f3cb3b9e_52e3_27fb_9664_3c93ed173c54["detect_project_type()"]
  65d20932_41e6_eeee_7338_5dd0682e5e42["download.js"]
  f3cb3b9e_52e3_27fb_9664_3c93ed173c54 -->|defined in| 65d20932_41e6_eeee_7338_5dd0682e5e42
  2e34f7ff_3d9b_3d31_75ac_8a472947d75a["process_directory()"]
  2e34f7ff_3d9b_3d31_75ac_8a472947d75a -->|calls| f3cb3b9e_52e3_27fb_9664_3c93ed173c54
  style f3cb3b9e_52e3_27fb_9664_3c93ed173c54 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playgrounds/sandbox/scripts/download.js lines 242–262

function detect_project_type(files) {
	let has_app_imports = false;
	let has_page_svelte = false;

	for (const file of files) {
		// Check for $app/* imports
		if (/from\s+['"](\$app\/[^'"]+)['"]/.test(file.contents)) {
			has_app_imports = true;
		}
		// Check for +page.svelte or +layout.svelte
		if (file.name === '+page.svelte' || file.name === '+layout.svelte') {
			has_page_svelte = true;
		}
	}

	return {
		type: has_page_svelte ? 'sveltekit' : 'vite',
		has_app_imports,
		has_page_svelte
	};
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free