Skip to content

feat(rsc): ability to register server function via plugins#1310

Merged
hi-ogawa merged 25 commits into
mainfrom
server-reference-claims
Jul 24, 2026
Merged

feat(rsc): ability to register server function via plugins#1310
hi-ogawa merged 25 commits into
mainfrom
server-reference-claims

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Previously our builtin server function support owned manager.serverReferenceMetaMap lifecycle entirely i.e. only use server directive can participate in server function logic. This change is aimed to extend the serverReferenceMetaMap singleton concept so that user land plugins can manage server reference independently through own transform. The implementation is inspired by how Vinext keeps track of server references cloudflare/vinext#2156 with sandwitched plugins.

See packages/plugin-rsc/examples/custom-server-function/custom-server-function-plugin.ts for custom server function plugin example.

As explained in the design document above, this is independent from #1246 which is for improving standalone transform utilities and not about rsc plugin's builtin server references registration mechanism.

TODO

  • review
  • e2e
  • doc?

Co-authored-by: OpenCode <noreply@opencode.ai>
@hi-ogawa hi-ogawa changed the title refactor(rsc): track server reference claims feat(rsc): ability to register server function via plugins Jul 24, 2026
hi-ogawa and others added 2 commits July 24, 2026 12:32
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
@hi-ogawa
hi-ogawa marked this pull request as draft July 24, 2026 03:35
Comment thread packages/plugin-rsc/src/plugin.ts Outdated
Comment thread packages/plugin-rsc/src/plugin.ts Outdated
Comment thread packages/plugin-rsc/src/plugin.ts Outdated
Comment thread packages/plugin-rsc/examples/custom-server-function/README.md Outdated
hi-ogawa and others added 3 commits July 24, 2026 14:15
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Comment thread packages/plugin-rsc/src/plugin.ts Outdated
Comment thread packages/plugin-rsc/src/plugin.ts Outdated
hi-ogawa and others added 2 commits July 24, 2026 14:56
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Comment thread packages/plugin-rsc/examples/custom-server-function/src/env.d.ts Outdated
Co-authored-by: OpenCode <noreply@opencode.ai>
Comment thread packages/plugin-rsc/e2e/custom-server-function.test.ts Outdated
Comment on lines +44 to +45
ServerReferencesManager,
type ServerReferenceMeta,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

export type from top-level?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

probably fine for later.

Comment thread packages/plugin-rsc/src/plugin.ts Outdated
hi-ogawa and others added 2 commits July 24, 2026 15:20
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Comment thread packages/plugin-rsc/src/plugins/server-reference.ts
hi-ogawa and others added 9 commits July 24, 2026 15:41
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
hi-ogawa and others added 4 commits July 24, 2026 16:24
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
@hi-ogawa
hi-ogawa marked this pull request as ready for review July 24, 2026 07:58
Co-authored-by: OpenCode <noreply@opencode.ai>
@hi-ogawa
hi-ogawa merged commit 31cdbb8 into main Jul 24, 2026
22 checks passed
@hi-ogawa
hi-ogawa deleted the server-reference-claims branch July 24, 2026 09:38
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