WORK-096
ID:WORK-096Status:ready

Vite plugin — dev server HMR

Implement hot module replacement for .md file changes during development. When a markdown file is saved, re-transform it and trigger a page update.

Priority:mediumComplexity:simpleMilestone:v1.0.0Source:SPEC-031
changeset-release/main View source

Criteria completion

No incremental history — criteria tracking started on Apr 19.

Branches 2
changeset-release/main current ready
claude/file-naming-convention-LJdwR readymain ready
History 4
  1. f2b3512
    Content editedby Claude
    Add {ID}-{slug}.md filename convention + migrate filenames subcommand
  2. 59ded4a
    Content editedby Claude
    Implement SPEC-037 plan package hardening: all 7 work items
  3. f262d7b
    Content editedby Claude
    Backfill source attributes on all 123 work items
  4. 027eaee
    Created (ready)by Claude
    Add SPEC-031 work items for @refrakt-md/vite plugin (WORK-094 through WO

Acceptance Criteria

  • File watcher detects .md changes in dev mode
  • Changed file is re-transformed through the full pipeline (parse → transform → render)
  • Vite module graph is invalidated for the changed file via server.moduleGraph.invalidateModule()
  • Browser receives update (full reload — same approach as existing sveltekit HMR)
  • Level 2 warnings for cross-page runes display in terminal on file change
  • No unnecessary re-transforms of unchanged files in Level 1 mode

Approach

  1. Implement src/hmr.ts — hooks into Vite's configureServer and handleHotUpdate
  2. On .md file change: invalidate module, send full reload
  3. Reference packages/sveltekit/src/content-hmr.ts for existing pattern

Dependencies

  • WORK-094 — core plugin must exist first

References

  • SPEC-031 (Dev Server section)
  • packages/sveltekit/src/content-hmr.ts — existing HMR implementation