index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR cd0e7127_96f9_d468_a86c_01d17d962513["index.ts"] 48658eda_5bcd_d93a_6692_f7e186da9cbf["./shared.js"] cd0e7127_96f9_d468_a86c_01d17d962513 --> 48658eda_5bcd_d93a_6692_f7e186da9cbf b384cf30_390d_6db6_4724_be96d46e50ef["./types.js"] cd0e7127_96f9_d468_a86c_01d17d962513 --> b384cf30_390d_6db6_4724_be96d46e50ef d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] cd0e7127_96f9_d468_a86c_01d17d962513 --> d9a92db9_c95e_9165_13ac_24b3d859d946 6834f085_c14f_61e4_3720_10435d7dac98["fs"] cd0e7127_96f9_d468_a86c_01d17d962513 --> 6834f085_c14f_61e4_3720_10435d7dac98 f16d8c76_2866_6150_bd14_0347b59abfe9["astro"] cd0e7127_96f9_d468_a86c_01d17d962513 --> f16d8c76_2866_6150_bd14_0347b59abfe9 b77270e1_f0f2_7ea7_00a0_eedcb9ad6bdb["errors"] cd0e7127_96f9_d468_a86c_01d17d962513 --> b77270e1_f0f2_7ea7_00a0_eedcb9ad6bdb 3b10c06c_a805_be1f_3a3d_1f00ea858ef5["config"] cd0e7127_96f9_d468_a86c_01d17d962513 --> 3b10c06c_a805_be1f_3a3d_1f00ea858ef5 style cd0e7127_96f9_d468_a86c_01d17d962513 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { fileURLToPath } from 'node:url';
import { writeJson } from '@astrojs/internal-helpers/fs';
import type {
AstroAdapter,
AstroConfig,
AstroIntegration,
NodeAppHeadersJson,
RouteToHeaders,
} from 'astro';
import { AstroError } from 'astro/errors';
import { STATIC_HEADERS_FILE } from './shared.js';
import type { Options, UserOptions } from './types.js';
import { sessionDrivers } from 'astro/config';
export function getAdapter(options: Options): AstroAdapter {
return {
name: '@astrojs/node',
serverEntrypoint: '@astrojs/node/server.js',
previewEntrypoint: '@astrojs/node/preview.js',
exports: ['handler', 'startServer', 'options'],
args: options,
adapterFeatures: {
buildOutput: 'server',
edgeMiddleware: false,
staticHeaders: options.staticHeaders,
},
supportedAstroFeatures: {
hybridOutput: 'stable',
staticOutput: 'stable',
serverOutput: 'stable',
sharpImageService: 'stable',
i18nDomains: 'experimental',
envGetSecret: 'stable',
},
};
}
const protocols = ['http:', 'https:'];
export default function createIntegration(userOptions: UserOptions): AstroIntegration {
if (!userOptions?.mode) {
throw new AstroError(`Setting the 'mode' option is required.`);
}
const { experimentalErrorPageHost } = userOptions;
if (
experimentalErrorPageHost &&
(!URL.canParse(experimentalErrorPageHost) ||
!protocols.includes(new URL(experimentalErrorPageHost).protocol))
) {
throw new AstroError(
`Invalid experimentalErrorPageHost: ${experimentalErrorPageHost}. It should be a valid URL.`,
);
}
let _options: Options;
let _config: AstroConfig | undefined = undefined;
let _routeToHeaders: RouteToHeaders | undefined = undefined;
return {
name: '@astrojs/node',
hooks: {
// ... (83 more lines)
Domain
Subdomains
Functions
Dependencies
- ./shared.js
- ./types.js
- astro
- config
- errors
- fs
- node:url
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, RoutingSystem subdomain.
What functions are defined in index.ts?
index.ts defines 2 function(s): createIntegration, getAdapter.
What does index.ts depend on?
index.ts imports 7 module(s): ./shared.js, ./types.js, astro, config, errors, fs, node:url.
Where is index.ts in the architecture?
index.ts is located at packages/integrations/node/src/index.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/node/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free