@cosmicdrift/kumiko-dev-server 0.353.0 → 0.354.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/bin/kumiko-build.ts +18 -2
- package/dist/codegen/run-codegen.d.ts +3 -0
- package/dist/codegen/run-codegen.js +14 -10
- package/dist/create-kumiko-server.d.ts +1 -0
- package/dist/create-kumiko-server.js +2 -1
- package/dist/run-dev-app.js +1 -0
- package/dist/scaffold-feature.js +1 -1
- package/package.json +6 -6
- package/src/changes.json +6 -0
package/bin/kumiko-build.ts
CHANGED
|
@@ -33,18 +33,34 @@ import {
|
|
|
33
33
|
|
|
34
34
|
if (process.argv.slice(2).some((arg) => arg === "--help" || arg === "-h")) {
|
|
35
35
|
process.stdout.write(
|
|
36
|
-
"Usage: kumiko-build [app-dir] build client (dist/) and server (dist-server/) bundles
|
|
36
|
+
"Usage: kumiko-build [--check] [app-dir] build client (dist/) and server (dist-server/) bundles;\n" +
|
|
37
|
+
" --check only verifies .kumiko/ is up to date (exit 1 on drift, writes nothing)\n",
|
|
37
38
|
);
|
|
38
39
|
process.exit(0);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const
|
|
42
|
+
const checkCodegenOnly = process.argv.includes("--check");
|
|
43
|
+
const explicit = process.argv.slice(2).find((arg) => !arg.startsWith("-"));
|
|
42
44
|
const cwd = explicit ? resolve(process.cwd(), explicit) : process.cwd();
|
|
43
45
|
|
|
44
46
|
const red = "\x1b[31m";
|
|
45
47
|
const yellow = "\x1b[33m";
|
|
46
48
|
const reset = "\x1b[0m";
|
|
47
49
|
|
|
50
|
+
if (checkCodegenOnly) {
|
|
51
|
+
const drift = runCodegen({ appRoot: cwd, checkOnly: true });
|
|
52
|
+
for (const w of drift.warnings) {
|
|
53
|
+
process.stderr.write(`${yellow}!${reset} [codegen] ${formatScanWarning(w)}\n`);
|
|
54
|
+
}
|
|
55
|
+
if (drift.didWriteTypes || drift.didWriteDefine || drift.didWriteSchemas) {
|
|
56
|
+
process.stderr.write(
|
|
57
|
+
`\n ${red}✗${reset} .kumiko/ is stale; run kumiko-build or the dev-server and commit.\n\n`,
|
|
58
|
+
);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
process.exit(0);
|
|
62
|
+
}
|
|
63
|
+
|
|
48
64
|
try {
|
|
49
65
|
// Read once up front — resolveClientEntries can throw (mutual exclusion,
|
|
50
66
|
// malformed declaration, unmigrated legacy client-*.tsx files) and that
|
|
@@ -7,6 +7,9 @@ export type CodegenOptions = {
|
|
|
7
7
|
* Die Dev-Server-Integration übergibt die QNs direkt aus der gebooteten
|
|
8
8
|
* Registry — CLI ruft sie aus dem Manifest. */
|
|
9
9
|
readonly handlerQns?: readonly string[];
|
|
10
|
+
/** Drift check for CI: nothing is written or removed; the `didWrite*` flags
|
|
11
|
+
* report which files would have changed. */
|
|
12
|
+
readonly checkOnly?: boolean;
|
|
10
13
|
};
|
|
11
14
|
export type CodegenResult = {
|
|
12
15
|
readonly outputDir: string;
|
|
@@ -44,7 +44,9 @@ export function runCodegen(opts) {
|
|
|
44
44
|
skipped: true,
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
const checkOnly = opts.checkOnly === true;
|
|
48
|
+
if (!checkOnly)
|
|
49
|
+
mkdirSync(outputDir, { recursive: true });
|
|
48
50
|
const typesContent = renderTypesAugmentation(scan.events, outputDir);
|
|
49
51
|
// `opts.handlerQns` undefined means the caller (kumiko-build) has no
|
|
50
52
|
// live feature registry to draw from and relies on the manifest
|
|
@@ -82,12 +84,12 @@ export function runCodegen(opts) {
|
|
|
82
84
|
const finalDefineContent = shouldPreserveStaleBlock
|
|
83
85
|
? withPreservedBlock(defineContent, definePath, TYPED_DISPATCHER_MARKER, LEGACY_TYPED_DISPATCHER_ANCHOR)
|
|
84
86
|
: defineContent;
|
|
85
|
-
const didWriteTypes = writeIfChanged(typesPath, finalTypesContent);
|
|
86
|
-
const didWriteDefine = writeIfChanged(definePath, finalDefineContent);
|
|
87
|
-
writeIfChanged(packageJsonPath, packageJsonContent);
|
|
87
|
+
const didWriteTypes = writeIfChanged(typesPath, finalTypesContent, checkOnly);
|
|
88
|
+
const didWriteDefine = writeIfChanged(definePath, finalDefineContent, checkOnly);
|
|
89
|
+
writeIfChanged(packageJsonPath, packageJsonContent, checkOnly);
|
|
88
90
|
const didWriteSchemas = schemasContent !== undefined
|
|
89
|
-
? writeIfChanged(schemasPath, schemasContent)
|
|
90
|
-
: removeIfExists(schemasPath);
|
|
91
|
+
? writeIfChanged(schemasPath, schemasContent, checkOnly)
|
|
92
|
+
: removeIfExists(schemasPath, checkOnly);
|
|
91
93
|
const warnings = shouldPreserveStaleBlock
|
|
92
94
|
? [
|
|
93
95
|
...scan.warnings,
|
|
@@ -144,11 +146,12 @@ function renderKumikoPackageJson() {
|
|
|
144
146
|
* must NOT trigger a full TS-language-server rebuild (which would
|
|
145
147
|
* happen on every mtime change).
|
|
146
148
|
*/
|
|
147
|
-
function writeIfChanged(path, content) {
|
|
149
|
+
function writeIfChanged(path, content, checkOnly) {
|
|
148
150
|
const existing = readExistingOrUndefined(path);
|
|
149
151
|
if (existing === content)
|
|
150
152
|
return false;
|
|
151
|
-
|
|
153
|
+
if (!checkOnly)
|
|
154
|
+
writeFileSync(path, content, "utf-8");
|
|
152
155
|
return true;
|
|
153
156
|
}
|
|
154
157
|
function readExistingOrUndefined(path) {
|
|
@@ -192,10 +195,11 @@ function extractBlock(content, anchor) {
|
|
|
192
195
|
* produces it (e.g. the last inline-schema was refactored to a named
|
|
193
196
|
* export). Returns true when an actual unlink happened.
|
|
194
197
|
*/
|
|
195
|
-
function removeIfExists(path) {
|
|
198
|
+
function removeIfExists(path, checkOnly) {
|
|
196
199
|
if (!existsSync(path))
|
|
197
200
|
return false;
|
|
198
|
-
|
|
201
|
+
if (!checkOnly)
|
|
202
|
+
rmSync(path, { force: true });
|
|
199
203
|
return true;
|
|
200
204
|
}
|
|
201
205
|
const featureManifestSchema = z.object({
|
|
@@ -201,6 +201,7 @@ export type KumikoServerHandle = {
|
|
|
201
201
|
};
|
|
202
202
|
export declare const STYLESHEET_WATCH_ENV = "KUMIKO_DEV_STYLESHEET_WATCH";
|
|
203
203
|
export declare const PROD_BUNDLES_ENV = "KUMIKO_DEV_PROD_BUNDLES";
|
|
204
|
+
export declare const DEFAULT_HTML = "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,interactive-widget=resizes-content\" />\n <title>Kumiko</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/client.js\"></script>\n </body>\n</html>\n";
|
|
204
205
|
type DirectoryWatchEvents = (dir: string, options: {
|
|
205
206
|
readonly recursive: true;
|
|
206
207
|
readonly signal: AbortSignal;
|
|
@@ -93,7 +93,7 @@ const RELOAD_SNIPPET = `
|
|
|
93
93
|
// keyboard shrinks only the visual viewport, not the layout viewport that
|
|
94
94
|
// `position: fixed` anchors to — a fixed bottom action bar would stay
|
|
95
95
|
// pinned behind the keyboard instead of above it.
|
|
96
|
-
const DEFAULT_HTML = `<!doctype html>
|
|
96
|
+
export const DEFAULT_HTML = `<!doctype html>
|
|
97
97
|
<html lang="en">
|
|
98
98
|
<head>
|
|
99
99
|
<meta charset="utf-8" />
|
|
@@ -755,6 +755,7 @@ export async function createKumikoServer(options) {
|
|
|
755
755
|
path: url.pathname,
|
|
756
756
|
host,
|
|
757
757
|
systemQuery: buildDevSystemQuery(req, socketAddress),
|
|
758
|
+
requestSignal: req.signal,
|
|
758
759
|
});
|
|
759
760
|
}
|
|
760
761
|
return new Response(html, { status, headers });
|
package/dist/run-dev-app.js
CHANGED
package/dist/scaffold-feature.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.354.1",
|
|
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.354.1",
|
|
68
|
+
"@cosmicdrift/kumiko-framework": "0.354.1",
|
|
69
|
+
"@cosmicdrift/kumiko-headless": "0.354.1",
|
|
70
|
+
"@cosmicdrift/kumiko-renderer-web": "0.354.1",
|
|
71
|
+
"@cosmicdrift/kumiko-server-runtime": "0.354.1",
|
|
72
72
|
"bun-types": "^1.3.13",
|
|
73
73
|
"ts-morph": "^28.0.0",
|
|
74
74
|
"zod": "^4.4.3"
|