Skip to content

Conversation

@MickL
Copy link

@MickL MickL commented Nov 15, 2025

Description

I tested @intlify/h3 with h3 v2 and it seems to be working, but I saw the dependency was still h3 v1.

Summary by CodeRabbit

  • Chores
    • Updated internal dependencies to maintain compatibility and stability.

@coderabbitai
Copy link

coderabbitai bot commented Nov 15, 2025

Walkthrough

A devDependency version bump of h3 in packages/h3/package.json from ^1.15.4 to ^2.0.1-rc.5. No functional code changes or structural modifications are present.

Changes

Cohort / File(s) Summary
h3 devDependency upgrade
packages/h3/package.json
Updated h3 devDependency from ^1.15.4 to ^2.0.1-rc.5

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

  • Support h3 v2 #19: Addresses the request to upgrade h3 to v2 by updating the h3 devDependency version in packages/h3/package.json

Poem

🐰 A hop, a skip, a version new,
h3 ascends to v2 so true,
Dependencies dance in JSON's light,
The package hops forward, all feels right! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Updated h3 to v2' directly and concisely summarizes the main change: updating the h3 dependency from v1 to v2.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e9be549 and 69b2b5a.

📒 Files selected for processing (1)
  • packages/h3/package.json (1 hunks)

"@types/node": "catalog:",
"@types/supertest": "^6.0.3",
"h3": "^1.15.4",
"h3": "^2.0.1-rc.5",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

⚠️ Pre-release dependency version requires verification and caution.

Upgrading to h3 ^2.0.1-rc.5 introduces risk due to several factors:

  1. Release candidate status: RC versions are pre-release and may have breaking changes before the stable v2 release, potentially causing unexpected breakage in dependent code.
  2. Major version bump: The upgrade from h3 v1 to v2 typically includes significant API changes. Without comprehensive test evidence, compatibility is uncertain.
  3. Insufficient verification evidence: The PR description states the code "appears to work," but this lacks concrete evidence (test results, CI logs, API compatibility audit).

Before merging, confirm:

  • All tests pass with h3 v2.0.1-rc.5
  • No breaking API changes affect the code in this package
  • CI/CD pipeline succeeds with the new version
  • Consider whether to wait for the stable v2 release

Run the following to verify h3 v2 compatibility and test status:

Additionally, search the web for breaking changes between h3 v1 and v2:


🏁 Script executed:

#!/bin/bash
# Description: Verify h3 v2 API compatibility and test status

# 1. Check h3 v2 changelog/breaking changes
echo "=== Checking h3 v2 release notes ==="
curl -s https://github.com/unjs/h3/releases/tag/v2.0.1-rc.5 | grep -A 20 "Breaking" || echo "No breaking changes section found"

# 2. Search for h3 API usage in source code
echo -e "\n=== Searching for h3 API usage in source code ==="
rg -nP --type=ts --type=js 'from\s+["\']h3["\']|import.*from.*h3' --no-heading

# 3. Look for any migration notes or comments
echo -e "\n=== Checking for migration-related comments ==="
rg -nP '(TODO|FIXME|XXX|HACK).*h3|h3.*v2|migration' --type=ts --type=js

Length of output: 191


🌐 Web query:

h3 v2 breaking changes from v1

💡 Result:

Here are the main breaking changes when moving H3 v1 → v2 (summary — see migration guide for full details):

  • ESM-only / Node requirement: v2 targets modern runtimes (ESM-first) and requires Node >= 20.11 (or Bun/Deno). CommonJS usage is more limited. [1]
  • Web-standards rewrite: APIs are built on web primitives (Request, Response, URL, Headers). [1]
  • Router integration: the router is now part of the H3 core (use new H3() instead of createApp/createRouter). [1]
  • New route engine: route matching moved to the rou3 engine — matching rules/behavior changed (some patterns behave slightly differently). [1]
  • Middleware path matching change: app.use("/path", handler) now matches exactly "/path" (not subpaths); use "/path/**" to match subpaths like before. [1]
  • event.path semantics: handlers now receive the full path (prefixes are not stripped); use withBase(base, handler) when needed. [1]
  • Handler lifecycle/returns: any handler can return a Response; middleware may opt not to return — H3 will try subsequent handlers and produce a 404/empty 200 depending on flow. [1][2]
  • Runtime/adapter changes and docs move: project moved to new org/domain (h3.dev) and docs/guide were rewritten — adjust imports and consult new docs. [2]

Sources: H3 migration guide and v2 beta announcement. [1][2]

References
[1] H3 migration guide (v1→v2). h3.dev/migration.
[2] H3 v2 beta announcement / blog. h3.dev/blog/v2-beta.


I need to search the codebase properly to understand actual h3 API usage and verify test status.

I need to examine the codebase to verify whether h3 APIs are actually used and whether tests pass with the RC version.


