MCPcopy
hub / github.com/vercel-labs/just-bash / createLegacyFs

Function createLegacyFs

packages/just-bash/src/encoding.fs-fallback.test.ts:19–33  ·  view source on GitHub ↗

* Wrap an InMemoryFs in a Proxy that hides `readFileBytes`, forcing every * caller down the fallback path. Delegates everything else.

(seed: Record<string, string>)

Source from the content-addressed store, hash-verified

17 * caller down the fallback path. Delegates everything else.
18 */
19function createLegacyFs(seed: Record<string, string>): IFileSystem {
20 const inner = new InMemoryFs(seed);
21 return new Proxy(inner, {
22 get(target, prop, receiver) {
23 if (prop === "readFileBytes") return undefined;
24 const value = Reflect.get(target, prop, receiver);
25 // Methods need to keep their `this` bound to the inner instance.
26 return typeof value === "function" ? value.bind(target) : value;
27 },
28 has(target, prop) {
29 if (prop === "readFileBytes") return false;
30 return Reflect.has(target, prop);
31 },
32 }) as IFileSystem;
33}
34
35describe("readFileBytes back-compat fallback", () => {
36 it("commands work against a custom IFileSystem missing readFileBytes", async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…