getLocalVirtualModContents() — astro Function Reference
Architecture documentation for the getLocalVirtualModContents() function in vite-plugin-db.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 2febfa4d_ec4e_d812_680f_a8e74106b0dd["getLocalVirtualModContents()"] 10c96ff6_9978_85bd_85f5_ced507d506e2["vite-plugin-db.ts"] 2febfa4d_ec4e_d812_680f_a8e74106b0dd -->|defined in| 10c96ff6_9978_85bd_85f5_ced507d506e2 54a8b5c7_dd97_53d0_6372_b72f4f1ba7ee["vitePluginDb()"] 54a8b5c7_dd97_53d0_6372_b72f4f1ba7ee -->|calls| 2febfa4d_ec4e_d812_680f_a8e74106b0dd cd7a45b4_c277_8322_6079_4ee060c2e132["getDBModule()"] 2febfa4d_ec4e_d812_680f_a8e74106b0dd -->|calls| cd7a45b4_c277_8322_6079_4ee060c2e132 22c4d439_15aa_1784_8821_5d5ea7ff98b7["getStringifiedTableExports()"] 2febfa4d_ec4e_d812_680f_a8e74106b0dd -->|calls| 22c4d439_15aa_1784_8821_5d5ea7ff98b7 style 2febfa4d_ec4e_d812_680f_a8e74106b0dd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/db/src/core/integration/vite-plugin-db.ts lines 153–186
export function getLocalVirtualModContents({
tables,
root,
localExecution,
}: {
tables: DBTables;
root: URL;
/**
* Used for the execute command to import the client directly.
* In other cases, we use the runtime only vite virtual module.
*
* This is used to ensure that the client is imported correctly
* when executing commands like `astro db execute`.
*/
localExecution: boolean;
}) {
const { ASTRO_DATABASE_FILE } = getAstroEnv();
const dbUrl = new URL(DB_PATH, root);
// If this is for the execute command, we need to import the client directly instead of using the runtime only virtual module.
const clientImport = getDBModule(localExecution);
return `
import { asDrizzleTable, normalizeDatabaseUrl } from ${RUNTIME_IMPORT};
${clientImport}
const dbUrl = normalizeDatabaseUrl(${JSON.stringify(ASTRO_DATABASE_FILE)}, ${JSON.stringify(dbUrl)});
export const db = createClient({ url: dbUrl });
export * from ${RUNTIME_VIRTUAL_IMPORT};
${getStringifiedTableExports(tables)}`;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does getLocalVirtualModContents() do?
getLocalVirtualModContents() is a function in the astro codebase, defined in packages/db/src/core/integration/vite-plugin-db.ts.
Where is getLocalVirtualModContents() defined?
getLocalVirtualModContents() is defined in packages/db/src/core/integration/vite-plugin-db.ts at line 153.
What does getLocalVirtualModContents() call?
getLocalVirtualModContents() calls 2 function(s): getDBModule, getStringifiedTableExports.
What calls getLocalVirtualModContents()?
getLocalVirtualModContents() is called by 1 function(s): vitePluginDb.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free