Skip to content

Commit 20d3a47

Browse files
committed
chore: Use oxfmt instead of prettier
Just trying the package out on a unpopular but medium sized package
1 parent e235f58 commit 20d3a47

74 files changed

Lines changed: 785 additions & 944 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.oxfmtrc.jsonc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": ["CHANGELOG.md"],
4+
"sortImports": {},
5+
"proseWrap": "always",
6+
"sortPackageJson": {
7+
"sortScripts": true,
8+
},
9+
}

.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Setup
44

5-
Install the version of [`bun`](https://bun.sh) specified in the `package.json#packageManager` field. Alternatively, use a version manager like [`bunv`](https://github.com/aklinker1/bunv).
5+
Install the version of [`bun`](https://bun.sh) specified in the `package.json#packageManager` field.
6+
Alternatively, use a version manager like [`bunv`](https://github.com/aklinker1/bunv).
67

78
## Scripts
89

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Zeta
22

3-
[![JSR](https://jsr.io/badges/@aklinker1/zeta)](https://jsr.io/@aklinker1/zeta) [![NPM Version](https://img.shields.io/npm/v/%40aklinker1%2Fzeta?logo=npm&labelColor=red&color=white)](https://www.npmjs.com/package/@aklinker1/zeta) [![Docs](https://img.shields.io/badge/Docs-blue?logo=readme&logoColor=white)](https://zeta.aklinker1.io) [![API Reference](https://img.shields.io/badge/API%20Reference-blue?logo=readme&logoColor=white)](https://jsr.io/@aklinker1/zeta/doc) [![License](https://img.shields.io/github/license/aklinker1/zeta)](https://github.com/aklinker1/zeta/blob/main/LICENSE) [![Changelog](https://img.shields.io/badge/Changelog-blue?logo=github&logoColor=white)](https://github.com/aklinker1/zeta/blob/main/CHANGELOG.md)
3+
[![JSR](https://jsr.io/badges/@aklinker1/zeta)](https://jsr.io/@aklinker1/zeta)
4+
[![NPM Version](https://img.shields.io/npm/v/%40aklinker1%2Fzeta?logo=npm&labelColor=red&color=white)](https://www.npmjs.com/package/@aklinker1/zeta)
5+
[![Docs](https://img.shields.io/badge/Docs-blue?logo=readme&logoColor=white)](https://zeta.aklinker1.io)
6+
[![API Reference](https://img.shields.io/badge/API%20Reference-blue?logo=readme&logoColor=white)](https://jsr.io/@aklinker1/zeta/doc)
7+
[![License](https://img.shields.io/github/license/aklinker1/zeta)](https://github.com/aklinker1/zeta/blob/main/LICENSE)
8+
[![Changelog](https://img.shields.io/badge/Changelog-blue?logo=github&logoColor=white)](https://github.com/aklinker1/zeta/blob/main/CHANGELOG.md)
49

510
Composable, fast, testable, OpenAPI-first backend framework with validation built-in.
611

benchmarks/overhead.ts

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ async function runBenchmark(
3030
};
3131
},
3232
): Promise<void> {
33-
if (
34-
process.argv[2] &&
35-
!name.toLowerCase().includes(process.argv[2].toLowerCase())
36-
) {
33+
if (process.argv[2] && !name.toLowerCase().includes(process.argv[2].toLowerCase())) {
3734
return;
3835
}
3936

@@ -77,8 +74,7 @@ await runBenchmark("Validate and Echo JSON Body", {
7774
headers: { "Content-Type": "application/json" },
7875
}),
7976
fetchFunctions: {
80-
vanilla: (req) =>
81-
req.json().then((body) => Response.json(TestObject.parse(body))),
77+
vanilla: (req) => req.json().then((body) => Response.json(TestObject.parse(body))),
8278
elysia: new Elysia().post("/", (ctx) => ctx.body, {
8379
body: TestObject,
8480
}).fetch,
@@ -97,18 +93,12 @@ await runBenchmark("Validate and Echo Query Params", {
9793
fetchFunctions: {
9894
vanilla: (req) =>
9995
Response.json(
100-
Object.fromEntries(
101-
new URLSearchParams(
102-
req.url.slice(req.url.indexOf("?") + 1),
103-
).entries(),
104-
),
96+
Object.fromEntries(new URLSearchParams(req.url.slice(req.url.indexOf("?") + 1)).entries()),
10597
),
10698
elysia: new Elysia().get("/", (ctx) => ctx.query, {
10799
query: TestObject,
108100
}).fetch,
109-
hono: new Hono().get("/", (ctx) =>
110-
ctx.json(TestObject.parse(ctx.req.query())),
111-
).fetch,
101+
hono: new Hono().get("/", (ctx) => ctx.json(TestObject.parse(ctx.req.query()))).fetch,
112102
zeta: createApp()
113103
// @ts-ignore: expects response schema, but works without it
114104
.get("/", { query: TestObject }, (ctx) => ctx.query)
@@ -122,9 +112,7 @@ await runBenchmark("Validate and Echo Path Params", {
122112
elysia: new Elysia().get("/:test", (ctx) => ctx.params, {
123113
params: TestObject,
124114
}).fetch,
125-
hono: new Hono().get("/:test", (ctx) =>
126-
ctx.json(TestObject.parse(ctx.req.param())),
127-
).fetch,
115+
hono: new Hono().get("/:test", (ctx) => ctx.json(TestObject.parse(ctx.req.param()))).fetch,
128116
zeta: createApp()
129117
// @ts-ignore: expects response schema, but works without it
130118
.get("/:test", { params: TestObject }, (ctx) => ctx.params)
@@ -139,9 +127,7 @@ await runBenchmark("Response Validation", {
139127
elysia: new Elysia().get("/", () => STATIC_RESPONSE, {
140128
response: TestObject,
141129
}).fetch,
142-
hono: new Hono().get("/", (ctx) =>
143-
ctx.json(TestObject.parse(STATIC_RESPONSE)),
144-
).fetch,
130+
hono: new Hono().get("/", (ctx) => ctx.json(TestObject.parse(STATIC_RESPONSE))).fetch,
145131
zeta: createApp()
146132
// @ts-ignore: expects response schema, but works without it
147133
.get("/", { responses: TestObject }, () => STATIC_RESPONSE)
@@ -152,9 +138,7 @@ await runBenchmark("Response Validation", {
152138
await runBenchmark("Single hook", {
153139
buildRequest: () => new Request("http://localhost/"),
154140
fetchFunctions: {
155-
elysia: new Elysia()
156-
.decorate({ fn: () => STATIC_RESPONSE })
157-
.get("/", (ctx) => ctx.fn()).fetch,
141+
elysia: new Elysia().decorate({ fn: () => STATIC_RESPONSE }).get("/", (ctx) => ctx.fn()).fetch,
158142
hono: new Hono()
159143
.use(
160144
createMiddleware<{

0 commit comments

Comments
 (0)