Home / Function/ compile() — astro Function Reference

compile() — astro Function Reference

Architecture documentation for the compile() function in rehype-optimize-static.test.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  3acdaac3_9487_267c_398d_cd43c95e2e23["compile()"]
  29763700_7244_a511_48c0_47ed43973e4b["rehype-optimize-static.test.js"]
  3acdaac3_9487_267c_398d_cd43c95e2e23 -->|defined in| 29763700_7244_a511_48c0_47ed43973e4b
  e3a99970_a5f5_5b81_143d_4ac9d604cb6d["dedent()"]
  3acdaac3_9487_267c_398d_cd43c95e2e23 -->|calls| e3a99970_a5f5_5b81_143d_4ac9d604cb6d
  style 3acdaac3_9487_267c_398d_cd43c95e2e23 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/mdx/test/units/rehype-optimize-static.test.js lines 10–21

async function compile(mdxCode, options) {
	const result = await _compile(mdxCode, {
		jsx: true,
		rehypePlugins: [rehypeOptimizeStatic],
		...options,
	});
	const code = result.toString();
	// Capture the returned JSX code for testing
	const jsx = /return (.+);\n\}\nexport default function MDXContent/s.exec(code)?.[1];
	if (jsx == null) throw new Error('Could not find JSX code in compiled MDX');
	return dedent(jsx);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does compile() do?
compile() is a function in the astro codebase, defined in packages/integrations/mdx/test/units/rehype-optimize-static.test.js.
Where is compile() defined?
compile() is defined in packages/integrations/mdx/test/units/rehype-optimize-static.test.js at line 10.
What does compile() call?
compile() calls 1 function(s): dedent.

Analyze Your Own Codebase

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

Try Supermodel Free