Home / Function/ vitePluginMdxPostprocess() — astro Function Reference

vitePluginMdxPostprocess() — astro Function Reference

Architecture documentation for the vitePluginMdxPostprocess() function in vite-plugin-mdx-postprocess.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  41ea6fc9_a90c_0a26_da48_58217361f433["vitePluginMdxPostprocess()"]
  1d16286a_a608_ecf0_1939_33200eaee4a0["vite-plugin-mdx-postprocess.ts"]
  41ea6fc9_a90c_0a26_da48_58217361f433 -->|defined in| 1d16286a_a608_ecf0_1939_33200eaee4a0
  5fd6f1f4_38c0_593a_0f60_5635d6ac94c7["injectUnderscoreFragmentImport()"]
  41ea6fc9_a90c_0a26_da48_58217361f433 -->|calls| 5fd6f1f4_38c0_593a_0f60_5635d6ac94c7
  62a58fec_847a_8395_f00c_8a6e61053f8e["injectMetadataExports()"]
  41ea6fc9_a90c_0a26_da48_58217361f433 -->|calls| 62a58fec_847a_8395_f00c_8a6e61053f8e
  b77f121d_86c3_57e6_dbc0_088f4a6a6208["transformContentExport()"]
  41ea6fc9_a90c_0a26_da48_58217361f433 -->|calls| b77f121d_86c3_57e6_dbc0_088f4a6a6208
  208f74e4_5dbd_d2b1_4880_e0fe1c61ec8d["annotateContentExport()"]
  41ea6fc9_a90c_0a26_da48_58217361f433 -->|calls| 208f74e4_5dbd_d2b1_4880_e0fe1c61ec8d
  style 41ea6fc9_a90c_0a26_da48_58217361f433 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts lines 15–43

export function vitePluginMdxPostprocess(astroConfig: AstroConfig): Plugin {
	return {
		name: '@astrojs/mdx-postprocess',
		transform: {
			filter: {
				id: /\.mdx$/,
			},
			handler(code, id) {
				const fileInfo = getFileInfo(id, astroConfig);
				const [imports, exports] = parse(code);

				// Call a series of functions that transform the code
				code = injectUnderscoreFragmentImport(code, imports);
				code = injectMetadataExports(code, exports, fileInfo);
				code = transformContentExport(code, exports);
				code = annotateContentExport(
					code,
					id,
					this.environment.name === 'ssr' || this.environment.name === 'prerender',
					imports,
				);

				// The code transformations above are append-only, so the line/column mappings are the same
				// and we can omit the sourcemap for performance.
				return { code, map: null };
			},
		},
	};
}

Domain

Subdomains

Frequently Asked Questions

What does vitePluginMdxPostprocess() do?
vitePluginMdxPostprocess() is a function in the astro codebase, defined in packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts.
Where is vitePluginMdxPostprocess() defined?
vitePluginMdxPostprocess() is defined in packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts at line 15.
What does vitePluginMdxPostprocess() call?
vitePluginMdxPostprocess() calls 4 function(s): annotateContentExport, injectMetadataExports, injectUnderscoreFragmentImport, transformContentExport.

Analyze Your Own Codebase

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

Try Supermodel Free