hooks.spec.ts — vite Source File
Architecture documentation for hooks.spec.ts, a typescript file in the vite codebase. 14 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3fd9950b_bcb7_a128_9aed_592d2aca94e6["hooks.spec.ts"] 45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 45981d85_cbdd_e969_8c88_c17072ea0eda bbded320_f805_2b6e_3109_088d194024a2["build"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> bbded320_f805_2b6e_3109_088d194024a2 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7["plugin.ts"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 5abb8c87_ffcb_f2d4_7421_e36705d9e5c7 1dc2cf7d_5d97_c778_8c33_6449a7607aef["Plugin"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 1dc2cf7d_5d97_c778_8c33_6449a7607aef 7da774f9_eca5_d54e_6e01_6bee7d460a2b["config.ts"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 7da774f9_eca5_d54e_6e01_6bee7d460a2b 58c4a210_68fe_1b4d_ed49_d59203f97ef1["resolveConfig"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 58c4a210_68fe_1b4d_ed49_d59203f97ef1 a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e["index.ts"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> a423a1ed_f7d8_0eb5_9b8f_ddfa7fa8147e 19009191_26ac_2526_d048_41ac02638e55["createServer"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 19009191_26ac_2526_d048_41ac02638e55 e49f0ff7_5101_3a1d_5a1f_33fae58eea2d["preview.ts"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> e49f0ff7_5101_3a1d_5a1f_33fae58eea2d 5c50110b_5c76_c14f_b1dd_3efd3df7f375["preview"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 5c50110b_5c76_c14f_b1dd_3efd3df7f375 abfc9e70_3c15_b3f0_a595_3cf27afb7e64["utils.ts"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> abfc9e70_3c15_b3f0_a595_3cf27afb7e64 5b95806c_6cb8_a9a6_1dd6_709fd3849415["promiseWithResolvers"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 5b95806c_6cb8_a9a6_1dd6_709fd3849415 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> 51e96894_3556_ed5c_1ede_97d449867adf a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 3fd9950b_bcb7_a128_9aed_592d2aca94e6 --> a340ba46_b2b7_3048_3bb3_6907a74c8464 style 3fd9950b_bcb7_a128_9aed_592d2aca94e6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import path from 'node:path'
import { describe, expect, onTestFinished, test } from 'vitest'
import { build } from '../../build'
import type { Plugin } from '../../plugin'
import { resolveConfig } from '../../config'
import { createServer } from '../../server'
import { preview } from '../../preview'
import { promiseWithResolvers } from '../../../shared/utils'
const resolveConfigWithPlugin = (
plugin: Plugin,
command: 'serve' | 'build' = 'serve',
) => {
return resolveConfig(
{ configFile: false, plugins: [plugin], logLevel: 'error' },
command,
)
}
const ENTRY_ID = 'entry.js'
const RESOLVED_ENTRY_ID = `\0${ENTRY_ID}`
const resolveEntryPlugin: Plugin = {
name: 'resolve-entry.js',
resolveId(id) {
if (id === ENTRY_ID) {
return RESOLVED_ENTRY_ID
}
},
load(id) {
if (id === RESOLVED_ENTRY_ID) {
return 'export default {}'
}
},
}
const createServerWithPlugin = async (plugin: Plugin) => {
const server = await createServer({
configFile: false,
root: import.meta.dirname,
plugins: [plugin, resolveEntryPlugin],
logLevel: 'error',
server: {
middlewareMode: true,
ws: false,
},
})
onTestFinished(() => server.close())
return server
}
const createPreviewServerWithPlugin = async (plugin: Plugin) => {
const server = await preview({
configFile: false,
root: import.meta.dirname,
plugins: [
{
name: 'mock-preview',
configurePreviewServer({ httpServer }) {
// NOTE: make httpServer.listen no-op to avoid starting a server
httpServer.listen = () => {
// ... (289 more lines)
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does hooks.spec.ts do?
hooks.spec.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 hooks.spec.ts?
hooks.spec.ts defines 6 function(s): buildWithPlugin, createPreviewServerWithPlugin, createServerWithPlugin, resolveConfigWithPlugin, resolveEntryPlugin.load, resolveEntryPlugin.resolveId.
What does hooks.spec.ts depend on?
hooks.spec.ts imports 14 module(s): Plugin, build, build.ts, config.ts, createServer, index.ts, node:path, plugin.ts, and 6 more.
Where is hooks.spec.ts in the architecture?
hooks.spec.ts is located at packages/vite/src/node/__tests__/plugins/hooks.spec.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node/__tests__/plugins).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free