index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR dfd7a031_bf4c_d294_22de_195709bd3025["index.ts"] d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"] dfd7a031_bf4c_d294_22de_195709bd3025 --> d3861967_b647_84d2_ff48_15013353bd56 ec3f57f9_1334_b72b_abeb_11b186147ebe["../integrations/hooks.js"] dfd7a031_bf4c_d294_22de_195709bd3025 --> ec3f57f9_1334_b72b_abeb_11b186147ebe e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] dfd7a031_bf4c_d294_22de_195709bd3025 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa 10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"] dfd7a031_bf4c_d294_22de_195709bd3025 --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05 4454efd2_ab89_97b9_11ec_53ebe0d2f5ce["rollup"] dfd7a031_bf4c_d294_22de_195709bd3025 --> 4454efd2_ab89_97b9_11ec_53ebe0d2f5ce 263e522e_1aa5_ebc3_e7d6_45ebc51671f7["vite"] dfd7a031_bf4c_d294_22de_195709bd3025 --> 263e522e_1aa5_ebc3_e7d6_45ebc51671f7 style dfd7a031_bf4c_d294_22de_195709bd3025 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { PluginContext } from 'rollup';
import type { Plugin as VitePlugin } from 'vite';
import { normalizePath } from 'vite';
import type { Logger } from '../core/logger/core.js';
import { runHookServerSetup } from '../integrations/hooks.js';
import type { AstroSettings } from '../types/astro.js';
import type { InternalInjectedRoute, ResolvedInjectedRoute } from '../types/public/internal.js';
/** Connect Astro integrations into Vite, as needed. */
export default function astroIntegrationsContainerPlugin({
settings,
logger,
}: {
settings: AstroSettings;
logger: Logger;
}): VitePlugin {
return {
name: 'astro:integration-container',
async configureServer(server) {
if (server.config.isProduction) return;
await runHookServerSetup({ config: settings.config, server, logger });
},
async buildStart() {
if (settings.injectedRoutes.length === settings.resolvedInjectedRoutes.length) return;
// Ensure the injectedRoutes are all resolved to their final paths through Rollup
settings.resolvedInjectedRoutes = await Promise.all(
settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route)),
);
},
};
}
async function resolveEntryPoint(
this: PluginContext,
route: InternalInjectedRoute,
): Promise<ResolvedInjectedRoute> {
const resolvedId = await this.resolve(route.entrypoint.toString())
.then((res) => res?.id)
.catch(() => undefined);
if (!resolvedId) return route;
const resolvedEntryPoint = new URL(`file://${normalizePath(resolvedId)}`);
return { ...route, resolvedEntryPoint };
}
Domain
Subdomains
Dependencies
- ../core/logger/core.js
- ../integrations/hooks.js
- ../types/astro.js
- ../types/public/internal.js
- rollup
- vite
Source
Frequently Asked Questions
What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in index.ts?
index.ts defines 2 function(s): astroIntegrationsContainerPlugin, resolveEntryPoint.
What does index.ts depend on?
index.ts imports 6 module(s): ../core/logger/core.js, ../integrations/hooks.js, ../types/astro.js, ../types/public/internal.js, rollup, vite.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/vite-plugin-integrations-container/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-integrations-container).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free