@taujs/server 0.0.3 → 0.0.5
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 +18 -33
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -90,11 +90,10 @@ Extended pipe object with callbacks to @taujs/server enabling additional manipul
|
|
|
90
90
|
|
|
91
91
|
```
|
|
92
92
|
import { ServerResponse } from 'node:http';
|
|
93
|
-
import { Writable } from 'node:stream';
|
|
94
93
|
|
|
95
94
|
import React from 'react';
|
|
96
|
-
import { renderToPipeableStream } from 'react-dom/server';
|
|
97
95
|
import { createSSRStore, SSRStoreProvider } from '@taujs/server/data-store';
|
|
96
|
+
import { createStreamRenderer } from '@taujs/server/render';
|
|
98
97
|
|
|
99
98
|
import AppBootstrap from '@client/AppBootstrap';
|
|
100
99
|
|
|
@@ -108,38 +107,24 @@ export const streamRender = (
|
|
|
108
107
|
) => {
|
|
109
108
|
const store = createSSRStore(initialDataPromise);
|
|
110
109
|
|
|
111
|
-
const
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
</
|
|
115
|
-
|
|
116
|
-
bootstrapModules: [bootstrapModules],
|
|
117
|
-
onShellReady() {
|
|
118
|
-
const headContent = `
|
|
119
|
-
<meta name="description" content="taujs [ τjs ]">
|
|
120
|
-
<link rel="icon" type="image/svg+xml" href="/taujs.svg" />
|
|
121
|
-
<title>taujs [ τjs ]</title>
|
|
122
|
-
`;
|
|
123
|
-
onHead(headContent);
|
|
124
|
-
|
|
125
|
-
pipe(
|
|
126
|
-
new Writable({
|
|
127
|
-
write(chunk, _encoding, callback) {
|
|
128
|
-
serverResponse.write(chunk, callback);
|
|
129
|
-
},
|
|
130
|
-
final(callback) {
|
|
131
|
-
onFinish(store.getSnapshot());
|
|
132
|
-
callback();
|
|
133
|
-
},
|
|
134
|
-
}),
|
|
135
|
-
);
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
onAllReady() {},
|
|
110
|
+
const headContent = `
|
|
111
|
+
<meta name="description" content="taujs [ τjs ]">
|
|
112
|
+
<link rel="icon" type="image/svg+xml" href="/taujs.svg" />
|
|
113
|
+
<title>taujs [ τjs ]</title>
|
|
114
|
+
`;
|
|
139
115
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
116
|
+
createStreamRenderer(
|
|
117
|
+
serverResponse,
|
|
118
|
+
{ onHead, onFinish, onError },
|
|
119
|
+
{
|
|
120
|
+
appElement: (
|
|
121
|
+
<SSRStoreProvider store={store}>
|
|
122
|
+
<AppBootstrap />
|
|
123
|
+
</SSRStoreProvider>
|
|
124
|
+
),
|
|
125
|
+
bootstrapModules,
|
|
126
|
+
getStoreSnapshot: store.getSnapshot,
|
|
127
|
+
headContent,
|
|
143
128
|
},
|
|
144
129
|
);
|
|
145
130
|
};
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git+https://github.com/aoede3/taujs-server.git"
|
|
22
22
|
},
|
|
23
|
-
"version": "0.0.
|
|
23
|
+
"version": "0.0.5",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"import": "./dist/SSRServer.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"type": "module",
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@fastify/static": "^7.0.4",
|
|
57
|
-
"path-to-regexp": "^
|
|
57
|
+
"path-to-regexp": "^8.1.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@arethetypeswrong/cli": "^0.15.4",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"prettier": "^3.3.3",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"tsup": "^8.2.4",
|
|
70
|
+
"typescript": "^5.5.4",
|
|
70
71
|
"vite": "^5.4.2",
|
|
71
72
|
"vitest": "^2.0.5"
|
|
72
73
|
},
|