writeInjectedTypes() — astro Function Reference
Architecture documentation for the writeInjectedTypes() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 76725a69_d85c_2f6d_9e32_f181cc2afec3["writeInjectedTypes()"] cd488d83_5ad0_f34a_227f_731e9945a152["index.ts"] 76725a69_d85c_2f6d_9e32_f181cc2afec3 -->|defined in| cd488d83_5ad0_f34a_227f_731e9945a152 2523437b_c067_5714_7895_f8fb9bc10862["syncInternal()"] 2523437b_c067_5714_7895_f8fb9bc10862 -->|calls| 76725a69_d85c_2f6d_9e32_f181cc2afec3 c7b848d6_a769_a24b_5584_11b4431c6e75["getTsReference()"] 76725a69_d85c_2f6d_9e32_f181cc2afec3 -->|calls| c7b848d6_a769_a24b_5584_11b4431c6e75 style 76725a69_d85c_2f6d_9e32_f181cc2afec3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/core/sync/index.ts lines 196–217
function writeInjectedTypes(settings: AstroSettings, fs: typeof fsMod) {
const references: Array<string> = [];
for (const { filename, content } of settings.injectedTypes) {
const filepath = fileURLToPath(new URL(filename, settings.dotAstroDir));
fs.mkdirSync(dirname(filepath), { recursive: true });
if (content) {
fs.writeFileSync(filepath, content, 'utf-8');
}
references.push(normalizePath(relative(fileURLToPath(settings.dotAstroDir), filepath)));
}
const astroDtsContent = `${CLIENT_TYPES_REFERENCE}\n${references.map((reference) => getTsReference('path', reference)).join('\n')}`;
if (references.length === 0) {
fs.mkdirSync(settings.dotAstroDir, { recursive: true });
}
fs.writeFileSync(
fileURLToPath(new URL('./types.d.ts', settings.dotAstroDir)),
astroDtsContent,
'utf-8',
);
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does writeInjectedTypes() do?
writeInjectedTypes() is a function in the astro codebase, defined in packages/astro/src/core/sync/index.ts.
Where is writeInjectedTypes() defined?
writeInjectedTypes() is defined in packages/astro/src/core/sync/index.ts at line 196.
What does writeInjectedTypes() call?
writeInjectedTypes() calls 1 function(s): getTsReference.
What calls writeInjectedTypes()?
writeInjectedTypes() is called by 1 function(s): syncInternal.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free