@fluojs/platform-deno 1.0.0 → 1.0.1

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
@@ -60,12 +60,21 @@ const response = await adapter.handle(new Request('http://localhost:3000/health'
60
60
  ```
61
61
 
62
62
  ### Deno 네이티브 WebSocket 지원
63
- 어댑터는 `@fluojs/websockets/deno` 바인딩을 통해 Deno의 네이티브 `Deno.upgradeWebSocket`을 지원합니다.
63
+ 어댑터는 애플리케이션이 `@fluojs/websockets/deno` 바인딩을 import하고 설정한 뒤에 Deno의 네이티브 `Deno.upgradeWebSocket`을 지원합니다. 해당 바인딩이 없으면 websocket upgrade 요청은 암묵적으로 upgrade되지 않고 일반 HTTP dispatch 경로를 계속 따릅니다.
64
64
 
65
65
  ```typescript
66
- // Deno 어댑터가 활성화된 경우 게이트웨이는 자동으로 Deno의 네이티브 업그레이드를 사용합니다.
66
+ import { Module } from '@fluojs/core';
67
+ import { WebSocketGateway } from '@fluojs/websockets';
68
+ import { DenoWebSocketModule } from '@fluojs/websockets/deno';
69
+
67
70
  @WebSocketGateway({ path: '/ws' })
68
71
  export class MyGateway {}
72
+
73
+ @Module({
74
+ imports: [DenoWebSocketModule.forRoot()],
75
+ providers: [MyGateway],
76
+ })
77
+ export class RealtimeModule {}
69
78
  ```
70
79
 
71
80
  ## HTTPS와 런타임 이식성
@@ -85,11 +94,11 @@ await runDenoApplication(AppModule, {
85
94
 
86
95
  `hostname`은 Deno 네이티브 옵션 이름으로 유지됩니다. 공유 HTTP 어댑터 테스트와 교차 런타임 설정 헬퍼를 위해 `host`도 이식성 alias로 허용하며, 둘 다 제공하면 `hostname`이 우선합니다.
87
96
 
88
- Advanced option에는 test 또는 non-hosted runtime을 위한 injectable `serve`, `upgradeWebSocket` seam, `rawBody`, `maxBodySize`, `multipart`, `shutdownSignals`가 포함됩니다. `runDenoApplication(...)`은 기본적으로 `SIGINT`/`SIGTERM`을 연결하고, `shutdownSignals: false`는 signal registration을 끕니다. Close는 active request drain을 최대 10초 기다립니다. `handle(...)`은 `listen()`이 dispatcher를 bind하기 전에는 JSON `500`, shutdown 진행 중에는 JSON `503`을 반환합니다.
97
+ Advanced option에는 test 또는 non-hosted runtime을 위한 injectable `serve`, `upgradeWebSocket` seam, `rawBody`, `maxBodySize`, `multipart`, `shutdownSignals`가 포함됩니다. Seam을 주입하지 않으면 어댑터는 listen/upgrade 시점에 `globalThis.Deno.serve`와 `globalThis.Deno.upgradeWebSocket`으로 fallback합니다. `runDenoApplication(...)`은 기본적으로 `SIGINT`/`SIGTERM`을 연결하고, `shutdownSignals: false`는 signal registration을 끕니다. Close는 Deno serve signal을 abort하기 전에 active request drain을 최대 10초 기다립니다. `handle(...)`은 `listen()`이 dispatcher를 bind하기 전에는 JSON `500`, shutdown 진행 중에는 JSON `503`을 반환합니다.
89
98
 
90
99
  ## Conformance 커버리지
91
100
 
92
- `packages/platform-deno/src/adapter.test.ts`는 문서화된 Deno 계약을 검증하는 package-local regression 대상입니다. 이 파일은 shared Web dispatch delegation, HTTPS startup forwarding, `SIGINT`/`SIGTERM` signal listener 등록과 정리, websocket upgrade binding, listen 전 `500` 처리, shutdown 중 `503` 처리, in-flight request drain, bounded 10초 close timeout을 검증합니다.
101
+ `packages/platform-deno/src/adapter.test.ts`는 문서화된 Deno 계약을 검증하는 package-local regression 대상입니다. 이 파일은 shared Web dispatch delegation, HTTPS startup forwarding, `SIGINT`/`SIGTERM` signal listener 등록과 정리, websocket upgrade binding, global Deno serve/upgrade fallback seam, listen 전 `500` 처리, shutdown 중 `503` 처리, serve-signal abort 전 in-flight request drain, bounded 10초 close timeout을 검증합니다.
93
102
 
94
103
  공유 edge portability suite인 `packages/testing/src/portability/web-runtime-adapter-portability.test.ts`는 Deno를 Bun 및 Cloudflare Workers와 함께 실행해 malformed cookie 보존, query decoding, JSON/text raw-body capture, multipart raw-body 제외, SSE framing을 검증합니다. 패키지 테스트의 README parity assertion은 이 edge-runtime 커버리지 문서가 한국어 mirror와 계속 동기화되도록 확인합니다.
95
104
 
package/README.md CHANGED
@@ -60,12 +60,21 @@ const response = await adapter.handle(new Request('http://localhost:3000/health'
60
60
  ```
61
61
 
62
62
  ### Deno-Native WebSocket Support
63
- The adapter supports Deno's native `Deno.upgradeWebSocket` through the `@fluojs/websockets/deno` binding.
63
+ The adapter supports Deno's native `Deno.upgradeWebSocket` after the application imports and configures the `@fluojs/websockets/deno` binding. Without that binding, websocket upgrade requests continue through normal HTTP dispatch instead of being upgraded implicitly.
64
64
 
65
65
  ```typescript
66
- // Gateways automatically use Deno's native upgrade when the Deno adapter is active
66
+ import { Module } from '@fluojs/core';
67
+ import { WebSocketGateway } from '@fluojs/websockets';
68
+ import { DenoWebSocketModule } from '@fluojs/websockets/deno';
69
+
67
70
  @WebSocketGateway({ path: '/ws' })
68
71
  export class MyGateway {}
72
+
73
+ @Module({
74
+ imports: [DenoWebSocketModule.forRoot()],
75
+ providers: [MyGateway],
76
+ })
77
+ export class RealtimeModule {}
69
78
  ```
70
79
 
71
80
  ## HTTPS and Runtime Portability
@@ -85,11 +94,11 @@ await runDenoApplication(AppModule, {
85
94
 
86
95
  `hostname` remains the Deno-native option name. The adapter also accepts `host` as a portability alias for shared HTTP adapter tests and cross-runtime configuration helpers; when both are provided, `hostname` wins.
87
96
 
88
- Advanced options include injectable `serve` and `upgradeWebSocket` seams for tests or non-hosted runtimes, `rawBody`, `maxBodySize`, `multipart`, and `shutdownSignals`. `runDenoApplication(...)` wires `SIGINT`/`SIGTERM` by default, `shutdownSignals: false` disables signal registration, and close waits up to 10 seconds for active requests to drain. `handle(...)` returns a JSON `500` before `listen()` binds the dispatcher and a JSON `503` while shutdown is in progress.
97
+ Advanced options include injectable `serve` and `upgradeWebSocket` seams for tests or non-hosted runtimes, `rawBody`, `maxBodySize`, `multipart`, and `shutdownSignals`. When a seam is not injected, the adapter falls back to `globalThis.Deno.serve` and `globalThis.Deno.upgradeWebSocket` at listen/upgrade time. `runDenoApplication(...)` wires `SIGINT`/`SIGTERM` by default, `shutdownSignals: false` disables signal registration, and close waits up to 10 seconds for active requests to drain before aborting the Deno serve signal. `handle(...)` returns a JSON `500` before `listen()` binds the dispatcher and a JSON `503` while shutdown is in progress.
89
98
 
90
99
  ## Conformance Coverage
91
100
 
92
- `packages/platform-deno/src/adapter.test.ts` is the package-local regression target for the documented Deno contract. It covers shared Web dispatch delegation, HTTPS startup forwarding, `SIGINT`/`SIGTERM` signal listener registration and cleanup, websocket upgrade binding, pre-listen `500` handling, shutdown `503` handling, in-flight request drain, and the bounded 10-second close timeout.
101
+ `packages/platform-deno/src/adapter.test.ts` is the package-local regression target for the documented Deno contract. It covers shared Web dispatch delegation, HTTPS startup forwarding, `SIGINT`/`SIGTERM` signal listener registration and cleanup, websocket upgrade binding, global Deno serve/upgrade fallback seams, pre-listen `500` handling, shutdown `503` handling, in-flight request drain before serve-signal abort, and the bounded 10-second close timeout.
93
102
 
94
103
  The shared edge portability suite in `packages/testing/src/portability/web-runtime-adapter-portability.test.ts` exercises Deno beside Bun and Cloudflare Workers for malformed cookie preservation, query decoding, JSON/text raw-body capture, multipart raw-body exclusion, and SSE framing. The README parity assertion in the package test keeps these documented edge-runtime coverage claims synchronized with the Korean mirror.
95
104
 
package/dist/adapter.js CHANGED
@@ -278,9 +278,12 @@ function isWebSocketUpgradeRequest(request) {
278
278
  }
279
279
  function closeDenoServerWithDrain(server, abortController, waitForDrain) {
280
280
  return (async () => {
281
- abortController?.abort();
282
- await server.shutdown();
283
- await waitForDrain();
281
+ try {
282
+ await server.shutdown();
283
+ await waitForDrain();
284
+ } finally {
285
+ abortController?.abort();
286
+ }
284
287
  await server.finished;
285
288
  })();
286
289
  }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "platform",
9
9
  "server"
10
10
  ],
11
- "version": "1.0.0",
11
+ "version": "1.0.1",
12
12
  "private": false,
13
13
  "license": "MIT",
14
14
  "repository": {
@@ -33,11 +33,11 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@fluojs/http": "^1.0.0",
36
- "@fluojs/runtime": "^1.0.0"
36
+ "@fluojs/runtime": "^1.0.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "vitest": "^3.2.4",
40
- "@fluojs/testing": "^1.0.0"
40
+ "@fluojs/testing": "^1.0.1"
41
41
  },
42
42
  "scripts": {
43
43
  "prebuild": "node ../../tooling/scripts/clean-dist.mjs",