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