http.ts — vite Source File
Architecture documentation for http.ts, a typescript file in the vite codebase. 14 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 695bc011_d16d_4322_2fef_1a59a092ee32["http.ts"] d873c697_620e_ffca_0134_e9fecd784782["proxy.ts"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> d873c697_620e_ffca_0134_e9fecd784782 05b97f5d_3ed3_9bce_0c0f_62f0d2fcd320["ProxyOptions"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> 05b97f5d_3ed3_9bce_0c0f_62f0d2fcd320 eca93de5_04d5_dda0_7ae6_2ceb5379ea81["logger.ts"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> eca93de5_04d5_dda0_7ae6_2ceb5379ea81 fff7f05e_fc73_d337_53a0_b846230bc8e2["Logger"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> fff7f05e_fc73_d337_53a0_b846230bc8e2 a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e dc89a07a_7490_3b94_fcf2_07f282d5cefe["HttpServer"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> dc89a07a_7490_3b94_fcf2_07f282d5cefe 545df65b_7f67_94d3_e2e8_a592d5e64b8f["constants.ts"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f a09ff191_7c83_bdcd_30f1_b4e129910bf6["promises"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> a09ff191_7c83_bdcd_30f1_b4e129910bf6 689e5a7c_b7c2_0909_a0c2_a9564d811346["node:net"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> 689e5a7c_b7c2_0909_a0c2_a9564d811346 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> 51e96894_3556_ed5c_1ede_97d449867adf 946bdba3_227b_3fc0_1b4c_ddbdb281f454["node:http"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> 946bdba3_227b_3fc0_1b4c_ddbdb281f454 d3247ce3_3db4_c9bd_3925_57eb350e29ff["node:https"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> d3247ce3_3db4_c9bd_3925_57eb350e29ff bff4f846_ab01_b5ba_74d4_c1608e434d2c["picocolors"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> bff4f846_ab01_b5ba_74d4_c1608e434d2c 9165291b_077b_bedb_8c23_36e44bc99390["connect"] 695bc011_d16d_4322_2fef_1a59a092ee32 --> 9165291b_077b_bedb_8c23_36e44bc99390 style 695bc011_d16d_4322_2fef_1a59a092ee32 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fsp from 'node:fs/promises'
import net from 'node:net'
import path from 'node:path'
import type { OutgoingHttpHeaders as HttpServerHeaders } from 'node:http'
import type { ServerOptions as HttpsServerOptions } from 'node:https'
import colors from 'picocolors'
import type { Connect } from '#dep-types/connect'
import type { ProxyOptions } from './server/middlewares/proxy'
import type { Logger } from './logger'
import type { HttpServer } from './server'
import { wildcardHosts } from './constants'
export interface CommonServerOptions {
/**
* Specify server port. Note if the port is already being used, Vite will
* automatically try the next available port so this may not be the actual
* port the server ends up listening on.
*/
port?: number
/**
* If enabled, vite will exit if specified port is already in use
*/
strictPort?: boolean
/**
* Specify which IP addresses the server should listen on.
* Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
*/
host?: string | boolean
/**
* The hostnames that Vite is allowed to respond to.
* `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
* When using HTTPS, this check is skipped.
*
* If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
* For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
*
* If set to `true`, the server is allowed to respond to requests for any hosts.
* This is not recommended as it will be vulnerable to DNS rebinding attacks.
*/
allowedHosts?: string[] | true
/**
* Enable TLS + HTTP/2.
* Note: this downgrades to TLS only when the proxy option is also used.
*/
https?: HttpsServerOptions
/**
* Open browser window on startup
*/
open?: boolean | string
/**
* Configure custom proxy rules for the dev server. Expects an object
* of `{ key: options }` pairs.
* Uses [`http-proxy-3`](https://github.com/sagemathinc/http-proxy-3).
* Full options [here](https://github.com/sagemathinc/http-proxy-3#options).
*
* Example `vite.config.js`:
* ``` js
* module.exports = {
* proxy: {
* // string shorthand: /foo -> http://localhost:4567/foo
// ... (215 more lines)
Domain
Subdomains
Functions
Dependencies
- HttpServer
- Logger
- ProxyOptions
- connect
- constants.ts
- index.ts
- logger.ts
- node:http
- node:https
- node:net
- node:path
- picocolors
- promises
- proxy.ts
Source
Frequently Asked Questions
What does http.ts do?
http.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 http.ts?
http.ts defines 9 function(s): httpServerStart, isPortAvailable, origin, readFileIfExists, resolveHttpServer, resolveHttpsConfig, setClientErrorHandler, tryBindServer, tryListen.
What does http.ts depend on?
http.ts imports 14 module(s): HttpServer, Logger, ProxyOptions, connect, constants.ts, index.ts, logger.ts, node:http, and 6 more.
What files import http.ts?
http.ts is imported by 2 file(s): index.ts, preview.ts.
Where is http.ts in the architecture?
http.ts is located at packages/vite/src/node/http.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