@ruvyxa/adapter-cloudflare 1.0.30 → 1.1.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.md CHANGED
@@ -1,6 +1,22 @@
1
- # @ruvyxa/adapter-cloudflare
1
+ <p align="center">
2
+ <a href="https://github.com/thirawat27/Ruvyxa">
3
+ <img src="https://raw.githubusercontent.com/thirawat27/Ruvyxa/main/assets/branding/ruvyxa.png" alt="Ruvyxa" width="140" height="140" />
4
+ </a>
5
+ </p>
2
6
 
3
- Cloudflare Workers deployment adapter for Ruvyxa production builds.
7
+ <h1 align="center">@ruvyxa/adapter-cloudflare</h1>
8
+
9
+ <p align="center">
10
+ Cloudflare Workers deployment adapter for Ruvyxa production builds.
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://www.npmjs.com/package/@ruvyxa/adapter-cloudflare"><img src="https://img.shields.io/npm/v/@ruvyxa/adapter-cloudflare?style=flat-square" alt="npm version" /></a>
15
+ <a href="https://www.npmjs.com/package/@ruvyxa/adapter-cloudflare"><img src="https://img.shields.io/node/v/@ruvyxa/adapter-cloudflare?style=flat-square&label=node" alt="Supported Node version" /></a>
16
+ <img src="https://img.shields.io/badge/license-Apache%202.0-green?style=flat-square" alt="License" />
17
+ </p>
18
+
19
+ ---
4
20
 
5
21
  ## Install
