Fix Turbopack module resolution for lzma and restore path imports

This commit is contained in:
openhands committed 2026-08-25 22:19:59 +02:00
1 parent a5044c80d7
commit e06596391e
35 files changed
+392 -333

No files matched your search

+8 -6
View File
@@ -6,7 +6,6 @@
// FurnitureData.json is only ever read (a copy is made first).
import { promises as fs } from "node:fs";
import os from "node:os";
import path from "node:path";
import { sql } from "drizzle-orm";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { db } from "@/lib/db";
@@ -23,6 +22,7 @@ import {
classifyCatalogItem,
NO_CATALOG_KINDS,
} from "@/lib/services/item-kind";
import { getRuntimePath } from "@/lib/utils/runtime-path";
const { getGamedataRootMock, getNitroFilesRootMock, settingGetMock } =
vi.hoisted(() => ({
@@ -59,9 +59,11 @@ let tmpRoot: string;
let gamedataDir: string;
beforeAll(async () => {
tmpRoot = await fs.mkdtemp(path.join(os.tmpdir(), "furni-repair-rehearsal-"));
gamedataDir = path.join(tmpRoot, "Gamedata");
await fs.mkdir(path.join(gamedataDir, "config"), { recursive: true });
tmpRoot = await fs.mkdtemp(
getRuntimePath(os.tmpdir(), "furni-repair-rehearsal-"),
);
gamedataDir = getRuntimePath(tmpRoot, "Gamedata");
await fs.mkdir(getRuntimePath(gamedataDir, "config"), { recursive: true });
getGamedataRootMock.mockResolvedValue(gamedataDir);
getNitroFilesRootMock.mockResolvedValue("");
settingGetMock.mockImplementation(
@@ -75,7 +77,7 @@ beforeAll(async () => {
try {
await fs.copyFile(
REAL_FURNIDATA,
path.join(gamedataDir, "config", "FurnitureData.json"),
getRuntimePath(gamedataDir, "config", "FurnitureData.json"),
);
} catch {
// missing copy — repair still runs against an empty file
@@ -242,7 +244,7 @@ describeGuard("catalog studio live repair rehearsal (sandbox)", () => {
byName.set(r.item_name, (byName.get(r.item_name) ?? 0) + 1);
const finalFd = JSON.parse(
await fs.readFile(
path.join(gamedataDir, "config", "FurnitureData.json"),
getRuntimePath(gamedataDir, "config", "FurnitureData.json"),
"utf8",
),
) as Record<string, { furnitype: Array<Record<string, unknown>> }>;