🏁 Script executed:

#!/bin/bash
# Search for actual h3 imports and usage in source code

echo "=== Finding h3 imports in TypeScript/JavaScript files ==="
fd -e ts -e js -e mts -e mjs | head -20 && echo "..." || true

echo -e "\n=== Searching for 'from h3' or 'import.*h3' ==="
rg 'from\s+["\']h3["\']|import\s+.*\s+from\s+["\']h3["\']' -A 2

echo -e "\n=== Checking for direct h3 API usage patterns ==="
rg 'createApp|defineEventHandler|useQuery|readBody|setHeader' --type ts --type js -c | head -10

echo -e "\n=== Looking for test files ==="
fd -e test.ts -e test.js -e spec.ts -e spec.js 

echo -e "\n=== Checking package.json scripts ==="
cat packages/h3/package.json | grep -A 5 '"scripts"'

Length of output: 945


🏁 Script executed:

#!/bin/bash
# Search for actual h3 imports and usage in source code

echo "=== Searching for h3 imports ==="
rg 'from.*["\']h3["\']|import.*h3' --type ts --type js -A 1

echo -e "\n=== Checking test directory structure ==="
fd -t d test spec __tests__ 2>/dev/null | head -5

echo -e "\n=== Looking for test files in packages/h3 ==="
fd -e test.ts -e test.js -e spec.ts -e spec.js packages/h3

echo -e "\n=== Checking packages/h3 structure ==="
ls -la packages/h3/src/ 2>/dev/null | head -20 || echo "src directory not found"

echo -e "\n=== Reading packages/h3/package.json scripts section ==="
jq '.scripts' packages/h3/package.json 2>/dev/null || cat packages/h3/package.json | grep -A 10 '"scripts"'

Length of output: 102


🏁 Script executed:

#!/bin/bash
# Simplified approach to find h3 usage and test status

echo "=== Checking packages/h3 source file content ==="
cat packages/h3/src/index.ts | head -40

echo -e "\n=== Looking for h3 package references ==="
grep -r "h3" packages/h3/src --include="*.ts" --include="*.js" | head -10

echo -e "\n=== Package.json test script ==="
cat packages/h3/package.json | grep -E 'test|scripts' -A 20 | head -30

echo -e "\n=== Check if test files exist ==="
ls -la packages/h3/src/*.test.* 2>/dev/null
ls -la packages/h3/spec/*.spec.* 2>/dev/null

echo -e "\n=== Sample of main test file ==="
head -50 packages/h3/src/index.test.ts

Length of output: 3631


🏁 Script executed:

#!/bin/bash
# Check for test scripts at workspace root and CI configuration

echo "=== Root package.json scripts ==="
cat package.json | grep -A 20 '"scripts"' | head -25

echo -e "\n=== Checking for vitest config in packages/h3 ==="
ls -la packages/h3/vitest.* packages/h3/vite.* 2>/dev/null || echo "No vitest/vite config found in packages/h3"

echo -e "\n=== Checking root vitest config ==="
ls -la vitest.* vite.* 2>/dev/null | head -5

echo -e "\n=== Looking for CI workflow test command ==="
find .github -name "*.yml" -o -name "*.yaml" 2>/dev/null | xargs grep -l "test" 2>/dev/null | head -2

echo -e "\n=== Sample CI workflow ==="
find .github/workflows -name "*.yml" 2>/dev/null | head -1 | xargs cat 2>/dev/null | grep -A 5 "test"

Length of output: 2739


Verify h3 v2.0.1-rc.5 compatibility before merging — confirmed breaking changes require testing.

Investigation confirms significant breaking changes in h3 v1→v2: ESM-only/Node >= 20.11 requirement, web-standards rewrite using Request/Response/URL/Headers, router API changes, middleware path matching changes, and event.path semantics changes.

Your code directly imports and uses affected h3 APIs:

  • toWebRequest() from h3
  • H3Event type (test mocks assume specific structure with web.request and node.req)
  • AppOptions type
  • Module augmentation on h3

Tests exist (index.test.ts, spec/integration.spec.ts, spec/e2e.spec.ts) and the root pnpm test script will run them via vitest. However, before merging to a pre-release version:

  1. Confirm tests pass: Run pnpm test and verify all h3 package tests pass with h3 v2.0.1-rc.5
  2. Verify API compatibility: Ensure H3Event structure, toWebRequest(), and AppOptions match v2 API in your code
  3. Consider stability: Evaluate whether to wait for stable h3 v2.0.0 release rather than using rc.5 to avoid mid-development breaking changes

@kazupon
Copy link
Member

kazupon commented Nov 15, 2025

Thank you for your contribution!
I've just create PR #32
I appreciate your contribution, but since this PR is supported by that PR, we'll close this one.

@kazupon kazupon closed this Nov 15, 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.

2 participants