@zap-js/client 0.0.2 → 0.0.4
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/README.md +310 -24
- package/bin/zap +0 -0
- package/bin/zap-codegen +0 -0
- package/dist/cli/commands/build.d.ts +11 -0
- package/dist/cli/commands/build.js +282 -0
- package/dist/cli/commands/codegen.d.ts +8 -0
- package/dist/cli/commands/codegen.js +95 -0
- package/dist/cli/commands/dev.d.ts +20 -0
- package/dist/cli/commands/dev.js +78 -0
- package/dist/cli/commands/new.d.ts +9 -0
- package/dist/cli/commands/new.js +307 -0
- package/dist/cli/commands/routes-old.d.ts +9 -0
- package/dist/cli/commands/routes-old.js +106 -0
- package/dist/cli/commands/routes.d.ts +11 -0
- package/dist/cli/commands/routes.js +280 -0
- package/dist/cli/commands/serve.d.ts +17 -0
- package/dist/cli/commands/serve.js +386 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +76 -0
- package/dist/cli/utils/index.d.ts +2 -0
- package/dist/cli/utils/index.js +2 -0
- package/dist/cli/utils/logger.d.ts +84 -0
- package/dist/cli/utils/logger.js +181 -0
- package/dist/cli/utils/port-finder.d.ts +8 -0
- package/dist/cli/utils/port-finder.js +48 -0
- package/dist/dev-server/codegen-runner.d.ts +41 -0
- package/dist/dev-server/codegen-runner.js +172 -0
- package/dist/dev-server/hot-reload.d.ts +72 -0
- package/dist/dev-server/hot-reload.js +280 -0
- package/dist/dev-server/index.d.ts +8 -0
- package/dist/dev-server/index.js +8 -0
- package/dist/dev-server/route-scanner.d.ts +71 -0
- package/dist/dev-server/route-scanner.js +114 -0
- package/dist/dev-server/rust-builder.d.ts +66 -0
- package/dist/dev-server/rust-builder.js +286 -0
- package/dist/dev-server/server.d.ts +147 -0
- package/dist/dev-server/server.js +658 -0
- package/dist/dev-server/vite-proxy.d.ts +56 -0
- package/dist/dev-server/vite-proxy.js +212 -0
- package/dist/dev-server/watcher.d.ts +48 -0
- package/dist/dev-server/watcher.js +127 -0
- package/dist/router/codegen-enhanced.d.ts +5 -0
- package/dist/router/codegen-enhanced.js +275 -0
- package/dist/router/codegen.d.ts +17 -0
- package/dist/router/codegen.js +654 -0
- package/dist/router/index.d.ts +16 -0
- package/dist/router/index.js +19 -0
- package/dist/router/scanner.d.ts +86 -0
- package/dist/router/scanner.js +689 -0
- package/dist/router/ssg.d.ts +115 -0
- package/dist/router/ssg.js +202 -0
- package/dist/router/types.d.ts +124 -0
- package/dist/router/types.js +9 -0
- package/dist/router/watch.d.ts +38 -0
- package/dist/router/watch.js +135 -0
- package/dist/runtime/csrf.d.ts +146 -0
- package/dist/runtime/csrf.js +166 -0
- package/dist/runtime/error-boundary.d.ts +129 -0
- package/dist/runtime/error-boundary.js +287 -0
- package/dist/runtime/hooks.d.ts +83 -0
- package/dist/runtime/hooks.js +96 -0
- package/dist/runtime/index.d.ts +229 -0
- package/dist/runtime/index.js +449 -0
- package/dist/runtime/ipc-client.d.ts +144 -0
- package/dist/runtime/ipc-client.js +621 -0
- package/dist/runtime/logger.d.ts +71 -0
- package/dist/runtime/logger.js +164 -0
- package/dist/runtime/middleware.d.ts +66 -0
- package/dist/runtime/middleware.js +114 -0
- package/dist/runtime/process-manager.d.ts +51 -0
- package/dist/runtime/process-manager.js +207 -0
- package/dist/runtime/router-simple.d.ts +98 -0
- package/dist/runtime/router-simple.js +330 -0
- package/dist/runtime/router.d.ts +103 -0
- package/dist/runtime/router.js +435 -0
- package/dist/runtime/rpc-client.d.ts +35 -0
- package/dist/runtime/rpc-client.js +140 -0
- package/dist/runtime/streaming-utils.d.ts +86 -0
- package/dist/runtime/streaming-utils.js +150 -0
- package/dist/runtime/types.d.ts +465 -0
- package/dist/runtime/types.js +60 -0
- package/dist/runtime/websockets-utils.d.ts +50 -0
- package/dist/runtime/websockets-utils.js +92 -0
- package/package.json +30 -20
- package/index.js +0 -29
- package/internal/cli/package.json +0 -46
- package/internal/cli/tsconfig.tsbuildinfo +0 -1
- package/internal/dev-server/node_modules/ora/index.d.ts +0 -332
- package/internal/dev-server/node_modules/ora/index.js +0 -416
- package/internal/dev-server/node_modules/ora/license +0 -9
- package/internal/dev-server/node_modules/ora/node_modules/string-width/index.d.ts +0 -36
- package/internal/dev-server/node_modules/ora/node_modules/string-width/index.js +0 -65
- package/internal/dev-server/node_modules/ora/node_modules/string-width/license +0 -9
- package/internal/dev-server/node_modules/ora/node_modules/string-width/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
- package/internal/dev-server/node_modules/ora/node_modules/string-width/node_modules/emoji-regex/README.md +0 -107
- package/internal/dev-server/node_modules/ora/node_modules/string-width/node_modules/emoji-regex/index.d.ts +0 -3
- package/internal/dev-server/node_modules/ora/node_modules/string-width/node_modules/emoji-regex/index.js +0 -4
- package/internal/dev-server/node_modules/ora/node_modules/string-width/node_modules/emoji-regex/index.mjs +0 -4
- package/internal/dev-server/node_modules/ora/node_modules/string-width/node_modules/emoji-regex/package.json +0 -46
- package/internal/dev-server/node_modules/ora/node_modules/string-width/package.json +0 -60
- package/internal/dev-server/node_modules/ora/node_modules/string-width/readme.md +0 -62
- package/internal/dev-server/node_modules/ora/package.json +0 -66
- package/internal/dev-server/node_modules/ora/readme.md +0 -325
- package/internal/dev-server/package.json +0 -41
- package/internal/router/package.json +0 -28
- package/internal/runtime/package.json +0 -41
- package/internal/runtime/src/error-boundary.tsx +0 -476
- package/internal/runtime/src/router-simple.tsx +0 -640
- package/internal/runtime/src/router.tsx +0 -771
- package/internal/runtime/tsconfig.tsbuildinfo +0 -1
- package/src/errors.js +0 -33
- package/src/logger.js +0 -10
- package/src/middleware.js +0 -32
- package/src/router.js +0 -41
- package/src/types.js +0 -39
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route file scanner for ZapJS (Next.js style conventions)
|
|
3
|
+
*
|
|
4
|
+
* File Routing Conventions:
|
|
5
|
+
* - index.tsx → /
|
|
6
|
+
* - about.tsx → /about
|
|
7
|
+
* - [param].tsx → /:param (required dynamic segment)
|
|
8
|
+
* - [param]?.tsx → /:param? (optional dynamic segment)
|
|
9
|
+
* - [...slug].tsx → /*slug (catch-all)
|
|
10
|
+
* - [[...slug]].tsx → /*slug? (optional catch-all)
|
|
11
|
+
* - posts.[id].tsx → /posts/:id
|
|
12
|
+
* - _layout.tsx → Layout scoped to directory segment
|
|
13
|
+
* - __root.tsx → Root layout
|
|
14
|
+
* - (group)/ → Route group (no URL segment)
|
|
15
|
+
* - _excluded/ → Excluded from routing (underscore prefix for folders)
|
|
16
|
+
* - api/*.ts → API routes (separate folder)
|
|
17
|
+
* - ws/*.ts → WebSocket routes (dedicated folder)
|
|
18
|
+
*
|
|
19
|
+
* Legacy support: $param syntax is still supported for backwards compatibility
|
|
20
|
+
*/
|
|
21
|
+
import type { ScannedRoute, LayoutRoute, RouteTree, ScanOptions } from './types.js';
|
|
22
|
+
export declare class RouteScanner {
|
|
23
|
+
private routesDir;
|
|
24
|
+
private extensions;
|
|
25
|
+
private includeApi;
|
|
26
|
+
constructor(options: ScanOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Scan the routes directory and build a route tree
|
|
29
|
+
*/
|
|
30
|
+
scan(): RouteTree;
|
|
31
|
+
/**
|
|
32
|
+
* Assign parent layouts to routes based on directory structure
|
|
33
|
+
*/
|
|
34
|
+
private assignLayouts;
|
|
35
|
+
private scanDirectory;
|
|
36
|
+
private scanApiDirectory;
|
|
37
|
+
/**
|
|
38
|
+
* Scan dedicated WebSocket folder
|
|
39
|
+
*/
|
|
40
|
+
private scanWsDirectory;
|
|
41
|
+
/**
|
|
42
|
+
* Parse a WebSocket route file
|
|
43
|
+
*/
|
|
44
|
+
private parseWsRouteFile;
|
|
45
|
+
/**
|
|
46
|
+
* Parse a single segment for params
|
|
47
|
+
*
|
|
48
|
+
* Supports Next.js style:
|
|
49
|
+
* - [param] → :param (required)
|
|
50
|
+
* - [param]? → :param? (optional - file-level only)
|
|
51
|
+
* - [...slug] → *slug (catch-all)
|
|
52
|
+
* - [[...slug]] → *slug? (optional catch-all)
|
|
53
|
+
*
|
|
54
|
+
* Legacy TanStack style (still supported):
|
|
55
|
+
* - $param → :param
|
|
56
|
+
* - $param? → :param?
|
|
57
|
+
* - $...rest → *rest
|
|
58
|
+
* - $...rest? → *rest?
|
|
59
|
+
*/
|
|
60
|
+
private parseSegment;
|
|
61
|
+
private parseRouteFile;
|
|
62
|
+
private parseApiRouteFile;
|
|
63
|
+
private isRouteFile;
|
|
64
|
+
private getBaseName;
|
|
65
|
+
private fileNameToUrlSegment;
|
|
66
|
+
/**
|
|
67
|
+
* Split a filename by dots, but preserve bracketed segments
|
|
68
|
+
* e.g., "posts.[id]" -> ["posts", "[id]"]
|
|
69
|
+
* e.g., "[...slug]" -> ["[...slug]"]
|
|
70
|
+
* e.g., "[[...path]]" -> ["[[...path]]"]
|
|
71
|
+
*/
|
|
72
|
+
private splitPreservingBrackets;
|
|
73
|
+
private prefixToUrl;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Convenience function to scan routes
|
|
77
|
+
*/
|
|
78
|
+
export declare function scanRoutes(routesDir: string, options?: Partial<ScanOptions>): RouteTree;
|
|
79
|
+
/**
|
|
80
|
+
* Convert route tree to a flat list for debugging/display
|
|
81
|
+
*/
|
|
82
|
+
export declare function flattenRoutes(tree: RouteTree): ScannedRoute[];
|
|
83
|
+
/**
|
|
84
|
+
* Get the parent layout for a route
|
|
85
|
+
*/
|
|
86
|
+
export declare function findParentLayout(route: ScannedRoute, layouts: LayoutRoute[]): LayoutRoute | null;
|