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 RenderingEngine 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  5a655f72_26c4_fb42_ed4d_5dc8a24063cc["index.ts"]
  8db17b08_b9e5_db7e_cd39_46be76c6d5ad["../core/messages.js"]
  5a655f72_26c4_fb42_ed4d_5dc8a24063cc --> 8db17b08_b9e5_db7e_cd39_46be76c6d5ad
  0145d7d0_d9f5_ab57_eea4_5750953cd250["../../core/preview/index.js"]
  5a655f72_26c4_fb42_ed4d_5dc8a24063cc --> 0145d7d0_d9f5_ab57_eea4_5750953cd250
  9323e55c_9236_cd3d_d0b3_e20df52a4e84["../flags.js"]
  5a655f72_26c4_fb42_ed4d_5dc8a24063cc --> 9323e55c_9236_cd3d_d0b3_e20df52a4e84
  10250468_0e83_bd69_43e9_3bcef2294a91["piccolore"]
  5a655f72_26c4_fb42_ed4d_5dc8a24063cc --> 10250468_0e83_bd69_43e9_3bcef2294a91
  style 5a655f72_26c4_fb42_ed4d_5dc8a24063cc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import colors from 'piccolore';
import { printHelp } from '../../core/messages.js';
import previewServer from '../../core/preview/index.js';
import { type Flags, flagsToAstroInlineConfig } from '../flags.js';

interface PreviewOptions {
	flags: Flags;
}

export async function preview({ flags }: PreviewOptions) {
	if (flags?.help || flags?.h) {
		printHelp({
			commandName: 'astro preview',
			usage: '[...flags]',
			tables: {
				Flags: [
					['--port', `Specify which port to run on. Defaults to 4321.`],
					['--host', `Listen on all addresses, including LAN and public addresses.`],
					['--host <custom-address>', `Expose on a network IP address at <custom-address>`],
					['--open', 'Automatically open the app in the browser on server start'],
					[
						'--allowed-hosts',
						'Specify a comma-separated list of allowed hosts or allow any hostname.',
					],
					['--help (-h)', 'See all available flags.'],
				],
			},
			description: `Starts a local server to serve your static dist/ directory. Check ${colors.cyan(
				'https://docs.astro.build/en/reference/cli-reference/#astro-preview',
			)} for more information.`,
		});
		return;
	}

	const inlineConfig = flagsToAstroInlineConfig(flags);

	return await previewServer(inlineConfig);
}

Domain

Subdomains

Functions

Dependencies

  • ../../core/preview/index.js
  • ../core/messages.js
  • ../flags.js
  • piccolore

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, RenderingEngine subdomain.
What functions are defined in index.ts?
index.ts defines 1 function(s): preview.
What does index.ts depend on?
index.ts imports 4 module(s): ../../core/preview/index.js, ../core/messages.js, ../flags.js, piccolore.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/cli/preview/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/cli/preview).

Analyze Your Own Codebase

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

Try Supermodel Free