@taujs/server 0.3.2 → 0.3.4
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-DPZped7n.d.ts} +7 -2
- package/dist/build.d.ts +1 -1
- package/dist/build.js +10 -6
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -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, FastifyPluginCallback } from 'fastify';
|
|
3
3
|
import { PluginOption } from 'vite';
|
|
4
4
|
|
|
5
5
|
type CSPDirectives = Record<string, string[]>;
|
|
@@ -69,6 +69,10 @@ type SSRServerOptions = {
|
|
|
69
69
|
generateCSP?: (directives: CSPDirectives, nonce: string) => string;
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
+
registerStaticAssets?: false | {
|
|
73
|
+
plugin: FastifyPluginCallback<any> | FastifyPluginAsync<any>;
|
|
74
|
+
options?: Record<string, unknown>;
|
|
75
|
+
};
|
|
72
76
|
isDebug?: boolean;
|
|
73
77
|
};
|
|
74
78
|
type ServiceMethod = (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
@@ -102,6 +106,7 @@ type RenderModule = {
|
|
|
102
106
|
renderSSR: RenderSSR;
|
|
103
107
|
renderStream: RenderStream;
|
|
104
108
|
};
|
|
109
|
+
type GenericPlugin = FastifyPluginCallback<Record<string, unknown>> | FastifyPluginAsync<Record<string, unknown>>;
|
|
105
110
|
type BaseMiddleware = {
|
|
106
111
|
auth?: {
|
|
107
112
|
required: boolean;
|
|
@@ -145,4 +150,4 @@ interface InitialRouteParams extends Record<string, unknown> {
|
|
|
145
150
|
type RouteParams = InitialRouteParams & Record<string, unknown>;
|
|
146
151
|
type RoutePathsAndAttributes<Params = {}> = Omit<Route<Params>, 'element'>;
|
|
147
152
|
|
|
148
|
-
export { type BaseMiddleware as B, type Config as C, type DataResult as D, type InitialRouteParams as I, type ManifestEntry as M, type NamedService as N, type ProcessedConfig as P, type Route as R, SSRServer as S, TEMPLATE as T, type RouteParams as a, type RouteAttributes as b, createMaps as c, type SSRServerOptions as d, type ServiceMethod as e, type ServiceRegistry as f, type RenderCallbacks as g, type SSRManifest as h, type Manifest as i, type RenderSSR as j, type RenderStream as k, type RenderModule as l, type ServiceCall as m, type DataHandler as n, type RoutePathsAndAttributes as o, processConfigs as p, type CSPDirectives as q, type CSPOptions as r, defaultGenerateCSP as s, generateNonce as t, createCSPHook as u, getRequestNonce as v, applyCSP as w };
|
|
153
|
+
export { type BaseMiddleware as B, type Config as C, type DataResult as D, type GenericPlugin as G, type InitialRouteParams as I, type ManifestEntry as M, type NamedService as N, type ProcessedConfig as P, type Route as R, SSRServer as S, TEMPLATE as T, type RouteParams as a, type RouteAttributes as b, createMaps as c, type SSRServerOptions as d, type ServiceMethod as e, type ServiceRegistry as f, type RenderCallbacks as g, type SSRManifest as h, type Manifest as i, type RenderSSR as j, type RenderStream as k, type RenderModule as l, type ServiceCall as m, type DataHandler as n, type RoutePathsAndAttributes as o, processConfigs as p, type CSPDirectives as q, type CSPOptions as r, defaultGenerateCSP as s, generateNonce as t, createCSPHook as u, getRequestNonce as v, applyCSP as w };
|
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -538,12 +538,16 @@ 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 && typeof opts.registerStaticAssets === "object") {
|
|
542
|
+
const { plugin, options } = opts.registerStaticAssets;
|
|
543
|
+
await app.register(plugin, {
|
|
544
|
+
root: baseClientRoot,
|
|
545
|
+
prefix: "/",
|
|
546
|
+
index: false,
|
|
547
|
+
wildcard: false,
|
|
548
|
+
...options ?? {}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
547
551
|
app.addHook(
|
|
548
552
|
"onRequest",
|
|
549
553
|
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-DPZped7n.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, G as GenericPlugin, 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-DPZped7n.js';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'vite';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -536,12 +536,16 @@ 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 && typeof opts.registerStaticAssets === "object") {
|
|
540
|
+
const { plugin, options } = opts.registerStaticAssets;
|
|
541
|
+
await app.register(plugin, {
|
|
542
|
+
root: baseClientRoot,
|
|
543
|
+
prefix: "/",
|
|
544
|
+
index: false,
|
|
545
|
+
wildcard: false,
|
|
546
|
+
...options ?? {}
|
|
547
|
+
});
|
|
548
|
+
}
|
|
545
549
|
app.addHook(
|
|
546
550
|
"onRequest",
|
|
547
551
|
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-DPZped7n.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.4",
|
|
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",
|