/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/specs/bundle/html/sourcemap-bundle.asserts.ts
35 строк
1 KB
em
fix(bundle): rename sourcemap for HTML entrypoints (#34901)
05 июн 2026, 13:25
Не верифицирован
05 июн 2026, 13:25
9d177ea
Код
Авторство
О чём код?
import { assertFileContains } from "./assert-helpers.ts"; const files: string[] = []; Deno.readDirSync("./dist").forEach((entry) => { files.push(entry.name); }); // The internal virtual-entry name must never leak into emitted output. for (const name of files) { if (name.includes("deno-bundle-html.entry")) { throw new Error( "output file leaks the internal virtual-entry name: " + name, ); } } // The external sourcemap should be named to match the JS bundle. const jsFile = files.find((f) => /^index-[^.]+\.js$/.test(f)); const mapFile = files.find((f) => /^index-[^.]+\.js\.map$/.test(f)); if (!jsFile) { throw new Error("no index-<hash>.js bundle found: " + files.join(", ")); } if (!mapFile) { throw new Error( "no index-<hash>.js.map sourcemap found: " + files.join(", "), ); } if (mapFile !== jsFile + ".map") { throw new Error( `sourcemap name ${mapFile} does not match bundle ${jsFile}`, ); } // The sourcemap should still resolve its original source. assertFileContains("./dist/" + mapFile, "index.ts");