@ruvyxa/adapter-cloudflare 1.0.1 → 1.0.3
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 +28 -2
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
# @ruvyxa/adapter-cloudflare
|
|
2
2
|
|
|
3
|
-
Cloudflare edge deployment adapter
|
|
3
|
+
Cloudflare edge deployment adapter metadata for Ruvyxa production builds.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ruvyxa/adapter-cloudflare
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
4
12
|
|
|
5
13
|
```ts
|
|
14
|
+
import { defineConfig } from "ruvyxa/config"
|
|
6
15
|
import { cloudflareAdapter } from "@ruvyxa/adapter-cloudflare"
|
|
7
16
|
|
|
8
|
-
export default
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
adapter: cloudflareAdapter(),
|
|
19
|
+
})
|
|
9
20
|
```
|
|
21
|
+
|
|
22
|
+
## Output Metadata
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"name": "cloudflare",
|
|
27
|
+
"target": "edge",
|
|
28
|
+
"platform": "cloudflare",
|
|
29
|
+
"entry": ".ruvyxa/server/app",
|
|
30
|
+
"assetsDir": ".ruvyxa/assets",
|
|
31
|
+
"configFiles": ["wrangler.toml"]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use this adapter for Cloudflare Workers and Pages-style edge deployments.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import type { Adapter } from "@ruvyxa/core";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the Cloudflare Workers adapter.
|
|
4
|
+
*/
|
|
2
5
|
export interface CloudflareAdapterOptions {
|
|
6
|
+
/** Custom worker entry point path. Defaults to `${outDir}/server/app`. */
|
|
3
7
|
workerEntry?: string;
|
|
4
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Create a Cloudflare Workers deployment adapter for Ruvyxa.
|
|
11
|
+
*
|
|
12
|
+
* Produces an edge-compatible worker bundle and static assets ready for
|
|
13
|
+
* deployment via `wrangler`. Generates a `wrangler.toml` config reference.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { defineConfig } from "ruvyxa/config"
|
|
18
|
+
* import { cloudflareAdapter } from "@ruvyxa/adapter-cloudflare"
|
|
19
|
+
*
|
|
20
|
+
* export default defineConfig({
|
|
21
|
+
* adapter: cloudflareAdapter({ workerEntry: "./src/worker.ts" })
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
5
25
|
export declare function cloudflareAdapter(options?: CloudflareAdapterOptions): Adapter;
|
|
6
26
|
export default cloudflareAdapter;
|
|
7
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA+B,MAAM,cAAc,CAAA;AAExE,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA+B,MAAM,cAAc,CAAA;AAExE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CA4BjF;AAED,eAAe,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a Cloudflare Workers deployment adapter for Ruvyxa.
|
|
3
|
+
*
|
|
4
|
+
* Produces an edge-compatible worker bundle and static assets ready for
|
|
5
|
+
* deployment via `wrangler`. Generates a `wrangler.toml` config reference.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { defineConfig } from "ruvyxa/config"
|
|
10
|
+
* import { cloudflareAdapter } from "@ruvyxa/adapter-cloudflare"
|
|
11
|
+
*
|
|
12
|
+
* export default defineConfig({
|
|
13
|
+
* adapter: cloudflareAdapter({ workerEntry: "./src/worker.ts" })
|
|
14
|
+
* })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
1
17
|
export function cloudflareAdapter(options = {}) {
|
|
18
|
+
if (options.workerEntry !== undefined && typeof options.workerEntry !== "string") {
|
|
19
|
+
throw new Error(`[RUV2001] cloudflareAdapter: "workerEntry" must be a string, got ${typeof options.workerEntry}`);
|
|
20
|
+
}
|
|
21
|
+
if (options.workerEntry !== undefined && options.workerEntry.trim() === "") {
|
|
22
|
+
throw new Error(`[RUV2001] cloudflareAdapter: "workerEntry" must not be an empty string`);
|
|
23
|
+
}
|
|
2
24
|
return {
|
|
3
25
|
name: "cloudflare",
|
|
4
26
|
target: "edge",
|
|
5
27
|
build(ctx) {
|
|
28
|
+
validateBuildContext(ctx, "cloudflareAdapter");
|
|
6
29
|
return {
|
|
7
30
|
name: "cloudflare",
|
|
8
31
|
target: "edge",
|
|
@@ -15,4 +38,12 @@ export function cloudflareAdapter(options = {}) {
|
|
|
15
38
|
};
|
|
16
39
|
}
|
|
17
40
|
export default cloudflareAdapter;
|
|
41
|
+
function validateBuildContext(ctx, adapterName) {
|
|
42
|
+
if (!ctx.root || typeof ctx.root !== "string") {
|
|
43
|
+
throw new Error(`[RUV2000] ${adapterName}: BuildContext.root is required and must be a non-empty string`);
|
|
44
|
+
}
|
|
45
|
+
if (!ctx.outDir || typeof ctx.outDir !== "string") {
|
|
46
|
+
throw new Error(`[RUV2000] ${adapterName}: BuildContext.outDir is required and must be a non-empty string`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
18
49
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAoC,EAAE;IACtE,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CACb,oEAAoE,OAAO,OAAO,CAAC,WAAW,EAAE,CACjG,CAAA;IACH,CAAC;IAED,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,MAAM;QACd,KAAK,CAAC,GAAiB;YACrB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;YAC9C,OAAO;gBACL,IAAI,EAAE,YAAY;gBAClB,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,YAAY;gBACtB,KAAK,EAAE,OAAO,CAAC,WAAW,IAAI,GAAG,GAAG,CAAC,MAAM,aAAa;gBACxD,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,SAAS;gBACjC,WAAW,EAAE,CAAC,eAAe,CAAC;aAC/B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,iBAAiB,CAAA;AAEhC,SAAS,oBAAoB,CAAC,GAAiB,EAAE,WAAmB;IAClE,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,aAAa,WAAW,gEAAgE,CACzF,CAAA;IACH,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,aAAa,WAAW,kEAAkE,CAC3F,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruvyxa/adapter-cloudflare",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Shape Ruvyxa builds for Cloudflare edge targets with typed worker and asset output metadata.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/thirawat27/ruvyxa#readme",
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
29
|
+
"node": ">=22.0.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@ruvyxa/core": "^1.0.
|
|
41
|
+
"@ruvyxa/core": "^1.0.3"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc -p tsconfig.json",
|
|
45
45
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
46
|
-
"test": "
|
|
46
|
+
"test": "node --test \"../../../tests/packages/adapter-cloudflare/**/*.test.ts\"",
|
|
47
47
|
"format": "tsc -p tsconfig.json --noEmit"
|
|
48
48
|
}
|
|
49
49
|
}
|