Home / Function/ bundleConfigFile() — astro Function Reference

bundleConfigFile() — astro Function Reference

Architecture documentation for the bundleConfigFile() function in load-config.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  5eb19f2d_21b9_7b75_bbda_ae56bac6d11d["bundleConfigFile()"]
  bed767c0_8e7f_8ca6_d8c0_dcaef61ca053["load-config.ts"]
  5eb19f2d_21b9_7b75_bbda_ae56bac6d11d -->|defined in| bed767c0_8e7f_8ca6_d8c0_dcaef61ca053
  3c9d3cab_a608_a786_a49b_6b882154cef7["loadMarkdocConfig()"]
  3c9d3cab_a608_a786_a49b_6b882154cef7 -->|calls| 5eb19f2d_21b9_7b75_bbda_ae56bac6d11d
  style 5eb19f2d_21b9_7b75_bbda_ae56bac6d11d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/markdoc/src/load-config.ts lines 50–98

async function bundleConfigFile({
	markdocConfigUrl,
	astroConfig,
}: {
	markdocConfigUrl: URL;
	astroConfig: Pick<AstroConfig, 'root'>;
}): Promise<{ code: string; dependencies: string[] }> {
	let markdocError: MarkdocError | undefined;

	const result = await esbuild({
		absWorkingDir: fileURLToPath(astroConfig.root),
		entryPoints: [fileURLToPath(markdocConfigUrl)],
		outfile: 'out.js',
		write: false,
		target: ['node16'],
		platform: 'node',
		packages: 'external',
		bundle: true,
		format: 'esm',
		sourcemap: 'inline',
		metafile: true,
		plugins: [
			{
				name: 'stub-astro-imports',
				setup(build) {
					build.onResolve({ filter: /.*\.astro$/ }, () => {
						// Avoid throwing within esbuild.
						// This swallows the `hint` and blows up the stacktrace.
						markdocError = new MarkdocError({
							message: '`.astro` files are no longer supported in the Markdoc config.',
							hint: 'Use the `component()` utility to specify a component path instead. See https://docs.astro.build/en/guides/integrations-guide/markdoc/',
						});
						return {
							// Stub with an unused default export.
							path: 'data:text/javascript,export default true',
							external: true,
						};
					});
				},
			},
		],
	});
	if (markdocError) throw markdocError;
	const { text } = result.outputFiles[0];
	return {
		code: text,
		dependencies: result.metafile ? Object.keys(result.metafile.inputs) : [],
	};
}

Domain

Subdomains

Frequently Asked Questions

What does bundleConfigFile() do?
bundleConfigFile() is a function in the astro codebase, defined in packages/integrations/markdoc/src/load-config.ts.
Where is bundleConfigFile() defined?
bundleConfigFile() is defined in packages/integrations/markdoc/src/load-config.ts at line 50.
What calls bundleConfigFile()?
bundleConfigFile() is called by 1 function(s): loadMarkdocConfig.

Analyze Your Own Codebase

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

Try Supermodel Free