@evjs/runtime 0.0.1-alpha.6 → 0.0.1-alpha.8

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.
Files changed (46) hide show
  1. package/AGENT.md +66 -0
  2. package/README.md +65 -14
  3. package/esm/client/context.d.ts +25 -0
  4. package/esm/client/context.d.ts.map +1 -0
  5. package/esm/client/context.js +21 -0
  6. package/esm/client/context.js.map +1 -0
  7. package/esm/client/create-app.d.ts.map +1 -1
  8. package/esm/client/create-app.js +1 -0
  9. package/esm/client/create-app.js.map +1 -1
  10. package/esm/client/index.d.ts +4 -2
  11. package/esm/client/index.d.ts.map +1 -1
  12. package/esm/client/index.js +2 -2
  13. package/esm/client/index.js.map +1 -1
  14. package/esm/client/query.d.ts +0 -4
  15. package/esm/client/query.d.ts.map +1 -1
  16. package/esm/client/query.js +0 -18
  17. package/esm/client/query.js.map +1 -1
  18. package/esm/client/transport.d.ts +50 -0
  19. package/esm/client/transport.d.ts.map +1 -0
  20. package/esm/client/transport.js +71 -0
  21. package/esm/client/transport.js.map +1 -0
  22. package/esm/constants.d.ts +6 -0
  23. package/esm/constants.d.ts.map +1 -0
  24. package/esm/constants.js +6 -0
  25. package/esm/constants.js.map +1 -0
  26. package/esm/server/app.d.ts +9 -9
  27. package/esm/server/app.d.ts.map +1 -1
  28. package/esm/server/app.js +9 -12
  29. package/esm/server/app.js.map +1 -1
  30. package/esm/server/environments/node.d.ts +11 -0
  31. package/esm/server/environments/node.d.ts.map +1 -0
  32. package/esm/server/environments/node.js +19 -0
  33. package/esm/server/environments/node.js.map +1 -0
  34. package/esm/server/index.d.ts +4 -2
  35. package/esm/server/index.d.ts.map +1 -1
  36. package/esm/server/index.js +2 -1
  37. package/esm/server/index.js.map +1 -1
  38. package/package.json +8 -2
  39. package/esm/client/rpc.d.ts +0 -29
  40. package/esm/client/rpc.d.ts.map +0 -1
  41. package/esm/client/rpc.js +0 -45
  42. package/esm/client/rpc.js.map +0 -1
  43. package/esm/version.d.ts +0 -2
  44. package/esm/version.d.ts.map +0 -1
  45. package/esm/version.js +0 -2
  46. package/esm/version.js.map +0 -1
