@zap-js/client 0.0.4 → 0.0.6
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.
|
@@ -14,6 +14,7 @@ interface RouteTree {
|
|
|
14
14
|
name: string;
|
|
15
15
|
index: number;
|
|
16
16
|
catchAll: boolean;
|
|
17
|
+
optional: boolean;
|
|
17
18
|
}>;
|
|
18
19
|
isIndex: boolean;
|
|
19
20
|
}>;
|
|
@@ -26,10 +27,22 @@ interface RouteTree {
|
|
|
26
27
|
name: string;
|
|
27
28
|
index: number;
|
|
28
29
|
catchAll: boolean;
|
|
30
|
+
optional: boolean;
|
|
29
31
|
}>;
|
|
30
32
|
methods?: string[];
|
|
31
33
|
isIndex: boolean;
|
|
32
34
|
}>;
|
|
35
|
+
wsRoutes: Array<{
|
|
36
|
+
filePath: string;
|
|
37
|
+
relativePath: string;
|
|
38
|
+
urlPath: string;
|
|
39
|
+
params: Array<{
|
|
40
|
+
name: string;
|
|
41
|
+
index: number;
|
|
42
|
+
catchAll: boolean;
|
|
43
|
+
optional: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
}>;
|
|
33
46
|
layouts: unknown[];
|
|
34
47
|
root: unknown;
|
|
35
48
|
}
|
|
@@ -22,13 +22,12 @@ export class RouteScannerRunner extends EventEmitter {
|
|
|
22
22
|
*/
|
|
23
23
|
async loadRouter() {
|
|
24
24
|
try {
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
28
|
-
const router = await (Function('moduleName', 'return import(moduleName)')(moduleName));
|
|
25
|
+
// Import from local router module
|
|
26
|
+
const router = await import('../router/index.js');
|
|
29
27
|
return router;
|
|
30
28
|
}
|
|
31
|
-
catch {
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('[route-scanner] Failed to load router:', error);
|
|
32
31
|
return null;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
@@ -9,6 +9,7 @@ import { CodegenRunner } from './codegen-runner.js';
|
|
|
9
9
|
import { HotReloadServer } from './hot-reload.js';
|
|
10
10
|
import { RouteScannerRunner } from './route-scanner.js';
|
|
11
11
|
import { ProcessManager, IpcServer } from '../runtime/index.js';
|
|
12
|
+
import { initRpcClient } from '../runtime/rpc-client.js';
|
|
12
13
|
import { cliLogger } from '../cli/utils/logger.js';
|
|
13
14
|
// Register tsx loader for TypeScript imports
|
|
14
15
|
// This must be called before any dynamic imports of .ts files
|
|
@@ -299,10 +300,16 @@ export class DevServer extends EventEmitter {
|
|
|
299
300
|
this.ipcServer = new IpcServer(this.socketPath);
|
|
300
301
|
await this.ipcServer.start();
|
|
301
302
|
this.log('debug', `IPC server listening on ${this.socketPath}`);
|
|
303
|
+
// Initialize RPC client for bidirectional IPC communication
|
|
304
|
+
// This allows TypeScript route handlers to call Rust functions via rpc.call()
|
|
305
|
+
initRpcClient(this.socketPath);
|
|
306
|
+
this.log('debug', `RPC client initialized on ${this.socketPath}`);
|
|
302
307
|
// Load and register route handlers
|
|
303
308
|
const routes = await this.loadRouteHandlers(routeTree);
|
|
309
|
+
console.log(`[dev-server] Loaded ${routes.length} route configurations`);
|
|
304
310
|
// Build Rust server configuration
|
|
305
311
|
const config = this.buildRustConfig(routes);
|
|
312
|
+
console.log(`[dev-server] Built Rust config with ${config.routes.length} routes`);
|
|
306
313
|
// Get binary path
|
|
307
314
|
const binaryPath = this.rustBuilder.getBinaryPath();
|
|
308
315
|
this.log('debug', `Using Rust binary: ${binaryPath}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zap-js/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "High-performance fullstack React framework - Client package",
|
|
5
5
|
"homepage": "https://github.com/saint0x/zapjs",
|
|
6
6
|
"repository": {
|
|
@@ -12,8 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "./dist/runtime/index.js",
|
|
15
|
+
"types": "./index.d.ts",
|
|
15
16
|
"exports": {
|
|
16
|
-
".":
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./dist/runtime/index.js"
|
|
20
|
+
},
|
|
17
21
|
"./router": "./dist/router/index.js"
|
|
18
22
|
},
|
|
19
23
|
"bin": {
|