DevFontFileIdGenerator Class — astro Architecture
Architecture documentation for the DevFontFileIdGenerator class in dev-font-file-id-generator.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 768a8024_e2d9_a21c_8496_03d353df56e2["DevFontFileIdGenerator"] c9d5eef5_dcdb_1649_9209_5a22550c254d["dev-font-file-id-generator.ts"] 768a8024_e2d9_a21c_8496_03d353df56e2 -->|defined in| c9d5eef5_dcdb_1649_9209_5a22550c254d 40752d6f_a521_97e9_e5cd_d1466bd63947["constructor()"] 768a8024_e2d9_a21c_8496_03d353df56e2 -->|method| 40752d6f_a521_97e9_e5cd_d1466bd63947 21e4527b_db7f_c9f4_d2d4_5554949dc08f["weight()"] 768a8024_e2d9_a21c_8496_03d353df56e2 -->|method| 21e4527b_db7f_c9f4_d2d4_5554949dc08f bb3e7b8e_f549_5cdb_4511_cf808eba6364["generate()"] 768a8024_e2d9_a21c_8496_03d353df56e2 -->|method| bb3e7b8e_f549_5cdb_4511_cf808eba6364
Relationship Graph
Source Code
packages/astro/src/assets/fonts/infra/dev-font-file-id-generator.ts lines 5–51
export class DevFontFileIdGenerator implements FontFileIdGenerator {
readonly #hasher: Hasher;
readonly #contentResolver: FontFileContentResolver;
constructor({
hasher,
contentResolver,
}: {
hasher: Hasher;
contentResolver: FontFileContentResolver;
}) {
this.#hasher = hasher;
this.#contentResolver = contentResolver;
}
#formatWeight(weight: unifont.FontFaceData['weight']): string | undefined {
if (Array.isArray(weight)) {
return weight.join('-');
}
if (typeof weight === 'number') {
return weight.toString();
}
return weight?.replace(/\s+/g, '-');
}
generate({
cssVariable,
originalUrl,
type,
font,
}: {
originalUrl: string;
type: FontType;
cssVariable: string;
font: unifont.FontFaceData;
}): string {
return [
cssVariable.slice(2),
this.#formatWeight(font.weight),
font.style,
font.meta?.subset,
`${this.#hasher.hashString(this.#contentResolver.resolve(originalUrl))}.${type}`,
]
.filter(Boolean)
.join('-');
}
}
Domain
Source
Frequently Asked Questions
What is the DevFontFileIdGenerator class?
DevFontFileIdGenerator is a class in the astro codebase, defined in packages/astro/src/assets/fonts/infra/dev-font-file-id-generator.ts.
Where is DevFontFileIdGenerator defined?
DevFontFileIdGenerator is defined in packages/astro/src/assets/fonts/infra/dev-font-file-id-generator.ts at line 5.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free