package/AGENT.md ADDED
@@ -0,0 +1,66 @@
1
+ # @evjs/runtime
2
+
3
+ Core runtime for the ev React framework. Provides client-side routing, data fetching, and server-side handling.
4
+
5
+ ## Client API (`@evjs/runtime/client`)
6
+
7
+ ### App Bootstrap
8
+ - `createApp({ routeTree, routerOptions?, queryClientConfig? })` — Bootstrap Router + Query + DOM. Injects `queryClient` into router context.
9
+ - `createAppRootRoute(options)` — Create root route with typed `context.queryClient` for route loaders.
10
+
11
+ ### Server Function Proxies
12
+ Always use these instead of raw `useQuery`/`useMutation` for server functions:
13
+
14
+ ```tsx
15
+ import { query, mutation, createQueryProxy, createMutationProxy } from "@evjs/runtime/client";
16
+ import { getUsers, createUser } from "./api/users.server";
17
+
18
+ // Direct wrapper
19
+ const { data } = query(getUsers).useQuery([]);
20
+ const { mutate } = mutation(createUser).useMutation();
21
+
22
+ // Module proxy
23
+ const api = { query: createQueryProxy({ getUsers }), mutation: createMutationProxy({ createUser }) };
24
+ api.query.getUsers.useQuery([]);
25
+
26
+ // queryOptions (for loaders, prefetch)
27
+ const opts = query(getUsers).queryOptions([]);
28
+ queryClient.ensureQueryData(opts);
29
+
30
+ // Query key (for invalidation)
31
+ queryClient.invalidateQueries({ queryKey: query(getUsers).queryKey() });
32
+ ```
33
+
34
+ ### Route Loader Pattern
35
+ ```tsx
36
+ const rootRoute = createAppRootRoute({ component: Root });
37
+ const usersRoute = createRoute({
38
+ getParentRoute: () => rootRoute,
39
+ path: "/users",
40
+ loader: ({ context }) =>
41
+ context.queryClient.ensureQueryData(query(getUsers).queryOptions([])),
42
+ component: UsersPage,
43
+ });
44
+ ```
45
+
46
+ ### Routing (re-exports from @tanstack/react-router)
47
+ `createRootRoute`, `createRoute`, `createRouter`, `Link`, `Outlet`, `Navigate`, `useParams`, `useSearch`, `useNavigate`, `useLocation`, `useMatch`, `useLoaderData`, `redirect`, `notFound`, `lazyRouteComponent`
48
+
49
+ ### Data (re-exports from @tanstack/react-query)
50
+ `useQuery`, `useMutation`, `useQueryClient`, `useSuspenseQuery`, `QueryClient`, `QueryClientProvider`
51
+
52
+ ### Transport
53
+ ```tsx
54
+ import { configureTransport } from "@evjs/runtime/client";
55
+ configureTransport({ transport: { send: async (fnId, args) => { /* custom */ } } });
56
+ ```
57
+
58
+ ## Server API (`@evjs/runtime/server`)
59
+
60
+ - `createApp(options?)` — Create Hono app with RPC middleware.
61
+ - `runNodeServer(app, { port?, host? })` — Start on Node.js (default port 3001).
62
+ - `registerServerFn(fnId, fn)` — Register server function (called by build-tools).
63
+ - `createRpcMiddleware()` — Standalone Hono RPC sub-app.
64
+
65
+ ## Server Functions
66
+ Files must start with `"use server";`, use named async exports, and end in `.server.ts`.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @evjs/runtime
2
2
 
3
- Core runtime for the **ev** framework. It provides isomorphic utilities for client-side routing, state management, and server-side RPC handling via Hono.
3
+ Core runtime for the **ev** framework. Provides client-side routing, data fetching, and server-side handling via Hono.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,40 +8,91 @@ Core runtime for the **ev** framework. It provides isomorphic utilities for clie
8
8
  npm install @evjs/runtime
9
9
  ```
10
10
 
11
- ## Features
11
+ ## Exports
12
12
 
13
- - **`createApp`**: A unified factory to bootstrap TanStack Router + Query.
14
- - **Routing**: Re-exports the full power of `@tanstack/react-router`.
15
- - **RPC**: Internal logic for calling `"use server"` functions from the client.
16
- - **Hono Server**: `createServer()` starts a Hono-based API server for RPC.
13
+ ### `@evjs/runtime/client`
14
+
15
+ | Export | Description |
16
+ |--------|-------------|
17
+ | `createApp` | Bootstrap TanStack Router + Query + DOM |
18
+ | `query(fn)` | Universal query proxy for server functions |
19
+ | `mutation(fn)` | Universal mutation proxy for server functions |
20
+ | `createQueryProxy(module)` | Module-level query proxy |
21
+ | `createMutationProxy(module)` | Module-level mutation proxy |
22
+ | `configureTransport` | Set custom transport (fetch, axios, WebSocket) |
23
+ | `createRootRoute`, `createRoute`, `Link`, `Outlet`, ... | Re-exports from `@tanstack/react-router` |
24
+ | `useQuery`, `useMutation`, `useQueryClient`, ... | Re-exports from `@tanstack/react-query` |
25
+
26
+ ### `@evjs/runtime/server`
27
+
28
+ | Export | Description |
29
+ |--------|-------------|
30
+ | `createApp` | Create a Hono app with RPC middleware |
31
+ | `runNodeServer` | Start the app on Node.js (default port 3001) |
32
+ | `registerServerFn` | Register a server function in the RPC registry |
33
+ | `createRpcMiddleware` | Standalone Hono sub-app for RPC dispatch |
17
34
 
18
35
  ## Usage
19
36
 
20
- ### Client Entry
37
+ ### Client
21
38
 
22
39
  ```tsx
