Home / Function/ getEntryModuleBaseInfo() — astro Function Reference

getEntryModuleBaseInfo() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  d4749634_d021_a687_4265_4885c1ed7b3f["getEntryModuleBaseInfo()"]
  157f6669_1b64_2b6d_ca39_b0f784c87ad2["vite-plugin-content-imports.ts"]
  d4749634_d021_a687_4265_4885c1ed7b3f -->|defined in| 157f6669_1b64_2b6d_ca39_b0f784c87ad2
  faee72c2_19cd_965a_76d9_c12bcc678122["getContentEntryModule()"]
  faee72c2_19cd_965a_76d9_c12bcc678122 -->|calls| d4749634_d021_a687_4265_4885c1ed7b3f
  680890c8_1665_e25c_7957_e9303be73454["getDataEntryModule()"]
  680890c8_1665_e25c_7957_e9303be73454 -->|calls| d4749634_d021_a687_4265_4885c1ed7b3f
  0899dca1_e80f_b4eb_f265_f15653c8fa77["getContentConfigFromGlobal()"]
  d4749634_d021_a687_4265_4885c1ed7b3f -->|calls| 0899dca1_e80f_b4eb_f265_f15653c8fa77
  style d4749634_d021_a687_4265_4885c1ed7b3f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/vite-plugin-content-imports.ts lines 326–367

async function getEntryModuleBaseInfo<TEntryType extends ContentEntryType | DataEntryType>({
	fileId,
	entryConfigByExt,
	contentDir,
	fs,
}: GetEntryModuleParams<TEntryType>) {
	const contentConfig = await getContentConfigFromGlobal();
	let rawContents;
	try {
		rawContents = await fs.promises.readFile(fileId, 'utf-8');
	} catch (e) {
		throw new AstroError({
			...AstroErrorData.UnknownContentCollectionError,
			message: `Unexpected error reading entry ${JSON.stringify(fileId)}.`,
			stack: e instanceof Error ? e.stack : undefined,
		});
	}
	const fileExt = extname(fileId);
	const entryConfig = entryConfigByExt.get(fileExt);

	if (!entryConfig) {
		throw new AstroError({
			...AstroErrorData.UnknownContentCollectionError,
			message: `No parser found for data entry ${JSON.stringify(
				fileId,
			)}. Did you apply an integration for this file type?`,
		});
	}
	const entry = pathToFileURL(fileId);
	const collection = getEntryCollectionName({ entry, contentDir });
	if (collection === undefined) throw new AstroError(AstroErrorData.UnknownContentCollectionError);

	const collectionConfig = contentConfig?.collections[collection];

	return {
		collectionConfig,
		entry,
		entryConfig,
		collection,
		rawContents,
	};
}

Subdomains

Frequently Asked Questions

What does getEntryModuleBaseInfo() do?
getEntryModuleBaseInfo() is a function in the astro codebase, defined in packages/astro/src/content/vite-plugin-content-imports.ts.
Where is getEntryModuleBaseInfo() defined?
getEntryModuleBaseInfo() is defined in packages/astro/src/content/vite-plugin-content-imports.ts at line 326.
What does getEntryModuleBaseInfo() call?
getEntryModuleBaseInfo() calls 1 function(s): getContentConfigFromGlobal.
What calls getEntryModuleBaseInfo()?
getEntryModuleBaseInfo() is called by 2 function(s): getContentEntryModule, getDataEntryModule.

Analyze Your Own Codebase

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

Try Supermodel Free