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 9e7eed30_d38a_0706_e488_dc489dabdb41["serve.ts"] 51e96894_3556_ed5c_1ede_97d449867adf["node:path"] 9e7eed30_d38a_0706_e488_dc489dabdb41 --> 51e96894_3556_ed5c_1ede_97d449867adf d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"] 9e7eed30_d38a_0706_e488_dc489dabdb41 --> d3fd5575_295b_d6be_24dd_62d277645dc9 b8bc32c3_2a2e_3dbd_c7f6_b60d2819000a["legacy-ssr.spec.ts"] b8bc32c3_2a2e_3dbd_c7f6_b60d2819000a --> 9e7eed30_d38a_0706_e488_dc489dabdb41 style 9e7eed30_d38a_0706_e488_dc489dabdb41 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/ssr']
export async function serve(): Promise<{ close(): Promise<void> }> {
const { build } = await import('vite')
await build({
root: rootDir,
logLevel: 'silent',
build: {
target: 'esnext',
ssr: 'entry-server.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.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
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-ssr.spec.ts.
Where is serve.ts in the architecture?
serve.ts is located at playground/legacy/__tests__/ssr/serve.ts (domain: ViteCore, subdomain: ConfigEngine, directory: playground/legacy/__tests__/ssr).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free