@fluojs/runtime 1.0.0-beta.10 → 1.0.0-beta.12

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 CHANGED
@@ -26,8 +26,8 @@ npm install @fluojs/runtime
26
26
  다음과 같은 경우에 이 패키지를 사용합니다:
27
27
  - **fluo 애플리케이션 부트스트랩**: 모듈을 실행 중인 HTTP 서버나 마이크로서비스로 변환할 때.
28
28
  - **DI 및 라이프사이클 오케스트레이션**: 모듈 그래프 컴파일, 프로바이더 연결 및 애플리케이션 훅(`onModuleInit`, `onApplicationBootstrap`)을 관리할 때.
29
- - **독립형 컨텍스트 생성**: HTTP 서버는 필요 없지만 DI가 필요한 CLI 태스크, 마이그레이션 또는 워커를 실행할 때.
30
- - **진단 및 검사**: CLI 내보내기와 Studio 소유 그래프 보기/렌더링을 위한 기계 읽기 가능한 플랫폼 snapshot 생산할 때.
29
+ - **독립형 컨텍스트 생성**: HTTP 서버는 필요 없지만 DI가 필요한 CLI task, script 또는 worker를 실행할 때.
30
+ - **진단 및 검사**: CLI 내보내기를 위한 기계 읽기 가능한 플랫폼 snapshot diagnostic issue를 생산하되, 그래프 보기와 Mermaid 표현은 Studio에 맡길 때.
31
31
 
32
32
  ## 퀵 스타트
33
33
 
@@ -115,7 +115,7 @@ class DatabaseModule {}
115
115
 
116
116
  @Module({
117
117
  imports: [DatabaseModule],
118
- providers: [UsersService], // 이제 DatabaseService를 주입받을 수 있음
118
+ providers: [UsersService], // UsersService가 DatabaseService를 주입받을 수 있음
119
119
  })
120
120
  class UsersModule {}
