@cosmicdrift/kumiko-dev-server 0.346.0 → 0.348.0
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/codegen/watch.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { watch } from "node:fs";
|
|
1
2
|
import { runCodegen } from "./run-codegen.js";
|
|
2
3
|
export type WatchOptions = {
|
|
3
4
|
/** App-Wurzel — gleiche Bedeutung wie für `runCodegen`. */
|
|
@@ -20,6 +21,9 @@ export type WatchOptions = {
|
|
|
20
21
|
readonly onResult?: (result: ReturnType<typeof runCodegen>) => void;
|
|
21
22
|
/** Callback bei runCodegen-Fehlern. Default: stderr-Warning. */
|
|
22
23
|
readonly onError?: (err: unknown) => void;
|
|
24
|
+
/** Event source seam so tests can drive changes without native fs events
|
|
25
|
+
* (macOS FSEvents starts asynchronously and can drop writes). Default: `node:fs` watch. */
|
|
26
|
+
readonly watchDirectory?: typeof watch;
|
|
23
27
|
};
|
|
24
28
|
export type WatchHandle = {
|
|
25
29
|
/** Beendet den Watcher. Idempotent — mehrfacher Aufruf ist no-op. */
|
package/dist/codegen/watch.js
CHANGED
|
@@ -75,7 +75,7 @@ export function watchAndRegenerate(opts) {
|
|
|
75
75
|
// ohne Debounce (User wartet auf den ersten codegen).
|
|
76
76
|
fire();
|
|
77
77
|
try {
|
|
78
|
-
watcher = watch(srcDir, { recursive: true }, (_eventType, filename) => {
|
|
78
|
+
watcher = (opts.watchDirectory ?? watch)(srcDir, { recursive: true }, (_eventType, filename) => {
|
|
79
79
|
// skip: watcher closed or no filename reported, nothing to act on
|
|
80
80
|
if (closed || !filename)
|
|
81
81
|
return;
|
|
@@ -90,6 +90,8 @@ export type CreateKumikoServerOptions = {
|
|
|
90
90
|
readonly js: string;
|
|
91
91
|
readonly map: string;
|
|
92
92
|
}>;
|
|
93
|
+
/** @internal — replaces the native directory watcher in tests. */
|
|
94
|
+
readonly _watchDirectory?: DirectoryWatchEvents;
|
|
93
95
|
/** Absolute path to the CSS entry (typically styles.css with
|
|
94
96
|
* @import "tailwindcss"). The dev-server builds it with the Tailwind
|
|
95
97
|
* CLI and serves the result at /styles.css; `stylesheetWatch` decides
|
|
@@ -199,6 +201,12 @@ export type KumikoServerHandle = {
|
|
|
199
201
|
};
|
|
200
202
|
export declare const STYLESHEET_WATCH_ENV = "KUMIKO_DEV_STYLESHEET_WATCH";
|
|
201
203
|
export declare const PROD_BUNDLES_ENV = "KUMIKO_DEV_PROD_BUNDLES";
|
|
204
|
+
type DirectoryWatchEvents = (dir: string, options: {
|
|
205
|
+
readonly recursive: true;
|
|
206
|
+
readonly signal: AbortSignal;
|
|
207
|
+
}) => AsyncIterable<{
|
|
208
|
+
readonly filename: string | null;
|
|
209
|
+
}>;
|
|
202
210
|
export declare function classifyChange(filename: string): "restart" | "hot-reload" | "ignore";
|
|
203
211
|
export declare function classifyWatchedChange(watchedDir: string, filename: string, entrySourceFiles: ReadonlySet<string>): ReturnType<typeof classifyChange>;
|
|
204
212
|
export declare function resolveStylesheet(options: CreateKumikoServerOptions): string | undefined;
|
|
@@ -271,13 +271,13 @@ async function tryServePublicAsset(req, pathname, app, publicDir, socketAddress)
|
|
|
271
271
|
}
|
|
272
272
|
return honoTry.response;
|
|
273
273
|
}
|
|
274
|
-
async function watchDir(dir, onChange, signal) {
|
|
274
|
+
async function watchDir(dir, onChange, signal, watchEvents) {
|
|
275
275
|
// AbortSignal wird vom Server-stop() ausgelöst: ohne den Abort liefe
|
|
276
276
|
// die for-await-Schleife bis zum Process-Exit weiter. Im Test-Setup
|
|
277
277
|
// (afterEach räumt tmpdir mit rmSync auf) sähe der Watcher dann das
|
|
278
278
|
// rmSync, klassifizierte's als "restart" und riefe process.exit(75) —
|
|
279
279
|
// bubbles als unhandled error in vitest hoch.
|
|
280
|
-
const watcher =
|
|
280
|
+
const watcher = watchEvents(dir, { recursive: true, signal });
|
|
281
281
|
try {
|
|
282
282
|
for await (const ev of watcher) {
|
|
283
283
|
if (ev.filename)
|
|
@@ -1014,7 +1014,7 @@ export async function createKumikoServer(options) {
|
|
|
1014
1014
|
// buildClient already logged the failure; keep serving the
|
|
1015
1015
|
// last good bundle until the next successful rebuild.
|
|
1016
1016
|
}
|
|
1017
|
-
}, watcherAbort.signal);
|
|
1017
|
+
}, watcherAbort.signal, options._watchDirectory ?? watch);
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
1020
1020
|
// The per-boot prefix is never reused, so its BullMQ keys (queues,
|
package/dist/run-dev-app.d.ts
CHANGED
|
@@ -42,6 +42,9 @@ export type RunDevAppAuthOptions = {
|
|
|
42
42
|
/** Domain attribute for both auth cookies (see
|
|
43
43
|
* AuthRoutesConfig.cookieDomain). Symmetric to RunProdAppAuthOptions. */
|
|
44
44
|
readonly cookieDomain?: string;
|
|
45
|
+
/** Former cookie domains cleared on login/logout (see
|
|
46
|
+
* AuthRoutesConfig.retiredCookieDomains). */
|
|
47
|
+
readonly retiredCookieDomains?: readonly string[];
|
|
45
48
|
/** Server-side Origin allowlist for the CSRF guard (see
|
|
46
49
|
* AuthRoutesConfig.allowedOrigins). Symmetric to RunProdAppAuthOptions —
|
|
47
50
|
* required once `cookieDomain` is set. */
|
package/dist/run-dev-app.js
CHANGED
|
@@ -253,6 +253,9 @@ export async function runDevApp(options) {
|
|
|
253
253
|
...(effectiveAuth.cookieDomain !== undefined && {
|
|
254
254
|
cookieDomain: effectiveAuth.cookieDomain,
|
|
255
255
|
}),
|
|
256
|
+
...(effectiveAuth.retiredCookieDomains !== undefined && {
|
|
257
|
+
retiredCookieDomains: effectiveAuth.retiredCookieDomains,
|
|
258
|
+
}),
|
|
256
259
|
...(effectiveAuth.allowedOrigins !== undefined && {
|
|
257
260
|
allowedOrigins: effectiveAuth.allowedOrigins,
|
|
258
261
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.348.0",
|
|
4
4
|
"description": "Dev-tooling for Kumiko apps: local dev-server bootstrap (runDevApp), scaffolding, codegen. Its compose-stacks/env-schema subpaths are consumed at prod boot too — see @cosmicdrift/kumiko-server-runtime for the prod runner itself.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"kumiko-upgrade": "./bin/kumiko-upgrade.ts"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
68
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
69
|
-
"@cosmicdrift/kumiko-headless": "0.
|
|
70
|
-
"@cosmicdrift/kumiko-renderer-web": "0.
|
|
71
|
-
"@cosmicdrift/kumiko-server-runtime": "0.
|
|
67
|
+
"@cosmicdrift/kumiko-bundled-features": "0.348.0",
|
|
68
|
+
"@cosmicdrift/kumiko-framework": "0.348.0",
|
|
69
|
+
"@cosmicdrift/kumiko-headless": "0.348.0",
|
|
70
|
+
"@cosmicdrift/kumiko-renderer-web": "0.348.0",
|
|
71
|
+
"@cosmicdrift/kumiko-server-runtime": "0.348.0",
|
|
72
72
|
"bun-types": "^1.3.13",
|
|
73
73
|
"ts-morph": "^28.0.0",
|
|
74
74
|
"zod": "^4.4.3"
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.347.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Dev-server file watchers take an injectable event source so watcher tests no longer depend on FSEvents timing",
|
|
6
|
+
"detail": "Dev-server file watchers accept an injected event source\n`watchAndRegenerate` takes `watchDirectory` and `createKumikoServer` takes `_watchDirectory`. Production behavior is unchanged (native `fs.watch`); the hot-reload and codegen-watch tests drive changes through the seam instead of macOS FSEvents, which starts asynchronously and drops early writes."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.345.0",
|
|
4
10
|
"type": "fix",
|