Home / Function/ to_public_ast() — svelte Function Reference

to_public_ast() — svelte Function Reference

Architecture documentation for the to_public_ast() function in index.js from the svelte codebase.

Function javascript Compiler Migrator calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  6cb14a69_7fad_9de7_91fa_6dfba0162df4["to_public_ast()"]
  cc8de3ad_4bae_f883_44db_d90442053943["index.js"]
  6cb14a69_7fad_9de7_91fa_6dfba0162df4 -->|defined in| cc8de3ad_4bae_f883_44db_d90442053943
  10e19602_80ed_a1f9_ddcc_2ac1ab16e385["compile()"]
  10e19602_80ed_a1f9_ddcc_2ac1ab16e385 -->|calls| 6cb14a69_7fad_9de7_91fa_6dfba0162df4
  9d70f1de_0c86_06c9_b157_fa44882a3823["parse()"]
  9d70f1de_0c86_06c9_b157_fa44882a3823 -->|calls| 6cb14a69_7fad_9de7_91fa_6dfba0162df4
  739544c3_ed59_a35e_6bea_b1b4d2b50e81["convert()"]
  6cb14a69_7fad_9de7_91fa_6dfba0162df4 -->|calls| 739544c3_ed59_a35e_6bea_b1b4d2b50e81
  style 6cb14a69_7fad_9de7_91fa_6dfba0162df4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/index.js lines 150–174

function to_public_ast(source, ast, modern) {
	if (modern) {
		const clean = (/** @type {any} */ node) => {
			delete node.metadata;
		};

		ast.options?.attributes.forEach((attribute) => {
			clean(attribute);
			clean(attribute.value);
			if (Array.isArray(attribute.value)) {
				attribute.value.forEach(clean);
			}
		});

		// remove things that we don't want to treat as public API
		return zimmerframe_walk(ast, null, {
			_(node, { next }) {
				clean(node);
				next();
			}
		});
	}

	return convert(source, ast);
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does to_public_ast() do?
to_public_ast() is a function in the svelte codebase, defined in packages/svelte/src/compiler/index.js.
Where is to_public_ast() defined?
to_public_ast() is defined in packages/svelte/src/compiler/index.js at line 150.
What does to_public_ast() call?
to_public_ast() calls 1 function(s): convert.
What calls to_public_ast()?
to_public_ast() is called by 2 function(s): compile, parse.

Analyze Your Own Codebase

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

Try Supermodel Free