Introducing 4.0!

do4ng - 25-03-17

In v4, everything has changed internally.

#Performance

With version 4.0.0-next.16, performance has improved approximately 6 times compared to previous versions, allowing it to handle three times more requests.

Performance Benchmark

Note: There was a significant performance drop when updating from 2.0 to 3.0, but this issue has been resolved with the 4.0 update, making it even faster.

INFO

PkgLatencyRequests/SecBytes/Sec
4.0.0-next.19:serpack-on0.03 ms18K2.3 MB
4.0.0-next.9:serpack-on0.03 ms17.5K2.23 MB
3.0.01.18 ms5.9K774.47 KB
2.0.0-next.240.23 ms11.4K1.45 MB
1.0.00.04 ms17.7K2.26 MB

#New Compiler

In the existing zely, esbuild was used as the default loader.
Although esbuild is still the default loader, zely introduced a new loader serpack based on swc.
It will increase the expandability of zely in the future.

Terminal
zely dev --serpack

Serpack is less performant than esbuild (but it still fast!), it has the advantage of being optimized for zely.

WARNING

This compiler is under development. The sourcemap and circular dependency issues are still not resolved.

#Build Server

Server build feature added!
You can bundle multiple typescript pages into one JavaScript File.

auto importing feature isn't supported.

Refer: Build Server

#CLI Request Tool

No more writing code during server development, such as creating separate JavaScript files to check if it works properly.

Plain
$ zely request
 
▸ baseURL: http://localhost:3001
 
[12:31:35 AM] info checking server... (requesting /)
 
GET> /
200 {"msg":"Hello","name":""}
GET>

Set header or method using JavaScript code in input prompt.

Plain
GET> config1 = { method: "POST", headers: { }, body: { name: "Cat" } }
GET> set(config1)
POST(config1)> /greeting
200 Hello, Cat!

TIP

Declare variables without declaration statements such as const or let.

#HTML Support

The new HTML loader goes through a compilation step instead of just passing the original HTML file, which increases responsiveness. - learn more

To use HTML loader, enable experimental.useHTML.

zely.config.ts
import { defineConfig } from 'zely';
 
export default defineConfig({
  experimental: {
    useHTML: true,
  },
});

INFO

Example: simple counter

#Minor News

#CLI

The CLI utility animaux has been updated!
The new version is more stable and TypeScript friendly.

#Integrating multiple packages

4 packages have been integrated into the main module.