@parcel/codeframe 2.13.3 → 2.14.0

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 CHANGED
@@ -18,7 +18,7 @@ function $parcel$export(e, n, v, s) {
18
18
  var $parcel$modules = {};
19
19
  var $parcel$inits = {};
20
20
 
21
- var parcelRequire = $parcel$global["parcelRequire94c2"];
21
+ var parcelRequire = $parcel$global["parcelRequire0b48"];
22
22
 
23
23
  if (parcelRequire == null) {
24
24
  parcelRequire = function(id) {
@@ -42,7 +42,7 @@ if (parcelRequire == null) {
42
42
  $parcel$inits[id] = init;
43
43
  };
44
44
 
45
- $parcel$global["parcelRequire94c2"] = parcelRequire;
45
+ $parcel$global["parcelRequire0b48"] = parcelRequire;
46
46
  }
47
47
 
48
48
  var parcelRegister = parcelRequire.register;
@@ -35960,7 +35960,9 @@ function $b7a7a892cca3868e$export$2e2bcd8739ae039(code, highlights, inputOpts =
35960
35960
  let lineNumberLength = (endLineIndex + 1).toString(10).length;
35961
35961
  // Split input into lines and highlight syntax
35962
35962
  let lines = code.split($b7a7a892cca3868e$var$NEWLINE);
35963
- let syntaxHighlightedLines = (opts.syntaxHighlighting ? $b7a7a892cca3868e$var$highlightSyntax(code, opts.language) : code).replace($b7a7a892cca3868e$var$TAB_REPLACE_REGEX, $b7a7a892cca3868e$var$TAB_REPLACEMENT).split($b7a7a892cca3868e$var$NEWLINE);
35963
+ let visibleLines = lines.slice(startLine, endLineIndex + 1).map((l)=>l.replace($b7a7a892cca3868e$var$TAB_REPLACE_REGEX, $b7a7a892cca3868e$var$TAB_REPLACEMENT));
35964
+ if (opts.syntaxHighlighting) visibleLines = $b7a7a892cca3868e$var$highlightSyntax(visibleLines.join('\n'), opts.language).split($b7a7a892cca3868e$var$NEWLINE);
35965
+ let syntaxHighlightedLines = lines.slice(0, startLine).concat(visibleLines).concat(lines.slice(endLineIndex + 2));
35964
35966
  // Loop over all lines and create codeframe
35965
35967
  let resultLines = [];
35966
35968
  for(let currentLineIndex = startLine; currentLineIndex < syntaxHighlightedLines.length; currentLineIndex++){