23
40
  import { createApp, createRootRoute, query, mutation } from "@evjs/runtime/client";
24
41
  import { getUsers, createUser } from "./api/users.server";
25
42
 
26
- // Using the Query Proxy
27
43
  function Users() {
28
44
  const { data } = query(getUsers).useQuery([]);
29
45
  const { mutate } = mutation(createUser).useMutation();
30
- // ...
31
46
  }
32
47
 
33
48
  const rootRoute = createRootRoute({ component: Root });
34
49
  const app = createApp({ routeTree: rootRoute });
35
-
36
50
  app.render("#app");
37
51
  ```
38
52
 
39
- ### Server Entry
53
+ ### Server
54
+
55
+ The server app is a runtime-agnostic Hono instance. Use a Runner to start it:
56
+
57
+ ```ts
58
+ import { createApp, runNodeServer } from "@evjs/runtime/server";
59
+
60
+ const app = createApp();
61
+ runNodeServer(app, { port: 3001 });
62
+ ```
63
+
64
+ In development, `ev dev` with `runner` configured in `EvWebpackPlugin` handles this automatically.
65
+
66
+ ### Custom Transport
40
67
 
41
68
  ```ts
42
- import { createServer } from "@evjs/runtime/server";
69
+ import { configureTransport } from "@evjs/runtime/client";
43
70
 
