@tsrx/hono 0.1.8 → 0.2.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/README.md +10 -0
- package/package.json +2 -2
- package/src/platform.js +8 -0
package/README.md
CHANGED
|
@@ -48,6 +48,16 @@ resolve statically within the module. It does not infer arbitrary Promise return
|
|
|
48
48
|
inter-module values, or object members that may have been overwritten by unknown
|
|
49
49
|
spreads or computed properties.
|
|
50
50
|
|
|
51
|
+
## Scripts
|
|
52
|
+
|
|
53
|
+
A `<script>` body is raw text, written into the output as it is in the source:
|
|
54
|
+
comments, `<`, `&`, and line breaks stay, and `{code}` is text, not an
|
|
55
|
+
expression. Both modes output it as `dangerouslySetInnerHTML`, because Hono's
|
|
56
|
+
server renderer escapes a string child like text. Server HTML runs the script when
|
|
57
|
+
the browser reads the page. The DOM renderer runs a script when it inserts it, as
|
|
58
|
+
it does for the same TSX. For a body computed at runtime, write
|
|
59
|
+
`<script dangerouslySetInnerHTML={{ __html: code }} />`.
|
|
60
|
+
|
|
51
61
|
## Build integrations
|
|
52
62
|
|
|
53
63
|
Use [@tsrx/vite-plugin-hono](../vite-plugin-hono/README.md) or
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Hono JSX compiler target for TSRX",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.2.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tsrx/core": "0.
|
|
46
|
+
"@tsrx/core": "0.5.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"hono": "^4.13.7"
|
package/src/platform.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
builders as b,
|
|
7
7
|
createJsxTransform,
|
|
8
|
+
DIAGNOSTIC_CODES,
|
|
8
9
|
error,
|
|
9
10
|
findFirstTopLevelAwait,
|
|
10
11
|
findFirstTopLevelAwaitInTsrxFunctionBody,
|
|
@@ -52,6 +53,7 @@ function create_hono_platform(mode) {
|
|
|
52
53
|
await_node,
|
|
53
54
|
ctx.errors,
|
|
54
55
|
ctx.comments,
|
|
56
|
+
DIAGNOSTIC_CODES.TARGET_AWAIT_UNSUPPORTED,
|
|
55
57
|
);
|
|
56
58
|
},
|
|
57
59
|
}
|
|
@@ -81,6 +83,10 @@ function create_hono_platform(mode) {
|
|
|
81
83
|
rewriteClassAttr: false,
|
|
82
84
|
multiRefStrategy: 'merge-refs',
|
|
83
85
|
hostSpreadRefBinding: 'in-place',
|
|
86
|
+
// Hono's server renderer escapes a string child of `<script>` like
|
|
87
|
+
// text; `dangerouslySetInnerHTML` renders the body as written in both
|
|
88
|
+
// modes.
|
|
89
|
+
scriptBody: 'dangerouslySetInnerHTML',
|
|
84
90
|
},
|
|
85
91
|
validation: {
|
|
86
92
|
// Server JSX supports async function components. The DOM renderer is
|
|
@@ -112,6 +118,7 @@ function create_hono_error_boundary(try_content, fallback_fn, ctx, node) {
|
|
|
112
118
|
reset_param,
|
|
113
119
|
ctx.errors,
|
|
114
120
|
ctx.comments,
|
|
121
|
+
DIAGNOSTIC_CODES.TARGET_CATCH_RESET_UNSUPPORTED,
|
|
115
122
|
);
|
|
116
123
|
}
|
|
117
124
|
|
|
@@ -163,6 +170,7 @@ export function validate_hono_dom_components(ast, filename, context) {
|
|
|
163
170
|
component,
|
|
164
171
|
context.errors,
|
|
165
172
|
context.comments,
|
|
173
|
+
DIAGNOSTIC_CODES.TARGET_AWAIT_UNSUPPORTED,
|
|
166
174
|
);
|
|
167
175
|
}
|
|
168
176
|
|