import faux from "./builtins.ts"; export type SheetType = "code" | "spritesheet" | "map" | "sfx" | "patterns" | "fonts"; export const parseCodeSheet = (sheet: string) => { try { new Function(sheet); } catch (err) { throw err; } // deno-lint-ignore no-explicit-any const G: any = {...faux, faux, log: console.log}; const context = new Proxy(G, { get: (target, prop) => { return target[prop]; }, set: (target, prop, value) => { target[prop] = value; return true; }, has: () => { return true; }, }); const fn = new Function("context", ` with (context) { ${sheet} } `); return fn(context); }