121
121
  ```
@@ -130,6 +130,9 @@ class UsersModule {}
130
130
  - `multi: true` provider token은 context cache에 memoize되지 않습니다. 각 `get()` 호출은 DI로 위임되어 컨테이너가 새로운 contribution 배열을 조립하며, 각 contribution 자체는 해당 provider scope에 따라 재사용됩니다.
131
131
  - `duplicateProviderPolicy`가 `warn` 또는 `ignore`일 때 context cache 적격성과 lifecycle hook 실행은 bootstrap이 선택한 effective winning provider를 기준으로 결정됩니다. stale losing provider는 cache entry나 lifecycle hook을 만들지 않습니다.
132
132
  - 애플리케이션 또는 컨텍스트 bootstrap이 런타임 리소스나 lifecycle instance 생성 이후 실패하면 fluo는 readiness를 초기화하고, 등록된 runtime cleanup callback을 실행하며, 그 시점까지 해석된 instance의 shutdown hook을 `bootstrap-failed`로 호출하고, 컨테이너를 dispose하고, cleanup 실패를 로그로 남긴 뒤 원래 bootstrap error를 다시 던집니다.
133
+ - `Application.listen()`과 microservice `listen()`은 shutdown과 직렬화됩니다. 겹치는 startup 호출은 같은 in-flight startup을 공유하고, shutdown은 진행 중인 startup이 끝날 때까지 기다리며, shutdown과 경합한 startup은 close 시작 이후 shell을 다시 `ready`로 전이할 수 없습니다.
134
+ - 종료 시그널 등록 실패는 사용자가 관찰할 수 있습니다. `runNodeApplication(...)`, `bootstrapNodeApplication(...)`, adapter 소유 runtime helper는 이미 시작된 애플리케이션을 `bootstrap-failed`로 닫고, close 실패가 있으면 별도로 로그로 남기며, 원래 registration error로 reject합니다.
135
+ - 종료 시그널 등록 해제 실패는 애플리케이션 close를 건너뛰지 않습니다. `app.close()`는 항상 adapter shutdown, lifecycle hook, runtime cleanup callback, container dispose까지 계속 진행합니다. close 자체가 성공하면 unregistration error로 reject하고, close도 실패하면 두 실패를 모두 담은 aggregate로 reject합니다.
133
136
  - 연결된 microservice는 부모 `Application`이 소유하는 child입니다. `startAllMicroservices()`는 순차적으로 시작하며 이후 child 시작이 실패하면 이미 시작된 child를 `bootstrap-failed`로 rollback하고, `Application.close(signal)`은 부모 lifecycle hook, adapter 종료, container dispose보다 먼저 연결된 child를 닫습니다.
134
137
  - `FluoFactory.createMicroservice()`는 cleanup이 실패해도 원래 bootstrap/runtime 해석 오류를 보존하고 cleanup 실패는 별도로 로그로 남깁니다.
135
138
  - Bootstrap은 독립적인 singleton lifecycle provider를 병렬로 해석한 뒤 lifecycle hook은 결정적인 provider 순서대로 실행합니다.
@@ -137,29 +140,37 @@ class UsersModule {}
137
140
  - `createNodeHttpAdapter(...)`, `bootstrapNodeApplication(...)`, `runNodeApplication(...)`는 `maxBodySize`를 0 이상의 정수 바이트 수로만 받으며, 값이 잘못되면 어댑터 생성/부트스트랩 단계에서 즉시 실패합니다.
138
141
  - 응답 스트림 백프레셔 헬퍼는 `drain`, `close`, `error` 중 어느 경우에도 `waitForDrain()`을 완료시켜 끊어진 연결에서 스트리밍 작성기가 멈추지 않도록 합니다.
139
142
  - 런타임 health 모듈은 bootstrap이 ready로 표시하기 전까지 `/ready`를 HTTP 503과 `starting`으로 보고하며, 애플리케이션/컨텍스트 종료가 시작되는 즉시, 종료 시도가 실패하더라도 다시 `starting`으로 내려갑니다.
143
+ - 런타임 health module readiness check는 현재 `RequestContext`를 받으므로, public integration이 internal runtime token을 import하지 않고도 runtime-exposed status provider를 해석할 수 있습니다.
140
144
  - 시그널 기반 종료 헬퍼는 bounded drain semantics를 유지하면서 timeout/실패 상황을 로그와 `process.exitCode`로 보고하지만, 최종 프로세스 종료 소유권은 주변 호스트 런타임에 남겨 둡니다.
141
- - 플랫폼 snapshot 생산은 런타임에 남아 있고, 그래프 보기와 Mermaid 렌더링은 CLI 및 자동화 호출자가 소비하는 Studio 소유 계약입니다.
145
+ - 플랫폼 snapshot 및 diagnostic issue 생산은 런타임에 남아 있고, 그래프 보기, filtering 표현, Mermaid 렌더링은 CLI 및 자동화 호출자가 소비하는 Studio 소유 계약입니다.
142
146
  - 모듈 그래프 컴파일 결과 캐시는 `moduleGraphCache: true`를 통한 opt-in입니다. 캐시 항목은 root module identity, runtime provider, validation token, core metadata version, compile algorithm version으로 식별되며, 성공한 컴파일만 저장하고 호출자 mutation이 이후 bootstrap을 오염시키지 않도록 격리된 그래프 복사본을 반환합니다.
143
147
 
144
148
  ## 공개 API 개요
145
149
 
146
150
  - `fluoFactory`: 패키지 예제에서 사용하는 런타임 부트스트랩 파사드의 lower-camel-case 별칭입니다.
147
- - `FluoFactory`: 호환성과 명시적 static 접근을 위해 유지되는 클래스 기반 런타임 부트스트랩 파사드입니다.
151
+ - `FluoFactory`: 명시적 static 접근을 제공하는 클래스 기반 런타임 부트스트랩 파사드입니다.
148
152
  - `Application`: `ApplicationContext`를 확장하며 `listen()`, `dispatch()`, `state`를 포함합니다.
149
- - `ApplicationContext`: `get<T>(token)`, `close()` 기능을 제공하며 `container`와 `modules`에 접근할 수 있습니다.
153
+ - `ApplicationContext`: `get<T>(token)`, `close()` 기능을 제공하며 `container`, `modules`, bootstrap diagnostics에 접근할 수 있습니다.
150
154
  - `LifecycleHooks`: `OnModuleInit`, `OnApplicationBootstrap`, `OnModuleDestroy`, `OnApplicationShutdown`를 묶는 편의 union 타입입니다.
151
- - `createHealthModule(options)`: bootstrap 및 shutdown 라이프사이클 전이에 맞춰 readiness marker를 관리하는 런타임 소유 `/health`, `/ready` 모듈 팩토리입니다.
155
+ - `HealthModule.forRoot(options)`: bootstrap 및 shutdown 라이프사이클 전이에 맞춰 readiness marker를 관리하는 런타임 소유 `/health`, `/ready` 모듈 파사드입니다.
156
+ - `createHealthModule(options)`: 같은 런타임 health module 계약을 위한 deprecated compatibility helper입니다. 애플리케이션-facing module import에서는 `HealthModule.forRoot(...)`를 우선 사용하세요.
157
+ - `ReadinessCheck`: runtime health module이 사용하는 function type입니다. Check는 `/ready` request context를 받고 boolean 또는 promise를 반환합니다.
152
158
  - `defineModule(cls, metadata)`: 프로그래밍 방식의 모듈 정의 헬퍼입니다.
153
159
  - `bootstrapApplication(options)`: 저수준 비동기 부트스트랩 함수입니다.
160
+ - `bootstrapModule(...)`: 저수준 module graph bootstrap helper입니다.
161
+ - `createBootstrapTimingDiagnostics(...)`, `createRuntimeDiagnosticsGraph(...)`: CLI/support tooling을 위한 runtime 소유 diagnostics snapshot helper입니다. 이 helper들은 기계 읽기 가능한 데이터를 생산하며, Studio가 viewer parsing, graph presentation, Mermaid rendering을 소유합니다.
162
+ - `createRequestAbortContext(...)`, `trackActiveRequestTransaction(...)`, `untrackActiveRequestTransaction(...)`: runtime-aware integration이 사용하는 request abort 및 active transaction helper입니다.
154
163
 
155
164
  ## 플랫폼 전용 서브경로
156
165
 
157
166
  | 서브경로 | 용도 |
158
167
  | :--- | :--- |
159
168
  | `@fluojs/runtime/node` | 로거 팩토리, Node 어댑터/부트스트랩 헬퍼, 종료 시그널 등록을 위한 지원되는 Node.js 전용 진입점입니다. |
160
- | `@fluojs/runtime/web` | Bun, Deno, Cloudflare Workers를 위한 공유 표준 요청/응답 유틸리티. |
161
- | `@fluojs/runtime/internal` | 저수준 오케스트레이션 헬퍼 HTTP 어댑터 기본 로직. |
162
- | `@fluojs/runtime/internal-node` | 어댑터/패키지 호환 계층이 사용하는 Node 전용 내부 seam이며, 애플리케이션 코드에서는 `@fluojs/runtime/node`를 우선 사용하세요. |
169
+ | `@fluojs/runtime/web` | Bun, Deno, Cloudflare Workers를 위한 공유 Web 표준 요청/응답 유틸리티입니다. `createWebRequestResponseFactory`, `dispatchWebRequest`, `createWebFrameworkRequest`, `parseMultipart`를 포함합니다. |
170
+ | `@fluojs/runtime/internal` | package integration을 위한 token-only internal seam입니다. |
171
+ | `@fluojs/runtime/internal-node` | adapter/runtime plumbing을 위한 Node 전용 internal seam이며, 애플리케이션 코드에서는 `@fluojs/runtime/node`를 우선 사용하세요. |
172
+ | `@fluojs/runtime/internal/http-adapter` | platform package를 위한 internal HTTP adapter seam입니다. |
173
+ | `@fluojs/runtime/internal/request-response-factory` | platform package를 위한 internal request/response factory seam입니다. |
163
174
 
164
175
  ### Node 전용 서브경로 (`@fluojs/runtime/node`)
165
176
 
@@ -184,10 +195,10 @@ const adapter = createNodeHttpAdapter({
184
195
 
185
196
  공개 Node 런타임 surface에서 `maxBodySize`는 바이트 수를 나타내는 숫자만 허용합니다. `'1mb'` 같은 값은 나중에 암묵 변환되지 않고 어댑터 생성 시점에 즉시 거부됩니다.
186
197
 
187
- - `createConsoleApplicationLogger()`: `process.stdout`/`process.stderr`를 사용하는 컬러 콘솔 로거입니다. 기본값은 기존 pretty 형식을 유지합니다. 더 간결한 `[fluo] LEVEL [context] message` 줄을 원하면 `{ mode: 'minimal' }`, 런타임 로거 출력을 숨기려면 `{ mode: 'silent' }`, 낮은 심각도 메시지를 걸러내려면 `{ level: 'warn' }` 같은 threshold, 결정적인 비컬러 출력을 원하면 `{ color: false }`를 전달하세요.
198
+ - `createConsoleApplicationLogger()`: `process.stdout`/`process.stderr`를 사용하는 컬러 콘솔 로거입니다. 기본값은 pretty 형식입니다. 더 간결한 `[fluo] LEVEL [context] message` 줄을 원하면 `{ mode: 'minimal' }`, 런타임 로거 출력을 숨기려면 `{ mode: 'silent' }`, 낮은 심각도 메시지를 걸러내려면 `{ level: 'warn' }` 같은 threshold, 결정적인 비컬러 출력을 원하면 `{ color: false }`를 전달하세요.
188
199
  - `createJsonApplicationLogger()`: `process.stdout`/`process.stderr`를 사용하는 구조화된 JSON 로거.
189
200
  - `createNodeHttpAdapter()`: 어댑터 우선 런타임 구성을 위한 raw Node `http`/`https` 어댑터 팩토리입니다. primary Node 요청 `content-type`을 JSON/멀티파트 판별 전에 normalize하며, `maxBodySize`는 숫자 바이트 수만 받습니다.
190
- - `bootstrapNodeApplication()` / `runNodeApplication()`: 호환 패키지와 직접 Node 런타임 흐름에서 사용하는 Node 전용 부트스트랩 헬퍼.
201
+ - `bootstrapNodeApplication()` / `runNodeApplication()`: 직접 Node runtime flow에서 사용하는 Node 전용 부트스트랩 헬퍼.
191
202
  - `createNodeShutdownSignalRegistration()`, `defaultNodeShutdownSignals()`, `registerShutdownSignals()`: 호스트가 명시적으로 시그널 wiring을 제어할 때 쓰는 종료 등록 헬퍼.
192
203
 
193
204
  런타임 애플리케이션 로깅은 CLI lifecycle reporting과 별개입니다. 애플리케이션/런타임 자체가 내는 로그를 바꾸고 싶을 때 `ApplicationLogger`를 설정하세요:
@@ -209,7 +220,7 @@ const jsonLogger = createJsonApplicationLogger();
209
220
  - [@fluojs/di](../di): 의존성 주입(DI) 컨테이너 구현체.
210
221
  - [@fluojs/http](../http): HTTP 라우팅, 컨트롤러 및 디스패처.
211
222
  - [@fluojs/platform-nodejs](../platform-nodejs): 공식 Node.js HTTP 어댑터.
212
- - [@fluojs/studio](../studio): 런타임이 생산한 snapshot 위한 뷰어 렌더링 헬퍼.
223
+ - [@fluojs/studio](../studio): 런타임이 생산한 snapshot diagnostic issue를 위한 viewer, filtering, rendering helper.
213
224
 
214
225
  ## 예제 소스
215
226
 
package/README.md CHANGED
@@ -26,8 +26,8 @@ npm install @fluojs/runtime
26
26
  Use this package when you need to:
27
27
  - **Bootstrap a fluo application**: Convert your modules into a running HTTP server or microservice.
28
28
  - **Orchestrate DI and Lifecycle**: Manage module-graph compilation, provider wiring, and application hooks (`onModuleInit`, `onApplicationBootstrap`).
29
- - **Create Standalone Contexts**: Run CLI tasks, migrations, or workers that need DI but not an HTTP server.
30
- - **Diagnostic Inspection**: Produce machine-readable platform snapshots for CLI export and Studio-owned graph viewing/rendering.
29
+ - **Create Standalone Contexts**: Run CLI tasks, scripts, or workers that need DI but not an HTTP server.
30
+ - **Diagnostic Inspection**: Produce machine-readable platform snapshots and diagnostic issues for CLI export while leaving graph viewing and Mermaid presentation to Studio.
31
31
 
32
32
  ## Quick Start
33
33
 
@@ -115,7 +115,7 @@ class DatabaseModule {}
115
115
 
116
116
  @Module({
117
117
  imports: [DatabaseModule],
118
- providers: [UsersService], // Can now inject DatabaseService
118
+ providers: [UsersService], // UsersService can inject DatabaseService
119
119
  })
120
120
  class UsersModule {}
121
121
  ```
