@taujs/server 0.1.1 → 0.1.3
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 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,14 +6,21 @@
|
|
|
6
6
|
|
|
7
7
|
`pnpm add @taujs/server`
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## CSR; SSR; Streaming SSR; Hydration; Fastify + React 18
|
|
10
|
+
|
|
11
|
+
Supports rendering modes:
|
|
12
|
+
|
|
13
|
+
- Client-side rendering (CSR)
|
|
14
|
+
- Server-side rendering (SSR)
|
|
15
|
+
- Streaming SSR
|
|
10
16
|
|
|
11
17
|
Fastify Plugin for integration with taujs [ τjs ] template https://github.com/aoede3/taujs
|
|
12
18
|
|
|
13
19
|
- Production: Fastify, React
|
|
14
20
|
- Development: Fastify, React, tsx, Vite
|
|
15
21
|
|
|
16
|
-
TypeScript
|
|
22
|
+
- TypeScript-first
|
|
23
|
+
- ESM-only focus
|
|
17
24
|
|
|
18
25
|
## τjs - Developer eXperience
|
|
19
26
|
|
|
@@ -40,7 +47,7 @@ Integrated ViteDevServer HMR + Vite Runtime API run alongside tsx (TS eXecute) p
|
|
|
40
47
|
|
|
41
48
|
https://github.com/aoede3/taujs/blob/main/src/server/index.ts
|
|
42
49
|
|
|
43
|
-
Not utilising taujs [ τjs ] template? Add in your own `alias` object for your own particular setup e.g. `alias: { object }`
|
|
50
|
+
Not utilising taujs [ τjs ] template? Add in your own ts `alias` object for your own particular directory setup e.g. `alias: { object }`
|
|
44
51
|
|
|
45
52
|
### React 'entry-client.tsx'
|
|
46
53
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FastifyPluginAsync } from 'fastify';
|
|
2
1
|
import { ServerResponse } from 'node:http';
|
|
2
|
+
import { FastifyPluginAsync } from 'fastify';
|
|
3
3
|
|
|
4
4
|
declare const RENDERTYPE: {
|
|
5
5
|
ssr: string;
|
|
@@ -56,7 +56,7 @@ type RenderModule = {
|
|
|
56
56
|
renderStream: RenderStream;
|
|
57
57
|
};
|
|
58
58
|
type RouteAttributes<Params = {}> = {
|
|
59
|
-
fetch
|
|
59
|
+
fetch?: (params?: Params, options?: RequestInit & {
|
|
60
60
|
params?: Record<string, unknown>;
|
|
61
61
|
}) => Promise<{
|
|
62
62
|
options: RequestInit & {
|
package/dist/index.js
CHANGED
|
@@ -121,6 +121,16 @@ import { readFile } from "node:fs/promises";
|
|
|
121
121
|
import path from "node:path";
|
|
122
122
|
import { createViteRuntime } from "vite";
|
|
123
123
|
|
|
124
|
+
// src/constants.ts
|
|
125
|
+
var RENDERTYPE = {
|
|
126
|
+
ssr: "ssr",
|
|
127
|
+
streaming: "streaming"
|
|
128
|
+
};
|
|
129
|
+
var SSRTAG = {
|
|
130
|
+
ssrHead: "<!--ssr-head-->",
|
|
131
|
+
ssrHtml: "<!--ssr-html-->"
|
|
132
|
+
};
|
|
133
|
+
|
|
124
134
|
// src/utils/Utils.ts
|
|
125
135
|
import { fileURLToPath } from "node:url";
|
|
126
136
|
import { dirname, join } from "node:path";
|
|
@@ -257,16 +267,6 @@ var overrideCSSHMRConsoleError = () => {
|
|
|
257
267
|
};
|
|
258
268
|
};
|
|
259
269
|
|
|
260
|
-
// src/constants.ts
|
|
261
|
-
var RENDERTYPE = {
|
|
262
|
-
ssr: "ssr",
|
|
263
|
-
streaming: "streaming"
|
|
264
|
-
};
|
|
265
|
-
var SSRTAG = {
|
|
266
|
-
ssrHead: "<!--ssr-head-->",
|
|
267
|
-
ssrHtml: "<!--ssr-html-->"
|
|
268
|
-
};
|
|
269
|
-
|
|
270
270
|
// src/SSRServer.ts
|
|
271
271
|
var SSRServer = (0, import_fastify_plugin.default)(
|
|
272
272
|
async (app, opts) => {
|
|
@@ -311,7 +311,7 @@ var SSRServer = (0, import_fastify_plugin.default)(
|
|
|
311
311
|
server.middlewares.use((req, res, next) => {
|
|
312
312
|
console.log(`rx: ${req.url}`);
|
|
313
313
|
res.on("finish", () => {
|
|
314
|
-
console.log(`
|
|
314
|
+
console.log(`tx: ${req.url}`);
|
|
315
315
|
});
|
|
316
316
|
next();
|
|
317
317
|
});
|