openpencil/vite/server.ts
Danila Poyarkov d16400b3e6 feat(editor): checkpoint live interaction improvements
Unify preview-aware transforms across scene drawing, labels, selection and input. Give live property and creation edits explicit preview ownership, preserve cancellation and one-step undo, and reuse bounded text preparation resources.

Include retained device-grid handling, worktree HMR coverage, and nested/reflected interaction regressions in this cohesive progress checkpoint.

Validation: full check passes; 734 scoped unit tests and 53 targeted browser tests pass. This is NOT merge-ready: the unchanged exact nested filled-section held/released regression still fails with 63 differing pixels (maximum channel delta 5/255). The browser pass count excludes that separately run failure and the previously classified paint-field-width baseline. Raster-origin investigation and broader acceptance remain outstanding.
2026-09-15 11:36:17 +03:00

42 lines
1.1 KiB
TypeScript

import { resolve } from 'node:path'
import { normalizePath, type ServerOptions } from 'vite'
const WATCHED_MARKDOWN_ROOTS = ['/src/', '/packages/core/src/', '/packages/vue/src/']
function ignoreMarkdownOutsideSource(path: string): boolean {
const normalized = normalizePath(path)
if (!normalized.endsWith('.md')) return false
return !WATCHED_MARKDOWN_ROOTS.some((root) => normalized.includes(root))
}
export const WATCH_IGNORED = [
'**/desktop/**',
'**/packages/cli/**',
'**/packages/mcp/**',
'**/packages/docs/**',
'**/tests/**',
'**/.github/**',
'**/.pi/**',
ignoreMarkdownOutsideSource
]
export function createDevServerOptions(host: string | undefined, rootDir: string): ServerOptions {
return {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: 'ws',
host,
port: 1421
}
: undefined,
watch: {
// Ignore nested checkouts, not an active checkout whose own path contains .worktrees.
ignored: [...WATCH_IGNORED, `${normalizePath(resolve(rootDir, '.worktrees'))}/**`]
}
}
}