@taujs/server 0.3.6 → 0.4.0

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.
@@ -0,0 +1,3 @@
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 ADDED
File without changes
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@taujs/server",
3
- "version": "0.3.6",
4
- "description": "taujs [ τjs ]",
3
+ "version": "0.4.0",
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://github.com/aoede3/taujs-server",
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/build.js",
34
- "types": "./dist/build.d.ts"
34
+ "import": "./dist/Build.js",
35
+ "types": "./dist/Build.d.ts"
35
36
  },
36
37
  "./config": {
37
- "import": "./dist/config.js",
38
- "types": "./dist/config.d.ts"
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
  },
@@ -54,23 +51,23 @@
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.3",
54
+ "@fastify/static": "^8.3.0",
58
55
  "@types/node": "^20.14.9",
59
- "@vitest/coverage-v8": "^2.1.0",
60
- "@vitest/ui": "^2.1.9",
61
- "fastify": "^5.3.3",
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": "^6.3.5",
67
- "vitest": "^2.0.5"
63
+ "vite": "^7.1.11",
64
+ "vitest": "^3.2.4"
68
65
  },
69
66
  "peerDependencies": {
70
- "@fastify/static": "^8.0.3",
71
- "fastify": "^5.3.3",
67
+ "@fastify/static": "^8.3.0",
68
+ "fastify": "^5.6.1",
72
69
  "typescript": "^5.5.4",
73
- "vite": "^6.3.5"
70
+ "vite": "^7.1.11"
74
71
  },
