stativ hash

This commit is contained in:
Mateusz Gruszczyński
2026-05-31 23:17:14 +02:00
parent 68d8ddc8d7
commit 62572ec273
6 changed files with 73 additions and 31 deletions
+8 -1
View File
@@ -99,9 +99,16 @@ async function loadModuleSources(){
return moduleSourcesPromise;
}
function normalizeRuntimeSource(source){
const text = String(source || '');
// Note: Some generated source chunks may end with a literal \\n marker;
// normalize only this trailing marker to avoid invalid Function() source.
return text.endsWith('\\n') ? `${text.slice(0, -2)}\n` : text;
}
export async function buildRuntimeSource(){
const sources = await loadModuleSources();
return `(() => {\n${sources.join('\n')}\n})();\n`;
return `(() => {\n${sources.map(normalizeRuntimeSource).join('\n')}\n})();\n`;
}
export async function startApp(){