ID:WORK-097Status:readyPriority:mediumComplexity:moderateMilestone:v1.0.0
Vite plugin — Level 2 cross-page pipeline
Implement the level: 'pipeline' mode that runs the full four-phase cross-page pipeline at build time, enabling breadcrumbs, nav, glossary auto-linking, and other entity-dependent features.
Acceptance Criteria
- When
level: 'pipeline'andcontentDirare set, plugin scans all.mdfiles incontentDiratbuildStart - Full pipeline runs via
runPipeline()from@refrakt-md/content: parse → register → aggregate → post-process - Entity registry is built (
EntityRegistryImpl) and available to all pages - Output modules include enriched
metawithentitiesandcrossPageDepsarrays - Cross-page runes (
breadcrumb,nav,glossary) render fully resolved content - Page hierarchy derived from file system relative to
contentDir; frontmatter can override title/slug - Pipeline results cached in memory; individual
transformcalls read from cache - Dev mode: file changes re-parse changed file; if entities change, dependent files are re-processed
@refrakt-md/contentis an optional peer dependency (only needed for Level 2)- Clear error message if
level: 'pipeline'is set but@refrakt-md/contentis not installed - Clear error message if
level: 'pipeline'is set butcontentDiris missing
Approach
- Implement
src/pipeline.ts— wrapsrunPipeline()with Vite build lifecycle hooks - In
buildStart: scancontentDir, run full pipeline, cache results - In
transform: read from cache instead of re-processing - In dev mode: use
handleHotUpdateto detect entity changes and selectively re-run pipeline phases - Reference
packages/sveltekit/src/plugin.tsfor existingbuildStartpipeline pattern
Dependencies
- WORK-094 — core plugin must exist first
- WORK-096 — HMR infrastructure for dev mode re-processing
References
- SPEC-031 (Level 2: Cross-Page Pipeline section)
packages/content/src/pipeline.ts—runPipeline()orchestratorpackages/content/src/registry.ts—EntityRegistryImpl