@taujs/server 0.4.0 → 0.4.2
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/Config-BuUuMjmO.d.ts +209 -0
- package/dist/Config.d.ts +1 -1
- package/dist/Config.js +16 -9
- package/dist/index.d.ts +37 -48
- package/dist/index.js +1594 -1409
- package/package.json +2 -2
- package/dist/Build.d.ts +0 -22
- package/dist/Build.js +0 -228
- package/dist/Config-CjwAJCfZ.d.ts +0 -245
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taujs/server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "τjs [ taujs ]",
|
|
5
5
|
"author": "John Smith | Aoede <taujs@aoede.uk.net> (https://www.aoede.uk.net)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"path-to-regexp": "^8.1.0",
|
|
48
|
-
"vite-plugin-node-polyfills": "^0.
|
|
48
|
+
"vite-plugin-node-polyfills": "^0.24.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@arethetypeswrong/cli": "^0.15.4",
|
package/dist/Build.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { A as AppConfig } from './Config-CjwAJCfZ.js';
|
|
2
|
-
import 'fastify';
|
|
3
|
-
import 'vite';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* τjs [ taujs ] Orchestration System
|
|
7
|
-
* (c) 2024-present Aoede Ltd
|
|
8
|
-
* Author: John Smith
|
|
9
|
-
*
|
|
10
|
-
* Licensed under the MIT License - attribution appreciated.
|
|
11
|
-
* Part of the τjs [ taujs ] system for declarative, build-time orchestration of microfrontend applications,
|
|
12
|
-
* including CSR, SSR, streaming, and middleware composition.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
declare function taujsBuild({ configs, projectRoot, clientBaseDir, isSSRBuild, }: {
|
|
16
|
-
configs: AppConfig[];
|
|
17
|
-
projectRoot: string;
|
|
18
|
-
clientBaseDir: string;
|
|
19
|
-
isSSRBuild?: boolean;
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
|
|
22
|
-
export { taujsBuild };
|
package/dist/Build.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// node_modules/picocolors/picocolors.js
|
|
28
|
-
var require_picocolors = __commonJS({
|
|
29
|
-
"node_modules/picocolors/picocolors.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
var p = process || {};
|
|
32
|
-
var argv = p.argv || [];
|
|
33
|
-
var env = p.env || {};
|
|
34
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
35
|
-
var formatter = (open, close, replace = open) => (input) => {
|
|
36
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
37
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
38
|
-
};
|
|
39
|
-
var replaceClose = (string, close, replace, index) => {
|
|
40
|
-
let result = "", cursor = 0;
|
|
41
|
-
do {
|
|
42
|
-
result += string.substring(cursor, index) + replace;
|
|
43
|
-
cursor = index + close.length;
|
|
44
|
-
index = string.indexOf(close, cursor);
|
|
45
|
-
} while (~index);
|
|
46
|
-
return result + string.substring(cursor);
|
|
47
|
-
};
|
|
48
|
-
var createColors = (enabled = isColorSupported) => {
|
|
49
|
-
let f = enabled ? formatter : () => String;
|
|
50
|
-
return {
|
|
51
|
-
isColorSupported: enabled,
|
|
52
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
53
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
54
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
55
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
56
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
57
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
58
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
59
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
60
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
61
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
62
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
63
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
64
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
65
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
66
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
67
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
68
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
69
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
70
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
71
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
72
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
73
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
74
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
75
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
76
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
77
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
78
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
79
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
80
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
81
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
82
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
83
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
84
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
85
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
86
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
87
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
88
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
89
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
90
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
91
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
92
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
module.exports = createColors();
|
|
96
|
-
module.exports.createColors = createColors;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// src/Build.ts
|
|
101
|
-
import path3 from "path";
|
|
102
|
-
import { build } from "vite";
|
|
103
|
-
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
104
|
-
|
|
105
|
-
// src/utils/AssetManager.ts
|
|
106
|
-
import path2 from "path";
|
|
107
|
-
|
|
108
|
-
// src/utils/System.ts
|
|
109
|
-
import { dirname, join } from "path";
|
|
110
|
-
import "path";
|
|
111
|
-
import { fileURLToPath } from "url";
|
|
112
|
-
var isDevelopment = process.env.NODE_ENV === "development";
|
|
113
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
114
|
-
var __dirname = join(dirname(__filename), !isDevelopment ? "./" : "..");
|
|
115
|
-
|
|
116
|
-
// src/constants.ts
|
|
117
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
118
|
-
var TEMPLATE = {
|
|
119
|
-
defaultEntryClient: "entry-client",
|
|
120
|
-
defaultEntryServer: "entry-server",
|
|
121
|
-
defaultHtmlTemplate: "index.html"
|
|
122
|
-
};
|
|
123
|
-
var DEBUG = {
|
|
124
|
-
auth: { label: "auth", colour: import_picocolors.default.blue },
|
|
125
|
-
csp: { label: "csp", colour: import_picocolors.default.yellow },
|
|
126
|
-
errors: { label: "errors", colour: import_picocolors.default.red },
|
|
127
|
-
routes: { label: "routes", colour: import_picocolors.default.cyan },
|
|
128
|
-
security: { label: "security", colour: import_picocolors.default.yellow },
|
|
129
|
-
trx: { label: "trx", colour: import_picocolors.default.magenta },
|
|
130
|
-
vite: { label: "vite", colour: import_picocolors.default.yellow }
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// src/utils/AssetManager.ts
|
|
134
|
-
var processConfigs = (configs, baseClientRoot, templateDefaults) => {
|
|
135
|
-
return configs.map((config) => {
|
|
136
|
-
const clientRoot = path2.resolve(baseClientRoot, config.entryPoint);
|
|
137
|
-
return {
|
|
138
|
-
clientRoot,
|
|
139
|
-
entryPoint: config.entryPoint,
|
|
140
|
-
entryClient: config.entryClient || templateDefaults.defaultEntryClient,
|
|
141
|
-
entryServer: config.entryServer || templateDefaults.defaultEntryServer,
|
|
142
|
-
htmlTemplate: config.htmlTemplate || templateDefaults.defaultHtmlTemplate,
|
|
143
|
-
appId: config.appId
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// src/Build.ts
|
|
149
|
-
async function taujsBuild({
|
|
150
|
-
configs,
|
|
151
|
-
projectRoot,
|
|
152
|
-
clientBaseDir,
|
|
153
|
-
isSSRBuild = process.env.BUILD_MODE === "ssr"
|
|
154
|
-
}) {
|
|
155
|
-
const deleteDist = async () => {
|
|
156
|
-
const { rm } = await import("fs/promises");
|
|
157
|
-
const distPath = path3.resolve(projectRoot, "dist");
|
|
158
|
-
try {
|
|
159
|
-
await rm(distPath, { recursive: true, force: true });
|
|
160
|
-
console.log("Deleted the dist directory\n");
|
|
161
|
-
} catch (err) {
|
|
162
|
-
console.error("Error deleting dist directory:", err);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const processedConfigs = processConfigs(configs, clientBaseDir, TEMPLATE);
|
|
166
|
-
if (!isSSRBuild) await deleteDist();
|
|
167
|
-
for (const config of processedConfigs) {
|
|
168
|
-
const { appId, entryPoint, clientRoot, entryClient, entryServer, htmlTemplate, plugins = [] } = config;
|
|
169
|
-
const outDir = path3.resolve(projectRoot, `dist/client/${entryPoint}`);
|
|
170
|
-
const root = entryPoint ? path3.resolve(clientBaseDir, entryPoint) : clientBaseDir;
|
|
171
|
-
const server = path3.resolve(clientRoot, `${entryServer}.tsx`);
|
|
172
|
-
const client = path3.resolve(clientRoot, `${entryClient}.tsx`);
|
|
173
|
-
const main = path3.resolve(clientRoot, htmlTemplate);
|
|
174
|
-
const viteConfig = {
|
|
175
|
-
base: entryPoint ? `/${entryPoint}/` : "/",
|
|
176
|
-
build: {
|
|
177
|
-
outDir,
|
|
178
|
-
manifest: !isSSRBuild,
|
|
179
|
-
rollupOptions: {
|
|
180
|
-
input: isSSRBuild ? { server } : { client, main }
|
|
181
|
-
},
|
|
182
|
-
ssr: isSSRBuild ? server : void 0,
|
|
183
|
-
ssrManifest: isSSRBuild,
|
|
184
|
-
...isSSRBuild && {
|
|
185
|
-
format: "esm",
|
|
186
|
-
target: `node${process.versions.node.split(".").map(Number)[0]}`
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
css: {
|
|
190
|
-
preprocessorOptions: {
|
|
191
|
-
scss: { api: "modern-compiler" }
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
plugins: [...config.plugins ?? [], nodePolyfills({ include: ["fs", "stream"] })],
|
|
195
|
-
publicDir: "public",
|
|
196
|
-
resolve: {
|
|
197
|
-
alias: {
|
|
198
|
-
"@client": root,
|
|
199
|
-
"@server": path3.resolve(projectRoot, "src/server"),
|
|
200
|
-
"@shared": path3.resolve(projectRoot, "src/shared")
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
root,
|
|
204
|
-
server: {
|
|
205
|
-
proxy: {
|
|
206
|
-
"/api": {
|
|
207
|
-
target: "http://localhost:3000",
|
|
208
|
-
changeOrigin: true,
|
|
209
|
-
rewrite: (path4) => path4.replace(/^\/api/, "")
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
try {
|
|
215
|
-
console.log(`Building for entryPoint: "${entryPoint}" (${appId})`);
|
|
216
|
-
await build(viteConfig);
|
|
217
|
-
console.log(`Build complete for entryPoint: "${entryPoint}"
|
|
218
|
-
`);
|
|
219
|
-
} catch (error) {
|
|
220
|
-
console.error(`Error building for entryPoint: "${entryPoint}"
|
|
221
|
-
`, error);
|
|
222
|
-
process.exit(1);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
export {
|
|
227
|
-
taujsBuild
|
|
228
|
-
};
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { FastifyRequest, FastifyPluginCallback, FastifyPluginAsync } from 'fastify';
|
|
2
|
-
import { PluginOption } from 'vite';
|
|
3
|
-
|
|
4
|
-
declare const DEBUG_CATEGORIES: readonly ["auth", "routes", "errors", "vite", "network", "ssr"];
|
|
5
|
-
type DebugCategory = (typeof DEBUG_CATEGORIES)[number];
|
|
6
|
-
type DebugConfig = boolean | DebugCategory[] | ({
|
|
7
|
-
all?: boolean;
|
|
8
|
-
} & Partial<Record<DebugCategory, boolean>>);
|
|
9
|
-
interface BaseLogger {
|
|
10
|
-
debug?(message: string, meta?: unknown): void;
|
|
11
|
-
info?(message: string, meta?: unknown): void;
|
|
12
|
-
warn?(message: string, meta?: unknown): void;
|
|
13
|
-
error?(message: string, meta?: unknown): void;
|
|
14
|
-
log?(message: string, meta?: unknown): void;
|
|
15
|
-
}
|
|
16
|
-
interface Logs extends BaseLogger {
|
|
17
|
-
debug(message: string, meta?: unknown): void;
|
|
18
|
-
debug(category: DebugCategory, message: string, meta?: unknown): void;
|
|
19
|
-
info(message: string, meta?: unknown): void;
|
|
20
|
-
warn(message: string, meta?: unknown): void;
|
|
21
|
-
error(message: string, meta?: unknown): void;
|
|
22
|
-
child(context: Record<string, unknown>): Logs;
|
|
23
|
-
isDebugEnabled(category: DebugCategory): boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
type Schema<T> = (input: unknown) => T;
|
|
27
|
-
type LooseSpec = Readonly<Record<string, ServiceMethod<any, Record<string, unknown>> | {
|
|
28
|
-
handler: ServiceMethod<any, Record<string, unknown>>;
|
|
29
|
-
params?: Schema<any>;
|
|
30
|
-
result?: Schema<any>;
|
|
31
|
-
parsers?: {
|
|
32
|
-
params?: Schema<any>;
|
|
33
|
-
result?: Schema<any>;
|
|
34
|
-
};
|
|
35
|
-
}>>;
|
|
36
|
-
type ServiceContext = {
|
|
37
|
-
signal?: AbortSignal;
|
|
38
|
-
deadlineMs?: number;
|
|
39
|
-
traceId?: string;
|
|
40
|
-
logger?: Logs;
|
|
41
|
-
user?: {
|
|
42
|
-
id: string;
|
|
43
|
-
roles: string[];
|
|
44
|
-
} | null;
|
|
45
|
-
};
|
|
46
|
-
type ServiceMethod<P, R extends Record<string, unknown>> = (params: P, ctx: ServiceContext) => Promise<R>;
|
|
47
|
-
type ServiceMethodDescriptor<P, R extends Record<string, unknown>> = {
|
|
48
|
-
handler: ServiceMethod<P, R>;
|
|
49
|
-
parsers?: {
|
|
50
|
-
params?: Schema<P>;
|
|
51
|
-
result?: Schema<R>;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
type ServiceRegistry = Readonly<Record<string, Readonly<Record<string, ServiceMethodDescriptor<any, Record<string, unknown>>>>>>;
|
|
55
|
-
declare const defineService: <T extends LooseSpec>(spec: T) => { [K in keyof T]: T[K] extends ServiceMethod<infer P, infer R> ? ServiceMethodDescriptor<P, R> : T[K] extends {
|
|
56
|
-
handler: ServiceMethod<infer P, infer R_1>;
|
|
57
|
-
} ? ServiceMethodDescriptor<P, R_1> : never; };
|
|
58
|
-
declare const defineServiceRegistry: <R extends ServiceRegistry>(registry: R) => R;
|
|
59
|
-
|
|
60
|
-
type RequestContext<L extends Logs = Logs> = {
|
|
61
|
-
traceId: string;
|
|
62
|
-
logger: L;
|
|
63
|
-
headers: Record<string, string>;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
type RouteCSPConfig = {
|
|
67
|
-
disabled?: boolean;
|
|
68
|
-
mode?: 'merge' | 'replace';
|
|
69
|
-
directives?: CSPDirectives | ((args: {
|
|
70
|
-
url: string;
|
|
71
|
-
params: PathToRegExpParams;
|
|
72
|
-
headers: FastifyRequest['headers'];
|
|
73
|
-
req: FastifyRequest;
|
|
74
|
-
}) => CSPDirectives);
|
|
75
|
-
generateCSP?: (directives: CSPDirectives, nonce: string, req: FastifyRequest) => string;
|
|
76
|
-
};
|
|
77
|
-
type Config = {
|
|
78
|
-
appId: string;
|
|
79
|
-
entryPoint: string;
|
|
80
|
-
entryClient?: string;
|
|
81
|
-
entryServer?: string;
|
|
82
|
-
htmlTemplate?: string;
|
|
83
|
-
};
|
|
84
|
-
type ProcessedConfig = {
|
|
85
|
-
appId: string;
|
|
86
|
-
clientRoot: string;
|
|
87
|
-
entryClient: string;
|
|
88
|
-
entryPoint: string;
|
|
89
|
-
entryServer: string;
|
|
90
|
-
htmlTemplate: string;
|
|
91
|
-
plugins?: PluginOption[];
|
|
92
|
-
};
|
|
93
|
-
type SSRServerOptions = {
|
|
94
|
-
alias?: Record<string, string>;
|
|
95
|
-
clientRoot: string;
|
|
96
|
-
configs: AppConfig[];
|
|
97
|
-
routes: Route<PathToRegExpParams>[];
|
|
98
|
-
serviceRegistry: ServiceRegistry;
|
|
99
|
-
security?: SecurityConfig;
|
|
100
|
-
registerStaticAssets?: false | {
|
|
101
|
-
plugin: FastifyPluginCallback<any> | FastifyPluginAsync<any>;
|
|
102
|
-
options?: Record<string, unknown>;
|
|
103
|
-
};
|
|
104
|
-
debug?: DebugConfig;
|
|
105
|
-
devNet?: {
|
|
106
|
-
host: string;
|
|
107
|
-
hmrPort: number;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
type RenderCallbacks<T = unknown> = {
|
|
111
|
-
onHead?: (headContent: string) => void;
|
|
112
|
-
onShellReady?: () => void;
|
|
113
|
-
onAllReady?: (initialData: T) => void;
|
|
114
|
-
onError?: (error: unknown) => void;
|
|
115
|
-
};
|
|
116
|
-
type SSRManifest = {
|
|
117
|
-
[key: string]: string[];
|
|
118
|
-
};
|
|
119
|
-
type ManifestEntry = {
|
|
120
|
-
file: string;
|
|
121
|
-
src?: string;
|
|
122
|
-
isDynamicEntry?: boolean;
|
|
123
|
-
imports?: string[];
|
|
124
|
-
css?: string[];
|
|
125
|
-
assets?: string[];
|
|
126
|
-
};
|
|
127
|
-
type Manifest = {
|
|
128
|
-
[key: string]: ManifestEntry;
|
|
129
|
-
};
|
|
130
|
-
type RenderSSR = (initialDataResolved: Record<string, unknown>, location: string, meta?: Record<string, unknown>, signal?: AbortSignal, opts?: {
|
|
131
|
-
logger?: Logs;
|
|
132
|
-
}) => Promise<{
|
|
133
|
-
headContent: string;
|
|
134
|
-
appHtml: string;
|
|
135
|
-
}>;
|
|
136
|
-
type RenderStream = (serverResponse: NodeJS.WritableStream, callbacks: RenderCallbacks, initialData: Record<string, unknown> | Promise<Record<string, unknown>> | (() => Promise<Record<string, unknown>>), location: string, bootstrapModules?: string, meta?: Record<string, unknown>, cspNonce?: string, signal?: AbortSignal, opts?: {
|
|
137
|
-
logger?: Logs;
|
|
138
|
-
}) => {
|
|
139
|
-
abort(): void;
|
|
140
|
-
};
|
|
141
|
-
type RenderModule = {
|
|
142
|
-
renderSSR: RenderSSR;
|
|
143
|
-
renderStream: RenderStream;
|
|
144
|
-
};
|
|
145
|
-
type GenericPlugin = FastifyPluginCallback<Record<string, unknown>> | FastifyPluginAsync<Record<string, unknown>>;
|
|
146
|
-
type BaseMiddleware = {
|
|
147
|
-
auth?: {
|
|
148
|
-
redirect?: string;
|
|
149
|
-
roles?: string[];
|
|
150
|
-
strategy?: string;
|
|
151
|
-
};
|
|
152
|
-
csp?: RouteCSPConfig | false;
|
|
153
|
-
};
|
|
154
|
-
type ServiceCall = {
|
|
155
|
-
serviceName: string;
|
|
156
|
-
serviceMethod: string;
|
|
157
|
-
args?: Record<string, unknown>;
|
|
158
|
-
};
|
|
159
|
-
type DataResult = Record<string, unknown> | ServiceCall;
|
|
160
|
-
type DataHandler<Params extends PathToRegExpParams, L extends Logs = Logs> = (params: Params, ctx: RequestContext<L> & {
|
|
161
|
-
[key: string]: unknown;
|
|
162
|
-
}) => Promise<DataResult>;
|
|
163
|
-
type PathToRegExpParams = Partial<Record<string, string | string[]>>;
|
|
164
|
-
type RouteAttributes<Params extends PathToRegExpParams = PathToRegExpParams, Middleware = BaseMiddleware, L extends Logs = Logs> = {
|
|
165
|
-
render: 'ssr';
|
|
166
|
-
hydrate?: boolean;
|
|
167
|
-
meta?: Record<string, unknown>;
|
|
168
|
-
middleware?: Middleware;
|
|
169
|
-
data?: DataHandler<Params, L>;
|
|
170
|
-
} | {
|
|
171
|
-
render: 'streaming';
|
|
172
|
-
hydrate?: boolean;
|
|
173
|
-
meta: Record<string, unknown>;
|
|
174
|
-
middleware?: Middleware;
|
|
175
|
-
data?: DataHandler<Params, L>;
|
|
176
|
-
};
|
|
177
|
-
type Route<Params extends PathToRegExpParams = PathToRegExpParams> = {
|
|
178
|
-
attr?: RouteAttributes<Params>;
|
|
179
|
-
path: string;
|
|
180
|
-
appId?: string;
|
|
181
|
-
};
|
|
182
|
-
interface InitialRouteParams extends Record<string, unknown> {
|
|
183
|
-
serviceName?: string;
|
|
184
|
-
serviceMethod?: string;
|
|
185
|
-
}
|
|
186
|
-
type RoutePathsAndAttributes<Params extends PathToRegExpParams = PathToRegExpParams> = Omit<Route<Params>, 'element'>;
|
|
187
|
-
|
|
188
|
-
type CSPDirectives = Record<string, string[]>;
|
|
189
|
-
|
|
190
|
-
type CSPViolationReport = {
|
|
191
|
-
'document-uri': string;
|
|
192
|
-
'violated-directive': string;
|
|
193
|
-
'blocked-uri'?: string;
|
|
194
|
-
'source-file'?: string;
|
|
195
|
-
'line-number'?: number;
|
|
196
|
-
'column-number'?: number;
|
|
197
|
-
'script-sample'?: string;
|
|
198
|
-
'original-policy'?: string;
|
|
199
|
-
disposition?: 'enforce' | 'report';
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* τjs [ taujs ] Orchestration System
|
|
204
|
-
* (c) 2024-present Aoede Ltd
|
|
205
|
-
* Author: John Smith
|
|
206
|
-
*
|
|
207
|
-
* Licensed under the MIT License - attribution appreciated.
|
|
208
|
-
* Part of the τjs [ taujs ] system for declarative, build-time orchestration of microfrontend applications,
|
|
209
|
-
* including CSR, SSR, streaming, and middleware composition.
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
|
-
type SecurityConfig = {
|
|
213
|
-
csp?: {
|
|
214
|
-
defaultMode?: 'merge' | 'replace';
|
|
215
|
-
directives?: CSPDirectives;
|
|
216
|
-
generateCSP?: (directives: CSPDirectives, nonce: string, req?: FastifyRequest) => string;
|
|
217
|
-
reporting?: {
|
|
218
|
-
endpoint: string;
|
|
219
|
-
onViolation?: (report: CSPViolationReport, req: FastifyRequest) => void;
|
|
220
|
-
reportOnly?: boolean;
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
type AppRoute = Omit<Route<PathToRegExpParams>, 'appId'> & {
|
|
225
|
-
attr?: RouteAttributes<PathToRegExpParams>;
|
|
226
|
-
};
|
|
227
|
-
type AppConfig = {
|
|
228
|
-
appId: string;
|
|
229
|
-
entryPoint: string;
|
|
230
|
-
plugins?: PluginOption[];
|
|
231
|
-
routes?: AppRoute[];
|
|
232
|
-
};
|
|
233
|
-
type TaujsConfig = {
|
|
234
|
-
server?: {
|
|
235
|
-
host?: string;
|
|
236
|
-
port?: number;
|
|
237
|
-
hmrPort?: number;
|
|
238
|
-
};
|
|
239
|
-
security?: SecurityConfig;
|
|
240
|
-
apps: AppConfig[];
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
declare function defineConfig<T extends TaujsConfig>(config: T): T;
|
|
244
|
-
|
|
245
|
-
export { type AppConfig as A, type BaseLogger as B, type Config as C, type DebugConfig as D, type GenericPlugin as G, type InitialRouteParams as I, type ManifestEntry as M, type ProcessedConfig as P, type RouteCSPConfig as R, type SSRServerOptions as S, type TaujsConfig as T, type ServiceRegistry as a, type RenderCallbacks as b, type SSRManifest as c, type Manifest as d, type RenderSSR as e, type RenderStream as f, type RenderModule as g, type BaseMiddleware as h, type ServiceCall as i, type DataResult as j, type DataHandler as k, type PathToRegExpParams as l, type RouteAttributes as m, type Route as n, type RoutePathsAndAttributes as o, type SecurityConfig as p, type AppRoute as q, defineConfig as r, defineServiceRegistry as s, defineService as t };
|
package/dist/types.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import 'fastify';
|
|
2
|
-
import 'vite';
|
|
3
|
-
export { h as BaseMiddleware, C as Config, k as DataHandler, j as DataResult, G as GenericPlugin, I as InitialRouteParams, d as Manifest, M as ManifestEntry, l as PathToRegExpParams, P as ProcessedConfig, b as RenderCallbacks, g as RenderModule, e as RenderSSR, f as RenderStream, n as Route, m as RouteAttributes, R as RouteCSPConfig, o as RoutePathsAndAttributes, c as SSRManifest, S as SSRServerOptions, i as ServiceCall } from './Config-CjwAJCfZ.js';
|
package/dist/types.js
DELETED
|
File without changes
|