importAnalysisBuild.ts — vite Source File
Architecture documentation for importAnalysisBuild.ts, a typescript file in the vite codebase. 22 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR 04ad4685_2ce3_556a_152b_c93668a74b3b["importAnalysisBuild.ts"] 031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 031bc221_67a8_c579_f2bf_bb30a08beeb2 cb1210e8_03e9_2eec_ef04_aa15d44d4c08["combineSourcemaps"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> cb1210e8_03e9_2eec_ef04_aa15d44d4c08 310ed049_c1b4_c917_b399_81bab290e5a2["generateCodeFrame"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 310ed049_c1b4_c917_b399_81bab290e5a2 7e08b9a5_2650_5312_63d2_5971015349af["numberToPos"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 7e08b9a5_2650_5312_63d2_5971015349af 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7 dfa3f5a8_b519_cb65_4b7e_9d4824406fd4["perEnvironmentPlugin"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> dfa3f5a8_b519_cb65_4b7e_9d4824406fd4 7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 7da774f9_eca5_d54e_6e01_6bee7d460a2b eb5604c2_58e1_1c00_5a1a_5d97ea5236ad["ResolvedConfig"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> eb5604c2_58e1_1c00_5a1a_5d97ea5236ad 45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 45981d85_cbdd_e969_8c88_c17072ea0eda 0b9e0d55_d22c_da82_ca1d_a2e7d0af1d66["toOutputFilePathInJS"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 0b9e0d55_d22c_da82_ca1d_a2e7d0af1d66 18244f7c_8357_ba88_c896_32c6447f1faf["sourcemap.ts"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 18244f7c_8357_ba88_c896_32c6447f1faf 0857a370_8db0_3f2b_ac58_b48c57bd6a12["genSourceMapUrl"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 0857a370_8db0_3f2b_ac58_b48c57bd6a12 84057c57_14eb_2f16_cd5c_1899e8da6db0["baseEnvironment.ts"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> 84057c57_14eb_2f16_cd5c_1899e8da6db0 dc928824_33f2_0b61_b231_90d8800b77a5["PartialEnvironment"] 04ad4685_2ce3_556a_152b_c93668a74b3b --> dc928824_33f2_0b61_b231_90d8800b77a5 style 04ad4685_2ce3_556a_152b_c93668a74b3b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import path from 'node:path'
import MagicString from 'magic-string'
import type { ImportSpecifier } from 'es-module-lexer'
import { init, parse as parseImports } from 'es-module-lexer'
import type { SourceMap } from 'rolldown'
import { viteBuildImportAnalysisPlugin as nativeBuildImportAnalysisPlugin } from 'rolldown/experimental'
import type { RawSourceMap } from '@jridgewell/remapping'
import convertSourceMap from 'convert-source-map'
import { combineSourcemaps, generateCodeFrame, numberToPos } from '../utils'
import { type Plugin, perEnvironmentPlugin } from '../plugin'
import type { ResolvedConfig } from '../config'
import { toOutputFilePathInJS } from '../build'
import { genSourceMapUrl } from '../server/sourcemap'
import type { PartialEnvironment } from '../baseEnvironment'
import { removedPureCssFilesCache } from './css'
type FileDep = {
url: string
runtime: boolean
}
type VitePreloadErrorEvent = Event & { payload: Error }
/**
* A flag for injected helpers. This flag will be set to `false` if the output
* target is not native es - so that injected helper logic can be conditionally
* dropped.
*/
export const isModernFlag = `__VITE_IS_MODERN__`
export const preloadMethod = `__vitePreload`
export const preloadMarker = `__VITE_PRELOAD__`
export const preloadHelperId = '\0vite/preload-helper.js'
const preloadMarkerRE = new RegExp(preloadMarker, 'g')
function toRelativePath(filename: string, importer: string) {
const relPath = path.posix.relative(path.posix.dirname(importer), filename)
return relPath[0] === '.' ? relPath : `./${relPath}`
}
function findPreloadMarker(str: string, pos: number = 0): number {
preloadMarkerRE.lastIndex = pos
const result = preloadMarkerRE.exec(str)
return result?.index ?? -1
}
/**
* Helper for preloading CSS and direct imports of async chunks in parallel to
* the async chunk itself.
*/
function detectScriptRel() {
const relList =
typeof document !== 'undefined' && document.createElement('link').relList
return relList && relList.supports && relList.supports('modulepreload')
? 'modulepreload'
: 'preload'
}
declare const scriptRel: string
// ... (518 more lines)
Domain
Subdomains
Functions
Dependencies
- PartialEnvironment
- ResolvedConfig
- baseEnvironment.ts
- build.ts
- combineSourcemaps
- config.ts
- convert-source-map
- css.ts
- es-module-lexer
- experimental
- genSourceMapUrl
- generateCodeFrame
- magic-string
- node:path
- numberToPos
- perEnvironmentPlugin
- plugin.ts
- remapping
- rolldown
- sourcemap.ts
- toOutputFilePathInJS
- utils.ts
Imported By
Source
Frequently Asked Questions
What does importAnalysisBuild.ts do?
importAnalysisBuild.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 importAnalysisBuild.ts?
importAnalysisBuild.ts defines 6 function(s): buildImportAnalysisPlugin, detectScriptRel, findPreloadMarker, getPreloadCode, preload, toRelativePath.
What does importAnalysisBuild.ts depend on?
importAnalysisBuild.ts imports 22 module(s): PartialEnvironment, ResolvedConfig, baseEnvironment.ts, build.ts, combineSourcemaps, config.ts, convert-source-map, css.ts, and 14 more.
What files import importAnalysisBuild.ts?
importAnalysisBuild.ts is imported by 3 file(s): assetImportMetaUrl.ts, build.ts, ssrManifestPlugin.ts.
Where is importAnalysisBuild.ts in the architecture?
importAnalysisBuild.ts is located at packages/vite/src/node/plugins/importAnalysisBuild.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