@fluojs/runtime 1.0.0-beta.8 → 1.0.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/README.ko.md +38 -13
- package/README.md +38 -13
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +204 -35
- package/dist/health/diagnostics.d.ts.map +1 -1
- package/dist/health/diagnostics.js +4 -4
- package/dist/health/health.d.ts +17 -4
- package/dist/health/health.d.ts.map +1 -1
- package/dist/health/health.js +34 -11
- package/dist/http-adapter-shared.d.ts.map +1 -1
- package/dist/http-adapter-shared.js +31 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/core-metadata.d.ts +84 -0
- package/dist/internal/core-metadata.d.ts.map +1 -0
- package/dist/internal/core-metadata.js +83 -0
- package/dist/internal/http-runtime.d.ts +5 -0
- package/dist/internal/http-runtime.d.ts.map +1 -0
- package/dist/internal/http-runtime.js +4 -0
- package/dist/internal.d.ts +2 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/logging/logger.d.ts +30 -1
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js +63 -5
- package/dist/module-graph.d.ts +17 -1
- package/dist/module-graph.d.ts.map +1 -1
- package/dist/module-graph.js +290 -4
- package/dist/tokens.d.ts +12 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +11 -1
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/web.js +3 -3
- package/package.json +6 -6
|
@@ -106,15 +106,42 @@ export async function runHttpAdapterApplication(rootModule, options, adapter) {
|
|
|
106
106
|
}
|
|
107
107
|
throw error;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
let unregisterShutdownSignals;
|
|
110
|
+
try {
|
|
111
|
+
unregisterShutdownSignals = options.shutdownRegistration?.(app, logger, options.forceExitTimeoutMs) ?? (() => {});
|
|
112
|
+
} catch (error) {
|
|
113
|
+
logger.error('Failed to register shutdown signals.', error, 'FluoFactory');
|
|
114
|
+
try {
|
|
115
|
+
await app.close('bootstrap-failed');
|
|
116
|
+
} catch (closeError) {
|
|
117
|
+
logger.error('Failed to close application after shutdown registration failure.', closeError, 'FluoFactory');
|
|
118
|
+
}
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
110
121
|
const close = app.close.bind(app);
|
|
111
122
|
let shutdownSignalsUnregistered = false;
|
|
112
123
|
app.close = async signal => {
|
|
124
|
+
let unregisterError;
|
|
113
125
|
if (!shutdownSignalsUnregistered) {
|
|
114
|
-
|
|
115
|
-
|
|
126
|
+
try {
|
|
127
|
+
unregisterShutdownSignals();
|
|
128
|
+
} catch (error) {
|
|
129
|
+
unregisterError = error;
|
|
130
|
+
} finally {
|
|
131
|
+
shutdownSignalsUnregistered = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
await close(signal);
|
|
136
|
+
} catch (closeError) {
|
|
137
|
+
if (unregisterError) {
|
|
138
|
+
throw new AggregateError([unregisterError, closeError], 'Application close failed during shutdown signal cleanup.');
|
|
139
|
+
}
|
|
140
|
+
throw closeError;
|
|
141
|
+
}
|
|
142
|
+
if (unregisterError) {
|
|
143
|
+
throw unregisterError;
|
|
116
144
|
}
|
|
117
|
-
await close(signal);
|
|
118
145
|
};
|
|
119
146
|
return app;
|
|
120
147
|
}
|
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';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { InjectionToken, Token } from '@fluojs/core';
|
|
2
|
+
import type { Scope } from '@fluojs/di';
|
|
3
|
+
import type { ModuleDefinition } from '../types.js';
|
|
4
|
+
/** Runtime-local view of DI forward references consumed by module graph compilation. */
|
|
5
|
+
export type RuntimeForwardRef = {
|
|
6
|
+
__forwardRef__: true;
|
|
7
|
+
forwardRef: () => Token;
|
|
8
|
+
};
|
|
9
|
+
/** Runtime-local view of optional DI tokens consumed by module graph compilation. */
|
|
10
|
+
export type RuntimeOptionalToken = {
|
|
11
|
+
__optional__: true;
|
|
12
|
+
token: Token;
|
|
13
|
+
};
|
|
14
|
+
/** Runtime-local union for DI dependency metadata consumed by module graph compilation. */
|
|
15
|
+
export type RuntimeInjectionToken = Token | RuntimeForwardRef | RuntimeOptionalToken;
|
|
16
|
+
/** Runtime-local class DI metadata view used for provider scope and dependency validation. */
|
|
17
|
+
export interface RuntimeClassDiMetadata {
|
|
18
|
+
inject?: readonly RuntimeInjectionToken[];
|
|
19
|
+
scope?: Scope;
|
|
20
|
+
}
|
|
21
|
+
/** Runtime-local writable class DI metadata shape used by explicit metadata-version tests. */
|
|
22
|
+
export interface RuntimeWritableClassDiMetadata {
|
|
23
|
+
inject?: InjectionToken[];
|
|
24
|
+
scope?: Scope;
|
|
25
|
+
}
|
|
26
|
+
/** Runtime-local module metadata view used while compiling application module graphs. */
|
|
27
|
+
export type RuntimeModuleMetadata = Pick<ModuleDefinition, 'controllers' | 'exports' | 'global' | 'imports' | 'middleware' | 'providers'>;
|
|
28
|
+
/** Runtime-local writable module metadata shape used by decorators, tests, and dynamic module normalization. */
|
|
29
|
+
export interface RuntimeWritableModuleMetadata {
|
|
30
|
+
controllers?: unknown[];
|
|
31
|
+
exports?: unknown[];
|
|
32
|
+
global?: boolean;
|
|
33
|
+
imports?: unknown[];
|
|
34
|
+
middleware?: unknown[];
|
|
35
|
+
providers?: unknown[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Writes runtime-visible module metadata through the runtime-owned core metadata seam.
|
|
39
|
+
*
|
|
40
|
+
* @param target Module constructor that should receive the metadata snapshot.
|
|
41
|
+
* @param metadata Module metadata used by decorators, tests, or dynamic module normalization.
|
|
42
|
+
*/
|
|
43
|
+
export declare function defineRuntimeModuleMetadata(target: Function, metadata: RuntimeWritableModuleMetadata): void;
|
|
44
|
+
/**
|
|
45
|
+
* Writes runtime-visible class DI metadata through the runtime-owned core metadata seam.
|
|
46
|
+
*
|
|
47
|
+
* @param target Class constructor that should receive DI metadata.
|
|
48
|
+
* @param metadata DI metadata used by explicit runtime metadata-version tests.
|
|
49
|
+
*/
|
|
50
|
+
export declare function defineRuntimeClassDiMetadata(target: Function, metadata: RuntimeWritableClassDiMetadata): void;
|
|
51
|
+
/**
|
|
52
|
+
* Reads runtime-visible class DI metadata without spreading peer internal imports.
|
|
53
|
+
*
|
|
54
|
+
* @param target Class constructor whose effective DI metadata should be read.
|
|
55
|
+
* @returns The effective class DI metadata when present.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getRuntimeClassDiMetadata(target: Function): RuntimeClassDiMetadata | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Reads own runtime-visible class DI metadata without inherited metadata fallback.
|
|
60
|
+
*
|
|
61
|
+
* @param target Class constructor whose own DI metadata should be read.
|
|
62
|
+
* @returns The own class DI metadata when present.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getOwnRuntimeClassDiMetadata(target: Function): RuntimeClassDiMetadata | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Reads the current module metadata version for runtime compile-cache keys.
|
|
67
|
+
*
|
|
68
|
+
* @returns Monotonic module metadata version maintained by the core metadata store.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getRuntimeModuleMetadataVersion(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Reads the current class DI metadata version for runtime compile-cache keys.
|
|
73
|
+
*
|
|
74
|
+
* @returns Monotonic class DI metadata version maintained by the core metadata store.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getRuntimeClassDiMetadataVersion(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Reads runtime-visible module metadata during graph compilation.
|
|
79
|
+
*
|
|
80
|
+
* @param target Module constructor whose metadata should be read.
|
|
81
|
+
* @returns Module metadata normalized by the core metadata store.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getRuntimeModuleMetadata(target: Function): RuntimeModuleMetadata;
|
|
84
|
+
//# sourceMappingURL=core-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-metadata.d.ts","sourceRoot":"","sources":["../../src/internal/core-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAU1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wFAAwF;AACxF,MAAM,MAAM,iBAAiB,GAAG;IAAE,cAAc,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,KAAK,CAAA;CAAE,CAAC;AAClF,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAAG;IAAE,YAAY,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AACxE,2FAA2F;AAC3F,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAErF,8FAA8F;AAC9F,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,8FAA8F;AAC9F,MAAM,WAAW,8BAA8B;IAC7C,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,gBAAgB,EAChB,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAC9E,CAAC;AAEF,gHAAgH;AAChH,MAAM,WAAW,6BAA6B;IAC5C,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,6BAA6B,GAAG,IAAI,CAE3G;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,8BAA8B,GAAG,IAAI,CAE7G;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,GAAG,sBAAsB,GAAG,SAAS,CAE9F;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,QAAQ,GAAG,sBAAsB,GAAG,SAAS,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,QAAQ,GAAG,qBAAqB,CAEhF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineClassDiMetadata as definePeerClassDiMetadata, defineModuleMetadata as definePeerModuleMetadata, getClassDiMetadata as getPeerClassDiMetadata, getClassDiMetadataVersion as getPeerClassDiMetadataVersion, getModuleMetadata as getPeerModuleMetadata, getModuleMetadataVersion as getPeerModuleMetadataVersion, getOwnClassDiMetadata as getPeerOwnClassDiMetadata } from '@fluojs/core/internal';
|
|
2
|
+
|
|
3
|
+
/** Runtime-local view of DI forward references consumed by module graph compilation. */
|
|
4
|
+
|
|
5
|
+
/** Runtime-local view of optional DI tokens consumed by module graph compilation. */
|
|
6
|
+
|
|
7
|
+
/** Runtime-local union for DI dependency metadata consumed by module graph compilation. */
|
|
8
|
+
|
|
9
|
+
/** Runtime-local class DI metadata view used for provider scope and dependency validation. */
|
|
10
|
+
|
|
11
|
+
/** Runtime-local writable class DI metadata shape used by explicit metadata-version tests. */
|
|
12
|
+
|
|
13
|
+
/** Runtime-local module metadata view used while compiling application module graphs. */
|
|
14
|
+
|
|
15
|
+
/** Runtime-local writable module metadata shape used by decorators, tests, and dynamic module normalization. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Writes runtime-visible module metadata through the runtime-owned core metadata seam.
|
|
19
|
+
*
|
|
20
|
+
* @param target Module constructor that should receive the metadata snapshot.
|
|
21
|
+
* @param metadata Module metadata used by decorators, tests, or dynamic module normalization.
|
|
22
|
+
*/
|
|
23
|
+
export function defineRuntimeModuleMetadata(target, metadata) {
|
|
24
|
+
definePeerModuleMetadata(target, metadata);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Writes runtime-visible class DI metadata through the runtime-owned core metadata seam.
|
|
29
|
+
*
|
|
30
|
+
* @param target Class constructor that should receive DI metadata.
|
|
31
|
+
* @param metadata DI metadata used by explicit runtime metadata-version tests.
|
|
32
|
+
*/
|
|
33
|
+
export function defineRuntimeClassDiMetadata(target, metadata) {
|
|
34
|
+
definePeerClassDiMetadata(target, metadata);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Reads runtime-visible class DI metadata without spreading peer internal imports.
|
|
39
|
+
*
|
|
40
|
+
* @param target Class constructor whose effective DI metadata should be read.
|
|
41
|
+
* @returns The effective class DI metadata when present.
|
|
42
|
+
*/
|
|
43
|
+
export function getRuntimeClassDiMetadata(target) {
|
|
44
|
+
return getPeerClassDiMetadata(target);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Reads own runtime-visible class DI metadata without inherited metadata fallback.
|
|
49
|
+
*
|
|
50
|
+
* @param target Class constructor whose own DI metadata should be read.
|
|
51
|
+
* @returns The own class DI metadata when present.
|
|
52
|
+
*/
|
|
53
|
+
export function getOwnRuntimeClassDiMetadata(target) {
|
|
54
|
+
return getPeerOwnClassDiMetadata(target);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Reads the current module metadata version for runtime compile-cache keys.
|
|
59
|
+
*
|
|
60
|
+
* @returns Monotonic module metadata version maintained by the core metadata store.
|
|
61
|
+
*/
|
|
62
|
+
export function getRuntimeModuleMetadataVersion() {
|
|
63
|
+
return getPeerModuleMetadataVersion();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Reads the current class DI metadata version for runtime compile-cache keys.
|
|
68
|
+
*
|
|
69
|
+
* @returns Monotonic class DI metadata version maintained by the core metadata store.
|
|
70
|
+
*/
|
|
71
|
+
export function getRuntimeClassDiMetadataVersion() {
|
|
72
|
+
return getPeerClassDiMetadataVersion();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Reads runtime-visible module metadata during graph compilation.
|
|
77
|
+
*
|
|
78
|
+
* @param target Module constructor whose metadata should be read.
|
|
79
|
+
* @returns Module metadata normalized by the core metadata store.
|
|
80
|
+
*/
|
|
81
|
+
export function getRuntimeModuleMetadata(target) {
|
|
82
|
+
return getPeerModuleMetadata(target);
|
|
83
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DefaultBinder } from '@fluojs/http/internal';
|
|
2
|
+
import { attachFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff } from '@fluojs/http/internal';
|
|
3
|
+
export { DefaultBinder as RuntimeDefaultBinder };
|
|
4
|
+
export { attachFrameworkRequestNativeRouteHandoff as attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff as consumeRuntimeRawRequestNativeRouteHandoff, };
|
|
5
|
+
//# sourceMappingURL=http-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-runtime.d.ts","sourceRoot":"","sources":["../../src/internal/http-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,wCAAwC,EACxC,mCAAmC,EACpC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,CAAC;AACjD,OAAO,EACL,wCAAwC,IAAI,+CAA+C,EAC3F,mCAAmC,IAAI,0CAA0C,GAClF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DefaultBinder } from '@fluojs/http/internal';
|
|
2
|
+
import { attachFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff } from '@fluojs/http/internal';
|
|
3
|
+
export { DefaultBinder as RuntimeDefaultBinder };
|
|
4
|
+
export { attachFrameworkRequestNativeRouteHandoff as attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff as consumeRuntimeRawRequestNativeRouteHandoff };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, } from './tokens.js';
|
|
1
|
+
export { APPLICATION_LOGGER, BOOTSTRAP_READY_SIGNAL, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION, } from './tokens.js';
|
|
2
|
+
export type { BootstrapReadySignal } from './tokens.js';
|
|
2
3
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER } from './tokens.js';
|
|
1
|
+
export { APPLICATION_LOGGER, BOOTSTRAP_READY_SIGNAL, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION } from './tokens.js';
|
package/dist/logging/logger.d.ts
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
import type { ApplicationLogger } from '../types.js';
|
|
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
|
+
}
|
|
2
30
|
/**
|
|
3
31
|
* Create console application logger.
|
|
4
32
|
*
|
|
33
|
+
* @param options Console logger mode, severity threshold, and color override.
|
|
5
34
|
* @returns The create console application logger result.
|
|
6
35
|
*/
|
|
7
|
-
export declare function createConsoleApplicationLogger(): ApplicationLogger;
|
|
36
|
+
export declare function createConsoleApplicationLogger(options?: ConsoleApplicationLoggerOptions): ApplicationLogger;
|
|
8
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,28 +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
|
}
|
|
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
|
+
}
|
|
18
54
|
|
|
19
55
|
/**
|
|
20
56
|
* Create console application logger.
|
|
21
57
|
*
|
|
58
|
+
* @param options Console logger mode, severity threshold, and color override.
|
|
22
59
|
* @returns The create console application logger result.
|
|
23
60
|
*/
|
|
24
|
-
export function createConsoleApplicationLogger() {
|
|
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
|
+
}
|
|
25
74
|
return {
|
|
26
75
|
debug(message, context = 'fluo') {
|
|
27
|
-
|
|
76
|
+
if (shouldLog('debug', level)) {
|
|
77
|
+
console.debug(format('DEBUG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
|
|
78
|
+
}
|
|
28
79
|
},
|
|
29
80
|
error(message, error, context = 'fluo') {
|
|
30
|
-
|
|
81
|
+
if (!shouldLog('error', level)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.error(format('ERROR', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
|
|
31
85
|
if (error) {
|
|
32
86
|
console.error(error);
|
|
33
87
|
}
|
|
34
88
|
},
|
|
35
89
|
log(message, context = 'fluo') {
|
|
36
|
-
|
|
90
|
+
if (shouldLog('log', level)) {
|
|
91
|
+
console.log(format('LOG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
|
|
92
|
+
}
|
|
37
93
|
},
|
|
38
94
|
warn(message, context = 'fluo') {
|
|
39
|
-
|
|
95
|
+
if (shouldLog('warn', level)) {
|
|
96
|
+
console.warn(format('WARN', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
|
|
97
|
+
}
|
|
40
98
|
}
|
|
41
99
|
};
|
|
42
100
|
}
|
package/dist/module-graph.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Provider } from '@fluojs/di';
|
|
2
1
|
import type { Token } from '@fluojs/core';
|
|
2
|
+
import type { Provider } from '@fluojs/di';
|
|
3
3
|
import type { BootstrapModuleOptions, CompiledModule, ModuleType } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Returns the public token represented by a provider declaration.
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"module-graph.d.ts","sourceRoot":"","sources":["../src/module-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAY3C,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"}
|