preview.ts — vite Source File
Architecture documentation for preview.ts, a typescript file in the vite codebase. 57 imports, 6 dependents.
Entity Profile
Dependency Diagram
graph LR e49f0ff7_5101_3a1d_5a1f_33fae58eea2d["preview.ts"] a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e dc89a07a_7490_3b94_fcf2_07f282d5cefe["HttpServer"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> dc89a07a_7490_3b94_fcf2_07f282d5cefe 9144408c_e729_9a0f_2647_4c18b22bf8cc["ResolvedServerOptions"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> 9144408c_e729_9a0f_2647_4c18b22bf8cc d4e0c540_4b5d_2c55_27d0_83c24b24e8d8["ResolvedServerUrls"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> d4e0c540_4b5d_2c55_27d0_83c24b24e8d8 82bcdece_2370_d7d0_3f82_ad3703daa682["createServerCloseFn"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> 82bcdece_2370_d7d0_3f82_ad3703daa682 695bc011_d16d_4322_2fef_1a59a092ee32["http.ts"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> 695bc011_d16d_4322_2fef_1a59a092ee32 8ebe1d26_454e_80c8_0671_53211aaf99f9["CommonServerOptions"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> 8ebe1d26_454e_80c8_0671_53211aaf99f9 de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f["httpServerStart"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f e66d0fef_de7e_a1f4_2eb6_054a37395337["resolveHttpServer"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> e66d0fef_de7e_a1f4_2eb6_054a37395337 cb5a4344_4dd4_e836_a83e_593080e6a235["resolveHttpsConfig"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> cb5a4344_4dd4_e836_a83e_593080e6a235 0c12d8fd_e65d_655d_6d45_310c047bb1ce["setClientErrorHandler"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> 0c12d8fd_e65d_655d_6d45_310c047bb1ce 42b33c04_e36e_8276_32b6_47412295d0b2["openBrowser.ts"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> 42b33c04_e36e_8276_32b6_47412295d0b2 9e1e86ba_9f46_dbe1_a8b7_cee1ecb37905["openBrowser"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> 9e1e86ba_9f46_dbe1_a8b7_cee1ecb37905 ed4cdfe5_4523_9979_979c_b5f6e2b5f2c6["base.ts"] e49f0ff7_5101_3a1d_5a1f_33fae58eea2d --> ed4cdfe5_4523_9979_979c_b5f6e2b5f2c6 style e49f0ff7_5101_3a1d_5a1f_33fae58eea2d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs'
import path from 'node:path'
import sirv from 'sirv'
import compression from '@polka/compression'
import connect from 'connect'
import corsMiddleware from 'cors'
import type { Connect } from '#dep-types/connect'
import type {
HttpServer,
ResolvedServerOptions,
ResolvedServerUrls,
} from './server'
import { createServerCloseFn } from './server'
import type { CommonServerOptions } from './http'
import {
httpServerStart,
resolveHttpServer,
resolveHttpsConfig,
setClientErrorHandler,
} from './http'
import { openBrowser } from './server/openBrowser'
import { baseMiddleware } from './server/middlewares/base'
import { htmlFallbackMiddleware } from './server/middlewares/htmlFallback'
import { indexHtmlMiddleware } from './server/middlewares/indexHtml'
import { notFoundMiddleware } from './server/middlewares/notFound'
import { proxyMiddleware } from './server/middlewares/proxy'
import {
getServerUrlByHost,
normalizePath,
resolveHostname,
resolveServerUrls,
setupSIGTERMListener,
shouldServeFile,
teardownSIGTERMListener,
} from './utils'
import { printServerUrls } from './logger'
import { bindCLIShortcuts } from './shortcuts'
import type { BindCLIShortcutsOptions, ShortcutsState } from './shortcuts'
import { resolveConfig } from './config'
import type { InlineConfig, ResolvedConfig } from './config'
import { DEFAULT_PREVIEW_PORT } from './constants'
import type { RequiredExceptFor } from './typeUtils'
import { hostValidationMiddleware } from './server/middlewares/hostCheck'
import {
BasicMinimalPluginContext,
basePluginContextMeta,
} from './server/pluginContainer'
import type { MinimalPluginContextWithoutEnvironment } from './plugin'
export interface PreviewOptions extends CommonServerOptions {}
export interface ResolvedPreviewOptions extends RequiredExceptFor<
PreviewOptions,
'host' | 'https' | 'proxy'
> {}
export function resolvePreviewOptions(
preview: PreviewOptions | undefined,
server: ResolvedServerOptions,
): ResolvedPreviewOptions {
// ... (248 more lines)
Domain
Subdomains
Functions
Dependencies
- BasicMinimalPluginContext
- BindCLIShortcutsOptions
- CommonServerOptions
- HttpServer
- InlineConfig
- MinimalPluginContextWithoutEnvironment
- RequiredExceptFor
- ResolvedConfig
- ResolvedServerOptions
- ResolvedServerUrls
- ShortcutsState
- base.ts
- baseMiddleware
- bindCLIShortcuts
- compression
- config.ts
- connect
- connect
- constants.ts
- cors
- createServerCloseFn
- getServerUrlByHost
- hostCheck.ts
- hostValidationMiddleware
- htmlFallback.ts
- htmlFallbackMiddleware
- http.ts
- httpServerStart
- index.ts
- indexHtml.ts
- indexHtmlMiddleware
- logger.ts
- node:fs
- node:path
- normalizePath
- notFound.ts
- notFoundMiddleware
- openBrowser
- openBrowser.ts
- plugin.ts
- pluginContainer.ts
- printServerUrls
- proxy.ts
- proxyMiddleware
- resolveConfig
- resolveHostname
- resolveHttpServer
- resolveHttpsConfig
- resolveServerUrls
- setClientErrorHandler
- setupSIGTERMListener
- shortcuts.ts
- shouldServeFile
- sirv
- teardownSIGTERMListener
- typeUtils.ts
- utils.ts
Imported By
Source
Frequently Asked Questions
What does preview.ts do?
preview.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in preview.ts?
preview.ts defines 3 function(s): preview, resolvePreviewOptions, server.
What does preview.ts depend on?
preview.ts imports 57 module(s): BasicMinimalPluginContext, BindCLIShortcutsOptions, CommonServerOptions, HttpServer, InlineConfig, MinimalPluginContextWithoutEnvironment, RequiredExceptFor, ResolvedConfig, and 49 more.
What files import preview.ts?
preview.ts is imported by 6 file(s): config.ts, hooks.spec.ts, plugin.ts, shortcuts.spec.ts, shortcuts.ts, utils.ts.
Where is preview.ts in the architecture?
preview.ts is located at packages/vite/src/node/preview.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free