mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
fix(javascript): preserve HTML carriage return source ranges (#1092)
* test(javascript): reproduce HTML carriage return source coordinates Compare actual resolved and unresolved artifact graph evidence with parse5 source locations across HTML line terminators and UTF-16 columns. Exercise both public built CLI analysis commands. Tests only; production and workflows unchanged. Signed-off-by: Rudy Celekli <rudy@gradiahq.com> * fix(javascript): preserve HTML carriage return source ranges Treat LF, CRLF, and bare CR as HTML line endings when projecting actual script opening-tag offsets to retained source ranges. Preserve UTF-16 column semantics and document the source-coordinate contract. Signed-off-by: Rudy Celekli <rudy@gradiahq.com> --------- Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
This commit is contained in:
committed by
GitHub
parent
e94be95c66
commit
23862af1b5
@@ -407,7 +407,7 @@ const pointForOffset = (
|
||||
text: string,
|
||||
offset: number,
|
||||
): JavaScriptSourcePoint => {
|
||||
const lines = text.slice(0, offset).split("\n");
|
||||
const lines = text.slice(0, offset).split(/\r\n|\r|\n/u);
|
||||
return { line: lines.length, column: lines.at(-1)?.length ?? 0 };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user