@mpen/jsxhtml 0.5.1 → 0.5.2
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/README.md +2 -29
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -62,40 +62,13 @@ Add these options to your `tsconfig.json` or Babel config.
|
|
|
62
62
|
|
|
63
63
|
## Elysia Integration
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
import {elysiaJsx} from '@mpen/jsxhtml'
|
|
69
|
-
|
|
70
|
-
new Elysia()
|
|
71
|
-
.use(elysiaJsx())
|
|
72
|
-
.get('/', () => {
|
|
73
|
-
return (
|
|
74
|
-
<HtmlDocument lang="en">
|
|
75
|
-
<head>
|
|
76
|
-
<title>Hello JsxHtml</title>
|
|
77
|
-
</head>
|
|
78
|
-
<body>
|
|
79
|
-
Hi there!
|
|
80
|
-
</body>
|
|
81
|
-
</HtmlDocument>
|
|
82
|
-
)
|
|
83
|
-
})
|
|
84
|
-
.listen(3000)
|
|
85
|
-
```
|
|
86
|
-
```txt
|
|
87
|
-
<!DOCTYPE html><html lang="en"><head><title>Hello JsxHtml</title></head><body>Hi there!</body></html>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
It should be just as easy to integrate with [Express](https://expressjs.com/) or any other JavaScript server, because JsxHtml compiles to an object with a `.toString()` method -- so if your framework allows you to send a string in the response body, you're good to go.
|
|
91
|
-
|
|
92
|
-
For reference, so you can see how easy this is, the entire Elysia plugin is this:
|
|
65
|
+
As of v0.5, the Elysia plugin has been removed, but it's very easy to implement yourself:
|
|
93
66
|
|
|
94
67
|
```ts
|
|
95
68
|
import {isJsxNode} from './jsx-nodes'
|
|
69
|
+
import {Elysia} from 'elysia'
|
|
96
70
|
|
|
97
71
|
export function elysiaJsx() {
|
|
98
|
-
const {Elysia} = require('elysia') as typeof import('elysia')
|
|
99
72
|
return new Elysia()
|
|
100
73
|
.onAfterHandle(({response}) => {
|
|
101
74
|
if(isJsxNode(response)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpen/jsxhtml",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"packageManager": "bun@1.3.7",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
|
68
68
|
"@typescript-eslint/parser": "^8.29.1",
|
|
69
69
|
"bun-types": "^1.2.15",
|
|
70
|
-
"elysia": "^1.2.25",
|
|
71
70
|
"eslint": "^8.57.1",
|
|
72
71
|
"eslint-plugin-react-compiler": "^19.0.0-beta-e993439-20250405",
|
|
73
72
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
@@ -79,11 +78,10 @@
|
|
|
79
78
|
"rollup": "^4.40.0",
|
|
80
79
|
"serve": "^14.2.4",
|
|
81
80
|
"tslib": "^2.8.1",
|
|
82
|
-
"typescript": "^5.
|
|
81
|
+
"typescript": "^5.9.3"
|
|
83
82
|
},
|
|
84
83
|
"peerDependencies": {
|
|
85
|
-
"csstype": "3.x"
|
|
86
|
-
"elysia": "1.x"
|
|
84
|
+
"csstype": "3.x"
|
|
87
85
|
},
|
|
88
86
|
"peerDependenciesMeta": {
|
|
89
87
|
"elysia": {
|