@fluojs/runtime 1.0.0-beta.1 → 1.0.0-beta.11
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/README.ko.md +53 -11
- package/README.md +53 -11
- package/dist/adapters/request-response-factory.d.ts +9 -0
- package/dist/adapters/request-response-factory.d.ts.map +1 -1
- package/dist/adapters/request-response-factory.js +14 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +327 -60
- package/dist/health/diagnostics.d.ts +38 -0
- package/dist/health/diagnostics.d.ts.map +1 -1
- package/dist/health/diagnostics.js +48 -0
- package/dist/health/health.d.ts +34 -0
- package/dist/health/health.d.ts.map +1 -1
- package/dist/health/health.js +54 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/logging/json-logger.d.ts +5 -0
- package/dist/logging/json-logger.d.ts.map +1 -1
- package/dist/logging/json-logger.js +6 -0
- package/dist/logging/logger.d.ts +35 -1
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js +69 -5
- package/dist/module-graph.d.ts +16 -0
- package/dist/module-graph.d.ts.map +1 -1
- package/dist/module-graph.js +304 -8
- package/dist/node/internal-node-compression.d.ts +15 -0
- package/dist/node/internal-node-compression.d.ts.map +1 -1
- package/dist/node/internal-node-compression.js +16 -0
- package/dist/node/internal-node-request.d.ts +128 -0
- package/dist/node/internal-node-request.d.ts.map +1 -1
- package/dist/node/internal-node-request.js +321 -40
- package/dist/node/internal-node-response.d.ts +21 -1
- package/dist/node/internal-node-response.d.ts.map +1 -1
- package/dist/node/internal-node-response.js +42 -3
- package/dist/node/internal-node.d.ts +43 -6
- package/dist/node/internal-node.d.ts.map +1 -1
- package/dist/node/internal-node.js +65 -9
- package/dist/node/node-request.d.ts +1 -1
- package/dist/node/node-request.d.ts.map +1 -1
- package/dist/node/node-request.js +1 -1
- package/dist/platform-shell.d.ts +4 -0
- package/dist/platform-shell.d.ts.map +1 -1
- package/dist/platform-shell.js +72 -20
- package/dist/request-transaction.d.ts +28 -0
- package/dist/request-transaction.d.ts.map +1 -1
- package/dist/request-transaction.js +33 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/web.d.ts +9 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +207 -56
- package/package.json +6 -6
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { Scope } from '@fluojs/di';
|
|
2
2
|
import type { CompiledModule, ModuleType } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Describes the runtime diagnostics graph contract.
|
|
5
|
+
*/
|
|
3
6
|
export interface RuntimeDiagnosticsGraph {
|
|
4
7
|
version: 1;
|
|
5
8
|
rootModule: string;
|
|
6
9
|
modules: RuntimeDiagnosticsModule[];
|
|
7
10
|
relationships: RuntimeDiagnosticsRelationships;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Describes the runtime diagnostics module contract.
|
|
14
|
+
*/
|
|
9
15
|
export interface RuntimeDiagnosticsModule {
|
|
10
16
|
name: string;
|
|
11
17
|
global: boolean;
|
|
@@ -14,12 +20,18 @@ export interface RuntimeDiagnosticsModule {
|
|
|
14
20
|
providers: RuntimeDiagnosticsProvider[];
|
|
15
21
|
exports: string[];
|
|
16
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Describes the runtime diagnostics provider contract.
|
|
25
|
+
*/
|
|
17
26
|
export interface RuntimeDiagnosticsProvider {
|
|
18
27
|
token: string;
|
|
19
28
|
type: 'class' | 'factory' | 'value' | 'existing';
|
|
20
29
|
scope: Scope;
|
|
21
30
|
multi: boolean;
|
|
22
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Describes the runtime diagnostics relationships contract.
|
|
34
|
+
*/
|
|
23
35
|
export interface RuntimeDiagnosticsRelationships {
|
|
24
36
|
moduleImports: Array<{
|
|
25
37
|
from: string;
|
|
@@ -41,16 +53,42 @@ export interface RuntimeDiagnosticsRelationships {
|
|
|
41
53
|
module: string;
|
|
42
54
|
}>;
|
|
43
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Describes the bootstrap timing phase contract.
|
|
58
|
+
*/
|
|
44
59
|
export interface BootstrapTimingPhase {
|
|
45
60
|
durationMs: number;
|
|
46
61
|
name: 'bootstrap_module' | 'register_runtime_tokens' | 'resolve_lifecycle_instances' | 'run_bootstrap_lifecycle' | 'create_dispatcher';
|
|
47
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Describes the bootstrap timing diagnostics contract.
|
|
65
|
+
*/
|
|
48
66
|
export interface BootstrapTimingDiagnostics {
|
|
49
67
|
phases: BootstrapTimingPhase[];
|
|
50
68
|
totalMs: number;
|
|
51
69
|
version: 1;
|
|
52
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Create runtime diagnostics graph.
|
|
73
|
+
*
|
|
74
|
+
* @param modules The modules.
|
|
75
|
+
* @param rootModule The root module.
|
|
76
|
+
* @returns The create runtime diagnostics graph result.
|
|
77
|
+
*/
|
|
53
78
|
export declare function createRuntimeDiagnosticsGraph(modules: readonly CompiledModule[], rootModule: ModuleType): RuntimeDiagnosticsGraph;
|
|
79
|
+
/**
|
|
80
|
+
* Render runtime diagnostics mermaid.
|
|
81
|
+
*
|
|
82
|
+
* @param graph The graph.
|
|
83
|
+
* @returns The render runtime diagnostics mermaid result.
|
|
84
|
+
*/
|
|
54
85
|
export declare function renderRuntimeDiagnosticsMermaid(graph: RuntimeDiagnosticsGraph): string;
|
|
86
|
+
/**
|
|
87
|
+
* Create bootstrap timing diagnostics.
|
|
88
|
+
*
|
|
89
|
+
* @param phases The phases.
|
|
90
|
+
* @param totalMs The total ms.
|
|
91
|
+
* @returns The create bootstrap timing diagnostics result.
|
|
92
|
+
*/
|
|
55
93
|
export declare function createBootstrapTimingDiagnostics(phases: BootstrapTimingPhase[], totalMs: number): BootstrapTimingDiagnostics;
|
|
56
94
|
//# sourceMappingURL=diagnostics.d.ts.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A6B,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,uBAAuB,CAkEjI;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAoCtF;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,oBAAoB,EAAE,EAC9B,OAAO,EAAE,MAAM,GACd,0BAA0B,CAS5B"}
|
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
import { getClassDiMetadata } from '@fluojs/core/internal';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes the runtime diagnostics graph contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Describes the runtime diagnostics module contract.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Describes the runtime diagnostics provider contract.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Describes the runtime diagnostics relationships contract.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Describes the bootstrap timing phase contract.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Describes the bootstrap timing diagnostics contract.
|
|
25
|
+
*/
|
|
26
|
+
|
|
2
27
|
function roundMs(value) {
|
|
3
28
|
return Number(value.toFixed(3));
|
|
4
29
|
}
|
|
@@ -59,6 +84,14 @@ function normalizeProvider(provider) {
|
|
|
59
84
|
type: providerShape(provider)
|
|
60
85
|
};
|
|
61
86
|
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Create runtime diagnostics graph.
|
|
90
|
+
*
|
|
91
|
+
* @param modules The modules.
|
|
92
|
+
* @param rootModule The root module.
|
|
93
|
+
* @returns The create runtime diagnostics graph result.
|
|
94
|
+
*/
|
|
62
95
|
export function createRuntimeDiagnosticsGraph(modules, rootModule) {
|
|
63
96
|
const moduleDiagnostics = [];
|
|
64
97
|
const moduleImports = [];
|
|
@@ -119,6 +152,13 @@ export function createRuntimeDiagnosticsGraph(modules, rootModule) {
|
|
|
119
152
|
version: 1
|
|
120
153
|
};
|
|
121
154
|
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Render runtime diagnostics mermaid.
|
|
158
|
+
*
|
|
159
|
+
* @param graph The graph.
|
|
160
|
+
* @returns The render runtime diagnostics mermaid result.
|
|
161
|
+
*/
|
|
122
162
|
export function renderRuntimeDiagnosticsMermaid(graph) {
|
|
123
163
|
const lines = ['graph TD'];
|
|
124
164
|
const nodeByModule = new Map();
|
|
@@ -143,6 +183,14 @@ export function renderRuntimeDiagnosticsMermaid(graph) {
|
|
|
143
183
|
}
|
|
144
184
|
return lines.join('\n');
|
|
145
185
|
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Create bootstrap timing diagnostics.
|
|
189
|
+
*
|
|
190
|
+
* @param phases The phases.
|
|
191
|
+
* @param totalMs The total ms.
|
|
192
|
+
* @returns The create bootstrap timing diagnostics result.
|
|
193
|
+
*/
|
|
146
194
|
export function createBootstrapTimingDiagnostics(phases, totalMs) {
|
|
147
195
|
return {
|
|
148
196
|
phases: phases.map(phase => ({
|
package/dist/health/health.d.ts
CHANGED
|
@@ -1,18 +1,52 @@
|
|
|
1
1
|
import type { ModuleType } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Describes the health status contract.
|
|
4
|
+
*/
|
|
2
5
|
export interface HealthStatus {
|
|
3
6
|
status: 'ok' | 'unavailable';
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Describes the health check response contract.
|
|
10
|
+
*/
|
|
5
11
|
export interface HealthCheckResponse {
|
|
6
12
|
body: unknown;
|
|
7
13
|
statusCode?: number;
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Describes the readiness status contract.
|
|
17
|
+
*/
|
|
9
18
|
export interface ReadinessStatus {
|
|
10
19
|
status: 'ready' | 'starting' | 'unavailable';
|
|
11
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Describes the health module options contract.
|
|
23
|
+
*/
|
|
12
24
|
export interface HealthModuleOptions {
|
|
13
25
|
healthCheck?: (ctx: import('@fluojs/http').RequestContext) => HealthStatus | HealthCheckResponse | Promise<HealthStatus | HealthCheckResponse>;
|
|
14
26
|
path?: string;
|
|
15
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Defines the readiness check type.
|
|
30
|
+
*/
|
|
16
31
|
export type ReadinessCheck = () => boolean | Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Runtime health module facade for application module imports.
|
|
34
|
+
*/
|
|
35
|
+
export declare class HealthModule {
|
|
36
|
+
/**
|
|
37
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
38
|
+
*
|
|
39
|
+
* @param options Runtime health endpoint options.
|
|
40
|
+
* @returns A module class that can be imported into an application module.
|
|
41
|
+
*/
|
|
42
|
+
static forRoot(options?: HealthModuleOptions): ModuleType;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
46
|
+
*
|
|
47
|
+
* @deprecated Prefer `HealthModule.forRoot(...)` for application-facing module registration.
|
|
48
|
+
* @param options Runtime health endpoint options.
|
|
49
|
+
* @returns A module class that can be imported into an application module.
|
|
50
|
+
*/
|
|
17
51
|
export declare function createHealthModule(options?: HealthModuleOptions): ModuleType;
|
|
18
52
|
//# sourceMappingURL=health.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/health/health.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,GAAG,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAA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AC,OAAO,GAAE,mBAAwB,GAAG,UAAU;CAG9D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CAEhF"}
|
package/dist/health/health.js
CHANGED
|
@@ -5,7 +5,28 @@ function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.descrip
|
|
|
5
5
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
6
6
|
import { Controller, Get } from '@fluojs/http';
|
|
7
7
|
import { defineModule } from '../bootstrap.js';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Describes the health status contract.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Describes the health check response contract.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Describes the readiness status contract.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Describes the health module options contract.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Defines the readiness check type.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function createRuntimeHealthModule(options = {}) {
|
|
9
30
|
let _initProto, _initClass;
|
|
10
31
|
const basePath = options.path ?? '';
|
|
11
32
|
const readinessChecks = [];
|
|
@@ -64,7 +85,7 @@ export function createHealthModule(options = {}) {
|
|
|
64
85
|
_initClass();
|
|
65
86
|
}
|
|
66
87
|
}
|
|
67
|
-
class
|
|
88
|
+
class RuntimeHealthModule {
|
|
68
89
|
static addReadinessCheck(fn) {
|
|
69
90
|
readinessChecks.push(fn);
|
|
70
91
|
}
|
|
@@ -75,8 +96,37 @@ export function createHealthModule(options = {}) {
|
|
|
75
96
|
ready = false;
|
|
76
97
|
}
|
|
77
98
|
}
|
|
78
|
-
|
|
99
|
+
Object.defineProperty(RuntimeHealthModule, 'name', {
|
|
100
|
+
value: 'HealthModule'
|
|
101
|
+
});
|
|
102
|
+
defineModule(RuntimeHealthModule, {
|
|
79
103
|
controllers: [_HealthController]
|
|
80
104
|
});
|
|
81
|
-
return
|
|
105
|
+
return RuntimeHealthModule;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Runtime health module facade for application module imports.
|
|
110
|
+
*/
|
|
111
|
+
export class HealthModule {
|
|
112
|
+
/**
|
|
113
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
114
|
+
*
|
|
115
|
+
* @param options Runtime health endpoint options.
|
|
116
|
+
* @returns A module class that can be imported into an application module.
|
|
117
|
+
*/
|
|
118
|
+
static forRoot(options = {}) {
|
|
119
|
+
return createRuntimeHealthModule(options);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Creates a runtime-owned `/health` and `/ready` module.
|
|
125
|
+
*
|
|
126
|
+
* @deprecated Prefer `HealthModule.forRoot(...)` for application-facing module registration.
|
|
127
|
+
* @param options Runtime health endpoint options.
|
|
128
|
+
* @returns A module class that can be imported into an application module.
|
|
129
|
+
*/
|
|
130
|
+
export function createHealthModule(options = {}) {
|
|
131
|
+
return HealthModule.forRoot(options);
|
|
82
132
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './abort.js';
|
|
2
2
|
export * from './bootstrap.js';
|
|
3
|
-
export
|
|
3
|
+
export { createBootstrapTimingDiagnostics, createRuntimeDiagnosticsGraph, } from './health/diagnostics.js';
|
|
4
|
+
export type { BootstrapTimingDiagnostics, BootstrapTimingPhase, RuntimeDiagnosticsGraph, RuntimeDiagnosticsModule, RuntimeDiagnosticsProvider, RuntimeDiagnosticsRelationships, } from './health/diagnostics.js';
|
|
4
5
|
export * from './errors.js';
|
|
5
6
|
export * from './health/health.js';
|
|
6
7
|
export type { MultipartOptions, MultipartRequestLike, MultipartResult, UploadedFile, } from './multipart.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,gCAAgC,EAChC,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,iCAAiC,EACjC,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './abort.js';
|
|
2
2
|
export * from './bootstrap.js';
|
|
3
|
-
export
|
|
3
|
+
export { createBootstrapTimingDiagnostics, createRuntimeDiagnosticsGraph } from './health/diagnostics.js';
|
|
4
4
|
export * from './errors.js';
|
|
5
5
|
export * from './health/health.js';
|
|
6
6
|
export * from './request-transaction.js';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { ApplicationLogger } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create json application logger.
|
|
4
|
+
*
|
|
5
|
+
* @returns The create json application logger result.
|
|
6
|
+
*/
|
|
2
7
|
export declare function createJsonApplicationLogger(): ApplicationLogger;
|
|
3
8
|
//# sourceMappingURL=json-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-logger.d.ts","sourceRoot":"","sources":["../../src/logging/json-logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAqCrD,wBAAgB,2BAA2B,IAAI,iBAAiB,CAe/D"}
|
|
1
|
+
{"version":3,"file":"json-logger.d.ts","sourceRoot":"","sources":["../../src/logging/json-logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAqCrD;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,iBAAiB,CAe/D"}
|
|
@@ -21,6 +21,12 @@ function buildEntry(level, message, context, error) {
|
|
|
21
21
|
}
|
|
22
22
|
return entry;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Create json application logger.
|
|
27
|
+
*
|
|
28
|
+
* @returns The create json application logger result.
|
|
29
|
+
*/
|
|
24
30
|
export function createJsonApplicationLogger() {
|
|
25
31
|
return {
|
|
26
32
|
debug(message, context) {
|
package/dist/logging/logger.d.ts
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
1
|
import type { ApplicationLogger } from '../types.js';
|
|
2
|
-
|
|
2
|
+
/** Severity threshold accepted by `createConsoleApplicationLogger(...)`. */
|
|
3
|
+
export type ConsoleApplicationLoggerLevel = 'debug' | 'error' | 'log' | 'warn';
|
|
4
|
+
/** Console formatting mode accepted by `createConsoleApplicationLogger(...)`. */
|
|
5
|
+
export type ConsoleApplicationLoggerMode = 'minimal' | 'pretty' | 'silent';
|
|
6
|
+
/** Options used to tune the Node console logger without replacing the runtime logger contract. */
|
|
7
|
+
export interface ConsoleApplicationLoggerOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Controls console formatting.
|
|
10
|
+
*
|
|
11
|
+
* - `pretty` keeps the historical timestamp, pid, level, context, and message format.
|
|
12
|
+
* - `minimal` writes only `[fluo] LEVEL [context] message`.
|
|
13
|
+
* - `silent` suppresses all logger methods.
|
|
14
|
+
*/
|
|
15
|
+
mode?: ConsoleApplicationLoggerMode;
|
|
16
|
+
/** Lowest severity emitted by the logger. Defaults to `debug`, preserving existing output. */
|
|
17
|
+
level?: ConsoleApplicationLoggerLevel;
|
|
18
|
+
/** Override TTY-aware ANSI color detection. */
|
|
19
|
+
color?: boolean;
|
|
20
|
+
/** Explicit host color environment passed from the application/bootstrap boundary. */
|
|
21
|
+
environment?: ConsoleApplicationLoggerEnvironment;
|
|
22
|
+
}
|
|
23
|
+
/** Host color environment used by `createConsoleApplicationLogger(...)` without reading globals directly. */
|
|
24
|
+
export interface ConsoleApplicationLoggerEnvironment {
|
|
25
|
+
/** Whether `NO_COLOR`-style color suppression is enabled. */
|
|
26
|
+
noColor?: boolean;
|
|
27
|
+
/** `FORCE_COLOR`-style value used to force ANSI color output when truthy. */
|
|
28
|
+
forceColor?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create console application logger.
|
|
32
|
+
*
|
|
33
|
+
* @param options Console logger mode, severity threshold, and color override.
|
|
34
|
+
* @returns The create console application logger result.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createConsoleApplicationLogger(options?: ConsoleApplicationLoggerOptions): ApplicationLogger;
|
|
3
37
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logging/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logging/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,4EAA4E;AAC5E,MAAM,MAAM,6BAA6B,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAC/E,iFAAiF;AACjF,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3E,kGAAkG;AAClG,MAAM,WAAW,+BAA+B;IAC9C;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,4BAA4B,CAAC;IACpC,8FAA8F;IAC9F,KAAK,CAAC,EAAE,6BAA6B,CAAC;IACtC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sFAAsF;IACtF,WAAW,CAAC,EAAE,mCAAmC,CAAC;CACnD;AAED,6GAA6G;AAC7G,MAAM,WAAW,mCAAmC;IAClD,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA2DD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,+BAAoC,GAAG,iBAAiB,CA2C/G"}
|
package/dist/logging/logger.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
+
/** Severity threshold accepted by `createConsoleApplicationLogger(...)`. */
|
|
2
|
+
|
|
3
|
+
/** Console formatting mode accepted by `createConsoleApplicationLogger(...)`. */
|
|
4
|
+
|
|
5
|
+
/** Options used to tune the Node console logger without replacing the runtime logger contract. */
|
|
6
|
+
|
|
7
|
+
/** Host color environment used by `createConsoleApplicationLogger(...)` without reading globals directly. */
|
|
8
|
+
|
|
1
9
|
const RESET = '\u001B[0m';
|
|
2
10
|
const BRIGHT_GREEN = '\u001B[32m';
|
|
3
11
|
const BRIGHT_RED = '\u001B[31m';
|
|
4
12
|
const BRIGHT_YELLOW = '\u001B[33m';
|
|
5
13
|
const DIM = '\u001B[2m';
|
|
14
|
+
const LEVEL_PRIORITY = {
|
|
15
|
+
debug: 10,
|
|
16
|
+
log: 20,
|
|
17
|
+
warn: 30,
|
|
18
|
+
error: 40
|
|
19
|
+
};
|
|
6
20
|
function colorize(value, color, enabled) {
|
|
7
21
|
return enabled ? `${color}${value}${RESET}` : value;
|
|
8
22
|
}
|
|
@@ -15,22 +29,72 @@ function formatLog(level, context, message, color) {
|
|
|
15
29
|
const contextLabel = colorize(`[${context}]`, BRIGHT_YELLOW, color);
|
|
16
30
|
return `${prefix} ${pid} - ${timestamp} ${levelLabel} ${contextLabel} ${message}`;
|
|
17
31
|
}
|
|
18
|
-
|
|
32
|
+
function formatMinimalLog(level, context, message, color) {
|
|
33
|
+
const prefix = colorize('[fluo]', BRIGHT_GREEN, color);
|
|
34
|
+
const levelColor = level === 'ERROR' || level === 'WARN' ? BRIGHT_RED : BRIGHT_GREEN;
|
|
35
|
+
const levelLabel = colorize(level, levelColor, color);
|
|
36
|
+
const contextLabel = colorize(`[${context}]`, BRIGHT_YELLOW, color);
|
|
37
|
+
return `${prefix} ${levelLabel} ${contextLabel} ${message}`;
|
|
38
|
+
}
|
|
39
|
+
function shouldLog(currentLevel, configuredLevel) {
|
|
40
|
+
return LEVEL_PRIORITY[currentLevel] >= LEVEL_PRIORITY[configuredLevel];
|
|
41
|
+
}
|
|
42
|
+
function isForceColorEnabled(value) {
|
|
43
|
+
return value !== undefined && value !== '' && value !== '0' && value !== 'false' && value !== 'no' && value !== 'off';
|
|
44
|
+
}
|
|
45
|
+
function shouldUseColor(stream, environment) {
|
|
46
|
+
if (environment.noColor === true) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (isForceColorEnabled(environment.forceColor)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return Boolean(stream.isTTY);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Create console application logger.
|
|
57
|
+
*
|
|
58
|
+
* @param options Console logger mode, severity threshold, and color override.
|
|
59
|
+
* @returns The create console application logger result.
|
|
60
|
+
*/
|
|
61
|
+
export function createConsoleApplicationLogger(options = {}) {
|
|
62
|
+
const mode = options.mode ?? 'pretty';
|
|
63
|
+
const level = options.level ?? 'debug';
|
|
64
|
+
const environment = options.environment ?? {};
|
|
65
|
+
const format = mode === 'minimal' ? formatMinimalLog : formatLog;
|
|
66
|
+
if (mode === 'silent') {
|
|
67
|
+
return {
|
|
68
|
+
debug() {},
|
|
69
|
+
error() {},
|
|
70
|
+
log() {},
|
|
71
|
+
warn() {}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
19
74
|
return {
|
|
20
75
|
debug(message, context = 'fluo') {
|
|
21
|
-
|
|
76
|
+
if (shouldLog('debug', level)) {
|
|
77
|
+
console.debug(format('DEBUG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
|
|
78
|
+
}
|
|
22
79
|
},
|
|
23
80
|
error(message, error, context = 'fluo') {
|
|
24
|
-
|
|
81
|
+
if (!shouldLog('error', level)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.error(format('ERROR', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
|
|
25
85
|
if (error) {
|
|
26
86
|
console.error(error);
|
|
27
87
|
}
|
|
28
88
|
},
|
|
29
89
|
log(message, context = 'fluo') {
|
|
30
|
-
|
|
90
|
+
if (shouldLog('log', level)) {
|
|
91
|
+
console.log(format('LOG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
|
|
92
|
+
}
|
|
31
93
|
},
|
|
32
94
|
warn(message, context = 'fluo') {
|
|
33
|
-
|
|
95
|
+
if (shouldLog('warn', level)) {
|
|
96
|
+
console.warn(format('WARN', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
|
|
97
|
+
}
|
|
34
98
|
}
|
|
35
99
|
};
|
|
36
100
|
}
|
package/dist/module-graph.d.ts
CHANGED
|
@@ -8,6 +8,22 @@ import type { BootstrapModuleOptions, CompiledModule, ModuleType } from './types
|
|
|
8
8
|
* @returns The token that should be registered and resolved for the provider.
|
|
9
9
|
*/
|
|
10
10
|
export declare function providerToken(provider: Provider): Token;
|
|
11
|
+
/** Clears the process-local module graph compile cache for isolated regression tests. */
|
|
12
|
+
export declare function clearModuleGraphCompileCacheForTesting(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Reads the current process-local module graph compile cache size for tests.
|
|
15
|
+
*
|
|
16
|
+
* @returns Number of successful compile snapshots currently retained in the cache.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getModuleGraphCompileCacheSizeForTesting(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Builds the key used for opt-in module graph compile caching.
|
|
21
|
+
*
|
|
22
|
+
* @param rootModule Root module that would be compiled.
|
|
23
|
+
* @param options Bootstrap options that influence graph validation.
|
|
24
|
+
* @returns Process-local key that changes when metadata or runtime validation inputs change.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createModuleGraphCacheKey(rootModule: ModuleType, options?: BootstrapModuleOptions): string;
|
|
11
27
|
/**
|
|
12
28
|
* Collects runtime provider tokens into a set for visibility and validation checks.
|
|
13
29
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAW1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAoB,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAMvD;AAiBD,yFAAyF;AACzF,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,wCAAwC,IAAI,MAAM,CAEjE;AAgFD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAY9G;AAiRD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,GAAE,QAAQ,EAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAE5E;AA8UD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,cAAc,EAAE,CA4BjH"}
|