Skip to content

PR: merge fixed bun-first to main#36

Merged
miccy merged 111 commits intomainfrom
bun-first
Feb 14, 2026
Merged

PR: merge fixed bun-first to main#36
miccy merged 111 commits intomainfrom
bun-first

Conversation

@miccy
Copy link
Copy Markdown
Contributor

@miccy miccy commented Feb 14, 2026

Description

This pull request introduces several improvements and compatibility updates across the codebase, focusing on enhanced dependency injection, improved compatibility with upstream packages, and developer experience enhancements. The most significant changes include support for passing a custom console instance to Evolu dependencies, compatibility aliases for upstream common-v8, and improved hot-reloading for workspace packages. Additionally, there are minor documentation and type improvements.

Dependency Injection and Compatibility Improvements:

  • The createEvoluDeps function now accepts and preserves a provided console instance, allowing for custom logging and improved testability. [1] [2] [3]
  • Added compatibility aliases for upstream common-v8:
    • Introduced AppName type and appName config option as a deprecated alias for name in EvoluConfig, ensuring smoother migration and compatibility. [1] [2] [3] [4]
    • Added createRun as a deprecated alias for createRunner in the Node.js package. [1] [2] [3]

Developer Experience and Workspace Enhancements:

  • The web app's Next.js config now resolves workspace @evolu/* packages to TypeScript sources and supports live reload with proper extension aliasing, improving local development workflow.
  • Added documentation for using Bun's hot mode to iterate on schema and mutations, with notes about local state resets during development.

Other Notable Changes:

  • Exports and type declarations were updated for improved clarity and compatibility, including new exports for AppName and AppNameError. [1] [2]
  • Minor corrections and documentation improvements in changeset files and type guard naming conventions. [1] [2] [3] [4] [5] [6] [7]

Dependency Updates:

  • Updated several package dependencies, including typedoc and added @emotion/is-prop-valid to the web app. [1] [2]

These changes collectively improve the flexibility, compatibility, and developer experience of the Evolu codebase.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Checklist

  • Code follows project style guidelines
  • Tests pass locally (bun run check)
  • Documentation updated (if applicable)
  • No secrets or sensitive data included

Related Issues

Summary by CodeRabbit

  • New Features

    • Added zipArray array utility function
    • New console output utilities for storing and observing log entries
    • AppName configuration option for app identification
  • Bug Fixes

    • Improved error handling for invalid data parsing in worker initialization
  • Documentation

    • Added Bun hot-reload workflow guide for schema iteration
  • Refactor

    • Renamed console logging functions for clarity (getEntriesSnapshot, clearEntries)
    • Modernized worker APIs with property-based messaging and resource cleanup support
    • Enhanced build configuration for TypeScript source resolution
  • Chores

    • Updated dev dependencies (turbo, typedoc)
    • Added Emotion validation dependency

