one
Version:
One is a new React Framework that makes Vite serve both native and web.
12 lines (10 loc) • 456 B
text/typescript
import { posix } from 'node:path'
// idempotent. returns forward-slash output. accepts backslash input from legacy path.join-shaped callers.
export function toServerOutputPath(input: string, outDir: string): string {
const normalized = input.replace(/\\/g, '/')
const prefix = `${outDir}/server/`
if (normalized === `${outDir}/server` || normalized.startsWith(prefix)) {
return normalized
}
return posix.join(outDir, 'server', normalized)
}