Skip to content

feat: remove valtio dependency, inline proxy reactivity engine#52

Merged
Moon-DaeSeung merged 3 commits into
mainfrom
feat/remove-valtio-dependency
Mar 12, 2026
Merged

feat: remove valtio dependency, inline proxy reactivity engine#52
Moon-DaeSeung merged 3 commits into
mainfrom
feat/remove-valtio-dependency

Conversation

@Moon-DaeSeung
Copy link
Copy Markdown
Contributor

Summary

  • Removed valtio runtime dependency from packages/comwit
  • Implemented proxy reactivity engine inline in proxy.ts, based on valtio's source (MIT License)
  • Eliminated proxy-compare dependency by integrating native-object exclusion directly into canProxy() — only plain objects and arrays are proxied, which naturally handles File, Blob, Date, Map, etc. without the previous autoRefDeep/wrapWithAutoRef wrapper layer
  • es-toolkit is now the sole runtime dependency

What changed

  • packages/comwit/src/core/proxy.ts: Replaced valtio imports with ~220 lines of inline implementation covering proxy(), snapshot(), subscribe(), and ref()
  • packages/comwit/package.json: Removed valtio from dependencies

Test plan

  • All 232 tests pass (15 test files)
  • TypeScript typecheck passes
  • Vite build succeeds (ESM + CJS)
  • Proxy tests: reactivity, snapshots, subscriptions, batching, nested objects, arrays, native objects (File/Blob/Date/Map)

🤖 Generated with Claude Code

Replace valtio with a custom implementation based on valtio's source code
(MIT License). The proxy-compare dependency is also eliminated by integrating
native-object exclusion directly into canProxy() — only plain objects and
arrays are proxied, which naturally handles File, Blob, Date, Map, etc.

This removes the only non-es-toolkit runtime dependency, reducing bundle
size and giving full control over the reactivity engine.

All 232 tests pass, typecheck clean, build succeeds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comwit-docs Ready Ready Preview Mar 5, 2026 0:21am

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… objects

Replace proxyStateMap/refSet/snapCache/proxyCache with Symbol properties
stored directly on each object ($state via get trap, $ref/$snap/$proxy via
non-enumerable defineProperty). Two small fallback WeakMaps remain only for
non-extensible objects (frozen snapshots) which are inherently request-scoped.

This prevents shared mutable state at the module level for SSR safety.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Moon-DaeSeung Moon-DaeSeung reopened this Mar 5, 2026
@Moon-DaeSeung Moon-DaeSeung merged commit 27326a1 into main Mar 12, 2026
1 check passed
@Moon-DaeSeung Moon-DaeSeung deleted the feat/remove-valtio-dependency branch April 24, 2026 01:09
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