server-runtime.spec.ts — vite Source File
Architecture documentation for server-runtime.spec.ts, a typescript file in the vite codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 02c9d455_3ec0_f4e3_4293_04777d5340b3["server-runtime.spec.ts"] abfc9e70_3c15_b3f0_a595_3cf27afb7e64["utils.ts"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> abfc9e70_3c15_b3f0_a595_3cf27afb7e64 e967e251_52a9_6dc8_9c8c_4a18ba126272["invokeMethods.ts"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> e967e251_52a9_6dc8_9c8c_4a18ba126272 ba79a14e_d4fe_46e0_631c_0732e4e091cd["ExternalFetchResult"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> ba79a14e_d4fe_46e0_631c_0732e4e091cd 01ea9ea3_8399_6861_2813_c2cb84e13dbd["utils.ts"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> 01ea9ea3_8399_6861_2813_c2cb84e13dbd b86d82d7_be96_2a5f_c2dd_462307e1507d["createModuleRunnerTester"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> b86d82d7_be96_2a5f_c2dd_462307e1507d e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> e6032fbc_44cf_58d6_868d_dd15106c18c5 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> 51e96894_3556_ed5c_1ede_97d449867adf 6feed3e8_55b8_cce7_b5ef_e40b872585f7["node:url"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> 6feed3e8_55b8_cce7_b5ef_e40b872585f7 a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 02c9d455_3ec0_f4e3_4293_04777d5340b3 --> a340ba46_b2b7_3048_3bb3_6907a74c8464 style 02c9d455_3ec0_f4e3_4293_04777d5340b3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { existsSync, readdirSync } from 'node:fs'
import { posix, win32 } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, vi } from 'vitest'
import { isWindows } from '../../../../shared/utils'
import type { ExternalFetchResult } from '../../../../shared/invokeMethods'
import { createModuleRunnerTester } from './utils'
const _URL = URL
describe('module runner initialization', async () => {
const it = await createModuleRunnerTester({
resolve: {
external: ['tinyglobby'],
},
})
it('correctly runs ssr code', async ({ runner }) => {
const mod = await runner.import('/fixtures/simple.js')
expect(mod.test).toEqual('I am initialized')
// loads the same module if id is a file url
const fileUrl = new _URL('./fixtures/simple.js', import.meta.url)
const mod2 = await runner.import(fileUrl.toString())
expect(mod).toBe(mod2)
// loads the same module if id is a file path
const filePath = fileURLToPath(fileUrl)
const mod3 = await runner.import(filePath)
expect(mod).toBe(mod3)
})
it('can load virtual modules as an entry point', async ({ runner }) => {
const mod = await runner.import('virtual:test')
expect(mod.msg).toBe('virtual')
// already resolved id works similar to `transformRequest`
expect(await runner.import(`\0virtual:normal`)).toMatchInlineSnapshot(`
{
"default": "ok",
}
`)
// escaped virtual module id works
expect(await runner.import(`/@id/__x00__virtual:normal`))
.toMatchInlineSnapshot(`
{
"default": "ok",
}
`)
// timestamp query works
expect(await runner.import(`virtual:normal?t=${Date.now()}`))
.toMatchInlineSnapshot(`
{
"default": "ok",
}
`)
// other arbitrary queries don't work
// ... (480 more lines)
Domain
Dependencies
- ExternalFetchResult
- createModuleRunnerTester
- invokeMethods.ts
- node:fs
- node:path
- node:url
- utils.ts
- utils.ts
- vitest
Source
Frequently Asked Questions
What does server-runtime.spec.ts do?
server-runtime.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain.
What does server-runtime.spec.ts depend on?
server-runtime.spec.ts imports 9 module(s): ExternalFetchResult, createModuleRunnerTester, invokeMethods.ts, node:fs, node:path, node:url, utils.ts, utils.ts, and 1 more.
Where is server-runtime.spec.ts in the architecture?
server-runtime.spec.ts is located at packages/vite/src/node/ssr/runtime/__tests__/server-runtime.spec.ts (domain: ViteCore, directory: packages/vite/src/node/ssr/runtime/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free