Skip to content

Commit dbb5e90

Browse files
committed
🎉 feat: macro soundness
1 parent 8b26925 commit dbb5e90

File tree

9 files changed

+266
-138
lines changed

9 files changed

+266
-138
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# 1.0.5 -
2+
Improvement:
3+
- using regex for date pattern matching before using new Date validation
4+
- using tsc to emit declaration file instead of tsup
5+
- add `mapResponse` to MacroManager
6+
7+
Bug fix:
8+
- Ephemeral and Volatile type isn't recognize by MacroManager
9+
110
# 1.0.4 - 18 Mar 2024
211
Improvement:
312
- resolve, derive soundness

build.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ await Promise.all([
2828
outDir: 'dist/cjs',
2929
format: 'cjs',
3030
target: 'node20',
31-
dts: true,
31+
// dts: true,
3232
...tsupConfig
3333
})
3434
])
3535

36+
await $`tsc --project tsconfig.dts.json`
37+
3638
await Bun.build({
3739
entrypoints: ['./src/index.ts'],
3840
outdir: './dist/bun',
@@ -43,8 +45,8 @@ await Bun.build({
4345
})
4446

4547
await Promise.all([
46-
$`cp dist/cjs/*.d.ts dist/`,
47-
$`cp dist/cjs/ws/*.d.ts dist/ws/`
48+
$`cp dist/*.d.ts dist/cjs`,
49+
$`cp dist/ws/*.d.ts dist/cjs/ws/`,
4850
])
4951

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

bun.lockb

-1.06 KB
Binary file not shown.

example/a.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ import { req } from '../test/utils'
33

44
const app = new Elysia({ precompile: true })
55
.get('/', 'hi')
6+
.derive({ as: 'scoped' }, () => {
7+
return {
8+
hi: 'a'
9+
}
10+
})
11+
.macro(({ onBeforeHandle }) => {
12+
return {
13+
a() {
14+
onBeforeHandle(({ hi }) => {})
15+
}
16+
}
17+
})
618
.listen(3000)
719

820
console.log(app.fetch.toString())

package.json

Lines changed: 25 additions & 39 deletions
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.0.4",
4+
"version": "1.0.5",
55
"author": {
66
"name": "saltyAom",
77
"url": "https://github.com/SaltyAom",
@@ -12,76 +12,64 @@
1212
"types": "./dist/index.d.ts",
1313
"exports": {
1414
".": {
15-
"bun": "./dist/bun/index.js",
15+
"types": "./dist/index.d.ts",
1616
"import": "./dist/index.mjs",
17-
"require": "./dist/cjs/index.js",
18-
"types": "./dist/index.d.ts"
17+
"require": "./dist/cjs/index.js"
1918
},
2019
"./ws": {
21-
"bun": "./dist/ws/index.js",
20+
"types": "./dist/ws/index.d.ts",
2221
"import": "./dist/ws/index.mjs",
23-
"require": "./dist/cjs/ws/index.js",
24-
"types": "./dist/ws/index.d.ts"
22+
"require": "./dist/cjs/ws/index.js"
2523
},
2624
"./compose": {
27-
"bun": "./dist/compose.js",
25+
"types": "./dist/compose.d.ts",
2826
"import": "./dist/compose.mjs",
29-
"require": "./dist/cjs/compose.js",
30-
"types": "./dist/compose.d.ts"
27+
"require": "./dist/cjs/compose.js"
3128
},
3229
"./context": {
33-
"bun": "./dist/context.js",
30+
"types": "./dist/context.d.ts",
3431
"import": "./dist/context.mjs",
35-
"require": "./dist/cjs/context.js",
36-
"types": "./dist/context.d.ts"
32+
"require": "./dist/cjs/context.js"
3733
},
3834
"./cookie": {
39-
"bun": "./dist/cookie.js",
35+
"types": "./dist/cookie.d.ts",
4036
"import": "./dist/cookie.mjs",
41-
"require": "./dist/cjs/cookie.js",
42-
"types": "./dist/cookie.d.ts"
37+
"require": "./dist/cjs/cookie.js"
4338
},
4439
"./error": {
45-
"bun": "./dist/error.js",
40+
"types": "./dist/error.d.ts",
4641
"import": "./dist/error.mjs",
47-
"require": "./dist/cjs/error.js",
48-
"types": "./dist/error.d.ts"
42+
"require": "./dist/cjs/error.js"
4943
},
5044
"./handler": {
51-
"bun": "./dist/handler.js",
45+
"types": "./dist/handler.d.ts",
5246
"import": "./dist/handler.mjs",
53-
"require": "./dist/cjs/handler.js",
54-
"types": "./dist/handler.d.ts"
47+
"require": "./dist/cjs/handler.js"
5548
},
5649
"./schema": {
57-
"bun": "./dist/schema.js",
50+
"types": "./dist/schema.d.ts",
5851
"import": "./dist/schema.mjs",
59-
"require": "./dist/cjs/schema.js",
60-
"types": "./dist/schema.d.ts"
52+
"require": "./dist/cjs/schema.js"
6153
},
6254
"./trace": {
63-
"bun": "./dist/trace.js",
55+
"types": "./dist/trace.d.ts",
6456
"import": "./dist/trace.mjs",
65-
"require": "./dist/cjs/trace.js",
66-
"types": "./dist/trace.d.ts"
57+
"require": "./dist/cjs/trace.js"
6758
},
6859
"./type-system": {
69-
"bun": "./dist/type-system.js",
60+
"types": "./dist/type-system.d.ts",
7061
"import": "./dist/type-system.mjs",
71-
"require": "./dist/cjs/type-system.js",
72-
"types": "./dist/type-system.d.ts"
62+
"require": "./dist/cjs/type-system.js"
7363
},
7464
"./types": {
75-
"bun": "./dist/types.js",
65+
"types": "./dist/types.d.ts",
7666
"import": "./dist/types.mjs",
77-
"require": "./dist/cjs/types.js",
78-
"types": "./dist/types.d.ts"
67+
"require": "./dist/cjs/types.js"
7968
},
8069
"./utils": {
81-
"bun": "./dist/utils.js",
70+
"types": "./dist/utils.d.ts",
8271
"import": "./dist/utils.mjs",
83-
"require": "./dist/cjs/utils.js",
84-
"types": "./dist/utils.d.ts"
72+
"require": "./dist/cjs/utils.js"
8573
}
8674
},
8775
"repository": {
@@ -126,9 +114,7 @@
126114
"eslint-plugin-sonarjs": "^0.23.0",
127115
"expect-type": "^0.16.0",
128116
"memoirist": "0.1.6",
129-
"ts-toolbelt": "^9.6.0",
130117
"tsup": "^8.0.2",
131-
"type-fest": "^4.10.1",
132118
"typescript": "^5.4.2"
133119
},
134120
"peerDependencies": {

0 commit comments

Comments
 (0)