Skip to content

Support Elysia 2 while retaining Elysia 1 compatibility - #212

Merged
dahlia merged 1 commit into
mainfrom
packages/elysia/v2
Sep 6, 2026
Merged

Support Elysia 2 while retaining Elysia 1 compatibility#212
dahlia merged 1 commit into
mainfrom
packages/elysia/v2

Conversation

@dahlia

@dahlia dahlia commented Sep 6, 2026

Copy link
Copy Markdown
Owner

A compatibility layer translates native hooks and response values so Elysia 1.4 and 2 beta can share the existing elysiaLogger() API in LogTape 2.4.

For local request context, the adapter copies Elysia 2 route metadata and wraps callbacks after macro expansion. This preserves request IDs in child hooks without mutating reusable plugins or changing native hook deduplication. The docs explain JSR dependency overrides and Elysia 2's restriction on registering macros after await in a plugin function.

The compatibility matrix tests packed ESM/CommonJS exports and JSR-shaped source on Node.js, Bun, and Deno against 1.4.0, 1.4.30, and 2.0.0-beta.12. Consumer type checks allow only dependency diagnostics also present without LogTape. The matrix, repository checks, and documentation build pass.

Keep the existing adapter API while supporting Elysia 2 beta hooks,
status values and local request context. Preserve child plugin reuse
and native hook deduplication, including deferred macro hooks.

Validate packed ESM/CommonJS exports and JSR-shaped source against
Elysia 1.4.0, 1.4.30 and 2.0.0-beta.12 on Node.js, Bun and Deno.
Document shared dependencies, Deno overrides, and Elysia 2's native
async plugin registration constraint with supported examples and tests.

Assisted-by: Codex:gpt-6-astra
Assisted-by: Claude Code:claude-fable-5-1
@dahlia dahlia added this to the LogTape 2.4 milestone Sep 6, 2026
@dahlia dahlia self-assigned this Sep 6, 2026
@dahlia dahlia added the enhancement New feature or request label Sep 6, 2026
@dahlia

dahlia commented Sep 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T08:35:21.368434Z 490477d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Test Results (Linux)

    1 files  ±0     52 suites  ±0   57s ⏱️ -2s
1 482 tests ±0  1 414 ✅ ±0   68 💤 ±0  0 ❌ ±0 
1 482 runs  ±0  1 346 ✅ ±0  136 💤 ±0  0 ❌ ±0 

Results for commit 490477d. ± Comparison against base commit 5753151.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Test Results (macOS)

    1 files  ±0     52 suites  ±0   55s ⏱️ +6s
1 482 tests ±0  1 414 ✅ ±0   68 💤 ±0  0 ❌ ±0 
1 482 runs  ±0  1 346 ✅ ±0  136 💤 ±0  0 ❌ ±0 

Results for commit 490477d. ± Comparison against base commit 5753151.

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.62663% with 304 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.41%. Comparing base (5753151) to head (490477d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/elysia/src/compat.ts 14.02% 277 Missing and 5 partials ⚠️
packages/elysia/src/mod.ts 60.00% 15 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #212      +/-   ##
==========================================
- Coverage   86.18%   84.41%   -1.77%     
==========================================
  Files          72       73       +1     
  Lines       13612    13956     +344     
  Branches     3151     3162      +11     
==========================================
+ Hits        11731    11781      +50     
- Misses       1307     1590     +283     
- Partials      574      585      +11     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Test Results (Windows)

    1 files  ±0     52 suites  ±0   1m 24s ⏱️ -27s
1 482 tests ±0  1 424 ✅ ±0   58 💤 ±0  0 ❌ ±0 
1 482 runs  ±0  1 366 ✅ ±0  116 💤 ±0  0 ❌ ±0 

Results for commit 490477d. ± Comparison against base commit 5753151.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 490477d4d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/elysia/src/compat.ts
Comment thread packages/elysia/src/compat.ts
@dahlia
dahlia merged commit 28c1f35 into main Sep 6, 2026
16 of 18 checks passed
@dahlia
dahlia deleted the packages/elysia/v2 branch September 6, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant