Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

File typescript CoreAstro RoutingSystem 14 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  13f9df63_e787_0221_d262_fe287a4b7ce1["index.ts"]
  0f5cc593_98c2_8f47_0533_0efdb214c249["./utils/generate-routes-json.js"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 0f5cc593_98c2_8f47_0533_0efdb214c249
  9b36dbc1_ea97_4e3c_349e_9cac5bead186["./utils/image-config.js"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 9b36dbc1_ea97_4e3c_349e_9cac5bead186
  bd836c84_8c54_ff43_d548_1ecbf7d0842a["./vite-plugin-config.js"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> bd836c84_8c54_ff43_d548_1ecbf7d0842a
  22f5c3b0_9997_c1be_8811_a6d4604ad86a["./wrangler.js"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 22f5c3b0_9997_c1be_8811_a6d4604ad86a
  5f6c6676_65fd_45a0_c44c_0e4b20cd8494["./prerenderer.js"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 5f6c6676_65fd_45a0_c44c_0e4b20cd8494
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 5d6d1861_a18d_b246_cd94_08889ab7e74c
  325c69df_803f_748b_c6b3_87205adf699d["promises"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 325c69df_803f_748b_c6b3_87205adf699d
  e4df8f29_fb2f_3d70_a962_fdf6a3670b22["path"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> e4df8f29_fb2f_3d70_a962_fdf6a3670b22
  73b7bce3_6086_5697_35d6_0cc8964a1aff["underscore-redirects"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 73b7bce3_6086_5697_35d6_0cc8964a1aff
  cd61a25f_49b5_edd2_d556_1f8a13996d51["vite-plugin"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> cd61a25f_49b5_edd2_d556_1f8a13996d51
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  b4a76fc8_3591_85b4_7b57_55ab21d1030d["node:util"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> b4a76fc8_3591_85b4_7b57_55ab21d1030d
  3b10c06c_a805_be1f_3a3d_1f00ea858ef5["config"]
  13f9df63_e787_0221_d262_fe287a4b7ce1 --> 3b10c06c_a805_be1f_3a3d_1f00ea858ef5
  style 13f9df63_e787_0221_d262_fe287a4b7ce1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { createReadStream, existsSync, readFileSync } from 'node:fs';
import { appendFile, stat } from 'node:fs/promises';
import { createInterface } from 'node:readline/promises';
import { removeLeadingForwardSlash } from '@astrojs/internal-helpers/path';
import { createRedirectsFromAstroRoutes, printAsRedirects } from '@astrojs/underscore-redirects';
import { cloudflare as cfVitePlugin, type PluginConfig } from '@cloudflare/vite-plugin';
import type {
	AstroConfig,
	AstroIntegration,
	HookParameters,
	IntegrationResolvedRoute,
} from 'astro';

import { createRoutesFile, getParts } from './utils/generate-routes-json.js';
import { type ImageService, setImageConfig } from './utils/image-config.js';
import { createConfigPlugin } from './vite-plugin-config.js';
import {
	cloudflareConfigCustomizer,
	DEFAULT_SESSION_KV_BINDING_NAME,
	DEFAULT_IMAGES_BINDING_NAME,
} from './wrangler.js';
import { parseEnv } from 'node:util';
import { sessionDrivers } from 'astro/config';
import { createCloudflarePrerenderer } from './prerenderer.js';

export type { Runtime } from './utils/handler.js';

export type Options = {
	/** Options for handling images. */
	imageService?: ImageService;

	/** Configuration for `_routes.json` generation. A _routes.json file controls when your Function is invoked. This file will include three different properties:
	 *
	 * - version: Defines the version of the schema. Currently there is only one version of the schema (version 1), however, we may add more in the future and aim to be backwards compatible.
	 * - include: Defines routes that will be invoked by Functions. Accepts wildcard behavior.
	 * - exclude: Defines routes that will not be invoked by Functions. Accepts wildcard behavior. `exclude` always take priority over `include`.
	 *
	 * Wildcards match any number of path segments (slashes). For example, `/users/*` will match everything after the `/users/` path.
	 *
	 */
	routes?: {
		/** Extend `_routes.json` */
		extend: {
			/** Paths which should be routed to the SSR function */
			include?: {
				/** Generally this is in pathname format, but does support wildcards, e.g. `/users`, `/products/*` */
				pattern: string;
			}[];
			/** Paths which should be routed as static assets */
			exclude?: {
				/** Generally this is in pathname format, but does support wildcards, e.g. `/static`, `/assets/*`, `/images/avatar.jpg` */
				pattern: string;
			}[];
		};
	};

	/**
	 * By default, Astro will be configured to use Cloudflare KV to store session data. The KV namespace
	 * will be automatically provisioned when you deploy.
	 *
// ... (348 more lines)

Domain

Subdomains

Types

Dependencies

  • ./prerenderer.js
  • ./utils/generate-routes-json.js
  • ./utils/image-config.js
  • ./vite-plugin-config.js
  • ./wrangler.js
  • astro
  • config
  • node:fs
  • node:util
  • path
  • promises
  • promises
  • underscore-redirects
  • vite-plugin

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 1 function(s): createIntegration.
What does index.ts depend on?
index.ts imports 14 module(s): ./prerenderer.js, ./utils/generate-routes-json.js, ./utils/image-config.js, ./vite-plugin-config.js, ./wrangler.js, astro, config, node:fs, and 6 more.
Where is index.ts in the architecture?
index.ts is located at packages/integrations/cloudflare/src/index.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/cloudflare/src).

Analyze Your Own Codebase

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

Try Supermodel Free