serve.ts — vite Source File
Architecture documentation for serve.ts, a typescript file in the vite codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR f712e8cd_d635_d42c_a01f_23491c6b2d29["serve.ts"] 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] f712e8cd_d635_d42c_a01f_23491c6b2d29 --> 51e96894_3556_ed5c_1ede_97d449867adf d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"] f712e8cd_d635_d42c_a01f_23491c6b2d29 --> d3fd5575_295b_d6be_24dd_62d277645dc9 6ad2ca38_b7b8_cd8b_af67_15d93c353f2b["legacy-client-legacy-ssr-sequential-builds.spec.ts"] 6ad2ca38_b7b8_cd8b_af67_15d93c353f2b --> f712e8cd_d635_d42c_a01f_23491c6b2d29 style f712e8cd_d635_d42c_a01f_23491c6b2d29 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// this is automatically detected by playground/vitestSetup.ts and will replace
// the default e2e test serve behavior
import path from 'node:path'
import { ports, rootDir } from '~utils'
export const port = ports['legacy/client-and-ssr']
export async function serve(): Promise<{ close(): Promise<void> }> {
const { build } = await import('vite')
await build({
mode: 'test',
root: rootDir,
logLevel: 'silent',
build: {
target: 'esnext',
outDir: 'dist/client',
},
})
await build({
mode: 'test',
root: rootDir,
logLevel: 'silent',
build: {
target: 'esnext',
ssr: 'entry-server-sequential.js',
outDir: 'dist/server',
},
})
const { default: express } = await import('express')
const app = express()
app.use('/', async (_req, res) => {
const { render } = await import(
path.resolve(rootDir, './dist/server/entry-server-sequential.js')
)
const html = await render()
res.status(200).set({ 'Content-Type': 'text/html' }).end(html)
})
return new Promise((resolve, reject) => {
try {
const server = app.listen(port, () => {
resolve({
// for test teardown
async close() {
await new Promise((resolve) => {
server.close(resolve)
})
},
})
})
} catch (e) {
reject(e)
}
})
}
Domain
Subdomains
Functions
Dependencies
- node:path
- ~utils
Imported By
Source
Frequently Asked Questions
What does serve.ts do?
serve.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 serve.ts?
serve.ts defines 1 function(s): serve.
What does serve.ts depend on?
serve.ts imports 2 module(s): node:path, ~utils.
What files import serve.ts?
serve.ts is imported by 1 file(s): legacy-client-legacy-ssr-sequential-builds.spec.ts.
Where is serve.ts in the architecture?
serve.ts is located at playground/legacy/__tests__/client-and-ssr/serve.ts (domain: ViteCore, subdomain: ConfigEngine, directory: playground/legacy/__tests__/client-and-ssr).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free