@parcel/codeframe 2.0.0-nightly.1381 → 2.0.0-nightly.1386
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/codeframe.js +2 -0
- package/lib/codeframe.js.map +1 -1
- package/package.json +2 -2
- package/src/codeframe.js +3 -0
- package/test/codeframe.test.js +23 -0
package/lib/codeframe.js
CHANGED
|
@@ -36023,6 +36023,8 @@ function $796233c1fee0ccb8$export$2e2bcd8739ae039(code, highlights, inputOpts =
|
|
|
36023
36023
|
else if (lastCol > startCol) // If last column is larger than the start, there's overlap in highlights
|
|
36024
36024
|
// This line adjusts the characters count to ensure we don't add too many characters
|
|
36025
36025
|
characters += startCol - lastCol;
|
|
36026
|
+
// Don't crash (and swallow the original message) if the diagnostic is malformed (end is before start).
|
|
36027
|
+
characters = Math.max(1, characters);
|
|
36026
36028
|
// Append the highlight indicators
|
|
36027
36029
|
highlightLine += highlighter("^".repeat(characters));
|
|
36028
36030
|
// Set the lastCol equal to character count between start of line part and highlight end-column
|