@cosmicdrift/kumiko-dev-server 0.122.4 → 0.123.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/package.json +3 -3
- package/src/build-prod-bundle.ts +6 -3
- package/src/inject-schema.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.123.0",
|
|
4
4
|
"description": "Development server bootstrap for Kumiko apps. Bundles the client, mints dev-JWTs, injects the resolved AppSchema, and seeds an admin. Not for production.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"kumiko-schema-check": "./bin/kumiko-schema-check.ts"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
54
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
53
|
+
"@cosmicdrift/kumiko-bundled-features": "0.123.0",
|
|
54
|
+
"@cosmicdrift/kumiko-framework": "0.123.0",
|
|
55
55
|
"ts-morph": "^28.0.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
package/src/build-prod-bundle.ts
CHANGED
|
@@ -544,7 +544,8 @@ function buildMissingTemplateError(manifest: BuildManifest, entry: ClientEntry):
|
|
|
544
544
|
? ` <link rel="stylesheet" href="/styles.css" />\n`
|
|
545
545
|
: "";
|
|
546
546
|
const jsLine = manifest[entry.manifestKey]
|
|
547
|
-
?
|
|
547
|
+
? // html-ok: Error-Hilfetext (Tag-Snippet als Text), wird nie gerendert.
|
|
548
|
+
` <script type="module" src="/${entry.manifestKey}"></script>\n`
|
|
548
549
|
: "";
|
|
549
550
|
return (
|
|
550
551
|
`[kumiko build] kein ${entry.htmlPath} gefunden, aber es gibt JS/CSS-Output.\n` +
|
|
@@ -587,9 +588,9 @@ export function injectAssetTags(
|
|
|
587
588
|
): string {
|
|
588
589
|
let result = html;
|
|
589
590
|
|
|
590
|
-
// Build-Stand vor </head> backen.
|
|
591
|
-
// </script>-Escaping nötig. Ohne </head> (z.B. Fragment) still skip.
|
|
591
|
+
// Build-Stand vor </head> backen. Ohne </head> (z.B. Fragment) still skip.
|
|
592
592
|
if (buildInfo && result.includes("</head>")) {
|
|
593
|
+
// html-ok: id/builtAt sind Hex bzw. ISO — kein `<` möglich, kein Breakout.
|
|
593
594
|
const tag = `<script>window.__KUMIKO_BUILD__=${JSON.stringify(buildInfo)};</script>`;
|
|
594
595
|
result = result.replace("</head>", ` ${tag}\n </head>`);
|
|
595
596
|
}
|
|
@@ -608,6 +609,7 @@ export function injectAssetTags(
|
|
|
608
609
|
}),
|
|
609
610
|
);
|
|
610
611
|
}
|
|
612
|
+
// html-ok: cssUrl ist ein selbst-generierter Manifest-Asset-Pfad (Hash-Name).
|
|
611
613
|
result = result.replace(placeholder[0], `<link rel="stylesheet" href="${cssUrl}" />`);
|
|
612
614
|
}
|
|
613
615
|
|
|
@@ -630,6 +632,7 @@ export function injectAssetTags(
|
|
|
630
632
|
}),
|
|
631
633
|
);
|
|
632
634
|
}
|
|
635
|
+
// html-ok: jsUrl ist ein selbst-generierter Manifest-Asset-Pfad (Hash-Name).
|
|
633
636
|
result = result.replace(placeholder[0], `<script type="module" src="${jsUrl}"></script>`);
|
|
634
637
|
}
|
|
635
638
|
|
package/src/inject-schema.ts
CHANGED
|
@@ -14,9 +14,15 @@
|
|
|
14
14
|
// Reads (prod) oder bereits-vorbereitete templates (custom CI-builds)
|
|
15
15
|
// stacking-Tags produzieren.
|
|
16
16
|
|
|
17
|
+
// `<` als < serialisieren: verhindert `</script>`-Breakout aus dem
|
|
18
|
+
// RAWTEXT-Block, JSON bleibt valides JS.
|
|
19
|
+
function scriptSafeJsonHtml(json: string): string {
|
|
20
|
+
return json.replace(/</g, "\\u003c");
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
export function injectSchema(html: string, schemaJson: string): string {
|
|
18
24
|
if (html.includes("__KUMIKO_SCHEMA__")) return html;
|
|
19
|
-
const tag = `<script>window.__KUMIKO_SCHEMA__=${schemaJson};</script>`;
|
|
25
|
+
const tag = `<script>window.__KUMIKO_SCHEMA__=${scriptSafeJsonHtml(schemaJson)};</script>`;
|
|
20
26
|
if (html.includes('<script src="/client.js"')) {
|
|
21
27
|
return html.replace('<script src="/client.js"', `${tag}<script src="/client.js"`);
|
|
22
28
|
}
|