steida added 30 commits February 2, 2026 12:16
Replace the old runMain pattern with a shutdown-aware createRunner that injects a shutdown promise into deps and installs global signal and error handlers (SIGINT, SIGTERM, SIGHUP, uncaughtException, unhandledRejection). Move Node.js runner wiring into packages/nodejs/src/Task.ts, resolve shutdown via process signals, and ensure listeners are cleaned up on runner dispose. Rename relay APIs: createNodeJsRelayBetterSqliteDeps -> createRelayDeps and createNodeJsRelay -> startRelay, update examples and the apps/relay entry to use startRelay and createRunner. Simplify task typing in packages/common (introduce AnyTask and use it in InferTask* helpers, add CreateRunner type, remove MainTask), and adjust the local-first Relay implementation to handle sqlite errors by logging and returning ok(stack). Update tests to reflect the new createRunner/shutdown behavior and to verify signal/error handling and listener cleanup. README updated to reflect the API rename.
Introduce a browser-specific Task runner and tests. Implements createRunner in packages/web/src/Task.ts that composes the common runner, creates a console child named "global", registers global "error" and "unhandledrejection" handlers (logging via createUnknownError), and removes those listeners when the runner is disposed. Adds vitest tests in packages/web/test/Task.test.ts to verify custom deps merging, mocked listener registration/removal, real-event logging for ErrorEvent and PromiseRejectionEvent, and that handlers are detached after disposal.
Update packages/nodejs/package.json to change the "files" entry from "dist/**" to "dist/src/**". This restricts what gets packaged/published (avoiding unrelated files under dist), reducing package size and ensuring only the compiled source artifacts and src are included.
Consolidate imports and stop passing a custom time provider to createConsoleEntryFormatter in apps/relay/src/index.ts. The createTime import and its usage were removed so the formatter uses its default time handling, and the import statement was simplified.
Update pnpm-lock.yaml to refresh multiple dependency versions and integrity hashes. Notable bumps: @algolia/autocomplete-core/plugin/shared 1.19.4 -> 1.19.5, framer-motion & motion 12.30.1 -> 12.31.0, enhanced-resolve 5.18.4 -> 5.19.0, and dotenv 16.4.7 -> 16.6.1. Snapshots/resolutions updated accordingly — this is an automated lockfile refresh to keep transitive deps in sync.
Switch example projects to use local workspace packages and a centralized React catalog. Updated @evolu/* dependencies from "latest" to "workspace:*" and replaced direct React/ReactDOM version pins (19.1.0) with "catalog:react19" where applicable across: angular-vite-pwa, react-electron, react-expo, react-nextjs, react-vite-pwa, and vue-vite-pwa. This ensures examples resolve local workspace packages and share a single React version definition.
Introduce a root vitest.config.ts and split package test configs into unit and browser projects (packages/common/vitest.unit.config.ts, packages/common/vitest.browser.config.ts). Remove the old combined common vitest config and migrate per-package coverage/test settings into the central config. Update package.json scripts to run Vitest from the repo root, remove per-package Vitest deps where appropriate, and add browser/playwright-related devDeps at the root. Adjust tsconfigs (add root tsconfig.json and include vitest.*.config.ts in packages/common) and simplify turbo.json task entries. Also add a README link to the Vitest VS Code extension.
Replace the brief Test-driven development note with an expanded TDD section that explains how to run tests, test file locations, and filtering by test name. Add subsections on test structure, type testing (expectTypeOf), and inline snapshot usage with Vitest code examples. Remove the previous Vitest filtering CLI snippets and some commit-message examples to streamline the guidance and surface more actionable testing patterns for contributors.
Rename vitest.config.ts → vitest.config.mts (switch to .mts/ESM), update tsconfig include to reference vitest.config.mts, and add a new "scripts" test project in the Vitest config to include tests matching scripts/**/*.test.mts. Also simplify package.json "verify" script by removing the generic "pnpm test" step.
Introduce a standalone createQueryBuilder(Schema) to build typed Kysely queries without an Evolu instance. The createQuery implementation was moved into packages/common/src/local-first/Schema.ts and exported from index.ts; Evolu.createQuery was removed from the Evolu interface/instance. Updated usages across playgrounds to call createQuery(...) (created via createQueryBuilder) and adjusted types/docs in Query.ts. Added a changeset noting the API migration and guidance to replace evolu.createQuery with createQueryBuilder(Schema).
Copilot AI and others added 14 commits February 13, 2026 21:03
Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
…rove type safety

Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
Remove ESLint from react-vite-pwa example
Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
[WIP] Update tooling and documentation for monorepo management
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

This pull request introduces multiple interconnected changes: a worker abstraction refactoring with new tab messaging (InitTab/InitEvolu), console system overhaul with renamed APIs and new output factories, AppName as a new public type with validation, ConsoleDep dependency injection into Evolu setup, error handling migration to evoluError store, Next.js configuration enhancements, and various utility additions alongside documentation updates.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/array-module-refactor.md, .changeset/console-improved.md, .changeset/lovely-aliens-camp.md, .changeset/set-module.md, .changeset/spotty-coats-sort.md, .changeset/worker-abstraction-refactor.md
Changelog entries documenting new zipArray function, console API refactoring (function renames, new output factories), worker abstraction changes (interface replacements, message protocol updates), and minor wording/capitalization corrections.
Console System Refactoring
packages/common/src/local-first/Evolu.ts, packages/react-web/src/local-first/Evolu.ts, packages/web/src/local-first/Evolu.ts, packages/react-web/src/index.ts, packages/web/src/local-first/Evolu.ts
Added ConsoleDep type imports and parameter to createEvoluDeps functions; introduced writeConsoleEntry helper for routing console entries; integrated console instance management and evoluError store into dependency wiring.
Worker & Tab Messaging Refactoring
packages/common/src/local-first/Worker.ts, packages/common/test/local-first/Worker.test.ts
Replaced InitErrorStoreMessage/InitEvoluMessage with InitTab/InitEvolu variants carrying NativeMessagePort; introduced EvoluTabOutput type for console and error outputs; refactored runEvoluWorkerScope to manage tab ports, buffer outputs, and dispatch via tab channel.
AppName Feature
packages/common/src/local-first/Evolu.ts, packages/common/src/index.ts
Added AppName brand validator and AppNameError type; deprecated appName property as alias to name in EvoluConfig; exported AppName and AppNameError from common package; implemented name derivation fallback chain (configName | appName | "default").
Evolu Dependencies & Error Handling
packages/common/src/local-first/Evolu.ts, packages/common/test/local-first/Evolu.test.ts
Extended EvoluPlatformDeps and EvoluDeps to include ConsoleDep and RandomBytesDep; created evoluError store in createEvoluDeps wired via tab channel messaging; replaced local createErrorStore with centralized EvoluError store; added test coverage for appName compatibility and tab output handling.
Build Configuration & Dependencies
apps/web/next.config.mjs, apps/web/package.json, package.json, packages/common/package.json, packages/web/package.json
Added Next.js transpilePackages configuration for workspace @evolu/\* packages; customized webpack module resolution with conditionNames and extensionAlias for TypeScript sources; bumped turbo and typedoc versions; added @emotion/is-prop-valid dependency; added "source" export entries to package.json files; prepended environment variable defaults to sync:guard scripts.
Worker Types & Interfaces
packages/common/src/local-first/Worker.ts, packages/common/test/local-first/Evolu.test.ts
Replaced WorkerScope and SharedWorkerScope interfaces with WorkerSelf and SharedWorkerSelf wrappers; changed onMessage from method to property; made all worker and message port interfaces Disposable; added Output = never default generic; replaced createWorkerScope/createSharedWorkerScope with createWorkerSelf/createSharedWorkerSelf factory functions.
Utility Functions & Aliases
packages/nodejs/src/Task.ts, packages/nodejs/test/Task.test.ts, packages/web/src/local-first/DbWorker.ts
Added createRun as deprecated public alias to createRunner in Task module; introduced safeParseAppOwner helper in DbWorker for graceful JSON parsing with null fallback instead of throwing errors; added test coverage for createRun alias.
Documentation & Examples
apps/web/src/app/(docs)/docs/local-first/page.mdx, apps/web/src/app/(playgrounds)/playgrounds/minimal/EvoluMinimalExample.tsx
Added Bun hot workflow guide with schema iteration example and local state reset instructions; migrated error handling from evolu.subscribeError to deps.evoluError stream with alert display.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant Evolu as Evolu (Main)
    participant TabChannel as Tab Channel
    participant Worker as Evolu Worker
    participant Console as Console Instance

    App->>Evolu: createEvoluDeps(deps)
    Evolu->>Evolu: Create console instance
    Evolu->>Evolu: Create evoluError store
    Evolu->>Evolu: Create EvoluTabChannel
    Evolu->>Worker: Post InitTab with tab port
    
    Note over Worker: Register tab port<br/>in tabPorts set
    
    Worker-->>TabChannel: ConsoleEntry message
    TabChannel->>Evolu: Receive ConsoleEntry
    Evolu->>Console: writeConsoleEntry(entry)
    
    Worker-->>TabChannel: EvoluError message
    TabChannel->>Evolu: Receive EvoluError
    Evolu->>Evolu: Update evoluError store
    Evolu-->>App: Error state available
    
    App->>Evolu: createEvolu(deps)
    Evolu->>Evolu: Retrieve evoluError from deps
    Evolu-->>App: Evolu instance with<br/>error handling
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes


