Skip to content

Commit 1cf939c

Browse files
committed
docs: improve grammar in blog/elysia-04.md
1 parent 8a2ab5b commit 1cf939c

File tree

1 file changed

+36
-37
lines changed

1 file changed

+36
-37
lines changed

docs/blog/elysia-04.md

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,40 @@ head:
3838
date="30 Mar 2023"
3939
>
4040
41-
Named after the opening music of ["The Liar Princess and the Blind Prince" trailer](https://youtu.be/UdBespMvxaA), [「月夜の音楽会」(Moonlit Night Concert)](https://youtu.be/o8b-IQulh1c) composed and sang by Akiko Shikata.
41+
Named after the opening music of ["The Liar Princess and the Blind Prince" trailer](https://youtu.be/UdBespMvxaA), [「月夜の音楽会」(Moonlit Night Concert)](https://youtu.be/o8b-IQulh1c), composed and performed by Akiko Shikata.
4242

43-
This version doesn't introduce an exciting new feature, later but a foundation for more solid ground, and internal improvement for the future of Elysia.
43+
This version doesn't introduce a single exciting new feature but rather lays a foundation for a more solid platform, focusing on internal improvements for the future of Elysia.
4444

45-
## Ahead of Time Complie
46-
By default, Elysia has to deal with conditional checking in various situations, for example, checking if the life-cycle of the route existed before performing, or unwrapping validation schema if provided.
45+
## Ahead-of-Time Compile
46+
By default, Elysia must deal with conditional checks in various situations, for example, checking if a route's life-cycle exists before executing it, or unwrapping a validation schema if provided.
4747

48-
This introduces a minimal overhead to Elysia and overall because even if the route doesn't have a life-cycle event attached to it, it needs to be runtime checked.
48+
This introduces a small runtime overhead because even if a route doesn't have a life-cycle event attached, it still needs to be checked at runtime.
4949

5050
Since every function is checked on compile time, it's not possible to have a conditional async, for example, a simple route that returns a file should be synced, but since it's compile-time checking, some routes might be async thus making the same simple route async too.
5151

52-
An async function introduces an additional tick to the function, making it a bit slower. But since Elysia is a foundation for web servers, we want to optimize every part to make sure that you don't run into performance problems.
52+
An async function introduces an additional tick, making it slightly slower. Since Elysia is a foundation for web servers, we optimize every part to help you avoid performance problems.
5353

54-
We fix this small overhead by introducing Ahead Time Compilation.
54+
We address this overhead by introducing Ahead-of-Time Compilation.
5555

56-
As the name suggests, instead of checking dynamic life-cycle and validation on the runtime, Elysia checks life-cycle, validation, and the possibility of an async function and generates a compact function, removing an unnecessary part like an un-used life-cycle and validation.
56+
As the name suggests, instead of checking dynamic life-cycle hooks and validation at runtime, Elysia checks life-cycle hooks, validation, and the possibility of an async function at compile time and generates a compact function, removing unnecessary parts like unused life-cycle hooks and validation.
5757

58-
Making conditional async function possible, since instead of using a centralized function for handling, we compose a new function especially created for each route instead. Elysia then checks all life-cycle functions and handlers to see if there's an async, and if not, the function will be synced to reduce additional overhead.
58+
Conditional async functions become possible because, instead of using a centralized handler, we compose a new function specifically created for each route. Elysia checks all life-cycle functions and handlers to see if any are async; if not, the generated function will be synchronous to reduce overhead.
5959

6060
## TypeBox 0.26
61-
TypeBox is a library that powered Elysia's validation and type provider to create a type-level single source of truth, re-exported as **Elysia.t**.
61+
TypeBox is the library that powers Elysia's validation and type system, providing a single source of truth at the type level and re-exported as **Elysia.t**.
6262

63-
In this update, we update TypeBox from 0.25.4 to 0.26.
63+
In this update, we upgrade TypeBox from 0.25.4 to 0.26.
6464

65-
This brings a lot of improvement and new features, for example, a `Not` type and `Convert` for `coercion` value which we might support in some next version of Elysia.
65+
This brings many improvements and new features, for example, a `Not` type and `Convert` for `coercion` values which we may support in a future version of Elysia.
6666

67-
But the one benefit for Elysia would be, `Error.First()` which allows us to get the first error of type instead of using Iterator, this reduces overhead in creating a new Error to send back to the client.
67+
One notable benefit for Elysia is `Error.First()`, which lets us get the first error instead of using an iterator. This reduces overhead when creating a new `Error` to send back to the client.
6868

69-
There are some changes to **TypeBox** and **Elysia.t** that normally wouldn't have much effect on your end, but you can see what's a new feature in [TypeBox release here.](https://github.com/sinclairzx81/typebox/blob/master/changelog/0.26.0.md)
69+
There are some changes to **TypeBox** and **Elysia.t** that normally won't affect you much, but you can see what's new in the [TypeBox release notes](https://github.com/sinclairzx81/typebox/blob/master/changelog/0.26.0.md).
7070

7171
## Validate response per status
72-
Previously, Elysia's response validate multiple status responses using union type.
72+
Previously, Elysia validated multiple status responses using a union type.
7373

74-
This might have unexpected results for highly dynamic apps with a strict response for status.
75-
For example if you have a route like:
74+
This could produce unexpected results for highly dynamic apps that require strict validation per status. For example, if you have a route like:
7675
```ts
7776
app.post('/strict-status', process, {
7877
schema: {
@@ -84,27 +83,27 @@ app.post('/strict-status', process, {
8483
})
8584
```
8685

87-
It's expected that if 200 response is not a string, then it should throw a validation error, but in reality, it wouldn't throw an error because response validation is using union. This might leave an unexpected value to the end user and a type error for Eden Treaty.
86+
It's expected that if a 200 response is not a string, it should throw a validation error, but in reality it wouldn't because response validation used a union. This could leave an unexpected value for the end user and cause a type error for Eden Treaty.
8887

89-
With this release, a response is validated per status instead of union, which means that it will strictly validate based on response status instead of unioned type.
88+
With this release, responses are validated per status instead of using a union, which means validation is strict based on the response status.
9089

9190
## Separation of Elysia Fn
92-
Elysia Fn is a great addition to Elysia, with Eden, it breaks the boundary between client and server allowing you to use any server-side function in your client, fully type-safe and even with primitive types like Error, Set, and Map.
91+
Elysia Fn is a great addition to Elysia. With Eden, it breaks the boundary between client and server, allowing you to use server-side functions in your client app, fully type-safe and with primitive types like Error, Set, and Map.
9392

94-
But with the primitive type support, Elysia Fn depends on "superjson" which is around 38% of Elysia's dependency size.
93+
However, because of primitive type support, Elysia Fn depends on `superjson`, which accounts for around 38% of Elysia's dependency size.
9594

96-
In this release, to use Elysia Fn, you're required to explicitly install `@elysiajs/fn` to use Elysia Fn. This approach is like installing an additional feature same as `cargo add --feature`.
95+
In this release, to use Elysia Fn you must explicitly install `@elysiajs/fn`. This approach is similar to installing an optional feature (e.g., `cargo add --feature`).
9796

98-
This makes Elysia lighter for servers that don't use Elysia Fn, Following our philosophy, **To ensure that you have what you actually need**
97+
This makes Elysia lighter for servers that don't use Elysia Fn—following our philosophy: **To ensure that you have only what you actually need**.
9998

100-
However, if you forgot to install Elysia Fn and accidentally use Elysia Fn, there will be a type warning reminding you to install Elysia Fn before usage, and a runtime error telling the same thing.
99+
If you forget to install Elysia Fn and attempt to use it, you'll get a type warning reminding you to install `@elysiajs/fn`, and a runtime error with the same message.
101100

102-
For migration, besides a breaking change of installing `@elysiajs/fn` explicitly, there's no migration need.
101+
For migration, besides the breaking change of installing `@elysiajs/fn` explicitly, no other migration is required.
103102

104103
## Conditional Route
105-
This release introduces `.if` method for registering a conditional route or plugin.
104+
This release introduces the `.if` method for registering a conditional route or plugin.
106105

107-
This allows you to declaratively for a specific conditional, for example excluding Swagger documentation from the production environment.
106+
This allows you to declaratively register conditionalfor example, excluding Swagger documentation in production:
108107
```ts
109108
const isProduction = process.env.NODE_ENV === 'production'
110109

@@ -113,10 +112,10 @@ const app = new Elysia().if(!isProduction, (app) =>
113112
)
114113
```
115114

116-
Eden Treaty will be able to recognize the route as if it's a normal route/plugin.
115+
Eden Treaty will be able to recognize the route as a normal route/plugin.
117116

118117
## Custom Validation Error
119-
Big thanks to amirrezamahyari on [#31](https://github.com/elysiajs/elysia/pull/31) which allows Elysia to access TypeBox's error property, for a better programmatically error response.
118+
Big thanks to amirrezamahyari on [#31](https://github.com/elysiajs/elysia/pull/31) which allows Elysia to access TypeBox's error property for better programmatic error responses.
120119

121120
```ts
122121
new Elysia()
@@ -146,26 +145,26 @@ new Elysia()
146145
.listen(3000)
147146
```
148147

149-
Now you can create a validation error for your API not limited to only the first error.
148+
Now you can create a validation error for your API that is not limited to only the first error.
150149

151150
---
152151

153-
### Notable Improvement:
152+
### Notable Improvements:
154153
- Update TypeBox to 0.26.8
155154
- Inline a declaration for response type
156-
- Refactor some type for faster response
157-
- Use Typebox `Error().First()` instead of iteration
155+
- Refactor some types for faster responses
156+
- Use TypeBox `Error().First()` instead of iteration
158157
- Add `innerHandle` for returning an actual response (for benchmark)
159158

160159
### Breaking Change:
161-
- Separate `.fn` to `@elysiajs/fn`
160+
- Separate `.fn` into `@elysiajs/fn`
162161

163162
## Afterward
164-
This release might not be a big release with a new exciting feature, but this improve a solid foundation, and Proof of Concept for planned I have for Elysia in the future, and making Elysia even faster and more versatile than it was.
163+
This release might not introduce an exciting new feature, but it improves the foundation and serves as a proof of concept for planned features in Elysia's future, making Elysia faster and more versatile.
165164

166-
I'm really excited for what will be unfold in the future.
165+
I'm really excited about what will unfold in the future.
167166

168-
Thank you for your continuous support for Elysia~
167+
Thank you for your continuous support of Elysia.
169168

170169
> the moonlit night concert, our secret
171170
>

0 commit comments

Comments
 (0)