@cosmicdrift/kumiko-dev-server 0.352.0 → 0.353.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.
@@ -20,8 +20,8 @@ import { readFile, realpath, watch } from "node:fs/promises";
20
20
  import { tmpdir } from "node:os";
21
21
  import { join, resolve, sep } from "node:path";
22
22
  import { resolveAnonymousAccessFromRegistry } from "@cosmicdrift/kumiko-bundled-features/auth-foundation";
23
- import { buildRequestContextDataFromRequest, createClientIpResolver, generateToken, requestContext, } from "@cosmicdrift/kumiko-framework/api";
24
- import { buildAppSchema, createAnonymousUser, } from "@cosmicdrift/kumiko-framework/engine";
23
+ import { createClientIpResolver, generateToken, } from "@cosmicdrift/kumiko-framework/api";
24
+ import { buildAppSchema } from "@cosmicdrift/kumiko-framework/engine";
25
25
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
26
26
  import { pushEntityProjectionTables, setupTestStack, TestUsers, } from "@cosmicdrift/kumiko-framework/stack";
27
27
  import { resolveAndInjectPageHead, } from "@cosmicdrift/kumiko-headless/apex";
@@ -29,6 +29,7 @@ import { startDevJobRunners } from "@cosmicdrift/kumiko-server-runtime/boot/job-
29
29
  import { buildBunServeOptions, resolveDerivedMaxRequestBodySize, } from "@cosmicdrift/kumiko-server-runtime/bun-serve-options";
30
30
  import { makeDispatchSystemWrite, } from "@cosmicdrift/kumiko-server-runtime/extra-routes-deps";
31
31
  import { RENDERER_WEB_FONT_FILE_PATTERN, RENDERER_WEB_FONTS_URL_PREFIX, resolveRendererWebFontsDir, } from "@cosmicdrift/kumiko-server-runtime/renderer-web-fonts";
32
+ import { buildRequestBoundSystemQuery } from "@cosmicdrift/kumiko-server-runtime/request-bound-system-query";
32
33
  import { canResolveTailwindStylesheet, resolveTailwindCli, } from "@cosmicdrift/kumiko-server-runtime/resolve-tailwind-cli";
33
34
  import { stripNoRouteMatchHeader, tryHonoFirst, } from "@cosmicdrift/kumiko-server-runtime/try-hono-first";
34
35
  // Runtime-detection. The dev-server is meant to run under Bun (Kumiko's
