Fix Turbopack module resolution for lzma and restore path imports
This commit is contained in:
1 parent
a5044c80d7
commit
e06596391e
35 files changed
+392
-333
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import { existsSync, promises as fs } from "node:fs";
|
||||
import path from "node:path";
|
||||
import {
|
||||
listOfficialEffects,
|
||||
resolveEffectSwfUrl,
|
||||
@@ -13,17 +12,18 @@ import { getGamedataRoot } from "@/lib/services/furni-asset-dirs";
|
||||
import { downloadFile } from "@/lib/services/import/core/download";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
import { convertSwfToNitro } from "@/lib/services/swf-to-nitro";
|
||||
import { getRuntimePath } from "@/lib/utils/runtime-path";
|
||||
import type {
|
||||
EffectListItem,
|
||||
EffectMapEntry,
|
||||
ImportEffectResult,
|
||||
} from "@/types/effects";
|
||||
|
||||
const EFFECT_NITRO_DIR_FALLBACK = path.join(
|
||||
const EFFECT_NITRO_DIR_FALLBACK = getRuntimePath(
|
||||
/*turbopackIgnore: true*/ process.cwd(),
|
||||
"public/nitro-assets/bundled/effect",
|
||||
);
|
||||
const EFFECT_SWF_DIR_FALLBACK = path.join(
|
||||
const EFFECT_SWF_DIR_FALLBACK = getRuntimePath(
|
||||
/*turbopackIgnore: true*/ process.cwd(),
|
||||
"public/swf/gordon",
|
||||
);
|
||||
@@ -35,7 +35,10 @@ async function getEffectNitroDir(): Promise<string> {
|
||||
if (configured) return configured;
|
||||
const gamedataRoot = await getGamedataRoot();
|
||||
if (gamedataRoot)
|
||||
return path.join(/*turbopackIgnore: true*/ gamedataRoot, "bundled/effect");
|
||||
return getRuntimePath(
|
||||
/*turbopackIgnore: true*/ gamedataRoot,
|
||||
"bundled/effect",
|
||||
);
|
||||
return EFFECT_NITRO_DIR_FALLBACK;
|
||||
}
|
||||
|
||||
@@ -61,7 +64,7 @@ export async function ensureEffectDirs(): Promise<void> {
|
||||
}
|
||||
|
||||
async function nitroPathFor(lib: string): Promise<string> {
|
||||
return path.join(
|
||||
return getRuntimePath(
|
||||
/*turbopackIgnore: true*/ await getEffectNitroDir(),
|
||||
`${lib}.nitro`,
|
||||
);
|
||||
@@ -82,7 +85,7 @@ export async function importSingleEffect(params: {
|
||||
|
||||
// Download SWF
|
||||
onProgress?.("downloading");
|
||||
const swfPath = path.join(
|
||||
const swfPath = getRuntimePath(
|
||||
/*turbopackIgnore: true*/ await getEffectSwfDir(),
|
||||
`${lib}.swf`,
|
||||
);
|
||||
@@ -167,7 +170,7 @@ export async function getEffectList(search: string): Promise<EffectListItem[]> {
|
||||
...e,
|
||||
present: localByLib.has(e.lib),
|
||||
nitroExists: existsSync(
|
||||
/*turbopackIgnore: true*/ path.join(nitroDir, `${e.lib}.nitro`),
|
||||
/*turbopackIgnore: true*/ getRuntimePath(nitroDir, `${e.lib}.nitro`),
|
||||
),
|
||||
}));
|
||||
return term
|
||||
|
||||
Reference in new issue
Block a user