6
22
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAgD,MAAM,cAAc,CAAA;AASzF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAsED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAgG1E;eAEc,UAAU"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAgD,MAAM,cAAc,CAAA;AASzF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAyFD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAkG1E;eAEc,UAAU"}
package/dist/index.js CHANGED
@@ -5,6 +5,21 @@ import { clientBuildOutput, headersFileContents, projectRelativeOutDir, runtimeB
5
5
  * Bump only together with a check of the Workers runtime changes it opts into.
6
6
  */
7
7
  const DEFAULT_COMPATIBILITY_DATE = '2025-09-01';
8
+ /**
9
+ * Node.js compatibility, which this Worker genuinely depends on.
10
+ *
11
+ * `runtime/request-context.mjs` reaches for `node:async_hooks` and falls back
12
+ * to a single-slot store when the runtime has none. That fallback refuses a
13
+ * second concurrent render rather than risk serving one visitor's page to
14
+ * another, so on Workers every app that calls `cookies()`, `headers()`, or
15
+ * `draftMode()` while rendering failed as soon as two requests overlapped.
16
+ *
17
+ * Cloudflare enables the Node.js APIs without a flag only from compatibility
18
+ * date `2026-08-04`; between `2024-09-23` and that date they are behind
19
+ * `nodejs_compat`, which is the range `DEFAULT_COMPATIBILITY_DATE` sits in.
20
+ * The flag stays harmless once the date is raised past the cutoff.
21
+ */
22
+ const COMPATIBILITY_FLAGS = ['nodejs_compat'];
8
23
  /**
9
24
  * Worker fetch handler source code.
10
25
  *
@@ -17,7 +32,7 @@ const DEFAULT_COMPATIBILITY_DATE = '2025-09-01';
17
32
  */
18
33
  function workerHandlerSource(runtimePolicy) {
19
34
  return `import { createHandler } from './serverless-handler.mjs';
20
- import { loadRouteModule } from './route-modules.mjs';
35
+ import { applyPluginHttp, loadActionModule, loadRouteModule } from './route-modules.mjs';
21
36
  // A JS module, not a JSON import: import attributes for JSON are not uniformly
22
37
  // available across bundlers and Worker compatibility dates.
23
38
  import manifest from './manifest.mjs';
@@ -48,6 +63,9 @@ const handler = createHandler({
48
63
  optimizeImage: runtimePolicy.image?.onDemand === true ? optimizeImage : undefined,
49
64
  importPage: loadRouteModule,
50
65
  importApi: loadRouteModule,
66
+ importAction: loadActionModule,
67
+ pluginHttp: applyPluginHttp,
68
+ security: runtimePolicy.security,
51
69
  readPrerendered: (pathname) => {
52
70
  // In Workers, pre-rendered pages are served as static assets.
53
71
  // ISR revalidation requires KV or Durable Objects (not yet supported).
@@ -105,12 +123,14 @@ export function cloudflare(options = {}) {
105
123
  name: 'ruvyxa-app',
106
124
  main: './worker/index.mjs',
107
125
  compatibility_date: compatDate,
126
+ compatibility_flags: COMPATIBILITY_FLAGS,
108
127
  assets: { directory: './assets' },
109
128
  }, null, 2);
110
129
  const projectWranglerConfig = JSON.stringify({
111
130
  name: 'ruvyxa-app',
112
131
  main: `${relativeOutDir}/deploy/cloudflare/worker/index.mjs`,
113
132
  compatibility_date: compatDate,
133
+ compatibility_flags: COMPATIBILITY_FLAGS,
114
134
  assets: { directory: `${relativeOutDir}/deploy/cloudflare/assets` },
115
135
  }, null, 2);
116
136
  return {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAA;AA+BrB;;;;GAIG;AACH,MAAM,0BAA0B,GAAG,YAAY,CAAA;AAE/C;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CA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oE;oBACpE,sBAAsB;oBACtB,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACzE,2CAA2C;oBAC3C;wBACE,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,0BAA0B;wBAChC,aAAa,EAAE,mBAAmB,CAAC,aAAa,CAAC;qBAClD;oBACD,kDAAkD;oBAClD;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,kCAAkC;wBACxC,QAAQ,EAAE,cAAc,GAAG,IAAI;qBAChC;oBACD;wBACE,gEAAgE;wBAChE,kEAAkE;wBAClE,mEAAmE;wBACnE,sDAAsD;wBACtD,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,mCAAmC;wBACzC,QAAQ,EAAE,mBAAmB,EAAE;qBAChC;oBACD,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,IAAI;wBAChC,CAAC,CAAC;4BACE;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,gBAAgB;gCACtB,KAAK,EAAE,SAAS;gCAChB,YAAY,EAAE,IAAI;gCAClB,QAAQ,EAAE,qBAAqB,GAAG,IAAI;6BACb;yBAC5B;wBACH,CAAC,CAAC,EAAE,CAAC;iBACR;aACF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruvyxa/adapter-cloudflare",
3
- "version": "1.0.30",
3
+ "version": "1.1.0",
4
4
  "description": "Shape Ruvyxa builds for Cloudflare edge targets with typed worker and asset output metadata.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -14,20 +14,40 @@
14
14
  "keywords": [
15
15
  "ruvyxa",
16
16
  "adapter",
17
+ "deploy",
18
+ "deployment",
19
+ "hosting",
20
+ "build",
17
21
  "cloudflare",
18
- "edge"
22
+ "cloudflare-workers",
23
+ "workers",
24
+ "worker",
25
+ "wrangler",
26
+ "edge",
27
+ "edge-runtime",
28
+ "edge-computing",
29
+ "serverless",
30
+ "cdn",
31
+ "prerender",
32
+ "ssr",
33
+ "ssg",
34
+ "static-assets",
35
+ "typescript",
36
+ "fullstack",
37
+ "framework",
38
+ "csr"
19
39
  ],
20
40
  "repository": {
21
41
  "type": "git",
22
- "url": "git+https://github.com/thirawat27/ruvyxa.git",
42
+ "url": "git+https://github.com/thirawat27/Ruvyxa.git",
23
43
  "directory": "packages/@ruvyxa/adapter-cloudflare"
24
44
  },
25
45
  "bugs": {
26
- "url": "https://github.com/thirawat27/ruvyxa/issues"
46
+ "url": "https://github.com/thirawat27/Ruvyxa/issues"
27
47
  },
28
- "homepage": "https://github.com/thirawat27/ruvyxa#readme",
48
+ "homepage": "https://github.com/thirawat27/Ruvyxa#readme",
29
49
  "engines": {
30
- "node": ">=22.13.0"
50
+ "node": ">=24.19.0"
31
51
  },
32
52
  "publishConfig": {
33
53
  "access": "public"
@@ -39,7 +59,7 @@
39
59
  }
40
60
  },
41
61
  "dependencies": {
42
- "@ruvyxa/core": "^1.0.30"
62
+ "@ruvyxa/core": "^1.1.0"
43
63
  },
44
64
  "scripts": {
45
65
  "build": "tsc -p tsconfig.json",
package/src/index.ts CHANGED
@@ -43,6 +43,22 @@ export interface CloudflareAdapterOptions {
43
43
  */
44
44
  const DEFAULT_COMPATIBILITY_DATE = '2025-09-01'
45
45
 
46
+ /**
47
+ * Node.js compatibility, which this Worker genuinely depends on.
48
+ *
49
+ * `runtime/request-context.mjs` reaches for `node:async_hooks` and falls back
50
+ * to a single-slot store when the runtime has none. That fallback refuses a
51
+ * second concurrent render rather than risk serving one visitor's page to
52
+ * another, so on Workers every app that calls `cookies()`, `headers()`, or
53
+ * `draftMode()` while rendering failed as soon as two requests overlapped.
54
+ *
55
+ * Cloudflare enables the Node.js APIs without a flag only from compatibility
56
+ * date `2026-08-04`; between `2024-09-23` and that date they are behind
57
+ * `nodejs_compat`, which is the range `DEFAULT_COMPATIBILITY_DATE` sits in.
58
+ * The flag stays harmless once the date is raised past the cutoff.
59
+ */
60
+ const COMPATIBILITY_FLAGS = ['nodejs_compat']
61
+
46
62
  /**
47
63
  * Worker fetch handler source code.
48
64
  *
@@ -55,7 +71,7 @@ const DEFAULT_COMPATIBILITY_DATE = '2025-09-01'
55
71
  */
56
72
  function workerHandlerSource(runtimePolicy: unknown): string {
57
73
  return `import { createHandler } from './serverless-handler.mjs';
58
- import { loadRouteModule } from './route-modules.mjs';
74
+ import { applyPluginHttp, loadActionModule, loadRouteModule } from './route-modules.mjs';
59
75
  // A JS module, not a JSON import: import attributes for JSON are not uniformly
60
76
  // available across bundlers and Worker compatibility dates.
61
77
  import manifest from './manifest.mjs';
@@ -86,6 +102,9 @@ const handler = createHandler({
86
102
  optimizeImage: runtimePolicy.image?.onDemand === true ? optimizeImage : undefined,
87
103
  importPage: loadRouteModule,
88
104
  importApi: loadRouteModule,
105
+ importAction: loadActionModule,
106
+ pluginHttp: applyPluginHttp,
107
+ security: runtimePolicy.security,
89
108
  readPrerendered: (pathname) => {
90
109
  // In Workers, pre-rendered pages are served as static assets.
91
110
  // ISR revalidation requires KV or Durable Objects (not yet supported).
@@ -151,6 +170,7 @@ export function cloudflare(options: CloudflareAdapterOptions = {}): Adapter {
151
170
  name: 'ruvyxa-app',
152
171
  main: './worker/index.mjs',
153
172
  compatibility_date: compatDate,
173
+ compatibility_flags: COMPATIBILITY_FLAGS,
154
174
  assets: { directory: './assets' },
155
175
  },
156
176
  null,
@@ -162,6 +182,7 @@ export function cloudflare(options: CloudflareAdapterOptions = {}): Adapter {
162
182
  name: 'ruvyxa-app',
163
183
  main: `${relativeOutDir}/deploy/cloudflare/worker/index.mjs`,
164
184
  compatibility_date: compatDate,
185
+ compatibility_flags: COMPATIBILITY_FLAGS,
165
186
  assets: { directory: `${relativeOutDir}/deploy/cloudflare/assets` },
166
187
  },
167
188
  null,