Skip to content

Conversation

@kazupon
Copy link
Member

@kazupon kazupon commented Nov 14, 2025

Description

Linked Issues

Additional context

Summary by CodeRabbit

  • Chores
    • Updated dependencies across packages using workspace catalog references for @intlify/utils.
    • Refactored internal locale detection to use standardized request handling patterns.

@kazupon kazupon added the improvement Includes backwards-compatible fixes label Nov 14, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2025

Walkthrough

The changes consolidate the @intlify/utils dependency across h3 and hono packages using a monorepo catalog, and refactor locale detection in both integrations to pass WebRequest abstractions instead of raw event/context objects to the header locale function.

Changes

Cohort / File(s) Summary
Dependency catalog centralization
pnpm-workspace.yaml
Added @intlify/utils (^1.0.1) to the catalog for centralized dependency management across the workspace.
h3 package updates
packages/h3/package.json, packages/h3/src/index.ts, packages/h3/src/index.test.ts
Updated @intlify/utils dependency to use catalog reference. Refactored detectLocaleFromAcceptLanguageHeader to pass toWebRequest(event) instead of raw event to getHeaderLocale. Updated test mocks to include event.web.request.headers.get() for header simulation.
hono package updates
packages/hono/package.json, packages/hono/src/index.ts, packages/hono/src/index.test.ts
Updated @intlify/utils dependency to use catalog reference. Refactored detectLocaleFromAcceptLanguageHeader to pass ctx.req.raw instead of ctx to getHeaderLocale. Updated test mocks to use req.raw.headers.get(...) instead of req.header(...).

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant OldFlow as Old Locale Detection
    participant NewFlow as New Locale Detection
    participant Utils as `@intlify/utils`

    rect rgb(240, 248, 255)
    Note over OldFlow: Legacy: Raw event/context
    App->>OldFlow: Pass event/ctx
    OldFlow->>Utils: getHeaderLocale(event/ctx)
    Utils-->>OldFlow: Extracted locale
    OldFlow-->>App: Detected locale
    end

    rect rgb(240, 255, 240)
    Note over NewFlow: Updated: WebRequest abstraction
    App->>NewFlow: detectLocaleFromAcceptLanguageHeader
    NewFlow->>NewFlow: Convert to WebRequest<br/>(h3: toWebRequest(event)<br/>hono: ctx.req.raw)
    NewFlow->>Utils: getHeaderLocale(WebRequest)
    Utils-->>NewFlow: Extracted locale
    NewFlow-->>App: Detected locale
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The changes follow a consistent pattern applied to both h3 and hono packages with minimal variation
  • Dependency catalog updates are straightforward configuration
  • Locale detection refactoring introduces WebRequest abstraction but maintains the same overall contract
  • Test updates mirror production code changes with predictable mock adjustments

Poem

🐰 A catalog's born to unite the way,

Dependencies consolidated, hip-hop-hooray!

WebRequest wraps the headers tight,

h3 and hono both shimmer bright! ✨

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 clearly summarizes the main change: upgrading the @intlify/utils dependency to v1 across multiple packages. It accurately reflects the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/upgrade-intlify-utils

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

pkg-pr-new bot commented Nov 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@intlify/h3@14
npm i https://pkg.pr.new/@intlify/hono@14

commit: eeda063

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 e63bc39 and eeda063.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • packages/h3/package.json (1 hunks)
  • packages/h3/src/index.test.ts (2 hunks)
  • packages/h3/src/index.ts (2 hunks)
  • packages/hono/package.json (1 hunks)
  • packages/hono/src/index.test.ts (3 hunks)
  • packages/hono/src/index.ts (2 hunks)
  • pnpm-workspace.yaml (1 hunks)
🔇 Additional comments (8)
packages/hono/package.json (1)

66-66: LGTM!

The migration to catalog-based dependency resolution aligns with the workspace configuration in pnpm-workspace.yaml.

packages/h3/package.json (1)

67-67: LGTM!

The catalog-based dependency resolution ensures consistency with the workspace configuration.

packages/hono/src/index.test.ts (1)

17-21: LGTM!

The test mocks correctly reflect the updated header access pattern using req.raw.headers.get(), which aligns with the implementation changes in packages/hono/src/index.ts.

Also applies to: 61-65, 82-86

packages/hono/src/index.ts (2)

174-175: Verify the signature change for getHeaderLocale.

The function now passes ctx.req.raw (the raw Request object) instead of the Hono Context. Ensure this matches the expected signature in @intlify/utils v1 and that header retrieval works correctly across different Hono runtimes.


13-13: No issues found. The import path change is valid and compatible.

The @intlify/utils/hono subpath remains available in the current package version, and getHeaderLocale is correctly available from the main @intlify/utils export. The code at lines 13 and 15 is compatible with the @intlify/utils package structure—there is no breaking change or import conflict.

Likely an incorrect or invalid review comment.

packages/h3/src/index.ts (2)

175-176: LGTM!

The use of toWebRequest(event) provides a clean abstraction layer, converting the H3Event to a standard WebRequest interface for header extraction. This aligns well with the cross-framework compatibility goals.


19-20: No action required — the h3 subpath export is supported.

@intlify/utils provides environment subpaths (including "h3") so you can import like import { ... } from "@intlify/utils/h3". The code correctly exports from @intlify/utils/h3 on line 22, and this subpath is properly supported by the package. The refactoring (importing getHeaderLocale from the main @intlify/utils package and re-exporting the h3 subpath) is valid and intentional.

Likely an incorrect or invalid review comment.

packages/h3/src/index.test.ts (1)

15-21: LGTM!

The test mocks correctly simulate the H3 web interface by adding web.request.headers.get(), which aligns with the use of toWebRequest(event) in the implementation. The tests also maintain the existing node.req.headers structure for completeness.

Also applies to: 67-73

typescript: ^5.9.3
tsdown: ^0.16.4
publint: ^0.3.15
'@intlify/utils': ^1.0.1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the new major version and check for breaking changes.

This is a major version upgrade for @intlify/utils (from 0.x to 1.x). Ensure that version ^1.0.1 exists and review the changelog for any breaking changes that might affect the workspace.


🌐 Web query:

What are the breaking changes in @intlify/utils version 1.0.1?

💡 Result:

I can look this up — may I search the web for the @intlify/utils v1.0.1 changelog/releases?


The specified version of @intlify/utils does not exist.

The latest version of @intlify/utils is 0.13.0, last published 2 years ago. Version ^1.0.1 does not exist in the npm registry. This will cause dependency resolution to fail unless this is a planned future release or the version specification is incorrect. Verify that the version constraint should be updated to match an existing release (e.g., ^0.13.0) or confirm this version will be published.

🤖 Prompt for AI Agents
In pnpm-workspace.yaml around line 11, the dependency entry '@intlify/utils':
^1.0.1 references a non-existent release and will break installs; update the
version constraint to a valid published version (for example '^0.13.0') or
change it to a tag that exists (e.g., 'latest') / a workspace path if you intend
to use a local package, then run pnpm install to verify resolution succeeds.

@kazupon kazupon merged commit 96ae431 into main Nov 14, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Includes backwards-compatible fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants