Home / File/ index.ts — astro Source File

index.ts — astro Source File

Architecture documentation for index.ts, a typescript file in the astro codebase. 13 imports, 0 dependents.

File typescript CoreAstro RoutingSystem 13 imports 5 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  9b72c5c7_3349_4acd_8ca1_afe541842abe["index.ts"]
  33ed95cd_96ff_f301_bc85_29b41d61d35b["./image/shared.js"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> 33ed95cd_96ff_f301_bc85_29b41d61d35b
  569cfb9c_5080_e57b_9e14_da3056cc42c7["./lib/nft.js"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> 569cfb9c_5080_e57b_9e14_da3056cc42c7
  0d9525e4_c95f_9570_4554_43027ceb5bab["./lib/redirects.js"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> 0d9525e4_c95f_9570_4554_43027ceb5bab
  4f62cea4_ea60_e9f4_44d8_dee7d0d1d0ec["./lib/web-analytics.js"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> 4f62cea4_ea60_e9f4_44d8_dee7d0d1d0ec
  f57400b9_56ba_86b4_c813_28290bf335e1["./serverless/middleware.js"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> f57400b9_56ba_86b4_c813_28290bf335e1
  81618d1a_0b9d_d91d_60fb_2cddb33f504e["./vite-plugin-config.js"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> 81618d1a_0b9d_d91d_60fb_2cddb33f504e
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> d9a92db9_c95e_9165_13ac_24b3d859d946
  6834f085_c14f_61e4_3720_10435d7dac98["fs"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> 6834f085_c14f_61e4_3720_10435d7dac98
  50ce0ace_0bbf_f84c_68dd_331280396924["routing-utils"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> 50ce0ace_0bbf_f84c_68dd_331280396924
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> f16d8c76_2866_6150_bd14_0347b59abfe9
  b77270e1_f0f2_7ea7_00a0_eedcb9ad6bdb["errors"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> b77270e1_f0f2_7ea7_00a0_eedcb9ad6bdb
  e64464d4_88a4_c7e2_f90f_758b06231bbe["tinyglobby"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe --> e64464d4_88a4_c7e2_f90f_758b06231bbe
  style 9b72c5c7_3349_4acd_8ca1_afe541842abe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { cpSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
import { pathToFileURL } from 'node:url';
import { emptyDir, removeDir, writeJson } from '@astrojs/internal-helpers/fs';
import {
	getTransformedRoutes,
	normalizeRoutes,
	type Route,
	type RouteWithSrc,
} from '@vercel/routing-utils';
import type {
	AstroAdapter,
	AstroConfig,
	AstroIntegration,
	AstroIntegrationLogger,
	HookParameters,
	IntegrationResolvedRoute,
	RouteToHeaders,
} from 'astro';
import { AstroError } from 'astro/errors';
import { globSync } from 'tinyglobby';
import type { RemotePattern } from './image/shared.js';
import {
	type DevImageService,
	getAstroImageConfig,
	getDefaultImageConfig,
	type VercelImageConfig,
} from './image/shared.js';
import { copyDependenciesToFunction } from './lib/nft.js';
import { escapeRegex, getRedirects } from './lib/redirects.js';
import {
	getInjectableWebAnalyticsContent,
	type VercelWebAnalyticsConfig,
} from './lib/web-analytics.js';
import { generateEdgeMiddleware } from './serverless/middleware.js';
import { createConfigPlugin } from './vite-plugin-config.js';

const PACKAGE_NAME = '@astrojs/vercel';

/**
 * The edge function calls the node server at /_render,
 * with the original path as the value of this header.
 */
export const ASTRO_PATH_HEADER = 'x-astro-path';
export const ASTRO_PATH_PARAM = 'x_astro_path';

/**
 * The edge function calls the node server at /_render,
 * with the locals serialized into this header.
 */
export const ASTRO_LOCALS_HEADER = 'x-astro-locals';
export const ASTRO_MIDDLEWARE_SECRET_HEADER = 'x-astro-middleware-secret';
export const VERCEL_EDGE_MIDDLEWARE_FILE = 'vercel-edge-middleware';

// Vercel routes the folder names to a path on the deployed website.
// We attempt to avoid interfering by prefixing with an underscore.
export const NODE_PATH = '_render';
const MIDDLEWARE_PATH = '_middleware';

// This isn't documented by vercel anywhere, but unlike serverless
// and edge functions, isr functions are not passed the original path.
// ... (734 more lines)

Domain

Subdomains

Classes

Dependencies

  • ./image/shared.js
  • ./lib/nft.js
  • ./lib/redirects.js
  • ./lib/web-analytics.js
  • ./serverless/middleware.js
  • ./vite-plugin-config.js
  • astro
  • errors
  • fs
  • node:fs
  • node:url
  • routing-utils
  • tinyglobby

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 5 function(s): createRoutesWithStaticHeaders, getAdapter, getRuntime, isAcceptedPattern, vercelAdapter.
What does index.ts depend on?
index.ts imports 13 module(s): ./image/shared.js, ./lib/nft.js, ./lib/redirects.js, ./lib/web-analytics.js, ./serverless/middleware.js, ./vite-plugin-config.js, astro, errors, and 5 more.
Where is index.ts in the architecture?
index.ts is located at packages/integrations/vercel/src/index.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/vercel/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free