Home / Function/ cleanGlobalCLIOptions() — vite Function Reference

cleanGlobalCLIOptions() — vite Function Reference

Architecture documentation for the cleanGlobalCLIOptions() function in cli.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  b2abb7b3_f460_486a_0742_c976fde1330f["cleanGlobalCLIOptions()"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0["cli.ts"]
  b2abb7b3_f460_486a_0742_c976fde1330f -->|defined in| a4f486ae_83b9_5db5_eb04_81cee52d16a0
  style b2abb7b3_f460_486a_0742_c976fde1330f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/cli.ts lines 103–140

function cleanGlobalCLIOptions<Options extends GlobalCLIOptions>(
  options: Options,
): Omit<Options, keyof GlobalCLIOptions> {
  const ret = { ...options }
  delete ret['--']
  delete ret.c
  delete ret.config
  delete ret.base
  delete ret.l
  delete ret.logLevel
  delete ret.clearScreen
  delete ret.configLoader
  delete ret.d
  delete ret.debug
  delete ret.f
  delete ret.filter
  delete ret.m
  delete ret.mode
  delete ret.force
  delete ret.w

  // convert the sourcemap option to a boolean if necessary
  if ('sourcemap' in ret) {
    const sourcemap = ret.sourcemap as `${boolean}` | 'inline' | 'hidden'
    ret.sourcemap =
      sourcemap === 'true'
        ? true
        : sourcemap === 'false'
          ? false
          : ret.sourcemap
  }
  if ('watch' in ret) {
    const watch = ret.watch
    ret.watch = watch ? {} : undefined
  }

  return ret
}

Domain

Subdomains

Frequently Asked Questions

What does cleanGlobalCLIOptions() do?
cleanGlobalCLIOptions() is a function in the vite codebase, defined in packages/vite/src/node/cli.ts.
Where is cleanGlobalCLIOptions() defined?
cleanGlobalCLIOptions() is defined in packages/vite/src/node/cli.ts at line 103.

Analyze Your Own Codebase

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

Try Supermodel Free