@fluojs/platform-cloudflare-workers 1.0.0-beta.2 → 1.0.0-beta.4
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 +17 -1
- package/README.md +17 -1
- package/dist/adapter.d.ts +1 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -1
- package/package.json +3 -3
package/README.ko.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
- [사용 시점](#사용-시점)
|
|
11
11
|
- [빠른 시작](#빠른-시작)
|
|
12
12
|
- [주요 패턴](#주요-패턴)
|
|
13
|
+
- [Conformance 커버리지](#conformance-커버리지)
|
|
13
14
|
- [공개 API 개요](#공개-api-개요)
|
|
14
15
|
- [관련 패키지](#관련-패키지)
|
|
15
16
|
- [예제 소스](#예제-소스)
|
|
@@ -67,7 +68,7 @@ export default {
|
|
|
67
68
|
## 주요 패턴
|
|
68
69
|
|
|
69
70
|
### WebSocketPair 활용
|
|
70
|
-
어댑터는 `@fluojs/websockets/cloudflare-workers` 바인딩을 통해 실시간 통신을 위한 Cloudflare의 네이티브 `WebSocketPair`를 지원합니다.
|
|
71
|
+
어댑터는 `@fluojs/websockets/cloudflare-workers` 바인딩을 통해 실시간 통신을 위한 Cloudflare의 네이티브 `WebSocketPair`를 지원합니다. Upgrade handling은 해당 binding을 통한 opt-in이며, non-hosted runtime test에서는 `createWebSocketPair`를 주입할 수 있습니다.
|
|
71
72
|
|
|
72
73
|
```typescript
|
|
73
74
|
@WebSocketGateway({ path: '/ws' })
|
|
@@ -84,12 +85,27 @@ const adapter = createCloudflareWorkerAdapter({
|
|
|
84
85
|
});
|
|
85
86
|
```
|
|
86
87
|
|
|
88
|
+
### 동작 참고
|
|
89
|
+
|
|
90
|
+
- `fetch()`는 active work를 `executionContext.waitUntil(...)`에 등록합니다.
|
|
91
|
+
- `close()`는 shutdown 중 새 요청에 JSON `503` response를 반환하고, active request가 끝나지 않으면 10초 뒤 timeout됩니다.
|
|
92
|
+
- Multipart request는 `rawBody`를 보존하지 않습니다.
|
|
93
|
+
- Worker `env` 객체는 fetch entrypoint boundary를 통과하며, package-level config resolution은 application이 소유합니다.
|
|
94
|
+
|
|
95
|
+
## Conformance 커버리지
|
|
96
|
+
|
|
97
|
+
`packages/platform-cloudflare-workers/src/adapter.test.ts`는 문서화된 Worker 계약을 검증하는 package-local regression 대상입니다. 이 파일은 shared Web dispatch delegation, `executionContext.waitUntil(...)` 등록, websocket upgrade binding, lazy entrypoint 재사용, shutdown gating, close 중 JSON `503` response, bounded 10초 close timeout을 검증합니다.
|
|
98
|
+
|
|
99
|
+
공유 edge portability suite인 `packages/testing/src/portability/web-runtime-adapter-portability.test.ts`는 Cloudflare Workers를 Bun 및 Deno와 함께 실행해 malformed cookie 보존, query decoding, JSON/text raw-body capture, multipart raw-body 제외, SSE framing을 검증합니다. 패키지 테스트의 README parity assertion은 이 edge-runtime 커버리지 문서가 한국어 mirror와 계속 동기화되도록 확인합니다.
|
|
100
|
+
|
|
87
101
|
## 공개 API 개요
|
|
88
102
|
|
|
89
103
|
- `createCloudflareWorkerAdapter(options)`: Worker HTTP 어댑터를 위한 팩토리입니다.
|
|
90
104
|
- `createCloudflareWorkerEntrypoint(module, options)`: 지연 부트스트랩 방식의 Worker 엔트리포인트를 생성합니다.
|
|
91
105
|
- `bootstrapCloudflareWorkerApplication(module, options)`: Worker를 위한 비동기 부트스트랩 헬퍼입니다.
|
|
92
106
|
- `CloudflareWorkerHttpApplicationAdapter`: 핵심 어댑터 구현 클래스입니다.
|
|
107
|
+
- `CloudflareWorkerEntrypoint`: `fetch`, `ready()`, `close()` lifecycle method를 제공하는 lazy entrypoint입니다.
|
|
108
|
+
- Option 및 type: `CloudflareWorkerAdapterOptions`, `BootstrapCloudflareWorkerApplicationOptions`, `CloudflareWorkerExecutionContext`, `CloudflareWorkerWebSocketBinding`, Worker websocket pair/upgrade type.
|
|
93
109
|
|
|
94
110
|
## 관련 패키지
|
|
95
111
|
|
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Cloudflare Workers HTTP adapter for the fluo runtime, optimized for the edge.
|
|
|
10
10
|
- [When to Use](#when-to-use)
|
|
11
11
|
- [Quick Start](#quick-start)
|
|
12
12
|
- [Common Patterns](#common-patterns)
|
|
13
|
+
- [Conformance Coverage](#conformance-coverage)
|
|
13
14
|
- [Public API Overview](#public-api-overview)
|
|
14
15
|
- [Related Packages](#related-packages)
|
|
15
16
|
- [Example Sources](#example-sources)
|
|
@@ -67,7 +68,7 @@ export default {
|
|
|
67
68
|
## Common Patterns
|
|
68
69
|
|
|
69
70
|
### Working with WebSocketPairs
|
|
70
|
-
The adapter supports Cloudflare's native `WebSocketPair` for real-time communication via the `@fluojs/websockets/cloudflare-workers` binding.
|
|
71
|
+
The adapter supports Cloudflare's native `WebSocketPair` for real-time communication via the `@fluojs/websockets/cloudflare-workers` binding. Upgrade handling is opt-in through that binding, and `createWebSocketPair` can be injected for non-hosted runtime tests.
|
|
71
72
|
|
|
72
73
|
```typescript
|
|
73
74
|
@WebSocketGateway({ path: '/ws' })
|
|
@@ -84,12 +85,27 @@ const adapter = createCloudflareWorkerAdapter({
|
|
|
84
85
|
});
|
|
85
86
|
```
|
|
86
87
|
|
|
88
|
+
### Behavior Notes
|
|
89
|
+
|
|
90
|
+
- `fetch()` registers active work with `executionContext.waitUntil(...)`.
|
|
91
|
+
- `close()` returns JSON `503` responses for new requests during shutdown and times out after 10 seconds if active requests never settle.
|
|
92
|
+
- Multipart requests do not preserve `rawBody`.
|
|
93
|
+
- The Worker `env` object is passed through the fetch entrypoint boundary; package-level config resolution remains application-owned.
|
|
94
|
+
|
|
95
|
+
## Conformance Coverage
|
|
96
|
+
|
|
97
|
+
`packages/platform-cloudflare-workers/src/adapter.test.ts` is the package-local regression target for the documented Worker contract. It covers shared Web dispatch delegation, `executionContext.waitUntil(...)` registration, websocket upgrade binding, lazy entrypoint reuse, shutdown gating, JSON `503` responses while closing, and the bounded 10-second close timeout.
|
|
98
|
+
|
|
99
|
+
The shared edge portability suite in `packages/testing/src/portability/web-runtime-adapter-portability.test.ts` exercises Cloudflare Workers beside Bun and Deno 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.
|
|
100
|
+
|
|
87
101
|
## Public API Overview
|
|
88
102
|
|
|
89
103
|
- `createCloudflareWorkerAdapter(options)`: Factory for the Worker HTTP adapter.
|
|
90
104
|
- `createCloudflareWorkerEntrypoint(module, options)`: Creates a lazy-bootstrapping Worker entrypoint.
|
|
91
105
|
- `bootstrapCloudflareWorkerApplication(module, options)`: Async bootstrap helper for Workers.
|
|
92
106
|
- `CloudflareWorkerHttpApplicationAdapter`: The core adapter implementation.
|
|
107
|
+
- `CloudflareWorkerEntrypoint`: Lazy entrypoint with `fetch`, `ready()`, and `close()` lifecycle methods.
|
|
108
|
+
- Options and types: `CloudflareWorkerAdapterOptions`, `BootstrapCloudflareWorkerApplicationOptions`, `CloudflareWorkerExecutionContext`, `CloudflareWorkerWebSocketBinding`, and Worker websocket pair/upgrade types.
|
|
93
109
|
|
|
94
110
|
## Related Packages
|
|
95
111
|
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Dispatcher, type HttpApplicationAdapter } from '@fluojs/http';
|
|
1
|
+
import { type Dispatcher, type HttpApplicationAdapter } from '@fluojs/http/internal';
|
|
2
2
|
import { type BootstrapHttpAdapterApplicationOptions } from '@fluojs/runtime/internal/http-adapter';
|
|
3
3
|
import type { Application, ModuleType, UploadedFile } from '@fluojs/runtime';
|
|
4
4
|
import { type CreateWebRequestResponseFactoryOptions } from '@fluojs/runtime/web';
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,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AAG,OAAO,EAC5D,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,2CAAgD,GACxD,0BAA0B,CAAC,GAAG,CAAC,CA6DjC;AAmGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,YAAY;QACpB,SAAS,CAAC,EAAE,yBAAyB,CAAC;KACvC;IAED,UAAU,UAAU;QAClB,aAAa,CAAC,EAAE,UAAU,6BAA6B,CAAC;KACzD;CACF"}
|
package/dist/adapter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createFetchStyleHttpAdapterRealtimeCapability } from '@fluojs/http';
|
|
1
|
+
import { createFetchStyleHttpAdapterRealtimeCapability } from '@fluojs/http/internal';
|
|
2
2
|
import { bootstrapHttpAdapterApplication } from '@fluojs/runtime/internal/http-adapter';
|
|
3
3
|
import { createWebRequestResponseFactory, dispatchWebRequest } from '@fluojs/runtime/web';
|
|
4
4
|
const WORKER_DISPATCHER_NOT_READY_MESSAGE = 'Cloudflare Workers adapter received a request before dispatcher binding completed.';
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"platform",
|
|
10
10
|
"fetch"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.0-beta.
|
|
12
|
+
"version": "1.0.0-beta.4",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fluojs/http": "^1.0.0-beta.
|
|
37
|
-
"@fluojs/runtime": "^1.0.0-beta.
|
|
36
|
+
"@fluojs/http": "^1.0.0-beta.11",
|
|
37
|
+
"@fluojs/runtime": "^1.0.0-beta.12"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"vitest": "^3.2.4"
|