75
72
  "peerDependenciesMeta": {
76
73
  "@fastify/static": {
@@ -1,153 +0,0 @@
1
- import { ServerResponse } from 'node:http';
2
- import { FastifyRequest, FastifyReply, HookHandlerDoneFunction, FastifyPluginAsync, FastifyPluginCallback } from 'fastify';
3
- import { PluginOption } from 'vite';
4
-
5
- type CSPDirectives = Record<string, string[]>;
6
- interface CSPOptions {
7
- directives?: CSPDirectives;
8
- exposeNonce?: (req: FastifyRequest, nonce: string) => void;
9
- generateCSP?: (directives: CSPDirectives, nonce: string) => string;
10
- }
11
- declare const defaultGenerateCSP: (directives: CSPDirectives, nonce: string) => string;
12
- declare const generateNonce: () => string;
13
- declare const createCSPHook: (options?: CSPOptions) => (req: FastifyRequest, reply: FastifyReply, done: HookHandlerDoneFunction) => void;
14
- declare const getRequestNonce: (req: FastifyRequest) => string | undefined;
15
- declare const applyCSP: (security: SSRServerOptions["security"], reply: FastifyReply) => string | undefined;
16
-
17
- declare const TEMPLATE: {
18
- readonly defaultEntryClient: "entry-client";
19
- readonly defaultEntryServer: "entry-server";
20
- readonly defaultHtmlTemplate: "index.html";
21
- };
22
-
23
- /**
24
- * taujs [ τjs ] Orchestration System
25
- * (c) 2024-present Aoede Ltd
26
- * Author: John Smith
27
- *
28
- * Licensed under the MIT License — attribution appreciated.
29
- * Part of the taujs [ τjs ] system for declarative, build-time orchestration of microfrontend applications,
30
- * including CSR, SSR, streaming, and middleware composition.
31
- */
32
-
33
- declare const createMaps: () => {
34
- bootstrapModules: Map<string, string>;
35
- cssLinks: Map<string, string>;
36
- manifests: Map<string, Manifest>;
37
- preloadLinks: Map<string, string>;
38
- renderModules: Map<string, RenderModule>;
39
- ssrManifests: Map<string, SSRManifest>;
40
- templates: Map<string, string>;
41
- };
42
- declare const processConfigs: (configs: Config[], baseClientRoot: string, templateDefaults: typeof TEMPLATE) => ProcessedConfig[];
43
- declare const SSRServer: FastifyPluginAsync<SSRServerOptions>;
44
- type Config = {
45
- appId: string;
46
- entryPoint: string;
47
- entryClient?: string;
48
- entryServer?: string;
49
- htmlTemplate?: string;
50
- };
51
- type ProcessedConfig = {
52
- appId: string;
53
- clientRoot: string;
54
- entryClient: string;
55
- entryPoint: string;
56
- entryServer: string;
57
- htmlTemplate: string;
58
- plugins?: PluginOption[];
59
- };
60
- type SSRServerOptions = {
61
- alias?: Record<string, string>;
62
- clientRoot: string;
63
- configs: Config[];
64
- routes: Route<RouteParams>[];
65
- serviceRegistry: ServiceRegistry;
66
- security?: {
67
- csp?: {
68
- directives?: CSPDirectives;
69
- generateCSP?: (directives: CSPDirectives, nonce: string) => string;
70
- };
71
- };
72
- registerStaticAssets?: false | {
73
- plugin: FastifyPluginCallback<any> | FastifyPluginAsync<any>;
74
- options?: Record<string, unknown>;
75
- };
76
- isDebug?: boolean;
77
- };
78
- type ServiceMethod = (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
79
- type NamedService = Record<string, ServiceMethod>;
80
- type ServiceRegistry = Record<string, NamedService>;
81
- type RenderCallbacks = {
82
- onHead: (headContent: string) => void;
83
- onFinish: (initialDataResolved: unknown) => void;
84
- onError: (error: unknown) => void;
85
- };
86
- type SSRManifest = {
87
- [key: string]: string[];
88
- };
89
- type ManifestEntry = {
90
- file: string;
91
- src?: string;
92
- isDynamicEntry?: boolean;
93
- imports?: string[];
94
- css?: string[];
95
- assets?: string[];
96
- };
97
- type Manifest = {
98
- [key: string]: ManifestEntry;
99
- };
100
- type RenderSSR = (initialDataResolved: Record<string, unknown>, location: string, meta?: Record<string, unknown>) => Promise<{
101
- headContent: string;
102
- appHtml: string;
103
- }>;
104
- type RenderStream = (serverResponse: ServerResponse, callbacks: RenderCallbacks, initialDataPromise: Promise<Record<string, unknown>>, location: string, bootstrapModules?: string, meta?: Record<string, unknown>) => void;
105
- type RenderModule = {
106
- renderSSR: RenderSSR;
107
- renderStream: RenderStream;
108
- };
109
- type GenericPlugin = FastifyPluginCallback<Record<string, unknown>> | FastifyPluginAsync<Record<string, unknown>>;
110
- type BaseMiddleware = {
111
- auth?: {
112
- required: boolean;
113
- redirect?: string;
114
- roles?: string[];
115
- strategy?: string;
116
- };
117
- };
118
- type ServiceCall = {
119
- serviceName: string;
120
- serviceMethod: string;
121
- args?: Record<string, unknown>;
122
- };
123
- type DataResult = Record<string, unknown> | ServiceCall;
124
- type DataHandler<Params> = (params: Params, ctx: {
125
- headers: Record<string, string>;
126
- [key: string]: unknown;
127
- }) => Promise<DataResult>;
128
- type RouteAttributes<Params = {}, Middleware = BaseMiddleware> = {
129
- render: 'ssr';
130
- hydrate?: boolean;
131
- meta?: Record<string, unknown>;
132
- middleware?: Middleware;
133
- data?: DataHandler<Params>;
134
- } | {
135
- render: 'streaming';
136
- hydrate?: never;
137
- meta: Record<string, unknown>;
138
- middleware?: Middleware;
139
- data?: DataHandler<Params>;
140
- };
141
- type Route<Params = {}> = {
142
- attr?: RouteAttributes<Params>;
143
- path: string;
144
- appId?: string;
145
- };
146
- interface InitialRouteParams extends Record<string, unknown> {
147
- serviceName?: string;
148
- serviceMethod?: string;
149
- }
150
- type RouteParams = InitialRouteParams & Record<string, unknown>;
151
- type RoutePathsAndAttributes<Params = {}> = Omit<Route<Params>, 'element'>;
152
-
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 };