* feat(lint): suggest converting groups to frames and deleting hidden layers no-groups and no-hidden-layers now carry suggestions the Lint panel, the lint_fix tool and editor.applyLintFixes can apply. A group becomes a frame in place, keeping its id, children, bounds and look; a hidden layer is deleted with its children. Neither is offered for locked layers or inside components and instances, and both are checked again when applied. The editor gains convertGroupToFrame and deleteNodes, which deleteSelected now uses, and applies lint fixes through a bridge so structure changes and property updates share one undo step. lint_fix becomes a document mutation because atomic tools cannot remove layers. * fix(code): keep canvas edits made while replaced code waits to render Replacing all the code drops its layer links until the preview links it again, so a canvas edit in the preview delay could not be patched into the code and the preview drew over it. Edits made while code waits to render are now applied again once the preview has linked the code, in the same undo step, and reach the code like any other canvas change. * fix(figma-api): default paint opacity and visibility like Figma Plugin scripts may leave out a paint's opacity and visible; Figma reads them back as 1 and true. The fills and strokes setters stored the paint as given, so the Design panel received an undefined opacity. * build(dev): forward only errors from the browser console Vite forwards browser logs when an agent starts the dev server. Serializing a Vue warning's component props walks the editor state and freezes the tab, so warnings stay in the browser console. * fix(code): follow values while they are dragged or scrubbed Live previews change layers without a new scene version, so the code kept the old value until the gesture ended. The Code tab now follows preview updates once per frame, as the Design panel does, and goes back when the gesture is cancelled. * fix(code): keep canvas edits when the replaced code fails to preview A failed preview took the canvas edits waiting for it and dropped them, and stopped recording new ones, so correcting the code drew over them. The edits now wait for the next preview.
46 lines
1.4 KiB
TypeScript
46 lines
1.4 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,
|
|
// Vite forwards browser logs to the terminal when an agent starts it. Vue warnings carry the
|
|
// component's props, and serializing the editor state behind them freezes the tab, so only
|
|
// errors are forwarded.
|
|
forwardConsole: { unhandledErrors: true, logLevels: ['error'] },
|
|
watch: {
|
|
// Ignore nested checkouts, not an active checkout whose own path contains .worktrees.
|
|
ignored: [...WATCH_IGNORED, `${normalizePath(resolve(rootDir, '.worktrees'))}/**`]
|
|
}
|
|
}
|
|
}
|