Skip to content

Commit 5dfebc8

Browse files
committed
📘 doc: use throw error
1 parent 718c648 commit 5dfebc8

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Bug fix:
44
- [#971](https://github.com/elysiajs/elysia/issues/971) remove top level import, use dynamic import instead
55
- [#969](https://github.com/elysiajs/elysia/issues/969) Invalid context on `.onStart`, `.onStop`
66
- [#965](https://github.com/elysiajs/elysia/issues/965) [Composer] failed to generate optimized handler. Unexpected identifier 'mapCompactResponse'
7+
- decorator name with space is not working
78

89
# 1.2.2 - 24 Dec 2024
910
Bug fix:

build.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ await Promise.all([
9090

9191
await $`cp dist/index*.d.ts dist/bun`
9292

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")`))
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")`))
9696

9797
process.exit()

example/a.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@ import { Elysia, file, getSchemaValidator, t } from '../src'
22
import { post, req } from '../test/utils'
33

44
const app = new Elysia()
5-
.onAfterHandle(() => {
6-
console.log('after handle')
7-
})
8-
.mapResponse((context) => {
9-
return context.response
10-
})
11-
.get('/', async () => {
12-
return 'ok'
5+
.get('/image', async () => {
6+
return file('test/kyuukurarin.mp4')
137
})
148
.listen(3000)
159

16-
console.log(app.routes[0].compile().toString())
10+
// console.log(app.routes[0].compile().toString())
1711

1812
// app.handle(req('/'))
1913

src/universal/file.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { type stat as Stat } from 'fs/promises'
44

55
import { isBun } from './utils'
66
import type { BunFile } from 'bun'
7-
import { MaybePromise } from '../types'
7+
import type { MaybePromise } from '../types'
88

99
export const mime = {
1010
aac: 'audio/aac',
@@ -115,7 +115,7 @@ export class ElysiaFile {
115115

116116
return fs.createReadStream(path)
117117
})
118-
this.value = import('fs/promises').then((fs) => {
118+
this.stats = import('fs/promises').then((fs) => {
119119
stat = fs.stat
120120

121121
return fs.stat(path)

0 commit comments

Comments
 (0)