@hawkeyexl/manni 2.3.2 → 2.3.4
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/README.md +1 -1
- package/dist/{chunk-4XNZNHQH.js → chunk-KUZJ23HJ.js} +2 -2
- package/dist/{chunk-KFB6EYK3.js → chunk-LHYFB75E.js} +2 -2
- package/dist/{chunk-KFB6EYK3.js.map → chunk-LHYFB75E.js.map} +1 -1
- package/dist/{chunk-PTCA7ETL.js → chunk-THU5EEXC.js} +86 -18
- package/dist/chunk-THU5EEXC.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-PTCA7ETL.js.map +0 -1
- /package/dist/{chunk-4XNZNHQH.js.map → chunk-KUZJ23HJ.js.map} +0 -0
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
withValueAt,
|
|
70
70
|
writeEncryptionKey,
|
|
71
71
|
writeFileAtomic
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-LHYFB75E.js";
|
|
73
73
|
|
|
74
74
|
// src/meta/core/reencrypt.ts
|
|
75
75
|
import { extname } from "node:path";
|
|
@@ -365,6 +365,10 @@ function parseSrc(src) {
|
|
|
365
365
|
range.end = end;
|
|
366
366
|
return range;
|
|
367
367
|
}
|
|
368
|
+
function tooWide(lines) {
|
|
369
|
+
const width = lines.end - lines.start + 1;
|
|
370
|
+
return width > MAX_RANGE_LINES ? `spans ${String(width)} lines, more than ${String(MAX_RANGE_LINES)}` : void 0;
|
|
371
|
+
}
|
|
368
372
|
function formatSrc(range) {
|
|
369
373
|
const { path, start, end } = range;
|
|
370
374
|
if (start === void 0) return path;
|
|
@@ -472,6 +476,17 @@ async function buildSourceIndex(root, opts) {
|
|
|
472
476
|
has: (path) => byPath.has(path)
|
|
473
477
|
};
|
|
474
478
|
}
|
|
479
|
+
function isEnoent(error) {
|
|
480
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
481
|
+
}
|
|
482
|
+
async function sourceIndexFor(root, client) {
|
|
483
|
+
try {
|
|
484
|
+
return await buildSourceIndex(root, { gitClient: client });
|
|
485
|
+
} catch (error) {
|
|
486
|
+
if (isEnoent(error)) throw new CiteError(`Root directory not found: ${root}.`);
|
|
487
|
+
throw error;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
475
490
|
async function readSource(root, index, range, key) {
|
|
476
491
|
let resolvedPath;
|
|
477
492
|
if (range.encrypted) {
|
|
@@ -840,6 +855,56 @@ function unitHolding(text, line, format, body) {
|
|
|
840
855
|
if (paragraph?.line !== start) return void 0;
|
|
841
856
|
return { start, end: lineAt(text, paragraph.end), kind: "paragraph" };
|
|
842
857
|
}
|
|
858
|
+
var LIST_ITEM = /^([ \t]*)([-*+]|\d{1,9}[.)])([ \t]+|$)/;
|
|
859
|
+
var THEMATIC_BREAK = /^[ \t]*([-*_])(?:[ \t]*\1){2,}[ \t]*$/;
|
|
860
|
+
function textOfLine(text, n) {
|
|
861
|
+
const pos = offsetOfLine(text, n);
|
|
862
|
+
return lineText(text, pos, lineEnd(text, pos));
|
|
863
|
+
}
|
|
864
|
+
function indentOf(line) {
|
|
865
|
+
return /^[ \t]*/.exec(line)?.[0] ?? "";
|
|
866
|
+
}
|
|
867
|
+
function columnOf(indent) {
|
|
868
|
+
let column = 0;
|
|
869
|
+
for (const ch of indent) column = ch === " " ? column + 4 - column % 4 : column + 1;
|
|
870
|
+
return column;
|
|
871
|
+
}
|
|
872
|
+
function listItemOf(line) {
|
|
873
|
+
if (THEMATIC_BREAK.test(line)) return void 0;
|
|
874
|
+
const match = LIST_ITEM.exec(line);
|
|
875
|
+
if (match === null) return void 0;
|
|
876
|
+
const [, lead = "", bullet = "", gap = ""] = match;
|
|
877
|
+
return { lead, bullet, gap };
|
|
878
|
+
}
|
|
879
|
+
function continuesList(text, line, format, bodyLine, column) {
|
|
880
|
+
let n = line - 1;
|
|
881
|
+
while (n >= bodyLine) {
|
|
882
|
+
const above = textOfLine(text, n);
|
|
883
|
+
if (above.trim() !== "" && !isMarkerLine(above, format)) break;
|
|
884
|
+
n--;
|
|
885
|
+
}
|
|
886
|
+
if (n < bodyLine) return false;
|
|
887
|
+
if (columnOf(indentOf(textOfLine(text, n))) > column) return true;
|
|
888
|
+
for (; n >= bodyLine; n--) {
|
|
889
|
+
const above = textOfLine(text, n);
|
|
890
|
+
if (above.trim() === "" || ANY_FENCE.test(above) || isMarkerLine(above, format)) break;
|
|
891
|
+
const item = listItemOf(above);
|
|
892
|
+
if (item !== void 0 && columnOf(item.lead) === column) return true;
|
|
893
|
+
}
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
function markerIndent(text, line, format, bodyLine) {
|
|
897
|
+
if (format === "asciidoc") return "";
|
|
898
|
+
const own = textOfLine(text, line);
|
|
899
|
+
const indent = indentOf(own);
|
|
900
|
+
if (format !== "markdown" && format !== "mdx") return indent;
|
|
901
|
+
const item = listItemOf(own);
|
|
902
|
+
if (item === void 0 || !continuesList(text, line, format, bodyLine, columnOf(item.lead))) {
|
|
903
|
+
return indent;
|
|
904
|
+
}
|
|
905
|
+
const gap = item.gap === "" || columnOf(item.gap) > 4 ? " " : item.gap;
|
|
906
|
+
return item.lead + " ".repeat(item.bullet.length) + gap;
|
|
907
|
+
}
|
|
843
908
|
function anchoredLines(text, after, format, quote = false) {
|
|
844
909
|
if (quote) {
|
|
845
910
|
const block = fencedBlockAfter(text, after, format);
|
|
@@ -1457,6 +1522,16 @@ function readPage(file, content, opts) {
|
|
|
1457
1522
|
);
|
|
1458
1523
|
return;
|
|
1459
1524
|
}
|
|
1525
|
+
const wide = ["claim", "source"].map((end) => {
|
|
1526
|
+
const lines = end === "claim" ? citation.claim?.lines : citation.source.lines;
|
|
1527
|
+
const parsed = lines === void 0 ? void 0 : parseLines(lines);
|
|
1528
|
+
const reason = parsed === void 0 ? void 0 : tooWide(parsed);
|
|
1529
|
+
return reason === void 0 ? void 0 : `${end}.lines "${String(lines)}" ${reason}`;
|
|
1530
|
+
}).find((message) => message !== void 0);
|
|
1531
|
+
if (wide !== void 0) {
|
|
1532
|
+
findings.push(finding("entry-invalid", named(citation.id, wide), subject));
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1460
1535
|
const encrypted = isEncryptedValue(citation.source.file);
|
|
1461
1536
|
if (encrypted !== isKeyedPin(citation.source.integrity)) {
|
|
1462
1537
|
findings.push(
|
|
@@ -2352,6 +2427,8 @@ function refusalFor(reason, path, encrypted) {
|
|
|
2352
2427
|
}
|
|
2353
2428
|
async function mintCitation(opts) {
|
|
2354
2429
|
const range = parseSrc(opts.src);
|
|
2430
|
+
const wide = range.start === void 0 || range.end === void 0 ? void 0 : tooWide({ start: range.start, end: range.end });
|
|
2431
|
+
if (wide !== void 0) throw new CiteError(`Invalid range "${opts.src}": it ${wide}.`);
|
|
2355
2432
|
const { key } = opts;
|
|
2356
2433
|
const encrypt = opts.encrypt === true || range.encrypted;
|
|
2357
2434
|
if (encrypt && !range.encrypted && key === void 0) {
|
|
@@ -2586,17 +2663,6 @@ function joinHits() {
|
|
|
2586
2663
|
}
|
|
2587
2664
|
};
|
|
2588
2665
|
}
|
|
2589
|
-
function isEnoent(error) {
|
|
2590
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
2591
|
-
}
|
|
2592
|
-
async function indexFor(root, client) {
|
|
2593
|
-
try {
|
|
2594
|
-
return await buildSourceIndex(root, { gitClient: client });
|
|
2595
|
-
} catch (error) {
|
|
2596
|
-
if (isEnoent(error)) throw new CiteError(`Root directory not found: ${root}.`);
|
|
2597
|
-
throw error;
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
2666
|
async function prepareRun(opts, action, verb, requireSources = false) {
|
|
2601
2667
|
const cwd = resolve3(opts.cwd ?? process.cwd());
|
|
2602
2668
|
const run3 = await resolveCiteRun({
|
|
@@ -2660,7 +2726,7 @@ async function prepareRun(opts, action, verb, requireSources = false) {
|
|
|
2660
2726
|
severity: config?.severity,
|
|
2661
2727
|
gitClient: git
|
|
2662
2728
|
};
|
|
2663
|
-
if (checkSources) pageOptions.sourceIndex = await
|
|
2729
|
+
if (checkSources) pageOptions.sourceIndex = await sourceIndexFor(run3.root, git);
|
|
2664
2730
|
const sidecars2 = await sidecarsFor(run3);
|
|
2665
2731
|
const setupFor = (label, content) => {
|
|
2666
2732
|
const page = sidecars2?.forPage(label, content, forced?.name);
|
|
@@ -2866,6 +2932,8 @@ async function runAdd(opts) {
|
|
|
2866
2932
|
if (marker && opts.id === void 0) {
|
|
2867
2933
|
throw new CiteError("--marker needs --id: the marker names the entry.");
|
|
2868
2934
|
}
|
|
2935
|
+
const wide = pageLines === void 0 ? void 0 : tooWide(pageLines);
|
|
2936
|
+
if (wide !== void 0) throw new CiteError(`Invalid range "${at2}": it ${wide}.`);
|
|
2869
2937
|
if (quote && pageLines === void 0) {
|
|
2870
2938
|
throw new CiteError(`--quote needs the block's lines: ${label}:L1-L2.`);
|
|
2871
2939
|
}
|
|
@@ -2903,7 +2971,7 @@ async function runAdd(opts) {
|
|
|
2903
2971
|
}
|
|
2904
2972
|
}
|
|
2905
2973
|
const client = opts.gitClient ?? gitClient(root);
|
|
2906
|
-
const sourceIndex = await
|
|
2974
|
+
const sourceIndex = await sourceIndexFor(root, client);
|
|
2907
2975
|
let body = content;
|
|
2908
2976
|
let markerAt;
|
|
2909
2977
|
let claimSpan;
|
|
@@ -2923,7 +2991,7 @@ async function runAdd(opts) {
|
|
|
2923
2991
|
);
|
|
2924
2992
|
}
|
|
2925
2993
|
shifted = shiftedEntries(page.citations, holding.start, page.bodyLine, label);
|
|
2926
|
-
const statement = formatStatement(format, { kind: "ref", id: opts.id ?? "" });
|
|
2994
|
+
const statement = markerIndent(content, holding.start, format, page.bodyLine) + formatStatement(format, { kind: "ref", id: opts.id ?? "" });
|
|
2927
2995
|
const insertAt = offsetOfLine(content, holding.start);
|
|
2928
2996
|
body = insertStatementBefore(content, insertAt, statement);
|
|
2929
2997
|
markerAt = holding.start;
|
|
@@ -3801,7 +3869,7 @@ function rootFor(flag, cite, file, cwd) {
|
|
|
3801
3869
|
function isEnoent3(error) {
|
|
3802
3870
|
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
3803
3871
|
}
|
|
3804
|
-
async function
|
|
3872
|
+
async function indexFor(root, client) {
|
|
3805
3873
|
try {
|
|
3806
3874
|
return await buildSourceIndex(root, { gitClient: client });
|
|
3807
3875
|
} catch (error) {
|
|
@@ -3997,7 +4065,7 @@ async function runKeyRotate(opts) {
|
|
|
3997
4065
|
const sourceIndex = () => {
|
|
3998
4066
|
if (index === void 0) {
|
|
3999
4067
|
if (fellBack) opts.onNotice?.(`No git root found; resolving src: paths from ${cwd}`);
|
|
4000
|
-
index =
|
|
4068
|
+
index = indexFor(root, client);
|
|
4001
4069
|
}
|
|
4002
4070
|
return index;
|
|
4003
4071
|
};
|
|
@@ -4190,4 +4258,4 @@ export {
|
|
|
4190
4258
|
runKeyRotate,
|
|
4191
4259
|
runKeySet
|
|
4192
4260
|
};
|
|
4193
|
-
//# sourceMappingURL=chunk-
|
|
4261
|
+
//# sourceMappingURL=chunk-THU5EEXC.js.map
|