metadata.ts — astro Source File
Architecture documentation for metadata.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f143fda5_8882_f73d_ef43_7e22c35534a3["metadata.ts"] 32f8c7d4_d66e_e0cf_b019_46ec3f2fea31["../core/module-loader/index.js"] f143fda5_8882_f73d_ef43_7e22c35534a3 --> 32f8c7d4_d66e_e0cf_b019_46ec3f2fea31 f68003f1_292f_ca44_03ce_21af87a33c7b["../core/util.js"] f143fda5_8882_f73d_ef43_7e22c35534a3 --> f68003f1_292f_ca44_03ce_21af87a33c7b 10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"] f143fda5_8882_f73d_ef43_7e22c35534a3 --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05 2273eb38_2cc1_3ab6_58ce_6299d8f2ed92["../vite-plugin-astro/index.js"] f143fda5_8882_f73d_ef43_7e22c35534a3 --> 2273eb38_2cc1_3ab6_58ce_6299d8f2ed92 fde1d0cd_5fc0_0be4_88d8_2707f2b10bc5["./vite.js"] f143fda5_8882_f73d_ef43_7e22c35534a3 --> fde1d0cd_5fc0_0be4_88d8_2707f2b10bc5 style f143fda5_8882_f73d_ef43_7e22c35534a3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/index.js';
import { viteID } from '../core/util.js';
import type { SSRComponentMetadata, SSRResult } from '../types/public/internal.js';
import { getAstroMetadata } from '../vite-plugin-astro/index.js';
import { crawlGraph } from './vite.js';
export async function getComponentMetadata(
filePath: URL,
loader: ModuleLoader,
): Promise<SSRResult['componentMetadata']> {
const map: SSRResult['componentMetadata'] = new Map();
const rootID = viteID(filePath);
addMetadata(map, loader.getModuleInfo(rootID));
for await (const moduleNode of crawlGraph(loader.getSSREnvironment(), rootID, true)) {
const id = moduleNode.id;
if (id) {
addMetadata(map, loader.getModuleInfo(id));
}
}
return map;
}
function addMetadata(map: SSRResult['componentMetadata'], modInfo: ModuleInfo | null) {
if (modInfo) {
const astro = getAstroMetadata(modInfo);
if (astro) {
let metadata: SSRComponentMetadata = {
containsHead: false,
propagation: 'none',
};
if (astro.propagation) {
metadata.propagation = astro.propagation;
}
if (astro.containsHead) {
metadata.containsHead = astro.containsHead;
}
map.set(modInfo.id, metadata);
}
}
}
Domain
Subdomains
Functions
Dependencies
- ../core/module-loader/index.js
- ../core/util.js
- ../types/public/internal.js
- ../vite-plugin-astro/index.js
- ./vite.js
Source
Frequently Asked Questions
What does metadata.ts do?
metadata.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in metadata.ts?
metadata.ts defines 2 function(s): addMetadata, getComponentMetadata.
What does metadata.ts depend on?
metadata.ts imports 5 module(s): ../core/module-loader/index.js, ../core/util.js, ../types/public/internal.js, ../vite-plugin-astro/index.js, ./vite.js.
Where is metadata.ts in the architecture?
metadata.ts is located at packages/astro/src/vite-plugin-astro-server/metadata.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-astro-server).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free