@hawkeyexl/manni 2.8.2 → 2.8.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-7UBCWTCO.js → chunk-3QRJR6LM.js} +2 -2
- package/dist/{chunk-WCNU53MJ.js → chunk-HZ2KWOOO.js} +54 -92
- package/dist/chunk-HZ2KWOOO.js.map +1 -0
- package/dist/{chunk-KEW557TN.js → chunk-XHH5OSQQ.js} +457 -269
- package/dist/chunk-XHH5OSQQ.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +70 -42
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-KEW557TN.js.map +0 -1
- package/dist/chunk-WCNU53MJ.js.map +0 -1
- /package/dist/{chunk-7UBCWTCO.js.map → chunk-3QRJR6LM.js.map} +0 -0
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
supportedExtensions,
|
|
62
62
|
terminalConfirm,
|
|
63
63
|
toJsonText
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-XHH5OSQQ.js";
|
|
65
65
|
|
|
66
66
|
// src/meta/cli.ts
|
|
67
67
|
import { existsSync } from "node:fs";
|
|
@@ -1517,4 +1517,4 @@ export {
|
|
|
1517
1517
|
reportConfig,
|
|
1518
1518
|
buildProgram
|
|
1519
1519
|
};
|
|
1520
|
-
//# sourceMappingURL=chunk-
|
|
1520
|
+
//# sourceMappingURL=chunk-3QRJR6LM.js.map
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
hasFrontmatterFence,
|
|
36
36
|
hashLines,
|
|
37
37
|
hashRange,
|
|
38
|
+
heldManifest,
|
|
38
39
|
isEncryptedValue,
|
|
39
40
|
isErrorSeverity,
|
|
40
41
|
isIgnoredByGit,
|
|
@@ -56,11 +57,13 @@ import {
|
|
|
56
57
|
readConfigFile,
|
|
57
58
|
readFamilyConfigFile,
|
|
58
59
|
readManifestValue,
|
|
60
|
+
rebaseable,
|
|
59
61
|
removeManifestKey,
|
|
60
62
|
resolveBaselineRequest,
|
|
61
63
|
resolveEncryptionKey,
|
|
62
64
|
resolveTargetSet,
|
|
63
65
|
selectCollections,
|
|
66
|
+
settle,
|
|
64
67
|
settleBaseline,
|
|
65
68
|
sliceLines,
|
|
66
69
|
spellLines,
|
|
@@ -72,7 +75,7 @@ import {
|
|
|
72
75
|
withValueAt,
|
|
73
76
|
writeEncryptionKey,
|
|
74
77
|
writeFileAtomic
|
|
75
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-XHH5OSQQ.js";
|
|
76
79
|
|
|
77
80
|
// src/meta/core/reencrypt.ts
|
|
78
81
|
import { extname } from "node:path";
|
|
@@ -1033,10 +1036,14 @@ function fenceSpanAt(text, line, format) {
|
|
|
1033
1036
|
if (!block || block.line !== line) return void 0;
|
|
1034
1037
|
return { start: line, end: lineAt(text, block.end) };
|
|
1035
1038
|
}
|
|
1036
|
-
function
|
|
1037
|
-
|
|
1038
|
-
(
|
|
1039
|
+
function fenceAround(text, bodyOffset, line, format) {
|
|
1040
|
+
const block = fencedBlocks(text, bodyOffset, format).find(
|
|
1041
|
+
(b) => line > b.line && line <= lineAt(text, b.end)
|
|
1039
1042
|
);
|
|
1043
|
+
return block === void 0 ? void 0 : { start: block.line, end: lineAt(text, block.end) };
|
|
1044
|
+
}
|
|
1045
|
+
function insideFence(text, bodyOffset, line, format) {
|
|
1046
|
+
return fenceAround(text, bodyOffset, line, format) !== void 0;
|
|
1040
1047
|
}
|
|
1041
1048
|
function unitHolding(text, line, format, body) {
|
|
1042
1049
|
const textOf = (n) => lineText(text, offsetOfLine(text, n), lineEnd(text, offsetOfLine(text, n)));
|
|
@@ -1719,9 +1726,12 @@ function spellElsewhere(spans) {
|
|
|
1719
1726
|
const last = named4.pop() ?? "";
|
|
1720
1727
|
return named4.length === 0 ? `${noun} ${last}` : `${noun} ${named4.join(", ")} and ${last}`;
|
|
1721
1728
|
}
|
|
1722
|
-
function
|
|
1729
|
+
function spanOf(line, recorded) {
|
|
1723
1730
|
const width = recorded === void 0 ? 1 : Math.max(1, recorded.end - recorded.start + 1);
|
|
1724
|
-
|
|
1731
|
+
return { start: line, end: line + width - 1 };
|
|
1732
|
+
}
|
|
1733
|
+
function rowsAt(line, lines, recorded, named4) {
|
|
1734
|
+
const end = spanOf(line, recorded).end;
|
|
1725
1735
|
if (end > lines.length) return "table-short";
|
|
1726
1736
|
for (let n = line; n <= end; n++) {
|
|
1727
1737
|
if (!isTableRow(lines[n - 1] ?? "")) return "table-short";
|
|
@@ -1740,7 +1750,11 @@ function unitOrWhy(page, line, lines, recorded, named4 = false) {
|
|
|
1740
1750
|
if (block !== void 0) {
|
|
1741
1751
|
return { lines: block, kind: "block", text: lines.slice(block.start - 1, block.end) };
|
|
1742
1752
|
}
|
|
1743
|
-
|
|
1753
|
+
const around = fenceAround(page.content, page.bodyOffset, line, page.format);
|
|
1754
|
+
if (around !== void 0) {
|
|
1755
|
+
const span2 = spanOf(line, recorded);
|
|
1756
|
+
return span2.end < around.end ? { lines: span2, kind: "fenced-lines", text: lines.slice(span2.start - 1, span2.end) } : "fence-crossed";
|
|
1757
|
+
}
|
|
1744
1758
|
if (isTableRow(own)) return rowsAt(line, lines, recorded, named4);
|
|
1745
1759
|
const paragraph = paragraphAfter(
|
|
1746
1760
|
page.content,
|
|
@@ -2663,13 +2677,7 @@ function unifiedDiff(label, before, after) {
|
|
|
2663
2677
|
}
|
|
2664
2678
|
|
|
2665
2679
|
// src/cite/core/manifest.ts
|
|
2666
|
-
var
|
|
2667
|
-
function conflictRefusal(file) {
|
|
2668
|
-
return `${file} changed under the command while it was being written. Nothing was written to it. Re-run the command.`;
|
|
2669
|
-
}
|
|
2670
|
-
function encodeValue(value) {
|
|
2671
|
-
return value === void 0 ? "absent" : JSON.stringify(value);
|
|
2672
|
-
}
|
|
2680
|
+
var codec = { apply, read: readManifestValue };
|
|
2673
2681
|
var ManifestSet = class {
|
|
2674
2682
|
held = /* @__PURE__ */ new Map();
|
|
2675
2683
|
/** Read a manifest, or hand back the copy this run has already rewritten. */
|
|
@@ -2683,14 +2691,7 @@ var ManifestSet = class {
|
|
|
2683
2691
|
const reason = error instanceof Error ? error.message : String(error);
|
|
2684
2692
|
throw new CiteError(`Manifest ${manifest.file} could not be read: ${reason}`);
|
|
2685
2693
|
}
|
|
2686
|
-
const fresh =
|
|
2687
|
-
path: manifest.path,
|
|
2688
|
-
file: manifest.file,
|
|
2689
|
-
before,
|
|
2690
|
-
text: before,
|
|
2691
|
-
ops: [],
|
|
2692
|
-
bases: /* @__PURE__ */ new Map()
|
|
2693
|
-
};
|
|
2694
|
+
const fresh = heldManifest(manifest.path, manifest.file, before);
|
|
2694
2695
|
this.held.set(manifest.path, fresh);
|
|
2695
2696
|
return fresh;
|
|
2696
2697
|
}
|
|
@@ -2704,11 +2705,12 @@ var ManifestSet = class {
|
|
|
2704
2705
|
const op = {
|
|
2705
2706
|
kind: "splice",
|
|
2706
2707
|
entry,
|
|
2708
|
+
key: CITATIONS_KEY2,
|
|
2707
2709
|
join: manifest.join,
|
|
2708
2710
|
file: manifest.file,
|
|
2709
2711
|
value: [...citations]
|
|
2710
2712
|
};
|
|
2711
|
-
rebaseable(held, op);
|
|
2713
|
+
rebaseable(held, op, codec);
|
|
2712
2714
|
const spliced = splice(held.text, {
|
|
2713
2715
|
entry,
|
|
2714
2716
|
key: CITATIONS_KEY2,
|
|
@@ -2738,8 +2740,14 @@ var ManifestSet = class {
|
|
|
2738
2740
|
*/
|
|
2739
2741
|
async remove(manifest, entry) {
|
|
2740
2742
|
const held = await this.hold(manifest);
|
|
2741
|
-
const op = {
|
|
2742
|
-
|
|
2743
|
+
const op = {
|
|
2744
|
+
kind: "remove",
|
|
2745
|
+
entry,
|
|
2746
|
+
key: CITATIONS_KEY2,
|
|
2747
|
+
join: manifest.join,
|
|
2748
|
+
file: manifest.file
|
|
2749
|
+
};
|
|
2750
|
+
rebaseable(held, op, codec);
|
|
2743
2751
|
held.text = apply(held.text, op);
|
|
2744
2752
|
held.ops.push(op);
|
|
2745
2753
|
}
|
|
@@ -2761,7 +2769,7 @@ var ManifestSet = class {
|
|
|
2761
2769
|
for (const held of this.held.values()) {
|
|
2762
2770
|
if (held.text === held.before) continue;
|
|
2763
2771
|
try {
|
|
2764
|
-
await settle(held, write, read);
|
|
2772
|
+
await settle(held, { codec, write, read, toError: (message) => new CiteError(message) });
|
|
2765
2773
|
} catch (error) {
|
|
2766
2774
|
if (io.onError !== void 0) await io.onError(changeOf(held), error);
|
|
2767
2775
|
throw error;
|
|
@@ -2782,70 +2790,16 @@ function changeOf(held) {
|
|
|
2782
2790
|
diff: unifiedDiff(held.file, held.before, held.text)
|
|
2783
2791
|
};
|
|
2784
2792
|
}
|
|
2785
|
-
function rebaseable(held, op) {
|
|
2786
|
-
const at2 = op.join === "path" ? posix.normalize(op.entry) : op.entry;
|
|
2787
|
-
if (held.bases.has(at2)) return;
|
|
2788
|
-
held.bases.set(at2, {
|
|
2789
|
-
entry: op.entry,
|
|
2790
|
-
join: op.join,
|
|
2791
|
-
value: encodeValue(
|
|
2792
|
-
readManifestValue(held.before, { entry: op.entry, key: CITATIONS_KEY2, join: op.join })
|
|
2793
|
-
)
|
|
2794
|
-
});
|
|
2795
|
-
}
|
|
2796
2793
|
function apply(text, op) {
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
entry: op.entry,
|
|
2800
|
-
key: CITATIONS_KEY2,
|
|
2801
|
-
value: op.value,
|
|
2802
|
-
join: op.join,
|
|
2803
|
-
file: op.file
|
|
2804
|
-
}).text;
|
|
2805
|
-
}
|
|
2794
|
+
const where = { entry: op.entry, key: op.key, join: op.join, file: op.file };
|
|
2795
|
+
if (op.kind === "splice") return splice(text, { ...where, value: op.value }).text;
|
|
2806
2796
|
try {
|
|
2807
|
-
return removeManifestKey(text,
|
|
2808
|
-
entry: op.entry,
|
|
2809
|
-
key: CITATIONS_KEY2,
|
|
2810
|
-
join: op.join,
|
|
2811
|
-
file: op.file
|
|
2812
|
-
}).text;
|
|
2797
|
+
return removeManifestKey(text, where).text;
|
|
2813
2798
|
} catch (error) {
|
|
2814
2799
|
if (error instanceof DocmetaError) throw new CiteError(error.message);
|
|
2815
2800
|
throw error;
|
|
2816
2801
|
}
|
|
2817
2802
|
}
|
|
2818
|
-
function rebase(held, current) {
|
|
2819
|
-
for (const base of held.bases.values()) {
|
|
2820
|
-
const now = encodeValue(
|
|
2821
|
-
readManifestValue(current, { entry: base.entry, key: CITATIONS_KEY2, join: base.join })
|
|
2822
|
-
);
|
|
2823
|
-
if (now !== base.value) return void 0;
|
|
2824
|
-
}
|
|
2825
|
-
let text = current;
|
|
2826
|
-
for (const op of held.ops) text = apply(text, op);
|
|
2827
|
-
return text;
|
|
2828
|
-
}
|
|
2829
|
-
async function settle(held, write, read) {
|
|
2830
|
-
for (let attempt = 1; attempt <= COMMIT_ATTEMPTS; attempt++) {
|
|
2831
|
-
let current;
|
|
2832
|
-
try {
|
|
2833
|
-
current = await read(held.path);
|
|
2834
|
-
} catch (error) {
|
|
2835
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
2836
|
-
throw new CiteError(`Manifest ${held.file} could not be read: ${reason}`);
|
|
2837
|
-
}
|
|
2838
|
-
if (current === held.before) {
|
|
2839
|
-
await write(held.path, held.text);
|
|
2840
|
-
return;
|
|
2841
|
-
}
|
|
2842
|
-
const replayed = rebase(held, current);
|
|
2843
|
-
if (replayed === void 0) throw new CiteError(conflictRefusal(held.file));
|
|
2844
|
-
held.before = current;
|
|
2845
|
-
held.text = replayed;
|
|
2846
|
-
}
|
|
2847
|
-
throw new CiteError(conflictRefusal(held.file));
|
|
2848
|
-
}
|
|
2849
2803
|
function splice(text, options) {
|
|
2850
2804
|
try {
|
|
2851
2805
|
return spliceManifestValue(text, options);
|
|
@@ -4270,8 +4224,8 @@ function sayNoUnit(reason) {
|
|
|
4270
4224
|
return "the line is outside the page body";
|
|
4271
4225
|
case "blank":
|
|
4272
4226
|
return "the line is blank";
|
|
4273
|
-
case "
|
|
4274
|
-
return "the
|
|
4227
|
+
case "fence-crossed":
|
|
4228
|
+
return "the claim's lines are not all inside one fenced block";
|
|
4275
4229
|
case "marker":
|
|
4276
4230
|
return "that line now holds a cite marker, not claim text";
|
|
4277
4231
|
case "not-a-paragraph":
|
|
@@ -4282,6 +4236,9 @@ function sayNoUnit(reason) {
|
|
|
4282
4236
|
return "that line is a table rule, not claim text";
|
|
4283
4237
|
}
|
|
4284
4238
|
}
|
|
4239
|
+
function unitNoun(kind) {
|
|
4240
|
+
return kind === "fenced-lines" ? "fenced text" : kind;
|
|
4241
|
+
}
|
|
4285
4242
|
function settles(plan) {
|
|
4286
4243
|
switch (plan.kind) {
|
|
4287
4244
|
case "claim-moved":
|
|
@@ -4757,7 +4714,7 @@ async function runUpdate(opts) {
|
|
|
4757
4714
|
if (unit !== void 0 && wide !== void 0) {
|
|
4758
4715
|
declined.set(result.origin.index, {
|
|
4759
4716
|
rule: "claim-changed",
|
|
4760
|
-
why: `Not re-pinned: the ${unit.kind} ${wide}.`
|
|
4717
|
+
why: `Not re-pinned: the ${unitNoun(unit.kind)} ${wide}.`
|
|
4761
4718
|
});
|
|
4762
4719
|
} else if (unit === void 0) {
|
|
4763
4720
|
const why = at2 === void 0 ? void 0 : noUnitAt(page, at2, lines, held, named4);
|
|
@@ -4767,7 +4724,12 @@ async function runUpdate(opts) {
|
|
|
4767
4724
|
why: `Not re-pinned: ${sayNoUnit(why)}.`
|
|
4768
4725
|
});
|
|
4769
4726
|
}
|
|
4770
|
-
} else if (
|
|
4727
|
+
} else if (wantsBlock && unit.kind !== "block") {
|
|
4728
|
+
declined.set(result.origin.index, {
|
|
4729
|
+
rule: "claim-changed",
|
|
4730
|
+
why: "Not re-pinned: quote: true, and the line no longer opens a fenced block."
|
|
4731
|
+
});
|
|
4732
|
+
} else if (pin !== void 0) {
|
|
4771
4733
|
const elsewhere = named4 ? [] : otherClaimSpans(lines, unit.lines, pin, page.bodyLine);
|
|
4772
4734
|
const replaced = replacementAt(claim, unit.text, page.format);
|
|
4773
4735
|
if (replaced !== void 0 && only === void 0) {
|
|
@@ -5413,10 +5375,10 @@ function renderCheckPretty(run3, opts) {
|
|
|
5413
5375
|
return lines.join("\n");
|
|
5414
5376
|
}
|
|
5415
5377
|
function spellAtSpec(spec) {
|
|
5416
|
-
const span =
|
|
5378
|
+
const span = spanOf2(spec);
|
|
5417
5379
|
return span === void 0 ? `lines ${spec}` : spellAt(span);
|
|
5418
5380
|
}
|
|
5419
|
-
function
|
|
5381
|
+
function spanOf2(spec) {
|
|
5420
5382
|
const [first, second] = spec.split("-");
|
|
5421
5383
|
const start = Number(first);
|
|
5422
5384
|
const end = second === void 0 ? start : Number(second);
|
|
@@ -5424,8 +5386,8 @@ function spanOf(spec) {
|
|
|
5424
5386
|
return { start, end };
|
|
5425
5387
|
}
|
|
5426
5388
|
function widening(held, now) {
|
|
5427
|
-
const was =
|
|
5428
|
-
const is =
|
|
5389
|
+
const was = spanOf2(held);
|
|
5390
|
+
const is = spanOf2(now);
|
|
5429
5391
|
if (was === void 0 || is === void 0) return "";
|
|
5430
5392
|
const parts = [];
|
|
5431
5393
|
if (is.start < was.start) {
|
|
@@ -6114,4 +6076,4 @@ export {
|
|
|
6114
6076
|
runKeyRotate,
|
|
6115
6077
|
runKeySet
|
|
6116
6078
|
};
|
|
6117
|
-
//# sourceMappingURL=chunk-
|
|
6079
|
+
//# sourceMappingURL=chunk-HZ2KWOOO.js.map
|