Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/svelte/tests/sourcemaps/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ const { test, run } = suite<SourcemapTest>(async (config, cwd) => {

const decoded = decode(map.mappings);

/*
Decoded sourcemap mappings contain absolute line/column numbers.
Negative values are invalid and can cause errors in downstream processing
*/
for (let l = 0; l < decoded.length; l++) {
for (let m of decoded[l]) {
if (m.find((i) => i < 0)) {
throw new Error(
`Invalid mapping with negative value ${JSON.stringify(m)} at line ${l} of the decoded mappings of ${info} sourcemap\n${JSON.stringify(map)}`
);
}
}
}

try {
for (let entry of entries) {
entry = typeof entry === 'string' ? { str: entry } : entry;
Expand Down
Loading