index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d68e5306_c538_f1dd_7811_2ac2f7f8b490["index.ts"] 7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"] d68e5306_c538_f1dd_7811_2ac2f7f8b490 --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b 263e522e_1aa5_ebc3_e7d6_45ebc51671f7["vite"] d68e5306_c538_f1dd_7811_2ac2f7f8b490 --> 263e522e_1aa5_ebc3_e7d6_45ebc51671f7 style d68e5306_c538_f1dd_7811_2ac2f7f8b490 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { Plugin } from 'vite';
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';
const ASTRO_STATIC_PATHS_MODULE_ID = 'astro:static-paths';
const ASTRO_STATIC_PATHS_RESOLVED_ID = '\0' + ASTRO_STATIC_PATHS_MODULE_ID;
/**
* Virtual module that exposes StaticPaths class for prerendering.
* This allows adapters to use StaticPaths from their runtime (e.g., workerd)
* to collect all prerenderable paths.
*
* Only works in the 'prerender' environment - returns no-op in other environments.
*/
export default function vitePluginStaticPaths(): Plugin {
return {
name: 'astro:static-paths',
enforce: 'pre',
resolveId: {
filter: {
id: new RegExp(`^${ASTRO_STATIC_PATHS_MODULE_ID}$`),
},
handler() {
return ASTRO_STATIC_PATHS_RESOLVED_ID;
},
},
load: {
filter: {
id: new RegExp(`^${ASTRO_STATIC_PATHS_RESOLVED_ID}$`),
},
handler() {
// Only provide real implementation in prerender environment
if (this.environment?.name !== ASTRO_VITE_ENVIRONMENT_NAMES.prerender) {
return {
code: `export class StaticPaths { async getAll() { return []; } }`,
};
}
// Re-export StaticPaths class from runtime module
return {
code: `export { StaticPaths } from 'astro/runtime/prerender/static-paths.js';`,
};
},
},
};
}
Domain
Subdomains
Functions
Dependencies
- ../core/constants.js
- 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): vitePluginStaticPaths.
What does index.ts depend on?
index.ts imports 2 module(s): ../core/constants.js, vite.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/vite-plugin-static-paths/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/vite-plugin-static-paths).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free