@revojs/bun 0.0.88 → 0.1.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/dist/index.d.ts CHANGED
@@ -1,2 +1,6 @@
1
- import { type Module } from "revojs";
2
- export declare function bun(): Module;
1
+ import { Module } from "revojs";
2
+
3
+ //#region src/index.d.ts
4
+ declare function bun(): Module;
5
+ //#endregion
6
+ export { bun };
package/dist/index.js CHANGED
@@ -1,8 +1,14 @@
1
+ import { useKit } from "revojs/vite";
2
+
1
3
  //#region src/index.ts
2
4
  function bun() {
3
- return { setup(app) {
4
- app.config.server.entry = "@revojs/bun/runtime";
5
- } };
5
+ return {
6
+ config: { externals: ["bun"] },
7
+ setup(app) {
8
+ const { toPath } = useKit(app, import.meta.url);
9
+ app.config.server = toPath("./module/server.ts");
10
+ }
11
+ };
6
12
  }
7
13
 
8
14
  //#endregion
@@ -0,0 +1,21 @@
1
+ import { serve } from "bun";
2
+ import { Scope, SERVER_CONTEXT } from "revojs";
3
+
4
+ serve({
5
+ async fetch(request) {
6
+ const server = await import("#virtual/server").then((module) => module.default);
7
+
8
+ const scope = new Scope();
9
+ try {
10
+ scope.setContext(SERVER_CONTEXT, {
11
+ request,
12
+ response: { headers: new Headers() },
13
+ variables: process.env,
14
+ });
15
+
16
+ return await server.fetch(scope);
17
+ } finally {
18
+ scope.stop();
19
+ }
20
+ },
21
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revojs/bun",
3
- "version": "0.0.88",
3
+ "version": "0.1.3",
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,18 +17,15 @@
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
- "@rolldown/binding-linux-x64-gnu": "*"
32
- },
33
26
  "devDependencies": {
34
27
  "@revojs/tsconfig": "*",
35
- "@types/bun": "^1.2.18",
36
- "rolldown": "^1.0.0-beta.19"
28
+ "@types/bun": "^1.2.22",
29
+ "tsdown": "^0.15.1"
37
30
  }
38
31
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import { serve } from "bun";
2
- import { RUNTIME_CONTEXT, Scope } from "revojs";
3
-
4
- //#region src/runtime/index.ts
5
- serve({ fetch: async (request) => {
6
- const { runtime } = await import("#virtual/runtime");
7
- const scope = new Scope();
8
- try {
9
- scope.setContext(RUNTIME_CONTEXT, {
10
- tasks: [],
11
- states: {},
12
- request,
13
- response: { headers: new Headers() },
14
- variables: process.env
15
- });
16
- return await runtime.fetch(scope);
17
- } finally {
18
- scope.stop();
19
- }
20
- } });
21
-
22
- //#endregion