@cosmicdrift/kumiko-server-runtime 0.338.0 → 0.339.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.
@@ -33,9 +33,9 @@ export type BuildResult = {
33
33
  * undefined bei vanilla public-only-Builds (kein Bundle). */
34
34
  readonly buildInfo?: BuildInfo;
35
35
  };
36
- /** In index.html gebacken (`window.__KUMIKO_BUILD__`) UND als
37
- * dist/build-info.json geschrieben. Der UpdateChecker pollt build-info.json
38
- * und vergleicht `id` gegen den geladenen Stand → Reload-Banner bei Drift. */
36
+ /** Baked into index.html (`<meta name="kumiko-build">`) AND written as
37
+ * dist/build-info.json. The UpdateChecker polls build-info.json and compares
38
+ * `id` with the loaded build, showing a reload banner on drift. */
39
39
  export type BuildInfo = {
40
40
  /** Hash über die sortierten (content-gehashten) Asset-URLs. Ändert sich
41
41
  * gdw. sich ein Asset ändert — selbsttragend, kein Env-Var/Dockerfile. */
@@ -51,6 +51,7 @@ import { cp, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
51
51
  import { tmpdir } from "node:os";
52
52
  import { isAbsolute, join, relative, resolve, sep } from "node:path";
53
53
  import { isPlainObject, parseJsonOrThrow } from "@cosmicdrift/kumiko-framework/utils";
54
+ import { escapeHtmlAttr } from "@cosmicdrift/kumiko-headless";
54
55
  import { Temporal } from "temporal-polyfill";
55
56
  import { RENDERER_WEB_FONT_FILE_PATTERN, RENDERER_WEB_FONTS_DIST_DIR, resolveRendererWebFontsDir, } from "./renderer-web-fonts.js";
56
57
  import { canResolveTailwindStylesheet, resolveTailwindCli } from "./resolve-tailwind-cli.js";
@@ -654,6 +655,7 @@ export function buildMissingTemplateError(manifest, entry) {
654
655
  `\n` +
655
656
  `Der Build ersetzt /styles.css und /${entry.manifestKey} durch die gehashten URLs.`);
656
657
  }
658
+ const BUILD_META_NAME = "kumiko-build";
657
659
  // @internal — exported nur für Unit-Tests.
658
660
  //
659
661
  // Convention: das HTML-Template MUSS Placeholder-Tags für jedes Asset
@@ -668,10 +670,10 @@ export function buildMissingTemplateError(manifest, entry) {
668
670
  // Diff zwischen Dev- und Prod-HTML unsichtbar macht.
669
671
  export function injectAssetTags(html, manifest, entry, buildInfo) {
670
672
  let result = html;
671
- // Build-Stand vor </head> backen. Ohne </head> (z.B. Fragment) still skip.
673
+ // Meta tag instead of an inline script: strict CSPs (script-src 'self') block inline scripts.
674
+ // Without </head> (e.g. a fragment) skip silently.
672
675
  if (buildInfo && result.includes("</head>")) {
673
- // html-ok: id/builtAt sind Hex bzw. ISO — kein `<` möglich, kein Breakout.
674
- const tag = `<script>window.__KUMIKO_BUILD__=${JSON.stringify(buildInfo)};</script>`;
676
+ const tag = `<meta name="${BUILD_META_NAME}" content="${escapeHtmlAttr(buildInfo.id)}" data-built-at="${escapeHtmlAttr(buildInfo.builtAt)}" />`;
675
677
  result = result.replace("</head>", ` ${tag}\n </head>`);
676
678
  }
677
679
  const cssUrl = manifest["styles.css"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-server-runtime",
3
- "version": "0.338.0",
3
+ "version": "0.339.0",
4
4
  "description": "Production server-boot runtime for Kumiko apps: connections, schema-drift-gate, seeds, lifecycle, graceful shutdown. Symmetric to kumiko-dev-server's runDevApp, without dev/scaffold/codegen tooling.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -80,10 +80,10 @@
80
80
  }
81
81
  },
82
82
  "dependencies": {
83
- "@cosmicdrift/kumiko-bundled-features": "0.338.0",
84
- "@cosmicdrift/kumiko-framework": "0.338.0",
85
- "@cosmicdrift/kumiko-headless": "0.338.0",
86
- "@cosmicdrift/kumiko-renderer-web": "0.338.0",
83
+ "@cosmicdrift/kumiko-bundled-features": "0.339.0",
84
+ "@cosmicdrift/kumiko-framework": "0.339.0",
85
+ "@cosmicdrift/kumiko-headless": "0.339.0",
86
+ "@cosmicdrift/kumiko-renderer-web": "0.339.0",
87
87
  "bun-types": "^1.3.13",
88
88
  "ioredis": "^5.10.1",
89
89
  "temporal-polyfill": "^0.3.2"
package/src/changes.json CHANGED
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "version": "0.339.0",
4
+ "type": "fix",
5
+ "title": "Prod builds no longer inject an inline script for the build info, so strict CSPs without unsafe-inline work without hashes or nonces",
6
+ "detail": "Build info is baked into index.html as a meta tag instead of an inline script",
7
+ "migration": "window.__KUMIKO_BUILD__ no longer exists. Code that read it (for example a version footer) now gets undefined and silently renders nothing. Replace the global with readLoadedBuild() from @cosmicdrift/kumiko-renderer-web, which returns { id, builtAt } from the new <meta name=\"kumiko-build\"> tag, and drop the Window augmentation for __KUMIKO_BUILD__. The UpdateChecker needs no change."
8
+ },
2
9
  {
3
10
  "version": "0.338.0",
4
11
  "type": "improvement",