File tree Expand file tree Collapse file tree 5 files changed +14
-35
lines changed Expand file tree Collapse file tree 5 files changed +14
-35
lines changed Original file line number Diff line number Diff line change
1
+ # 1.2.2 - 24 Dec 2024
2
+ Bug fix:
3
+ - conditional import and require
4
+
1
5
# 1.2.1 - 23 Dec 2024
2
6
Bug fix:
3
7
- conditional import for fs
Original file line number Diff line number Diff line change @@ -90,4 +90,8 @@ await Promise.all([
90
90
91
91
await $ `cp dist/index*.d.ts dist/bun`
92
92
93
+ const fsMjs = Bun . file ( 'dist/universal/fs.mjs' )
94
+ const fsMjsContent = await fsMjs . text ( )
95
+ Bun . write ( fsMjs , fsMjsContent . replace ( `require("fs")` , `await import("fs")` ) )
96
+
93
97
process . exit ( )
Original file line number Diff line number Diff line change 1
- import { Elysia , t } from '../src'
1
+ import { Elysia , file , t } from '../src'
2
2
import { req } from '../test/utils'
3
3
4
- export const userService = new Elysia ( { name : 'user/service' } )
5
- . macro ( {
6
- isSignIn ( enabled : boolean ) {
7
- if ( ! enabled ) return
8
-
9
- return {
10
- beforeHandle ( { error, cookie : { token } , store : { session } } ) {
11
- if ( ! token . value )
12
- return error ( 401 , {
13
- success : false ,
14
- message : 'Unauthorized'
15
- } )
16
-
17
- const username = session [ token . value as unknown as number ]
18
-
19
- if ( ! username )
20
- return error ( 401 , {
21
- success : false ,
22
- message : 'Unauthorized'
23
- } )
24
- }
25
- }
26
- }
27
- } )
28
- . get ( '/' , ( ) => 'a' , {
29
- isSignIn : false
30
- } )
31
-
32
- userService
33
- . handle ( req ( '/' ) )
34
- . then ( ( x ) => x . text ( ) )
35
- . then ( console . log )
4
+ new Elysia ( ) . get ( '/' , ( ) => file ( 'test/kyuukurarin.mp4' ) ) . 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.2.1 " ,
4
+ "version" : " 1.2.2 " ,
5
5
"author" : {
6
6
"name" : " saltyAom" ,
7
7
"url" : " https://github.com/SaltyAom" ,
Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ import type * as Fs from 'fs'
2
2
import { env } from './env'
3
3
4
4
const fs : typeof Fs =
5
- typeof process !== 'undefined' && env . NODE_ENV ? require ( 'fs' ) : { }
5
+ typeof process !== 'undefined' && env . NODE_ENV
6
+ ? require ( 'fs' )
7
+ : { }
6
8
7
9
const noop = ( ) => { }
8
10
You can’t perform that action at this time.
0 commit comments