zitejs 0.9.12 → 0.9.13
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/dist/cjs/dev/index.js +9 -1
- package/dist/esm/dev/index.js +10 -2
- package/package.json +1 -1
package/dist/cjs/dev/index.js
CHANGED
|
@@ -32,6 +32,13 @@ function getFlowId(appDir) {
|
|
|
32
32
|
catch { }
|
|
33
33
|
return undefined;
|
|
34
34
|
}
|
|
35
|
+
function regenerateAppTypedWrappers(appDir) {
|
|
36
|
+
const outDir = (0, path_1.join)('apps', appDir, '.zite');
|
|
37
|
+
(0, fs_2.mkdirSync)(outDir, { recursive: true });
|
|
38
|
+
(0, fs_2.writeFileSync)((0, path_1.join)(outDir, 'user.ts'), (0, lib_js_1.generateUserTs)());
|
|
39
|
+
(0, fs_2.writeFileSync)((0, path_1.join)(outDir, 'auth.ts'), (0, lib_js_1.generateAuthWrapperTs)());
|
|
40
|
+
(0, fs_2.writeFileSync)((0, path_1.join)(outDir, 'backend.ts'), (0, lib_js_1.generateBackendWrapperTs)());
|
|
41
|
+
}
|
|
35
42
|
function regenerateAppApiTs(appDir) {
|
|
36
43
|
const apiDir = (0, path_1.join)('apps', appDir, 'src', 'api');
|
|
37
44
|
if (!(0, fs_2.existsSync)(apiDir))
|
|
@@ -57,10 +64,11 @@ async function runDev() {
|
|
|
57
64
|
console.warn('Initial sync failed (continuing with watcher):', err instanceof Error ? err.message : err);
|
|
58
65
|
}
|
|
59
66
|
console.log('');
|
|
60
|
-
// 2. Find all apps and regenerate their .zite/
|
|
67
|
+
// 2. Find all apps and regenerate their .zite/ files
|
|
61
68
|
const appDirs = findAppDirs();
|
|
62
69
|
for (const app of appDirs) {
|
|
63
70
|
regenerateAppApiTs(app);
|
|
71
|
+
regenerateAppTypedWrappers(app);
|
|
64
72
|
}
|
|
65
73
|
// 3. Watch each app's src/api/ for endpoint changes
|
|
66
74
|
let watchingAny = false;
|
package/dist/esm/dev/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { watch } from 'fs';
|
|
|
2
2
|
import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync, } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { runSync } from '../sync/index.js';
|
|
5
|
-
import { generateApiTs } from '../sync/lib.js';
|
|
5
|
+
import { generateApiTs, generateUserTs, generateAuthWrapperTs, generateBackendWrapperTs, } from '../sync/lib.js';
|
|
6
6
|
const debounceTimers = new Map();
|
|
7
7
|
function debounce(key, fn, ms) {
|
|
8
8
|
const existing = debounceTimers.get(key);
|
|
@@ -29,6 +29,13 @@ function getFlowId(appDir) {
|
|
|
29
29
|
catch { }
|
|
30
30
|
return undefined;
|
|
31
31
|
}
|
|
32
|
+
function regenerateAppTypedWrappers(appDir) {
|
|
33
|
+
const outDir = join('apps', appDir, '.zite');
|
|
34
|
+
mkdirSync(outDir, { recursive: true });
|
|
35
|
+
writeFileSync(join(outDir, 'user.ts'), generateUserTs());
|
|
36
|
+
writeFileSync(join(outDir, 'auth.ts'), generateAuthWrapperTs());
|
|
37
|
+
writeFileSync(join(outDir, 'backend.ts'), generateBackendWrapperTs());
|
|
38
|
+
}
|
|
32
39
|
function regenerateAppApiTs(appDir) {
|
|
33
40
|
const apiDir = join('apps', appDir, 'src', 'api');
|
|
34
41
|
if (!existsSync(apiDir))
|
|
@@ -54,10 +61,11 @@ export async function runDev() {
|
|
|
54
61
|
console.warn('Initial sync failed (continuing with watcher):', err instanceof Error ? err.message : err);
|
|
55
62
|
}
|
|
56
63
|
console.log('');
|
|
57
|
-
// 2. Find all apps and regenerate their .zite/
|
|
64
|
+
// 2. Find all apps and regenerate their .zite/ files
|
|
58
65
|
const appDirs = findAppDirs();
|
|
59
66
|
for (const app of appDirs) {
|
|
60
67
|
regenerateAppApiTs(app);
|
|
68
|
+
regenerateAppTypedWrappers(app);
|
|
61
69
|
}
|
|
62
70
|
// 3. Watch each app's src/api/ for endpoint changes
|
|
63
71
|
let watchingAny = false;
|