clawfire 0.2.0 → 0.2.1
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 +23 -8
- package/dist/cli.js +14 -4
- package/dist/{dev-server-QTNE5N7I.js → dev-server-ZGXJARNY.js} +403 -37
- package/dist/dev.cjs +403 -37
- package/dist/dev.cjs.map +1 -1
- package/dist/dev.d.cts +16 -23
- package/dist/dev.d.ts +16 -23
- package/dist/dev.js +403 -37
- package/dist/dev.js.map +1 -1
- package/package.json +1 -1
- package/templates/CLAUDE.md +18 -1
- package/templates/starter/CLAUDE.md +84 -4
- package/templates/starter/app/components/footer.html +5 -0
- package/templates/starter/app/components/nav.html +14 -0
- package/templates/starter/app/pages/_404.html +9 -0
- package/templates/starter/app/pages/_layout.html +46 -0
- package/templates/starter/app/pages/about.html +84 -0
- package/templates/starter/app/pages/index.html +192 -0
- package/templates/starter/app/pages/todos/index.html +173 -0
- package/templates/starter/public/index.html +9 -330
package/dist/dev.d.cts
CHANGED
|
@@ -4,19 +4,19 @@ import './schema-BJsictSV.cjs';
|
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
interface DevServerOptions {
|
|
7
|
-
/**
|
|
7
|
+
/** Project root path */
|
|
8
8
|
projectDir?: string;
|
|
9
|
-
/**
|
|
9
|
+
/** Frontend server port (default: 3000) */
|
|
10
10
|
port?: number;
|
|
11
|
-
/** API
|
|
11
|
+
/** API server port (default: 3456) */
|
|
12
12
|
apiPort?: number;
|
|
13
|
-
/**
|
|
13
|
+
/** Router options */
|
|
14
14
|
routerOptions?: Partial<RouterOptions>;
|
|
15
|
-
/**
|
|
15
|
+
/** Hot reload enabled (default: true) */
|
|
16
16
|
hotReload?: boolean;
|
|
17
|
-
/**
|
|
17
|
+
/** Change detection debounce ms (default: 150) */
|
|
18
18
|
debounceMs?: number;
|
|
19
|
-
/**
|
|
19
|
+
/** Callback to manually register routes (instead of file-based) */
|
|
20
20
|
onSetupRoutes?: (router: ClawfireRouter) => void | Promise<void>;
|
|
21
21
|
}
|
|
22
22
|
declare class DevServer {
|
|
@@ -31,9 +31,12 @@ declare class DevServer {
|
|
|
31
31
|
private routesDir;
|
|
32
32
|
private schemasDir;
|
|
33
33
|
private publicDir;
|
|
34
|
+
private pagesDir;
|
|
35
|
+
private componentsDir;
|
|
34
36
|
private playgroundHtml;
|
|
35
37
|
private importCounter;
|
|
36
38
|
private isReloading;
|
|
39
|
+
private pageCompiler;
|
|
37
40
|
constructor(options?: DevServerOptions);
|
|
38
41
|
start(): Promise<void>;
|
|
39
42
|
stop(): Promise<void>;
|
|
@@ -44,7 +47,10 @@ declare class DevServer {
|
|
|
44
47
|
private handleSSE;
|
|
45
48
|
private broadcastSSE;
|
|
46
49
|
private regeneratePlayground;
|
|
47
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Inject HMR and (optionally) client-side router scripts before </body>.
|
|
52
|
+
*/
|
|
53
|
+
private injectScripts;
|
|
48
54
|
private serveStaticFile;
|
|
49
55
|
private proxyToApiServer;
|
|
50
56
|
private handleFrontendRequest;
|
|
@@ -52,24 +58,11 @@ declare class DevServer {
|
|
|
52
58
|
private printStartupBanner;
|
|
53
59
|
}
|
|
54
60
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* import { startDevServer } from "clawfire/dev";
|
|
60
|
-
*
|
|
61
|
-
* startDevServer({
|
|
62
|
-
* port: 3000,
|
|
63
|
-
* apiPort: 3456,
|
|
64
|
-
* onSetupRoutes: (router) => {
|
|
65
|
-
* router.register("/health", healthRoute);
|
|
66
|
-
* }
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
61
|
+
* Create and start dev server (one-line helper)
|
|
69
62
|
*/
|
|
70
63
|
declare function startDevServer(options?: DevServerOptions): Promise<DevServer>;
|
|
71
64
|
|
|
72
|
-
type WatchEventType = "route-change" | "schema-change" | "config-change" | "frontend-change" | "css-change" | "any-change";
|
|
65
|
+
type WatchEventType = "route-change" | "schema-change" | "config-change" | "frontend-change" | "css-change" | "page-change" | "component-change" | "any-change";
|
|
73
66
|
interface WatchEvent {
|
|
74
67
|
type: WatchEventType;
|
|
75
68
|
filePath: string;
|
package/dist/dev.d.ts
CHANGED
|
@@ -4,19 +4,19 @@ import './schema-BJsictSV.js';
|
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
interface DevServerOptions {
|
|
7
|
-
/**
|
|
7
|
+
/** Project root path */
|
|
8
8
|
projectDir?: string;
|
|
9
|
-
/**
|
|
9
|
+
/** Frontend server port (default: 3000) */
|
|
10
10
|
port?: number;
|
|
11
|
-
/** API
|
|
11
|
+
/** API server port (default: 3456) */
|
|
12
12
|
apiPort?: number;
|
|
13
|
-
/**
|
|
13
|
+
/** Router options */
|
|
14
14
|
routerOptions?: Partial<RouterOptions>;
|
|
15
|
-
/**
|
|
15
|
+
/** Hot reload enabled (default: true) */
|
|
16
16
|
hotReload?: boolean;
|
|
17
|
-
/**
|
|
17
|
+
/** Change detection debounce ms (default: 150) */
|
|
18
18
|
debounceMs?: number;
|
|
19
|
-
/**
|
|
19
|
+
/** Callback to manually register routes (instead of file-based) */
|
|
20
20
|
onSetupRoutes?: (router: ClawfireRouter) => void | Promise<void>;
|
|
21
21
|
}
|
|
22
22
|
declare class DevServer {
|
|
@@ -31,9 +31,12 @@ declare class DevServer {
|
|
|
31
31
|
private routesDir;
|
|
32
32
|
private schemasDir;
|
|
33
33
|
private publicDir;
|
|
34
|
+
private pagesDir;
|
|
35
|
+
private componentsDir;
|
|
34
36
|
private playgroundHtml;
|
|
35
37
|
private importCounter;
|
|
36
38
|
private isReloading;
|
|
39
|
+
private pageCompiler;
|
|
37
40
|
constructor(options?: DevServerOptions);
|
|
38
41
|
start(): Promise<void>;
|
|
39
42
|
stop(): Promise<void>;
|
|
@@ -44,7 +47,10 @@ declare class DevServer {
|
|
|
44
47
|
private handleSSE;
|
|
45
48
|
private broadcastSSE;
|
|
46
49
|
private regeneratePlayground;
|
|
47
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Inject HMR and (optionally) client-side router scripts before </body>.
|
|
52
|
+
*/
|
|
53
|
+
private injectScripts;
|
|
48
54
|
private serveStaticFile;
|
|
49
55
|
private proxyToApiServer;
|
|
50
56
|
private handleFrontendRequest;
|
|
@@ -52,24 +58,11 @@ declare class DevServer {
|
|
|
52
58
|
private printStartupBanner;
|
|
53
59
|
}
|
|
54
60
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* import { startDevServer } from "clawfire/dev";
|
|
60
|
-
*
|
|
61
|
-
* startDevServer({
|
|
62
|
-
* port: 3000,
|
|
63
|
-
* apiPort: 3456,
|
|
64
|
-
* onSetupRoutes: (router) => {
|
|
65
|
-
* router.register("/health", healthRoute);
|
|
66
|
-
* }
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
61
|
+
* Create and start dev server (one-line helper)
|
|
69
62
|
*/
|
|
70
63
|
declare function startDevServer(options?: DevServerOptions): Promise<DevServer>;
|
|
71
64
|
|
|
72
|
-
type WatchEventType = "route-change" | "schema-change" | "config-change" | "frontend-change" | "css-change" | "any-change";
|
|
65
|
+
type WatchEventType = "route-change" | "schema-change" | "config-change" | "frontend-change" | "css-change" | "page-change" | "component-change" | "any-change";
|
|
73
66
|
interface WatchEvent {
|
|
74
67
|
type: WatchEventType;
|
|
75
68
|
filePath: string;
|