Home / Function/ stringifyEntryData() — astro Function Reference

stringifyEntryData() — astro Function Reference

Architecture documentation for the stringifyEntryData() function in vite-plugin-content-imports.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  4e091873_0693_5420_b2f8_6752dc3df051["stringifyEntryData()"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2["vite-plugin-content-imports.ts"]
  4e091873_0693_5420_b2f8_6752dc3df051 -->|defined in| 157f6669_1b64_2b6d_ca39_b0f784c87ad2
  06cd4177_9728_08c0_fa43_2385e28cbaf4["astroContentImportPlugin()"]
  06cd4177_9728_08c0_fa43_2385e28cbaf4 -->|calls| 4e091873_0693_5420_b2f8_6752dc3df051
  style 4e091873_0693_5420_b2f8_6752dc3df051 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/vite-plugin-content-imports.ts lines 407–436

function stringifyEntryData(data: Record<string, any>, isSSR: boolean): string {
	try {
		return devalue.uneval(data, (value) => {
			// Add support for URL objects
			if (value instanceof URL) {
				return `new URL(${JSON.stringify(value.href)})`;
			}

			// For Astro assets, add a proxy to track references
			if (typeof value === 'object' && 'ASTRO_ASSET' in value) {
				const { ASTRO_ASSET, ...asset } = value;
				asset.fsPath = ASTRO_ASSET;
				return getProxyCode(asset, isSSR);
			}
		});
	} catch (e) {
		if (e instanceof Error) {
			throw new AstroError({
				...AstroErrorData.UnsupportedConfigTransformError,
				message: AstroErrorData.UnsupportedConfigTransformError.message(e.message),
				stack: e.stack,
			});
		} else {
			throw new AstroError({
				name: 'PluginContentImportsError',
				message: 'Unexpected error processing content collection data.',
			});
		}
	}
}

Subdomains

Frequently Asked Questions

What does stringifyEntryData() do?
stringifyEntryData() is a function in the astro codebase, defined in packages/astro/src/content/vite-plugin-content-imports.ts.
Where is stringifyEntryData() defined?
stringifyEntryData() is defined in packages/astro/src/content/vite-plugin-content-imports.ts at line 407.
What calls stringifyEntryData()?
stringifyEntryData() is called by 1 function(s): astroContentImportPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free