index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 18 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 63c98f38_799c_f0f6_b3c0_59e116a89b1d["index.ts"] 97dbad4f_4a90_206c_6e29_6a54c12480f2["../core/app/index.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> 97dbad4f_4a90_206c_6e29_6a54c12480f2 a4f2698c_5256_262a_ba7c_f72b51878d10["../core/app/types.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> a4f2698c_5256_262a_ba7c_f72b51878d10 83a1f26e_e929_2185_8cb4_97cf43d76365["../core/dev/adapter-validation.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> 83a1f26e_e929_2185_8cb4_97cf43d76365 d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> d3861967_b647_84d2_ff48_15013353bd56 bf5441b3_b825_f070_aed3_a0f2ac54caa3["../core/routing/manifest/create.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> bf5441b3_b825_f070_aed3_a0f2ac54caa3 7858470e_6646_2f36_de46_9779897f7cb6["../core/routing/manifest/prerender.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> 7858470e_6646_2f36_de46_9779897f7cb6 f68003f1_292f_ca44_03ce_21af87a33c7b["../core/util.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> f68003f1_292f_ca44_03ce_21af87a33c7b a370a45c_02f1_30de_445d_47ee08d095a2["../core/viteUtils.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> a370a45c_02f1_30de_445d_47ee08d095a2 e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> e9b74c5a_8d34_34a7_e196_5e41b87214aa 6d6c494c_c8df_be75_fbfb_a5f4768e2e5c["../vite-plugin-astro/metadata.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> 6d6c494c_c8df_be75_fbfb_a5f4768e2e5c 578ea01d_496b_3b43_98f2_7b2f0ce78d7e["../vite-plugin-astro/types.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> 578ea01d_496b_3b43_98f2_7b2f0ce78d7e 7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b f202f4fa_f9f9_9398_9510_7a42ce8ea007["../environments.js"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> f202f4fa_f9f9_9398_9510_7a42ce8ea007 e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"] 63c98f38_799c_f0f6_b3c0_59e116a89b1d --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415 style 63c98f38_799c_f0f6_b3c0_59e116a89b1d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type fsMod from 'node:fs';
import { extname } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import colors from 'piccolore';
import { normalizePath, type Plugin, type ViteDevServer } from 'vite';
import { serializeRouteData } from '../core/app/index.js';
import type { SerializedRouteInfo } from '../core/app/types.js';
import { warnMissingAdapter } from '../core/dev/adapter-validation.js';
import type { Logger } from '../core/logger/core.js';
import { createRoutesList } from '../core/routing/manifest/create.js';
import { getRoutePrerenderOption } from '../core/routing/manifest/prerender.js';
import { isEndpoint, isPage } from '../core/util.js';
import { rootRelativePath } from '../core/viteUtils.js';
import type { AstroSettings, RoutesList } from '../types/astro.js';
import { createDefaultAstroMetadata } from '../vite-plugin-astro/metadata.js';
import type { PluginMetadata } from '../vite-plugin-astro/types.js';
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';
import { isAstroServerEnvironment } from '../environments.js';
type Payload = {
settings: AstroSettings;
logger: Logger;
fsMod?: typeof fsMod;
routesList: RoutesList;
command: 'dev' | 'build';
};
export const ASTRO_ROUTES_MODULE_ID = 'virtual:astro:routes';
const ASTRO_ROUTES_MODULE_ID_RESOLVED = '\0' + ASTRO_ROUTES_MODULE_ID;
const KNOWN_FILE_EXTENSIONS = ['.astro', '.js', '.ts'];
export default async function astroPluginRoutes({
settings,
logger,
fsMod,
routesList: initialRoutesList,
command,
}: Payload): Promise<Plugin> {
logger.debug('update', 'Re-calculate routes');
let serializedRouteInfo: SerializedRouteInfo[] = initialRoutesList.routes.map(
(r): SerializedRouteInfo => {
return {
file: '',
links: [],
scripts: [],
styles: [],
routeData: serializeRouteData(r, settings.config.trailingSlash),
};
},
);
async function rebuildRoutes(path: string | null = null, server: ViteDevServer) {
if (path != null && path.startsWith(settings.config.srcDir.pathname)) {
logger.debug(
'update',
`Re-calculating routes for ${path.slice(settings.config.srcDir.pathname.length)}`,
);
const file = pathToFileURL(normalizePath(path));
// ... (176 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- ../core/app/index.js
- ../core/app/types.js
- ../core/constants.js
- ../core/dev/adapter-validation.js
- ../core/logger/core.js
- ../core/routing/manifest/create.js
- ../core/routing/manifest/prerender.js
- ../core/util.js
- ../core/viteUtils.js
- ../environments.js
- ../types/astro.js
- ../vite-plugin-astro/metadata.js
- ../vite-plugin-astro/types.js
- node:fs
- node:path
- node:url
- piccolore
- 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 1 function(s): astroPluginRoutes.
What does index.ts depend on?
index.ts imports 18 module(s): ../core/app/index.js, ../core/app/types.js, ../core/constants.js, ../core/dev/adapter-validation.js, ../core/logger/core.js, ../core/routing/manifest/create.js, ../core/routing/manifest/prerender.js, ../core/util.js, and 10 more.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/vite-plugin-routes/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-routes).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free