Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

File typescript CoreAstro RoutingSystem 4 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  eecbb2c4_1cf9_b32b_f41f_438a6587b783["index.ts"]
  ccbf4855_e7a3_6593_4a03_296825437140["./version.js"]
  eecbb2c4_1cf9_b32b_f41f_438a6587b783 --> ccbf4855_e7a3_6593_4a03_296825437140
  5d389dfb_18c4_9ef7_b245_992a321798be["plugin-react"]
  eecbb2c4_1cf9_b32b_f41f_438a6587b783 --> 5d389dfb_18c4_9ef7_b245_992a321798be
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  eecbb2c4_1cf9_b32b_f41f_438a6587b783 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  263e522e_1aa5_ebc3_e7d6_45ebc51671f7["vite"]
  eecbb2c4_1cf9_b32b_f41f_438a6587b783 --> 263e522e_1aa5_ebc3_e7d6_45ebc51671f7
  style eecbb2c4_1cf9_b32b_f41f_438a6587b783 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import react, { type Options as ViteReactPluginOptions } from '@vitejs/plugin-react';
import type { AstroIntegration, AstroRenderer } from 'astro';
import type * as vite from 'vite';
import {
	getReactMajorVersion,
	isSupportedReactVersion,
	type ReactVersionConfig,
	versionsConfig,
} from './version.js';
import type { EnvironmentOptions } from 'vite';

export type ReactIntegrationOptions = Pick<
	ViteReactPluginOptions,
	'include' | 'exclude' | 'babel'
> & {
	experimentalReactChildren?: boolean;
	/**
	 * Disable streaming in React components
	 */
	experimentalDisableStreaming?: boolean;
};

const FAST_REFRESH_PREAMBLE = react.preambleCode;

function getRenderer(reactConfig: ReactVersionConfig) {
	return {
		name: '@astrojs/react',
		clientEntrypoint: reactConfig.client,
		serverEntrypoint: reactConfig.server,
	};
}

function optionsPlugin({
	experimentalReactChildren = false,
	experimentalDisableStreaming = false,
}: {
	experimentalReactChildren: boolean;
	experimentalDisableStreaming: boolean;
}): vite.Plugin {
	const virtualModule = 'astro:react:opts';
	const virtualModuleId = '\0' + virtualModule;
	return {
		name: '@astrojs/react:opts',
		resolveId: {
			filter: {
				id: new RegExp(`^${virtualModule}$`),
			},
			handler() {
				return virtualModuleId;
			},
		},
		load: {
			filter: {
				id: new RegExp(`^${virtualModuleId}$`),
			},
			handler() {
				return {
					code: `export default {
						experimentalReactChildren: ${JSON.stringify(experimentalReactChildren)},
						experimentalDisableStreaming: ${JSON.stringify(experimentalDisableStreaming)}
// ... (140 more lines)

Domain

Subdomains

Dependencies

  • ./version.js
  • astro
  • plugin-react
  • vite

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): configEnvironmentPlugin, getContainerRenderer, getRenderer, getViteConfiguration, optionsPlugin.
What does index.ts depend on?
index.ts imports 4 module(s): ./version.js, astro, plugin-react, vite.
Where is index.ts in the architecture?
index.ts is located at packages/integrations/react/src/index.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/react/src).

Analyze Your Own Codebase

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

Try Supermodel Free