@ruvyxa/adapter-bun 1.0.19 → 1.0.20
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 +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +93 -0
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,17 @@ export interface BunAdapterOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Create a Bun runtime deployment adapter for Ruvyxa.
|
|
11
11
|
*
|
|
12
|
-
* Produces
|
|
13
|
-
*
|
|
12
|
+
* Produces the same self-contained deployment the node adapter does — a
|
|
13
|
+
* compiled route registry, the request handler, and a `public/` directory —
|
|
14
|
+
* and runs it with `bun .ruvyxa/deploy/bun/server/index.mjs`. Bun implements
|
|
15
|
+
* `node:http`, `import.meta.dirname`, and the Web `Request`/`Response` classes
|
|
16
|
+
* the handler is written against, so the server source is shared rather than
|
|
17
|
+
* forked.
|
|
18
|
+
*
|
|
19
|
+
* Earlier releases emitted only a launcher that shelled out to
|
|
20
|
+
* `bunx ruvyxa start`, which meant a Bun host still needed the ruvyxa CLI and
|
|
21
|
+
* its native binary installed at runtime. The launcher is still emitted for
|
|
22
|
+
* that workflow; it is no longer the only option.
|
|
14
23
|
*
|
|
15
24
|
* @example
|
|
16
25
|
* ```ts
|
|
@@ -18,7 +27,7 @@ export interface BunAdapterOptions {
|
|
|
18
27
|
* import { bunAdapter } from "@ruvyxa/adapter-bun"
|
|
19
28
|
*
|
|
20
29
|
* export default config({
|
|
21
|
-
* adapter: bunAdapter(
|
|
30
|
+
* adapter: bunAdapter()
|
|
22
31
|
* })
|
|
23
32
|
* ```
|
|
24
33
|
*/
|
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;AAGxE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA+B,MAAM,cAAc,CAAA;AAGxE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAsDnE;eAEc,UAAU"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { clientBuildOutput, validateBuildContext } from '@ruvyxa/core';
|
|
1
|
+
import { clientBuildOutput, standaloneServerSource, validateBuildContext } from '@ruvyxa/core';
|
|
2
2
|
/**
|
|
3
3
|
* Create a Bun runtime deployment adapter for Ruvyxa.
|
|
4
4
|
*
|
|
5
|
-
* Produces
|
|
6
|
-
*
|
|
5
|
+
* Produces the same self-contained deployment the node adapter does — a
|
|
6
|
+
* compiled route registry, the request handler, and a `public/` directory —
|
|
7
|
+
* and runs it with `bun .ruvyxa/deploy/bun/server/index.mjs`. Bun implements
|
|
8
|
+
* `node:http`, `import.meta.dirname`, and the Web `Request`/`Response` classes
|
|
9
|
+
* the handler is written against, so the server source is shared rather than
|
|
10
|
+
* forked.
|
|
11
|
+
*
|
|
12
|
+
* Earlier releases emitted only a launcher that shelled out to
|
|
13
|
+
* `bunx ruvyxa start`, which meant a Bun host still needed the ruvyxa CLI and
|
|
14
|
+
* its native binary installed at runtime. The launcher is still emitted for
|
|
15
|
+
* that workflow; it is no longer the only option.
|
|
7
16
|
*
|
|
8
17
|
* @example
|
|
9
18
|
* ```ts
|
|
@@ -11,7 +20,7 @@ import { clientBuildOutput, validateBuildContext } from '@ruvyxa/core';
|
|
|
11
20
|
* import { bunAdapter } from "@ruvyxa/adapter-bun"
|
|
12
21
|
*
|
|
13
22
|
* export default config({
|
|
14
|
-
* adapter: bunAdapter(
|
|
23
|
+
* adapter: bunAdapter()
|
|
15
24
|
* })
|
|
16
25
|
* ```
|
|
17
26
|
*/
|
|
@@ -25,6 +34,7 @@ export function bunAdapter(options = {}) {
|
|
|
25
34
|
return {
|
|
26
35
|
name: 'bun',
|
|
27
36
|
target: 'node',
|
|
37
|
+
supports: ['ssr', 'ssg', 'csr', 'isr', 'ppr', 'api'],
|
|
28
38
|
build(ctx) {
|
|
29
39
|
validateBuildContext(ctx, 'bunAdapter');
|
|
30
40
|
return {
|
|
@@ -36,6 +46,15 @@ export function bunAdapter(options = {}) {
|
|
|
36
46
|
assetsDir: `${ctx.outDir}/assets`,
|
|
37
47
|
...clientBuildOutput(ctx),
|
|
38
48
|
artifacts: [
|
|
49
|
+
// Standalone server: compiled route registry + handler runtime
|
|
50
|
+
{
|
|
51
|
+
kind: 'function',
|
|
52
|
+
path: 'deploy/bun/server',
|
|
53
|
+
handlerSource: standaloneServerSource(),
|
|
54
|
+
},
|
|
55
|
+
// Static publish directory served by the standalone server. An
|
|
56
|
+
// API-only app has no prerendered pages; the server still runs.
|
|
57
|
+
{ kind: 'static-site', path: 'deploy/bun/public', optional: true },
|
|
39
58
|
{
|
|
40
59
|
kind: 'file',
|
|
41
60
|
path: 'deploy/bun/start.mjs',
|
|
@@ -44,7 +63,13 @@ export function bunAdapter(options = {}) {
|
|
|
44
63
|
{
|
|
45
64
|
kind: 'file',
|
|
46
65
|
path: 'deploy/bun/README.md',
|
|
47
|
-
contents: '# Ruvyxa Bun deployment\n\
|
|
66
|
+
contents: '# Ruvyxa Bun deployment\n\n' +
|
|
67
|
+
'Standalone (no ruvyxa runtime dependency):\n\n' +
|
|
68
|
+
'```bash\nbun .ruvyxa/deploy/bun/server/index.mjs\n```\n\n' +
|
|
69
|
+
'Honors `PORT` (default 3000) and `HOST` (default 0.0.0.0). Copy the\n' +
|
|
70
|
+
'`deploy/bun/` directory anywhere Bun runs and use the same command.\n\n' +
|
|
71
|
+
'Alternative, using the installed ruvyxa CLI:\n\n' +
|
|
72
|
+
'```bash\nbun .ruvyxa/deploy/bun/start.mjs\n```\n',
|
|
48
73
|
},
|
|
49
74
|
],
|
|
50
75
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAU9F;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,UAAU,CAAC,OAAO,GAAsB,EAAE;IACxD,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,uDAAuD,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAChG,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;IAC9E,CAAC;IAED,OAAO;QACL,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QACpD,KAAK,CAAC,GAAiB;YACrB,oBAAoB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;YACvC,OAAO;gBACL,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,GAAG,CAAC,MAAM,aAAa;gBAClD,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,SAAS;gBACjC,GAAG,iBAAiB,CAAC,GAAG,CAAC;gBACzB,SAAS,EAAE;oBACT,+DAA+D;oBAC/D;wBACE,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,mBAAmB;wBACzB,aAAa,EAAE,sBAAsB,EAAE;qBACxC;oBACD,+DAA+D;oBAC/D,gEAAgE;oBAChE,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAClE;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sBAAsB;wBAC5B,QAAQ,EAAE,+LAA+L;qBAC1M;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sBAAsB;wBAC5B,QAAQ,EACN,6BAA6B;4BAC7B,gDAAgD;4BAChD,2DAA2D;4BAC3D,uEAAuE;4BACvE,yEAAyE;4BACzE,kDAAkD;4BAClD,kDAAkD;qBACrD;iBACF;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-bun",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Run Ruvyxa on Bun-flavored hosts with typed adapter metadata for entrypoints and assets.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
+
"src",
|
|
11
12
|
"README.md"
|
|
12
13
|
],
|
|
13
14
|
"keywords": [
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
},
|
|
27
28
|
"homepage": "https://github.com/thirawat27/ruvyxa#readme",
|
|
28
29
|
"engines": {
|
|
29
|
-
"node": ">=22.
|
|
30
|
+
"node": ">=22.12.0"
|
|
30
31
|
},
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"@ruvyxa/core": "^1.0.
|
|
42
|
+
"@ruvyxa/core": "^1.0.20"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsc -p tsconfig.json",
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Adapter, AdapterOutput, BuildContext } from '@ruvyxa/core'
|
|
2
|
+
import { clientBuildOutput, standaloneServerSource, validateBuildContext } from '@ruvyxa/core'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Bun adapter.
|
|
6
|
+
*/
|
|
7
|
+
export interface BunAdapterOptions {
|
|
8
|
+
/** Custom entry point path. Defaults to `${outDir}/server/app`. */
|
|
9
|
+
entry?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create a Bun runtime deployment adapter for Ruvyxa.
|
|
14
|
+
*
|
|
15
|
+
* Produces the same self-contained deployment the node adapter does — a
|
|
16
|
+
* compiled route registry, the request handler, and a `public/` directory —
|
|
17
|
+
* and runs it with `bun .ruvyxa/deploy/bun/server/index.mjs`. Bun implements
|
|
18
|
+
* `node:http`, `import.meta.dirname`, and the Web `Request`/`Response` classes
|
|
19
|
+
* the handler is written against, so the server source is shared rather than
|
|
20
|
+
* forked.
|
|
21
|
+
*
|
|
22
|
+
* Earlier releases emitted only a launcher that shelled out to
|
|
23
|
+
* `bunx ruvyxa start`, which meant a Bun host still needed the ruvyxa CLI and
|
|
24
|
+
* its native binary installed at runtime. The launcher is still emitted for
|
|
25
|
+
* that workflow; it is no longer the only option.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { config } from "ruvyxa/config"
|
|
30
|
+
* import { bunAdapter } from "@ruvyxa/adapter-bun"
|
|
31
|
+
*
|
|
32
|
+
* export default config({
|
|
33
|
+
* adapter: bunAdapter()
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function bunAdapter(options: BunAdapterOptions = {}): Adapter {
|
|
38
|
+
if (options.entry !== undefined && typeof options.entry !== 'string') {
|
|
39
|
+
throw new Error(`[RUV2001] bunAdapter: "entry" must be a string, got ${typeof options.entry}`)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (options.entry !== undefined && options.entry.trim() === '') {
|
|
43
|
+
throw new Error(`[RUV2001] bunAdapter: "entry" must not be an empty string`)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
name: 'bun',
|
|
48
|
+
target: 'node',
|
|
49
|
+
supports: ['ssr', 'ssg', 'csr', 'isr', 'ppr', 'api'],
|
|
50
|
+
build(ctx: BuildContext): AdapterOutput {
|
|
51
|
+
validateBuildContext(ctx, 'bunAdapter')
|
|
52
|
+
return {
|
|
53
|
+
name: 'bun',
|
|
54
|
+
target: 'node',
|
|
55
|
+
platform: 'bun',
|
|
56
|
+
runtime: 'bun',
|
|
57
|
+
entry: options.entry ?? `${ctx.outDir}/server/app`,
|
|
58
|
+
assetsDir: `${ctx.outDir}/assets`,
|
|
59
|
+
...clientBuildOutput(ctx),
|
|
60
|
+
artifacts: [
|
|
61
|
+
// Standalone server: compiled route registry + handler runtime
|
|
62
|
+
{
|
|
63
|
+
kind: 'function',
|
|
64
|
+
path: 'deploy/bun/server',
|
|
65
|
+
handlerSource: standaloneServerSource(),
|
|
66
|
+
},
|
|
67
|
+
// Static publish directory served by the standalone server. An
|
|
68
|
+
// API-only app has no prerendered pages; the server still runs.
|
|
69
|
+
{ kind: 'static-site', path: 'deploy/bun/public', optional: true },
|
|
70
|
+
{
|
|
71
|
+
kind: 'file',
|
|
72
|
+
path: 'deploy/bun/start.mjs',
|
|
73
|
+
contents: `const child = Bun.spawn(['bunx', '--no-install', 'ruvyxa', 'start'], { cwd: process.cwd(), stdin: 'inherit', stdout: 'inherit', stderr: 'inherit' })\nprocess.exitCode = await child.exited\n`,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
kind: 'file',
|
|
77
|
+
path: 'deploy/bun/README.md',
|
|
78
|
+
contents:
|
|
79
|
+
'# Ruvyxa Bun deployment\n\n' +
|
|
80
|
+
'Standalone (no ruvyxa runtime dependency):\n\n' +
|
|
81
|
+
'```bash\nbun .ruvyxa/deploy/bun/server/index.mjs\n```\n\n' +
|
|
82
|
+
'Honors `PORT` (default 3000) and `HOST` (default 0.0.0.0). Copy the\n' +
|
|
83
|
+
'`deploy/bun/` directory anywhere Bun runs and use the same command.\n\n' +
|
|
84
|
+
'Alternative, using the installed ruvyxa CLI:\n\n' +
|
|
85
|
+
'```bash\nbun .ruvyxa/deploy/bun/start.mjs\n```\n',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default bunAdapter
|