@hawkeyexl/manni 2.3.3 → 2.3.5

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 CHANGED
@@ -98,7 +98,7 @@ actually reads rather than hand-written:
98
98
  ```yaml
99
99
  repos:
100
100
  - repo: https://github.com/hawkeyexl/manni
101
- rev: v2.3.3
101
+ rev: v2.3.5
102
102
  hooks:
103
103
  - id: manni-meta
104
104
  ```
@@ -61,7 +61,7 @@ import {
61
61
  supportedExtensions,
62
62
  terminalConfirm,
63
63
  toJsonText
64
- } from "./chunk-SN5CEVX7.js";
64
+ } from "./chunk-HUBOM7FZ.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-AUWNPYWA.js.map
1520
+ //# sourceMappingURL=chunk-2ESHX2HT.js.map
@@ -32,6 +32,7 @@ import {
32
32
  findWindows,
33
33
  generateEncryptionKey,
34
34
  gitignoreOptions,
35
+ hasFrontmatterFence,
35
36
  hashLines,
36
37
  hashRange,
37
38
  isEncryptedValue,
@@ -69,7 +70,7 @@ import {
69
70
  withValueAt,
70
71
  writeEncryptionKey,
71
72
  writeFileAtomic
72
- } from "./chunk-SN5CEVX7.js";
73
+ } from "./chunk-HUBOM7FZ.js";
73
74
 
74
75
  // src/meta/core/reencrypt.ts
75
76
  import { extname } from "node:path";
@@ -476,6 +477,17 @@ async function buildSourceIndex(root, opts) {
476
477
  has: (path) => byPath.has(path)
477
478
  };
478
479
  }
480
+ function isEnoent(error) {
481
+ return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
482
+ }
483
+ async function sourceIndexFor(root, client) {
484
+ try {
485
+ return await buildSourceIndex(root, { gitClient: client });
486
+ } catch (error) {
487
+ if (isEnoent(error)) throw new CiteError(`Root directory not found: ${root}.`);
488
+ throw error;
489
+ }
490
+ }
479
491
  async function readSource(root, index, range, key) {
480
492
  let resolvedPath;
481
493
  if (range.encrypted) {
@@ -1334,6 +1346,7 @@ var citations_default = {
1334
1346
  // src/cite/core/page.ts
1335
1347
  var MAX_MARKERS_PER_PAGE = 500;
1336
1348
  var ELEMENT_BACKED = /* @__PURE__ */ new Set(["html", "xml"]);
1349
+ var FENCE_ONLY = /* @__PURE__ */ new Set(["markdown", "mdx"]);
1337
1350
  var MARKER_JSON = "A marker names an entry by id. Write the entry in frontmatter or the sidecar.";
1338
1351
  function ownedMessage(owner) {
1339
1352
  return `"citations" is owned by manifest ${owner.file} (collection ${owner.collection}); remove it from the document`;
@@ -1441,6 +1454,11 @@ function bodyLineOf(content, bodyOffset) {
1441
1454
  function readPage(file, content, opts) {
1442
1455
  const extractor = pickExtractor(file, opts?.format);
1443
1456
  const format = extractor.name;
1457
+ if (FENCE_ONLY.has(format) && hasFrontmatterFence(content) && locateFrontmatter(content) === null) {
1458
+ throw new CiteError(
1459
+ `${file}: Unterminated front matter fence: the opening fence has no matching close, so the page's citations cannot be read. Add a closing fence.`
1460
+ );
1461
+ }
1444
1462
  const extracted = extractor.extract(content, file);
1445
1463
  const data = extracted.data;
1446
1464
  const bodyOffset = ELEMENT_BACKED.has(format) ? 0 : locateFrontmatter(content)?.closeEnd ?? 0;
@@ -2652,17 +2670,6 @@ function joinHits() {
2652
2670
  }
2653
2671
  };
2654
2672
  }
2655
- function isEnoent(error) {
2656
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
2657
- }
2658
- async function indexFor(root, client) {
2659
- try {
2660
- return await buildSourceIndex(root, { gitClient: client });
2661
- } catch (error) {
2662
- if (isEnoent(error)) throw new CiteError(`Root directory not found: ${root}.`);
2663
- throw error;
2664
- }
2665
- }
2666
2673
  async function prepareRun(opts, action, verb, requireSources = false) {
2667
2674
  const cwd = resolve3(opts.cwd ?? process.cwd());
2668
2675
  const run3 = await resolveCiteRun({
@@ -2726,7 +2733,7 @@ async function prepareRun(opts, action, verb, requireSources = false) {
2726
2733
  severity: config?.severity,
2727
2734
  gitClient: git
2728
2735
  };
2729
- if (checkSources) pageOptions.sourceIndex = await indexFor(run3.root, git);
2736
+ if (checkSources) pageOptions.sourceIndex = await sourceIndexFor(run3.root, git);
2730
2737
  const sidecars2 = await sidecarsFor(run3);
2731
2738
  const setupFor = (label, content) => {
2732
2739
  const page = sidecars2?.forPage(label, content, forced?.name);
@@ -2971,7 +2978,7 @@ async function runAdd(opts) {
2971
2978
  }
2972
2979
  }
2973
2980
  const client = opts.gitClient ?? gitClient(root);
2974
- const sourceIndex = await buildSourceIndex(root, { gitClient: client });
2981
+ const sourceIndex = await sourceIndexFor(root, client);
2975
2982
  let body = content;
2976
2983
  let markerAt;
2977
2984
  let claimSpan;
@@ -3869,7 +3876,7 @@ function rootFor(flag, cite, file, cwd) {
3869
3876
  function isEnoent3(error) {
3870
3877
  return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
3871
3878
  }
3872
- async function indexFor2(root, client) {
3879
+ async function indexFor(root, client) {
3873
3880
  try {
3874
3881
  return await buildSourceIndex(root, { gitClient: client });
3875
3882
  } catch (error) {
@@ -4065,7 +4072,7 @@ async function runKeyRotate(opts) {
4065
4072
  const sourceIndex = () => {
4066
4073
  if (index === void 0) {
4067
4074
  if (fellBack) opts.onNotice?.(`No git root found; resolving src: paths from ${cwd}`);
4068
- index = indexFor2(root, client);
4075
+ index = indexFor(root, client);
4069
4076
  }
4070
4077
  return index;
4071
4078
  };
@@ -4258,4 +4265,4 @@ export {
4258
4265
  runKeyRotate,
4259
4266
  runKeySet
4260
4267
  };
4261
- //# sourceMappingURL=chunk-2I5U4HXR.js.map
4268
+ //# sourceMappingURL=chunk-FG7LVRZ3.js.map