From 6c270a9470271f75120804d268a1614f40239bcf Mon Sep 17 00:00:00 2001 From: lvwmwm Date: Thu, 27 Aug 2026 13:11:19 -0300 Subject: [PATCH] feat: semantic sharding for unnamed modules (__helpers/__vendor/__polyfill) --- src/update/tasks/code.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/update/tasks/code.ts b/src/update/tasks/code.ts index 5ea6c552266..891ea0b9a4d 100644 --- a/src/update/tasks/code.ts +++ b/src/update/tasks/code.ts @@ -51,13 +51,22 @@ export default async function code(progress: Progress, _code: string[]) { const rawFiles = await scanDir(modulesPath, modulesPath); + function classifyUnmapped(relativePath: string): string { + if (/^module_\d+\.js$/.test(relativePath)) return "__polyfill"; + const rest = relativePath.replace(/^\d+_/, ""); + if (rest.startsWith("_")) return "__helpers"; + return "__vendor"; + } + function resolveDest(relativePath: string): string { const id = extractModuleId(relativePath); if (id !== undefined) { const sourcePath = modulePaths.get(id); if (sourcePath) return sanitizePath(sourcePath); const bucket = Math.floor(id / 1000); - return `__unmapped/${String(bucket).padStart(2, "0")}xxx/${relativePath}`; + const bucketStr = `${String(bucket).padStart(2, "0")}xxx`; + const cat = classifyUnmapped(relativePath); + return `${cat}/${bucketStr}/${relativePath}`; } return `__unmapped/${relativePath}`; }