Skip to content

y-partyserver: extract withYjs mixin#348

Merged
threepointone merged 3 commits intomainfrom
yjs-mixin
Feb 25, 2026
Merged

y-partyserver: extract withYjs mixin#348
threepointone merged 3 commits intomainfrom
yjs-mixin

Conversation

@threepointone
Copy link
Collaborator

Extract Yjs functionality into a withYjs mixin that can be applied to any Server subclass.

Changes

  • withYjs(Base) — new exported mixin function. All Yjs logic (document management, sync protocol, awareness tracking, persistence, custom messages) lives inside this mixin. Can be applied to any class extending Server:
    import { Server } from "partyserver";
    import { withYjs } from "y-partyserver";
    
    class MyCustomYjsServer extends withYjs(Server) {
      // has full Yjs functionality
    }
  • YServer — now defined as withYjs(Server), fully backward-compatible
  • YjsInstance / YjsStatic — new exported interfaces describing the mixin's instance and static members

Verification

  • Type checking passes
  • Build passes (ESM + CJS + .d.ts)
  • All 23 existing tests pass with no changes

Add a .changeset and refactor y-partyserver to extract all Yjs-related functionality into a withYjs mixin. Replace the previous YServer class with a composable withYjs(Base) that provides document, lifecycle hooks, message/awareness handling, custom message API, unstable_replaceDocument, and static callbackOptions. Re-export YServer as withYjs(Server). Debounced persistence now reads debounce options from the mixin constructor. This preserves existing behavior while making the Yjs features reusable across Server subclasses.
@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: c0d0112

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
y-partyserver Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

hono-party

npm i https://pkg.pr.new/cloudflare/partykit/hono-party@348

partyfn

npm i https://pkg.pr.new/cloudflare/partykit/partyfn@348

partyserver

npm i https://pkg.pr.new/cloudflare/partykit/partyserver@348

partysocket

npm i https://pkg.pr.new/cloudflare/partykit/partysocket@348

partysub

npm i https://pkg.pr.new/cloudflare/partykit/partysub@348

partysync

npm i https://pkg.pr.new/cloudflare/partykit/partysync@348

partytracks

npm i https://pkg.pr.new/cloudflare/partykit/partytracks@348

partywhen

npm i https://pkg.pr.new/cloudflare/partykit/partywhen@348

y-partyserver

npm i https://pkg.pr.new/cloudflare/partykit/y-partyserver@348

commit: c0d0112

Update dependencies: bump partysocket to ^1.1.16 (packages/partyfn) and standardize partyserver version ranges from ">=0.3.1" to "^0.3.1" across packages (partysub, partysync, partywhen, y-partyserver). package-lock.json updated to reflect the new versions for consistent dependency resolution.
Trim stray blank lines in CHANGELOG.md files to improve formatting. Cleaned up extraneous empty lines in packages/partyserver/CHANGELOG.md, packages/partysocket/CHANGELOG.md, and packages/y-partyserver/CHANGELOG.md; no substantive changes to release notes.
@threepointone threepointone merged commit ca6f28f into main Feb 25, 2026
6 checks passed
@threepointone threepointone deleted the yjs-mixin branch February 25, 2026 00:38
@github-actions github-actions bot mentioned this pull request Feb 25, 2026
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