Skip to content

feat(h3): 新增 H3 v2 适配器,统一升级至 3.4.0 - #223

Merged
yourtion merged 3 commits into
mainfrom
feat/h3-adapter
Oct 27, 2026
Merged

yourtion merged 3 commits into
mainfrom
feat/h3-adapter

Conversation

@yourtion

@yourtion yourtion commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

erest 目前缺少 H3 接入方式。新增独立包 @erest/h3,使现有 API 定义可直接绑定到 H3 v2,并复用 Zod 校验、中间件、hooks、响应信封、文档和 Axios SDK。

改动

  • 导出 H3Adapter、h3Adapter、createERest 和 H3Raw;reply.raw 推导为 H3Event,兼容自定义 State。
  • 支持普通路由与 forceGroup 分组挂载,覆盖显式、默认及嵌套前缀。
  • 声明 body schema 时解析 JSON/URL-encoded,缺失和非法请求体进入校验/错误处理;未声明时保留原生请求流。
  • 支持 reply.status/json/send,以及 markSent() 配合原生 Response 返回。
  • 将 H3 纳入四框架合约测试、类型检查、workspace 构建和六包发布产物检查;补全接入与迁移文档,公开包版本统一为 3.4.0。

验证

  • 核心与子包构建、lint/格式检查、frozen-lockfile 安装通过。
  • 全量回归及覆盖率检查通过:834 个库测试;示例测试 13 个通过。
  • test:h3-types 通过,检查 Raw/State 类型推导与适配器兼容性。
  • 发布工具测试 19 个通过;六个 tarball 在独立消费项目中的安装、ESM 导入、CLI 入口及 H3 请求 smoke test 通过。

发布

支持 H3 ^2.0.8,需要 Node.js >=20.19.0。维护者已手动发布 @erest/h3@3.3.0 并完成 npm Trusted Publisher 配置。六个公开包版本统一为 3.4.0,PR 合入 main 且 CI 通过后推送 v3.4.0,由现有工作流统一自动发布。

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.61%. Comparing base (8a80d32) to head (48bf502).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #223   +/-   ##
=======================================
  Coverage   99.61%   99.61%           
=======================================
  Files          29       29           
  Lines        3150     3150           
  Branches     1024     1025    +1     
=======================================
  Hits         3138     3138           
  Misses         12       12           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yourtion
yourtion merged commit 7d65834 into main Oct 27, 2026
9 checks passed
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