vite-plugin.ts — astro Source File
Architecture documentation for vite-plugin.ts, a typescript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d223a8b8_792e_a5fe_c08b_a90af6ed14ef["vite-plugin.ts"] e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] d223a8b8_792e_a5fe_c08b_a90af6ed14ef --> e9b74c5a_8d34_34a7_e196_5e41b87214aa 8df634da_0f30_1e1f_1314_2439b0c9baab["../core/errors/errors-data.js"] d223a8b8_792e_a5fe_c08b_a90af6ed14ef --> 8df634da_0f30_1e1f_1314_2439b0c9baab ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"] d223a8b8_792e_a5fe_c08b_a90af6ed14ef --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9 a36a2963_3e6e_b4c0_f768_c3c1468734e7["../core/session/utils.js"] d223a8b8_792e_a5fe_c08b_a90af6ed14ef --> a36a2963_3e6e_b4c0_f768_c3c1468734e7 d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] d223a8b8_792e_a5fe_c08b_a90af6ed14ef --> d9a92db9_c95e_9165_13ac_24b3d859d946 263e522e_1aa5_ebc3_e7d6_45ebc51671f7["vite"] d223a8b8_792e_a5fe_c08b_a90af6ed14ef --> 263e522e_1aa5_ebc3_e7d6_45ebc51671f7 style d223a8b8_792e_a5fe_c08b_a90af6ed14ef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { fileURLToPath } from 'node:url';
import type { Plugin as VitePlugin } from 'vite';
import type { AstroSettings } from '../../types/astro.js';
import { SessionStorageInitError } from '../errors/errors-data.js';
import { AstroError } from '../errors/index.js';
import { normalizeSessionDriverConfig } from './utils.js';
export const VIRTUAL_SESSION_DRIVER_ID = 'virtual:astro:session-driver';
const RESOLVED_VIRTUAL_SESSION_DRIVER_ID = '\0' + VIRTUAL_SESSION_DRIVER_ID;
export function vitePluginSessionDriver({ settings }: { settings: AstroSettings }): VitePlugin {
return {
name: VIRTUAL_SESSION_DRIVER_ID,
enforce: 'pre',
resolveId: {
filter: {
id: new RegExp(`^${VIRTUAL_SESSION_DRIVER_ID}$`),
},
handler() {
return RESOLVED_VIRTUAL_SESSION_DRIVER_ID;
},
},
load: {
filter: {
id: new RegExp(`^${RESOLVED_VIRTUAL_SESSION_DRIVER_ID}$`),
},
async handler() {
if (!settings.config.session?.driver) {
return { code: 'export default null;' };
}
const driver = normalizeSessionDriverConfig(
settings.config.session.driver,
settings.config.session.options,
);
const importerPath = fileURLToPath(import.meta.url);
const resolved = await this.resolve(driver.entrypoint, importerPath);
if (!resolved) {
throw new AstroError({
...SessionStorageInitError,
message: SessionStorageInitError.message(
`Failed to resolve session driver: ${driver.entrypoint}`,
driver.entrypoint,
),
});
}
return {
code: `import { default as _default } from '${resolved.id}';\nexport * from '${resolved.id}';\nexport default _default;`,
};
},
},
};
}
Domain
Subdomains
Functions
Dependencies
- ../core/errors/errors-data.js
- ../core/errors/index.js
- ../core/session/utils.js
- ../types/astro.js
- node:url
- vite
Source
Frequently Asked Questions
What does vite-plugin.ts do?
vite-plugin.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 vite-plugin.ts?
vite-plugin.ts defines 1 function(s): vitePluginSessionDriver.
What does vite-plugin.ts depend on?
vite-plugin.ts imports 6 module(s): ../core/errors/errors-data.js, ../core/errors/index.js, ../core/session/utils.js, ../types/astro.js, node:url, vite.
Where is vite-plugin.ts in the architecture?
vite-plugin.ts is located at packages/astro/src/core/session/vite-plugin.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/session).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free