Home / File/ plugin.ts — vite Source File

plugin.ts — vite Source File

Architecture documentation for plugin.ts, a typescript file in the vite codebase. 12 imports, 0 dependents.

File typescript ViteCore 12 imports

Entity Profile

Dependency Diagram

graph LR
  f81cffe5_5872_74d5_0c1b_79b0ef8844af["plugin.ts"]
  5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7
  1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef
  8ff6b641_5b90_beb8_1f26_116cd98f3550["PluginContextExtension"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 8ff6b641_5b90_beb8_1f26_116cd98f3550
  50f2cc1b_69af_aadf_6019_aa52b3b31de6["PluginOption"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 50f2cc1b_69af_aadf_6019_aa52b3b31de6
  545df65b_7f67_94d3_e2e8_a592d5e64b8f["constants.ts"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f
  54e67a14_a437_c14e_bc06_6d4adc025099["typeUtils.ts"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 54e67a14_a437_c14e_bc06_6d4adc025099
  1bbf8164_8795_a5ec_63ef_9271e1d7bc6f["GetHookContextMap"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 1bbf8164_8795_a5ec_63ef_9271e1d7bc6f
  2e0042c0_33fb_8ee7_c6e4_29090e8f76ac["NonNeverKeys"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 2e0042c0_33fb_8ee7_c6e4_29090e8f76ac
  d66f2dc9_4443_4498_eccd_810b2e79a2b0["RollupPluginHooks"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> d66f2dc9_4443_4498_eccd_810b2e79a2b0
  693ca867_249b_3e5a_0ce1_8930413b7fcd["rolldown"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 693ca867_249b_3e5a_0ce1_8930413b7fcd
  467ed05a_7598_0637_2ccd_6d636455972a["utils"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 467ed05a_7598_0637_2ccd_6d636455972a
  6701bba9_3d8f_f5b8_c0a6_edc7752de5de["rollup"]
  f81cffe5_5872_74d5_0c1b_79b0ef8844af --> 6701bba9_3d8f_f5b8_c0a6_edc7752de5de
  style f81cffe5_5872_74d5_0c1b_79b0ef8844af fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * This is a development only file for testing types.
 */
import type { Plugin as RolldownPlugin } from 'rolldown'
import type { Equal, ExpectExtends, ExpectTrue } from '@type-challenges/utils'
import type { Plugin as RollupPlugin } from 'rollup'
import type { Plugin, PluginContextExtension, PluginOption } from '../plugin'
import type { ROLLUP_HOOKS } from '../constants'
import type {
  GetHookContextMap,
  NonNeverKeys,
  RollupPluginHooks,
} from '../typeUtils'

type EnvironmentPluginHooksContext = GetHookContextMap<Plugin>
type EnvironmentPluginHooksContextMatched = {
  [K in keyof EnvironmentPluginHooksContext]: EnvironmentPluginHooksContext[K] extends PluginContextExtension
    ? never
    : false
}

type HooksMissingExtension = NonNeverKeys<EnvironmentPluginHooksContextMatched>
type HooksMissingInConstants = Exclude<
  RollupPluginHooks,
  (typeof ROLLUP_HOOKS)[number]
>

export type cases = [
  // Ensure environment plugin hooks are superset of rollup plugin hooks
  ExpectTrue<ExpectExtends<RolldownPlugin, Plugin>>,

  // Ensure all Rollup hooks have Vite's plugin context extension
  ExpectTrue<Equal<HooksMissingExtension, never>>,

  // Ensure the `ROLLUP_HOOKS` constant is up-to-date
  ExpectTrue<Equal<HooksMissingInConstants, never>>,

  // Ensure all Vite plugins, Rolldown plugins, and Rollup plugins can be assigned to `plugins` option
  ExpectTrue<ExpectExtends<PluginOption, RolldownPlugin>>,
  ExpectTrue<ExpectExtends<PluginOption, RollupPlugin>>,
  ExpectTrue<ExpectExtends<PluginOption, Plugin>>,
]

export {}

Domain

Frequently Asked Questions

What does plugin.ts do?
plugin.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain.
What does plugin.ts depend on?
plugin.ts imports 12 module(s): GetHookContextMap, NonNeverKeys, Plugin, PluginContextExtension, PluginOption, RollupPluginHooks, constants.ts, plugin.ts, and 4 more.
Where is plugin.ts in the architecture?
plugin.ts is located at packages/vite/src/node/__tests_dts__/plugin.ts (domain: ViteCore, directory: packages/vite/src/node/__tests_dts__).

Analyze Your Own Codebase

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

Try Supermodel Free