@bleedingdev/modern-js-server-core 3.2.0-ultramodern.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.
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/cjs/adapters/node/helper/index.js +55 -0
- package/dist/cjs/adapters/node/helper/loadCache.js +58 -0
- package/dist/cjs/adapters/node/helper/loadConfig.js +78 -0
- package/dist/cjs/adapters/node/helper/loadEnv.js +66 -0
- package/dist/cjs/adapters/node/helper/loadPlugin.js +47 -0
- package/dist/cjs/adapters/node/helper/utils.js +39 -0
- package/dist/cjs/adapters/node/hono.js +95 -0
- package/dist/cjs/adapters/node/index.js +87 -0
- package/dist/cjs/adapters/node/node.js +180 -0
- package/dist/cjs/adapters/node/plugins/index.js +72 -0
- package/dist/cjs/adapters/node/plugins/nodeServer.js +43 -0
- package/dist/cjs/adapters/node/plugins/resource.js +206 -0
- package/dist/cjs/adapters/node/plugins/static.js +379 -0
- package/dist/cjs/constants.js +77 -0
- package/dist/cjs/context.js +41 -0
- package/dist/cjs/helper.js +45 -0
- package/dist/cjs/hono.js +46 -0
- package/dist/cjs/index.js +247 -0
- package/dist/cjs/plugins/compat/hooks.js +80 -0
- package/dist/cjs/plugins/compat/index.js +64 -0
- package/dist/cjs/plugins/contractGateAutopilot.js +158 -0
- package/dist/cjs/plugins/contractGateSnapshotStore.js +239 -0
- package/dist/cjs/plugins/default.js +61 -0
- package/dist/cjs/plugins/favicon.js +48 -0
- package/dist/cjs/plugins/index.js +157 -0
- package/dist/cjs/plugins/log.js +92 -0
- package/dist/cjs/plugins/mfCache.js +78 -0
- package/dist/cjs/plugins/middlewares.js +49 -0
- package/dist/cjs/plugins/monitors.js +192 -0
- package/dist/cjs/plugins/processedBy.js +50 -0
- package/dist/cjs/plugins/render/csrRscRender.js +74 -0
- package/dist/cjs/plugins/render/dataHandler.js +53 -0
- package/dist/cjs/plugins/render/index.js +158 -0
- package/dist/cjs/plugins/render/inject.js +92 -0
- package/dist/cjs/plugins/render/render.js +273 -0
- package/dist/cjs/plugins/render/renderRscHandler.js +72 -0
- package/dist/cjs/plugins/render/serverActionHandler.js +47 -0
- package/dist/cjs/plugins/render/ssrCache.js +198 -0
- package/dist/cjs/plugins/render/ssrRender.js +96 -0
- package/dist/cjs/plugins/render/utils.js +49 -0
- package/dist/cjs/plugins/route.js +68 -0
- package/dist/cjs/plugins/telemetry.js +1283 -0
- package/dist/cjs/serverBase.js +176 -0
- package/dist/cjs/types/config/bff.js +18 -0
- package/dist/cjs/types/config/dev.js +18 -0
- package/dist/cjs/types/config/html.js +18 -0
- package/dist/cjs/types/config/index.js +93 -0
- package/dist/cjs/types/config/output.js +18 -0
- package/dist/cjs/types/config/security.js +18 -0
- package/dist/cjs/types/config/server.js +18 -0
- package/dist/cjs/types/config/share.js +18 -0
- package/dist/cjs/types/config/source.js +18 -0
- package/dist/cjs/types/config/tools.js +18 -0
- package/dist/cjs/types/index.js +79 -0
- package/dist/cjs/types/plugins/base.js +18 -0
- package/dist/cjs/types/plugins/index.js +58 -0
- package/dist/cjs/types/plugins/plugin.js +18 -0
- package/dist/cjs/types/render.js +18 -0
- package/dist/cjs/types/requestHandler.js +18 -0
- package/dist/cjs/types/server.js +18 -0
- package/dist/cjs/utils/entry.js +40 -0
- package/dist/cjs/utils/env.js +51 -0
- package/dist/cjs/utils/error.js +93 -0
- package/dist/cjs/utils/index.js +114 -0
- package/dist/cjs/utils/middlewareCollector.js +63 -0
- package/dist/cjs/utils/publicDir.js +92 -0
- package/dist/cjs/utils/request.js +86 -0
- package/dist/cjs/utils/serverConfig.js +43 -0
- package/dist/cjs/utils/storage.js +69 -0
- package/dist/cjs/utils/transformStream.js +65 -0
- package/dist/cjs/utils/warmup.js +40 -0
- package/dist/esm/adapters/node/helper/index.mjs +5 -0
- package/dist/esm/adapters/node/helper/loadCache.mjs +14 -0
- package/dist/esm/adapters/node/helper/loadConfig.mjs +31 -0
- package/dist/esm/adapters/node/helper/loadEnv.mjs +22 -0
- package/dist/esm/adapters/node/helper/loadPlugin.mjs +13 -0
- package/dist/esm/adapters/node/helper/utils.mjs +5 -0
- package/dist/esm/adapters/node/hono.mjs +55 -0
- package/dist/esm/adapters/node/index.mjs +4 -0
- package/dist/esm/adapters/node/node.mjs +130 -0
- package/dist/esm/adapters/node/plugins/index.mjs +3 -0
- package/dist/esm/adapters/node/plugins/nodeServer.mjs +9 -0
- package/dist/esm/adapters/node/plugins/resource.mjs +138 -0
- package/dist/esm/adapters/node/plugins/static.mjs +329 -0
- package/dist/esm/constants.mjs +28 -0
- package/dist/esm/context.mjs +4 -0
- package/dist/esm/helper.mjs +11 -0
- package/dist/esm/hono.mjs +2 -0
- package/dist/esm/index.mjs +12 -0
- package/dist/esm/plugins/compat/hooks.mjs +40 -0
- package/dist/esm/plugins/compat/index.mjs +27 -0
- package/dist/esm/plugins/contractGateAutopilot.mjs +124 -0
- package/dist/esm/plugins/contractGateSnapshotStore.mjs +180 -0
- package/dist/esm/plugins/default.mjs +27 -0
- package/dist/esm/plugins/favicon.mjs +14 -0
- package/dist/esm/plugins/index.mjs +11 -0
- package/dist/esm/plugins/log.mjs +58 -0
- package/dist/esm/plugins/mfCache.mjs +35 -0
- package/dist/esm/plugins/middlewares.mjs +15 -0
- package/dist/esm/plugins/monitors.mjs +149 -0
- package/dist/esm/plugins/processedBy.mjs +16 -0
- package/dist/esm/plugins/render/csrRscRender.mjs +40 -0
- package/dist/esm/plugins/render/dataHandler.mjs +19 -0
- package/dist/esm/plugins/render/index.mjs +84 -0
- package/dist/esm/plugins/render/inject.mjs +55 -0
- package/dist/esm/plugins/render/render.mjs +230 -0
- package/dist/esm/plugins/render/renderRscHandler.mjs +38 -0
- package/dist/esm/plugins/render/serverActionHandler.mjs +13 -0
- package/dist/esm/plugins/render/ssrCache.mjs +158 -0
- package/dist/esm/plugins/render/ssrRender.mjs +62 -0
- package/dist/esm/plugins/render/utils.mjs +15 -0
- package/dist/esm/plugins/route.mjs +34 -0
- package/dist/esm/plugins/telemetry.mjs +1195 -0
- package/dist/esm/rslib-runtime.mjs +18 -0
- package/dist/esm/serverBase.mjs +139 -0
- package/dist/esm/types/config/bff.mjs +0 -0
- package/dist/esm/types/config/dev.mjs +0 -0
- package/dist/esm/types/config/html.mjs +0 -0
- package/dist/esm/types/config/index.mjs +6 -0
- package/dist/esm/types/config/output.mjs +0 -0
- package/dist/esm/types/config/security.mjs +0 -0
- package/dist/esm/types/config/server.mjs +0 -0
- package/dist/esm/types/config/share.mjs +0 -0
- package/dist/esm/types/config/source.mjs +0 -0
- package/dist/esm/types/config/tools.mjs +0 -0
- package/dist/esm/types/index.mjs +4 -0
- package/dist/esm/types/plugins/base.mjs +0 -0
- package/dist/esm/types/plugins/index.mjs +1 -0
- package/dist/esm/types/plugins/plugin.mjs +0 -0
- package/dist/esm/types/render.mjs +0 -0
- package/dist/esm/types/requestHandler.mjs +0 -0
- package/dist/esm/types/server.mjs +0 -0
- package/dist/esm/utils/entry.mjs +3 -0
- package/dist/esm/utils/env.mjs +14 -0
- package/dist/esm/utils/error.mjs +53 -0
- package/dist/esm/utils/index.mjs +9 -0
- package/dist/esm/utils/middlewareCollector.mjs +26 -0
- package/dist/esm/utils/publicDir.mjs +33 -0
- package/dist/esm/utils/request.mjs +40 -0
- package/dist/esm/utils/serverConfig.mjs +9 -0
- package/dist/esm/utils/storage.mjs +35 -0
- package/dist/esm/utils/transformStream.mjs +28 -0
- package/dist/esm/utils/warmup.mjs +6 -0
- package/dist/esm-node/adapters/node/helper/index.mjs +6 -0
- package/dist/esm-node/adapters/node/helper/loadCache.mjs +15 -0
- package/dist/esm-node/adapters/node/helper/loadConfig.mjs +32 -0
- package/dist/esm-node/adapters/node/helper/loadEnv.mjs +23 -0
- package/dist/esm-node/adapters/node/helper/loadPlugin.mjs +14 -0
- package/dist/esm-node/adapters/node/helper/utils.mjs +6 -0
- package/dist/esm-node/adapters/node/hono.mjs +56 -0
- package/dist/esm-node/adapters/node/index.mjs +5 -0
- package/dist/esm-node/adapters/node/node.mjs +131 -0
- package/dist/esm-node/adapters/node/plugins/index.mjs +4 -0
- package/dist/esm-node/adapters/node/plugins/nodeServer.mjs +10 -0
- package/dist/esm-node/adapters/node/plugins/resource.mjs +139 -0
- package/dist/esm-node/adapters/node/plugins/static.mjs +330 -0
- package/dist/esm-node/constants.mjs +29 -0
- package/dist/esm-node/context.mjs +5 -0
- package/dist/esm-node/helper.mjs +12 -0
- package/dist/esm-node/hono.mjs +3 -0
- package/dist/esm-node/index.mjs +13 -0
- package/dist/esm-node/plugins/compat/hooks.mjs +41 -0
- package/dist/esm-node/plugins/compat/index.mjs +28 -0
- package/dist/esm-node/plugins/contractGateAutopilot.mjs +125 -0
- package/dist/esm-node/plugins/contractGateSnapshotStore.mjs +182 -0
- package/dist/esm-node/plugins/default.mjs +28 -0
- package/dist/esm-node/plugins/favicon.mjs +15 -0
- package/dist/esm-node/plugins/index.mjs +12 -0
- package/dist/esm-node/plugins/log.mjs +59 -0
- package/dist/esm-node/plugins/mfCache.mjs +36 -0
- package/dist/esm-node/plugins/middlewares.mjs +16 -0
- package/dist/esm-node/plugins/monitors.mjs +150 -0
- package/dist/esm-node/plugins/processedBy.mjs +17 -0
- package/dist/esm-node/plugins/render/csrRscRender.mjs +41 -0
- package/dist/esm-node/plugins/render/dataHandler.mjs +20 -0
- package/dist/esm-node/plugins/render/index.mjs +85 -0
- package/dist/esm-node/plugins/render/inject.mjs +56 -0
- package/dist/esm-node/plugins/render/render.mjs +231 -0
- package/dist/esm-node/plugins/render/renderRscHandler.mjs +39 -0
- package/dist/esm-node/plugins/render/serverActionHandler.mjs +14 -0
- package/dist/esm-node/plugins/render/ssrCache.mjs +159 -0
- package/dist/esm-node/plugins/render/ssrRender.mjs +63 -0
- package/dist/esm-node/plugins/render/utils.mjs +16 -0
- package/dist/esm-node/plugins/route.mjs +35 -0
- package/dist/esm-node/plugins/telemetry.mjs +1196 -0
- package/dist/esm-node/rslib-runtime.mjs +19 -0
- package/dist/esm-node/serverBase.mjs +140 -0
- package/dist/esm-node/types/config/bff.mjs +1 -0
- package/dist/esm-node/types/config/dev.mjs +1 -0
- package/dist/esm-node/types/config/html.mjs +1 -0
- package/dist/esm-node/types/config/index.mjs +7 -0
- package/dist/esm-node/types/config/output.mjs +1 -0
- package/dist/esm-node/types/config/security.mjs +1 -0
- package/dist/esm-node/types/config/server.mjs +1 -0
- package/dist/esm-node/types/config/share.mjs +1 -0
- package/dist/esm-node/types/config/source.mjs +1 -0
- package/dist/esm-node/types/config/tools.mjs +1 -0
- package/dist/esm-node/types/index.mjs +5 -0
- package/dist/esm-node/types/plugins/base.mjs +1 -0
- package/dist/esm-node/types/plugins/index.mjs +2 -0
- package/dist/esm-node/types/plugins/plugin.mjs +1 -0
- package/dist/esm-node/types/render.mjs +1 -0
- package/dist/esm-node/types/requestHandler.mjs +1 -0
- package/dist/esm-node/types/server.mjs +1 -0
- package/dist/esm-node/utils/entry.mjs +4 -0
- package/dist/esm-node/utils/env.mjs +15 -0
- package/dist/esm-node/utils/error.mjs +54 -0
- package/dist/esm-node/utils/index.mjs +10 -0
- package/dist/esm-node/utils/middlewareCollector.mjs +27 -0
- package/dist/esm-node/utils/publicDir.mjs +34 -0
- package/dist/esm-node/utils/request.mjs +41 -0
- package/dist/esm-node/utils/serverConfig.mjs +10 -0
- package/dist/esm-node/utils/storage.mjs +36 -0
- package/dist/esm-node/utils/transformStream.mjs +29 -0
- package/dist/esm-node/utils/warmup.mjs +7 -0
- package/dist/types/adapters/node/helper/index.d.ts +6 -0
- package/dist/types/adapters/node/helper/loadCache.d.ts +2 -0
- package/dist/types/adapters/node/helper/loadConfig.d.ts +3 -0
- package/dist/types/adapters/node/helper/loadEnv.d.ts +3 -0
- package/dist/types/adapters/node/helper/loadPlugin.d.ts +3 -0
- package/dist/types/adapters/node/helper/utils.d.ts +21 -0
- package/dist/types/adapters/node/hono.d.ts +19 -0
- package/dist/types/adapters/node/index.d.ts +5 -0
- package/dist/types/adapters/node/node.d.ts +17 -0
- package/dist/types/adapters/node/plugins/index.d.ts +3 -0
- package/dist/types/adapters/node/plugins/nodeServer.d.ts +6 -0
- package/dist/types/adapters/node/plugins/resource.d.ts +11 -0
- package/dist/types/adapters/node/plugins/static.d.ts +25 -0
- package/dist/types/constants.d.ts +26 -0
- package/dist/types/context.d.ts +3 -0
- package/dist/types/helper.d.ts +10 -0
- package/dist/types/hono.d.ts +3 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/plugins/compat/hooks.d.ts +8 -0
- package/dist/types/plugins/compat/index.d.ts +3 -0
- package/dist/types/plugins/contractGateAutopilot.d.ts +35 -0
- package/dist/types/plugins/contractGateSnapshotStore.d.ts +57 -0
- package/dist/types/plugins/default.d.ts +7 -0
- package/dist/types/plugins/favicon.d.ts +2 -0
- package/dist/types/plugins/index.d.ts +11 -0
- package/dist/types/plugins/log.d.ts +2 -0
- package/dist/types/plugins/mfCache.d.ts +12 -0
- package/dist/types/plugins/middlewares.d.ts +2 -0
- package/dist/types/plugins/monitors.d.ts +6 -0
- package/dist/types/plugins/processedBy.d.ts +2 -0
- package/dist/types/plugins/render/csrRscRender.d.ts +2 -0
- package/dist/types/plugins/render/dataHandler.d.ts +5 -0
- package/dist/types/plugins/render/index.d.ts +3 -0
- package/dist/types/plugins/render/inject.d.ts +7 -0
- package/dist/types/plugins/render/render.d.ts +16 -0
- package/dist/types/plugins/render/renderRscHandler.d.ts +2 -0
- package/dist/types/plugins/render/serverActionHandler.d.ts +2 -0
- package/dist/types/plugins/render/ssrCache.d.ts +18 -0
- package/dist/types/plugins/render/ssrRender.d.ts +26 -0
- package/dist/types/plugins/render/utils.d.ts +3 -0
- package/dist/types/plugins/route.d.ts +2 -0
- package/dist/types/plugins/telemetry.d.ts +309 -0
- package/dist/types/serverBase.d.ts +38 -0
- package/dist/types/types/config/bff.d.ts +142 -0
- package/dist/types/types/config/dev.d.ts +4 -0
- package/dist/types/types/config/html.d.ts +15 -0
- package/dist/types/types/config/index.d.ts +35 -0
- package/dist/types/types/config/output.d.ts +20 -0
- package/dist/types/types/config/security.d.ts +4 -0
- package/dist/types/types/config/server.d.ts +402 -0
- package/dist/types/types/config/share.d.ts +3 -0
- package/dist/types/types/config/source.d.ts +7 -0
- package/dist/types/types/config/tools.d.ts +2 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/plugins/base.d.ts +57 -0
- package/dist/types/types/plugins/index.d.ts +2 -0
- package/dist/types/types/plugins/plugin.d.ts +31 -0
- package/dist/types/types/render.d.ts +24 -0
- package/dist/types/types/requestHandler.d.ts +48 -0
- package/dist/types/types/server.d.ts +67 -0
- package/dist/types/utils/entry.d.ts +3 -0
- package/dist/types/utils/env.d.ts +2 -0
- package/dist/types/utils/error.d.ts +8 -0
- package/dist/types/utils/index.d.ts +9 -0
- package/dist/types/utils/middlewareCollector.d.ts +12 -0
- package/dist/types/utils/publicDir.d.ts +40 -0
- package/dist/types/utils/request.d.ts +17 -0
- package/dist/types/utils/serverConfig.d.ts +8 -0
- package/dist/types/utils/storage.d.ts +5 -0
- package/dist/types/utils/transformStream.d.ts +5 -0
- package/dist/types/utils/warmup.d.ts +1 -0
- package/package.json +103 -0
- package/rslib.config.mts +4 -0
- package/rstest.config.mts +7 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import type { Metrics } from '@modern-js/types';
|
|
2
|
+
import type { ServerTelemetryUserConfig } from '../types/config';
|
|
3
|
+
import type { ServerPlugin } from '../types/plugins';
|
|
4
|
+
export type TelemetrySignalType = 'log' | 'metric' | 'trace';
|
|
5
|
+
export interface TelemetryEnvelope {
|
|
6
|
+
timestamp: number;
|
|
7
|
+
service: string;
|
|
8
|
+
module: string;
|
|
9
|
+
environment: string;
|
|
10
|
+
signalType: TelemetrySignalType;
|
|
11
|
+
name: string;
|
|
12
|
+
level?: string;
|
|
13
|
+
value?: number;
|
|
14
|
+
unit?: string;
|
|
15
|
+
traceId?: string;
|
|
16
|
+
spanId?: string;
|
|
17
|
+
parentSpanId?: string;
|
|
18
|
+
tags?: Record<string, string>;
|
|
19
|
+
attributes?: Record<string, unknown>;
|
|
20
|
+
error?: {
|
|
21
|
+
name?: string;
|
|
22
|
+
message: string;
|
|
23
|
+
stack?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface TelemetryExporter {
|
|
27
|
+
name: string;
|
|
28
|
+
init?: (context: {
|
|
29
|
+
service: string;
|
|
30
|
+
module: string;
|
|
31
|
+
environment: string;
|
|
32
|
+
}) => void | Promise<void>;
|
|
33
|
+
emit: (batch: TelemetryEnvelope[]) => void | Promise<void>;
|
|
34
|
+
flush?: () => void | Promise<void>;
|
|
35
|
+
shutdown?: () => void | Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface TelemetryRegistryOptions {
|
|
38
|
+
service: string;
|
|
39
|
+
module: string;
|
|
40
|
+
environment: string;
|
|
41
|
+
samplingRate?: number;
|
|
42
|
+
flushIntervalMs?: number;
|
|
43
|
+
maxBatchSize?: number;
|
|
44
|
+
maxQueueSize?: number;
|
|
45
|
+
redactionKeys?: string[];
|
|
46
|
+
slo?: {
|
|
47
|
+
queueUtilizationWarnThreshold?: number;
|
|
48
|
+
queueDroppedWarnThreshold?: number;
|
|
49
|
+
alertCooldownMs?: number;
|
|
50
|
+
onAlert?: (alert: TelemetrySloAlert) => void;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export type TelemetrySloAlertType = 'queue.utilization' | 'queue.drop';
|
|
54
|
+
export interface TelemetrySloAlert {
|
|
55
|
+
timestamp: number;
|
|
56
|
+
service: string;
|
|
57
|
+
module: string;
|
|
58
|
+
environment: string;
|
|
59
|
+
type: TelemetrySloAlertType;
|
|
60
|
+
value: number;
|
|
61
|
+
threshold: number;
|
|
62
|
+
queueDepth: number;
|
|
63
|
+
queueCapacity: number;
|
|
64
|
+
queueUtilization: number;
|
|
65
|
+
totalDropped: number;
|
|
66
|
+
}
|
|
67
|
+
export interface TelemetryQueueStats {
|
|
68
|
+
depth: number;
|
|
69
|
+
capacity: number;
|
|
70
|
+
utilization: number;
|
|
71
|
+
pendingDropped: number;
|
|
72
|
+
totalDropped: number;
|
|
73
|
+
}
|
|
74
|
+
export type TelemetryCanaryState = 'canary' | 'promoted' | 'rolled_back';
|
|
75
|
+
export type TelemetryCanaryAction = 'hold' | 'promote' | 'rollback';
|
|
76
|
+
export type TelemetryCanaryFailureReason = 'queue_utilization' | 'queue_dropped' | 'unhealthy_exporter' | 'contract_gate_missing' | 'contract_gate_failed';
|
|
77
|
+
export interface TelemetryCanaryFailure {
|
|
78
|
+
reason: TelemetryCanaryFailureReason;
|
|
79
|
+
gate?: string;
|
|
80
|
+
message?: string;
|
|
81
|
+
threshold?: number;
|
|
82
|
+
value?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface TelemetryCanaryContractGateStatus {
|
|
85
|
+
name: string;
|
|
86
|
+
passed: boolean;
|
|
87
|
+
reason?: string;
|
|
88
|
+
updatedAt: number;
|
|
89
|
+
}
|
|
90
|
+
export interface TelemetryCanaryDecision {
|
|
91
|
+
timestamp: number;
|
|
92
|
+
action: TelemetryCanaryAction;
|
|
93
|
+
state: TelemetryCanaryState;
|
|
94
|
+
consecutiveHealthy: number;
|
|
95
|
+
consecutiveFailures: number;
|
|
96
|
+
failures: TelemetryCanaryFailure[];
|
|
97
|
+
queueStats: TelemetryQueueStats;
|
|
98
|
+
unhealthyExporterCount: number;
|
|
99
|
+
contractGates: TelemetryCanaryContractGateStatus[];
|
|
100
|
+
}
|
|
101
|
+
export interface TelemetryCanaryStatusSnapshot {
|
|
102
|
+
timestamp: number;
|
|
103
|
+
state: TelemetryCanaryState;
|
|
104
|
+
consecutiveHealthy: number;
|
|
105
|
+
consecutiveFailures: number;
|
|
106
|
+
queueStats: TelemetryQueueStats;
|
|
107
|
+
unhealthyExporterCount: number;
|
|
108
|
+
requiredContractGates: string[];
|
|
109
|
+
contractGates: TelemetryCanaryContractGateStatus[];
|
|
110
|
+
failurePreview: TelemetryCanaryFailure[];
|
|
111
|
+
}
|
|
112
|
+
export interface TelemetryCanaryOrchestratorOptions {
|
|
113
|
+
registry: TelemetryRegistry;
|
|
114
|
+
evaluationIntervalMs?: number;
|
|
115
|
+
minConsecutiveHealthyEvaluations?: number;
|
|
116
|
+
rollbackConsecutiveFailures?: number;
|
|
117
|
+
maxQueueUtilization?: number;
|
|
118
|
+
maxTotalDropped?: number;
|
|
119
|
+
maxUnhealthyExporters?: number;
|
|
120
|
+
requiredContractGates?: string[];
|
|
121
|
+
onEvaluate?: (decision: TelemetryCanaryDecision) => void;
|
|
122
|
+
onPromote?: (decision: TelemetryCanaryDecision) => void;
|
|
123
|
+
onRollback?: (decision: TelemetryCanaryDecision) => void;
|
|
124
|
+
}
|
|
125
|
+
export interface TelemetryExporterHealthStatus {
|
|
126
|
+
name: string;
|
|
127
|
+
healthy: boolean;
|
|
128
|
+
failures: number;
|
|
129
|
+
lastError?: string;
|
|
130
|
+
lastSuccessAt?: number;
|
|
131
|
+
lastFailureAt?: number;
|
|
132
|
+
}
|
|
133
|
+
export declare class TelemetryStartupHealthError extends Error {
|
|
134
|
+
readonly code = "TELEMETRY_EXPORTER_STARTUP_HEALTH_FAILED";
|
|
135
|
+
readonly failedExporters: TelemetryExporterHealthStatus[];
|
|
136
|
+
constructor(failedExporters: TelemetryExporterHealthStatus[]);
|
|
137
|
+
}
|
|
138
|
+
export interface OtlpExporterOptions {
|
|
139
|
+
endpoint?: string;
|
|
140
|
+
headers?: Record<string, string>;
|
|
141
|
+
timeoutMs?: number;
|
|
142
|
+
}
|
|
143
|
+
export interface VictoriaMetricsExporterOptions extends OtlpExporterOptions {
|
|
144
|
+
metricPrefix?: string;
|
|
145
|
+
}
|
|
146
|
+
export declare const DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = "/_modern/contract-gates/runtime-fallback";
|
|
147
|
+
export declare const DEFAULT_RUNTIME_STATUS_ENDPOINT = "/_modern/runtime/status";
|
|
148
|
+
export type RuntimeSignalErrorCode = 'PAYLOAD_TOO_LARGE' | 'INVALID_PAYLOAD' | 'RATE_LIMITED' | 'UNAUTHORIZED' | 'UNTRUSTED_SOURCE';
|
|
149
|
+
export type RuntimeSignalError = Error & {
|
|
150
|
+
code?: RuntimeSignalErrorCode;
|
|
151
|
+
};
|
|
152
|
+
export type RuntimeFallbackSignalTrustPolicy = {
|
|
153
|
+
allowedApps: string[];
|
|
154
|
+
allowedEntryOrigins: string[];
|
|
155
|
+
expectedRuntimeDigests: Record<string, string>;
|
|
156
|
+
enforceRuntimeDigest: boolean;
|
|
157
|
+
maxSignalsPerWindow: number;
|
|
158
|
+
windowMs: number;
|
|
159
|
+
dedupeWindowMs: number;
|
|
160
|
+
};
|
|
161
|
+
type RuntimeFallbackSignalRateLimitState = {
|
|
162
|
+
count: number;
|
|
163
|
+
windowStartedAt: number;
|
|
164
|
+
};
|
|
165
|
+
export type RuntimeFallbackSignalAuthConfig = {
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
headerName: string;
|
|
168
|
+
expectedValue?: string;
|
|
169
|
+
};
|
|
170
|
+
export type RuntimeFallbackSignalRuntimeState = {
|
|
171
|
+
rateLimitBySource: Map<string, RuntimeFallbackSignalRateLimitState>;
|
|
172
|
+
dedupeByFingerprint: Map<string, number>;
|
|
173
|
+
};
|
|
174
|
+
export type RuntimeFallbackSignalTrustContext = {
|
|
175
|
+
trustPolicy: RuntimeFallbackSignalTrustPolicy;
|
|
176
|
+
runtimeState: RuntimeFallbackSignalRuntimeState;
|
|
177
|
+
};
|
|
178
|
+
export declare function createOtlpTelemetryExporter(options?: OtlpExporterOptions): TelemetryExporter;
|
|
179
|
+
export declare function createVictoriaMetricsTelemetryExporter(options?: VictoriaMetricsExporterOptions): TelemetryExporter;
|
|
180
|
+
export declare class TelemetryRegistry {
|
|
181
|
+
private readonly exporters;
|
|
182
|
+
private readonly queue;
|
|
183
|
+
private readonly redactionKeys;
|
|
184
|
+
private readonly service;
|
|
185
|
+
private readonly module;
|
|
186
|
+
private readonly environment;
|
|
187
|
+
private readonly samplingRate;
|
|
188
|
+
private readonly maxBatchSize;
|
|
189
|
+
private readonly maxQueueSize;
|
|
190
|
+
private readonly flushIntervalMs;
|
|
191
|
+
private readonly flushTimer?;
|
|
192
|
+
private droppedCount;
|
|
193
|
+
private totalDroppedCount;
|
|
194
|
+
private flushing;
|
|
195
|
+
private readonly exporterHealth;
|
|
196
|
+
private readonly queueUtilizationWarnThreshold;
|
|
197
|
+
private readonly queueDroppedWarnThreshold;
|
|
198
|
+
private readonly alertCooldownMs;
|
|
199
|
+
private readonly onSloAlert?;
|
|
200
|
+
private readonly lastSloAlertAt;
|
|
201
|
+
constructor(options: TelemetryRegistryOptions);
|
|
202
|
+
register(exporter: TelemetryExporter): Promise<void>;
|
|
203
|
+
private getOrCreateExporterHealth;
|
|
204
|
+
private markExporterHealthy;
|
|
205
|
+
private markExporterFailure;
|
|
206
|
+
private maybeEmitSloAlert;
|
|
207
|
+
enqueue(envelope: TelemetryEnvelope): void;
|
|
208
|
+
enqueueMetric(input: {
|
|
209
|
+
name: string;
|
|
210
|
+
value: number;
|
|
211
|
+
unit?: string;
|
|
212
|
+
traceId?: string;
|
|
213
|
+
spanId?: string;
|
|
214
|
+
parentSpanId?: string;
|
|
215
|
+
tags?: Record<string, string>;
|
|
216
|
+
attributes?: Record<string, unknown>;
|
|
217
|
+
}): void;
|
|
218
|
+
enqueueLog(input: {
|
|
219
|
+
name: string;
|
|
220
|
+
level: string;
|
|
221
|
+
traceId?: string;
|
|
222
|
+
spanId?: string;
|
|
223
|
+
parentSpanId?: string;
|
|
224
|
+
tags?: Record<string, string>;
|
|
225
|
+
attributes?: Record<string, unknown>;
|
|
226
|
+
error?: TelemetryEnvelope['error'];
|
|
227
|
+
}): void;
|
|
228
|
+
enqueueTrace(input: {
|
|
229
|
+
name: string;
|
|
230
|
+
traceId?: string;
|
|
231
|
+
spanId?: string;
|
|
232
|
+
parentSpanId?: string;
|
|
233
|
+
tags?: Record<string, string>;
|
|
234
|
+
attributes?: Record<string, unknown>;
|
|
235
|
+
}): void;
|
|
236
|
+
private buildDroppedEnvelope;
|
|
237
|
+
private buildQueueDepthEnvelope;
|
|
238
|
+
private buildQueueUtilizationEnvelope;
|
|
239
|
+
private emitBatch;
|
|
240
|
+
private buildStartupProbeEnvelope;
|
|
241
|
+
startupHealthCheck(options?: {
|
|
242
|
+
failLoud?: boolean;
|
|
243
|
+
}): Promise<void>;
|
|
244
|
+
getExporterHealth(): TelemetryExporterHealthStatus[];
|
|
245
|
+
getQueueStats(): TelemetryQueueStats;
|
|
246
|
+
private flushInternal;
|
|
247
|
+
flush(): Promise<void>;
|
|
248
|
+
shutdown(): Promise<void>;
|
|
249
|
+
}
|
|
250
|
+
export declare class TelemetryCanaryOrchestrator {
|
|
251
|
+
private readonly registry;
|
|
252
|
+
private readonly evaluationIntervalMs;
|
|
253
|
+
private readonly minConsecutiveHealthyEvaluations;
|
|
254
|
+
private readonly rollbackConsecutiveFailures;
|
|
255
|
+
private readonly maxQueueUtilization;
|
|
256
|
+
private readonly maxTotalDropped;
|
|
257
|
+
private readonly maxUnhealthyExporters;
|
|
258
|
+
private requiredContractGates;
|
|
259
|
+
private readonly onEvaluate?;
|
|
260
|
+
private readonly onPromote?;
|
|
261
|
+
private readonly onRollback?;
|
|
262
|
+
private readonly contractGates;
|
|
263
|
+
private state;
|
|
264
|
+
private consecutiveHealthy;
|
|
265
|
+
private consecutiveFailures;
|
|
266
|
+
private evaluationTimer?;
|
|
267
|
+
constructor(options: TelemetryCanaryOrchestratorOptions);
|
|
268
|
+
setRequiredContractGates(gates: string[]): void;
|
|
269
|
+
addRequiredContractGate(name: string): void;
|
|
270
|
+
setContractGate(name: string, passed: boolean, reason?: string): void;
|
|
271
|
+
setContractGates(gates: Record<string, boolean | {
|
|
272
|
+
passed: boolean;
|
|
273
|
+
reason?: string;
|
|
274
|
+
}>): void;
|
|
275
|
+
resetToCanary(): void;
|
|
276
|
+
private collectFailures;
|
|
277
|
+
evaluate(): TelemetryCanaryDecision;
|
|
278
|
+
getStatusSnapshot(): TelemetryCanaryStatusSnapshot;
|
|
279
|
+
start(): void;
|
|
280
|
+
stop(): void;
|
|
281
|
+
}
|
|
282
|
+
export declare const createTelemetryAwareMetrics: <T extends Metrics>(baseMetrics: T, registry: TelemetryRegistry) => T;
|
|
283
|
+
export declare function resolveRuntimeFallbackSignalEndpoint(configuredEndpoint?: string): string;
|
|
284
|
+
export declare function createRuntimeSignalError(message: string, code: RuntimeSignalError['code']): RuntimeSignalError;
|
|
285
|
+
export declare function normalizeRuntimeFallbackSignalAuthConfig(configured: {
|
|
286
|
+
enabled?: boolean;
|
|
287
|
+
headerName?: string;
|
|
288
|
+
expectedValue?: string;
|
|
289
|
+
expectedValueEnv?: string;
|
|
290
|
+
} | undefined): RuntimeFallbackSignalAuthConfig;
|
|
291
|
+
export declare function enforceRuntimeFallbackSignalAuthToken(token: string | undefined, authConfig: RuntimeFallbackSignalAuthConfig): void;
|
|
292
|
+
export declare function normalizeRuntimeFallbackTrustPolicy(configured: {
|
|
293
|
+
allowedApps?: string[];
|
|
294
|
+
allowedEntryOrigins?: string[];
|
|
295
|
+
expectedRuntimeDigests?: Record<string, string>;
|
|
296
|
+
enforceRuntimeDigest?: boolean;
|
|
297
|
+
maxSignalsPerWindow?: number;
|
|
298
|
+
windowMs?: number;
|
|
299
|
+
dedupeWindowMs?: number;
|
|
300
|
+
} | undefined): RuntimeFallbackSignalTrustPolicy;
|
|
301
|
+
export declare function createRuntimeFallbackSignalRuntimeState(): RuntimeFallbackSignalRuntimeState;
|
|
302
|
+
export declare function enforceRuntimeFallbackSignalTrustPolicy(payload: Record<string, unknown>, runtimeSignalContext: RuntimeFallbackSignalTrustContext): {
|
|
303
|
+
deduped: boolean;
|
|
304
|
+
};
|
|
305
|
+
export declare function parseRuntimeFallbackSignalPayloadFromRawBody(rawBody: string, maxBodyBytes: number): Record<string, unknown>;
|
|
306
|
+
export declare function getRuntimeSignalErrorStatusCode(signalError: RuntimeSignalError): 400 | 401 | 403 | 413 | 429 | 500;
|
|
307
|
+
export declare const hasEnabledTelemetryExporters: (config: ServerTelemetryUserConfig | undefined) => boolean;
|
|
308
|
+
export declare const injectTelemetryPlugin: () => ServerPlugin;
|
|
309
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ServerCreateOptions } from '@modern-js/plugin/server';
|
|
2
|
+
import type { Env, ServerConfig, ServerPlugin, ServerPluginHooks } from './types';
|
|
3
|
+
import type { CliConfig } from './types/config';
|
|
4
|
+
export interface ServerBaseOptions extends ServerCreateOptions {
|
|
5
|
+
/** server working directory, and then also dist directory */
|
|
6
|
+
config: CliConfig;
|
|
7
|
+
serverConfig?: ServerConfig;
|
|
8
|
+
runMode?: 'apiOnly' | 'ssrOnly' | 'webOnly';
|
|
9
|
+
}
|
|
10
|
+
export declare class ServerBase<E extends Env = any> {
|
|
11
|
+
#private;
|
|
12
|
+
serverOptions: ServerBaseOptions;
|
|
13
|
+
private app;
|
|
14
|
+
private plugins;
|
|
15
|
+
private serverContext;
|
|
16
|
+
constructor(options: ServerBaseOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Order
|
|
19
|
+
* - server runner
|
|
20
|
+
* - apply middlewares
|
|
21
|
+
*/
|
|
22
|
+
init(): Promise<this>;
|
|
23
|
+
addPlugins(plugins: ServerPlugin[]): void;
|
|
24
|
+
get hooks(): ServerPluginHooks;
|
|
25
|
+
get all(): import("hono/types").HandlerInterface<E, "all", import("hono/types").BlankSchema, "/", "/">;
|
|
26
|
+
get use(): import("hono/types").MiddlewareHandlerInterface<E, import("hono/types").BlankSchema, "/">;
|
|
27
|
+
get get(): import("hono/types").HandlerInterface<E, "get", import("hono/types").BlankSchema, "/", "/">;
|
|
28
|
+
get options(): import("hono/types").HandlerInterface<E, "options", import("hono/types").BlankSchema, "/", "/">;
|
|
29
|
+
get post(): import("hono/types").HandlerInterface<E, "post", import("hono/types").BlankSchema, "/", "/">;
|
|
30
|
+
get put(): import("hono/types").HandlerInterface<E, "put", import("hono/types").BlankSchema, "/", "/">;
|
|
31
|
+
get delete(): import("hono/types").HandlerInterface<E, "delete", import("hono/types").BlankSchema, "/", "/">;
|
|
32
|
+
get patch(): import("hono/types").HandlerInterface<E, "patch", import("hono/types").BlankSchema, "/", "/">;
|
|
33
|
+
get handle(): (request: Request, Env?: {} | E["Bindings"] | undefined, executionCtx?: import("hono").ExecutionContext) => Response | Promise<Response>;
|
|
34
|
+
get request(): (input: Request | string | URL, requestInit?: RequestInit, Env?: {} | E["Bindings"] | undefined, executionCtx?: import("hono").ExecutionContext) => Response | Promise<Response>;
|
|
35
|
+
get notFound(): (handler: import("hono").NotFoundHandler<E>) => import("hono/hono-base").HonoBase<E, import("hono/types").BlankSchema, "/", "/">;
|
|
36
|
+
get onError(): (handler: import("hono").ErrorHandler<E>) => import("hono/hono-base").HonoBase<E, import("hono/types").BlankSchema, "/", "/">;
|
|
37
|
+
}
|
|
38
|
+
export declare function createServerBase<E extends Env>(options: ServerBaseOptions): ServerBase<E>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { HttpMethodDecider } from '@modern-js/types';
|
|
2
|
+
export type BffRuntimeFramework = 'hono' | 'effect';
|
|
3
|
+
export interface BffCrossProjectPolicyUserConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Enable cross-project envelope and operation-context policy checks.
|
|
6
|
+
*
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Require cross-project envelope header when policy is enabled.
|
|
12
|
+
*
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
requireEnvelope?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Require operation-context header when policy is enabled.
|
|
18
|
+
*
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
requireOperationContext?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Require operation-context detail header carrying schema/version metadata.
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
requireOperationContextDetails?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Require operation schema hash in operation-context details.
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
requireOperationSchemaHash?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Require operation version in operation-context details.
|
|
36
|
+
*
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
requireOperationVersion?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Optional allowlist of producer namespaces derived from requestId.
|
|
42
|
+
*/
|
|
43
|
+
allowedNamespaces?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* Optional operation-contract map keyed by:
|
|
46
|
+
* - `${METHOD}:${routePath}`
|
|
47
|
+
* - `operation:${requestId}:${operationId}`
|
|
48
|
+
*/
|
|
49
|
+
expectedOperationContracts?: Record<string, {
|
|
50
|
+
schemaHash?: string;
|
|
51
|
+
operationVersion?: number;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Allow operations missing from expectedOperationContracts.
|
|
55
|
+
*
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
allowUnknownOperations?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* HTTP status code used for denied requests.
|
|
61
|
+
*
|
|
62
|
+
* @default 403
|
|
63
|
+
*/
|
|
64
|
+
denyStatus?: number;
|
|
65
|
+
}
|
|
66
|
+
export type BffEffectOpenApiUserConfig = boolean | {
|
|
67
|
+
path?: string;
|
|
68
|
+
};
|
|
69
|
+
export interface BffEffectDataPlatformSelectionUserConfig {
|
|
70
|
+
maxDepth?: number;
|
|
71
|
+
maxFields?: number;
|
|
72
|
+
allowedLeafPaths?: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface BffEffectDataPlatformBatchUserConfig {
|
|
75
|
+
enabled?: boolean;
|
|
76
|
+
endpoint?: `/${string}`;
|
|
77
|
+
maxBatchSize?: number;
|
|
78
|
+
maxBatchBytes?: number;
|
|
79
|
+
flushIntervalMs?: number;
|
|
80
|
+
maxConcurrency?: number;
|
|
81
|
+
requestTimeoutMs?: number;
|
|
82
|
+
allowedMethods?: string[];
|
|
83
|
+
}
|
|
84
|
+
export interface BffEffectDataPlatformUserConfig {
|
|
85
|
+
enabled?: boolean;
|
|
86
|
+
requireEnvelope?: boolean;
|
|
87
|
+
envelopeHeader?: string;
|
|
88
|
+
expectedNamespace?: string;
|
|
89
|
+
validateOrigin?: boolean;
|
|
90
|
+
requireTraceContext?: boolean;
|
|
91
|
+
selection?: BffEffectDataPlatformSelectionUserConfig;
|
|
92
|
+
batch?: BffEffectDataPlatformBatchUserConfig;
|
|
93
|
+
}
|
|
94
|
+
export interface BffEffectUserConfig {
|
|
95
|
+
entry?: string;
|
|
96
|
+
openapi?: BffEffectOpenApiUserConfig;
|
|
97
|
+
dataPlatform?: BffEffectDataPlatformUserConfig;
|
|
98
|
+
}
|
|
99
|
+
export interface BffUserConfig {
|
|
100
|
+
prefix?: string | string[];
|
|
101
|
+
httpMethodDecider?: HttpMethodDecider;
|
|
102
|
+
enableHandleWeb?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Enables cross-project BFF SDK generation for producer apps.
|
|
105
|
+
*/
|
|
106
|
+
crossProject?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Internal marker injected by generated cross-project SDK plugins.
|
|
109
|
+
*/
|
|
110
|
+
isCrossProjectServer?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Logical producer ID forwarded to generated clients and runtime contracts.
|
|
113
|
+
*/
|
|
114
|
+
requestId?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Legacy request runtime import path. Internal/compatibility usage.
|
|
117
|
+
*/
|
|
118
|
+
runtimeCreateRequest?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Custom request creator import path for generated BFF clients.
|
|
121
|
+
*/
|
|
122
|
+
requestCreator?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Legacy custom fetcher import path for generated BFF clients.
|
|
125
|
+
*/
|
|
126
|
+
fetcher?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Selects the BFF runtime implementation.
|
|
129
|
+
*
|
|
130
|
+
* - `effect`: only `api/effect/index` is served.
|
|
131
|
+
* - `hono`: only `api/lambda/**` handlers are served.
|
|
132
|
+
*
|
|
133
|
+
* @default 'effect'
|
|
134
|
+
*/
|
|
135
|
+
runtimeFramework?: BffRuntimeFramework;
|
|
136
|
+
/**
|
|
137
|
+
* Effect runtime configuration. Only applies when `runtimeFramework: 'effect'`.
|
|
138
|
+
*/
|
|
139
|
+
effect?: BffEffectUserConfig;
|
|
140
|
+
crossProjectPolicy?: BffCrossProjectPolicyUserConfig;
|
|
141
|
+
}
|
|
142
|
+
export type BffNormalizedConfig = BffUserConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type CrossOrigin = 'anonymous' | 'use-credentials';
|
|
2
|
+
export type ScriptLoading = 'defer' | 'module' | 'blocking';
|
|
3
|
+
export interface HtmlUserConfig {
|
|
4
|
+
favicon?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Set the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) attribute
|
|
7
|
+
* of the `<script>` tag.
|
|
8
|
+
*/
|
|
9
|
+
crossorigin?: boolean | CrossOrigin;
|
|
10
|
+
/**
|
|
11
|
+
* Set the loading mode of the `<script>` tag.
|
|
12
|
+
*/
|
|
13
|
+
scriptLoading?: ScriptLoading;
|
|
14
|
+
}
|
|
15
|
+
export type HtmlNormalizedConfig = HtmlUserConfig;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BffNormalizedConfig, BffUserConfig } from './bff';
|
|
2
|
+
import type { DevNormalizedConfig, DevUserConfig } from './dev';
|
|
3
|
+
import type { HtmlNormalizedConfig, HtmlUserConfig } from './html';
|
|
4
|
+
import type { OutputNormalizedConfig, OutputUserConfig } from './output';
|
|
5
|
+
import type { SecurityNormalizedConfig, SecurityUserConfig } from './security';
|
|
6
|
+
import type { ServerNormalizedConfig, ServerUserConfig } from './server';
|
|
7
|
+
import type { SourceNormalizedConfig, SourceUserConfig } from './source';
|
|
8
|
+
import type { ToolsNormalizedConfig, ToolsUserConfig } from './tools';
|
|
9
|
+
export * from './bff';
|
|
10
|
+
export * from './html';
|
|
11
|
+
export * from './output';
|
|
12
|
+
export * from './server';
|
|
13
|
+
export * from './source';
|
|
14
|
+
export * from './tools';
|
|
15
|
+
export interface UserConfig {
|
|
16
|
+
output?: OutputUserConfig;
|
|
17
|
+
source?: SourceUserConfig;
|
|
18
|
+
tools?: ToolsUserConfig;
|
|
19
|
+
server?: ServerUserConfig;
|
|
20
|
+
html?: HtmlUserConfig;
|
|
21
|
+
bff?: BffUserConfig;
|
|
22
|
+
dev?: DevUserConfig;
|
|
23
|
+
security?: SecurityUserConfig;
|
|
24
|
+
}
|
|
25
|
+
export type ServerOptions = {
|
|
26
|
+
output: OutputNormalizedConfig;
|
|
27
|
+
source: SourceNormalizedConfig;
|
|
28
|
+
tools: ToolsNormalizedConfig;
|
|
29
|
+
server: ServerNormalizedConfig;
|
|
30
|
+
html: HtmlNormalizedConfig;
|
|
31
|
+
bff: BffNormalizedConfig;
|
|
32
|
+
dev?: DevNormalizedConfig;
|
|
33
|
+
security?: SecurityNormalizedConfig;
|
|
34
|
+
};
|
|
35
|
+
export type CliConfig = Required<UserConfig>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface OutputUserConfig {
|
|
2
|
+
distPath?: {
|
|
3
|
+
root?: string;
|
|
4
|
+
js?: string;
|
|
5
|
+
css?: string;
|
|
6
|
+
svg?: string;
|
|
7
|
+
font?: string;
|
|
8
|
+
html?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
media?: string;
|
|
11
|
+
server?: string;
|
|
12
|
+
};
|
|
13
|
+
enableInlineRouteManifests?: boolean;
|
|
14
|
+
disableInlineRouteManifests?: boolean;
|
|
15
|
+
assetPrefix?: string;
|
|
16
|
+
polyfill?: 'entry' | 'usage' | 'ua' | 'off';
|
|
17
|
+
inlineScripts?: boolean;
|
|
18
|
+
inlineStyles?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type OutputNormalizedConfig = OutputUserConfig;
|