@@ -130,6 +130,9 @@ class UsersModule {}
130
130
  - `multi: true` provider tokens are not context-cache memoized: each `get()` call delegates to DI so the container can assemble a fresh contribution array while still reusing each contribution according to its own provider scope.
131
131
  - When `duplicateProviderPolicy` is `warn` or `ignore`, context-cache eligibility and lifecycle hook execution are based on the effective winning provider selected by bootstrap; stale losing providers do not seed cache entries or lifecycle hooks.
132
132
  - If application or context bootstrap fails after runtime resources or lifecycle instances have been created, fluo resets readiness, runs registered runtime cleanup callbacks, invokes shutdown hooks for instances resolved so far with `bootstrap-failed`, disposes the container, logs cleanup failures, and rethrows the original bootstrap error.
133
+ - `Application.listen()` and microservice `listen()` are serialized with shutdown: overlapping startup calls share the same in-flight startup, shutdown waits for in-flight startup to settle, and a startup that races with shutdown cannot transition the shell back to `ready` after close begins.
134
+ - Shutdown signal registration failures are user-observable: `runNodeApplication(...)`, `bootstrapNodeApplication(...)`, and adapter-owned runtime helpers close the already-started application with `bootstrap-failed`, log any close failure separately, and reject with the original registration error.
135
+ - Shutdown signal unregistration failures do not skip application close: `app.close()` always continues through adapter shutdown, lifecycle hooks, runtime cleanup callbacks, and container disposal; if close otherwise succeeds it rejects with the unregistration error, and if close also fails it rejects with an aggregate containing both failures.
133
136
  - Connected microservices are owned children of their parent `Application`: `startAllMicroservices()` starts them sequentially and rolls back already-started children with `bootstrap-failed` if a later child fails, while `Application.close(signal)` closes connected children before parent lifecycle hooks, adapter shutdown, and container disposal.
134
137
  - `FluoFactory.createMicroservice()` preserves the original bootstrap/runtime-resolution error when cleanup fails and logs cleanup failures separately.
135
138
  - Bootstrap resolves independent singleton lifecycle providers concurrently, then runs lifecycle hooks in deterministic provider order.
@@ -137,29 +140,37 @@ class UsersModule {}
137
140
  - `createNodeHttpAdapter(...)`, `bootstrapNodeApplication(...)`, and `runNodeApplication(...)` accept `maxBodySize` only as a non-negative integer byte count and fail fast during adapter creation/bootstrap when the value is invalid.
138
141
  - Response stream backpressure helpers settle `waitForDrain()` on `drain`, `close`, or `error` so streaming writers do not hang on dead connections.
139
142
  - Runtime health modules report `/ready` as `starting` with HTTP 503 until bootstrap marks them ready, and they return to `starting` as soon as application/context shutdown begins, including failed shutdown attempts.
143
+ - Runtime health module readiness checks receive the current `RequestContext`, allowing public integrations to resolve runtime-exposed status providers without importing internal runtime tokens.
140
144
  - Signal-driven shutdown helpers preserve bounded drain semantics, log timeout/failure conditions, and set `process.exitCode` when shutdown does not finish cleanly, but they leave final process termination ownership to the surrounding host runtime.
141
- - Platform snapshot production stays in runtime; graph viewing and Mermaid rendering are Studio-owned contracts consumed by CLI and automation callers.
145
+ - Platform snapshot and diagnostic issue production stay in runtime; graph viewing, filtering presentation, and Mermaid rendering are Studio-owned contracts consumed by CLI and automation callers.
142
146
  - Module graph compile-result caching is opt-in through `moduleGraphCache: true`; it keys entries by root module identity, runtime providers, validation tokens, core metadata versions, and the compile algorithm version, caches only successful compilations, and returns isolated graph copies so caller mutations cannot poison later bootstraps.
143
147
 
144
148
  ## Public API Overview
145
149
 
146
150
  - `fluoFactory`: Lower-camel-case alias for the runtime bootstrap facade used in the package examples.
147
- - `FluoFactory`: Class-based runtime bootstrap facade retained for compatibility and explicit static access.
151
+ - `FluoFactory`: Class-based runtime bootstrap facade with explicit static access.
148
152
  - `Application`: Extends `ApplicationContext` with `listen()`, `dispatch()`, and `state`.
149
- - `ApplicationContext`: Provides `get<T>(token)`, `close()`, and access to `container` and `modules`.
153
+ - `ApplicationContext`: Provides `get<T>(token)`, `close()`, and access to `container`, `modules`, and bootstrap diagnostics.
150
154
  - `LifecycleHooks`: Convenience union covering `OnModuleInit`, `OnApplicationBootstrap`, `OnModuleDestroy`, and `OnApplicationShutdown`.
151
- - `createHealthModule(options)`: Runtime-owned `/health` and `/ready` module factory whose readiness marker follows bootstrap and shutdown lifecycle transitions.
155
+ - `HealthModule.forRoot(options)`: Runtime-owned `/health` and `/ready` module facade whose readiness marker follows bootstrap and shutdown lifecycle transitions.
156
+ - `createHealthModule(options)`: Deprecated compatibility helper for the same runtime health module contract; prefer `HealthModule.forRoot(...)` in application-facing module imports.
157
+ - `ReadinessCheck`: Function type used by runtime health modules. Checks receive the `/ready` request context and return a boolean or promise.
152
158
  - `defineModule(cls, metadata)`: Programmatic module definition helper.
153
159
  - `bootstrapApplication(options)`: Lower-level async bootstrap function.
