feat: DRY adapter base, add Next.js/Hono/Fastify adapters, migrate tests to vitest#97
Open
Sarita-Joshi wants to merge 2 commits into
Open
feat: DRY adapter base, add Next.js/Hono/Fastify adapters, migrate tests to vitest#97Sarita-Joshi wants to merge 2 commits into
Sarita-Joshi wants to merge 2 commits into
Conversation
Removes the @hapi/boom dependency entirely and replaces it with a lightweight HipError class defined in core.ts. This gives hipthrusts its own error type with no external dependencies, making it simpler for consumers (no need to import or know about boom). HipError has statusCode, message, and a static isHipError() type guard. Adapters catch HipError directly instead of checking Boom.isBoom(). BREAKING CHANGE: Consumers that caught Boom errors from hipthrusts should now catch HipError instead. The .output property is preserved for backwards compatibility with existing adapter code.
…sts to vitest - Extract shared HandlerConfig type, defineHandler, and prepareHipthrustable into src/adapter.ts so all framework adapters reuse the same base - Add Next.js App Router adapter (src/next.ts) - Add Hono adapter (src/hono.ts) - Add Fastify adapter (src/fastify.ts) - Slim Express adapter to use shared base - Fix pre-existing bug: transformThrowPossiblyAsync now catches sync throws - Migrate test/index.test.ts from mocha/chai to vitest - Fix pre-existing nested it() bug in type error test case - Add comprehensive test suites (131 tests total) - Add hello-world examples for Express, Hono, Fastify, and Next.js - Add hono, fastify, next as optional peer dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HandlerConfigtype,defineHandler, andprepareHipthrustableintosrc/adapter.tsso all framework adapters reuse the same basesrc/next.ts) withgatherContextfor async pre-lifecycle worksrc/hono.ts)src/fastify.ts)transformThrowPossiblyAsyncnow catches sync throws from async-capable functionstest/index.test.tsfrom mocha/chai to vitest, fix nestedit()bug