mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04: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:
@@ -529,7 +529,7 @@ const parseSourceMap = (
|
||||
void cause;
|
||||
return invalidSourceMap(file, "Source map is not valid JSON.");
|
||||
}
|
||||
const maps = flattenSourceMaps(value);
|
||||
const maps = flattenSourceMapLeaves(value);
|
||||
if (maps === undefined)
|
||||
return invalidSourceMap(file, "Source map is not a version 3 map.");
|
||||
return collectSourceMapOriginals(file, maps);
|
||||
@@ -594,13 +594,6 @@ const unavailableSourceMap = (
|
||||
};
|
||||
};
|
||||
|
||||
const flattenSourceMaps = (
|
||||
root: unknown,
|
||||
): Readonly<Record<string, unknown>>[] | undefined => {
|
||||
const leaves = flattenSourceMapLeaves(root);
|
||||
return leaves === undefined ? undefined : [...leaves];
|
||||
};
|
||||
|
||||
const invalidSourceMap = (
|
||||
file: JavaScriptArtifactFile,
|
||||
limitation: string,
|
||||
|
||||
Reference in New Issue
Block a user