Home / File/ constants.ts — vite Source File

constants.ts — vite Source File

Architecture documentation for constants.ts, a typescript file in the vite codebase. 5 imports, 32 dependents.

File typescript ViteCore ConfigEngine 5 imports 32 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  545df65b_7f67_94d3_e2e8_a592d5e64b8f["constants.ts"]
  54e67a14_a437_c14e_bc06_6d4adc025099["typeUtils.ts"]
  545df65b_7f67_94d3_e2e8_a592d5e64b8f --> 54e67a14_a437_c14e_bc06_6d4adc025099
  d66f2dc9_4443_4498_eccd_810b2e79a2b0["RollupPluginHooks"]
  545df65b_7f67_94d3_e2e8_a592d5e64b8f --> d66f2dc9_4443_4498_eccd_810b2e79a2b0
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  545df65b_7f67_94d3_e2e8_a592d5e64b8f --> 51e96894_3556_ed5c_1ede_97d449867adf
  6feed3e8_55b8_cce7_b5ef_e40b872585f7["node:url"]
  545df65b_7f67_94d3_e2e8_a592d5e64b8f --> 6feed3e8_55b8_cce7_b5ef_e40b872585f7
  e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"]
  545df65b_7f67_94d3_e2e8_a592d5e64b8f --> e6032fbc_44cf_58d6_868d_dd15106c18c5
  77df6aca_f424_d78e_77d2_9c703cf821e6["constants.spec.ts"]
  77df6aca_f424_d78e_77d2_9c703cf821e6 --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  f81cffe5_5872_74d5_0c1b_79b0ef8844af["plugin.ts"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"]
  45981d85_cbdd_e969_8c88_c17072ea0eda --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  a4f486ae_83b9_5db5_eb04_81cee52d16a0["cli.ts"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0 --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"]
  7da774f9_eca5_d54e_6e01_6bee7d460a2b --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  695bc011_d16d_4322_2fef_1a59a092ee32["http.ts"]
  695bc011_d16d_4322_2fef_1a59a092ee32 --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  46419eb2_654c_202c_b705_789bb65b53e8["nodeResolve.ts"]
  46419eb2_654c_202c_b705_789bb65b53e8 --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  2f328851_91ee_fb05_63f0_4f466b9d6250["index.ts"]
  2f328851_91ee_fb05_63f0_4f466b9d6250 --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  88c474dd_3ef0_0479_2549_43cd02a6f84b["rolldownDepPlugin.ts"]
  88c474dd_3ef0_0479_2549_43cd02a6f84b --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  style 545df65b_7f67_94d3_e2e8_a592d5e64b8f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path, { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { readFileSync } from 'node:fs'
import type { RollupPluginHooks } from './typeUtils'

const { version } = JSON.parse(
  readFileSync(new URL('../../package.json', import.meta.url)).toString(),
)

export const ROLLUP_HOOKS: RollupPluginHooks[] = [
  'options',
  'buildStart',
  'buildEnd',
  'renderStart',
  'renderError',
  'renderChunk',
  'writeBundle',
  'generateBundle',
  'banner',
  'footer',
  'augmentChunkHash',
  'outputOptions',
  // 'renderDynamicImport',
  // 'resolveFileUrl',
  // 'resolveImportMeta',
  'intro',
  'outro',
  'closeBundle',
  'closeWatcher',
  'load',
  'moduleParsed',
  'watchChange',
  'resolveDynamicImport',
  'resolveId',
  // 'shouldTransformCachedModule',
  'transform',
  'onLog',
]

export const VERSION = version as string

const DEFAULT_MAIN_FIELDS = [
  'browser',
  'module',
  'jsnext:main', // moment still uses this...
  'jsnext',
]
export const DEFAULT_CLIENT_MAIN_FIELDS: readonly string[] =
  Object.freeze(DEFAULT_MAIN_FIELDS)
export const DEFAULT_SERVER_MAIN_FIELDS: readonly string[] = Object.freeze(
  DEFAULT_MAIN_FIELDS.filter((f) => f !== 'browser'),
)

/**
 * A special condition that would be replaced with production or development
 * depending on NODE_ENV env variable
 */
export const DEV_PROD_CONDITION = `development|production` as const

const DEFAULT_CONDITIONS = ['module', 'browser', 'node', DEV_PROD_CONDITION]
// ... (166 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does constants.ts do?
constants.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in constants.ts?
constants.ts defines 3 function(s): DEFAULT_CLIENT_CONDITIONS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS.
What does constants.ts depend on?
constants.ts imports 5 module(s): RollupPluginHooks, node:fs, node:path, node:url, typeUtils.ts.
What files import constants.ts?
constants.ts is imported by 32 file(s): asset.ts, assetImportMetaUrl.ts, build.ts, cli.ts, clientInjections.ts, config.ts, constants.spec.ts, css.ts, and 24 more.
Where is constants.ts in the architecture?
constants.ts is located at packages/vite/src/node/constants.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node).

Analyze Your Own Codebase

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

Try Supermodel Free