File tree Expand file tree Collapse file tree 5 files changed +50
-26
lines changed Expand file tree Collapse file tree 5 files changed +50
-26
lines changed Original file line number Diff line number Diff line change
1
+ # 1.3.21 - 31 Aug 2025
2
+ Bug fix:
3
+ - [ #1356 ] ( https://github.com/elysiajs/elysia/pull/1356 ) webSocket validation error handling in BunAdapter
4
+ - [ #1358 ] ( https://github.com/elysiajs/elysia/pull/1358 ) allow overriding websocket handler with listen options
5
+ - [ #1365 ] ( https://github.com/elysiajs/elysia/pull/1365 ) check if the plugin.constructor (fix import module in Bun 1.2.21)
6
+ - [ #1367 ] ( https://github.com/elysiajs/elysia/pull/1367 ) .trace hooks (onAfterResponse, etc...) not being called
7
+ - [ #1369 ] ( https://github.com/elysiajs/elysia/issues/1369 ) don't block microtask queue in SSE
8
+
1
9
# 1.3.20 - 24 Aug 2025
2
10
Change:
3
11
- mime is undefined when using ` Elysia.file ` in Web Standard Adapter
Original file line number Diff line number Diff line change 1
- import { Elysia , sse , t } from '../src'
2
- import { req } from '../test/utils'
1
+ import { Elysia } from '../src'
2
+
3
+ const plugin1 = new Elysia ( ) . derive ( { as : 'scoped' } , ( ) => ( {
4
+ hello : 'world'
5
+ } ) )
6
+
7
+ const plugin2 = new Elysia ( )
8
+ . use ( plugin1 )
9
+ . derive ( { as : 'scoped' } , ( { hello } ) => ( { hello } ) )
3
10
4
11
const app = new Elysia ( )
5
- . get ( '/' , function * ( ) {
6
- yield sse ( 'a' )
7
- yield sse ( 'b' )
8
- } )
9
- . get ( '/proxy' , ( ) => app . handle ( new Request ( 'http://localhost' ) ) )
12
+ . use ( plugin2 )
13
+ // This is undefined
14
+ . get ( '/' , ( { hello } ) => typeof hello )
10
15
. listen ( 3000 )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " elysia" ,
3
3
"description" : " Ergonomic Framework for Human" ,
4
- "version" : " 1.3.20 " ,
4
+ "version" : " 1.3.21 " ,
5
5
"author" : {
6
6
"name" : " saltyAom" ,
7
7
"url" : " https://github.com/SaltyAom" ,
Original file line number Diff line number Diff line change @@ -247,24 +247,34 @@ export const createStreamHandler =
247
247
if ( chunk === undefined || chunk === null ) continue
248
248
249
249
// @ts -ignore
250
- if ( chunk . toSSE )
250
+ if ( chunk . toSSE ) {
251
251
// @ts -ignore
252
252
controller . enqueue ( chunk . toSSE ( ) )
253
- else if ( typeof chunk === 'object' )
254
- try {
255
- controller . enqueue (
256
- format ( JSON . stringify ( chunk ) )
257
- )
258
- } catch {
253
+ } else {
254
+ if ( typeof chunk === 'object' )
255
+ try {
256
+ controller . enqueue (
257
+ format ( JSON . stringify ( chunk ) )
258
+ )
259
+ } catch {
260
+ controller . enqueue (
261
+ format ( chunk . toString ( ) )
262
+ )
263
+ }
264
+ else
259
265
controller . enqueue ( format ( chunk . toString ( ) ) )
260
- }
261
- else controller . enqueue ( format ( chunk . toString ( ) ) )
262
-
263
- // Wait for the next event loop
264
- // Otherwise the data will be mixed up
265
- await new Promise < void > ( ( resolve ) =>
266
- setTimeout ( ( ) => resolve ( ) , 0 )
267
- )
266
+
267
+ if ( ! isSSE )
268
+ /**
269
+ * Wait for the next event loop
270
+ * otherwise the data will be mixed up
271
+ *
272
+ * @see https://github.com/elysiajs/elysia/issues/741
273
+ */
274
+ await new Promise < void > ( ( resolve ) =>
275
+ setTimeout ( ( ) => resolve ( ) , 0 )
276
+ )
277
+ }
268
278
}
269
279
} catch ( error ) {
270
280
console . warn ( error )
@@ -357,7 +367,6 @@ export const createResponseHandler = (handler: CreateHandlerParameter) => {
357
367
status : set . status as number
358
368
} )
359
369
360
-
361
370
if (
362
371
! ( newResponse as Response ) . headers . has ( 'content-length' ) &&
363
372
( newResponse as Response ) . headers . get (
Original file line number Diff line number Diff line change @@ -907,7 +907,7 @@ export const composeHandler = ({
907
907
endUnit ( )
908
908
}
909
909
}
910
-
910
+
911
911
reporter . resolve ( )
912
912
913
913
afterResponse += '})\n'
@@ -1678,6 +1678,8 @@ export const composeHandler = ({
1678
1678
mapResponse ( 'resolved' ) +
1679
1679
`}` +
1680
1680
`else Object.assign(c, resolved)\n`
1681
+
1682
+ endUnit ( )
1681
1683
} else if ( ! returning ) {
1682
1684
fnLiteral += isAsync ( beforeHandle )
1683
1685
? `await e.beforeHandle[${ i } ](c)\n`
@@ -2517,7 +2519,7 @@ export const composeErrorHandler = (app: AnyElysia) => {
2517
2519
total : hooks . afterResponse ?. length ,
2518
2520
name : 'context'
2519
2521
} )
2520
-
2522
+
2521
2523
if ( hooks . afterResponse ?. length && hooks . afterResponse ) {
2522
2524
for ( let i = 0 ; i < hooks . afterResponse . length ; i ++ ) {
2523
2525
const fn = hooks . afterResponse [ i ] . fn
You can’t perform that action at this time.
0 commit comments