createImage() — astro Function Reference
Architecture documentation for the createImage() function in runtime-assets.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD aa778089_4837_60e4_d10f_70dffb71daa1["createImage()"] 22462ad0_0c12_680a_37b6_f35d0154b9f5["runtime-assets.ts"] aa778089_4837_60e4_d10f_70dffb71daa1 -->|defined in| 22462ad0_0c12_680a_37b6_f35d0154b9f5 style aa778089_4837_60e4_d10f_70dffb71daa1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/content/runtime-assets.ts lines 7–36
export function createImage(
pluginContext: PluginContext,
shouldEmitFile: boolean,
entryFilePath: string,
) {
return () => {
return z.string().transform(async (imagePath, ctx) => {
const resolvedFilePath = (await pluginContext.resolve(imagePath, entryFilePath))?.id;
const metadata = (await emitImageMetadata(
resolvedFilePath,
shouldEmitFile
? (opts: Parameters<typeof pluginContext.emitFile>[0]) =>
emitClientAsset(pluginContext, opts)
: undefined,
)) as OmitBrand<ImageMetadata>;
if (!metadata) {
ctx.addIssue({
code: 'custom',
message: `Image ${imagePath} does not exist. Is the path correct?`,
fatal: true,
});
return z.never();
}
return { ...metadata, ASTRO_ASSET: metadata.fsPath };
});
};
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does createImage() do?
createImage() is a function in the astro codebase, defined in packages/astro/src/content/runtime-assets.ts.
Where is createImage() defined?
createImage() is defined in packages/astro/src/content/runtime-assets.ts at line 7.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free