astroDBIntegration() — astro Function Reference
Architecture documentation for the astroDBIntegration() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD bae2f194_ed09_ed10_da43_ef94962b8ab8["astroDBIntegration()"] 74eaede6_604c_f153_5a03_fab5555699d5["index.ts"] bae2f194_ed09_ed10_da43_ef94962b8ab8 -->|defined in| 74eaede6_604c_f153_5a03_fab5555699d5 dd5bafc5_23b5_40e2_3925_68a58ecd2e13["integration()"] dd5bafc5_23b5_40e2_3925_68a58ecd2e13 -->|calls| bae2f194_ed09_ed10_da43_ef94962b8ab8 cdc2ee10_0683_2ffd_ac03_f35f104cde5b["executeSeedFile()"] bae2f194_ed09_ed10_da43_ef94962b8ab8 -->|calls| cdc2ee10_0683_2ffd_ac03_f35f104cde5b d60c6a47_a726_7358_e99c_8d0d9780e4b4["databaseFileEnvDefined()"] bae2f194_ed09_ed10_da43_ef94962b8ab8 -->|calls| d60c6a47_a726_7358_e99c_8d0d9780e4b4 616f494c_6029_e3a6_b7cd_0bc268f4f27e["getTempViteServer()"] bae2f194_ed09_ed10_da43_ef94962b8ab8 -->|calls| 616f494c_6029_e3a6_b7cd_0bc268f4f27e style bae2f194_ed09_ed10_da43_ef94962b8ab8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/db/src/core/integration/index.ts lines 53–209
function astroDBIntegration(options?: AstroDBConfig): AstroIntegration {
const resolvedConfig = astroDBConfigSchema.parse(options);
let connectToRemote = false;
let configFileDependencies: string[] = [];
let root: URL;
// Used during production builds to load seed files.
let tempViteServer: ViteDevServer | undefined;
// Make table loading "late" to pass to plugins from `config:setup`,
// but load during `config:done` to wait for integrations to settle.
let tables: LateTables = {
get() {
throw new Error('[astro:db] INTERNAL Tables not loaded yet');
},
};
let seedFiles: LateSeedFiles = {
get() {
throw new Error('[astro:db] INTERNAL Seed files not loaded yet');
},
};
let seedHandler: SeedHandler = {
execute: () => {
throw new Error('[astro:db] INTERNAL Seed handler not loaded yet');
},
inProgress: false,
};
let command: HookParameters<'astro:config:setup'>['command'];
let finalBuildOutput: string;
return {
name: 'astro:db',
hooks: {
'astro:config:setup': async ({ updateConfig, config, command: _command, logger }) => {
command = _command;
root = config.root;
if (command === 'preview') return;
let dbPlugin: VitePlugin | undefined = undefined;
const args = parseArgs(process.argv.slice(3));
connectToRemote = process.env.ASTRO_INTERNAL_TEST_REMOTE || args['remote'];
const dbClientPlugin = vitePluginDbClient({
connectToRemote,
mode: resolvedConfig.mode,
});
if (connectToRemote) {
dbPlugin = vitePluginDb({
connectToRemote,
appToken: getRemoteDatabaseInfo().token,
tables,
root: config.root,
srcDir: config.srcDir,
output: config.output,
seedHandler,
});
} else {
dbPlugin = vitePluginDb({
connectToRemote,
tables,
seedFiles,
root: config.root,
srcDir: config.srcDir,
output: config.output,
logger,
seedHandler,
});
}
updateConfig({
vite: {
assetsInclude: [DB_PATH],
plugins: [dbClientPlugin, dbPlugin],
},
});
},
'astro:config:done': async ({ config, injectTypes, buildOutput }) => {
if (command === 'preview') return;
finalBuildOutput = buildOutput;
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does astroDBIntegration() do?
astroDBIntegration() is a function in the astro codebase, defined in packages/db/src/core/integration/index.ts.
Where is astroDBIntegration() defined?
astroDBIntegration() is defined in packages/db/src/core/integration/index.ts at line 53.
What does astroDBIntegration() call?
astroDBIntegration() calls 3 function(s): databaseFileEnvDefined, executeSeedFile, getTempViteServer.
What calls astroDBIntegration()?
astroDBIntegration() is called by 1 function(s): integration.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free