Skip to content

refactor!: Introduce subpath exports and remove server-registry abstraction in loro-adaptors#25

Merged
zxch3n merged 2 commits intomainfrom
fix-adaptor-expose
Nov 20, 2025
Merged

refactor!: Introduce subpath exports and remove server-registry abstraction in loro-adaptors#25
zxch3n merged 2 commits intomainfrom
fix-adaptor-expose

Conversation

@zxch3n
Copy link
Copy Markdown
Member

@zxch3n zxch3n commented Nov 20, 2025

This commit refactors the loro-adaptors package to improve modularity and
make peer dependencies truly optional.

Previously, importing from loro-adaptors would implicitly pull in all
peer dependencies, leading to "Could not resolve" errors if a user only
intended to use a subset of adaptors (e.g., only flock without loro-crdt).
Additionally, the server-registry abstraction was identified as unnecessary.

This change addresses these issues by:

  • Introducing subpath exports for specific adaptor groups:
    • loro-adaptors/loro: Exports LoroAdaptor, LoroEphemeralAdaptor,
      LoroPersistentStoreAdaptor, EloAdaptor, and their server counterparts.
      This requires loro-crdt as a peer dependency.
    • loro-adaptors/flock: Exports FlockAdaptor and FlockServerAdaptor.
      This requires @loro-dev/flock as a peer dependency.
    • loro-adaptors/yjs: Exports YjsAwarenessServerAdaptor for Yjs awareness.
      This requires yjs as a peer dependency.
  • Refactoring src/index.ts to only export general types and core utilities,
    effectively making it a lean entry point without direct adaptor implementations.
  • Removing src/server/server-registry.ts and the AdaptorsForServer interface
    from src/types.ts, as this abstraction was deemed unnecessary.
  • Updating package.json exports and tsdown.config.ts entry points to reflect
    the new modular structure.
  • Updating README.md with revised installation instructions and usage examples
    for the new subpath imports.

…stry abstraction

This commit refactors the `loro-adaptors` package to improve modularity and
make peer dependencies truly optional.

Previously, importing from `loro-adaptors` would implicitly pull in all
peer dependencies, leading to "Could not resolve" errors if a user only
intended to use a subset of adaptors (e.g., only `flock` without `loro-crdt`).
Additionally, the `server-registry` abstraction was identified as unnecessary.

This change addresses these issues by:

- Introducing subpath exports for specific adaptor groups:
    - `loro-adaptors/loro`: Exports `LoroAdaptor`, `LoroEphemeralAdaptor`,
      `LoroPersistentStoreAdaptor`, `EloAdaptor`, and their server counterparts.
      This requires `loro-crdt` as a peer dependency.
    - `loro-adaptors/flock`: Exports `FlockAdaptor` and `FlockServerAdaptor`.
      This requires `@loro-dev/flock` as a peer dependency.
    - `loro-adaptors/yjs`: Exports `YjsAwarenessServerAdaptor` for Yjs awareness.
      This requires `yjs` as a peer dependency.
- Refactoring `src/index.ts` to only export general types and core utilities,
  effectively making it a lean entry point without direct adaptor implementations.
- Removing `src/server/server-registry.ts` and the `AdaptorsForServer` interface
  from `src/types.ts`, as this abstraction was deemed unnecessary.
- Updating `package.json` `exports` and `tsdown.config.ts` entry points to reflect
  the new modular structure.
- Updating `README.md` with revised installation instructions and usage examples
  for the new subpath imports.
@zxch3n zxch3n changed the title feat(loro-adaptors): Introduce subpath exports and remove server-registry abstraction refactor!: Introduce subpath exports and remove server-registry abstraction in loro-adaptors Nov 20, 2025
@zxch3n zxch3n merged commit d5f2460 into main Nov 20, 2025
2 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 20, 2025
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