@jridgewell/sourcemap-codec
Advanced tools
Comparing version
@@ -40,2 +40,4 @@ (function (global, factory) { | ||
let line = []; | ||
let sorted = true; | ||
let lastCol = 0; | ||
for (let i = 0; i < mappings.length;) { | ||
@@ -47,3 +49,6 @@ const c = mappings.charCodeAt(i); | ||
else if (c === semicolon) { | ||
state[0] = 0; | ||
state[0] = lastCol = 0; | ||
if (!sorted) | ||
sort(line); | ||
sorted = true; | ||
decoded.push(line); | ||
@@ -55,4 +60,8 @@ line = []; | ||
i = decodeInteger(mappings, i, state, 0); // generatedCodeColumn | ||
const col = state[0]; | ||
if (col < lastCol) | ||
sorted = false; | ||
lastCol = col; | ||
if (!hasMoreSegments(mappings, i)) { | ||
line.push([state[0]]); | ||
line.push([col]); | ||
continue; | ||
@@ -64,9 +73,11 @@ } | ||
if (!hasMoreSegments(mappings, i)) { | ||
line.push([state[0], state[1], state[2], state[3]]); | ||
line.push([col, state[1], state[2], state[3]]); | ||
continue; | ||
} | ||
i = decodeInteger(mappings, i, state, 4); // nameIndex | ||
line.push([state[0], state[1], state[2], state[3], state[4]]); | ||
line.push([col, state[1], state[2], state[3], state[4]]); | ||
} | ||
} | ||
if (!sorted) | ||
sort(line); | ||
decoded.push(line); | ||
@@ -101,2 +112,8 @@ return decoded; | ||
} | ||
function sort(line) { | ||
line.sort(sortComparator); | ||
} | ||
function sortComparator(a, b) { | ||
return a[0] - b[0]; | ||
} | ||
function encode(decoded) { | ||
@@ -103,0 +120,0 @@ const state = new Int32Array(5); |
{ | ||
"name": "@jridgewell/sourcemap-codec", | ||
"version": "1.4.9", | ||
"version": "1.4.10", | ||
"description": "Encode/decode sourcemap mappings", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28791
1.25%339
11.15%8
-11.11%