jeasx 2.0.0 β 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +359 -1
- package/env.js +26 -3
- package/esbuild.config.js +1 -1
- package/package.json +5 -5
- package/serverless.js +4 -4
- package/serverless.js.map +1 -1
- package/serverless.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,361 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 2025-10-28 - Jeasx 2.1.0 released
|
|
4
|
+
|
|
5
|
+
π Environment vars can now be loaded from a JavaScript file (`.env.js`) additionally to existing .env-files. This allows enhanced environment setups depending on your workflows.
|
|
6
|
+
|
|
7
|
+
Node 24 (LTS) is the official default runtime from now on.
|
|
8
|
+
|
|
9
|
+
Dependency updates: `@fastify/multipart@9.3.0`, `@fastify/static@8.3.0`, `@types/node@24.9.1`
|
|
10
|
+
|
|
11
|
+
## 2025-10-15 - Jeasx 2.0.1 released
|
|
12
|
+
|
|
13
|
+
π This releases fixes status codes for fallback 404 routes. Due to an unnoticed bug introduced by a minor refactoring, 404-routes were delivered with `status=200`, now it is the correct `status=404` again. This might impact your SEO score, so an update is highly recommended.
|
|
14
|
+
|
|
15
|
+
Dependency updates: `esbuild@0.25.11`
|
|
16
|
+
|
|
17
|
+
## 2025-10-12 - Jeasx 2.0.0 released
|
|
18
|
+
|
|
19
|
+
π Approximately one year after the release of Jeasx 1.0 I'm proud to announce the release of Jeasx 2.0.
|
|
20
|
+
|
|
21
|
+
It's a funny story... every time I think Jeasx is feature-complete, there is still some more room to improve. Although the main idea behind Jeasx development still holds true: focus on a lean and stable core and let developers do all their magic in userland.
|
|
22
|
+
|
|
23
|
+
This release is focused on security and comes with a major breaking change: all HTML markup is escaped by default from now on, so you don't have to escape dangerous user input on your own anymore. This way the developer experience is improved and the actual performance costs for automatic escaping are neglible due to the reuse of the highly optimized fast-escape-html library.
|
|
24
|
+
|
|
25
|
+
If you need to include literal HTML in your JSX templates (e.g. HTML snippets from a CMS), you can use a special object syntax to opt out of escaping: `{{ html: "<p>Some HTML from a CMS</p>" }}`
|
|
26
|
+
|
|
27
|
+
If you want to migrate from Jeasx 1.0 to Jeasx 2.0 with automatic HTML escaping enabled, you'll need to remove all calls to #escapeEntities() and modify the HTML declaration in your layouts (`{{ html: <!DOCTYPE html>" }}`). Then you should check where you need to render literal HTML (or other code) and apply the required changes to opt out of escaping (e.g. `<div>{ wysiwygContent }</div>; to <div>{{ html: wysiwygContent }}</div>`).
|
|
28
|
+
|
|
29
|
+
If you want to restore the non-escaping behaviour of Jeasx < v2, you can set `jsxEscapeHTML = false` in the root guard. This way HTML escaping is disabled globally.
|
|
30
|
+
|
|
31
|
+
Another internal change is the renaming of the directories in the output directory (`dist`): `routes` is now called `server` alongside the `browser` directory.
|
|
32
|
+
|
|
33
|
+
Dependency updates: `jsx-async-runtime@2.0.0, @types/node@22.18.10`
|
|
34
|
+
|
|
35
|
+
## 2025-09-29 - Jeasx 1.9.0 released
|
|
36
|
+
|
|
37
|
+
π This release drops the constraint that you had to put all routes into a dedicated routes-directory and all JavaScript & CSS into a dedicated browser-directory. From now on you can use any directory layout in your projects as you like. You can still use the proven `browser/routes` layout, but you don't have to.
|
|
38
|
+
|
|
39
|
+
This feature enables the co-location of server and browser code in the same directory which might be a better default for your workflows.
|
|
40
|
+
|
|
41
|
+
The only remaining constraint is to mark server routes with brackets (e.g. `[news].jsx`) and browser-bundled assets as index-files (e.g. `index.js` or `index.css`).
|
|
42
|
+
|
|
43
|
+
Please note: This feature is enabled by dropping the hard coded outbase-directories in the esbuild configuration. If the outbase directory isn't specified, it defaults to the lowest common ancestor directory among all input entry point paths.
|
|
44
|
+
|
|
45
|
+
If you run into an edge case (e.g. your browser bundles won't load anymore), here's how to fix it: if you store all your assets in browser/assets and request your assets via `/assets/...`, this won't work anymore, because assets is now the lowest common ancestor directory and is removed by esbuild. Simple fix: just put an empty `index.js` into browser directory, so this directory is lowest common ancestor directory again.
|
|
46
|
+
|
|
47
|
+
Bumbed the default `ESBUILD_BROWSER_TARGET` to `"chrome130", "edge130", "firefox130", "safari18"`.
|
|
48
|
+
|
|
49
|
+
Dependency updates: `fastify@5.6.1, esbuild@0.25.10, @types/node@22.18.6`
|
|
50
|
+
|
|
51
|
+
## 2025-09-11 - Jeasx 1.8.6 released
|
|
52
|
+
|
|
53
|
+
π This release bumps dependencies to the latest and greatest versions.
|
|
54
|
+
|
|
55
|
+
Dependency updates: `fastify@5.6.0, fastify/multipart@9.2.1, @types/node@22.18.1`
|
|
56
|
+
|
|
57
|
+
## 2025-08-13 - Jeasx 1.8.5 released
|
|
58
|
+
|
|
59
|
+
π This release bumps dependencies to the latest and greatest versions.
|
|
60
|
+
|
|
61
|
+
Dependency updates: `fastify@5.5.0, jsx-async-runtime@1.0.4, esbuild@0.25.9, @types/node@22.17.1`
|
|
62
|
+
|
|
63
|
+
## 2025-08-03 - Jeasx 1.8.4 released
|
|
64
|
+
|
|
65
|
+
π This release bumps dependencies to the latest and greatest versions.
|
|
66
|
+
|
|
67
|
+
Dependency updates: `esbuild@0.25.8, @types/node@22.17.0`
|
|
68
|
+
|
|
69
|
+
## 2025-07-11 - Jeasx 1.8.3 released
|
|
70
|
+
|
|
71
|
+
π This release bumps dependencies to the latest and greatest versions.
|
|
72
|
+
|
|
73
|
+
Dependency updates: `jsx-async-runtime@1.0.3, esbuild@0.25.6, @types/node@22.16.3`
|
|
74
|
+
|
|
75
|
+
## 2025-06-13 - Jeasx 1.8.2 released
|
|
76
|
+
|
|
77
|
+
π This release changes the default options for @fastify/multipart. From now on the default for `attachFieldsToBody` is `keyValues` which provides all data for form body requests (e.g. uploads) directly via request.body. Have a look at the Fastify documentation for code examples and options.
|
|
78
|
+
|
|
79
|
+
This change makes the required code for handling form body requests much easier:
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
// Change this code...
|
|
83
|
+
const file = await request.file();
|
|
84
|
+
const upload = await file.toBuffer()
|
|
85
|
+
const format = file.fields["format"]["value"];
|
|
86
|
+
|
|
87
|
+
// ... to this code.
|
|
88
|
+
const upload = request.body["upload"];
|
|
89
|
+
const format = request.body["format"];
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Please note: This change might break your code. If you want to revert to the old behaviour, you can set the following environment variable: `FASTIFY_βMULTIPART_βATTACH_βFIELDS_βTO_βBODY=false`
|
|
93
|
+
|
|
94
|
+
Dependency updates: `fastify@5.4.0, @types/node@22.15.31`
|
|
95
|
+
|
|
96
|
+
## 2025-05-28 - Jeasx 1.8.1 released
|
|
97
|
+
|
|
98
|
+
π Just some dependency updates...
|
|
99
|
+
|
|
100
|
+
Dependency updates: `jsx-async-runtime@1.0.2, fastify@5.3.3, fastify/static@8.2.0, esbuild@0.25.5, @types/node@22.15.23`
|
|
101
|
+
|
|
102
|
+
## 2025-05-12 - Jeasx 1.8.0 released
|
|
103
|
+
|
|
104
|
+
π This release introduces a custom error handler to provide user-friendly error messages for internal server errors and to facilitate team notifications.
|
|
105
|
+
|
|
106
|
+
To set up an error handler, simply register it in a route of your choice:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
this.errorHandler = async (error) => {
|
|
110
|
+
console.error("β", error);
|
|
111
|
+
return <h1>Internal error</h1>;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
An error handler is called with this as context, allowing easy access to your context setup.
|
|
116
|
+
|
|
117
|
+
**Breaking change:** If you use a response handler, you'll need to change the name from this.response to this.responseHandler. This aligns the response handler with the introduced error handler. We apologize for any inconvenience, but since this is a seldom-used feature, we aim to streamline the codebase by aligning it without maintaining deprecated code.
|
|
118
|
+
|
|
119
|
+
As additional feature, a response handler is now called with this as the context, so you can access your existing context.
|
|
120
|
+
|
|
121
|
+
Dependency updates: `esbuild@0.25.4, @types/node@22.15.17`
|
|
122
|
+
|
|
123
|
+
## 2025-05-03 - Jeasx 1.7.3 released
|
|
124
|
+
|
|
125
|
+
π This release introduces a performance improvement by switching the internal route-to-module cache implementation from a JavaScript object to a Map. This change allows for better management of cache entries, enabling the configuration of a maximum cache limit. To take advantage of this, a new configuration option `JEASX_ROUTE_CACHE_LIMIT` has been added.
|
|
126
|
+
|
|
127
|
+
Dependency updates: `jsx-async-runtime@1.0.1, esbuild@0.25.3, @types/node@22.15.3`
|
|
128
|
+
|
|
129
|
+
## 2025-04-21 - Jeasx 1.7.2 released
|
|
130
|
+
|
|
131
|
+
π This release is brings only minor changes:
|
|
132
|
+
|
|
133
|
+
`FASTIFY_STATIC_HEADERS`: Apply all matching headers to the current path. Use an empty string ("") as first rule to set default headers, which can be overridden by more specific rules later. Please checkout the updated configuration.
|
|
134
|
+
|
|
135
|
+
Please note: You may need to adjust your existing configuration by moving the wildcard rule to the top of the JSON file to ensure it can be overridden by more specific rules defined below.
|
|
136
|
+
env.sh: Removed logging of loaded environment files. Minor refactoring to clean up the code.
|
|
137
|
+
|
|
138
|
+
Dependency updates: `fastify@5.3.2, @types/node@22.14.1`
|
|
139
|
+
|
|
140
|
+
## 2025-03-31 - Jeasx 1.7.1 released
|
|
141
|
+
|
|
142
|
+
π This release enhances support for Bun as an alternative JavaScript runtime for both development and production. Use `bun -b dev` to start development with Jeasx and Bun. With Bun 1.2.8, the entire Jeasx expo functions without any issues. While Node.js remains the primary focus of the project, Bun support will continue to improve. Having multiple options is always beneficial.
|
|
143
|
+
|
|
144
|
+
Route loading in development has been enhanced. It now relies on the modification time of the module, eliminating the need to calculate a hash for the file content. Additionally, a redundant file existence check for route handlers has been removed, resulting in more streamlined core code.
|
|
145
|
+
|
|
146
|
+
From now on, source maps for `serverless.js` are provided to enhance debugging.
|
|
147
|
+
|
|
148
|
+
Dependency updates: `esbuild@0.25.2`
|
|
149
|
+
|
|
150
|
+
## 2025-03-27 - Jeasx 1.7.0 released
|
|
151
|
+
|
|
152
|
+
π This release removes `pm2` as a dependency and utilizes the powerful file watching capabilities of esbuild directly. This enhancement significantly improves build performance because esbuild only re-compiles linked files. Additionally, sharing code between the server and browser now works seamlessly without any additional configurations.
|
|
153
|
+
|
|
154
|
+
As an added benefit, Jeasx now works with Bun as an alternative JavaScript runtime, although this setup is not yet recommended for development or production.
|
|
155
|
+
|
|
156
|
+
Dependency updates: `@types/node@22.13.14`
|
|
157
|
+
|
|
158
|
+
## 2025-03-26 - Jeasx 1.6.3 released
|
|
159
|
+
|
|
160
|
+
π This release fixes a bug with the recently introduced env file loading. The env files were loaded in the wrong order, so that overwriting existing env variables didn't work.
|
|
161
|
+
|
|
162
|
+
Dependency updates: `fastify@5.2.2, @types/node@22.13.13`
|
|
163
|
+
|
|
164
|
+
## 2025-03-19 - Jeasx 1.6.2 released
|
|
165
|
+
|
|
166
|
+
π This release introduces a `try/catch` block in the central request handler, ensuring that proper error messages are logged. Additionally, it enables sourcemaps for both server and browser code, making debugging a breeze.
|
|
167
|
+
|
|
168
|
+
To enable sourcemap support for Node.js, add the following code to the root of your project as a .npmrc file:
|
|
169
|
+
|
|
170
|
+
`node-options=--enable-source-maps`
|
|
171
|
+
|
|
172
|
+
If you are using Docker, you need to modify the following lines in your Dockerfile to enable support for `.npmrc`:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# RUN npx jeasx build
|
|
176
|
+
RUN npm run build
|
|
177
|
+
# CMD ["npx","jeasx","start"]
|
|
178
|
+
CMD ["npm","start"]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 2025-03-15 - Jeasx 1.6.1 released
|
|
182
|
+
|
|
183
|
+
π This releases replaces the dependency on `dotenv-flow` with a native implementation provided by Node.js (using `process.loadEnvFile` introduced with Node v20.12.0) to load environment variables from .env-files. The order of loading .env-files is the same as before:
|
|
184
|
+
|
|
185
|
+
```text
|
|
186
|
+
.env.defaults
|
|
187
|
+
.env
|
|
188
|
+
.env.local
|
|
189
|
+
.env.[NODE_ENV] (e.g. .env.development or .env.production)
|
|
190
|
+
.env.[NODE_ENV].local (e.g. .env.development.local or .env.production.local)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Breaking change:** If you use .env-files to configure Jeasx and deploy to Vercel, please update your `vercel.json`. You'll need to change `"includeFiles": "{node_modules,dist,public}/**/*"` to `"includeFiles": "./**/*"to` make sure Vercel includes the .env-files in the deployment.
|
|
194
|
+
|
|
195
|
+
Additionally a fix for correctly parsing environment variables to configure Fastify (`FASTIFY_DISABLE_REQUEST_LOGGING, FASTIFY_TRUST_PROXY`) was implemented.
|
|
196
|
+
|
|
197
|
+
Dependency updates: `jsx-async-runtime@1.0.0, esbuild@0.25.1, pm2@6.0.5`
|
|
198
|
+
|
|
199
|
+
Please note: version 1.6.0 was unpublished from NPM right after the release due to a mistake.
|
|
200
|
+
|
|
201
|
+
## 2025-03-09 - Jeasx 1.5.0 released
|
|
202
|
+
|
|
203
|
+
π This release features two new configurations:
|
|
204
|
+
|
|
205
|
+
`FASTIFY_REWRITE_URL` allows you to rewrite incoming URLs. Useful when running behind proxies or when you want to fake URLs.
|
|
206
|
+
`JEASX_BUILD_ROUTES_IGNORE_WATCH` allows watching for changes in src/browser when importing browser code into server code.
|
|
207
|
+
|
|
208
|
+
Dependency updates: `@types/node@22.13.10`
|
|
209
|
+
|
|
210
|
+
## 2025-03-01 - Jeasx 1.4.1 released
|
|
211
|
+
|
|
212
|
+
π This release features an updated `jsx-async-runtime@0.8.1` which brings typings for SVGs for a better developer experience in the IDE of your choice.
|
|
213
|
+
|
|
214
|
+
3rd-party dependencies were updated to the latest versions: `@fastify/static@8.1.1, @types/node@22.13.5`
|
|
215
|
+
|
|
216
|
+
## 2025-02-12 - Jeasx 1.4.0 released
|
|
217
|
+
|
|
218
|
+
π This release adds the route property to the current endpoint handler (e.g., `/[index]` or `/bar/[...path]`) to the request object (accessible via request.route). This makes it much easier to calculate trailing path segments for wildcard routes.
|
|
219
|
+
|
|
220
|
+
Also several dependencies were updated to the latest versions: `esbuild@0.25.0, @fastify/static@8.1.0, @fastify/multipart@9.0.3, @fastify/formbody@8.0.3, @types/node@22.13.1`
|
|
221
|
+
|
|
222
|
+
## 2025-01-18 - Jeasx 1.3.0 released
|
|
223
|
+
|
|
224
|
+
π We are excited to announce the release of `jsx-async-runtime@0.7.1`, which now includes proper typings for all HTML attributes in accordance with the Mozilla Developer Network. This ensures that code completion in your IDE for all HTML attributes works now as expected in Jeasx. Special thanks to Rebecca for highlighting this issue!
|
|
225
|
+
|
|
226
|
+
The updated version of `jsx-async-runtime` now supports using an array of strings for the class attribute, making it easier to create complex classnames. You can now construct classnames using plain strings or template strings, an array of strings, or an object, covering most use-cases known from other libraries like classnames.
|
|
227
|
+
|
|
228
|
+
As always, we've updated to the latest versions of our dependencies: `fastify/formbody@8.0.2, fastify/multipart@9.0.2, fastify/static@8.0.4, types/node@22.10.7`
|
|
229
|
+
|
|
230
|
+
## 2025-01-06 - Jeasx 1.2.2 released
|
|
231
|
+
|
|
232
|
+
π This release is just a minor dependency update: `fastify@5.2.1, fastify/cookie@11.0.2, types/node@22.10.5`
|
|
233
|
+
|
|
234
|
+
## 2024-12-12 - Jeasx 1.2.1 released
|
|
235
|
+
|
|
236
|
+
π This release fixes a bug introduced by the recently introduced route caching feature: if a guard returned different response types (e.g. JSX code for a forbidden route, otherwise props for the guarded routes), the guarded routes weren't resolved anymore.
|
|
237
|
+
|
|
238
|
+
## 2024-12-07 - Jeasx 1.2.0 released
|
|
239
|
+
|
|
240
|
+
π This release brings a major performance boost (about 2-5 times faster in benchmarks) by introducing runtime caches for resolved routes and loaded JavaScript modules. The caches are only used in production and won't interfere with your development workflow. This change was triggered by a PR submitted by Bryce, Kudos to him for bringing this topic onto the radar.
|
|
241
|
+
|
|
242
|
+
It also features an update to `jsx-async-runtime` which provides more accurate and also deprecated typings for HTML tags and attributes according to the fantastic HTML reference from the Mozilla Development Network.
|
|
243
|
+
|
|
244
|
+
Added two new environment variables (`FASTIFY_DISABLE_REQUEST_LOGGING` and `FASTIFY_TRUST_PROXY`) to give you more control over how Jeasx should behave in different environments.
|
|
245
|
+
|
|
246
|
+
## 2024-12-01 - Jeasx 1.1.0 released
|
|
247
|
+
|
|
248
|
+
π Migrated from dotenv to dotenv-flow, so you can use NODE_ENV-specific .env* files (like `.env.development`) to configure different environments for production and development. This is useful to disable caching headers (e.g. via `FASTIFY_STATIC_HEADERS`) in development, as Jeasx applies `FASTIFY_STATIC_HEADERS` in development from now on for a more consistent developer expierence. See updated .env-files in the quickstart-project for an example how to disable caching in development. This is only needed if you have configured `FASTIFY_STATIC_HEADERS` for your existing projects.
|
|
249
|
+
|
|
250
|
+
Bumped default environment variable `ESBUILD_BROWSER_TARGET` to more recent browser versions (e.g. `chrome126, edge126, firefox128, safari17`). If you want to stick with older versions, you can override it via the environment. Learn more about possible values at the esbuild website.
|
|
251
|
+
|
|
252
|
+
Updated `jsx-async-runtime` which fixes a bug in escapeEntities which escaped existing & two times. This release also removes the deprecated `renderToString` function. Simply replace it with `jsxToString`.
|
|
253
|
+
|
|
254
|
+
The default host is now :: which binds to all available network interfaces (e.g. `IPv6`). You can change it via the `HOST` environment variable (e.g. `HOST=0.0.0.0` for the old behaviour). The change is especially useful to connect to Jeasx via private networking on hosting platforms like Railway.
|
|
255
|
+
|
|
256
|
+
## 2024-11-15 - Jeasx 1.0.2 released
|
|
257
|
+
|
|
258
|
+
π Disabled cache-control for fastify-static, so proper Cache-Control response header could be applied via the environment variable `FASTIFY_STATIC_HEADERS`. Have a look at the env-file in the quickstart project for an example.
|
|
259
|
+
|
|
260
|
+
## 2024-11-01 - Jeasx 1.0.1 released
|
|
261
|
+
|
|
262
|
+
π This version brings official support for Node 22. Also dependencies were updated to latest versions of `fastify@5.0.1, fastify/static@8.0.2, fastify/cookie@11.0.1`. Added new examples for template fragments in combination with HTMX and image optimization with sharp.
|
|
263
|
+
|
|
264
|
+
## 2024-10-04 - Jeasx 1.0.0 released
|
|
265
|
+
|
|
266
|
+
It's finally here! Jeasx 1.0.0 is ready for production. We are proud to announce that the framework has reached feature completeness and is now ready for the masses. Lots of hours of work have been put into this project to make sure you have the best experience possible.
|
|
267
|
+
|
|
268
|
+
## 2024-09-23 - Jeasx 0.15.2 released
|
|
269
|
+
|
|
270
|
+
Updates to all `@fastify-plugins, esbuild@0.24.0`
|
|
271
|
+
|
|
272
|
+
## 2024-09-21 - Jeasx 0.15.1 released
|
|
273
|
+
|
|
274
|
+
Decorate the Fastify request object with `path` property, so you can easily access the route path without query parameters via request.path. This solves 99% of all use-cases for recently removed `@fastity/url-data`.
|
|
275
|
+
|
|
276
|
+
## 2024-09-20 - Jeasx 0.15.0 released
|
|
277
|
+
|
|
278
|
+
This release comes with Fastify 5. It also removes `@fastify/url-data` and `@fastify/accepts` as dependencies, therefore your code might break. The reason behind this removal is to depend on less dependencies in the long run which makes maintenance of the core easier.
|
|
279
|
+
|
|
280
|
+
If you rely on either accepts or url-data, you must provide appropriate changes in userland code. For `@fastify/url-data` I would recommend to use `fast-uri` and for `@fastify/accepts` `jshttp/accepts` for parsing accept-header if needed.
|
|
281
|
+
|
|
282
|
+
Please note: there were some intermediate releases since the past proper release which shouldn't be used (and are mostly unpublished from npm).
|
|
283
|
+
|
|
284
|
+
## 2024-08-21 - Jeasx 0.11.2 released
|
|
285
|
+
|
|
286
|
+
Added simple Dockerfile to quickstart template. Dependency updates: `esbuild@0.23.1, @fastify/cookie@9.4.0, @types/node@20.16.1`
|
|
287
|
+
|
|
288
|
+
## 2024-07-27 - Jeasx 0.11.1 released
|
|
289
|
+
|
|
290
|
+
Performance optimization: if response is string or buffer, break evaluation loop early. This allows to build caches for pages and binary assets in userland.
|
|
291
|
+
|
|
292
|
+
## 2024-07-26 - Jeasx 0.11.0 released
|
|
293
|
+
|
|
294
|
+
Updated to `jsx-async-runtime@0.5.0` which allows to override `jsxToString` from `jsx-async-runtime` to intercept / modify / replace JSX components via this context. Have a look at the example to see how it works.
|
|
295
|
+
|
|
296
|
+
## 2024-07-19 - Jeasx 0.10.1 released
|
|
297
|
+
|
|
298
|
+
Breaking change: removed `@fastify/request-context` in favor of the recently introduced this context. Changing your code should be straightforward. This change decouples userland code from Fastify. Additionally code for Jeasx and `jsx-async-runtime` is provided unminified, so debugging and testing is far easier now.
|
|
299
|
+
|
|
300
|
+
## 2024-07-12 - Jeasx 0.9.1 released
|
|
301
|
+
|
|
302
|
+
Updated to `jsx-async-runtime@0.4.1` which fixes a problem when running tests with Vitest.
|
|
303
|
+
|
|
304
|
+
## 2024-07-10 - Jeasx 0.9.0 released
|
|
305
|
+
|
|
306
|
+
Updated to `jsx-async-runtime@0.4.0` which allows to use `this` as context object to avoid prop drilling. Have a look at the demo to see how things work.
|
|
307
|
+
|
|
308
|
+
## 2024-07-05 - Jeasx 0.8.0 released
|
|
309
|
+
|
|
310
|
+
Updated to `jsx-async-runtime@0.3.0` (deprecated `renderToString` in favor of `jsxToString`)
|
|
311
|
+
|
|
312
|
+
## 2024-07-03 - Jeasx 0.7.6 released
|
|
313
|
+
|
|
314
|
+
Updated to `esbuild@0.23.0`
|
|
315
|
+
|
|
316
|
+
## 2024-07-01 - Jeasx 0.7.5 released
|
|
317
|
+
|
|
318
|
+
Updated to `fastify@4.28.1, esbuild@0.22.0, pm2@5.4.1`
|
|
319
|
+
|
|
320
|
+
## 2024-05-28 - Jeasx 0.7.4 released
|
|
321
|
+
|
|
322
|
+
Updated to `esbuild@0.21.4, pm2@5.4.0`
|
|
323
|
+
|
|
324
|
+
## 2024-05-17 - Jeasx 0.7.3 released
|
|
325
|
+
|
|
326
|
+
Updated to `esbuild@0.21.3, @types/node@20.12.12`
|
|
327
|
+
|
|
328
|
+
## 2024-05-08 - Jeasx 0.7.2 released
|
|
329
|
+
|
|
330
|
+
Updated to `fastify@4.27.0, esbuild@0.21.1, @fastify/static@7.0.4`
|
|
331
|
+
|
|
332
|
+
## 2024-05-07 - Jeasx 0.7.1 released
|
|
333
|
+
|
|
334
|
+
Updated `esbuild@0.21.0`
|
|
335
|
+
|
|
336
|
+
## 2024-04-27 - Jeasx 0.7.0 released
|
|
337
|
+
|
|
338
|
+
This release introduces a new feature that allows you to post-process the resulting payloads, such as prettifying the HTML output. You can now set up a response handler, for example, in a guard. The response handler takes the resulting payload as a parameter and returns the modified payload.
|
|
339
|
+
|
|
340
|
+
```js
|
|
341
|
+
import * as prettier from "prettier";
|
|
342
|
+
|
|
343
|
+
export default function RootGuard({ request, reply }) {
|
|
344
|
+
this.response = async (payload) => {
|
|
345
|
+
return typeof payload === "string" &&
|
|
346
|
+
String(reply.getHeader("content-type")).startsWith("text/html")
|
|
347
|
+
? await prettier.format(payload, { parser: "html" })
|
|
348
|
+
: payload;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Shame on me... I have recently started writing news as we approach the 1.0 release. But you can study the changelog at GitHub to see what has happend in the past.
|
|
354
|
+
|
|
355
|
+
## 2023-12-30 - First public commit
|
|
356
|
+
|
|
357
|
+
Our Journey Begins! π Introducing Jeasx, a revolutionary web development framework born out of a summer experiment in 2023.
|
|
358
|
+
|
|
359
|
+
Our mission?
|
|
360
|
+
|
|
361
|
+
To simplify web development using server-rendered JSX as the cornerstone, bringing back the essence of the web: HTML, CSS, and progressive enhancing JavaScript. Join us as we redefine the future of web development together!
|
package/env.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Load environment variables from .env* files
|
|
@@ -9,11 +10,12 @@ import { existsSync } from "node:fs";
|
|
|
9
10
|
* 3. .env.local
|
|
10
11
|
* 4. .env
|
|
11
12
|
* 5. .env.defaults
|
|
13
|
+
* 6. .env.js
|
|
12
14
|
*
|
|
13
|
-
* If a variable already exists in
|
|
14
|
-
* it will be not overwritten.
|
|
15
|
+
* If a variable already exists in a previous environment,
|
|
16
|
+
* it will be not overwritten at a later stage.
|
|
15
17
|
*/
|
|
16
|
-
export default function env() {
|
|
18
|
+
export default async function env() {
|
|
17
19
|
if (process.loadEnvFile) {
|
|
18
20
|
[
|
|
19
21
|
...(process.env.NODE_ENV
|
|
@@ -26,4 +28,25 @@ export default function env() {
|
|
|
26
28
|
.filter(existsSync)
|
|
27
29
|
.forEach(process.loadEnvFile);
|
|
28
30
|
}
|
|
31
|
+
try {
|
|
32
|
+
const envFile = `file://${join(process.cwd(), ".env.js")}`;
|
|
33
|
+
const envObject = (await import(envFile)).default;
|
|
34
|
+
Object.entries(envObject).forEach(([key, value]) => {
|
|
35
|
+
if (!(key in process.env)) {
|
|
36
|
+
switch (typeof value) {
|
|
37
|
+
case "string":
|
|
38
|
+
process.env[key] = value;
|
|
39
|
+
break;
|
|
40
|
+
case "function":
|
|
41
|
+
process.env[key] = value.toString();
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
process.env[key] = JSON.stringify(value);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
} catch (e) {
|
|
50
|
+
// ERR_MODULE_NOT_FOUND
|
|
51
|
+
}
|
|
29
52
|
}
|
package/esbuild.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jeasx",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Jeasx - the ease of JSX with the power of SSR",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@fastify/cookie": "11.0.2",
|
|
28
28
|
"@fastify/formbody": "8.0.2",
|
|
29
|
-
"@fastify/multipart": "9.
|
|
30
|
-
"@fastify/static": "8.
|
|
31
|
-
"@types/node": "
|
|
32
|
-
"esbuild": "0.25.
|
|
29
|
+
"@fastify/multipart": "9.3.0",
|
|
30
|
+
"@fastify/static": "8.3.0",
|
|
31
|
+
"@types/node": "24.9.1",
|
|
32
|
+
"esbuild": "0.25.11",
|
|
33
33
|
"fastify": "5.6.1",
|
|
34
34
|
"jsx-async-runtime": "2.0.0"
|
|
35
35
|
},
|
package/serverless.js
CHANGED
|
@@ -7,7 +7,7 @@ import { jsxToString } from "jsx-async-runtime";
|
|
|
7
7
|
import { stat } from "node:fs/promises";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
import env from "./env.js";
|
|
10
|
-
env();
|
|
10
|
+
await env();
|
|
11
11
|
const NODE_ENV_IS_DEVELOPMENT = process.env.NODE_ENV === "development";
|
|
12
12
|
const CWD = process.cwd();
|
|
13
13
|
const FASTIFY_STATIC_HEADERS = process.env.FASTIFY_STATIC_HEADERS && JSON.parse(process.env.FASTIFY_STATIC_HEADERS);
|
|
@@ -98,13 +98,13 @@ async function handler(request, reply) {
|
|
|
98
98
|
});
|
|
99
99
|
if (reply.sent) {
|
|
100
100
|
return;
|
|
101
|
+
} else if (route.endsWith("/[404]")) {
|
|
102
|
+
reply.status(404);
|
|
103
|
+
break;
|
|
101
104
|
} else if (typeof response === "string" || Buffer.isBuffer(response) || isJSX(response)) {
|
|
102
105
|
break;
|
|
103
106
|
} else if (route.endsWith("/[...guard]") && (response === void 0 || typeof response === "object")) {
|
|
104
107
|
continue;
|
|
105
|
-
} else if (route.endsWith("/[404]")) {
|
|
106
|
-
reply.status(404);
|
|
107
|
-
break;
|
|
108
108
|
} else if (reply.statusCode === 404) {
|
|
109
109
|
continue;
|
|
110
110
|
} else {
|
package/serverless.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["serverless.ts"],
|
|
4
|
-
"mappings": "AAAA,OAAO,mBAAmB;AAC1B,OAAO,qBAAqB;AAC5B,OAAO,sBAAsB;AAC7B,OAAO,mBAAmB;AAC1B,OAAO,aAA+C;AACtD,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,OAAO,SAAS;AAEhB,IAAI;
|
|
4
|
+
"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node:fs/promises";
|
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
import env from "./env.js";
|
|
10
10
|
|
|
11
|
-
env();
|
|
11
|
+
await env();
|
|
12
12
|
|
|
13
13
|
const NODE_ENV_IS_DEVELOPMENT = process.env.NODE_ENV === "development";
|
|
14
14
|
const CWD = process.cwd();
|
|
@@ -158,6 +158,9 @@ async function handler(request: FastifyRequest, reply: FastifyReply) {
|
|
|
158
158
|
|
|
159
159
|
if (reply.sent) {
|
|
160
160
|
return;
|
|
161
|
+
} else if (route.endsWith("/[404]")) {
|
|
162
|
+
reply.status(404);
|
|
163
|
+
break;
|
|
161
164
|
} else if (
|
|
162
165
|
typeof response === "string" ||
|
|
163
166
|
Buffer.isBuffer(response) ||
|
|
@@ -169,9 +172,6 @@ async function handler(request: FastifyRequest, reply: FastifyReply) {
|
|
|
169
172
|
(response === undefined || typeof response === "object")
|
|
170
173
|
) {
|
|
171
174
|
continue;
|
|
172
|
-
} else if (route.endsWith("/[404]")) {
|
|
173
|
-
reply.status(404);
|
|
174
|
-
break;
|
|
175
175
|
} else if (reply.statusCode === 404) {
|
|
176
176
|
continue;
|
|
177
177
|
} else {
|