Home / Function/ jsToTreeNode() — astro Function Reference

jsToTreeNode() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c8386be4_3c7e_7792_4b35_f425f56f414b["jsToTreeNode()"]
  579be117_6aa8_f4e4_0e48_c4a41ab4204a["utils.ts"]
  c8386be4_3c7e_7792_4b35_f425f56f414b -->|defined in| 579be117_6aa8_f4e4_0e48_c4a41ab4204a
  style c8386be4_3c7e_7792_4b35_f425f56f414b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/mdx/src/utils.ts lines 67–86

export function jsToTreeNode(
	jsString: string,
	acornOpts: AcornOpts = {
		ecmaVersion: 'latest',
		sourceType: 'module',
	},
): MdxjsEsm {
	return {
		type: 'mdxjsEsm',
		value: '',
		data: {
			// @ts-expect-error `parse` return types is incompatible but it should work in runtime
			estree: {
				...parse(jsString, acornOpts),
				type: 'Program',
				sourceType: 'module',
			},
		},
	};
}

Domain

Subdomains

Frequently Asked Questions

What does jsToTreeNode() do?
jsToTreeNode() is a function in the astro codebase, defined in packages/integrations/mdx/src/utils.ts.
Where is jsToTreeNode() defined?
jsToTreeNode() is defined in packages/integrations/mdx/src/utils.ts at line 67.

Analyze Your Own Codebase

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

Try Supermodel Free