@cosmicdrift/kumiko-dev-server 0.156.2 → 0.157.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-dev-server",
3
- "version": "0.156.2",
3
+ "version": "0.157.0",
4
4
  "description": "Dev-tooling for Kumiko apps: local dev-server bootstrap (runDevApp), scaffolding, codegen. Not shipped into production node_modules — see @cosmicdrift/kumiko-server-runtime for the prod boot path.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -54,9 +54,9 @@
54
54
  "kumiko-schema-check": "./bin/kumiko-schema-check.ts"
55
55
  },
56
56
  "dependencies": {
57
- "@cosmicdrift/kumiko-bundled-features": "0.156.2",
58
- "@cosmicdrift/kumiko-framework": "0.156.2",
59
- "@cosmicdrift/kumiko-server-runtime": "0.156.2",
57
+ "@cosmicdrift/kumiko-bundled-features": "0.157.0",
58
+ "@cosmicdrift/kumiko-framework": "0.157.0",
59
+ "@cosmicdrift/kumiko-server-runtime": "0.157.0",
60
60
  "ts-morph": "^28.0.0"
61
61
  },
62
62
  "publishConfig": {
@@ -55,10 +55,44 @@ describe("buildServerBundle (multi-entry + splitting)", () => {
55
55
  expect(pkg.scripts.start).toBe("bun run server.js");
56
56
  expect(Object.keys(pkg.dependencies)).not.toContain("drizzle-kit");
57
57
  expect(Object.keys(pkg.dependencies)).not.toContain("drizzle-orm");
58
+ // Positive counterpart to the negative checks above — a runtime
59
+ // external accidentally dropped from RUNTIME_EXTERNALS (into
60
+ // BUILD_ONLY_EXTERNALS instead) would slip through silently. This
61
+ // is the exact regression class behind the money-horse prod crash
62
+ // ("Cannot find package 'meilisearch'").
63
+ expect(Object.keys(pkg.dependencies)).toContain("meilisearch");
58
64
 
59
65
  expect(result.totalBytes).toBeGreaterThan(0);
60
66
  } finally {
61
67
  rmSync(dir, { recursive: true, force: true });
62
68
  }
63
69
  });
70
+
71
+ test("pins runtime-deps from node_modules/@cosmicdrift/* for consumer apps without a packages/ dir", async () => {
72
+ // Reproduziert #1217: findRepoRoot liefert für eine Consumer-App die
73
+ // App-Wurzel selbst (kein packages/-Ordner) — die Version muss aus den
74
+ // installierten node_modules/@cosmicdrift/*-Packages kommen, nicht "*".
75
+ const dir = makeFixture();
76
+ try {
77
+ const frameworkPkgDir = join(dir, "node_modules/@cosmicdrift/kumiko-framework");
78
+ mkdirSync(frameworkPkgDir, { recursive: true });
79
+ writeFileSync(
80
+ join(frameworkPkgDir, "package.json"),
81
+ `${JSON.stringify({ name: "@cosmicdrift/kumiko-framework", dependencies: { meilisearch: "^0.58.0" } })}\n`,
82
+ );
83
+ const bundledFeaturesPkgDir = join(dir, "node_modules/@cosmicdrift/kumiko-bundled-features");
84
+ mkdirSync(bundledFeaturesPkgDir, { recursive: true });
85
+ writeFileSync(
86
+ join(bundledFeaturesPkgDir, "package.json"),
87
+ `${JSON.stringify({ name: "@cosmicdrift/kumiko-bundled-features", dependencies: { ioredis: "^5.4.1" } })}\n`,
88
+ );
89
+
90
+ const result = await buildServerBundle({ cwd: dir, outDir: join(dir, "dist-server") });
91
+
92
+ expect(result.runtimeDeps["meilisearch"]).toBe("^0.58.0");
93
+ expect(result.runtimeDeps["ioredis"]).toBe("^5.4.1");
94
+ } finally {
95
+ rmSync(dir, { recursive: true, force: true });
96
+ }
97
+ });
64
98
  });
@@ -185,7 +185,7 @@ export async function buildServerBundle(
185
185
  entries.sort((a, b) => a.file.localeCompare(b.file));
186
186
  const totalBytes = [...entries, ...chunks].reduce((sum, e) => sum + e.sizeBytes, 0);
187
187
 
188
- const runtimeDeps = await resolveRuntimeDepsVersions(repoRoot, [
188
+ const runtimeDeps = await resolveRuntimeDepsVersions(cwd, repoRoot, [
189
189
  ...RUNTIME_EXTERNALS,
190
190
  ...(options.extraRuntimeExternals ?? []),
191
191
  ]);
@@ -224,23 +224,27 @@ function findRepoRoot(start: string): string | undefined {
224
224
  return undefined;
225
225
  }
226
226
 
227
- // Versionen für RUNTIME_EXTERNALS auflösen: erst aus framework + bundled-
228
- // features package.json (Workspace-pinning), Fallback auf "*" wenn nichts
229
- // gefunden. Ein Repo-Root muss existieren sonst kann eh kein CLI-Bundle
230
- // gemacht werden, also wird die Funktion gar nicht erst gerufen.
227
+ // Versionen für RUNTIME_EXTERNALS auflösen: erst aus den installierten
228
+ // node_modules/@cosmicdrift/*-Packages (relativ zu cwd funktioniert für
229
+ // jede Consumer-App), dann als Zusatz aus packages/framework + bundled-
230
+ // features (Workspace-Checkout des Frameworks selbst). Fallback auf "*"
231
+ // wenn keine Quelle den Namen kennt.
231
232
  async function resolveRuntimeDepsVersions(
233
+ cwd: string,
232
234
  repoRoot: string | undefined,
233
235
  packages: readonly string[],
234
236
  ): Promise<Record<string, string>> {
235
237
  const out: Record<string, string> = {};
236
- if (!repoRoot) {
237
- for (const pkg of packages) out[pkg] = "*";
238
- return out;
239
- }
240
238
 
241
239
  const pinSources = [
242
- join(repoRoot, "packages/framework/package.json"),
243
- join(repoRoot, "packages/bundled-features/package.json"),
240
+ join(cwd, "node_modules/@cosmicdrift/kumiko-framework/package.json"),
241
+ join(cwd, "node_modules/@cosmicdrift/kumiko-bundled-features/package.json"),
242
+ ...(repoRoot
243
+ ? [
244
+ join(repoRoot, "packages/framework/package.json"),
245
+ join(repoRoot, "packages/bundled-features/package.json"),
246
+ ]
247
+ : []),
244
248
  ];
245
249
  const allDeps: Record<string, string> = {};
246
250
  for (const path of pinSources) {