trackStyleHashes() — astro Function Reference
Architecture documentation for the trackStyleHashes() function in common.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 21d60b5d_fe02_4e91_ee0f_6e712b06625d["trackStyleHashes()"] 0f62fcfb_9504_86a2_16bb_d8a9742e1f23["common.ts"] 21d60b5d_fe02_4e91_ee0f_6e712b06625d -->|defined in| 0f62fcfb_9504_86a2_16bb_d8a9742e1f23 style 21d60b5d_fe02_4e91_ee0f_6e712b06625d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/core/csp/common.ts lines 96–125
export async function trackStyleHashes(
internals: BuildInternals,
settings: AstroSettings,
algorithm: CspAlgorithm,
): Promise<string[]> {
const clientStyleHashes: string[] = [];
for (const [_, page] of internals.pagesByViteID.entries()) {
for (const style of page.styles) {
if (style.sheet.type === 'inline') {
clientStyleHashes.push(await generateCspDigest(style.sheet.content, algorithm));
}
}
}
for (const clientAsset in internals.clientChunksAndAssets) {
const contents = readFileSync(
fileURLToPath(new URL(clientAsset, settings.config.build.client)),
'utf-8',
);
if (clientAsset.endsWith('.css') || clientAsset.endsWith('.css')) {
clientStyleHashes.push(await generateCspDigest(contents, algorithm));
}
}
if (settings.renderers.length > 0) {
clientStyleHashes.push(await generateCspDigest(ISLAND_STYLES, algorithm));
}
return clientStyleHashes;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does trackStyleHashes() do?
trackStyleHashes() is a function in the astro codebase, defined in packages/astro/src/core/csp/common.ts.
Where is trackStyleHashes() defined?
trackStyleHashes() is defined in packages/astro/src/core/csp/common.ts at line 96.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free