mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
refactor(javascript): reuse validated source-map decoding
Pass typed map objects into the codec and reuse validated TraceMap instances for regular and indexed lookups. Remove whole-map serialization, duplicate leaf decoding, an array-copy wrapper, and the unused offset-validation mode in artifact declaration collection. Validation: source-map and browser consumer suites (126 tests), declaration tests, and artifact reconstruction boundaries pass. Section overlap checks and raw source declarations remain intact.
This commit is contained in:
1 parent
c42232f566
commit
f64790bfc3
6 files changed
+61
-78
No files matched your search
@@ -51,12 +51,13 @@ export const decodeValidatedSourceMapLeaves = (
|
||||
check?: () => void,
|
||||
): readonly {
|
||||
readonly leaf: SourceMapLeaf;
|
||||
readonly map: TraceMap;
|
||||
readonly rows: ReturnType<typeof decodedMappings>;
|
||||
readonly resolvedSources: readonly string[];
|
||||
}[] =>
|
||||
leaves.map((leaf) => {
|
||||
check?.();
|
||||
const map = new TraceMap(JSON.stringify(leaf.map), mapUrl);
|
||||
const map = new TraceMap(leaf.codecMap, mapUrl);
|
||||
const rows = decodedMappings(map);
|
||||
for (const [line, row] of rows.entries()) {
|
||||
if ((line & 255) === 0) check?.();
|
||||
@@ -78,5 +79,5 @@ export const decodeValidatedSourceMapLeaves = (
|
||||
);
|
||||
}
|
||||
}
|
||||
return { leaf, rows, resolvedSources: map.resolvedSources };
|
||||
return { leaf, map, rows, resolvedSources: map.resolvedSources };
|
||||
});
|
||||
Reference in new issue
Block a user