Skip to content

refactor: extract @mdview/core and monorepo structure#39

Merged
jamesainslie merged 26 commits intomainfrom
electron-phase-1-extract-core
Mar 20, 2026
Merged

refactor: extract @mdview/core and monorepo structure#39
jamesainslie merged 26 commits intomainfrom
electron-phase-1-extract-core

Conversation

@jamesainslie
Copy link
Owner

Summary

  • Establishes npm workspaces monorepo with packages/core/ and packages/chrome-ext/
  • Extracts all platform-agnostic modules into @mdview/core (types, themes, comments, renderers, utilities, workers, export)
  • Defines adapter interfaces (StorageAdapter, MessagingAdapter, FileAdapter, IdentityAdapter, ExportAdapter) for platform abstraction
  • Refactors Chrome-dependent modules to accept adapters via constructor injection
  • Moves Chrome extension source to packages/chrome-ext/ with @mdview/core as workspace dependency
  • Fixes pre-existing test failures in vi.mock factories for Node built-ins and class constructors

Test plan

  • All 1207 tests pass (up from 929 at start, 0 failures)
  • Core package tests validate adapter contracts and barrel exports
  • Chrome extension tests pass with updated import paths
  • Pre-push hook gate passes on all commits

Move dom-purifier, skeleton-renderer, and scroll-manager to
packages/core/src/utils/ and replace originals with re-export shims.
Update render-pipeline and its test to use local imports. Add dompurify
dependency to @mdview/core package.json.
Move worker-pool, render-worker, and task modules (parse, highlight,
mermaid) to packages/core/src/workers/. Original files replaced with
re-export shims. Worker-pool uses createDebug() for platform-agnostic
logging instead of importing the Chrome-specific debug singleton.
…structors

native-host.test.ts: provide explicit mock factories for 'fs' and 'os'
since vitest auto-mocking doesn't work with Node built-ins.

comment-manager.test.ts: convert vi.fn() constructor mocks from arrow
functions to function(this) syntax since arrow functions can't be used
as constructors with `new`.
@jamesainslie jamesainslie merged commit 7805588 into main Mar 20, 2026
0 of 2 checks passed
@jamesainslie jamesainslie deleted the electron-phase-1-extract-core branch March 20, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant