@taujs/server 0.3.7 → 0.4.1
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/LICENSE +1 -1
- package/README.md +5 -3
- package/dist/Config-LCDjtT9m.d.ts +175 -0
- package/dist/Config.d.ts +3 -0
- package/dist/Config.js +27 -0
- package/dist/index.d.ts +52 -23
- package/dist/index.js +1897 -444
- package/package.json +19 -22
- package/dist/SSRServer-CbXIDaoA.d.ts +0 -142
- package/dist/build.d.ts +0 -25
- package/dist/build.js +0 -805
- package/dist/config.d.ts +0 -38
- package/dist/config.js +0 -146
- package/dist/security/csp.d.ts +0 -12
- package/dist/security/csp.js +0 -175
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taujs/server",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "τjs [ taujs ]",
|
|
5
5
|
"author": "John Smith | Aoede <taujs@aoede.uk.net> (https://www.aoede.uk.net)",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://taujs.dev/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/aoede3/taujs-server.git"
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"vite",
|
|
20
20
|
"streaming",
|
|
21
21
|
"react",
|
|
22
|
-
"ssr"
|
|
22
|
+
"ssr",
|
|
23
|
+
"mfe"
|
|
23
24
|
],
|
|
24
25
|
"type": "module",
|
|
25
26
|
"main": "./dist/index.js",
|
|
@@ -30,16 +31,12 @@
|
|
|
30
31
|
"types": "./dist/index.d.ts"
|
|
31
32
|
},
|
|
32
33
|
"./build": {
|
|
33
|
-
"import": "./dist/
|
|
34
|
-
"types": "./dist/
|
|
34
|
+
"import": "./dist/Build.js",
|
|
35
|
+
"types": "./dist/Build.d.ts"
|
|
35
36
|
},
|
|
36
37
|
"./config": {
|
|
37
|
-
"import": "./dist/
|
|
38
|
-
"types": "./dist/
|
|
39
|
-
},
|
|
40
|
-
"./csp": {
|
|
41
|
-
"import": "./dist/security/csp.js",
|
|
42
|
-
"types": "./dist/security/csp.d.ts"
|
|
38
|
+
"import": "./dist/Config.js",
|
|
39
|
+
"types": "./dist/Config.d.ts"
|
|
43
40
|
},
|
|
44
41
|
"./package.json": "./package.json"
|
|
45
42
|
},
|
|
@@ -48,29 +45,29 @@
|
|
|
48
45
|
],
|
|
49
46
|
"dependencies": {
|
|
50
47
|
"path-to-regexp": "^8.1.0",
|
|
51
|
-
"vite-plugin-node-polyfills": "^0.
|
|
48
|
+
"vite-plugin-node-polyfills": "^0.24.0"
|
|
52
49
|
},
|
|
53
50
|
"devDependencies": {
|
|
54
51
|
"@arethetypeswrong/cli": "^0.15.4",
|
|
55
52
|
"@babel/preset-typescript": "^7.24.7",
|
|
56
53
|
"@changesets/cli": "^2.27.7",
|
|
57
|
-
"@fastify/static": "^8.0
|
|
54
|
+
"@fastify/static": "^8.3.0",
|
|
58
55
|
"@types/node": "^20.14.9",
|
|
59
|
-
"@vitest/coverage-v8": "^2.
|
|
60
|
-
"@vitest/ui": "^2.
|
|
61
|
-
"fastify": "^5.
|
|
56
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
57
|
+
"@vitest/ui": "^3.2.4",
|
|
58
|
+
"fastify": "^5.6.1",
|
|
62
59
|
"jsdom": "^25.0.0",
|
|
63
60
|
"prettier": "^3.3.3",
|
|
64
61
|
"tsup": "^8.2.4",
|
|
65
62
|
"typescript": "^5.5.4",
|
|
66
|
-
"vite": "^
|
|
67
|
-
"vitest": "^2.
|
|
63
|
+
"vite": "^7.1.11",
|
|
64
|
+
"vitest": "^3.2.4"
|
|
68
65
|
},
|
|
69
66
|
"peerDependencies": {
|
|
70
|
-
"@fastify/static": "^8.0
|
|
71
|
-
"fastify": "^5.
|
|
67
|
+
"@fastify/static": "^8.3.0",
|
|
68
|
+
"fastify": "^5.6.1",
|
|
72
69
|
"typescript": "^5.5.4",
|
|
73
|
-
"vite": "^
|
|
70
|
+
"vite": "^7.1.11"
|
|
74
71
|
},
|
|
75
72
|
"peerDependenciesMeta": {
|
|
76
73
|
"@fastify/static": {
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { ServerResponse } from 'node:http';
|
|
2
|
-
import { FastifyPluginAsync, FastifyPluginCallback } from 'fastify';
|
|
3
|
-
import { PluginOption } from 'vite';
|
|
4
|
-
import { CSPDirectives } from './security/csp.js';
|
|
5
|
-
|
|
6
|
-
declare const TEMPLATE: {
|
|
7
|
-
readonly defaultEntryClient: "entry-client";
|
|
8
|
-
readonly defaultEntryServer: "entry-server";
|
|
9
|
-
readonly defaultHtmlTemplate: "index.html";
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* taujs [ τjs ] Orchestration System
|
|
14
|
-
* (c) 2024-present Aoede Ltd
|
|
15
|
-
* Author: John Smith
|
|
16
|
-
*
|
|
17
|
-
* Licensed under the MIT License — attribution appreciated.
|
|
18
|
-
* Part of the taujs [ τjs ] system for declarative, build-time orchestration of microfrontend applications,
|
|
19
|
-
* including CSR, SSR, streaming, and middleware composition.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
declare const createMaps: () => {
|
|
23
|
-
bootstrapModules: Map<string, string>;
|
|
24
|
-
cssLinks: Map<string, string>;
|
|
25
|
-
manifests: Map<string, Manifest>;
|
|
26
|
-
preloadLinks: Map<string, string>;
|
|
27
|
-
renderModules: Map<string, RenderModule>;
|
|
28
|
-
ssrManifests: Map<string, SSRManifest>;
|
|
29
|
-
templates: Map<string, string>;
|
|
30
|
-
};
|
|
31
|
-
declare const processConfigs: (configs: Config[], baseClientRoot: string, templateDefaults: typeof TEMPLATE) => ProcessedConfig[];
|
|
32
|
-
declare const SSRServer: FastifyPluginAsync<SSRServerOptions>;
|
|
33
|
-
type Config = {
|
|
34
|
-
appId: string;
|
|
35
|
-
entryPoint: string;
|
|
36
|
-
entryClient?: string;
|
|
37
|
-
entryServer?: string;
|
|
38
|
-
htmlTemplate?: string;
|
|
39
|
-
};
|
|
40
|
-
type ProcessedConfig = {
|
|
41
|
-
appId: string;
|
|
42
|
-
clientRoot: string;
|
|
43
|
-
entryClient: string;
|
|
44
|
-
entryPoint: string;
|
|
45
|
-
entryServer: string;
|
|
46
|
-
htmlTemplate: string;
|
|
47
|
-
plugins?: PluginOption[];
|
|
48
|
-
};
|
|
49
|
-
type SSRServerOptions = {
|
|
50
|
-
alias?: Record<string, string>;
|
|
51
|
-
clientRoot: string;
|
|
52
|
-
configs: Config[];
|
|
53
|
-
routes: Route<RouteParams>[];
|
|
54
|
-
serviceRegistry: ServiceRegistry;
|
|
55
|
-
security?: {
|
|
56
|
-
csp?: {
|
|
57
|
-
directives?: CSPDirectives;
|
|
58
|
-
generateCSP?: (directives: CSPDirectives, cspNonce: string) => string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
registerStaticAssets?: false | {
|
|
62
|
-
plugin: FastifyPluginCallback<any> | FastifyPluginAsync<any>;
|
|
63
|
-
options?: Record<string, unknown>;
|
|
64
|
-
};
|
|
65
|
-
isDebug?: boolean;
|
|
66
|
-
};
|
|
67
|
-
type ServiceMethod = (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
68
|
-
type NamedService = Record<string, ServiceMethod>;
|
|
69
|
-
type ServiceRegistry = Record<string, NamedService>;
|
|
70
|
-
type RenderCallbacks = {
|
|
71
|
-
onHead: (headContent: string) => void;
|
|
72
|
-
onFinish: (initialDataResolved: unknown) => void;
|
|
73
|
-
onError: (error: unknown) => void;
|
|
74
|
-
};
|
|
75
|
-
type SSRManifest = {
|
|
76
|
-
[key: string]: string[];
|
|
77
|
-
};
|
|
78
|
-
type ManifestEntry = {
|
|
79
|
-
file: string;
|
|
80
|
-
src?: string;
|
|
81
|
-
isDynamicEntry?: boolean;
|
|
82
|
-
imports?: string[];
|
|
83
|
-
css?: string[];
|
|
84
|
-
assets?: string[];
|
|
85
|
-
};
|
|
86
|
-
type Manifest = {
|
|
87
|
-
[key: string]: ManifestEntry;
|
|
88
|
-
};
|
|
89
|
-
type RenderSSR = (initialDataResolved: Record<string, unknown>, location: string, meta?: Record<string, unknown>) => Promise<{
|
|
90
|
-
headContent: string;
|
|
91
|
-
appHtml: string;
|
|
92
|
-
}>;
|
|
93
|
-
type RenderStream = (serverResponse: ServerResponse, callbacks: RenderCallbacks, initialDataPromise: Promise<Record<string, unknown>>, location: string, bootstrapModules?: string, meta?: Record<string, unknown>, cspNonce?: string) => void;
|
|
94
|
-
type RenderModule = {
|
|
95
|
-
renderSSR: RenderSSR;
|
|
96
|
-
renderStream: RenderStream;
|
|
97
|
-
};
|
|
98
|
-
type GenericPlugin = FastifyPluginCallback<Record<string, unknown>> | FastifyPluginAsync<Record<string, unknown>>;
|
|
99
|
-
type BaseMiddleware = {
|
|
100
|
-
auth?: {
|
|
101
|
-
required: boolean;
|
|
102
|
-
redirect?: string;
|
|
103
|
-
roles?: string[];
|
|
104
|
-
strategy?: string;
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
type ServiceCall = {
|
|
108
|
-
serviceName: string;
|
|
109
|
-
serviceMethod: string;
|
|
110
|
-
args?: Record<string, unknown>;
|
|
111
|
-
};
|
|
112
|
-
type DataResult = Record<string, unknown> | ServiceCall;
|
|
113
|
-
type DataHandler<Params> = (params: Params, ctx: {
|
|
114
|
-
headers: Record<string, string>;
|
|
115
|
-
[key: string]: unknown;
|
|
116
|
-
}) => Promise<DataResult>;
|
|
117
|
-
type RouteAttributes<Params = {}, Middleware = BaseMiddleware> = {
|
|
118
|
-
render: 'ssr';
|
|
119
|
-
hydrate?: boolean;
|
|
120
|
-
meta?: Record<string, unknown>;
|
|
121
|
-
middleware?: Middleware;
|
|
122
|
-
data?: DataHandler<Params>;
|
|
123
|
-
} | {
|
|
124
|
-
render: 'streaming';
|
|
125
|
-
hydrate?: never;
|
|
126
|
-
meta: Record<string, unknown>;
|
|
127
|
-
middleware?: Middleware;
|
|
128
|
-
data?: DataHandler<Params>;
|
|
129
|
-
};
|
|
130
|
-
type Route<Params = {}> = {
|
|
131
|
-
attr?: RouteAttributes<Params>;
|
|
132
|
-
path: string;
|
|
133
|
-
appId?: string;
|
|
134
|
-
};
|
|
135
|
-
interface InitialRouteParams extends Record<string, unknown> {
|
|
136
|
-
serviceName?: string;
|
|
137
|
-
serviceMethod?: string;
|
|
138
|
-
}
|
|
139
|
-
type RouteParams = InitialRouteParams & Record<string, unknown>;
|
|
140
|
-
type RoutePathsAndAttributes<Params = {}> = Omit<Route<Params>, 'element'>;
|
|
141
|
-
|
|
142
|
-
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 };
|
package/dist/build.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AppConfig } from './config.js';
|
|
2
|
-
import 'vite';
|
|
3
|
-
import './SSRServer-CbXIDaoA.js';
|
|
4
|
-
import 'node:http';
|
|
5
|
-
import 'fastify';
|
|
6
|
-
import './security/csp.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* taujs [ τjs ] Orchestration System
|
|
10
|
-
* (c) 2024-present Aoede Ltd
|
|
11
|
-
* Author: John Smith
|
|
12
|
-
*
|
|
13
|
-
* Licensed under the MIT License — attribution appreciated.
|
|
14
|
-
* Part of the taujs [ τjs ] system for declarative, build-time orchestration of microfrontend applications,
|
|
15
|
-
* including CSR, SSR, streaming, and middleware composition.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
declare function taujsBuild({ configs, projectRoot, clientBaseDir, isSSRBuild, }: {
|
|
19
|
-
configs: AppConfig[];
|
|
20
|
-
projectRoot: string;
|
|
21
|
-
clientBaseDir: string;
|
|
22
|
-
isSSRBuild?: boolean;
|
|
23
|
-
}): Promise<void>;
|
|
24
|
-
|
|
25
|
-
export { taujsBuild };
|