44
- createServer(); // Starts Hono-based RPC server on port 3001
71
+ configureTransport({
72
+ transport: {
73
+ send: async (fnId, args) => {
74
+ const { data } = await axios.post("/api/rpc", { fnId, args });
75
+ return data.result;
76
+ },
77
+ },
78
+ });
45
79
  ```
46
80
 
47
- The Hono server is automatically started and watched by the `ev dev` command. Server functions are auto-discovered by `EvWebpackPlugin` and registered at the `/api/rpc` endpoint — providing a zero-config, low-latency development experience.
81
+ ### Query Proxy Patterns
82
+
83
+ ```tsx
84
+ // A. Direct wrapper (single function)
85
+ const { data } = query(getUsers).useQuery([]);
86
+
87
+ // B. Module proxy (feature-based API)
88
+ import * as UsersAPI from "./api/users.server";
89
+ const users = {
90
+ query: createQueryProxy(UsersAPI),
91
+ mutation: createMutationProxy(UsersAPI),
92
+ };
93
+ users.query.getUsers.useQuery([]);
94
+
95
+ // C. queryOptions (for prefetching, etc.)
96
+ const options = query(getUsers).queryOptions([id]);
97
+ queryClient.prefetchQuery(options);
98
+ ```
@@ -0,0 +1,25 @@
1
+ import type { QueryClient } from "@tanstack/react-query";
2
+ /** Default context available in route loaders. */
3
+ export interface AppRouteContext {
4
+ queryClient: QueryClient;
5
+ }
6
+ /**
7
+ * Create a root route with the app's default context (queryClient).
8
+ *
9
+ * Use this instead of `createRootRoute` when you want typed access
10
+ * to `context.queryClient` in `loader` / `beforeLoad`.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * const rootRoute = createAppRootRoute({ component: Root });
15
+ *
16
+ * const usersRoute = createRoute({
17
+ * getParentRoute: () => rootRoute,
18
+ * path: "/users",
19
+ * loader: ({ context }) =>
20
+ * context.queryClient.ensureQueryData(query(getUsers).queryOptions([])),
21
+ * });
22
+ * ```
23
+ */
24
+ export declare const createAppRootRoute: <TRegister = import("@tanstack/router-core").Register, TRouteContextFn = import("@tanstack/router-core").AnyContext, TBeforeLoadFn = import("@tanstack/router-core").AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TSSR = unknown, TServerMiddlewares = unknown>(options?: import("@tanstack/router-core").RootRouteOptions<TRegister, TSearchValidator, AppRouteContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TSSR, TServerMiddlewares, undefined> | undefined) => import("@tanstack/react-router").RootRoute<TRegister, TSearchValidator, AppRouteContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown, TSSR, TServerMiddlewares, undefined>;
25
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/client/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,iuBAAgD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { createRootRouteWithContext } from "@tanstack/react-router";
2
+ /**
3
+ * Create a root route with the app's default context (queryClient).
4
+ *
5
+ * Use this instead of `createRootRoute` when you want typed access
6
+ * to `context.queryClient` in `loader` / `beforeLoad`.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * const rootRoute = createAppRootRoute({ component: Root });
11
+ *
12
+ * const usersRoute = createRoute({
13
+ * getParentRoute: () => rootRoute,
14
+ * path: "/users",
15
+ * loader: ({ context }) =>
16
+ * context.queryClient.ensureQueryData(query(getUsers).queryOptions([])),
17
+ * });
18
+ * ```
19
+ */
20
+ export const createAppRootRoute = createRootRouteWithContext();
21
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/client/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAOpE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,EAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/client/create-app.tsx"],"names":[],"mappings":"AAAA,OAAO,EAC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,CAAC;IACF;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,oCAAoC;IACpC,MAAM,EAAE,SAAS,CAAC;IAClB,0CAA0C;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;CAC/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,UAAU,SAAS,QAAQ,EACnD,OAAO,EAAE,gBAAgB,CAAC,UAAU,CAAC,GACpC,GAAG,CAgCL"}
@@ -23,6 +23,7 @@ export function createApp(options) {
23
23
  const router = createRouter({
24
24
  ...routerOptions,
25
25
  routeTree,
26
+ context: { queryClient, ...routerOptions?.context },
26
27
  });
27
28
  function render(container) {
28
29
  const el = typeof container === "string"
@@ -1 +1 @@
1
- {"version":3,"file":"create-app.js","sourceRoot":"","sources":["../../src/client/create-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EAEX,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAoC9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,SAAS,CACvB,OAAqC;IAErC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEhE,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAEvD,MAAM,MAAM,GAAG,YAAY,CAAC;QAC1B,GAAG,aAAa;QAChB,SAAS;KAC4B,CAAC,CAAC;IAEzC,SAAS,MAAM,CAAC,SAA+B;QAC7C,MAAM,EAAE,GACN,OAAO,SAAS,KAAK,QAAQ;YAC3B,CAAC,CAAC,QAAQ,CAAC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hB,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CACb,0CAA0C,MAAM,CAAC,SAAS,CAAC,EAAE,CAC9D,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QAC5B,IAAI,CAAC,MAAM,CACT,KAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW,YACtC,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,GACd,CACvB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACzC,CAAC"}
@@ -2,10 +2,12 @@
2
2
  * Client-side runtime utilities.
3
3
  */
4
4
  export * from "@tanstack/react-query";
5
+ export type { AppRouteContext } from "./context";
6
+ export { createAppRootRoute } from "./context";
5
7
  export type { App, CreateAppOptions } from "./create-app";
6
8
  export { createApp } from "./create-app";
7
9
  export * from "./query";
8
10
  export * from "./route";
9
- export type { RpcOptions } from "./rpc";
10
- export { __ev_rpc, configureRpc } from "./rpc";
11
+ export type { RequestContext, ServerTransport, TransportOptions, } from "./transport";
12
+ export { configureTransport } from "./transport";
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,YAAY,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Client-side runtime utilities.
3
3
  */
4
- // ── TanStack Query Integration ──
5
4
  export * from "@tanstack/react-query";
5
+ export { createAppRootRoute } from "./context";
6
6
  export { createApp } from "./create-app";
7
7
  export * from "./query";
8
8
  export * from "./route";
9
- export { __ev_rpc, configureRpc } from "./rpc";
9
+ export { configureTransport } from "./transport";
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mCAAmC;AACnC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAMxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
@@ -71,8 +71,4 @@ export declare const query: (<TArgs extends unknown[], TResponse>(fn: ServerFunc
71
71
  * @example const { mutate } = mutation(createUser).useMutation();
72
72
  */
73
73
  export declare const mutation: (<TVariables, TResponse>(fn: (args: TVariables) => Promise<TResponse>) => MutationProxyHandler<TVariables, TResponse>) & MutationProxy<Record<string, unknown>>;
74
- /** @deprecated Use query.fnName.useQuery() */
75
- export declare function useServerQuery<TArgs extends unknown[], TResponse, TError = Error>(serverFn: ServerFunction<TArgs, TResponse>, args: TArgs, options?: Omit<UseQueryOptions<TResponse, TError>, "queryKey" | "queryFn">): UseQueryResult<TResponse, TError>;
76
- /** @deprecated Use mutation.fnName.useMutation() */
77
- export declare function useServerMutation<TVariables, TResponse, TError = Error>(serverFn: (args: TVariables) => Promise<TResponse>, options?: Omit<UseMutationOptions<TResponse, TError, TVariables>, "mutationFn">): UseMutationResult<TResponse, TError, TVariables>;
78
74
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/client/query.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAI5B,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,SAAS,IAAI,CAAC,CAChE,GAAG,IAAI,EAAE,KAAK,KACX,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAIF;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,SAAS;IACnE,yCAAyC;IACzC,CAAC,GAAG,IAAI,EAAE,KAAK,GAAG,O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B,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAE7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAEnE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAA2B,CAAC,CAC5C,KAAK,SAAS,OAAO,EAAE,EACvB,SAAS,EAET,EAAE,EAAE,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,KACjC,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,GACvC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAA8B,CAAC,CAAC,UAAU,EAAE,SAAS,EACxE,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,SAAS,CAAC,KACzC,oBAAoB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,GAC/C,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { useMutation, useQuery, useSuspenseQuery, } from "@tanstack/react-query";
2
- // ── Implementation ───────────────────────────────────────
3
2
  function createHandler(fn, path) {
4
3
  return {
5
4
  useQuery: (args = [], options) => {
@@ -94,21 +93,4 @@ export const query = createProxy("query");
94
93
  * @example const { mutate } = mutation(createUser).useMutation();
95
94
  */
96
95
  export const mutation = createProxy("mutation");
97
- // ── Legacy Hooks (deprecated) ──────────────────────────
98
- /** @deprecated Use query.fnName.useQuery() */
99
- export function useServerQuery(serverFn, args, options) {
100
- const queryKey = [serverFn._evId || serverFn.name, ...args];
101
- return useQuery({
102
- ...options,
103
- queryKey,
104
- queryFn: () => serverFn(...args),
105
- });
106
- }
107
- /** @deprecated Use mutation.fnName.useMutation() */
108
- export function useServerMutation(serverFn, options) {
109
- return useMutation({
110
- ...options,
111
- mutationFn: (variables) => serverFn(variables),
112
- });
113
- }
114
96
  //# sourceMappingURL=query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/client/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,WAAW,EACX,QAAQ,EACR,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAqG/B,4DAA4D;AAE5D,SAAS,aAAa,CAAC,EAAsC,EAAE,IAAc;IAC3E,OAAO;QACL,QAAQ,EAAE,CACR,OAAkB,EAAE,EACpB,OAAuE,EACvE,EAAE;YACF,OAAO,QAAQ,CAAC;gBACd,GAAG,OAAO;gBACV,QAAQ,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC;gBAC/C,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;aAC3B,CAAC,CAAC;QACL,CAAC;QACD,gBAAgB,EAAE,CAChB,OAAkB,EAAE,EACpB,OAGC,EACD,EAAE;YACF,OAAO,gBAAgB,CAAC;gBACtB,GAAG,OAAO;gBACV,QAAQ,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC;gBAC/C,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;aAC3B,CAAC,CAAC;QACL,CAAC;QACD,WAAW,EAAE,CACX,OAAyE,EACzE,EAAE;YACF,OAAO,WAAW,CAAC;gBACjB,GAAG,OAAO;gBACV,UAAU,EAAE,CAAC,SAAkB,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;aAClD,CAAC,CAAC;QACL,CAAC;QACD,YAAY,EAAE,CACZ,OAAkB,EAAE,EACpB,OAAuE,EACvE,EAAE;YACF,OAAO;gBACL,GAAG,OAAO;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D,OAAO,CACR,CAAC;YACJ,CAAC;YAED,kCAAkC;YAClC,OAAO,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI;YAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAkD,CAAC;YACpE,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;gBAC7B,OAAO,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACjC,CAAC;YACD,OAAO,EAAE,CAAC,CAAC,WAAW;QACxB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAI,MAAU;IAC5C,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,CAAkB,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAI,MAAU;IAC/C,OAAO,WAAW,CAAC,UAAU,EAAE,MAAM,CAAqB,CAAC;AAC7D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAMH,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAGN,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Client-side transport 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_call(fnId, args)`. This module provides that helper.
7
+ */
8
+ /**
9
+ * Request context passed through server calls.
10
+ * Used during SSR to forward headers/cookies, and in RSC for streaming.
11
+ *
12
+ * @experimental This interface is reserved for future SSR/RSC support.
13
+ * Do not rely on it in production — the shape may change.
14
+ */
15
+ export interface RequestContext {
16
+ /** @experimental Request headers to forward (e.g. cookies during SSR). SSR is not yet supported. */
17
+ headers?: Record<string, string>;
18
+ /** Signal for aborting the request. */
19
+ signal?: AbortSignal;
20
+ }
21
+ /**
22
+ * Transport interface for client-server communication.
23
+ * Implement this to use a custom request library or protocol.
24
+ */
25
+ export interface ServerTransport {
26
+ /** Standard request-response call for server functions. */
27
+ send(fnId: string, args: unknown[], context?: RequestContext): Promise<unknown>;
28
+ /**
29
+ * Streaming call for RSC Flight protocol.
30
+ * Returns a ReadableStream of serialized React elements.
31
+ *
32
+ * @experimental Not yet implemented. Reserved for future RSC support.
33
+ * Do not use — this method signature may change.
34
+ */
35
+ stream?(fnId: string, args: unknown[], context?: RequestContext): ReadableStream<Uint8Array>;
36
+ }
37
+ export interface TransportOptions {
38
+ /** Base URL for the RPC endpoint. Defaults to the current origin. */
39
+ baseUrl?: string;
40
+ /** Path prefix for the RPC endpoint. Defaults to `/api/rpc`. */
41
+ endpoint?: string;
42
+ /** Custom transport. When provided, `baseUrl` and `endpoint` are ignored. */
43
+ transport?: ServerTransport;
44
+ }
45
+ /**
46
+ * Configure the server transport. Call once at app startup if you need to
47
+ * customise the endpoint URL or provide a custom transport.
48
+ */
49
+ export declare function configureTransport(options: TransportOptions): void;
50
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/client/transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,oGAAoG;IACpG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,uCAAuC;IACvC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB;;;;;;OAMG;IACH,MAAM,CAAC,CACL,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EAAE,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,cAAc,CAAC,UAAU,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAwDD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CASlE"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Client-side transport 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_call(fnId, args)`. This module provides that helper.
7
+ */
8
+ import { DEFAULT_RPC_ENDPOINT } from "../constants";
9
+ /**
10
+ * Default fetch-based transport.
11
+ */
12
+ function createFetchTransport(baseUrl, endpoint) {
13
+ return {
14
+ async send(fnId, args, context) {
15
+ const url = `${baseUrl}${endpoint}`;
16
+ const res = await fetch(url, {
17
+ method: "POST",
18
+ headers: {
19
+ "Content-Type": "application/json",
20
+ ...context?.headers,
21
+ },
22
+ body: JSON.stringify({ fnId, args }),
23
+ signal: context?.signal,
24
+ });
25
+ if (!res.ok) {
26
+ const text = await res.text().catch(() => res.statusText);
27
+ throw new Error(`[ev] Server function "${fnId}" failed (${res.status}): ${text}`);
28
+ }
29
+ const payload = await res.json();
30
+ if (payload.error) {
31
+ throw new Error(`[ev] Server function "${fnId}" threw: ${payload.error}`);
32
+ }
33
+ return payload.result;
34
+ },
35
+ };
36
+ }
37
+ let _transport = null;
38
+ function getTransport() {
39
+ if (!_transport) {
40
+ _transport = createFetchTransport("", DEFAULT_RPC_ENDPOINT);
41
+ }
42
+ return _transport;
43
+ }
44
+ /**
45
+ * Configure the server transport. Call once at app startup if you need to
46
+ * customise the endpoint URL or provide a custom transport.
47
+ */
48
+ export function configureTransport(options) {
49
+ if (options.transport) {
50
+ _transport = options.transport;
51
+ }
52
+ else {
53
+ _transport = createFetchTransport(options.baseUrl ?? "", options.endpoint ?? DEFAULT_RPC_ENDPOINT);
54
+ }
55
+ }
56
+ /**
57
+ * Call a server function by its unique ID.
58
+ *
59
+ * @internal This function is auto-injected by the Webpack loader.
60
+ * Do not call directly — use server functions as normal imports instead.
61
+ *
62
+ * @param fnId - The unique identifier assigned to the server function by the
63
+ * Webpack loader (e.g. `"user_server_getUser"`).
64
+ * @param args - The arguments to pass to the server function. Must be
65
+ * JSON-serializable.
66
+ * @returns A promise that resolves with the server function's return value.
67
+ */
68
+ export async function __ev_call(fnId, args, context) {
69
+ return getTransport().send(fnId, args, context);
70
+ }
71
+ //# sourceMappingURL=transport.js.map
@@ -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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ev runtime.
3
+ */
4
+ /** Default RPC endpoint path, shared between client and server. */
5
+ export declare const DEFAULT_RPC_ENDPOINT = "/api/rpc";
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -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"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared constants for the ev runtime.
3
+ */
4
+ /** Default RPC endpoint path, shared between client and server. */
5
+ export const DEFAULT_RPC_ENDPOINT = "/api/rpc";
6
+ //# sourceMappingURL=constants.js.map
@@ -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"}
@@ -1,25 +1,25 @@
1
1
  /**
2
2
  * Server application factory.
3
3
  *
4
- * Creates a Hono app with RPC middleware and starts a Node.js HTTP
5
- * server via @hono/node-server.
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 createServer. */
9
- export interface CreateServerOptions {
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 and start an ev API server.
16
+ * Create an ev API server application.
17
17
  *
18
- * Mounts the RPC middleware at `/api/rpc` and starts listening.
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 - Server configuration.
22
- * @returns The Hono app instance (for extension or testing).
21
+ * @param options - Application configuration.
22
+ * @returns A runtime-agnostic Hono app instance.
23
23
  */
24
- export declare function createServer(options?: CreateServerOptions): Hono;
24
+ export declare function createApp(options?: CreateAppOptions): Hono;
25
25
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/server/app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,gCAAgC;AAChC,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAahE"}
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,CAS1D"}
package/esm/server/app.js CHANGED
@@ -1,29 +1,26 @@
1
1
  /**
2
2
  * Server application factory.
3
3
  *
4
- * Creates a Hono app with RPC middleware and starts a Node.js HTTP
5
- * server via @hono/node-server.
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
- import { serve } from "@hono/node-server";
8
7
  import { Hono } from "hono";
8
+ import { DEFAULT_RPC_ENDPOINT } from "../constants";
9
9
  import { createRpcMiddleware } from "./handler";
10
10
  /**
11
- * Create and start an ev API server.
11
+ * Create an ev API server application.
12
12
  *
13
- * Mounts the RPC middleware at `/api/rpc` and starts listening.
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 - Server configuration.
17
- * @returns The Hono app instance (for extension or testing).
16
+ * @param options - Application configuration.
17
+ * @returns A runtime-agnostic Hono app instance.
18
18
  */
19
- export function createServer(options) {
20
- const { port = 3001, rpcEndpoint = "/api/rpc" } = options ?? {};
19
+ export function createApp(options) {
20
+ const { rpcEndpoint = DEFAULT_RPC_ENDPOINT } = options ?? {};
21
21
  const app = new Hono();
22
22
  // Mount RPC endpoint
23
23
  app.route(rpcEndpoint, createRpcMiddleware());
24
- serve({ fetch: app.fetch, port }, (info) => {
25
- console.log(`ev server running at http://localhost:${info.port}`);
26
- });
27
24
  return app;
28
25
  }
29
26
  //# sourceMappingURL=app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/server/app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAUhD;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAEhE,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,qBAAqB;IACrB,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAE9C,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;QACzC,OAAO,CAAC,GAAG,CAAC,yCAAyC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
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,qBAAqB;IACrB,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAE9C,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,11 @@
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
+ export declare function runNodeServer(app: Hono, options?: NodeRunnerOptions): import("@hono/node-server").ServerType;
11
+ //# 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;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,iBAAiB,0CAYnE"}
@@ -0,0 +1,19 @@
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
+ export function runNodeServer(app, options) {
9
+ const port = options?.port || 3001;
10
+ const hostname = options?.host;
11
+ const server = serve({ fetch: app.fetch, port, hostname }, (info) => {
12
+ const address = info.address === "0.0.0.0" || info.address === "::"
13
+ ? "localhost"
14
+ : info.address;
15
+ logger.info `Server API ready at http://${address}:${info.port}`;
16
+ });
17
+ return server;
18
+ }
19
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/server/environments/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAO7C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAS,EAAE,OAA2B;IAClE,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC;IACnC,MAAM,QAAQ,GAAG,OAAO,EAAE,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;QAClE,MAAM,OAAO,GACX,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;YACjD,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACnB,MAAM,CAAC,IAAI,CAAA,8BAA8B,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Server-side runtime utilities.
3
3
  */
4
- export type { CreateServerOptions } from "./app";
5
- export { createServer } from "./app";
4
+ export type { CreateAppOptions } from "./app";
5
+ export { createApp } from "./app";
6
+ export type { NodeRunnerOptions } from "./environments/node";
7
+ export { runNodeServer } from "./environments/node";
6
8
  export { createRpcMiddleware, registerServerFn } from "./handler";
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Server-side runtime utilities.
3
3
  */
4
- export { createServer } from "./app";
4
+ export { createApp } from "./app";
5
+ export { runNodeServer } from "./environments/node";
5
6
  export { createRpcMiddleware, registerServerFn } from "./handler";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@evjs/runtime",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.8",
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"
@@ -38,6 +39,10 @@
38
39
  "types": "./esm/client/index.d.ts",
39
40
  "import": "./esm/client/index.js"
40
41
  },
42
+ "./client/transport": {
43
+ "types": "./esm/client/transport.d.ts",
44
+ "import": "./esm/client/transport.js"
45
+ },
41
46
  "./server": {
42
47
  "types": "./esm/server/index.d.ts",
43
48
  "import": "./esm/server/index.js"
@@ -49,6 +54,7 @@
49
54
  "prepublishOnly": "npm run build"
50
55
  },
51
56
  "files": [
52
- "esm"
57
+ "esm",
58
+ "AGENT.md"
53
59
  ]
54
60
  }
@@ -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
@@ -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,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EAAE,GACd,OAAO,CAAC,OAAO,CAAC,CAyBlB"}
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
@@ -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,CAC5B,IAAY,EACZ,IAAe;IAEf,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,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1D,MAAM,IAAI,KAAK,CACb,6BAA6B,IAAI,aAAa,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CACrE,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAEjC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,6BAA6B,IAAI,YAAY,OAAO,CAAC,KAAK,EAAE,CAC7D,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC"}
package/esm/version.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const VERSION = "0.0.1-alpha.6";
2
- //# sourceMappingURL=version.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
package/esm/version.js DELETED
@@ -1,2 +0,0 @@
1
- export const VERSION = "0.0.1-alpha.6";
2
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC"}