Skip to content

Commit 9e6b6b6

Browse files
committed
🎉 feat: 1.3.2
1 parent c31c72c commit 9e6b6b6

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 1.3.2 - 24 May 2025
1+
# 1.3.2 - 27 May 2025
22
Feature:
33
- Support Bun native static response per method for Bun >= 1.2.14
44
- [#1213](https://github.com/elysiajs/elysia/issues/1213) trace.time is undefined in .trace() callback
@@ -7,6 +7,7 @@ Improvement:
77
- implement all universal type
88
- offload `AsyncGenerator`, `ReplaceFile` from Eden Treaty to `CreateEden`
99
- [#1223](https://github.com/elysiajs/elysia/issues/1223) infer `status(200)` response from handler if not specified
10+
- [#1185](https://github.com/elysiajs/elysia/issues/1185) use non-greedy match for `isContextPassToFunction` to prevent false positive
1011

1112
# 1.3.1 - 8 May 2025
1213
Bug fix:

example/a.ts

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1-
import { Elysia } from '../src'
1+
import { Elysia, t } from '../src'
22

3-
const app = new Elysia().get('/', function* ({ status }) {
4-
const project = { url: '1234' }
5-
if (!project) return status(400)
6-
return status(200, project.url)
3+
const MessageSchema = t.Object({
4+
message: t.String()
75
})
86

9-
app['~Routes'].get.response
7+
const app = new Elysia({
8+
name: 'appService'
9+
})
10+
.model({
11+
message: MessageSchema
12+
})
13+
.get(
14+
'/health',
15+
() => {
16+
return {
17+
timestamp: new Date().toISOString(),
18+
status: 'ok'
19+
}
20+
},
21+
{
22+
response: {
23+
200: t.Object({
24+
status: t.String(),
25+
timestamp: t.String()
26+
}),
27+
default: t.Ref('message')
28+
}
29+
}
30+
)
31+
32+
app.handle(new Request('http://localhost/health'))
33+
.then((x) => x.json())
34+
.then(console.log)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "elysia",
33
"description": "Ergonomic Framework for Human",
4-
"version": "1.3.2-exp.1",
4+
"version": "1.3.2",
55
"author": {
66
"name": "saltyAom",
77
"url": "https://github.com/SaltyAom",

src/sucrose.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ export const isContextPassToFunction = (
538538
) => {
539539
// ! Function is passed to another function, assume as all is accessed
540540
try {
541-
const captureFunction = new RegExp(`(?:\\w)\\((?:.*)?${context}`, 'gs')
541+
const captureFunction = new RegExp(`\\w\\((.*?)?${context}`, 'gs')
542542
captureFunction.test(body)
543543

544544
/*

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ export type EmptyRouteSchema = {
16241624
type _ComposeElysiaResponse<Schema extends RouteSchema, Handle> = Prettify<
16251625
(Schema['response'] extends { 200: any }
16261626
? {
1627-
200: Replace<Schema['response'][200], ElysiaFile | Blob, File>
1627+
200: Replace<Schema['response'][200], ElysiaFile, File>
16281628
}
16291629
: {
16301630
200: Handle extends AnyElysiaCustomStatusResponse
@@ -1636,7 +1636,7 @@ type _ComposeElysiaResponse<Schema extends RouteSchema, Handle> = Prettify<
16361636
>['response']
16371637
: Handle extends Generator<infer A, infer B, infer C>
16381638
? AsyncGenerator<A, B, C>
1639-
: Handle
1639+
: Replace<Handle, ElysiaFile, File>
16401640
}) &
16411641
ExtractErrorFromHandle<Handle> &
16421642
({} extends Omit<Schema['response'], 200>

0 commit comments

Comments
 (0)