Home / File/ cli.ts — vite Source File

cli.ts — vite Source File

Architecture documentation for cli.ts, a typescript file in the vite codebase. 17 imports, 0 dependents.

File typescript ViteCore ConfigEngine 17 imports 7 functions

Entity Profile

Dependency Diagram

graph LR
  a4f486ae_83b9_5db5_eb04_81cee52d16a0["cli.ts"]
  545df65b_7f67_94d3_e2e8_a592d5e64b8f["constants.ts"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 45981d85_cbdd_e969_8c88_c17072ea0eda
  c405e6f9_f059_0d3a_d8d9_6d6dd2e00614["BuildEnvironmentOptions"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> c405e6f9_f059_0d3a_d8d9_6d6dd2e00614
  a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e
  2c7c03d9_77c6_007f_638e_c7972aaa12b3["ServerOptions"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 2c7c03d9_77c6_007f_638e_c7972aaa12b3
  ed89bdb5_1269_0bd7_7665_244657588aa2["shortcuts.ts"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> ed89bdb5_1269_0bd7_7665_244657588aa2
  6b3b12b9_1ae8_ddf3_9550_76ffa7e888d2["CLIShortcut"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 6b3b12b9_1ae8_ddf3_9550_76ffa7e888d2
  eca93de5_04d5_dda0_7ae6_2ceb5379ea81["logger.ts"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> eca93de5_04d5_dda0_7ae6_2ceb5379ea81
  520011b1_93b8_7712_9ecf_62f28229402b["LogLevel"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 520011b1_93b8_7712_9ecf_62f28229402b
  04e3b119_ae40_14a9_42ce_3951d83fc60d["createLogger"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 04e3b119_ae40_14a9_42ce_3951d83fc60d
  7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 7da774f9_eca5_d54e_6e01_6bee7d460a2b
  6729b047_29e8_ba18_f1ca_c87655a130d3["InlineConfig"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 6729b047_29e8_ba18_f1ca_c87655a130d3
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 51e96894_3556_ed5c_1ede_97d449867adf
  e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> e6032fbc_44cf_58d6_868d_dd15106c18c5
  style a4f486ae_83b9_5db5_eb04_81cee52d16a0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path'
import fs from 'node:fs'
import { performance } from 'node:perf_hooks'
import { cac } from 'cac'
import colors from 'picocolors'
import { VERSION } from './constants'
import type { BuildEnvironmentOptions } from './build'
import type { ServerOptions } from './server'
import type { CLIShortcut } from './shortcuts'
import type { LogLevel } from './logger'
import { createLogger } from './logger'
import type { InlineConfig } from './config'

function checkNodeVersion(nodeVersion: string): boolean {
  const currentVersion = nodeVersion.split('.')
  const major = parseInt(currentVersion[0], 10)
  const minor = parseInt(currentVersion[1], 10)
  const isSupported =
    (major === 20 && minor >= 19) || (major === 22 && minor >= 12) || major > 22
  return isSupported
}

if (!checkNodeVersion(process.versions.node)) {
  // eslint-disable-next-line no-console
  console.warn(
    colors.yellow(
      `You are using Node.js ${process.versions.node}. ` +
        `Vite requires Node.js version 20.19+ or 22.12+. ` +
        `Please upgrade your Node.js version.`,
    ),
  )
}

const cli = cac('vite')

// global options
interface GlobalCLIOptions {
  '--'?: string[]
  c?: boolean | string
  config?: string
  base?: string
  l?: LogLevel
  logLevel?: LogLevel
  clearScreen?: boolean
  configLoader?: 'bundle' | 'runner' | 'native'
  d?: boolean | string
  debug?: boolean | string
  f?: string
  filter?: string
  m?: string
  mode?: string
  force?: boolean
  w?: boolean
}

interface ExperimentalDevOptions {
  experimentalBundle?: boolean
}

interface BuilderCLIOptions {
// ... (420 more lines)

Domain

Subdomains

Frequently Asked Questions

What does cli.ts do?
cli.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 cli.ts?
cli.ts defines 7 function(s): checkNodeVersion, cleanBuilderCLIOptions, cleanGlobalCLIOptions, convertBase, convertHost, filterDuplicateOptions, stopProfiler.
What does cli.ts depend on?
cli.ts imports 17 module(s): BuildEnvironmentOptions, CLIShortcut, InlineConfig, LogLevel, ServerOptions, build.ts, cac, config.ts, and 9 more.
Where is cli.ts in the architecture?
cli.ts is located at packages/vite/src/node/cli.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