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 -5
View File
@@ -1,8 +1,8 @@
import { existsSync, promises as fs } from "node:fs";
import path from "node:path";
import { downloadFile } from "@/lib/services/import/core/download";
import { CANONICAL_PETS, resolvePetSwfUrl } from "@/lib/services/pet-source";
import { convertSwfToNitro } from "@/lib/services/swf-to-nitro";
import { getRuntimePath } from "@/lib/utils/runtime-path";
export interface PetListItem {
lib: string;
@@ -16,11 +16,11 @@ export interface ImportPetResult {
error?: string;
}
export const PET_NITRO_DIR = path.join(
export const PET_NITRO_DIR = getRuntimePath(
/*turbopackIgnore: true*/ process.cwd(),
"public/nitro-assets/bundled/pet",
);
export const PET_SWF_DIR = path.join(
export const PET_SWF_DIR = getRuntimePath(
/*turbopackIgnore: true*/ process.cwd(),
"public/swf/gordon",
);
@@ -36,7 +36,10 @@ export async function ensurePetDirs(): Promise<void> {
}
function nitroPathFor(lib: string): string {
return path.join(/*turbopackIgnore: true*/ PET_NITRO_DIR, `${lib}.nitro`);
return getRuntimePath(
/*turbopackIgnore: true*/ PET_NITRO_DIR,
`${lib}.nitro`,
);
}
export async function importSinglePet(params: {
@@ -48,7 +51,7 @@ export async function importSinglePet(params: {
await ensurePetDirs();
onProgress?.("downloading");
const swfPath = path.join(
const swfPath = getRuntimePath(
/*turbopackIgnore: true*/ PET_SWF_DIR,
`${lib}.swf`,
);