-
-
Notifications
You must be signed in to change notification settings - Fork 85
Add Koa framework integration package #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements @fedify/koa package to integrate Fedify with Koa v2.x and v3.x. - Add packages/koa with createMiddleware() function - Support both Koa 2.x and 3.x via peer dependencies - Convert between Koa context and Web Standards Request/Response - Handle onNotFound/onNotAcceptable callbacks for routing - Build for both npm (ESM/CJS) and JSR distribution - Add examples/koa with basic integration demo - Update documentation with Koa integration guide - Update catalog to use Koa 2.16.0 (latest 2.x) Closes fedify-dev#454 Co-Authored-By: Claude <[email protected]>
Summary of ChangesHello @dahlia, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands Fedify's integration capabilities by introducing a dedicated package for the Koa web framework. This new integration allows developers to easily incorporate Fedify's federation features into their Koa applications, providing robust context conversion, stream handling, and full compatibility with Koa's async middleware pattern across both Koa v2.x and v3.x. The addition includes a new package, an example project, and updated documentation to guide users through the setup and usage. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new integration package, @fedify/koa, to support the Koa web framework. The implementation is well-structured, following patterns from existing framework integrations and includes comprehensive changes across the repository, such as documentation, examples, and configuration updates. The code correctly handles conversions between Koa's context and Web Standards Request/Response objects, including stream handling. My review includes a couple of suggestions to improve code clarity and make the example more illustrative for users.
There was a problem hiding this 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 adds comprehensive support for the Koa web framework through a new @fedify/koa integration package, allowing Fedify to work seamlessly with Koa applications.
- Implements
createMiddleware()function for Koa integration with support for both v2.x and v3.x - Adds proper conversion between Koa's context-based API and Web Standards Request/Response
- Includes complete example project and documentation updates
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pnpm-workspace.yaml |
Adds Koa package and example to workspace configuration |
packages/koa/src/index.ts |
Core integration logic with context conversion and middleware creation |
packages/koa/package.json |
Package configuration with dual Koa version support |
packages/koa/deno.json |
Deno configuration for JSR distribution |
packages/koa/README.md |
Package documentation with basic usage example |
examples/koa/ |
Complete example application demonstrating Koa integration |
docs/manual/integration.md |
Updated documentation with Koa section and installation instructions |
docs/.vitepress/config.mts |
Added Koa reference to documentation navigation |
deno.json |
Added Koa package to Deno workspace |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
- Simplify promise handling for contextData using await - Change @ts-ignore to @ts-expect-error for duplex property - Remove unnecessary parentheses around Readable.toWeb() - Remove unnecessary Buffer.from() wrapper for stream chunks
|
The latest push to this pull request has been published to JSR and npm as a pre-release:
|
|
The docs for this pull request have been published: |
Summary
Adds support for the Koa web framework through a dedicated
@fedify/koaintegration package.Closes #454
Changes
Package Implementation (
packages/koa/)createMiddleware()function for Koa integration^2.0.0 || ^3.0.0)onNotFound/onNotAcceptablecallbacks for proper routing integrationKey Features
ctxobject to/from Web Standards APIExample Project (
examples/koa/)Documentation
docs/manual/integration.mdConfiguration Updates
packages/koaandexamples/koatopnpm-workspace.yamlpackages/koato Deno workspace indeno.jsonkoa: ^2.16.0(latest stable 2.x version)@types/koa: ^2.15.0to catalogTesting
API Example
Notes
@fedify/express,@fedify/hono)anytypes (required for framework agnosticism)ctxandnext) is well-supported