@revojs/cloudflare 0.0.70

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.
@@ -0,0 +1,2 @@
1
+ import { type Module } from "revojs";
2
+ export declare function cloudflare(): Module;
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import { RUNTIME_CONTEXT, useRuntime } from "revojs";
2
+ import { getPlatformProxy } from "wrangler";
3
+
4
+ //#region src/index.ts
5
+ let proxy;
6
+ function cloudflare() {
7
+ return { setup(app) {
8
+ app.config.server.entry = "@revojs/cloudflare/runtime";
9
+ app.config.dev.middleware.push({ fetch: async (scope, next) => {
10
+ const { request, response } = useRuntime(scope);
11
+ proxy ??= await getPlatformProxy();
12
+ scope.setContext(RUNTIME_CONTEXT, {
13
+ tasks: new Array(),
14
+ request,
15
+ response,
16
+ variables: proxy.env
17
+ });
18
+ return next?.(scope);
19
+ } });
20
+ } };
21
+ }
22
+
23
+ //#endregion
24
+ export { cloudflare };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ fetch: (request: Request, variables: Record<string, unknown>) => Promise<Response>;
3
+ };
4
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { RUNTIME_CONTEXT, Scope } from "revojs";
2
+ import { runtime } from "#virtual/runtime";
3
+
4
+ //#region src/runtime/index.ts
5
+ var runtime_default = { fetch: async (request, variables) => {
6
+ const scope = new Scope();
7
+ scope.setContext(RUNTIME_CONTEXT, {
8
+ tasks: new Array(),
9
+ request,
10
+ response: { headers: new Headers() },
11
+ variables
12
+ });
13
+ return await runtime.fetch(scope).finally(() => scope.stop());
14
+ } };
15
+
16
+ //#endregion
17
+ export { runtime_default as default };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@revojs/cloudflare",
3
+ "version": "0.0.70",
4
+ "type": "module",
5
+ "repository": "coverbase/revojs",
6
+ "license": "MIT",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./runtime": {
13
+ "types": "./dist/runtime/index.d.ts",
14
+ "import": "./dist/runtime/index.js"
15
+ }
16
+ },
17
+ "types": "./dist/index.d.ts",
18
+ "module": "./dist/index.js",
19
+ "main": "./dist/index.js",
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "rolldown -c rolldown.config.ts && tsc",
25
+ "watch": "rolldown -w -c rolldown.config.ts && tsc --watch"
26
+ },
27
+ "dependencies": {
28
+ "revojs": "*",
29
+ "wrangler": "^4.24.3"
30
+ },
31
+ "optionalDependencies": {
32
+ "@rolldown/binding-linux-x64-gnu": "*"
33
+ },
34
+ "devDependencies": {
35
+ "@cloudflare/workers-types": "^4.20250712.0",
36
+ "@revojs/tsconfig": "*",
37
+ "rolldown": "^1.0.0-beta.19"
38
+ }
39
+ }