From a20d6a6fc1223ec07535561e2076b05a34d22317 Mon Sep 17 00:00:00 2001 From: saltyaom Date: Sat, 16 Mar 2024 22:15:24 +0700 Subject: [PATCH] :tada: release: Elysia 1.0 --- example/a.ts | 2 -- package.json | 2 +- src/compose.ts | 6 +++++- src/index.ts | 8 ++++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/example/a.ts b/example/a.ts index 6e82958a..92a78fb4 100644 --- a/example/a.ts +++ b/example/a.ts @@ -3,5 +3,3 @@ import { Elysia } from '../src' const app = new Elysia({ precompile: true }) .get('/', Bun.file('test/kyuukurarin.mp4')) .listen(3000) - -console.log(app.routes[0].composed?.toString()) diff --git a/package.json b/package.json index 283d4fb7..7be38b41 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "elysia", "description": "Ergonomic Framework for Human", - "version": "1.0.0-rc.19", + "version": "1.0.0", "author": { "name": "saltyAom", "url": "https://github.com/SaltyAom", diff --git a/src/compose.ts b/src/compose.ts index 4eeb4301..719232db 100644 --- a/src/compose.ts +++ b/src/compose.ts @@ -344,7 +344,11 @@ export const composeHandler = ({ if (!isHandleFn) handler = mapCompactResponse(handler) const hasErrorHandler = - (app.config.forceErrorEncapsulation && isHandleFn) || + (app.config.forceErrorEncapsulation && + (isHandleFn || + hooks.afterHandle.length > 0 || + hooks.beforeHandle.length > 0 || + hooks.transform.length > 0)) || hooks.error.length > 0 || app.event.error.length > 0 || typeof Bun === 'undefined' || diff --git a/src/index.ts b/src/index.ts index f54812b2..dfd29c1e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -172,6 +172,14 @@ export default class Elysia< resolve: {} } as Singleton + get store(): Singleton['store'] { + return this.singleton.store + } + + get decorator(): Singleton['decorator'] { + return this.singleton.decorator + } + protected definitions = { type: {} as Record, error: {} as Record