jtsx-loader 0.1.11 → 0.1.13
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 +35 -23
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -106,29 +106,41 @@ app.listen(port, () => {
|
|
|
106
106
|
|
|
107
107
|
```jsx
|
|
108
108
|
const Component = async ({ message }) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
109
|
+
// It's not a good practice to make queries here. This example demonstrates full asynchronuos JavaScript support within the template.
|
|
110
|
+
const exampleObject = { example: 'object'};
|
|
111
|
+
|
|
112
|
+
// Uncomment to test fetch
|
|
113
|
+
// const fetchOnEachRender = await fetch('https://httpbingo.org/json').then(r => r.json());
|
|
114
|
+
|
|
115
|
+
// Example with Fragment
|
|
116
|
+
return <>
|
|
117
|
+
{'<!DOCTYPE HTML>'}
|
|
118
|
+
<html>
|
|
119
|
+
<head>
|
|
120
|
+
<title>{message}</title>
|
|
121
|
+
</head>
|
|
122
|
+
<body>
|
|
123
|
+
<div>
|
|
124
|
+
<h2>{message}</h2>
|
|
125
|
+
<p>Example object</p>
|
|
126
|
+
<pre>{JSON.stringify(exampleObject, null, 4)}</pre>
|
|
127
|
+
<p>Open console to see same object passed from server inside JavaScript</p>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
{/* Uncomment to test fetch */}
|
|
131
|
+
{/* <p>Response from <a href="https://httpbingo.org/json">https://httpbingo.org/json</a></p>
|
|
132
|
+
<pre>{JSON.stringify(fetchOnEachRender, null, 4)}</pre> */}
|
|
133
|
+
</div>
|
|
134
|
+
<script>{`
|
|
135
|
+
window.sum = 5 + 5;
|
|
136
|
+
console.log('window.sum', window.sum);
|
|
137
|
+
window.serverObject = ${JSON.stringify(exampleObject)}; // pass object from backend to frontend
|
|
138
|
+
console.log('window.serverObject', window.serverObject);
|
|
139
|
+
`}</script>
|
|
140
|
+
</body>
|
|
141
|
+
</html>
|
|
142
|
+
</>;
|
|
143
|
+
}
|
|
132
144
|
export default Component;
|
|
133
145
|
```
|
|
134
146
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jtsx-loader",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"main": "./loader/register.mjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"url": "git+https://github.com/dergachevm/jtsx-loader.git"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"esbuild": "^0.27.
|
|
34
|
+
"esbuild": "^0.27.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"express": "^5.2.1",
|