Home / File/ esbuild.ts — vite Source File

esbuild.ts — vite Source File

Architecture documentation for esbuild.ts, a typescript file in the vite codebase. 20 imports, 8 dependents.

File typescript PluginSystem LegacySupport 20 imports 8 dependents 11 functions

Entity Profile

Dependency Diagram

graph LR
  926e3b98_b813_2ff8_abb3_16447ab95544["esbuild.ts"]
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 031bc221_67a8_c579_f2bf_bb30a08beeb2
  cb1210e8_03e9_2eec_ef04_aa15d44d4c08["combineSourcemaps"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> cb1210e8_03e9_2eec_ef04_aa15d44d4c08
  23a2e685_f919_9578_27ba_bde71c122058["createDebugger"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 23a2e685_f919_9578_27ba_bde71c122058
  0a6fbb70_77d3_9873_8417_b1e4ffba2651["ensureWatchedFile"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 0a6fbb70_77d3_9873_8417_b1e4ffba2651
  310ed049_c1b4_c917_b399_81bab290e5a2["generateCodeFrame"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 310ed049_c1b4_c917_b399_81bab290e5a2
  a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e
  31fbe894_2070_4b11_3ffa_96b46ed3dfa9["ViteDevServer"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 31fbe894_2070_4b11_3ffa_96b46ed3dfa9
  7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 7da774f9_eca5_d54e_6e01_6bee7d460a2b
  eb5604c2_58e1_1c00_5a1a_5d97ea5236ad["ResolvedConfig"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> eb5604c2_58e1_1c00_5a1a_5d97ea5236ad
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7
  1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef
  abfc9e70_3c15_b3f0_a595_3cf27afb7e64["utils.ts"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> abfc9e70_3c15_b3f0_a595_3cf27afb7e64
  10b9dea8_362c_1af2_93be_afa4dd9aed9e["cleanUrl"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 10b9dea8_362c_1af2_93be_afa4dd9aed9e
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  926e3b98_b813_2ff8_abb3_16447ab95544 --> 51e96894_3556_ed5c_1ede_97d449867adf
  style 926e3b98_b813_2ff8_abb3_16447ab95544 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path'
import colors from 'picocolors'
import type { RawSourceMap } from '@jridgewell/remapping'
import type { InternalModuleFormat, SourceMap } from 'rolldown'
import type { TSConfckParseResult } from 'tsconfck'
import { TSConfckCache, TSConfckParseError, parse } from 'tsconfck'
import type {
  EsbuildLoader,
  EsbuildMessage,
  EsbuildTransformOptions,
  EsbuildTransformResult as RawEsbuildTransformResult,
} from '#types/internal/esbuildOptions'
import type { FSWatcher } from '#dep-types/chokidar'
import {
  combineSourcemaps,
  createDebugger,
  createFilter,
  ensureWatchedFile,
  generateCodeFrame,
} from '../utils'
import type { ViteDevServer } from '../server'
import type { ResolvedConfig } from '../config'
import type { Plugin } from '../plugin'
import { cleanUrl } from '../../shared/utils'

const debug = createDebugger('vite:esbuild')

// IIFE content looks like `var MyLib = function() {`.
// Spaces are removed and parameters are mangled when minified
const IIFE_BEGIN_RE =
  /(?:const|var)\s+\S+\s*=\s*\(?function\([^()]*\)\s*\{\s*"use strict";/

const validExtensionRE = /\.\w+$/
const jsxExtensionsRE = /\.(?:j|t)sx\b/

// the final build should always support dynamic import and import.meta.
// if they need to be polyfilled, plugin-legacy should be used.
// plugin-legacy detects these two features when checking for modern code.
// Browser support: https://caniuse.com/es6-module-dynamic-import,mdn-javascript_operators_import_meta#:~:text=Feature%20summary
export const defaultEsbuildSupported = {
  'dynamic-import': true,
  'import-meta': true,
}

export interface ESBuildOptions extends EsbuildTransformOptions {
  include?: string | RegExp | ReadonlyArray<string | RegExp>
  exclude?: string | RegExp | ReadonlyArray<string | RegExp>
  jsxInject?: string
  /**
   * This option is not respected. Use `build.minify` instead.
   */
  minify?: never
}

export type ESBuildTransformResult = Omit<RawEsbuildTransformResult, 'map'> & {
  map: SourceMap
}

type TSConfigJSON = {
  extends?: string
// ... (531 more lines)

Domain

Subdomains

Frequently Asked Questions

What does esbuild.ts do?
esbuild.ts is a source file in the vite codebase, written in typescript. It belongs to the PluginSystem domain, LegacySupport subdomain.
What functions are defined in esbuild.ts?
esbuild.ts defines 11 function(s): buildEsbuildPlugin, esbuildPlugin, getTSConfckCache, importEsbuild, injectEsbuildHelpers, loadTsconfigJsonForFile, prettifyMessage, reloadOnTsconfigChange, resolveEsbuildTranspileOptions, transformWithEsbuild, and 1 more.
What does esbuild.ts depend on?
esbuild.ts imports 20 module(s): Plugin, ResolvedConfig, ViteDevServer, chokidar, cleanUrl, combineSourcemaps, config.ts, createDebugger, and 12 more.
What files import esbuild.ts?
esbuild.ts is imported by 8 file(s): build.ts, config.ts, css.ts, esbuild.spec.ts, fixture.spec.ts, index.ts, oxc.ts, ssrTransform.spec.ts.
Where is esbuild.ts in the architecture?
esbuild.ts is located at packages/vite/src/node/plugins/esbuild.ts (domain: PluginSystem, subdomain: LegacySupport, directory: packages/vite/src/node/plugins).

Analyze Your Own Codebase

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

Try Supermodel Free