Skip to content

refactor(package): subpath 'http-proxy-middleware/hono'#1220

Merged
chimurai merged 1 commit intomasterfrom
fix-hono-deps
May 2, 2026
Merged

refactor(package): subpath 'http-proxy-middleware/hono'#1220
chimurai merged 1 commit intomasterfrom
fix-hono-deps

Conversation

@chimurai
Copy link
Copy Markdown
Owner

@chimurai chimurai commented May 2, 2026

fixes: #1219
fixes: web-infra-dev/rspack#13883

Error: node_modules/.../http-proxy-middleware/index.d.ts(8,30): error TS2307: Cannot find module '@hono/node-server' or its corresponding type declarations.
Error: node_modules/.../http-proxy-middleware/index.d.ts(9,35): error TS2307: Cannot find module 'hono' or its corresponding type declarations.

Separate package 'http-proxy-middleware/hono' subpath export

import { createHonoProxyMiddleware } from 'http-proxy-middleware/hono';

Summary by CodeRabbit

  • New Features

    • Introduced the http-proxy-middleware/hono subpath export, enabling developers to import and use Hono-specific proxy middleware independently.
  • Documentation

    • Updated example server applications and official documentation recipes to demonstrate usage of the new Hono subpath import path.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

📝 Walkthrough

Walkthrough

This PR introduces a Hono-specific export subpath (./hono) to the package, separating Hono-dependent types from the main distribution. It creates a new index-hono.ts entrypoint and updates imports across examples, tests, and documentation to use the subpath import path.

Changes

Hono-Specific Export Separation

Layer / File(s) Summary
Package Export Configuration
package.json
Adds new exports["./hono"] entry pointing to ./dist/index-hono.d.ts and ./dist/index-hono.js, enabling the http-proxy-middleware/hono subpath.
Hono Entrypoint
src/index-hono.ts
New file documents the Hono-specific API entrypoint and re-exports createHonoProxyMiddleware from ./factory-hono.js to avoid forcing Hono types on consumers of the main package.
Main API Restructuring
src/index.ts
Updated to re-export from ./factory.js instead of ./factory-hono.js, removing Hono-dependent code from the default export.
Example Shim Infrastructure
examples/package.json, examples/subpath.hono.shim.js
Adds ESM imports mapping for #http-proxy-middleware/hono./subpath.hono.shim.js and creates the shim to re-export from ../dist/index-hono.js.
Consumer Integration
examples/hono/index.js, test/e2e/test-kit.ts
Updates imports to use #http-proxy-middleware/hono (examples) and ../../src/index-hono.js (tests) instead of the main index.
Documentation & JSDoc
recipes/servers.md, src/factory-hono.ts
Updates code examples and JSDoc snippets to import createHonoProxyMiddleware from http-proxy-middleware/hono instead of http-proxy-middleware.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A bunny hops through exports fair,
Separating Hono with care,
Types no longer burden the main,
A subpath shines like sun after rain,
Cleaner imports, lighter to bear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR successfully addresses issue #1219 by creating a separate 'http-proxy-middleware/hono' export, allowing consumers to opt-in to hono support without requiring hono as a dependency.
Out of Scope Changes check ✅ Passed All changes directly support the objective of creating a separate hono export entry point; no unrelated modifications are present.
Title check ✅ Passed The title accurately describes the main objective: creating a separate subpath export for Hono-specific middleware to allow optional, opt-in consumption without forcing Hono dependencies.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-hono-deps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 2, 2026

npm i https://pkg.pr.new/http-proxy-middleware@1220

commit: 5f085f1

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 94.07%. remained the same — fix-hono-deps into master

@chimurai chimurai mentioned this pull request May 2, 2026
2 tasks
@chimurai chimurai changed the title refactor(hono): package export 'http-proxy-middleware/hono' refactor(hono): package subpath 'http-proxy-middleware/hono' May 2, 2026
@chimurai chimurai changed the title refactor(hono): package subpath 'http-proxy-middleware/hono' refactor(package): subpath 'http-proxy-middleware/hono' May 2, 2026
@chimurai chimurai merged commit 08c5248 into master May 2, 2026
24 checks passed
@chimurai chimurai deleted the fix-hono-deps branch May 2, 2026 19:01
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.

Should hono types be dependencies?

2 participants