importBundledFile() — astro Function Reference
Architecture documentation for the importBundledFile() function in load-file.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 19d80c39_7c5c_ace8_c39c_7de905d1e6a4["importBundledFile()"] c880535e_510d_6ed5_4280_3abb271db261["load-file.ts"] 19d80c39_7c5c_ace8_c39c_7de905d1e6a4 -->|defined in| c880535e_510d_6ed5_4280_3abb271db261 70baf2f8_8656_2b85_dc81_210e3628975c["loadAndBundleDbConfigFile()"] 70baf2f8_8656_2b85_dc81_210e3628975c -->|calls| 19d80c39_7c5c_ace8_c39c_7de905d1e6a4 style 19d80c39_7c5c_ace8_c39c_7de905d1e6a4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/db/src/core/load-file.ts lines 185–204
export async function importBundledFile({
code,
root,
}: {
code: string;
root: URL;
}): Promise<{ default?: unknown }> {
// Write it to disk, load it with native Node ESM, then delete the file.
const tmpFileUrl = new URL(`./db.timestamp-${Date.now()}.mjs`, root);
await writeFile(tmpFileUrl, code, { encoding: 'utf8' });
try {
return await import(/* @vite-ignore */ tmpFileUrl.toString());
} finally {
try {
await unlink(tmpFileUrl);
} catch {
// already removed if this function is called twice simultaneously
}
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does importBundledFile() do?
importBundledFile() is a function in the astro codebase, defined in packages/db/src/core/load-file.ts.
Where is importBundledFile() defined?
importBundledFile() is defined in packages/db/src/core/load-file.ts at line 185.
What calls importBundledFile()?
importBundledFile() is called by 1 function(s): loadAndBundleDbConfigFile.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free