@ai-matrx/content-ir 0.18.1 → 0.18.3
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/CHANGELOG.md +16 -0
- package/dist/index.cjs +48 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +46 -8
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +48 -7
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +19 -1
- package/dist/source.d.ts +19 -1
- package/dist/source.js +46 -8
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.18.3
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/content-ir-core/v0.18.2..npm/content-ir-core/v0.18.3 -- apps/shared/content-ir-core`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.18.2 — 2026-09-25
|
|
10
|
+
|
|
11
|
+
**Carries: RC-B10 only.** Three helpers on THE one code-range rule, so every
|
|
12
|
+
consumer strips or reads code in one line instead of a private regex:
|
|
13
|
+
`mapCodeRanges(text, fn)` (rewrite each fence/span, prose kept byte for
|
|
14
|
+
byte), `codeSpanText(raw)` (CommonMark span text: runs off, one padding space
|
|
15
|
+
each side), `fenceParts(raw)` (opener, body, closed — list-marker line,
|
|
16
|
+
blockquote and the renderer's line-end closer handled).
|
|
17
|
+
- Consumer action: none — refresh to latest.
|
|
18
|
+
|
|
3
19
|
## 0.18.1 — 2026-09-25
|
|
4
20
|
|
|
5
21
|
**Carries: RC-B10 only** (the one code-range rule). No RC-B3 work is pending
|
package/dist/index.cjs
CHANGED
|
@@ -5488,16 +5488,27 @@ var BacktickRuns = class {
|
|
|
5488
5488
|
}
|
|
5489
5489
|
};
|
|
5490
5490
|
function codeSpans(text, from, to, out) {
|
|
5491
|
-
|
|
5492
|
-
for (let
|
|
5493
|
-
const
|
|
5494
|
-
|
|
5491
|
+
let runs = null;
|
|
5492
|
+
for (let i = from; i < to; ) {
|
|
5493
|
+
const ch = text.charCodeAt(i);
|
|
5494
|
+
if (ch === 92) {
|
|
5495
|
+
i += 2;
|
|
5496
|
+
continue;
|
|
5497
|
+
}
|
|
5498
|
+
if (ch !== 96) {
|
|
5499
|
+
i++;
|
|
5500
|
+
continue;
|
|
5501
|
+
}
|
|
5502
|
+
const n = backtickRunLength(text, i);
|
|
5503
|
+
const len = Math.min(n, to - i);
|
|
5504
|
+
runs ??= new BacktickRuns(text, from, to);
|
|
5505
|
+
const close = runs.next(len, i + len);
|
|
5495
5506
|
if (close === -1) {
|
|
5496
|
-
|
|
5507
|
+
i += len;
|
|
5497
5508
|
continue;
|
|
5498
5509
|
}
|
|
5499
|
-
out.push({ start, end: close +
|
|
5500
|
-
|
|
5510
|
+
out.push({ start: i, end: close + len, kind: "span" });
|
|
5511
|
+
i = close + len;
|
|
5501
5512
|
}
|
|
5502
5513
|
}
|
|
5503
5514
|
function findCodeRanges(text) {
|
|
@@ -5506,6 +5517,33 @@ function findCodeRanges(text) {
|
|
|
5506
5517
|
for (const [from, to] of s.paragraphs) codeSpans(text, from, to, ranges);
|
|
5507
5518
|
return ranges.sort((a, b) => a.start - b.start);
|
|
5508
5519
|
}
|
|
5520
|
+
function mapCodeRanges(text, fn) {
|
|
5521
|
+
let out = "";
|
|
5522
|
+
let at = 0;
|
|
5523
|
+
for (const r of findCodeRanges(text)) {
|
|
5524
|
+
if (r.start < at) continue;
|
|
5525
|
+
out += text.slice(at, r.start) + fn(r, text.slice(r.start, r.end));
|
|
5526
|
+
at = r.end;
|
|
5527
|
+
}
|
|
5528
|
+
return out + text.slice(at);
|
|
5529
|
+
}
|
|
5530
|
+
function codeSpanText(raw) {
|
|
5531
|
+
const ticks = backtickRunLength(raw, 0);
|
|
5532
|
+
const inner = raw.slice(ticks, raw.length - ticks);
|
|
5533
|
+
return inner.length >= 2 && inner.startsWith(" ") && inner.endsWith(" ") && inner.trim() !== "" ? inner.slice(1, -1) : inner;
|
|
5534
|
+
}
|
|
5535
|
+
function fenceParts(raw) {
|
|
5536
|
+
const lines = raw.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
5537
|
+
const { offset } = quotePrefix(lines[0] ?? "");
|
|
5538
|
+
const opener = fenceOpenerOf((lines[0] ?? "").slice(offset).replace(/^ *(?:[-*+]|\d{1,9}[.)])(?= |\t|$) ?/, ""));
|
|
5539
|
+
if (!opener) return null;
|
|
5540
|
+
const rest = lines.slice(1);
|
|
5541
|
+
const closed = rest.length > 0 && new FenceReader(opener, { nesting: false }).feed(rest[rest.length - 1]);
|
|
5542
|
+
if (!closed) return { opener, body: rest.join("\n"), closed };
|
|
5543
|
+
const last = rest[rest.length - 1];
|
|
5544
|
+
const before = trimFenceLine(last).startsWith("```") ? "" : last.slice(0, last.indexOf("```"));
|
|
5545
|
+
return { opener, body: [...rest.slice(0, -1), ...before.trim() ? [before] : []].join("\n"), closed };
|
|
5546
|
+
}
|
|
5509
5547
|
function fenceLineKinds(text) {
|
|
5510
5548
|
const s = scan(text);
|
|
5511
5549
|
let count = 1;
|
|
@@ -7364,6 +7402,7 @@ exports.capabilityOf = capabilityOf;
|
|
|
7364
7402
|
exports.classifyInboundEnvelopeMetadata = classifyInboundEnvelopeMetadata;
|
|
7365
7403
|
exports.classifyInnerFenceLine = classifyInnerFenceLine;
|
|
7366
7404
|
exports.closeFence = closeFence;
|
|
7405
|
+
exports.codeSpanText = codeSpanText;
|
|
7367
7406
|
exports.collectReferencedKinds = collectReferencedKinds;
|
|
7368
7407
|
exports.collectSchemaReferencedKinds = collectSchemaReferencedKinds;
|
|
7369
7408
|
exports.compareWithExistingKindSchema = compareWithExistingKindSchema;
|
|
@@ -7386,6 +7425,7 @@ exports.fenceDiscriminator = fenceDiscriminator;
|
|
|
7386
7425
|
exports.fenceLineKinds = fenceLineKinds;
|
|
7387
7426
|
exports.fenceNestsInnerFences = fenceNestsInnerFences;
|
|
7388
7427
|
exports.fenceOpenerOf = fenceOpenerOf;
|
|
7428
|
+
exports.fenceParts = fenceParts;
|
|
7389
7429
|
exports.fieldsToDbPayload = fieldsToDbPayload;
|
|
7390
7430
|
exports.findCodeRanges = findCodeRanges;
|
|
7391
7431
|
exports.fingerprintText = fingerprintText;
|
|
@@ -7425,6 +7465,7 @@ exports.looksLikeDirectiveHead = looksLikeDirectiveHead;
|
|
|
7425
7465
|
exports.looksLikeDisplayMath = looksLikeDisplayMath;
|
|
7426
7466
|
exports.looksLikeOpenInlineMath = looksLikeOpenInlineMath;
|
|
7427
7467
|
exports.makePartialKindStalenessGate = makePartialKindStalenessGate;
|
|
7468
|
+
exports.mapCodeRanges = mapCodeRanges;
|
|
7428
7469
|
exports.mapPosition = mapPosition;
|
|
7429
7470
|
exports.mapRange = mapRange;
|
|
7430
7471
|
exports.mergeResidueIntoValue = mergeResidueIntoValue;
|