runtime-assets.ts — astro Source File
Architecture documentation for runtime-assets.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 22462ad0_0c12_680a_37b6_f35d0154b9f5["runtime-assets.ts"] 416eda3d_47e6_c298_102b_b7a37d86a44e["../../assets/types.js"] 22462ad0_0c12_680a_37b6_f35d0154b9f5 --> 416eda3d_47e6_c298_102b_b7a37d86a44e db34c5eb_2288_0a98_b3b2_ee3c6260d741["../assets/utils/assets.js"] 22462ad0_0c12_680a_37b6_f35d0154b9f5 --> db34c5eb_2288_0a98_b3b2_ee3c6260d741 81ef02c8_27f0_6101_b479_46ceaa685c4c["../assets/utils/node.js"] 22462ad0_0c12_680a_37b6_f35d0154b9f5 --> 81ef02c8_27f0_6101_b479_46ceaa685c4c 4454efd2_ab89_97b9_11ec_53ebe0d2f5ce["rollup"] 22462ad0_0c12_680a_37b6_f35d0154b9f5 --> 4454efd2_ab89_97b9_11ec_53ebe0d2f5ce f8c9251e_f535_6281_2118_9e79a4155212["v4"] 22462ad0_0c12_680a_37b6_f35d0154b9f5 --> f8c9251e_f535_6281_2118_9e79a4155212 style 22462ad0_0c12_680a_37b6_f35d0154b9f5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { PluginContext } from 'rollup';
import * as z from 'zod/v4';
import type { ImageMetadata, OmitBrand } from '../assets/types.js';
import { emitClientAsset } from '../assets/utils/assets.js';
import { emitImageMetadata } from '../assets/utils/node.js';
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
Functions
Dependencies
- ../../assets/types.js
- ../assets/utils/assets.js
- ../assets/utils/node.js
- rollup
- v4
Source
Frequently Asked Questions
What does runtime-assets.ts do?
runtime-assets.ts is a source file in the astro codebase, written in typescript. It belongs to the ContentCollections domain, DataLoaders subdomain.
What functions are defined in runtime-assets.ts?
runtime-assets.ts defines 1 function(s): createImage.
What does runtime-assets.ts depend on?
runtime-assets.ts imports 5 module(s): ../../assets/types.js, ../assets/utils/assets.js, ../assets/utils/node.js, rollup, v4.
Where is runtime-assets.ts in the architecture?
runtime-assets.ts is located at packages/astro/src/content/runtime-assets.ts (domain: ContentCollections, subdomain: DataLoaders, directory: packages/astro/src/content).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free