160
+ - `bootstrapModule(...)`: Lower-level module graph bootstrap helper.
161
+ - `createBootstrapTimingDiagnostics(...)`, `createRuntimeDiagnosticsGraph(...)`: Runtime-owned diagnostics snapshot helpers for CLI/support tooling. They produce machine-readable data; Studio owns viewer parsing, graph presentation, and Mermaid rendering.
162
+ - `createRequestAbortContext(...)`, `trackActiveRequestTransaction(...)`, `untrackActiveRequestTransaction(...)`: Request abort and active transaction helpers used by runtime-aware integrations.
154
163
 
155
164
  ## Platform-Specific Subpaths
156
165
 
157
166
  | Subpath | Purpose |
158
167
  | :--- | :--- |
159
168
  | `@fluojs/runtime/node` | Supported Node.js entrypoint for logger factories, Node adapter/bootstrap helpers, and shutdown signal registration. |
160
- | `@fluojs/runtime/web` | Shared Web-standard request/response utilities for Bun, Deno, and Cloudflare Workers. |
161
- | `@fluojs/runtime/internal` | Low-level orchestration helpers and HTTP adapter base logic. |
162
- | `@fluojs/runtime/internal-node` | Node-only internal seam used by adapter/package compatibility layers; prefer `@fluojs/runtime/node` in application code. |
169
+ | `@fluojs/runtime/web` | Shared Web-standard request/response utilities for Bun, Deno, and Cloudflare Workers, including `createWebRequestResponseFactory`, `dispatchWebRequest`, `createWebFrameworkRequest`, and `parseMultipart`. |
170
+ | `@fluojs/runtime/internal` | Token-only internal seam for package integrations. |
171
+ | `@fluojs/runtime/internal-node` | Node-only internal seam for adapter/runtime plumbing; prefer `@fluojs/runtime/node` in application code. |
172
+ | `@fluojs/runtime/internal/http-adapter` | Internal HTTP adapter seam for platform packages. |
173
+ | `@fluojs/runtime/internal/request-response-factory` | Internal request/response factory seam for platform packages. |
163
174
 
164
175
  ### Node-Specific Subpath (`@fluojs/runtime/node`)
165
176
 
