integration.ts — astro Source File
Architecture documentation for integration.ts, a typescript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a3d8e3d5_bbb1_8fff_a02f_17b550fd5672["integration.ts"] dd6187d6_53c4_ce90_a1d1_3a0b5e7e7d3f["../../core/errors/errors.js"] a3d8e3d5_bbb1_8fff_a02f_17b550fd5672 --> dd6187d6_53c4_ce90_a1d1_3a0b5e7e7d3f 8df634da_0f30_1e1f_1314_2439b0c9baab["../core/errors/errors-data.js"] a3d8e3d5_bbb1_8fff_a02f_17b550fd5672 --> 8df634da_0f30_1e1f_1314_2439b0c9baab f68003f1_292f_ca44_03ce_21af87a33c7b["../core/util.js"] a3d8e3d5_bbb1_8fff_a02f_17b550fd5672 --> f68003f1_292f_ca44_03ce_21af87a33c7b e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] a3d8e3d5_bbb1_8fff_a02f_17b550fd5672 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa 4c453c0b_17bb_ebc3_f7de_e2a632e42c1e["../types/public/integrations.js"] a3d8e3d5_bbb1_8fff_a02f_17b550fd5672 --> 4c453c0b_17bb_ebc3_f7de_e2a632e42c1e 9f5b84fa_f8a8_ed7f_2a86_7ecc740bf1d4["../actions/consts.js"] a3d8e3d5_bbb1_8fff_a02f_17b550fd5672 --> 9f5b84fa_f8a8_ed7f_2a86_7ecc740bf1d4 style a3d8e3d5_bbb1_8fff_a02f_17b550fd5672 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { AstroError } from '../core/errors/errors.js';
import { ActionsWithoutServerOutputError } from '../core/errors/errors-data.js';
import { viteID } from '../core/util.js';
import type { AstroSettings } from '../types/astro.js';
import type { AstroIntegration } from '../types/public/integrations.js';
import { ACTION_RPC_ROUTE_PATTERN, ACTIONS_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
/**
* This integration is applied when the user is using Actions in their project.
* It will inject the necessary routes and middlewares to handle actions.
*/
// TODO: do not use an integration for this
export default function astroIntegrationActionsRouteHandler({
settings,
filename,
}: {
settings: AstroSettings;
filename: string;
}): AstroIntegration {
return {
name: VIRTUAL_MODULE_ID,
hooks: {
async 'astro:config:setup'() {
settings.injectedRoutes.push({
pattern: ACTION_RPC_ROUTE_PATTERN,
entrypoint: 'astro/actions/runtime/entrypoints/route.js',
prerender: false,
origin: 'internal',
});
},
'astro:config:done': async (params) => {
if (params.buildOutput === 'static') {
const error = new AstroError(ActionsWithoutServerOutputError);
error.stack = undefined;
throw error;
}
const stringifiedActionsImport = JSON.stringify(
viteID(new URL(`./${filename}`, params.config.srcDir)),
);
settings.injectedTypes.push({
filename: ACTIONS_TYPES_FILE,
content: `declare module "astro:actions" {
export const actions: typeof import(${stringifiedActionsImport})["server"];
}`,
});
},
},
};
}
Domain
Subdomains
Functions
Dependencies
- ../../core/errors/errors.js
- ../actions/consts.js
- ../core/errors/errors-data.js
- ../core/util.js
- ../types/astro.js
- ../types/public/integrations.js
Source
Frequently Asked Questions
What does integration.ts do?
integration.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 integration.ts?
integration.ts defines 1 function(s): astroIntegrationActionsRouteHandler.
What does integration.ts depend on?
integration.ts imports 6 module(s): ../../core/errors/errors.js, ../actions/consts.js, ../core/errors/errors-data.js, ../core/util.js, ../types/astro.js, ../types/public/integrations.js.
Where is integration.ts in the architecture?
integration.ts is located at packages/astro/src/actions/integration.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/actions).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free