Home / File/ oxc.ts — vite Source File

oxc.ts — vite Source File

Architecture documentation for oxc.ts, a typescript file in the vite codebase. 29 imports, 6 dependents.

File typescript PluginSystem AssetManagement 29 imports 6 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b["oxc.ts"]
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 031bc221_67a8_c579_f2bf_bb30a08beeb2
  cb1210e8_03e9_2eec_ef04_aa15d44d4c08["combineSourcemaps"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> cb1210e8_03e9_2eec_ef04_aa15d44d4c08
  0a6fbb70_77d3_9873_8417_b1e4ffba2651["ensureWatchedFile"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 0a6fbb70_77d3_9873_8417_b1e4ffba2651
  310ed049_c1b4_c917_b399_81bab290e5a2["generateCodeFrame"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 310ed049_c1b4_c917_b399_81bab290e5a2
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> a4adb1a7_cf54_091f_eb63_8217e684a8e1
  7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 7da774f9_eca5_d54e_6e01_6bee7d460a2b
  eb5604c2_58e1_1c00_5a1a_5d97ea5236ad["ResolvedConfig"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> eb5604c2_58e1_1c00_5a1a_5d97ea5236ad
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7
  1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef
  abfc9e70_3c15_b3f0_a595_3cf27afb7e64["utils.ts"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> abfc9e70_3c15_b3f0_a595_3cf27afb7e64
  10b9dea8_362c_1af2_93be_afa4dd9aed9e["cleanUrl"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 10b9dea8_362c_1af2_93be_afa4dd9aed9e
  a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e
  31fbe894_2070_4b11_3ffa_96b46ed3dfa9["ViteDevServer"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 31fbe894_2070_4b11_3ffa_96b46ed3dfa9
  545df65b_7f67_94d3_e2e8_a592d5e64b8f["constants.ts"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  style 16dc8750_0d4e_ed3e_3844_b80096ed2e0b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path'
import type {
  TransformOptions as OxcTransformOptions,
  TransformResult as OxcTransformResult,
} from 'rolldown/experimental'
import {
  viteTransformPlugin as nativeTransformPlugin,
  transformSync,
} from 'rolldown/experimental'
import type { RawSourceMap } from '@jridgewell/remapping'
import type { RollupError, SourceMap } from 'rolldown'
import { TSConfckParseError } from 'tsconfck'
import colors from 'picocolors'
import { prefixRegex } from 'rolldown/filter'
import type { FSWatcher } from '#dep-types/chokidar'
import {
  combineSourcemaps,
  createFilter,
  ensureWatchedFile,
  generateCodeFrame,
  normalizePath,
} from '../utils'
import type { ResolvedConfig } from '../config'
import type { Plugin } from '../plugin'
import { cleanUrl } from '../../shared/utils'
import { type Environment, perEnvironmentPlugin } from '..'
import type { ViteDevServer } from '../server'
import { JS_TYPES_RE, VITE_PACKAGE_DIR } from '../constants'
import type { Logger } from '../logger'
import type { ESBuildOptions, TSCompilerOptions } from './esbuild'
import { loadTsconfigJsonForFile } from './esbuild'

// IIFE content looks like `var MyLib = (function() {` or `this.nested.myLib = (function() {`.
export const IIFE_BEGIN_RE: RegExp =
  /(?:(?:(?:const|var)\s+[^.\s]+|[^.\s]+\.[^.\s]+\.[^.\s]+)\s*=\s*|^|\n)\(?function\([^()]*\)\s*\{(?:\s*"use strict";)?/
// UMD content looks like `})(this, function(exports, external1, external2) {`.
export const UMD_BEGIN_RE: RegExp =
  /\}\)\((?:this,\s*)?function\([^()]*\)\s*\{(?:\s*"use strict";)?/

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

export interface OxcOptions extends Omit<
  OxcTransformOptions,
  'cwd' | 'sourceType' | 'lang' | 'sourcemap' | 'helpers'
> {
  include?: string | RegExp | ReadonlyArray<string | RegExp>
  exclude?: string | RegExp | ReadonlyArray<string | RegExp>
  jsxInject?: string
  jsxRefreshInclude?: string | RegExp | ReadonlyArray<string | RegExp>
  jsxRefreshExclude?: string | RegExp | ReadonlyArray<string | RegExp>
}

export function getRollupJsxPresets(
  preset: 'react' | 'react-jsx',
): OxcJsxOptions {
  switch (preset) {
    case 'react':
      return {
        runtime: 'classic',
// ... (490 more lines)

Domain

Subdomains

Frequently Asked Questions

What does oxc.ts do?
oxc.ts is a source file in the vite codebase, written in typescript. It belongs to the PluginSystem domain, AssetManagement subdomain.
What functions are defined in oxc.ts?
oxc.ts defines 7 function(s): convertEsbuildConfigToOxcConfig, getRollupJsxPresets, oxcPlugin, resolveTsconfigTarget, setOxcTransformOptionsFromTsconfigOptions, transformWithOxc, warnDeprecatedShouldBeConvertedToPluginOptions.
What does oxc.ts depend on?
oxc.ts imports 29 module(s): .., ESBuildOptions, Logger, Plugin, ResolvedConfig, TSCompilerOptions, ViteDevServer, chokidar, and 21 more.
What files import oxc.ts?
oxc.ts is imported by 6 file(s): config.ts, css.ts, index.ts, index.ts, oxc.spec.ts, scan.ts.
Where is oxc.ts in the architecture?
oxc.ts is located at packages/vite/src/node/plugins/oxc.ts (domain: PluginSystem, subdomain: AssetManagement, 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