@taujs/server 0.3.2 → 0.3.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/dist/{SSRServer-D_82uJ06.d.ts → SSRServer-C9yjcgke.d.ts} +2 -1
- package/dist/build.d.ts +1 -1
- package/dist/build.js +19 -6
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -6
- package/dist/security/csp.d.ts +1 -1
- package/package.json +8 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerResponse } from 'node:http';
|
|
2
|
-
import { FastifyRequest, FastifyReply, HookHandlerDoneFunction, FastifyPluginAsync } from 'fastify';
|
|
2
|
+
import { FastifyRequest, FastifyReply, HookHandlerDoneFunction, FastifyPluginAsync, FastifyInstance } from 'fastify';
|
|
3
3
|
import { PluginOption } from 'vite';
|
|
4
4
|
|
|
5
5
|
type CSPDirectives = Record<string, string[]>;
|
|
@@ -69,6 +69,7 @@ type SSRServerOptions = {
|
|
|
69
69
|
generateCSP?: (directives: CSPDirectives, nonce: string) => string;
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
+
registerStaticAssets?: false | ((app: FastifyInstance) => Promise<void> | void);
|
|
72
73
|
isDebug?: boolean;
|
|
73
74
|
};
|
|
74
75
|
type ServiceMethod = (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -538,12 +538,25 @@ var SSRServer = (0, import_fastify_plugin.default)(
|
|
|
538
538
|
],
|
|
539
539
|
opts.isDebug
|
|
540
540
|
);
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
541
|
+
if (opts.registerStaticAssets !== false) {
|
|
542
|
+
if (typeof opts.registerStaticAssets === "function") {
|
|
543
|
+
await opts.registerStaticAssets(app);
|
|
544
|
+
} else {
|
|
545
|
+
try {
|
|
546
|
+
const fastifyStatic = await import("@fastify/static");
|
|
547
|
+
await app.register(fastifyStatic.default, {
|
|
548
|
+
index: false,
|
|
549
|
+
prefix: "/",
|
|
550
|
+
root: baseClientRoot,
|
|
551
|
+
wildcard: false
|
|
552
|
+
});
|
|
553
|
+
} catch (err) {
|
|
554
|
+
throw new Error(
|
|
555
|
+
"Static asset handling requires @fastify/static to be installed. Either install it or provide your own static asset handler using `registerStaticAssets`."
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
547
560
|
app.addHook(
|
|
548
561
|
"onRequest",
|
|
549
562
|
createCSPHook({
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginOption } from 'vite';
|
|
2
|
-
import { R as Route, a as RouteParams, b as RouteAttributes } from './SSRServer-
|
|
2
|
+
import { R as Route, a as RouteParams, b as RouteAttributes } from './SSRServer-C9yjcgke.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'fastify';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FastifyReply } from 'fastify';
|
|
2
|
-
export { B as BaseMiddleware, C as Config, n as DataHandler, D as DataResult, I as InitialRouteParams, i as Manifest, M as ManifestEntry, N as NamedService, P as ProcessedConfig, g as RenderCallbacks, l as RenderModule, j as RenderSSR, k as RenderStream, R as Route, b as RouteAttributes, a as RouteParams, o as RoutePathsAndAttributes, h as SSRManifest, S as SSRServer, d as SSRServerOptions, m as ServiceCall, e as ServiceMethod, f as ServiceRegistry, T as TEMPLATE, c as createMaps, p as processConfigs } from './SSRServer-
|
|
2
|
+
export { B as BaseMiddleware, C as Config, n as DataHandler, D as DataResult, I as InitialRouteParams, i as Manifest, M as ManifestEntry, N as NamedService, P as ProcessedConfig, g as RenderCallbacks, l as RenderModule, j as RenderSSR, k as RenderStream, R as Route, b as RouteAttributes, a as RouteParams, o as RoutePathsAndAttributes, h as SSRManifest, S as SSRServer, d as SSRServerOptions, m as ServiceCall, e as ServiceMethod, f as ServiceRegistry, T as TEMPLATE, c as createMaps, p as processConfigs } from './SSRServer-C9yjcgke.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'vite';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -536,12 +536,25 @@ var SSRServer = (0, import_fastify_plugin.default)(
|
|
|
536
536
|
],
|
|
537
537
|
opts.isDebug
|
|
538
538
|
);
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
539
|
+
if (opts.registerStaticAssets !== false) {
|
|
540
|
+
if (typeof opts.registerStaticAssets === "function") {
|
|
541
|
+
await opts.registerStaticAssets(app);
|
|
542
|
+
} else {
|
|
543
|
+
try {
|
|
544
|
+
const fastifyStatic = await import("@fastify/static");
|
|
545
|
+
await app.register(fastifyStatic.default, {
|
|
546
|
+
index: false,
|
|
547
|
+
prefix: "/",
|
|
548
|
+
root: baseClientRoot,
|
|
549
|
+
wildcard: false
|
|
550
|
+
});
|
|
551
|
+
} catch (err) {
|
|
552
|
+
throw new Error(
|
|
553
|
+
"Static asset handling requires @fastify/static to be installed. Either install it or provide your own static asset handler using `registerStaticAssets`."
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
545
558
|
app.addHook(
|
|
546
559
|
"onRequest",
|
|
547
560
|
createCSPHook({
|
package/dist/security/csp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'fastify';
|
|
2
|
-
export { q as CSPDirectives, r as CSPOptions, w as applyCSP, u as createCSPHook, s as defaultGenerateCSP, t as generateNonce, v as getRequestNonce } from '../SSRServer-
|
|
2
|
+
export { q as CSPDirectives, r as CSPOptions, w as applyCSP, u as createCSPHook, s as defaultGenerateCSP, t as generateNonce, v as getRequestNonce } from '../SSRServer-C9yjcgke.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'vite';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taujs/server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "taujs [ τjs ]",
|
|
5
5
|
"author": "John Smith | Aoede <taujs@aoede.uk.net> (https://www.aoede.uk.net)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"dist"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@fastify/static": "^8.0.3",
|
|
51
50
|
"path-to-regexp": "^8.1.0",
|
|
52
51
|
"vite-plugin-node-polyfills": "^0.23.0"
|
|
53
52
|
},
|
|
@@ -55,6 +54,7 @@
|
|
|
55
54
|
"@arethetypeswrong/cli": "^0.15.4",
|
|
56
55
|
"@babel/preset-typescript": "^7.24.7",
|
|
57
56
|
"@changesets/cli": "^2.27.7",
|
|
57
|
+
"@fastify/static": "^8.0.3",
|
|
58
58
|
"@types/node": "^20.14.9",
|
|
59
59
|
"@vitest/coverage-v8": "^2.1.0",
|
|
60
60
|
"@vitest/ui": "^2.1.9",
|
|
@@ -67,10 +67,16 @@
|
|
|
67
67
|
"vitest": "^2.0.5"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
+
"@fastify/static": "^8.0.3",
|
|
70
71
|
"fastify": "^5.3.3",
|
|
71
72
|
"typescript": "^5.5.4",
|
|
72
73
|
"vite": "^6.3.5"
|
|
73
74
|
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"@fastify/static": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
74
80
|
"scripts": {
|
|
75
81
|
"build": "tsup",
|
|
76
82
|
"build-local": "tsup && ./move.sh",
|