@evjs/runtime 0.0.1-alpha.1 → 0.0.1-alpha.11
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/AGENT.md +78 -0
- package/README.md +89 -13
- package/esm/client/context.d.ts +25 -0
- package/esm/client/context.d.ts.map +1 -0
- package/esm/client/context.js +21 -0
- package/esm/client/context.js.map +1 -0
- package/esm/client/create-app.d.ts.map +1 -1
- package/esm/client/create-app.js +1 -0
- package/esm/client/create-app.js.map +1 -1
- package/esm/client/index.d.ts +7 -2
- package/esm/client/index.d.ts.map +1 -1
- package/esm/client/index.js +4 -1
- package/esm/client/index.js.map +1 -1
- package/esm/client/query.d.ts +68 -0
- package/esm/client/query.d.ts.map +1 -0
- package/esm/client/query.js +94 -0
- package/esm/client/query.js.map +1 -0
- package/esm/client/transport.d.ts +55 -0
- package/esm/client/transport.d.ts.map +1 -0
- package/esm/client/transport.js +88 -0
- package/esm/client/transport.js.map +1 -0
- package/esm/constants.d.ts +6 -0
- package/esm/constants.d.ts.map +1 -0
- package/esm/constants.js +6 -0
- package/esm/constants.js.map +1 -0
- package/esm/index.d.ts +3 -4
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +6 -4
- package/esm/index.js.map +1 -1
- package/esm/server/app.d.ts +9 -9
- package/esm/server/app.d.ts.map +1 -1
- package/esm/server/app.js +11 -12
- package/esm/server/app.js.map +1 -1
- package/esm/server/environments/ecma.d.ts +19 -0
- package/esm/server/environments/ecma.d.ts.map +1 -0
- package/esm/server/environments/ecma.js +20 -0
- package/esm/server/environments/ecma.js.map +1 -0
- package/esm/server/environments/node.d.ts +14 -0
- package/esm/server/environments/node.d.ts.map +1 -0
- package/esm/server/environments/node.js +31 -0
- package/esm/server/environments/node.js.map +1 -0
- package/esm/server/handler.d.ts +0 -11
- package/esm/server/handler.d.ts.map +1 -1
- package/esm/server/handler.js +1 -12
- package/esm/server/handler.js.map +1 -1
- package/esm/server/index.d.ts +13 -4
- package/esm/server/index.d.ts.map +1 -1
- package/esm/server/index.js +11 -3
- package/esm/server/index.js.map +1 -1
- package/esm/server/register.d.ts +22 -0
- package/esm/server/register.d.ts.map +1 -0
- package/esm/server/register.js +22 -0
- package/esm/server/register.js.map +1 -0
- package/package.json +33 -5
- package/esm/client/rpc.d.ts +0 -29
- package/esm/client/rpc.d.ts.map +0 -1
- package/esm/client/rpc.js +0 -45
- package/esm/client/rpc.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/client/transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAmDpD;;GAEG;AACH,SAAS,oBAAoB,CAC3B,OAAe,EACf,QAAgB;IAEhB,OAAO;QACL,KAAK,CAAC,IAAI,CACR,IAAY,EACZ,IAAe,EACf,OAAwB;YAExB,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAC;YAEpC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAC3B,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,GAAG,OAAO,EAAE,OAAO;iBACpB;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;gBACpC,MAAM,EAAE,OAAO,EAAE,MAAM;aACxB,CAAC,CAAC;YAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBAC1D,MAAM,IAAI,KAAK,CACb,yBAAyB,IAAI,aAAa,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CACjE,CAAC;YACJ,CAAC;YAED,MAAM,OAA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EAA2B;IACjD,OAAO,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,aAAa,CAAC"}
|
package/esm/constants.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC"}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @evjs/runtime
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Import from subpaths instead:
|
|
5
|
+
* - @evjs/runtime/client
|
|
6
|
+
* - @evjs/runtime/server
|
|
6
7
|
*/
|
|
7
|
-
export * as client from "./client/index";
|
|
8
|
-
export * as server from "./server/index";
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @evjs/runtime
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* Import from subpaths instead:
|
|
6
|
+
* - @evjs/runtime/client
|
|
7
|
+
* - @evjs/runtime/server
|
|
6
8
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
throw new Error('[ev] Do not import from "@evjs/runtime" directly. ' +
|
|
10
|
+
'Use "@evjs/runtime/client" or "@evjs/runtime/server" instead.');
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,MAAM,IAAI,KAAK,CACb,oDAAoD;IAClD,+DAA+D,CAClE,CAAC"}
|
package/esm/server/app.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server application factory.
|
|
3
3
|
*
|
|
4
|
-
* Creates a Hono app with RPC middleware
|
|
5
|
-
*
|
|
4
|
+
* Creates a Hono app with RPC middleware.
|
|
5
|
+
* This app is runtime-agnostic and can be mounted in Node, Edge, or Bun.
|
|
6
6
|
*/
|
|
7
7
|
import { Hono } from "hono";
|
|
8
|
-
/** Options for
|
|
9
|
-
export interface
|
|
8
|
+
/** Options for createApp. */
|
|
9
|
+
export interface CreateAppOptions {
|
|
10
10
|
/** Port to listen on. Defaults to 3001. */
|
|
11
11
|
port?: number;
|
|
12
12
|
/** RPC endpoint path. Defaults to "/api/rpc". */
|
|
13
13
|
rpcEndpoint?: string;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Create
|
|
16
|
+
* Create an ev API server application.
|
|
17
17
|
*
|
|
18
|
-
* Mounts the RPC middleware at `/api/rpc
|
|
18
|
+
* Mounts the RPC middleware at `/api/rpc`.
|
|
19
19
|
* In Stage 3, this will be extended with SSR middleware.
|
|
20
20
|
*
|
|
21
|
-
* @param options -
|
|
22
|
-
* @returns
|
|
21
|
+
* @param options - Application configuration.
|
|
22
|
+
* @returns A runtime-agnostic Hono app instance.
|
|
23
23
|
*/
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function createApp(options?: CreateAppOptions): Hono;
|
|
25
25
|
//# sourceMappingURL=app.d.ts.map
|
package/esm/server/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/server/app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/server/app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,6BAA6B;AAC7B,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAY1D"}
|
package/esm/server/app.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server application factory.
|
|
3
3
|
*
|
|
4
|
-
* Creates a Hono app with RPC middleware
|
|
5
|
-
*
|
|
4
|
+
* Creates a Hono app with RPC middleware.
|
|
5
|
+
* This app is runtime-agnostic and can be mounted in Node, Edge, or Bun.
|
|
6
6
|
*/
|
|
7
7
|
import { Hono } from "hono";
|
|
8
|
-
import {
|
|
8
|
+
import { DEFAULT_RPC_ENDPOINT } from "../constants";
|
|
9
9
|
import { createRpcMiddleware } from "./handler";
|
|
10
10
|
/**
|
|
11
|
-
* Create
|
|
11
|
+
* Create an ev API server application.
|
|
12
12
|
*
|
|
13
|
-
* Mounts the RPC middleware at `/api/rpc
|
|
13
|
+
* Mounts the RPC middleware at `/api/rpc`.
|
|
14
14
|
* In Stage 3, this will be extended with SSR middleware.
|
|
15
15
|
*
|
|
16
|
-
* @param options -
|
|
17
|
-
* @returns
|
|
16
|
+
* @param options - Application configuration.
|
|
17
|
+
* @returns A runtime-agnostic Hono app instance.
|
|
18
18
|
*/
|
|
19
|
-
export function
|
|
20
|
-
const {
|
|
19
|
+
export function createApp(options) {
|
|
20
|
+
const { rpcEndpoint = DEFAULT_RPC_ENDPOINT } = options ?? {};
|
|
21
21
|
const app = new Hono();
|
|
22
|
+
// Health check for load balancers / container orchestrators
|
|
23
|
+
app.get("/health", (c) => c.json({ status: "ok" }));
|
|
22
24
|
// Mount RPC endpoint
|
|
23
25
|
app.route(rpcEndpoint, createRpcMiddleware());
|
|
24
|
-
serve({ fetch: app.fetch, port }, (info) => {
|
|
25
|
-
console.log(`ev server running at http://localhost:${info.port}`);
|
|
26
|
-
});
|
|
27
26
|
return app;
|
|
28
27
|
}
|
|
29
28
|
//# sourceMappingURL=app.js.map
|
package/esm/server/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/server/app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/server/app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAUhD;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,OAA0B;IAClD,MAAM,EAAE,WAAW,GAAG,oBAAoB,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE7D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,4DAA4D;IAC5D,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAEpD,qBAAqB;IACrB,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAE9C,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Hono } from "hono";
|
|
2
|
+
/**
|
|
3
|
+
* ECMA-standard environment adapter.
|
|
4
|
+
*
|
|
5
|
+
* Exports the Hono app's fetch handler as a standard ECMA-compatible
|
|
6
|
+
* module. Works in any runtime that supports the Fetch API standard
|
|
7
|
+
* (Deno, Bun, Cloudflare Workers, Vercel Edge, etc.).
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```ts
|
|
11
|
+
* import app from "./dist/server/index.js";
|
|
12
|
+
* import { createHandler } from "@evjs/runtime/server/ecma";
|
|
13
|
+
* export default createHandler(app);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function createHandler(app: Hono): {
|
|
17
|
+
fetch: (request: Request, Env?: unknown, executionCtx?: import("hono").ExecutionContext) => Response | Promise<Response>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ecma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecma.d.ts","sourceRoot":"","sources":["../../../src/server/environments/ecma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,IAAI;;EAItC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECMA-standard environment adapter.
|
|
3
|
+
*
|
|
4
|
+
* Exports the Hono app's fetch handler as a standard ECMA-compatible
|
|
5
|
+
* module. Works in any runtime that supports the Fetch API standard
|
|
6
|
+
* (Deno, Bun, Cloudflare Workers, Vercel Edge, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```ts
|
|
10
|
+
* import app from "./dist/server/index.js";
|
|
11
|
+
* import { createHandler } from "@evjs/runtime/server/ecma";
|
|
12
|
+
* export default createHandler(app);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function createHandler(app) {
|
|
16
|
+
return {
|
|
17
|
+
fetch: app.fetch,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ecma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecma.js","sourceRoot":"","sources":["../../../src/server/environments/ecma.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,GAAS;IACrC,OAAO;QACL,KAAK,EAAE,GAAG,CAAC,KAAK;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Hono } from "hono";
|
|
2
|
+
export interface NodeRunnerOptions {
|
|
3
|
+
port?: number;
|
|
4
|
+
host?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Runner plugin for Node.js environments.
|
|
8
|
+
* Takes a compiled Hono app and starts a native Node HTTP server.
|
|
9
|
+
*
|
|
10
|
+
* Port resolution order: options.port → PORT env → 3001 default.
|
|
11
|
+
* Registers SIGTERM/SIGINT handlers for graceful shutdown.
|
|
12
|
+
*/
|
|
13
|
+
export declare function runNodeServer(app: Hono, options?: NodeRunnerOptions): import("@hono/node-server").ServerType;
|
|
14
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/server/environments/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAIjC,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,iBAAiB,0CAsBnE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { serve } from "@hono/node-server";
|
|
2
|
+
import { getLogger } from "@logtape/logtape";
|
|
3
|
+
const logger = getLogger(["evjs", "server"]);
|
|
4
|
+
/**
|
|
5
|
+
* Runner plugin for Node.js environments.
|
|
6
|
+
* Takes a compiled Hono app and starts a native Node HTTP server.
|
|
7
|
+
*
|
|
8
|
+
* Port resolution order: options.port → PORT env → 3001 default.
|
|
9
|
+
* Registers SIGTERM/SIGINT handlers for graceful shutdown.
|
|
10
|
+
*/
|
|
11
|
+
export function runNodeServer(app, options) {
|
|
12
|
+
const port = options?.port || Number(process.env.PORT) || 3001;
|
|
13
|
+
const hostname = options?.host;
|
|
14
|
+
const server = serve({ fetch: app.fetch, port, hostname }, (info) => {
|
|
15
|
+
const address = info.address === "0.0.0.0" || info.address === "::"
|
|
16
|
+
? "localhost"
|
|
17
|
+
: info.address;
|
|
18
|
+
logger.info `Server API ready at http://${address}:${info.port}`;
|
|
19
|
+
});
|
|
20
|
+
// Graceful shutdown for container/orchestrator environments
|
|
21
|
+
const shutdown = () => {
|
|
22
|
+
logger.info `Shutting down server...`;
|
|
23
|
+
server.close(() => process.exit(0));
|
|
24
|
+
// Force exit after 10 seconds if connections don't drain
|
|
25
|
+
setTimeout(() => process.exit(1), 10_000).unref();
|
|
26
|
+
};
|
|
27
|
+
process.on("SIGTERM", shutdown);
|
|
28
|
+
process.on("SIGINT", shutdown);
|
|
29
|
+
return server;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","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EAAE,QAAQ,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/esm/server/handler.d.ts
CHANGED
|
@@ -6,16 +6,6 @@
|
|
|
6
6
|
* `POST /api/rpc` requests and dispatches them to the correct function.
|
|
7
7
|
*/
|
|
8
8
|
import { Hono } from "hono";
|
|
9
|
-
/** A registered server function. */
|
|
10
|
-
type ServerFn = (...args: unknown[]) => Promise<unknown>;
|
|
11
|
-
/**
|
|
12
|
-
* Register a server function so it can be invoked via RPC.
|
|
13
|
-
* Called automatically by the Webpack-transformed server bundles at load time.
|
|
14
|
-
*
|
|
15
|
-
* @param fnId - The unique ID for this function.
|
|
16
|
-
* @param fn - The actual function implementation.
|
|
17
|
-
*/
|
|
18
|
-
export declare function registerServerFn(fnId: string, fn: ServerFn): void;
|
|
19
9
|
/**
|
|
20
10
|
* Create a Hono sub-app that handles RPC requests.
|
|
21
11
|
*
|
|
@@ -25,5 +15,4 @@ export declare function registerServerFn(fnId: string, fn: ServerFn): void;
|
|
|
25
15
|
* @returns A Hono app to be mounted at the desired path (e.g. `/api/rpc`).
|
|
26
16
|
*/
|
|
27
17
|
export declare function createRpcMiddleware(): Hono;
|
|
28
|
-
export {};
|
|
29
18
|
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/server/handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/server/handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAwB1C"}
|
package/esm/server/handler.js
CHANGED
|
@@ -6,18 +6,7 @@
|
|
|
6
6
|
* `POST /api/rpc` requests and dispatches them to the correct function.
|
|
7
7
|
*/
|
|
8
8
|
import { Hono } from "hono";
|
|
9
|
-
|
|
10
|
-
const registry = new Map();
|
|
11
|
-
/**
|
|
12
|
-
* Register a server function so it can be invoked via RPC.
|
|
13
|
-
* Called automatically by the Webpack-transformed server bundles at load time.
|
|
14
|
-
*
|
|
15
|
-
* @param fnId - The unique ID for this function.
|
|
16
|
-
* @param fn - The actual function implementation.
|
|
17
|
-
*/
|
|
18
|
-
export function registerServerFn(fnId, fn) {
|
|
19
|
-
registry.set(fnId, fn);
|
|
20
|
-
}
|
|
9
|
+
import { registry } from "./register";
|
|
21
10
|
/**
|
|
22
11
|
* Create a Hono sub-app that handles RPC requests.
|
|
23
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/server/handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/server/handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACxB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,EAGnC,CAAC;QAEL,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oBAAoB,IAAI,aAAa,EAAE,EAAE,GAAG,CAAC,CAAC;QACvE,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;YACzC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/esm/server/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Server-side runtime utilities.
|
|
2
|
+
* Server-side runtime utilities (environment-agnostic).
|
|
3
|
+
*
|
|
4
|
+
* For environment-specific adapters, use:
|
|
5
|
+
* - @evjs/runtime/server/node
|
|
6
|
+
* - @evjs/runtime/server/ecma
|
|
7
|
+
*
|
|
8
|
+
* For minimal function registration (no Hono), use:
|
|
9
|
+
* - @evjs/runtime/server/register
|
|
3
10
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
11
|
+
export type { CreateAppOptions } from "./app";
|
|
12
|
+
export { createApp } from "./app";
|
|
13
|
+
export { registerServerFn } from "./register";
|
|
14
|
+
export type { ServerFn } from "./register";
|
|
15
|
+
export { createRpcMiddleware } from "./handler";
|
|
7
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
package/esm/server/index.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Server-side runtime utilities.
|
|
2
|
+
* Server-side runtime utilities (environment-agnostic).
|
|
3
|
+
*
|
|
4
|
+
* For environment-specific adapters, use:
|
|
5
|
+
* - @evjs/runtime/server/node
|
|
6
|
+
* - @evjs/runtime/server/ecma
|
|
7
|
+
*
|
|
8
|
+
* For minimal function registration (no Hono), use:
|
|
9
|
+
* - @evjs/runtime/server/register
|
|
3
10
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
11
|
+
export { createApp } from "./app";
|
|
12
|
+
export { registerServerFn } from "./register";
|
|
13
|
+
export { createRpcMiddleware } from "./handler";
|
|
6
14
|
//# sourceMappingURL=index.js.map
|
package/esm/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal server function registry.
|
|
3
|
+
*
|
|
4
|
+
* This module is intentionally decoupled from the framework runtime
|
|
5
|
+
* (Hono, RPC handler, etc.) so that the webpack server bundle only
|
|
6
|
+
* contains user-defined functions + this tiny registry.
|
|
7
|
+
*
|
|
8
|
+
* The framework runtime imports FROM this module to read the registry.
|
|
9
|
+
*/
|
|
10
|
+
/** A registered server function. */
|
|
11
|
+
export type ServerFn = (...args: unknown[]) => Promise<unknown>;
|
|
12
|
+
/** Internal registry mapping function IDs to implementations. */
|
|
13
|
+
export declare const registry: Map<string, ServerFn>;
|
|
14
|
+
/**
|
|
15
|
+
* Register a server function so it can be invoked via RPC.
|
|
16
|
+
* Called automatically by the Webpack-transformed server bundles at load time.
|
|
17
|
+
*
|
|
18
|
+
* @param fnId - The unique ID for this function.
|
|
19
|
+
* @param fn - The actual function implementation.
|
|
20
|
+
*/
|
|
21
|
+
export declare function registerServerFn(fnId: string, fn: ServerFn): void;
|
|
22
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/server/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oCAAoC;AACpC,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhE,iEAAiE;AACjE,eAAO,MAAM,QAAQ,uBAA8B,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI,CAEjE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal server function registry.
|
|
3
|
+
*
|
|
4
|
+
* This module is intentionally decoupled from the framework runtime
|
|
5
|
+
* (Hono, RPC handler, etc.) so that the webpack server bundle only
|
|
6
|
+
* contains user-defined functions + this tiny registry.
|
|
7
|
+
*
|
|
8
|
+
* The framework runtime imports FROM this module to read the registry.
|
|
9
|
+
*/
|
|
10
|
+
/** Internal registry mapping function IDs to implementations. */
|
|
11
|
+
export const registry = new Map();
|
|
12
|
+
/**
|
|
13
|
+
* Register a server function so it can be invoked via RPC.
|
|
14
|
+
* Called automatically by the Webpack-transformed server bundles at load time.
|
|
15
|
+
*
|
|
16
|
+
* @param fnId - The unique ID for this function.
|
|
17
|
+
* @param fn - The actual function implementation.
|
|
18
|
+
*/
|
|
19
|
+
export function registerServerFn(fnId, fn) {
|
|
20
|
+
registry.set(fnId, fn);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/server/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,iEAAiE;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,EAAY;IACzD,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evjs/runtime",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@hono/node-server": "^1.19.11",
|
|
7
|
+
"@logtape/logtape": "^2.0.4",
|
|
7
8
|
"@tanstack/react-query": "^5.90.21",
|
|
8
9
|
"@tanstack/react-router": "^1.163.3",
|
|
9
10
|
"hono": "^4.12.5"
|
|
@@ -26,18 +27,44 @@
|
|
|
26
27
|
"license": "MIT",
|
|
27
28
|
"author": "xusd320",
|
|
28
29
|
"type": "module",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
29
33
|
"exports": {
|
|
30
34
|
".": {
|
|
31
35
|
"types": "./esm/index.d.ts",
|
|
32
|
-
"import": "./esm/index.js"
|
|
36
|
+
"import": "./esm/index.js",
|
|
37
|
+
"default": "./esm/index.js"
|
|
33
38
|
},
|
|
34
39
|
"./client": {
|
|
35
40
|
"types": "./esm/client/index.d.ts",
|
|
36
|
-
"import": "./esm/client/index.js"
|
|
41
|
+
"import": "./esm/client/index.js",
|
|
42
|
+
"default": "./esm/client/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./client/transport": {
|
|
45
|
+
"types": "./esm/client/transport.d.ts",
|
|
46
|
+
"import": "./esm/client/transport.js",
|
|
47
|
+
"default": "./esm/client/transport.js"
|
|
37
48
|
},
|
|
38
49
|
"./server": {
|
|
39
50
|
"types": "./esm/server/index.d.ts",
|
|
40
|
-
"import": "./esm/server/index.js"
|
|
51
|
+
"import": "./esm/server/index.js",
|
|
52
|
+
"default": "./esm/server/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./server/register": {
|
|
55
|
+
"types": "./esm/server/register.d.ts",
|
|
56
|
+
"import": "./esm/server/register.js",
|
|
57
|
+
"default": "./esm/server/register.js"
|
|
58
|
+
},
|
|
59
|
+
"./server/node": {
|
|
60
|
+
"types": "./esm/server/environments/node.d.ts",
|
|
61
|
+
"import": "./esm/server/environments/node.js",
|
|
62
|
+
"default": "./esm/server/environments/node.js"
|
|
63
|
+
},
|
|
64
|
+
"./server/ecma": {
|
|
65
|
+
"types": "./esm/server/environments/ecma.d.ts",
|
|
66
|
+
"import": "./esm/server/environments/ecma.js",
|
|
67
|
+
"default": "./esm/server/environments/ecma.js"
|
|
41
68
|
}
|
|
42
69
|
},
|
|
43
70
|
"scripts": {
|
|
@@ -46,6 +73,7 @@
|
|
|
46
73
|
"prepublishOnly": "npm run build"
|
|
47
74
|
},
|
|
48
75
|
"files": [
|
|
49
|
-
"esm"
|
|
76
|
+
"esm",
|
|
77
|
+
"AGENT.md"
|
|
50
78
|
]
|
|
51
79
|
}
|
package/esm/client/rpc.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side RPC helper for calling server functions.
|
|
3
|
-
*
|
|
4
|
-
* When the Webpack loader transforms a `"use server"` module for the client
|
|
5
|
-
* bundle, each exported function is replaced with a stub that calls
|
|
6
|
-
* `__ev_rpc(fnId, args)`. This module provides that helper.
|
|
7
|
-
*/
|
|
8
|
-
export interface RpcOptions {
|
|
9
|
-
/** Base URL for the RPC endpoint. Defaults to the current origin. */
|
|
10
|
-
baseUrl?: string;
|
|
11
|
-
/** Path prefix for the RPC endpoint. Defaults to `/api/rpc`. */
|
|
12
|
-
endpoint?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Configure the RPC client. Call once at app startup if you need to
|
|
16
|
-
* customise the endpoint URL.
|
|
17
|
-
*/
|
|
18
|
-
export declare function configureRpc(options: RpcOptions): void;
|
|
19
|
-
/**
|
|
20
|
-
* Call a server function by its unique ID.
|
|
21
|
-
*
|
|
22
|
-
* @param fnId - The unique identifier assigned to the server function by the
|
|
23
|
-
* Webpack loader (e.g. `"user_server_getUser"`).
|
|
24
|
-
* @param args - The arguments to pass to the server function. Must be
|
|
25
|
-
* JSON-serializable.
|
|
26
|
-
* @returns A promise that resolves with the server function's return value.
|
|
27
|
-
*/
|
|
28
|
-
export declare function __ev_rpc(fnId: string, args: unknown[]): Promise<unknown>;
|
|
29
|
-
//# sourceMappingURL=rpc.d.ts.map
|
package/esm/client/rpc.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/client/rpc.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAEtD;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAqB9E"}
|
package/esm/client/rpc.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side RPC helper for calling server functions.
|
|
3
|
-
*
|
|
4
|
-
* When the Webpack loader transforms a `"use server"` module for the client
|
|
5
|
-
* bundle, each exported function is replaced with a stub that calls
|
|
6
|
-
* `__ev_rpc(fnId, args)`. This module provides that helper.
|
|
7
|
-
*/
|
|
8
|
-
let _options = {
|
|
9
|
-
baseUrl: "",
|
|
10
|
-
endpoint: "/api/rpc",
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Configure the RPC client. Call once at app startup if you need to
|
|
14
|
-
* customise the endpoint URL.
|
|
15
|
-
*/
|
|
16
|
-
export function configureRpc(options) {
|
|
17
|
-
_options = { ..._options, ...options };
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Call a server function by its unique ID.
|
|
21
|
-
*
|
|
22
|
-
* @param fnId - The unique identifier assigned to the server function by the
|
|
23
|
-
* Webpack loader (e.g. `"user_server_getUser"`).
|
|
24
|
-
* @param args - The arguments to pass to the server function. Must be
|
|
25
|
-
* JSON-serializable.
|
|
26
|
-
* @returns A promise that resolves with the server function's return value.
|
|
27
|
-
*/
|
|
28
|
-
export async function __ev_rpc(fnId, args) {
|
|
29
|
-
const url = `${_options.baseUrl}${_options.endpoint}`;
|
|
30
|
-
const res = await fetch(url, {
|
|
31
|
-
method: "POST",
|
|
32
|
-
headers: { "Content-Type": "application/json" },
|
|
33
|
-
body: JSON.stringify({ fnId, args }),
|
|
34
|
-
});
|
|
35
|
-
if (!res.ok) {
|
|
36
|
-
const text = await res.text().catch(() => res.statusText);
|
|
37
|
-
throw new Error(`[ev/rpc] Server function "${fnId}" failed (${res.status}): ${text}`);
|
|
38
|
-
}
|
|
39
|
-
const payload = await res.json();
|
|
40
|
-
if (payload.error) {
|
|
41
|
-
throw new Error(`[ev/rpc] Server function "${fnId}" threw: ${payload.error}`);
|
|
42
|
-
}
|
|
43
|
-
return payload.result;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=rpc.js.map
|
package/esm/client/rpc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../src/client/rpc.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,IAAI,QAAQ,GAAyB;IACnC,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAmB;IAC9C,QAAQ,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;AACzC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,IAAe;IAC1D,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEtD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;KACrC,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,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