bosia 0.6.9 → 0.6.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bosia",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A fast, batteries-included fullstack framework — SSR · Svelte 5 Runes · Bun · ElysiaJS. File-based routing inspired by SvelteKit. No Node.js, no Vite, no adapters.",
|
|
6
6
|
"keywords": [
|
package/src/cli/index.ts
CHANGED
|
@@ -26,6 +26,11 @@ async function main() {
|
|
|
26
26
|
await runBuild();
|
|
27
27
|
break;
|
|
28
28
|
}
|
|
29
|
+
case "sync": {
|
|
30
|
+
const { runSync } = await import("./sync.ts");
|
|
31
|
+
await runSync();
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
29
34
|
case "start": {
|
|
30
35
|
const { runStart } = await import("./start.ts");
|
|
31
36
|
await runStart();
|
|
@@ -80,6 +85,7 @@ Commands:
|
|
|
80
85
|
create <name> [--template <t>] Scaffold a new Bosia project
|
|
81
86
|
dev Start the development server
|
|
82
87
|
build Build for production
|
|
88
|
+
sync Generate .bosia/ codegen (routes, $types, env) without building
|
|
83
89
|
start Run the production server
|
|
84
90
|
test [args] Run tests with bun test (auto-loads .env.test, sets BOSIA_ENV=test)
|
|
85
91
|
add <component...> [-y] Add one or more UI components from the registry
|
package/src/cli/sync.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { scanRoutes } from "../core/scanner.ts";
|
|
2
|
+
import { generateRoutesFile } from "../core/routeFile.ts";
|
|
3
|
+
import { generateRouteTypes, ensureRootDirs } from "../core/routeTypes.ts";
|
|
4
|
+
import { loadEnv, classifyEnvVars } from "../core/env.ts";
|
|
5
|
+
import { generateEnvModules } from "../core/envCodegen.ts";
|
|
6
|
+
|
|
7
|
+
export async function runSync() {
|
|
8
|
+
const envMode = process.env.NODE_ENV === "production" ? "production" : "development";
|
|
9
|
+
const classifiedEnv = classifyEnvVars(loadEnv(envMode));
|
|
10
|
+
const manifest = scanRoutes();
|
|
11
|
+
generateRoutesFile(manifest);
|
|
12
|
+
generateRouteTypes(manifest);
|
|
13
|
+
ensureRootDirs();
|
|
14
|
+
generateEnvModules(classifiedEnv);
|
|
15
|
+
console.log("✅ Bosia codegen ready (.bosia/routes.ts, types, env modules)");
|
|
16
|
+
}
|
package/src/core/routeTypes.ts
CHANGED
|
@@ -100,6 +100,7 @@ export function generateRouteTypes(manifest: RouteManifest): void {
|
|
|
100
100
|
`export type PageMetadataLoad = (event: _MetadataEvent) => Metadata | Promise<Metadata>;`,
|
|
101
101
|
);
|
|
102
102
|
lines.push(`export type Action = (event: _RequestEvent) => any;`);
|
|
103
|
+
lines.push(`export type Actions = Record<string, Action>;`);
|
|
103
104
|
lines.push(`export type PageData = Awaited<ReturnType<typeof _pageLoad>>;`);
|
|
104
105
|
} else {
|
|
105
106
|
lines.push(``);
|
|
@@ -107,6 +108,7 @@ export function generateRouteTypes(manifest: RouteManifest): void {
|
|
|
107
108
|
`export type PageMetadataLoad = (event: _MetadataEvent) => Metadata | Promise<Metadata>;`,
|
|
108
109
|
);
|
|
109
110
|
lines.push(`export type Action = (event: _RequestEvent) => any;`);
|
|
111
|
+
lines.push(`export type Actions = Record<string, Action>;`);
|
|
110
112
|
lines.push(`export type PageData = {};`);
|
|
111
113
|
}
|
|
112
114
|
lines.push(`export type PageProps = { data: PageData; params: Params };`);
|
package/src/lib/index.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "bosia dev",
|
|
7
7
|
"build": "bosia build",
|
|
8
8
|
"start": "bosia start",
|
|
9
|
-
"check": "
|
|
9
|
+
"check": "bosia sync && svelte-check --tsconfig ./tsconfig.json && tsc --noEmit",
|
|
10
10
|
"format": "prettier --write .",
|
|
11
11
|
"format:check": "prettier --check ."
|
|
12
12
|
},
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@types/bun": "latest",
|
|
20
20
|
"prettier": "^3.3.0",
|
|
21
21
|
"prettier-plugin-svelte": "^3.2.0",
|
|
22
|
+
"svelte-check": "^4.4.8",
|
|
22
23
|
"typescript": "^5"
|
|
23
24
|
}
|
|
24
25
|
}
|