@ai-matrx/content-ir 0.18.6 → 0.19.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/CHANGELOG.md +32 -8
- package/README.md +1 -1
- package/dist/index.cjs +118 -34
- 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 +118 -35
- package/dist/index.js.map +1 -1
- package/dist/registry.cjs +88 -0
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.d.cts +104 -1
- package/dist/registry.d.ts +104 -1
- package/dist/registry.js +88 -1
- package/dist/registry.js.map +1 -1
- package/dist/source.cjs +30 -34
- package/dist/source.cjs.map +1 -1
- package/dist/source.js +30 -34
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.js
CHANGED
|
@@ -268,12 +268,6 @@ function fenceOpenerOf(content) {
|
|
|
268
268
|
return null;
|
|
269
269
|
}
|
|
270
270
|
var FenceReader = class {
|
|
271
|
-
constructor(opener, options = {}) {
|
|
272
|
-
this.opener = opener;
|
|
273
|
-
this.isJson = opener.char === "`" && opener.lang === "json";
|
|
274
|
-
this.nesting = opener.char === "`" && (options.nesting ?? fenceNestsInnerFences(opener.lang));
|
|
275
|
-
this.tildeCloser = opener.char === "~" ? new RegExp(`^ {0,3}~{${opener.ticks},}[ \\t]*$`) : null;
|
|
276
|
-
}
|
|
277
271
|
opener;
|
|
278
272
|
state = { inString: false, escaped: false };
|
|
279
273
|
depth = 0;
|
|
@@ -282,6 +276,12 @@ var FenceReader = class {
|
|
|
282
276
|
isJson;
|
|
283
277
|
nesting;
|
|
284
278
|
tildeCloser;
|
|
279
|
+
constructor(opener, options = {}) {
|
|
280
|
+
this.opener = opener;
|
|
281
|
+
this.isJson = opener.char === "`" && opener.lang === "json";
|
|
282
|
+
this.nesting = opener.char === "`" && (options.nesting ?? fenceNestsInnerFences(opener.lang));
|
|
283
|
+
this.tildeCloser = opener.char === "~" ? new RegExp(`^ {0,3}~{${opener.ticks},}[ \\t]*$`) : null;
|
|
284
|
+
}
|
|
285
285
|
/** How many nested fences are open right now. */
|
|
286
286
|
get nestedDepth() {
|
|
287
287
|
return this.depth;
|
|
@@ -899,9 +899,6 @@ function isEscapedBacktick(line, offset) {
|
|
|
899
899
|
return slashes % 2 === 1;
|
|
900
900
|
}
|
|
901
901
|
var XmlContainerTracker = class {
|
|
902
|
-
constructor(rootTag) {
|
|
903
|
-
this.rootTag = rootTag;
|
|
904
|
-
}
|
|
905
902
|
rootTag;
|
|
906
903
|
depth = 0;
|
|
907
904
|
inComment = false;
|
|
@@ -909,6 +906,9 @@ var XmlContainerTracker = class {
|
|
|
909
906
|
inlineTicks = 0;
|
|
910
907
|
/** The open fence, read by THE one closer (source/code-ranges.ts). */
|
|
911
908
|
fence = null;
|
|
909
|
+
constructor(rootTag) {
|
|
910
|
+
this.rootTag = rootTag;
|
|
911
|
+
}
|
|
912
912
|
consumeLine(line, startOffset = 0) {
|
|
913
913
|
if (this.fence) {
|
|
914
914
|
if (this.fence.feed(line)) this.fence = null;
|
|
@@ -1120,6 +1120,23 @@ function isSplitterTreeLine(line) {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
var MEDIA_REF_PREFIXES = ["[Image URL:", "[Video URL:", "[Audio URL:"];
|
|
1122
1122
|
var Tokenizer = class {
|
|
1123
|
+
text;
|
|
1124
|
+
streaming;
|
|
1125
|
+
meter;
|
|
1126
|
+
n;
|
|
1127
|
+
lineStarts = [];
|
|
1128
|
+
contentEnds = [];
|
|
1129
|
+
lineEnds = [];
|
|
1130
|
+
blocks = [];
|
|
1131
|
+
blockCache = /* @__PURE__ */ new Map();
|
|
1132
|
+
/** Lazily built: for line i, first line j >= i where brace net from i drops to <= 0. */
|
|
1133
|
+
braceStop = null;
|
|
1134
|
+
braceNet = null;
|
|
1135
|
+
/** Every occurrence offset of each needle searched so far (overlapping, like indexOf). */
|
|
1136
|
+
occurrences = /* @__PURE__ */ new Map();
|
|
1137
|
+
/** `$$` opener → closer for the pairs the core renders as math. */
|
|
1138
|
+
mathPairs;
|
|
1139
|
+
finder = (needle, from) => this.next(needle, from);
|
|
1123
1140
|
constructor(text, streaming = false, meter = void 0) {
|
|
1124
1141
|
this.text = text;
|
|
1125
1142
|
this.streaming = streaming;
|
|
@@ -1166,23 +1183,6 @@ var Tokenizer = class {
|
|
|
1166
1183
|
this.lineEnds.push(text.length);
|
|
1167
1184
|
}
|
|
1168
1185
|
}
|
|
1169
|
-
text;
|
|
1170
|
-
streaming;
|
|
1171
|
-
meter;
|
|
1172
|
-
n;
|
|
1173
|
-
lineStarts = [];
|
|
1174
|
-
contentEnds = [];
|
|
1175
|
-
lineEnds = [];
|
|
1176
|
-
blocks = [];
|
|
1177
|
-
blockCache = /* @__PURE__ */ new Map();
|
|
1178
|
-
/** Lazily built: for line i, first line j >= i where brace net from i drops to <= 0. */
|
|
1179
|
-
braceStop = null;
|
|
1180
|
-
braceNet = null;
|
|
1181
|
-
/** Every occurrence offset of each needle searched so far (overlapping, like indexOf). */
|
|
1182
|
-
occurrences = /* @__PURE__ */ new Map();
|
|
1183
|
-
/** `$$` opener → closer for the pairs the core renders as math. */
|
|
1184
|
-
mathPairs;
|
|
1185
|
-
finder = (needle, from) => this.next(needle, from);
|
|
1186
1186
|
/** Streaming: where provisional text starts (a pending `$$`), or +∞. */
|
|
1187
1187
|
provisionalFrom = Number.POSITIVE_INFINITY;
|
|
1188
1188
|
/** Streaming: the text ends in a lone CR whose LF has not arrived yet. */
|
|
@@ -1329,12 +1329,6 @@ var Tokenizer = class {
|
|
|
1329
1329
|
const last = this.lineStarts.length - 1;
|
|
1330
1330
|
if (last < 0) return;
|
|
1331
1331
|
if (this.isOpenTail(last)) {
|
|
1332
|
-
const lineStart = this.lineStarts[last];
|
|
1333
|
-
for (const block2 of this.blocks) {
|
|
1334
|
-
if (block2.kind === "prose" && block2.end > lineStart) {
|
|
1335
|
-
block2.inlines = block2.inlines.filter((inline) => inline.end <= lineStart);
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
1332
|
let b = this.blocks.length - 1;
|
|
1339
1333
|
while (b >= 0 && this.blocks[b].kind === "gap") b--;
|
|
1340
1334
|
const block = this.blocks[b];
|
|
@@ -1940,7 +1934,9 @@ var Tokenizer = class {
|
|
|
1940
1934
|
const block = this.detectBlock(this.lineStarts[k], k, false);
|
|
1941
1935
|
if (block) {
|
|
1942
1936
|
breakLine = k;
|
|
1943
|
-
if (this.mayDissolve(block)
|
|
1937
|
+
if (this.mayDissolve(block) || this.streaming && block.start >= this.provisionalFrom) {
|
|
1938
|
+
this.undecidedBreaks.add(end);
|
|
1939
|
+
}
|
|
1944
1940
|
break;
|
|
1945
1941
|
}
|
|
1946
1942
|
end = this.contentEnds[k];
|
|
@@ -2285,12 +2281,12 @@ function blockAt(blocks, offset) {
|
|
|
2285
2281
|
|
|
2286
2282
|
// source/splice.ts
|
|
2287
2283
|
var SourceSpliceError = class extends Error {
|
|
2284
|
+
code;
|
|
2288
2285
|
constructor(code, message) {
|
|
2289
2286
|
super(message);
|
|
2290
2287
|
this.code = code;
|
|
2291
2288
|
this.name = "SourceSpliceError";
|
|
2292
2289
|
}
|
|
2293
|
-
code;
|
|
2294
2290
|
};
|
|
2295
2291
|
function blockEdit(block, text) {
|
|
2296
2292
|
return { start: block.start, end: block.end, text };
|