Home / File/ html.ts — vite Source File

html.ts — vite Source File

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

File typescript PluginSystem AssetManagement 46 imports 6 dependents 36 functions

Entity Profile

Dependency Diagram

graph LR
  f8fe0737_718a_5509_b722_473f207d5906["html.ts"]
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7
  8b752f72_c233_b9a4_5d63_556516879519["MinimalPluginContextWithoutEnvironment"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 8b752f72_c233_b9a4_5d63_556516879519
  1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef
  a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"]
  f8fe0737_718a_5509_b722_473f207d5906 --> a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e
  31fbe894_2070_4b11_3ffa_96b46ed3dfa9["ViteDevServer"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 31fbe894_2070_4b11_3ffa_96b46ed3dfa9
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 031bc221_67a8_c579_f2bf_bb30a08beeb2
  b785bb42_81b4_52a8_f27e_13aacc0eea06["decodeURIIfPossible"]
  f8fe0737_718a_5509_b722_473f207d5906 --> b785bb42_81b4_52a8_f27e_13aacc0eea06
  41d0f7a0_ed36_9f0f_d0d6_f403e4f50763["encodeURIPath"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 41d0f7a0_ed36_9f0f_d0d6_f403e4f50763
  310ed049_c1b4_c917_b399_81bab290e5a2["generateCodeFrame"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 310ed049_c1b4_c917_b399_81bab290e5a2
  9d025481_71dc_8fbb_c07e_b6e74a08a45a["getHash"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 9d025481_71dc_8fbb_c07e_b6e74a08a45a
  ae8703ad_85e4_a4b4_5a15_57955bb1f6ce["isCSSRequest"]
  f8fe0737_718a_5509_b722_473f207d5906 --> ae8703ad_85e4_a4b4_5a15_57955bb1f6ce
  298b86d6_4810_9884_d5fa_3e3077e2206a["isDataUrl"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 298b86d6_4810_9884_d5fa_3e3077e2206a
  23257aa1_5e3f_7e6e_1b43_875b139e4ec5["isExternalUrl"]
  f8fe0737_718a_5509_b722_473f207d5906 --> 23257aa1_5e3f_7e6e_1b43_875b139e4ec5
  a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath"]
  f8fe0737_718a_5509_b722_473f207d5906 --> a4adb1a7_cf54_091f_eb63_8217e684a8e1
  style f8fe0737_718a_5509_b722_473f207d5906 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path'
import { URL } from 'node:url'
import type {
  OutputAsset,
  OutputBundle,
  OutputChunk,
  RollupError,
  SourceMapInput,
} from 'rolldown'
import MagicString from 'magic-string'
import colors from 'picocolors'
import type {
  DefaultTreeAdapterMap,
  ErrorCodes,
  ParserError,
  Token,
} from 'parse5'
import { stripLiteral } from 'strip-literal'
import escapeHtml from 'escape-html'
import type { MinimalPluginContextWithoutEnvironment, Plugin } from '../plugin'
import type { ViteDevServer } from '../server'
import {
  decodeURIIfPossible,
  encodeURIPath,
  generateCodeFrame,
  getHash,
  isCSSRequest,
  isDataUrl,
  isExternalUrl,
  normalizePath,
  partialEncodeURIPath,
  processSrcSet,
  removeLeadingSlash,
  unique,
} from '../utils'
import type { ResolvedConfig } from '../config'
import { checkPublicFile } from '../publicDir'
import { toOutputFilePathInHtml } from '../build'
import { resolveEnvPrefix } from '../env'
import { cleanUrl } from '../../shared/utils'
import { perEnvironmentState } from '../environment'
import { getNodeAssetAttributes } from '../assetSource'
import type { Logger } from '../logger'
import {
  assetUrlRE,
  getPublicAssetFilename,
  publicAssetUrlRE,
  urlToBuiltUrl,
} from './asset'
import { cssBundleNameCache } from './css'
import { modulePreloadPolyfillId } from './modulePreloadPolyfill'

interface ScriptAssetsUrl {
  start: number
  end: number
  url: string
}

const htmlProxyRE =
  /[?&]html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(?:js|css)$/
// ... (1522 more lines)

Domain

Subdomains

Frequently Asked Questions

What does html.ts do?
html.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 html.ts?
html.ts defines 36 function(s): addToHTMLProxyCache, addToHTMLProxyTransformResult, applyHtmlTransforms, buildHtmlPlugin, extractImportExpressionFromClassicScript, findNeedTransformStyleAttribute, formatParseError, getBaseInHTML, getScriptInfo, handleParseError, and 26 more.
What does html.ts depend on?
html.ts imports 46 module(s): Logger, MinimalPluginContextWithoutEnvironment, Plugin, ResolvedConfig, ViteDevServer, asset.ts, assetSource.ts, build.ts, and 38 more.
What files import html.ts?
html.ts is imported by 6 file(s): css.ts, define.ts, index.ts, indexHtml.ts, plugin.ts, transform.ts.
Where is html.ts in the architecture?
html.ts is located at packages/vite/src/node/plugins/html.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