mono-jsx 0.1.0 → 0.1.1
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 +4 -15
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/types/jsx.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# mono-jsx
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
mono-jsx is a JSX runtime that renders `<html>` element to a `Response` object in JavaScript runtimes like Node.js, Deno, Bun, Cloudflare Workers, etc.
|
|
6
6
|
|
|
@@ -11,16 +11,6 @@ mono-jsx is a JSX runtime that renders `<html>` element to a `Response` object i
|
|
|
11
11
|
- ⏳ Streaming rendering
|
|
12
12
|
- 🌎 Universal, works in Node.js, Deno, Bun, Cloudflare Workers, etc.
|
|
13
13
|
|
|
14
|
-
```jsx
|
|
15
|
-
export default {
|
|
16
|
-
fetch: (req) => (
|
|
17
|
-
<html>
|
|
18
|
-
<h1>Hello World!</h1>
|
|
19
|
-
</html>
|
|
20
|
-
),
|
|
21
|
-
};
|
|
22
|
-
```
|
|
23
|
-
|
|
24
14
|
## Installation
|
|
25
15
|
|
|
26
16
|
mono-jsx supports all modern JavaScript runtimes including Node.js, Deno, Bun, Cloudflare Workers, etc.
|
|
@@ -43,8 +33,7 @@ To use mono-jsx as JSX runtime, add the following configuration to your `tsconfi
|
|
|
43
33
|
{
|
|
44
34
|
"compilerOptions": {
|
|
45
35
|
"jsx": "react-jsx",
|
|
46
|
-
"jsxImportSource": "mono-jsx"
|
|
47
|
-
"allowJs": true // required for supporting `.jsx` extension in Node.js
|
|
36
|
+
"jsxImportSource": "mono-jsx"
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
39
|
```
|
|
@@ -112,7 +101,7 @@ serve({
|
|
|
112
101
|
});
|
|
113
102
|
```
|
|
114
103
|
|
|
115
|
-
and you will need [tsx](https://www.npmjs.com/package/tsx) to start the app.
|
|
104
|
+
and you will need [tsx](https://www.npmjs.com/package/tsx) to start the app without a build step.
|
|
116
105
|
|
|
117
106
|
```bash
|
|
118
107
|
npx tsx app.tsx
|
|
@@ -260,7 +249,7 @@ function App() {
|
|
|
260
249
|
mono-jsx provides a minimal state runtime that allows you to update view based on state changes in client-side.
|
|
261
250
|
|
|
262
251
|
```tsx
|
|
263
|
-
function
|
|
252
|
+
function Counter(
|
|
264
253
|
this: FC<{ count: number }>,
|
|
265
254
|
props: { initialCount?: number },
|
|
266
255
|
) {
|
package/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// index.ts
|
|
2
|
-
console.log("
|
|
2
|
+
console.log("Welcome to mono-jsx!");
|
package/package.json
CHANGED
package/types/jsx.d.ts
CHANGED