@@ -909,11 +909,8 @@ export default class Elysia<
909909
910910 addResponsePath ( path )
911911
912- let _compiled : ComposedHandler
913912 const compile = ( ) => {
914- if ( _compiled ) return _compiled
915-
916- return ( _compiled = composeHandler ( {
913+ const compiled = composeHandler ( {
917914 app : this ,
918915 path,
919916 method,
@@ -926,7 +923,12 @@ export default class Elysia<
926923 : handle ,
927924 allowMeta,
928925 inference : this . inference
929- } ) )
926+ } )
927+
928+ if ( this . router . history [ index ] )
929+ this . router . history [ index ] . composed = compiled
930+
931+ return compiled
930932 }
931933
932934 let oldIndex : number | undefined
@@ -941,22 +943,22 @@ export default class Elysia<
941943 else this . routeTree [ `${ method } _${ path } ` ] = this . router . history . length
942944
943945 const index = oldIndex ?? this . router . history . length
946+ const route = this . router . history
944947
945948 const mainHandler = shouldPrecompile
946949 ? compile ( )
947950 : ( ctx : Context ) =>
948- (
949- ( this . router . history [ index ] . composed =
950- compile ! ( ) ) as ComposedHandler
951- ) ( ctx )
951+ ( ( route [ index ] . composed = compile ! ( ) ) as ComposedHandler ) (
952+ ctx
953+ )
952954
953955 if ( oldIndex !== undefined )
954956 this . router . history [ oldIndex ] = Object . assign (
955957 {
956958 method,
957959 path,
958960 composed : mainHandler ,
959- compile : compile ! ,
961+ compile,
960962 handler : handle ,
961963 hooks
962964 } ,
@@ -976,7 +978,7 @@ export default class Elysia<
976978 method,
977979 path,
978980 composed : mainHandler ,
979- compile : compile ! ,
981+ compile,
980982 handler : handle ,
981983 hooks
982984 } ,
@@ -987,7 +989,9 @@ export default class Elysia<
987989 )
988990
989991 const handler = {
990- handler : shouldPrecompile ? mainHandler : undefined ,
992+ handler : shouldPrecompile
993+ ? ( route [ index ] . composed as ComposedHandler )
994+ : undefined ,
991995 compile ( ) {
992996 return ( this . handler = compile ! ( ) )
993997 }
@@ -5235,6 +5239,10 @@ export default class Elysia<
52355239 > ,
52365240 const Property extends MaybeValueOrVoidFunction <
52375241 MacroProperty <
5242+ Metadata [ 'macro' ] &
5243+ InputSchema < keyof Definitions [ 'typebox' ] & string > & {
5244+ [ name in Name ] ?: boolean
5245+ } ,
52385246 Schema & MacroContext ,
52395247 Singleton & {
52405248 derive : Partial < Ephemeral [ 'derive' ] & Volatile [ 'derive' ] >
@@ -5277,6 +5285,8 @@ export default class Elysia<
52775285 const Input extends Metadata [ 'macro' ] &
52785286 InputSchema < keyof Definitions [ 'typebox' ] & string > ,
52795287 const NewMacro extends Macro <
5288+ Metadata [ 'macro' ] &
5289+ InputSchema < keyof Definitions [ 'typebox' ] & string > ,
52805290 Input ,
52815291 IntersectIfObjectSchema <
52825292 MergeSchema <
@@ -5321,6 +5331,7 @@ export default class Elysia<
53215331 const NewMacro extends MaybeFunction <
53225332 Macro <
53235333 Input ,
5334+ // @ts -ignore trust me bro
53245335 IntersectIfObjectSchema <
53255336 MergeSchema <
53265337 UnwrapRoute < Input , Definitions [ 'typebox' ] , BasePath > ,
@@ -5417,6 +5428,13 @@ export default class Elysia<
54175428 continue
54185429 }
54195430
5431+ if ( k === 'introspect' ) {
5432+ value ?.( localHook )
5433+
5434+ delete localHook [ key ]
5435+ continue
5436+ }
5437+
54205438 if ( k === 'detail' ) {
54215439 if ( ! localHook . detail ) localHook . detail = { }
54225440 localHook . detail = mergeDeep ( localHook . detail , value , {
0 commit comments