add bundler load order priority, module bundling with --dryrun

This commit is contained in:
Stewart Allen 2025-10-13 12:24:23 -04:00
commit 5894dcc61c
3 changed files with 25 additions and 4 deletions

View file

@ -5,7 +5,8 @@
},
"inputs": [
{ "root": "web", "prefix": "" },
{ "root": "src", "prefix": "lib" },
{ "root": "alt", "prefix": "lib"},
{ "root": "src", "prefix": "lib"},
{ "root": "src/wasm", "prefix": "wasm" },
{ "root": "src/wasm", "prefix": "lib/kiri/wasm" }
],

View file

@ -32,13 +32,19 @@ function* walk(dir, seen = new Set()) {
// --- collect all files according to config ---
let entries = [];
let virtMap = new Set();
for (const input of inputs) {
const root = input.root;
const prefix = input.prefix || '';
for (const file of walk(root)) {
const rel = path.relative(root, file).replace(/\\/g, '/');
const virt = prefix ? `${prefix}/${rel}` : rel;
entries.push({ file, virt });
if (virtMap.has(virt)) {
console.log('pre-existing', virt, rel, root);
} else {
entries.push({ file, virt });
virtMap.add(virt);
}
}
}