Skip to content

Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.

fix(scaffold): normalize resolved import paths on Windows (#11)

Script7e2590eda07f0
diff --git a/skills/anidoodle/engine/tools/scaffold.mjs b/skills/anidoodle/engine/tools/scaffold.mjs
index 985975e..c71d816 100644
--- a/skills/anidoodle/engine/tools/scaffold.mjs
+++ b/skills/anidoodle/engine/tools/scaffold.mjs
@@ -51,7 +51,7 @@ const ownFilmFiles = () => {
const SRC = join(ENGINE, "src");
const walk = (d) => readdirSync(d).flatMap((n) => { const p = join(d, n); return statSync(p).isDirectory() ? walk(p) : p.endsWith(".ts") ? [p] : []; });
const files = walk(SRC);
- const res = (from, spec) => { const b = resolve(dirname(from), spec); for (const e of ["", ".ts", "/index.ts"]) if (existsSync(b + e) && statSync(b + e).isFile()) return b + e; return null; };
+ const res = (from, spec) => { const b = resolve(dirname(from), spec); for (const e of ["", ".ts", "/index.ts"]) { const c = resolve(b + e); if (existsSync(c) && statSync(c).isFile()) return c; } return null; }; // resolve(): on Windows "dir/index.ts" must become "dir\index.ts" to match the walked file list
const imp = new Map(files.map((f) => [f, new Set([...readFileSync(f, "utf8").matchAll(/(?:from|import)\s*\(?\s*"(\.[^"]+)"/g)].map((m) => res(f, m[1])).filter(Boolean))]));
const page = (f) => join(SRC, "hosts", `page-${f.slice(f.lastIndexOf(sep) + 1)}`);
const out = new Set(OWN_FILMS.map((n) => join(SRC, "canvas-core", `${n}.ts`)));