move to vfs package

This commit is contained in:
tresabhi committed 2026-11-23 20:27:55 -06:00
1 parent ff1aadb774
commit a89c75509e
49 files changed
+125 -96

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { assertSecret } from "@blitzkit/core";
import { fetchWGCClientSource } from "./fetchWGCClientSource";
import { AbstractVFS } from "./abstract";
import { LocalVFS } from "./local";
import { MixedVFS } from "./mixed";
import { SevenZipVFS } from "./sevenZip";
import { ZipVFS } from "./zip";
export async function createClientVFS() {
const provider = import.meta.env.CLIENT_PROVIDER;
let vfs: AbstractVFS;
if (provider === "zip") {
vfs = new ZipVFS(assertSecret(import.meta.env.CLIENT_SOURCE));
} else if (provider === "7z") {
vfs = new SevenZipVFS(assertSecret(import.meta.env.CLIENT_SOURCE));
} else if (provider === "wgc") {
vfs = new SevenZipVFS(await fetchWGCClientSource());
} else if (provider === "local") {
vfs = new LocalVFS(assertSecret(import.meta.env.CLIENT_DIR));
} else {
throw new Error(`Unknown client provider: ${provider}`);
}
// smart dlc patches take precedence over the client
const smartDlcDir = import.meta.env.SMART_DLC_DIR;
if (smartDlcDir) {
vfs = new MixedVFS([new LocalVFS(smartDlcDir), vfs]);
}
return await vfs.init();
}