Home / File/ index.ts — vite Source File

index.ts — vite Source File

Architecture documentation for index.ts, a typescript file in the vite codebase. 40 imports, 9 dependents.

File typescript DependencyOptimizer PreBundler 40 imports 9 dependents 43 functions

Entity Profile

Dependency Diagram

graph LR
  2f328851_91ee_fb05_63f0_4f466b9d6250["index.ts"]
  7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 7da774f9_eca5_d54e_6e01_6bee7d460a2b
  eb5604c2_58e1_1c00_5a1a_5d97ea5236ad["ResolvedConfig"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> eb5604c2_58e1_1c00_5a1a_5d97ea5236ad
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 031bc221_67a8_c579_f2bf_bb30a08beeb2
  19ce2051_6a74_4b8b_104d_ec006cd7075f["arraify"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 19ce2051_6a74_4b8b_104d_ec006cd7075f
  40f91c1f_e515_2c03_9628_3e4ba2691b70["asyncFlatten"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 40f91c1f_e515_2c03_9628_3e4ba2691b70
  23a2e685_f919_9578_27ba_bde71c122058["createDebugger"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 23a2e685_f919_9578_27ba_bde71c122058
  1cc52ea9_1097_389c_806c_c1207629afcc["flattenId"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 1cc52ea9_1097_389c_806c_c1207629afcc
  9d025481_71dc_8fbb_c07e_b6e74a08a45a["getHash"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 9d025481_71dc_8fbb_c07e_b6e74a08a45a
  908e9e35_950f_ad37_ffa9_0058622aa7e8["isOptimizable"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 908e9e35_950f_ad37_ffa9_0058622aa7e8
  934a26da_8b90_f4d4_a1d6_df7aa4fead12["lookupFile"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 934a26da_8b90_f4d4_a1d6_df7aa4fead12
  e56655cb_6a06_ed57_e671_30f0a2b54b82["normalizeId"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> e56655cb_6a06_ed57_e671_30f0a2b54b82
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> a4adb1a7_cf54_091f_eb63_8217e684a8e1
  821f5140_d604_b209_3c9a_17ee29fefe11["removeLeadingSlash"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 821f5140_d604_b209_3c9a_17ee29fefe11
  a9bd45ce_8339_2b77_7543_41c306ebdb02["tryStatSync"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> a9bd45ce_8339_2b77_7543_41c306ebdb02
  style 2f328851_91ee_fb05_63f0_4f466b9d6250 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs'
import fsp from 'node:fs/promises'
import path from 'node:path'
import { promisify } from 'node:util'
import { performance } from 'node:perf_hooks'
import colors from 'picocolors'
import { init, parse } from 'es-module-lexer'
import { isDynamicPattern } from 'tinyglobby'
import {
  type RolldownOptions,
  type RolldownOutput,
  type OutputOptions as RolldownOutputOptions,
  rolldown,
} from 'rolldown'
import type { DepsOptimizerEsbuildOptions } from '#types/internal/esbuildOptions'
import type { ResolvedConfig } from '../config'
import {
  arraify,
  asyncFlatten,
  createDebugger,
  flattenId,
  getHash,
  isOptimizable,
  lookupFile,
  normalizeId,
  normalizePath,
  removeLeadingSlash,
  tryStatSync,
  unique,
} from '../utils'
import {
  ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
  METADATA_FILENAME,
} from '../constants'
import { isWindows } from '../../shared/utils'
import type { Environment } from '../environment'
import { transformWithOxc } from '../plugins/oxc'
import { ScanEnvironment, scanImports } from './scan'
import { createOptimizeDepsIncludeResolver, expandGlobIds } from './resolve'
import {
  rolldownCjsExternalPlugin,
  rolldownDepPlugin,
} from './rolldownDepPlugin'

const debug = createDebugger('vite:deps')

const jsExtensionRE = /\.js$/i

export type ExportsData = {
  hasModuleSyntax: boolean
  // exported names (for `export { a as b }`, `b` is exported name)
  exports: readonly string[]
  // hint if the dep requires loading as jsx
  jsxLoader?: boolean
}

export interface DepsOptimizer {
  init: () => Promise<void>

  metadata: DepOptimizationMetadata
// ... (1408 more lines)

Subdomains

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the vite codebase, written in typescript. It belongs to the DependencyOptimizer domain, PreBundler subdomain.
What functions are defined in index.ts?
index.ts defines 43 function(s): OptimizedDepInfo, Promise, addManuallyIncludedOptimizeDeps, addOptimizedDepInfo, cleanupDepsCacheStaleDirs, createIsOptimizedDepFile, createIsOptimizedDepUrl, depInfo, depsFromOptimizedDepInfo, depsLogString, and 33 more.
What does index.ts depend on?
index.ts imports 40 module(s): Environment, ResolvedConfig, ScanEnvironment, arraify, asyncFlatten, config.ts, constants.ts, createDebugger, and 32 more.
What files import index.ts?
index.ts is imported by 9 file(s): config.ts, environment.ts, importAnalysis.ts, index.ts, optimizedDeps.ts, optimizer.ts, preAlias.ts, resolve.ts, and 1 more.
Where is index.ts in the architecture?
index.ts is located at packages/vite/src/node/optimizer/index.ts (domain: DependencyOptimizer, subdomain: PreBundler, directory: packages/vite/src/node/optimizer).

Analyze Your Own Codebase

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

Try Supermodel Free