@hawkeyexl/manni 2.8.2 → 2.8.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/README.md +1 -1
- package/dist/{chunk-WCNU53MJ.js → chunk-DGC4CCK3.js} +21 -78
- package/dist/chunk-DGC4CCK3.js.map +1 -0
- package/dist/{chunk-KEW557TN.js → chunk-KGI7B6DD.js} +204 -101
- package/dist/chunk-KGI7B6DD.js.map +1 -0
- package/dist/{chunk-7UBCWTCO.js → chunk-KYTHN2VT.js} +2 -2
- package/dist/cli.js +3 -3
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +41 -33
- 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-KYTHN2VT.js.map} +0 -0
package/README.md
CHANGED
|
@@ -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-KGI7B6DD.js";
|
|
76
79
|
|
|
77
80
|
// src/meta/core/reencrypt.ts
|
|
78
81
|
import { extname } from "node:path";
|
|
@@ -2663,13 +2666,7 @@ function unifiedDiff(label, before, after) {
|
|
|
2663
2666
|
}
|
|
2664
2667
|
|
|
2665
2668
|
// 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
|
-
}
|
|
2669
|
+
var codec = { apply, read: readManifestValue };
|
|
2673
2670
|
var ManifestSet = class {
|
|
2674
2671
|
held = /* @__PURE__ */ new Map();
|
|
2675
2672
|
/** Read a manifest, or hand back the copy this run has already rewritten. */
|
|
@@ -2683,14 +2680,7 @@ var ManifestSet = class {
|
|
|
2683
2680
|
const reason = error instanceof Error ? error.message : String(error);
|
|
2684
2681
|
throw new CiteError(`Manifest ${manifest.file} could not be read: ${reason}`);
|
|
2685
2682
|
}
|
|
2686
|
-
const fresh =
|
|
2687
|
-
path: manifest.path,
|
|
2688
|
-
file: manifest.file,
|
|
2689
|
-
before,
|
|
2690
|
-
text: before,
|
|
2691
|
-
ops: [],
|
|
2692
|
-
bases: /* @__PURE__ */ new Map()
|
|
2693
|
-
};
|
|
2683
|
+
const fresh = heldManifest(manifest.path, manifest.file, before);
|
|
2694
2684
|
this.held.set(manifest.path, fresh);
|
|
2695
2685
|
return fresh;
|
|
2696
2686
|
}
|
|
@@ -2704,11 +2694,12 @@ var ManifestSet = class {
|
|
|
2704
2694
|
const op = {
|
|
2705
2695
|
kind: "splice",
|
|
2706
2696
|
entry,
|
|
2697
|
+
key: CITATIONS_KEY2,
|
|
2707
2698
|
join: manifest.join,
|
|
2708
2699
|
file: manifest.file,
|
|
2709
2700
|
value: [...citations]
|
|
2710
2701
|
};
|
|
2711
|
-
rebaseable(held, op);
|
|
2702
|
+
rebaseable(held, op, codec);
|
|
2712
2703
|
const spliced = splice(held.text, {
|
|
2713
2704
|
entry,
|
|
2714
2705
|
key: CITATIONS_KEY2,
|
|
@@ -2738,8 +2729,14 @@ var ManifestSet = class {
|
|
|
2738
2729
|
*/
|
|
2739
2730
|
async remove(manifest, entry) {
|
|
2740
2731
|
const held = await this.hold(manifest);
|
|
2741
|
-
const op = {
|
|
2742
|
-
|
|
2732
|
+
const op = {
|
|
2733
|
+
kind: "remove",
|
|
2734
|
+
entry,
|
|
2735
|
+
key: CITATIONS_KEY2,
|
|
2736
|
+
join: manifest.join,
|
|
2737
|
+
file: manifest.file
|
|
2738
|
+
};
|
|
2739
|
+
rebaseable(held, op, codec);
|
|
2743
2740
|
held.text = apply(held.text, op);
|
|
2744
2741
|
held.ops.push(op);
|
|
2745
2742
|
}
|
|
@@ -2761,7 +2758,7 @@ var ManifestSet = class {
|
|
|
2761
2758
|
for (const held of this.held.values()) {
|
|
2762
2759
|
if (held.text === held.before) continue;
|
|
2763
2760
|
try {
|
|
2764
|
-
await settle(held, write, read);
|
|
2761
|
+
await settle(held, { codec, write, read, toError: (message) => new CiteError(message) });
|
|
2765
2762
|
} catch (error) {
|
|
2766
2763
|
if (io.onError !== void 0) await io.onError(changeOf(held), error);
|
|
2767
2764
|
throw error;
|
|
@@ -2782,70 +2779,16 @@ function changeOf(held) {
|
|
|
2782
2779
|
diff: unifiedDiff(held.file, held.before, held.text)
|
|
2783
2780
|
};
|
|
2784
2781
|
}
|
|
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
2782
|
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
|
-
}
|
|
2783
|
+
const where = { entry: op.entry, key: op.key, join: op.join, file: op.file };
|
|
2784
|
+
if (op.kind === "splice") return splice(text, { ...where, value: op.value }).text;
|
|
2806
2785
|
try {
|
|
2807
|
-
return removeManifestKey(text,
|
|
2808
|
-
entry: op.entry,
|
|
2809
|
-
key: CITATIONS_KEY2,
|
|
2810
|
-
join: op.join,
|
|
2811
|
-
file: op.file
|
|
2812
|
-
}).text;
|
|
2786
|
+
return removeManifestKey(text, where).text;
|
|
2813
2787
|
} catch (error) {
|
|
2814
2788
|
if (error instanceof DocmetaError) throw new CiteError(error.message);
|
|
2815
2789
|
throw error;
|
|
2816
2790
|
}
|
|
2817
2791
|
}
|
|
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
2792
|
function splice(text, options) {
|
|
2850
2793
|
try {
|
|
2851
2794
|
return spliceManifestValue(text, options);
|
|
@@ -6114,4 +6057,4 @@ export {
|
|
|
6114
6057
|
runKeyRotate,
|
|
6115
6058
|
runKeySet
|
|
6116
6059
|
};
|
|
6117
|
-
//# sourceMappingURL=chunk-
|
|
6060
|
+
//# sourceMappingURL=chunk-DGC4CCK3.js.map
|