Home / File/ hmr-ssr.spec.ts — vite Source File

hmr-ssr.spec.ts — vite Source File

Architecture documentation for hmr-ssr.spec.ts, a typescript file in the vite codebase. 7 imports, 0 dependents.

File typescript ViteCore ConfigEngine 7 imports 8 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  2f2e510b_d491_14bf_c7ee_0c390a8b3218["hmr-ssr.spec.ts"]
  e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"]
  2f2e510b_d491_14bf_c7ee_0c390a8b3218 --> e6032fbc_44cf_58d6_868d_dd15106c18c5
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  2f2e510b_d491_14bf_c7ee_0c390a8b3218 --> 51e96894_3556_ed5c_1ede_97d449867adf
  d55a9cec_90e1_f4ad_d084_e5cf07bdef40["node:events"]
  2f2e510b_d491_14bf_c7ee_0c390a8b3218 --> d55a9cec_90e1_f4ad_d084_e5cf07bdef40
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  2f2e510b_d491_14bf_c7ee_0c390a8b3218 --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  54c37fea_4fe7_2693_71cb_1276b77f55f9["vite"]
  2f2e510b_d491_14bf_c7ee_0c390a8b3218 --> 54c37fea_4fe7_2693_71cb_1276b77f55f9
  9ca835cf_b489_83a7_91dd_00ed2ef4e6f6["module-runner"]
  2f2e510b_d491_14bf_c7ee_0c390a8b3218 --> 9ca835cf_b489_83a7_91dd_00ed2ef4e6f6
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  2f2e510b_d491_14bf_c7ee_0c390a8b3218 --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style 2f2e510b_d491_14bf_c7ee_0c390a8b3218 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs'
import { posix, resolve } from 'node:path'
import EventEmitter from 'node:events'
import {
  afterAll,
  beforeAll,
  describe,
  expect,
  onTestFinished,
  test,
  vi,
} from 'vitest'
import type {
  InlineConfig,
  Plugin,
  RunnableDevEnvironment,
  ViteDevServer,
} from 'vite'
import { createRunnableDevEnvironment, createServer } from 'vite'
import type { ModuleRunner } from 'vite/module-runner'
import {
  addFile,
  createInMemoryLogger,
  editFile,
  isBuild,
  promiseWithResolvers,
  readFile,
  removeFile,
  slash,
  testDir,
} from '~utils'

let server: ViteDevServer
const clientLogs: string[] = []
const serverLogs: string[] = []
let runner: ModuleRunner

const logsEmitter = new EventEmitter()

afterAll(async () => {
  await server?.close()
})

const hmr = (key: string) => (globalThis.__HMR__[key] as string) || ''

const updated = (file: string, via?: string) => {
  if (via) {
    return `[vite] hot updated: ${file} via ${via}`
  }
  return `[vite] hot updated: ${file}`
}

if (!isBuild) {
  describe('hmr works correctly', () => {
    const hotEventCounts = { connect: 0, disconnect: 0 }

    beforeAll(async () => {
      function hotEventsPlugin(): Plugin {
        return {
          name: 'hot-events',
// ... (1129 more lines)

Domain

Subdomains

Classes

Dependencies

  • module-runner
  • node:events
  • node:fs
  • node:path
  • vite
  • vitest
  • ~utils

Frequently Asked Questions

What does hmr-ssr.spec.ts do?
hmr-ssr.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 hmr-ssr.spec.ts?
hmr-ssr.spec.ts defines 8 function(s): hmr, isWatched, logs, setupModuleRunner, untilConsoleLog, untilConsoleLogAfter, updated, waitForWatcher.
What does hmr-ssr.spec.ts depend on?
hmr-ssr.spec.ts imports 7 module(s): module-runner, node:events, node:fs, node:path, vite, vitest, ~utils.
Where is hmr-ssr.spec.ts in the architecture?
hmr-ssr.spec.ts is located at playground/hmr-ssr/__tests__/hmr-ssr.spec.ts (domain: ViteCore, subdomain: ConfigEngine, directory: playground/hmr-ssr/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free