@@ -725,11 +726,12 @@ export async function createKumikoServer(options) {
725
726
  // warn-once flags in dev is an accepted, low-risk gap (dev normally
726
727
  // runs unproxied — see CreateKumikoServerOptions.trustedProxyHops).
727
728
  const pageHeadClientIpResolver = createClientIpResolver(options.trustedProxyHops ?? 0, "createKumikoServer(pageHead)");
728
- const buildDevSystemQuery = (req, socketAddress) => (type, payload, tenantId) => requestContext.run(requestContext.get() ??
729
- buildRequestContextDataFromRequest(req, {
730
- resolver: pageHeadClientIpResolver,
731
- socketAddress,
732
- }), () => stack.dispatcher.query(type, payload, createAnonymousUser(tenantId)));
729
+ const buildDevSystemQuery = (req, socketAddress) => buildRequestBoundSystemQuery({
730
+ req,
731
+ dispatcher: stack.dispatcher,
732
+ resolver: pageHeadClientIpResolver,
733
+ socketAddress,
734
+ });
733
735
  // resolvePageHead goes through the same headless resolveAndInjectPageHead
734
736
  // that runProdApp uses, so dev and e2e exercise the one timeout and
735
737
  // fallback path instead of a second copy of it (#3026).
@@ -47,6 +47,12 @@ export function renderDeployFiles(options) {
47
47
  // `failed to compute cache key: "/app/seeds": not found`.
48
48
  const sourceDir = options.sourceDir ?? destinationRoot;
49
49
  const detected = detectOptionalSurfaces(sourceDir, options.appName);
50
+ if (detected.hasPrivateGhPackages && detected.registryConfigFiles.length === 0) {
51
+ // The Dockerfile only forwards the auth build-arg; without a registry
52
+ // config scope entry bun resolves @cosmicdriftgamestudio/* against npmjs
53
+ // and the image build fails late with a 404.
54
+ throw new Error(`renderDeployFiles: private @cosmicdriftgamestudio/* deps need a bunfig.toml or .npmrc in ${sourceDir} with a scope entry for the private registry`);
55
+ }
50
56
  const installManifests = ["package.json", "bun.lock", ...detected.registryConfigFiles].join(" ");
51
57
  const subs = {
52
58
  appName: options.appName,
@@ -198,8 +204,10 @@ function detectOptionalSurfaces(sourceDir, appName) {
198
204
  let deployConfigRaw;
199
205
  const pkgJsonPath = join(sourceDir, "package.json");
200
206
  if (existsSync(pkgJsonPath)) {
207
+ let jsonParsed = false;
201
208
  try {
202
209
  const raw = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
210
+ jsonParsed = true;
203
211
  // Read ahead of packageJsonSchema.parse: an unrelated shape problem in
204
212
  // `dependencies`/`workspaces` must not silently discard a valid deploy
205
213
  // config along with it (that's caught by the outer catch below).
@@ -221,8 +229,12 @@ function detectOptionalSurfaces(sourceDir, appName) {
221
229
  // back to defaults (an invalid deploy config must THROW, but
222
230
  // unreadable JSON can't distinguish "no deploy config" from "invalid
223
231
  // deploy config" — it already surfaces via this warning).
232
+ const reason = err instanceof Error ? err.message : String(err);
233
+ const message = jsonParsed
234
+ ? `scaffoldDeploy: package.json at ${pkgJsonPath} has an unexpected dependencies/workspaces shape — private-GH-packages/install-layout detection skipped (${reason})`
235
+ : `scaffoldDeploy: package.json at ${pkgJsonPath} is not valid JSON — private-GH-packages/install-layout detection skipped and kumiko.deploy (dbUser/dbName/stackNetwork) falls back to the defaults (${reason})`;
224
236
  // biome-ignore lint/suspicious/noConsole: scaffold visibility for skipped private-package detection
225
- console.warn(`scaffoldDeploy: package.json at ${pkgJsonPath} is not valid JSON — private-GH-packages/install-layout detection skipped (${err instanceof Error ? err.message : String(err)})`);
237
+ console.warn(message);
226
238
  }
227
239
  }
228
240
  const registryConfigFiles = REGISTRY_CONFIG_FILES.filter((f) => existsSync(join(sourceDir, f)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-dev-server",
3
- "version": "0.352.0",
3
+ "version": "0.353.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.352.0",
68
- "@cosmicdrift/kumiko-framework": "0.352.0",
69
- "@cosmicdrift/kumiko-headless": "0.352.0",
70
- "@cosmicdrift/kumiko-renderer-web": "0.352.0",
71
- "@cosmicdrift/kumiko-server-runtime": "0.352.0",
67
+ "@cosmicdrift/kumiko-bundled-features": "0.353.0",
68
+ "@cosmicdrift/kumiko-framework": "0.353.0",
69
+ "@cosmicdrift/kumiko-headless": "0.353.0",
70
+ "@cosmicdrift/kumiko-renderer-web": "0.353.0",
71
+ "@cosmicdrift/kumiko-server-runtime": "0.353.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,15 @@
1
1
  [
2
+ {
3
+ "version": "0.353.0",
4
+ "type": "fix",
5
+ "title": "init-deploy fails early when private GitHub packages have no bunfig.toml or .npmrc",
6
+ "detail": "init-deploy rejects private GitHub packages without a registry config\nAn app with `@cosmicdriftgamestudio/*` dependencies but no `bunfig.toml`/`.npmrc` used to get a Dockerfile whose `bun install` failed with a 404 only inside the image build. `scaffoldDeploy`, `renderDeployFiles` and `checkDeployDrift` now throw with a hint to add the scope entry."
7
+ },
8
+ {
9
+ "version": "0.353.0",
10
+ "type": "improvement",
11
+ "title": "Deploy scaffold warnings distinguish broken package.json from unexpected dependency shapes"
12
+ },
2
13
  {
3
14
  "version": "0.351.0",
4
15
  "type": "fix",