🐰 A refactor hops through with mighty grace,
Tab channels carry messages to their place,
Workers Self now dance with types so true,
Console and errors flow, AppName brand anew!
The Evolu realm evolves—what joy we see! 🎉


Note

🎁 Summarized by CodeRabbit Free

The PR author is not assigned a seat. To perform a comprehensive line-by-line review, please assign a seat to the pull request author through the subscription management page by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@miccy miccy self-assigned this Feb 14, 2026
@miccy miccy added upstream Needs cherry-pick or merge from upstream update Update libs and deps labels Feb 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request merges the bun-first branch into main, introducing several compatibility and developer experience improvements. The changes focus on enhanced dependency injection for custom console instances, compatibility aliases for upstream common-v8, improved hot-reloading for workspace packages, and minor documentation corrections.

Changes:

  • Added support for passing custom console instances through dependency injection in web/react-web packages
  • Introduced AppName and createRun compatibility aliases for upstream common-v8 migration
  • Enhanced Next.js config to support hot-reloading of workspace TypeScript sources
  • Added safeParseAppOwner error handling and documentation for Bun hot mode workflow

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/web/src/local-first/Evolu.ts Added ConsoleDep parameter to createEvoluDeps
packages/react-web/src/local-first/Evolu.ts Added ConsoleDep parameter to createEvoluDeps
packages/react-web/src/index.ts Added ConsoleDep parameter to createEvoluDeps
packages/web/src/local-first/DbWorker.ts Added safeParseAppOwner for error handling
packages/nodejs/src/Task.ts Added createRun as deprecated alias for createRunner
packages/nodejs/test/Task.test.ts Added test for createRun alias compatibility
packages/common/src/local-first/Evolu.ts Added AppName compatibility type, made EvoluConfig.name optional, preserved console in createEvoluDeps
packages/common/test/local-first/Evolu.test.ts Added tests for console preservation and appName compatibility
packages/common/src/index.ts Exported AppName and AppNameError
packages/common/package.json Added "source" export condition
packages/web/package.json Added "source" export condition
apps/web/next.config.mjs Added webpack config for workspace source hot-reload
apps/web/package.json Added @emotion/is-prop-valid dependency
apps/web/src/app/(docs)/docs/local-first/page.mdx Added Bun hot mode documentation
package.json Updated sync:guard scripts to use bun-first reference, updated typedoc
bun.lock Dependency version updates
.changeset/*.md Minor documentation corrections

miccy and others added 2 commits February 14, 2026 02:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Miccy <code@miccy.dev>
@miccy miccy marked this pull request as ready for review February 14, 2026 01:49
@miccy miccy requested a review from Copilot February 14, 2026 01:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated no new comments.

@miccy miccy merged commit 5554d86 into main Feb 14, 2026
11 checks passed
@miccy miccy deleted the bun-first branch February 22, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

update Update libs and deps upstream Needs cherry-pick or merge from upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants