acp-kernel 0.0.78 → 0.0.79-pr.331.196

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/dist/index.js CHANGED
@@ -4678,12 +4678,35 @@ function finishSalvage(entries, callId, diag, truncatedShape) {
4678
4678
  diag.kind = entries.length > 0 || truncatedShape ? "truncated" : "malformed-json";
4679
4679
  return finish(ranges, diag);
4680
4680
  }
4681
+ function coalesceLineEntries(entries) {
4682
+ const out = [];
4683
+ let headerOnlyIdx = -1;
4684
+ for (const e of entries) {
4685
+ if (typeof e === "string") {
4686
+ const nl = e.indexOf("\n");
4687
+ const head = (nl === -1 ? e : e.slice(0, nl)).trim();
4688
+ const hasRef = REF_PAIR_IN_LINE.test(head) || SINGLE_REF_IN_LINE.test(head);
4689
+ if (!hasRef && headerOnlyIdx >= 0) {
4690
+ out[headerOnlyIdx] = `${out[headerOnlyIdx]}
4691
+ ${e}`;
4692
+ continue;
4693
+ }
4694
+ out.push(e);
4695
+ headerOnlyIdx = hasRef && nl === -1 ? out.length - 1 : -1;
4696
+ } else {
4697
+ out.push(e);
4698
+ headerOnlyIdx = -1;
4699
+ }
4700
+ }
4701
+ return out;
4702
+ }
4681
4703
  function validateEntries(entries, callId) {
4682
4704
  const ranges = [];
4683
4705
  const reasons = [];
4684
4706
  let invalid = 0;
4685
- for (let i = 0; i < entries.length; i++) {
4686
- const outcome = validateEntry(entries[i], callId);
4707
+ const items = coalesceLineEntries(entries);
4708
+ for (let i = 0; i < items.length; i++) {
4709
+ const outcome = validateEntry(items[i], callId);
4687
4710
  if ("range" in outcome) ranges.push(outcome.range);
4688
4711
  else {
4689
4712
  invalid++;