@@ -184,10 +195,10 @@ const adapter = createNodeHttpAdapter({
184
195
 
185
196
  For the public Node runtime surface, `maxBodySize` is a byte-count number only. Values such as `'1mb'` are rejected immediately during adapter creation instead of being coerced later.
186
197
 
187
- - `createConsoleApplicationLogger()`: Colorized console logger using `process.stdout`/`process.stderr`. The default remains the historical pretty format. Pass `{ mode: 'minimal' }` for concise `[fluo] LEVEL [context] message` lines, `{ mode: 'silent' }` to suppress runtime logger output, `{ level: 'warn' }` or another threshold to filter lower-severity messages, and `{ color: false }` when you need deterministic non-colored output.
198
+ - `createConsoleApplicationLogger()`: Colorized console logger using `process.stdout`/`process.stderr`. The default remains the pretty format. Pass `{ mode: 'minimal' }` for concise `[fluo] LEVEL [context] message` lines, `{ mode: 'silent' }` to suppress runtime logger output, `{ level: 'warn' }` or another threshold to filter lower-severity messages, and `{ color: false }` when you need deterministic non-colored output.
188
199
  - `createJsonApplicationLogger()`: Structured JSON logger using `process.stdout`/`process.stderr`.
189
200
  - `createNodeHttpAdapter()`: Raw Node `http`/`https` adapter factory for adapter-first runtime setup. The helper normalizes the primary Node request `content-type` before JSON/multipart detection and accepts `maxBodySize` only as numeric bytes.
190
- - `bootstrapNodeApplication()` / `runNodeApplication()`: Node-specific bootstrap helpers used by compatibility packages and direct Node runtime flows.
201
+ - `bootstrapNodeApplication()` / `runNodeApplication()`: Node-specific bootstrap helpers used by direct Node runtime flows.
191
202
  - `createNodeShutdownSignalRegistration()`, `defaultNodeShutdownSignals()`, `registerShutdownSignals()`: Shutdown registration helpers for hosts that need explicit signal wiring.
192
203
 
193
204
  Runtime app logging is separate from CLI lifecycle reporting. Configure `ApplicationLogger` when you want to change logs emitted by the application/runtime itself:
@@ -209,7 +220,7 @@ Lower-level Node compression internals stay behind the `@fluojs/runtime/internal
209
220
  - [@fluojs/di](../di): Dependency injection container implementation.
210
221
  - [@fluojs/http](../http): HTTP routing, controllers, and dispatcher.
211
222
  - [@fluojs/platform-nodejs](../platform-nodejs): Official Node.js HTTP adapter.
212
- - [@fluojs/studio](../studio): Viewer and rendering helpers for runtime-produced snapshots.
223
+ - [@fluojs/studio](../studio): Viewer, filtering, and rendering helpers for runtime-produced snapshots and diagnostic issues.
213
224
 
214
225
  ## Example Sources
215
226
 
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,kBAAkB,EA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AAqcpB;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,gBAAgB,GAAG,CAAC,CAIjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,sBAA2B,GAAG,eAAe,CA+B7G;AA0zBD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAsHrG;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB;;;;;;;OAOG;WACU,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,WAAW,CAAC;IAOzG;;;;;;;OAOG;WACU,wBAAwB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,kBAAkB,CAAC;IAqG9B;;;;;;;;OAQG;WACU,kBAAkB,CAC7B,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC;CA+BpC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,oBAAc,CAAC"}
package/dist/bootstrap.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { Container } from '@fluojs/di';
2
- import { DefaultBinder } from '@fluojs/http/internal';
3
2
  import { InvariantError } from '@fluojs/core';
4
- import { defineModuleMetadata, getClassDiMetadata } from '@fluojs/core/internal';
5
3
  import { createDispatcher, createHandlerMapping } from '@fluojs/http';
6
4
  import { DuplicateProviderError } from './errors.js';
7
5
  import { createBootstrapTimingDiagnostics } from './health/diagnostics.js';
6
+ import { defineRuntimeModuleMetadata, getRuntimeClassDiMetadata } from './internal/core-metadata.js';
7
+ import { RuntimeDefaultBinder } from './internal/http-runtime.js';
8
8
  import { createConsoleApplicationLogger } from './logging/logger.js';
9
9
  import { compileModuleGraph, providerToken } from './module-graph.js';
10
10
  import { createRuntimePlatformShell } from './platform-shell.js';
11
- import { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER } from './tokens.js';
11
+ import { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CLEANUP_REGISTRATION, RUNTIME_CONTAINER } from './tokens.js';
12
12
  const DEFAULT_MICROSERVICE_TOKEN = Symbol.for('fluo.microservices.service');
13
13
  const runtimePerformance = globalThis.performance;
14
14
  async function runExceptionFilters(filters, error, request, response, requestId) {
@@ -26,16 +26,16 @@ async function runExceptionFilters(filters, error, request, response, requestId)
26
26
  }
27
27
  function providerScope(provider) {
28
28
  if (typeof provider === 'function') {
29
- return getClassDiMetadata(provider)?.scope ?? 'singleton';
29
+ return getRuntimeClassDiMetadata(provider)?.scope ?? 'singleton';
30
30
  }
31
31
  if ('useValue' in provider) {
32
32
  return 'singleton';
33
33
  }
34
34
  if ('useClass' in provider) {
35
- return provider.scope ?? getClassDiMetadata(provider.useClass)?.scope ?? 'singleton';
35
+ return provider.scope ?? getRuntimeClassDiMetadata(provider.useClass)?.scope ?? 'singleton';
36
36
  }
37
37
  if ('useFactory' in provider) {
38
- return provider.scope ?? (provider.resolverClass ? getClassDiMetadata(provider.resolverClass)?.scope : undefined) ?? 'singleton';
38
+ return provider.scope ?? (provider.resolverClass ? getRuntimeClassDiMetadata(provider.resolverClass)?.scope : undefined) ?? 'singleton';
39
39
  }
40
40
  return 'singleton';
41
41
  }
@@ -65,6 +65,17 @@ async function runCleanupCallbacks(cleanups) {
65
65
  }
66
66
  return errors;
67
67
  }
68
+ function createRuntimeCleanupRegistration(cleanups) {
69
+ return cleanup => {
70
+ cleanups.push(cleanup);
71
+ return () => {
72
+ const index = cleanups.indexOf(cleanup);
73
+ if (index >= 0) {
74
+ cleanups.splice(index, 1);
75
+ }
76
+ };
77
+ };
78
+ }
68
79
  async function closeRuntimeResources(options) {
69
80
  const errors = [];
70
81
  resetReadinessState(options.modules);
@@ -315,7 +326,7 @@ function registerModuleMiddleware(container, modules) {
315
326
  * @returns The same `moduleType` reference for fluent helper composition.
316
327
  */
317
328
  export function defineModule(moduleType, definition) {
318
- defineModuleMetadata(moduleType, definition);
329
+ defineRuntimeModuleMetadata(moduleType, definition);
319
330
  return moduleType;
320
331
  }
321
332
 
@@ -357,6 +368,7 @@ class FluoApplication {
357
368
  applicationState = 'bootstrapped';
358
369
  closed = false;
359
370
  closingPromise;
371
+ listenPromise;
360
372
  contextResolutionCache = new Map();
361
373
  lifecycleInstances;
362
374
  connectedMicroservices = [];
@@ -443,12 +455,27 @@ class FluoApplication {
443
455
  * 준비 검사를 통과한 뒤 어댑터에 바인딩을 위임하고 상태를 `ready`로 전이한다.
444
456
  */
445
457
  async listen() {
446
- if (this.applicationState === 'closed') {
458
+ if (this.closed || this.closingPromise || this.applicationState === 'closed') {
447
459
  throw new InvariantError('Application cannot listen after it has been closed.');
448
460
  }
449
461
  if (this.applicationState === 'ready') {
450
462
  return;
451
463
  }
464
+ if (this.listenPromise) {
465
+ await this.listenPromise;
466
+ return;
467
+ }
468
+ this.listenPromise = this.startListening();
469
+ try {
470
+ await this.listenPromise;
471
+ } finally {
472
+ this.listenPromise = undefined;
473
+ }
474
+ }
475
+ async startListening() {
476
+ if (this.closed || this.closingPromise || this.applicationState === 'closed') {
477
+ throw new InvariantError('Application cannot listen after it has been closed.');
478
+ }
452
479
  if (!this.hasHttpAdapter) {
453
480
  throw new InvariantError('Application cannot listen without an HTTP adapter. Provide options.adapter for HTTP startup, or use createApplicationContext() for adapterless DI-only bootstrap.');
454
481
  }
@@ -459,6 +486,9 @@ class FluoApplication {
459
486
  this.logger.error('Failed to start the HTTP adapter.', error, 'FluoApplication');
460
487
  throw error;
461
488
  }
489
+ if (this.closed || this.closingPromise) {
490
+ throw new InvariantError('Application startup was interrupted by shutdown.');
491
+ }
462
492
  this.applicationState = 'ready';
463
493
  this.logger.log('fluo application successfully started.', 'FluoApplication');
464
494
  }
@@ -479,6 +509,11 @@ class FluoApplication {
479
509
  }
480
510
  this.closingPromise = (async () => {
481
511
  const errors = [];
512
+ if (this.listenPromise) {
513
+ try {
514
+ await this.listenPromise;
515
+ } catch {}
516
+ }
482
517
  try {
483
518
  await this.closeConnectedMicroservices(signal);
484
519
  } catch (error) {
@@ -559,6 +594,7 @@ class FluoApplicationContext {
559
594
  class FluoMicroserviceApplication {
560
595
  closed = false;
561
596
  closingPromise;
597
+ listenPromise;
562
598
  microserviceState = 'bootstrapped';
563
599
  constructor(context, logger, runtime, closeContextOnClose) {
564
600
  this.context = context;
@@ -582,13 +618,31 @@ class FluoMicroserviceApplication {
582
618
  return this.context.get(token);
583
619
  }
584
620
  async listen() {
585
- if (this.microserviceState === 'closed') {
621
+ if (this.closed || this.closingPromise || this.microserviceState === 'closed') {
586
622
  throw new InvariantError('Microservice cannot listen after it has been closed.');
587
623
  }
588
624
  if (this.microserviceState === 'ready') {
589
625
  return;
590
626
  }
627
+ if (this.listenPromise) {
628
+ await this.listenPromise;
629
+ return;
630
+ }
631
+ this.listenPromise = this.startListening();
632
+ try {
633
+ await this.listenPromise;
634
+ } finally {
635
+ this.listenPromise = undefined;
636
+ }
637
+ }
638
+ async startListening() {
639
+ if (this.closed || this.closingPromise || this.microserviceState === 'closed') {
640
+ throw new InvariantError('Microservice cannot listen after it has been closed.');
641
+ }
591
642
  await this.runtime.listen();
643
+ if (this.closed || this.closingPromise) {
644
+ throw new InvariantError('Microservice startup was interrupted by shutdown.');
645
+ }
592
646
  this.microserviceState = 'ready';
593
647
  this.logger.log('fluo microservice successfully started.', 'FluoFactory');
594
648
  }
@@ -613,6 +667,11 @@ class FluoMicroserviceApplication {
613
667
  return;
614
668
  }
615
669
  this.closingPromise = (async () => {
670
+ if (this.listenPromise) {
671
+ try {
672
+ await this.listenPromise;
673
+ } catch {}
674
+ }
616
675
  if (this.closeContextOnClose) {
617
676
  const errors = [];
618
677
  try {
@@ -825,13 +884,16 @@ function createRuntimeProviders(options, logger) {
825
884
  useValue: logger
826
885
  }];
827
886
  }
828
- function registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell) {
887
+ function registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell, runtimeCleanup) {
829
888
  registerRuntimeContextTokens(bootstrapped, {
830
889
  provide: HTTP_APPLICATION_ADAPTER,
831
890
  useValue: adapter
832
891
  }, {
833
892
  provide: PLATFORM_SHELL,
834
893
  useValue: platformShell
894
+ }, {
895
+ provide: RUNTIME_CLEANUP_REGISTRATION,
896
+ useValue: createRuntimeCleanupRegistration(runtimeCleanup)
835
897
  });
836
898
  }
837
899
  function registerRuntimeContextTokens(bootstrapped, ...providers) {
@@ -843,10 +905,13 @@ function registerRuntimeContextTokens(bootstrapped, ...providers) {
843
905
  useValue: bootstrapped.modules
844
906
  });
845
907
  }
846
- function registerRuntimeApplicationContextTokens(bootstrapped, platformShell) {
908
+ function registerRuntimeApplicationContextTokens(bootstrapped, platformShell, runtimeCleanup) {
847
909
  registerRuntimeContextTokens(bootstrapped, {
848
910
  provide: PLATFORM_SHELL,
849
911
  useValue: platformShell
912
+ }, {
913
+ provide: RUNTIME_CLEANUP_REGISTRATION,
914
+ useValue: createRuntimeCleanupRegistration(runtimeCleanup)
850
915
  });
851
916
  }
852
917
  async function resolveBootstrapLifecycleInstances(bootstrapped, resolvedInstances) {
@@ -880,7 +945,7 @@ function createRuntimeDispatcherOptions(bootstrapped, options, handlerMapping, e
880
945
  rootContainer: bootstrapped.container
881
946
  };
882
947
  if (converters.length > 0) {
883
- dispatcherOptions.binder = new DefaultBinder(converters);
948
+ dispatcherOptions.binder = new RuntimeDefaultBinder(converters);
884
949
  }
885
950
  if (errorHandler) {
886
951
  dispatcherOptions.onError = errorHandler;
@@ -929,7 +994,7 @@ export async function bootstrapApplication(options) {
929
994
  logger,
930
995
  moduleGraphCache: options.moduleGraphCache,
931
996
  providers: runtimeProviders,
932
- validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER]
997
+ validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, RUNTIME_CLEANUP_REGISTRATION]
933
998
  });
934
999
  if (timingEnabled) {
935
1000
  timingPhases.push({
@@ -938,7 +1003,7 @@ export async function bootstrapApplication(options) {
938
1003
  });
939
1004
  }
940
1005
  const registerTokensStart = timingEnabled ? runtimePerformance.now() : 0;
941
- registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell);
1006
+ registerRuntimeBootstrapTokens(bootstrapped, adapter, platformShell, runtimeCleanup);
942
1007
  if (timingEnabled) {
943
1008
  timingPhases.push({
944
1009
  durationMs: runtimePerformance.now() - registerTokensStart,
@@ -977,7 +1042,7 @@ export async function bootstrapApplication(options) {
977
1042
  });
978
1043
  }
979
1044
  const bootstrapTiming = timingEnabled ? createBootstrapTimingDiagnostics(timingPhases, runtimePerformance.now() - timingStart) : undefined;
980
- return new FluoApplication(bootstrapped.container, bootstrapped.modules, options.rootModule, dispatcher, bootstrapTiming, adapter, hasHttpAdapter, platformShell, lifecycleInstances, logger, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL]));
1045
+ return new FluoApplication(bootstrapped.container, bootstrapped.modules, options.rootModule, dispatcher, bootstrapTiming, adapter, hasHttpAdapter, platformShell, lifecycleInstances, logger, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CLEANUP_REGISTRATION]));
981
1046
  } catch (error) {
982
1047
  logger.error('Failed to bootstrap the fluo application. Check the error below for what failed and how to fix it.', error, 'FluoFactory');
983
1048
  await runBootstrapFailureCleanup({
@@ -1038,7 +1103,7 @@ export class FluoFactory {
1038
1103
  logger,
1039
1104
  moduleGraphCache: options.moduleGraphCache,
1040
1105
  providers: runtimeProviders,
1041
- validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES]
1106
+ validationTokens: [RUNTIME_CONTAINER, COMPILED_MODULES, RUNTIME_CLEANUP_REGISTRATION]
1042
1107
  });
1043
1108
  if (timingEnabled) {
1044
1109
  timingPhases.push({
@@ -1047,7 +1112,7 @@ export class FluoFactory {
1047
1112
  });
1048
1113
  }
1049
1114
  const registerTokensStart = timingEnabled ? runtimePerformance.now() : 0;
1050
- registerRuntimeApplicationContextTokens(bootstrapped, platformShell);
1115
+ registerRuntimeApplicationContextTokens(bootstrapped, platformShell, runtimeCleanup);
1051
1116
  if (timingEnabled) {
1052
1117
  timingPhases.push({
1053
1118
  durationMs: runtimePerformance.now() - registerTokensStart,
@@ -1078,7 +1143,7 @@ export class FluoFactory {
1078
1143
  });
1079
1144
  }
1080
1145
  const bootstrapTiming = timingEnabled ? createBootstrapTimingDiagnostics(timingPhases, runtimePerformance.now() - timingStart) : undefined;
1081
- return new FluoApplicationContext(bootstrapped.container, bootstrapped.modules, rootModule, bootstrapTiming, lifecycleInstances, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, PLATFORM_SHELL]));
1146
+ return new FluoApplicationContext(bootstrapped.container, bootstrapped.modules, rootModule, bootstrapTiming, lifecycleInstances, runtimeCleanup, createContextCacheableTokenSet(bootstrapped.effectiveProviders, [RUNTIME_CONTAINER, COMPILED_MODULES, PLATFORM_SHELL, RUNTIME_CLEANUP_REGISTRATION]));
1082
1147
  } catch (error) {
1083
1148
  logger.error('Failed to bootstrap application context. Check the error below for what failed and how to fix it.', error, 'FluoFactory');
1084
1149
  await runBootstrapFailureCleanup({
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/health/diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,K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C,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,4 @@
1
- import { getClassDiMetadata } from '@fluojs/core/internal';
1
+ import { getRuntimeClassDiMetadata } from '../internal/core-metadata.js';
2
2
 
3
3
  /**
4
4
  * Describes the runtime diagnostics graph contract.
@@ -56,16 +56,16 @@ function providerShape(provider) {
56
56
  }
57
57
  function providerScope(provider) {
58
58
  if (typeof provider === 'function') {
59
- return getClassDiMetadata(provider)?.scope ?? 'singleton';
59
+ return getRuntimeClassDiMetadata(provider)?.scope ?? 'singleton';
60
60
  }
61
61
  if ('useValue' in provider || 'useExisting' in provider) {
62
62
  return 'singleton';
63
63
  }
64
64
  if ('useFactory' in provider) {
65
- return provider.scope ?? (provider.resolverClass ? getClassDiMetadata(provider.resolverClass)?.scope : undefined) ?? 'singleton';
65
+ return provider.scope ?? (provider.resolverClass ? getRuntimeClassDiMetadata(provider.resolverClass)?.scope : undefined) ?? 'singleton';
66
66
  }
67
67
  if ('useClass' in provider) {
68
- return provider.scope ?? getClassDiMetadata(provider.useClass)?.scope ?? 'singleton';
68
+ return provider.scope ?? getRuntimeClassDiMetadata(provider.useClass)?.scope ?? 'singleton';
69
69
  }
70
70
  return 'singleton';
71
71
  }
@@ -28,12 +28,25 @@ export interface HealthModuleOptions {
28
28
  /**
29
29
  * Defines the readiness check type.
30
30
  */
31
- export type ReadinessCheck = () => boolean | Promise<boolean>;
31
+ export type ReadinessCheck = (ctx: import('@fluojs/http').RequestContext) => boolean | Promise<boolean>;
32
32
  /**
33
- * Create health module.
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.
34
46
  *
35
- * @param options The options.
36
- * @returns The create health module result.
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.
37
50
  */
38
51
  export declare function createHealthModule(options?: HealthModuleOptions): ModuleType;
39
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;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,GAAG,aAAa,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,cAAc,EAAE,cAAc,KACrD,YAAY,GACZ,mBAAmB,GACnB,OAAO,CAAC,YAAY,GAAG,mBAAmB,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CA0EhF"}
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;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,GAAG,aAAa,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,cAAc,EAAE,cAAc,KACrD,YAAY,GACZ,mBAAmB,GACnB,OAAO,CAAC,YAAY,GAAG,mBAAmB,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,OAAO,cAAc,EAAE,cAAc,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAkFxG;;GAEG;AACH,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU;CAG9D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,UAAU,CAEhF"}
@@ -26,13 +26,7 @@ import { defineModule } from '../bootstrap.js';
26
26
  * Defines the readiness check type.
27
27
  */
28
28
 
29
- /**
30
- * Create health module.
31
- *
32
- * @param options The options.
33
- * @returns The create health module result.
34
- */
35
- export function createHealthModule(options = {}) {
29
+ function createRuntimeHealthModule(options = {}) {
36
30
  let _initProto, _initClass;
37
31
  const basePath = options.path ?? '';
38
32
  const readinessChecks = [];
@@ -75,7 +69,7 @@ export function createHealthModule(options = {}) {
75
69
  };
76
70
  }
77
71
  for (const check of readinessChecks) {
78
- const result = await check();
72
+ const result = await check(ctx);
79
73
  if (!result) {
80
74
  ctx.response.setStatus(503);
81
75
  return {
@@ -91,7 +85,7 @@ export function createHealthModule(options = {}) {
91
85
  _initClass();
92
86
  }
93
87
  }
94
- class HealthModule {
88
+ class RuntimeHealthModule {
95
89
  static addReadinessCheck(fn) {
96
90
  readinessChecks.push(fn);
97
91
  }
@@ -102,8 +96,37 @@ export function createHealthModule(options = {}) {
102
96
  ready = false;
103
97
  }
104
98
  }
105
- defineModule(HealthModule, {
99
+ Object.defineProperty(RuntimeHealthModule, 'name', {
100
+ value: 'HealthModule'
101
+ });
102
+ defineModule(RuntimeHealthModule, {
106
103
  controllers: [_HealthController]
107
104
  });
108
- return HealthModule;
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);
109
132
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http-adapter-shared.d.ts","sourceRoot":"","sources":["../src/http-adapter-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEhB,KAAK,sBAAsB,EAE3B,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAA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zC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,WAAW,CAAC,CA+EtB"}
@@ -106,15 +106,42 @@ export async function runHttpAdapterApplication(rootModule, options, adapter) {
106
106
  }
107
107
  throw error;
108
108
  }
109
- const unregisterShutdownSignals = options.shutdownRegistration?.(app, logger, options.forceExitTimeoutMs) ?? (() => {});
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
- unregisterShutdownSignals();
115
- shutdownSignalsUnregistered = true;
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
  }
@@ -0,0 +1,84 @@
1
+ import type { 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?: Token[];
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,KAAK,EAAE,MAAM,cAAc,CAAC;AAU1C,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,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AI,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 };
@@ -1,2 +1,2 @@
1
- export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, } from './tokens.js';
1
+ export { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION, } from './tokens.js';
2
2
  //# sourceMappingURL=internal.d.ts.map
@@ -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,GAClB,MAAM,aAAa,CAAC"}
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,EACjB,4BAA4B,GAC7B,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, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, PLATFORM_SHELL, RUNTIME_CONTAINER, RUNTIME_CLEANUP_REGISTRATION } from './tokens.js';
@@ -17,6 +17,15 @@ export interface ConsoleApplicationLoggerOptions {
17
17
  level?: ConsoleApplicationLoggerLevel;
18
18
  /** Override TTY-aware ANSI color detection. */
19
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;
20
29
  }
21
30
  /**
22
31
  * Create console application logger.
@@ -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;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;CACjB;AA2CD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,+BAAoC,GAAG,iBAAiB,CA0C/G"}
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"}
@@ -4,6 +4,8 @@
4
4
 
5
5
  /** Options used to tune the Node console logger without replacing the runtime logger contract. */
6
6
 
7
+ /** Host color environment used by `createConsoleApplicationLogger(...)` without reading globals directly. */
8
+
7
9
  const RESET = '\u001B[0m';
8
10
  const BRIGHT_GREEN = '\u001B[32m';
9
11
  const BRIGHT_RED = '\u001B[31m';
@@ -37,6 +39,18 @@ function formatMinimalLog(level, context, message, color) {
37
39
  function shouldLog(currentLevel, configuredLevel) {
38
40
  return LEVEL_PRIORITY[currentLevel] >= LEVEL_PRIORITY[configuredLevel];
39
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
+ }
40
54
 
41
55
  /**
42
56
  * Create console application logger.
@@ -47,6 +61,7 @@ function shouldLog(currentLevel, configuredLevel) {
47
61
  export function createConsoleApplicationLogger(options = {}) {
48
62
  const mode = options.mode ?? 'pretty';
49
63
  const level = options.level ?? 'debug';
64
+ const environment = options.environment ?? {};
50
65
  const format = mode === 'minimal' ? formatMinimalLog : formatLog;
51
66
  if (mode === 'silent') {
52
67
  return {
@@ -59,26 +74,26 @@ export function createConsoleApplicationLogger(options = {}) {
59
74
  return {
60
75
  debug(message, context = 'fluo') {
61
76
  if (shouldLog('debug', level)) {
62
- console.debug(format('DEBUG', context, message, options.color ?? Boolean(process.stdout.isTTY)));
77
+ console.debug(format('DEBUG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
63
78
  }
64
79
  },
65
80
  error(message, error, context = 'fluo') {
66
81
  if (!shouldLog('error', level)) {
67
82
  return;
68
83
  }
69
- console.error(format('ERROR', context, message, options.color ?? Boolean(process.stderr.isTTY)));
84
+ console.error(format('ERROR', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
70
85
  if (error) {
71
86
  console.error(error);
72
87
  }
73
88
  },
74
89
  log(message, context = 'fluo') {
75
90
  if (shouldLog('log', level)) {
76
- console.log(format('LOG', context, message, options.color ?? Boolean(process.stdout.isTTY)));
91
+ console.log(format('LOG', context, message, options.color ?? shouldUseColor(process.stdout, environment)));
77
92
  }
78
93
  },
79
94
  warn(message, context = 'fluo') {
80
95
  if (shouldLog('warn', level)) {
81
- console.warn(format('WARN', context, message, options.color ?? Boolean(process.stderr.isTTY)));
96
+ console.warn(format('WARN', context, message, options.color ?? shouldUseColor(process.stderr, environment)));
82
97
  }
83
98
  }
84
99
  };
@@ -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.
@@ -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;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"}
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"}
@@ -1,4 +1,4 @@
1
- import { getClassDiMetadata, getClassDiMetadataVersion, getModuleMetadata, getModuleMetadataVersion, getOwnClassDiMetadata } from '@fluojs/core/internal';
1
+ import { getRuntimeClassDiMetadata, getRuntimeClassDiMetadataVersion, getOwnRuntimeClassDiMetadata, getRuntimeModuleMetadata, getRuntimeModuleMetadataVersion } from './internal/core-metadata.js';
2
2
  import { ModuleGraphError, ModuleInjectionMetadataError, ModuleVisibilityError } from './errors.js';
3
3
  /**
4
4
  * Returns the public token represented by a provider declaration.
@@ -98,7 +98,7 @@ function describeProviderForCacheKey(provider) {
98
98
  export function createModuleGraphCacheKey(rootModule, options = {}) {
99
99
  const runtimeProviders = (options.providers ?? []).map(describeProviderForCacheKey).join('|');
100
100
  const validationTokens = (options.validationTokens ?? []).map(describeTokenForCacheKey).join('|');
101
- return [`root:${describeTokenForCacheKey(rootModule)}`, `module:${getModuleMetadataVersion()}`, `class-di:${getClassDiMetadataVersion()}`, `algorithm:${MODULE_GRAPH_COMPILE_ALGORITHM_VERSION}`, `runtime:${runtimeProviders}`, `validation:${validationTokens}`].join(';');
101
+ return [`root:${describeTokenForCacheKey(rootModule)}`, `module:${getRuntimeModuleMetadataVersion()}`, `class-di:${getRuntimeClassDiMetadataVersion()}`, `algorithm:${MODULE_GRAPH_COMPILE_ALGORITHM_VERSION}`, `runtime:${runtimeProviders}`, `validation:${validationTokens}`].join(';');
102
102
  }
103
103
  function cloneModuleDefinition(definition) {
104
104
  return {
@@ -287,7 +287,7 @@ function createModuleGraphCacheSnapshot(modules) {
287
287
  return Object.freeze(cloneCompiledModules(modules).map(compiledModule => freezeCompiledModule(compiledModule)));
288
288
  }
289
289
  function getEffectiveClassDiMetadata(target) {
290
- const metadata = getClassDiMetadata(target);
290
+ const metadata = getRuntimeClassDiMetadata(target);
291
291
  if (!metadata) {
292
292
  return undefined;
293
293
  }
@@ -335,7 +335,7 @@ function mergeRuntimeTokenSets(providers = [], validationTokens = []) {
335
335
  return new Set([...createRuntimeTokenSet(providers), ...validationTokens]);
336
336
  }
337
337
  function requiredConstructorParameters(target) {
338
- if (getOwnClassDiMetadata(target)?.inject !== undefined) {
338
+ if (getOwnRuntimeClassDiMetadata(target)?.inject !== undefined) {
339
339
  return 0;
340
340
  }
341
341
  return target.length;
@@ -398,7 +398,7 @@ function compileModule(moduleType, runtimeProviderTokens, compiled = new Map(),
398
398
  });
399
399
  }
400
400
  visiting.add(moduleType);
401
- const definition = normalizeModuleDefinition(getModuleMetadata(moduleType));
401
+ const definition = normalizeModuleDefinition(getRuntimeModuleMetadata(moduleType));
402
402
  for (const imported of definition.imports ?? []) {
403
403
  compileModule(imported, runtimeProviderTokens, compiled, visiting, ordered);
404
404
  }
package/dist/tokens.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { Container } from '@fluojs/di';
3
3
  import type { HttpApplicationAdapter } from '@fluojs/http';
4
4
  import type { ApplicationLogger } from './types.js';
5
5
  import type { CompiledModule } from './types.js';
6
+ import type { RuntimeCleanupRegistration } from './types.js';
6
7
  import type { PlatformShell } from './platform-contract.js';
7
8
  /**
8
9
  * Injection token for the application logger.
@@ -24,4 +25,8 @@ export declare const HTTP_APPLICATION_ADAPTER: Token<HttpApplicationAdapter>;
24
25
  * Injection token for the platform shell.
25
26
  */
26
27
  export declare const PLATFORM_SHELL: Token<PlatformShell>;
28
+ /**
29
+ * Internal injection token for registering runtime-owned cleanup callbacks.
30
+ */
31
+ export declare const RUNTIME_CLEANUP_REGISTRATION: Token<RuntimeCleanupRegistration>;
27
32
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CAAiD,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,SAAS,CAA+B,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,SAAS,cAAc,EAAE,CAA8B,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,sBAAsB,CAAsC,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,aAAa,CAA4B,CAAC"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CAAiD,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,SAAS,CAA+B,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,SAAS,cAAc,EAAE,CAA8B,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,sBAAsB,CAAsC,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,aAAa,CAA4B,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,0BAA0B,CAA0C,CAAC"}
package/dist/tokens.js CHANGED
@@ -21,4 +21,9 @@ export const HTTP_APPLICATION_ADAPTER = Symbol('HTTP_APPLICATION_ADAPTER');
21
21
  /**
22
22
  * Injection token for the platform shell.
23
23
  */
24
- export const PLATFORM_SHELL = Symbol('PLATFORM_SHELL');
24
+ export const PLATFORM_SHELL = Symbol('PLATFORM_SHELL');
25
+
26
+ /**
27
+ * Internal injection token for registering runtime-owned cleanup callbacks.
28
+ */
29
+ export const RUNTIME_CLEANUP_REGISTRATION = Symbol('RUNTIME_CLEANUP_REGISTRATION');
package/dist/types.d.ts CHANGED
@@ -81,6 +81,8 @@ export interface ApplicationLogger {
81
81
  log(message: string, context?: string): void;
82
82
  warn(message: string, context?: string): void;
83
83
  }
84
+ /** Registers runtime-owned cleanup callbacks that must run during bootstrap failure or shutdown. */
85
+ export type RuntimeCleanupRegistration = (cleanup: () => void) => () => void;
84
86
  /** Runtime-visible application states for HTTP and microservice shells. */
85
87
  export type ApplicationState = 'bootstrapped' | 'ready' | 'closed';
86
88
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IAAE,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC;AACzE,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AAEzC,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,uEAAuE;AACvE,MAAM,WAAW,sBAAsB;IACrC,uBAAuB,CAAC,EAAE,M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AC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,mBAAmB,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC3F,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IACjC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACpC,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,8EAA8E;AAC9E,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAEjC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjF"}
package/dist/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BadRequestException, createErrorResponse, HttpException, InternalServerErrorException, PayloadTooLargeException } from '@fluojs/http';
2
- import { attachFrameworkRequestNativeRouteHandoff, consumeRawRequestNativeRouteHandoff } from '@fluojs/http/internal';
2
+ import { attachRuntimeFrameworkRequestNativeRouteHandoff, consumeRuntimeRawRequestNativeRouteHandoff } from './internal/http-runtime.js';
3
3
  import { parseMultipart } from './multipart.js';
4
4
  import { dispatchWithRequestResponseFactory } from './adapters/request-response-factory.js';
5
5
  const DEFAULT_MAX_BODY_SIZE = 1 * 1024 * 1024;
@@ -296,8 +296,8 @@ function createDeferredWebFrameworkRequest(request, signal, multipartOptions, ma
296
296
  if (!hasRequestBody) {
297
297
  frameworkRequest.body = undefined;
298
298
  }
299
- const nativeRouteHandoff = consumeRawRequestNativeRouteHandoff(request);
300
- return nativeRouteHandoff ? attachFrameworkRequestNativeRouteHandoff(frameworkRequest, nativeRouteHandoff) : frameworkRequest;
299
+ const nativeRouteHandoff = consumeRuntimeRawRequestNativeRouteHandoff(request);
300
+ return nativeRouteHandoff ? attachRuntimeFrameworkRequestNativeRouteHandoff(frameworkRequest, nativeRouteHandoff) : frameworkRequest;
301
301
  }
302
302
  function createRequestWithSnapshotMetadata(request, url, method, headers) {
303
303
  const init = {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "module-graph",
10
10
  "orchestration"
11
11
  ],
12
- "version": "1.0.0-beta.10",
12
+ "version": "1.0.0-beta.12",
13
13
  "private": false,
14
14
  "license": "MIT",
15
15
  "repository": {
@@ -67,14 +67,14 @@
67
67
  "dist"
68
68
  ],
69
69
  "dependencies": {
70
- "@fluojs/di": "^1.0.0-beta.6",
71
- "@fluojs/config": "^1.0.0-beta.6",
72
- "@fluojs/http": "^1.0.0-beta.9",
73
- "@fluojs/core": "^1.0.0-beta.3"
70
+ "@fluojs/config": "^1.0.0-beta.8",
71
+ "@fluojs/core": "^1.0.0-beta.5",
72
+ "@fluojs/di": "^1.0.0-beta.7",
73
+ "@fluojs/http": "^1.0.0-beta.10"
74
74
  },
75
75
  "devDependencies": {
76
76
  "vitest": "^3.2.4",
77
- "@fluojs/serialization": "^1.0.0-beta.4"
77
+ "@fluojs/serialization": "^1.0.0-beta.6"
78
78
  },
79
79
  "scripts": {
80
80
  "prebuild": "node ../../tooling/scripts/clean-dist.mjs",