fix(browser): ignore duplicate frame navigations and read block-form source map directives (#546)

This commit is contained in:
morluto
2026-10-05 17:25:16 +08:00
committed by GitHub
parent 84e4361c09
commit 828395d510
6 changed files with 149 additions and 4 deletions
+5 -2
View File
@@ -273,11 +273,14 @@ export const addSourceMapDirectives = (
source: string,
accumulator: AnalysisAccumulator,
): void => {
// Minifiers emit either `//# sourceMappingURL=` or the block form
// `/*# sourceMappingURL=app.js.map */`. Matching only the line form silently
// dropped the block form, so a real footer produced no mapping at all.
for (const match of source.matchAll(
/\/\/[#@]\s*sourceMappingURL\s*=\s*([^\s]+)/gu,
/(?:\/\/|\/\*)[#@]\s*sourceMappingURL\s*=\s*([^\s*]+)/gu,
)) {
const declared = match[1];
if (declared === undefined) continue;
if (declared === undefined || declared.length === 0) continue;
const start = match.index;
const location = rangeForOffsets(source, start, start + match[0].length);
addFindingOnce(accumulator, `source-map\0${declared}`, () =>