@hawkeyexl/manni 4.4.1 → 4.5.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/README.md +1 -1
- package/dist/{batch-GFNLTGOH.js → batch-GOE3UXOD.js} +11 -11
- package/dist/{build-COYIQ25L.js → build-M7BMEHL2.js} +13 -11
- package/dist/{calibrate-MDBLJKEE.js → calibrate-6RRAILUY.js} +12 -12
- package/dist/{capture-LRML2PKV.js → capture-RJPQ6B4N.js} +12 -12
- package/dist/{check-EDLBYL5N.js → check-BQD64X3N.js} +11 -11
- package/dist/{check-HYNGXYJV.js → check-ESNS7ZBC.js} +4 -4
- package/dist/{check-ASPIHA6B.js → check-RQIIIURI.js} +12 -12
- package/dist/{chunk-NXV7WE2D.js → chunk-3R5Y3XOL.js} +3 -3
- package/dist/{chunk-A5ULMVHQ.js → chunk-3YHAYXBC.js} +2 -2
- package/dist/{chunk-57NEQRVO.js → chunk-527HHQPS.js} +4 -4
- package/dist/{chunk-57NEQRVO.js.map → chunk-527HHQPS.js.map} +1 -1
- package/dist/{chunk-6OYEI2VV.js → chunk-52PDIZKV.js} +3 -3
- package/dist/{chunk-UJCVAWP7.js → chunk-6XTQDFGP.js} +2 -2
- package/dist/{chunk-UJCVAWP7.js.map → chunk-6XTQDFGP.js.map} +1 -1
- package/dist/{chunk-3VK37OR2.js → chunk-7OQAU4EA.js} +5 -5
- package/dist/{chunk-4IUC2MNL.js → chunk-7ZUCEMCY.js} +8 -8
- package/dist/{chunk-M2JCK5F6.js → chunk-B7XUEQF3.js} +13 -2
- package/dist/chunk-B7XUEQF3.js.map +1 -0
- package/dist/{chunk-MYMBCTDE.js → chunk-BOIF2XGG.js} +2 -2
- package/dist/{chunk-YJOGUXGP.js → chunk-C3KI45RF.js} +8 -6
- package/dist/{chunk-YJOGUXGP.js.map → chunk-C3KI45RF.js.map} +1 -1
- package/dist/{chunk-MMTSSTG7.js → chunk-C6HZ6C5T.js} +2 -2
- package/dist/{chunk-QQUKGCAJ.js → chunk-CP4ZM43V.js} +2 -2
- package/dist/chunk-DE7JSWXV.js +2462 -0
- package/dist/chunk-DE7JSWXV.js.map +1 -0
- package/dist/{chunk-YB4IBW3M.js → chunk-DX32P2DT.js} +2 -2
- package/dist/{chunk-RL5XWQOL.js → chunk-EL2BZTDL.js} +137 -50
- package/dist/chunk-EL2BZTDL.js.map +1 -0
- package/dist/{chunk-WB3QM6PP.js → chunk-ELZ2IIOF.js} +332 -2522
- package/dist/chunk-ELZ2IIOF.js.map +1 -0
- package/dist/{chunk-MWJLZMBL.js → chunk-F2OVHJNC.js} +10 -10
- package/dist/{chunk-I2AH3CJJ.js → chunk-FLF6AECQ.js} +7 -7
- package/dist/{chunk-GCQRPUSB.js → chunk-GAZFKZHM.js} +4 -4
- package/dist/{chunk-QZ6LRSNV.js → chunk-HQFVJDEN.js} +7 -7
- package/dist/{chunk-M3W7J6MU.js → chunk-HVFR66GQ.js} +2 -2
- package/dist/{chunk-2B7ZNTPV.js → chunk-IA7BMIPE.js} +2 -2
- package/dist/{chunk-PIKOVN6W.js → chunk-JQU7FHYH.js} +6 -6
- package/dist/{chunk-NLXTXE5Y.js → chunk-K3U5F2QT.js} +183 -31
- package/dist/chunk-K3U5F2QT.js.map +1 -0
- package/dist/{chunk-JCDXE76J.js → chunk-MZC62HPZ.js} +2 -2
- package/dist/{chunk-TK3FC4RF.js → chunk-NAZRLJAK.js} +3 -3
- package/dist/{chunk-JXLTXMJ7.js → chunk-NGK3N6F2.js} +3 -3
- package/dist/{chunk-PU6DFJMY.js → chunk-NN4ASVTY.js} +3 -3
- package/dist/{chunk-C4SQM22E.js → chunk-OIZ3XMKB.js} +13 -11
- package/dist/chunk-OIZ3XMKB.js.map +1 -0
- package/dist/{chunk-6JSSEWBG.js → chunk-QCBICNKC.js} +6 -6
- package/dist/chunk-QCBICNKC.js.map +1 -0
- package/dist/{chunk-DXNZS72W.js → chunk-QLUMKWQQ.js} +3 -3
- package/dist/{chunk-EPH54CAY.js → chunk-QY3DOZMS.js} +4 -4
- package/dist/{chunk-FBEQCK47.js → chunk-SJO2FTPG.js} +6 -6
- package/dist/{chunk-PNPQTHBT.js → chunk-SNEHX4VE.js} +2 -2
- package/dist/{chunk-SKSDRUUK.js → chunk-TA42STP7.js} +4 -4
- package/dist/{chunk-CK7SKVHR.js → chunk-TBAMBLF3.js} +3 -12
- package/dist/chunk-TBAMBLF3.js.map +1 -0
- package/dist/{chunk-IDV6HJCB.js → chunk-TCC737IS.js} +3 -3
- package/dist/{chunk-QRWGPQKO.js → chunk-TVIX653Q.js} +3 -3
- package/dist/{chunk-YTURO7SI.js → chunk-UK2I3ACY.js} +3 -3
- package/dist/{chunk-7UKO3ASZ.js → chunk-XWFNO5PO.js} +3 -3
- package/dist/{chunk-37LP5HMZ.js → chunk-YA63PVWI.js} +5 -5
- package/dist/chunk-YGFIQ6Y5.js +17 -0
- package/dist/chunk-YGFIQ6Y5.js.map +1 -0
- package/dist/{chunk-UQISLDAV.js → chunk-ZX43SRZR.js} +3 -3
- package/dist/{cli-MN7PYMBI.js → cli-6PGVHP7Y.js} +15 -15
- package/dist/{cli-6UB5N6CU.js → cli-AAG3N4NB.js} +16 -16
- package/dist/{cli-6HIDIFVT.js → cli-E3H6ZP4I.js} +2 -2
- package/dist/{cli-RPM5PELX.js → cli-HUIMNJT6.js} +20 -15
- package/dist/cli-HUIMNJT6.js.map +1 -0
- package/dist/{cli-VI7VHWNZ.js → cli-MHTYPVOD.js} +16 -16
- package/dist/{cli-LFP5ZGYS.js → cli-PRZHQ3QB.js} +15 -13
- package/dist/{cli-LFP5ZGYS.js.map → cli-PRZHQ3QB.js.map} +1 -1
- package/dist/{cli-3BIBYHFK.js → cli-QKIJOXGW.js} +13 -13
- package/dist/{cli-PYPX6O6E.js → cli-TYGOHJOJ.js} +25 -25
- package/dist/{cli-673OTRGE.js → cli-YW6VWBHX.js} +9 -9
- package/dist/cli.js +11 -11
- package/dist/docmeta.js +8 -8
- package/dist/{github-SXPGP5DB.js → github-3WMSTNTK.js} +13 -13
- package/dist/{github-6QMYOHC3.js → github-OXSJQ4PS.js} +11 -11
- package/dist/index.d.ts +30 -8
- package/dist/index.js +42 -38
- package/dist/index.js.map +1 -1
- package/dist/{json-SY7KLNC7.js → json-4DCKDGUV.js} +11 -11
- package/dist/lint-YDHVVZHT.js +30 -0
- package/dist/{list-KZNVTNVC.js → list-3ZO2NIYO.js} +11 -11
- package/dist/{list-Q57YTFUQ.js → list-EJH6VAOW.js} +11 -11
- package/dist/{page-KSGV5RD4.js → page-QEDB7EVU.js} +10 -10
- package/dist/{pretty-A5EGTN35.js → pretty-5DGEBZSV.js} +11 -11
- package/dist/{pretty-CXSDXNAS.js → pretty-SQX33UM2.js} +12 -12
- package/dist/{reporters-HUY7UXFS.js → reporters-OHSI3RMV.js} +12 -11
- package/dist/{reporters-K2VUKSAK.js → reporters-YELDDYJD.js} +4 -4
- package/dist/{run-3DYJNRIG.js → run-IP6NZHAG.js} +11 -11
- package/dist/{term-BIQUPMOR.js → term-2WMDZ4PY.js} +15 -15
- package/dist/{validate-53RKM2XG.js → validate-G6HH3YXL.js} +5 -5
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/dist/chunk-6JSSEWBG.js.map +0 -1
- package/dist/chunk-C4SQM22E.js.map +0 -1
- package/dist/chunk-CK7SKVHR.js.map +0 -1
- package/dist/chunk-M2JCK5F6.js.map +0 -1
- package/dist/chunk-NLXTXE5Y.js.map +0 -1
- package/dist/chunk-RL5XWQOL.js.map +0 -1
- package/dist/chunk-WB3QM6PP.js.map +0 -1
- package/dist/cli-RPM5PELX.js.map +0 -1
- package/dist/lint-ASMJLLPA.js +0 -28
- /package/dist/{batch-GFNLTGOH.js.map → batch-GOE3UXOD.js.map} +0 -0
- /package/dist/{build-COYIQ25L.js.map → build-M7BMEHL2.js.map} +0 -0
- /package/dist/{calibrate-MDBLJKEE.js.map → calibrate-6RRAILUY.js.map} +0 -0
- /package/dist/{capture-LRML2PKV.js.map → capture-RJPQ6B4N.js.map} +0 -0
- /package/dist/{check-ASPIHA6B.js.map → check-BQD64X3N.js.map} +0 -0
- /package/dist/{check-EDLBYL5N.js.map → check-ESNS7ZBC.js.map} +0 -0
- /package/dist/{check-HYNGXYJV.js.map → check-RQIIIURI.js.map} +0 -0
- /package/dist/{chunk-NXV7WE2D.js.map → chunk-3R5Y3XOL.js.map} +0 -0
- /package/dist/{chunk-A5ULMVHQ.js.map → chunk-3YHAYXBC.js.map} +0 -0
- /package/dist/{chunk-6OYEI2VV.js.map → chunk-52PDIZKV.js.map} +0 -0
- /package/dist/{chunk-3VK37OR2.js.map → chunk-7OQAU4EA.js.map} +0 -0
- /package/dist/{chunk-4IUC2MNL.js.map → chunk-7ZUCEMCY.js.map} +0 -0
- /package/dist/{chunk-MYMBCTDE.js.map → chunk-BOIF2XGG.js.map} +0 -0
- /package/dist/{chunk-MMTSSTG7.js.map → chunk-C6HZ6C5T.js.map} +0 -0
- /package/dist/{chunk-QQUKGCAJ.js.map → chunk-CP4ZM43V.js.map} +0 -0
- /package/dist/{chunk-YB4IBW3M.js.map → chunk-DX32P2DT.js.map} +0 -0
- /package/dist/{chunk-MWJLZMBL.js.map → chunk-F2OVHJNC.js.map} +0 -0
- /package/dist/{chunk-I2AH3CJJ.js.map → chunk-FLF6AECQ.js.map} +0 -0
- /package/dist/{chunk-GCQRPUSB.js.map → chunk-GAZFKZHM.js.map} +0 -0
- /package/dist/{chunk-QZ6LRSNV.js.map → chunk-HQFVJDEN.js.map} +0 -0
- /package/dist/{chunk-M3W7J6MU.js.map → chunk-HVFR66GQ.js.map} +0 -0
- /package/dist/{chunk-2B7ZNTPV.js.map → chunk-IA7BMIPE.js.map} +0 -0
- /package/dist/{chunk-PIKOVN6W.js.map → chunk-JQU7FHYH.js.map} +0 -0
- /package/dist/{chunk-JCDXE76J.js.map → chunk-MZC62HPZ.js.map} +0 -0
- /package/dist/{chunk-TK3FC4RF.js.map → chunk-NAZRLJAK.js.map} +0 -0
- /package/dist/{chunk-JXLTXMJ7.js.map → chunk-NGK3N6F2.js.map} +0 -0
- /package/dist/{chunk-PU6DFJMY.js.map → chunk-NN4ASVTY.js.map} +0 -0
- /package/dist/{chunk-DXNZS72W.js.map → chunk-QLUMKWQQ.js.map} +0 -0
- /package/dist/{chunk-EPH54CAY.js.map → chunk-QY3DOZMS.js.map} +0 -0
- /package/dist/{chunk-FBEQCK47.js.map → chunk-SJO2FTPG.js.map} +0 -0
- /package/dist/{chunk-PNPQTHBT.js.map → chunk-SNEHX4VE.js.map} +0 -0
- /package/dist/{chunk-SKSDRUUK.js.map → chunk-TA42STP7.js.map} +0 -0
- /package/dist/{chunk-IDV6HJCB.js.map → chunk-TCC737IS.js.map} +0 -0
- /package/dist/{chunk-QRWGPQKO.js.map → chunk-TVIX653Q.js.map} +0 -0
- /package/dist/{chunk-YTURO7SI.js.map → chunk-UK2I3ACY.js.map} +0 -0
- /package/dist/{chunk-7UKO3ASZ.js.map → chunk-XWFNO5PO.js.map} +0 -0
- /package/dist/{chunk-37LP5HMZ.js.map → chunk-YA63PVWI.js.map} +0 -0
- /package/dist/{chunk-UQISLDAV.js.map → chunk-ZX43SRZR.js.map} +0 -0
- /package/dist/{cli-MN7PYMBI.js.map → cli-6PGVHP7Y.js.map} +0 -0
- /package/dist/{cli-6UB5N6CU.js.map → cli-AAG3N4NB.js.map} +0 -0
- /package/dist/{cli-6HIDIFVT.js.map → cli-E3H6ZP4I.js.map} +0 -0
- /package/dist/{cli-VI7VHWNZ.js.map → cli-MHTYPVOD.js.map} +0 -0
- /package/dist/{cli-3BIBYHFK.js.map → cli-QKIJOXGW.js.map} +0 -0
- /package/dist/{cli-PYPX6O6E.js.map → cli-TYGOHJOJ.js.map} +0 -0
- /package/dist/{cli-673OTRGE.js.map → cli-YW6VWBHX.js.map} +0 -0
- /package/dist/{github-6QMYOHC3.js.map → github-3WMSTNTK.js.map} +0 -0
- /package/dist/{github-SXPGP5DB.js.map → github-OXSJQ4PS.js.map} +0 -0
- /package/dist/{json-SY7KLNC7.js.map → json-4DCKDGUV.js.map} +0 -0
- /package/dist/{lint-ASMJLLPA.js.map → lint-YDHVVZHT.js.map} +0 -0
- /package/dist/{list-KZNVTNVC.js.map → list-3ZO2NIYO.js.map} +0 -0
- /package/dist/{list-Q57YTFUQ.js.map → list-EJH6VAOW.js.map} +0 -0
- /package/dist/{page-KSGV5RD4.js.map → page-QEDB7EVU.js.map} +0 -0
- /package/dist/{pretty-A5EGTN35.js.map → pretty-5DGEBZSV.js.map} +0 -0
- /package/dist/{pretty-CXSDXNAS.js.map → pretty-SQX33UM2.js.map} +0 -0
- /package/dist/{reporters-HUY7UXFS.js.map → reporters-OHSI3RMV.js.map} +0 -0
- /package/dist/{reporters-K2VUKSAK.js.map → reporters-YELDDYJD.js.map} +0 -0
- /package/dist/{run-3DYJNRIG.js.map → run-IP6NZHAG.js.map} +0 -0
- /package/dist/{term-BIQUPMOR.js.map → term-2WMDZ4PY.js.map} +0 -0
- /package/dist/{validate-53RKM2XG.js.map → validate-G6HH3YXL.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
resolvePages,
|
|
9
9
|
runConfigOptions,
|
|
10
10
|
withExternalMetadata
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7OQAU4EA.js";
|
|
12
12
|
import {
|
|
13
13
|
SUMMARY_FORMATS,
|
|
14
14
|
parseFormat
|
|
@@ -93,4 +93,4 @@ export {
|
|
|
93
93
|
runList,
|
|
94
94
|
renderList
|
|
95
95
|
};
|
|
96
|
-
//# sourceMappingURL=chunk-
|
|
96
|
+
//# sourceMappingURL=chunk-DX32P2DT.js.map
|
|
@@ -10,18 +10,21 @@ import {
|
|
|
10
10
|
documentBase,
|
|
11
11
|
documentSetPatterns,
|
|
12
12
|
emitLocalizations,
|
|
13
|
+
extractorFor,
|
|
13
14
|
formatOf,
|
|
14
15
|
isLanguageTag,
|
|
15
16
|
isSafeRelativePath,
|
|
16
17
|
mergePage,
|
|
18
|
+
metadataOf,
|
|
19
|
+
mintTreeSections,
|
|
17
20
|
openMetaView,
|
|
18
|
-
ownMetadata,
|
|
19
21
|
parseLocalizations,
|
|
22
|
+
parseTree,
|
|
20
23
|
resolveDocumentSet,
|
|
21
24
|
routesFrom,
|
|
22
25
|
searchIndexFilename,
|
|
23
26
|
vectorIndexFilename
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-K3U5F2QT.js";
|
|
25
28
|
import {
|
|
26
29
|
bundledShapesPath,
|
|
27
30
|
compactIri,
|
|
@@ -29,7 +32,7 @@ import {
|
|
|
29
32
|
loadGraph,
|
|
30
33
|
storeToQuads,
|
|
31
34
|
validateGraph
|
|
32
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-BOIF2XGG.js";
|
|
33
36
|
import {
|
|
34
37
|
COVERAGE_FIELDS,
|
|
35
38
|
DEFAULT_MODEL,
|
|
@@ -69,18 +72,19 @@ import {
|
|
|
69
72
|
loadRunConfig,
|
|
70
73
|
profileFor,
|
|
71
74
|
withPrefix
|
|
72
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-B7XUEQF3.js";
|
|
73
76
|
import {
|
|
74
77
|
mergeMetaProvenance
|
|
75
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-3YHAYXBC.js";
|
|
76
79
|
import {
|
|
77
80
|
isMissing,
|
|
78
81
|
spliceManifestValue
|
|
79
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-HVFR66GQ.js";
|
|
80
83
|
import {
|
|
84
|
+
DocmetaError,
|
|
81
85
|
urlManifestMessage,
|
|
82
86
|
writeFileAtomic
|
|
83
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-527HHQPS.js";
|
|
84
88
|
import {
|
|
85
89
|
assertKnownProvider,
|
|
86
90
|
assertLocalFlag,
|
|
@@ -253,7 +257,7 @@ function emitRdfXml(quads, prefixes) {
|
|
|
253
257
|
|
|
254
258
|
// src/graph/core/iirds-package.ts
|
|
255
259
|
import { existsSync } from "node:fs";
|
|
256
|
-
import { resolve } from "node:path";
|
|
260
|
+
import { extname, resolve } from "node:path";
|
|
257
261
|
import { DataFactory } from "n3";
|
|
258
262
|
|
|
259
263
|
// src/graph/core/zip.ts
|
|
@@ -330,6 +334,19 @@ function writeZip(entries) {
|
|
|
330
334
|
// src/graph/core/iirds-package.ts
|
|
331
335
|
var GRAPH_DOCUMENT = `${NS.graph}Document`;
|
|
332
336
|
var XSD_STRING3 = `${NS.xsd}string`;
|
|
337
|
+
var MEDIA_TYPES = {
|
|
338
|
+
".html": "text/html",
|
|
339
|
+
".htm": "text/html",
|
|
340
|
+
".adoc": "text/asciidoc",
|
|
341
|
+
".asciidoc": "text/asciidoc",
|
|
342
|
+
".rst": "text/x-rst",
|
|
343
|
+
".dita": "application/dita+xml",
|
|
344
|
+
".ditamap": "application/dita+xml",
|
|
345
|
+
".xml": "application/xml"
|
|
346
|
+
};
|
|
347
|
+
function mediaTypeOf(path2) {
|
|
348
|
+
return MEDIA_TYPES[extname(path2).toLowerCase()] ?? "text/markdown";
|
|
349
|
+
}
|
|
333
350
|
var CARRIED = [
|
|
334
351
|
IIRDS_HAS_TOPIC_TYPE,
|
|
335
352
|
IIRDS_HAS_SUBJECT,
|
|
@@ -390,7 +407,7 @@ function projectPackage(store, opts, cwd) {
|
|
|
390
407
|
add(doc, IIRDS_HAS_RENDITION, iri(rendition));
|
|
391
408
|
add(rendition, RDF_TYPE, iri(IIRDS_RENDITION));
|
|
392
409
|
add(rendition, IIRDS_SOURCE, lit(zipPath));
|
|
393
|
-
add(rendition, IIRDS_FORMAT, lit(
|
|
410
|
+
add(rendition, IIRDS_FORMAT, lit(mediaTypeOf(path2)));
|
|
394
411
|
contentFiles.push({ zipPath, absPath });
|
|
395
412
|
} else {
|
|
396
413
|
warnings.push(
|
|
@@ -720,6 +737,21 @@ var FRONTMATTER = /^---[ \t]*\r?\n(?:[\s\S]*?\r?\n)?(?:---|\.\.\.)[ \t]*(?:\r?\n
|
|
|
720
737
|
function stripFrontmatter(markdown) {
|
|
721
738
|
return markdown.replace(FRONTMATTER, "");
|
|
722
739
|
}
|
|
740
|
+
function plainText(nodes) {
|
|
741
|
+
return nodes.map((n) => n.text.replace(/\r\n/g, "\n").trim()).filter((t) => t !== "");
|
|
742
|
+
}
|
|
743
|
+
function treeText(source, path2) {
|
|
744
|
+
const format = formatOf(path2);
|
|
745
|
+
if (format === "markdown" || format === "mdx") return void 0;
|
|
746
|
+
const minted = mintTreeSections(parseTree(source, path2, format).sections);
|
|
747
|
+
const sections = /* @__PURE__ */ new Map();
|
|
748
|
+
for (const [n, section] of minted.sections.entries()) {
|
|
749
|
+
const own = plainText(minted.owned[n] ?? []);
|
|
750
|
+
sections.set(section.slug, [section.title, ...own].join("\n\n"));
|
|
751
|
+
}
|
|
752
|
+
const lead = plainText(minted.unowned);
|
|
753
|
+
return { doc: lead.length > 0 ? lead.join("\n\n") : void 0, sections };
|
|
754
|
+
}
|
|
723
755
|
function entry(id, type, fields) {
|
|
724
756
|
const out = { id, type };
|
|
725
757
|
if (fields.title !== void 0) out.title = fields.title;
|
|
@@ -736,6 +768,7 @@ function buildSearchIndex(graph, cwd, options = {}) {
|
|
|
736
768
|
});
|
|
737
769
|
const entries = [];
|
|
738
770
|
const sourceOf = /* @__PURE__ */ new Map();
|
|
771
|
+
const treeTextOf = /* @__PURE__ */ new Map();
|
|
739
772
|
const allSections = graph.instancesOf(GRAPH_SECTION);
|
|
740
773
|
const sectionsOf = /* @__PURE__ */ new Map();
|
|
741
774
|
for (const section of allSections) {
|
|
@@ -755,8 +788,10 @@ function buildSearchIndex(graph, cwd, options = {}) {
|
|
|
755
788
|
`Source not found for ${path2} \u2014 indexed without body text.`
|
|
756
789
|
);
|
|
757
790
|
}
|
|
791
|
+
const tree = source === void 0 || path2 === void 0 ? void 0 : treeText(source, path2);
|
|
792
|
+
if (tree) treeTextOf.set(doc, tree);
|
|
758
793
|
const body = source === void 0 ? void 0 : stripFrontmatter(source).replace(/\r\n/g, "\n");
|
|
759
|
-
const text = body === void 0 ? void 0 : (sectionsOf.get(doc)?.length ?? 0) > 0 ? documentPreamble(body) : body;
|
|
794
|
+
const text = tree ? tree.doc : body === void 0 ? void 0 : (sectionsOf.get(doc)?.length ?? 0) > 0 ? documentPreamble(body) : body;
|
|
760
795
|
entries.push(
|
|
761
796
|
entry(doc, compactIri(GRAPH_DOCUMENT2), {
|
|
762
797
|
title: graph.literal(doc, DCTERMS_TITLE2),
|
|
@@ -779,7 +814,8 @@ function buildSearchIndex(graph, cwd, options = {}) {
|
|
|
779
814
|
occurrences = sectionOccurrences(graph, doc);
|
|
780
815
|
occurrencesOf.set(doc, occurrences);
|
|
781
816
|
}
|
|
782
|
-
const
|
|
817
|
+
const tree = treeTextOf.get(doc);
|
|
818
|
+
const text = tree ? tree.sections.get(section.slice(hash + 1)) : source !== void 0 && title !== void 0 ? sectionOwnText(source, title, level, occurrences.get(section) ?? 0) : void 0;
|
|
783
819
|
entries.push(entry(section, compactIri(GRAPH_SECTION), { title, text }));
|
|
784
820
|
}
|
|
785
821
|
for (const concept of graph.instancesOf(SKOS_CONCEPT)) {
|
|
@@ -1243,6 +1279,7 @@ import { resolve as resolve6 } from "node:path";
|
|
|
1243
1279
|
|
|
1244
1280
|
// src/graph/core/frontmatter-edit.ts
|
|
1245
1281
|
import { Document, YAMLMap, YAMLSeq, isMap, parseDocument } from "yaml";
|
|
1282
|
+
var GRAPH_KEY = "graph";
|
|
1246
1283
|
function frontmatterKind(content) {
|
|
1247
1284
|
const body = content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
1248
1285
|
if (/^---(\r?\n)/.test(body)) return "yaml";
|
|
@@ -1286,9 +1323,7 @@ function setField(doc, map, field, value) {
|
|
|
1286
1323
|
map.set(field, node);
|
|
1287
1324
|
}
|
|
1288
1325
|
function applyGraphFields(content, path2, values, options = {}) {
|
|
1289
|
-
const entries =
|
|
1290
|
-
([, v]) => v !== void 0 && v !== null && !(Array.isArray(v) && v.length === 0)
|
|
1291
|
-
);
|
|
1326
|
+
const entries = writable(values);
|
|
1292
1327
|
const pageEntries = Object.entries(options.page ?? {});
|
|
1293
1328
|
if (entries.length === 0 && pageEntries.length === 0) {
|
|
1294
1329
|
return { content, applied: [], skipped: [] };
|
|
@@ -1340,6 +1375,23 @@ function applyGraphFields(content, path2, values, options = {}) {
|
|
|
1340
1375
|
doc.set("graph", graph);
|
|
1341
1376
|
}
|
|
1342
1377
|
const graphMap = graph ?? doc.createNode({});
|
|
1378
|
+
const { applied, skipped } = mergeFields(doc, graphMap, entries, options.force);
|
|
1379
|
+
for (const [key, value] of pageEntries) {
|
|
1380
|
+
doc.set(key, doc.createNode(value));
|
|
1381
|
+
}
|
|
1382
|
+
if (applied.length === 0 && pageEntries.length === 0) {
|
|
1383
|
+
return { content, applied, skipped };
|
|
1384
|
+
}
|
|
1385
|
+
let newBlock = doc.toString();
|
|
1386
|
+
if (split.eol === "\r\n") newBlock = newBlock.replace(/(?<!\r)\n/g, "\r\n");
|
|
1387
|
+
return { content: split.open + newBlock + split.suffix, applied, skipped };
|
|
1388
|
+
}
|
|
1389
|
+
function writable(values) {
|
|
1390
|
+
return Object.entries(values).filter(
|
|
1391
|
+
([, v]) => v !== void 0 && v !== null && !(Array.isArray(v) && v.length === 0)
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
function mergeFields(doc, graphMap, entries, force) {
|
|
1343
1395
|
const applied = [];
|
|
1344
1396
|
const skipped = [];
|
|
1345
1397
|
for (const [field, value] of entries) {
|
|
@@ -1364,22 +1416,45 @@ function applyGraphFields(content, path2, values, options = {}) {
|
|
|
1364
1416
|
skipped.push(field);
|
|
1365
1417
|
continue;
|
|
1366
1418
|
}
|
|
1367
|
-
if (target.has(leaf) && !
|
|
1419
|
+
if (target.has(leaf) && !force) {
|
|
1368
1420
|
skipped.push(field);
|
|
1369
1421
|
continue;
|
|
1370
1422
|
}
|
|
1371
1423
|
setField(doc, target, leaf, value);
|
|
1372
1424
|
applied.push(field);
|
|
1373
1425
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1426
|
+
return { applied, skipped };
|
|
1427
|
+
}
|
|
1428
|
+
function writeGraphFields(content, path2, format, values, options = {}) {
|
|
1429
|
+
if (format === "markdown" || format === "mdx") {
|
|
1430
|
+
return applyGraphFields(content, path2, values, options);
|
|
1376
1431
|
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1432
|
+
const entries = writable(values);
|
|
1433
|
+
const patch = {};
|
|
1434
|
+
let applied = [];
|
|
1435
|
+
let skipped = [];
|
|
1436
|
+
if (entries.length > 0) {
|
|
1437
|
+
const doc = new Document(
|
|
1438
|
+
metadataOf(content, path2, format).data[GRAPH_KEY] ?? {}
|
|
1439
|
+
);
|
|
1440
|
+
if (!isMap(doc.contents)) {
|
|
1441
|
+
throw new GraphError(`${path2}: metadata key "graph" is not a map`);
|
|
1442
|
+
}
|
|
1443
|
+
({ applied, skipped } = mergeFields(
|
|
1444
|
+
doc,
|
|
1445
|
+
doc.contents,
|
|
1446
|
+
entries,
|
|
1447
|
+
options.force
|
|
1448
|
+
));
|
|
1449
|
+
if (applied.length > 0) patch[GRAPH_KEY] = doc.toJS();
|
|
1379
1450
|
}
|
|
1380
|
-
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1451
|
+
Object.assign(patch, options.page);
|
|
1452
|
+
if (Object.keys(patch).length === 0) return { content, applied, skipped };
|
|
1453
|
+
const apply = extractorFor(format)?.apply;
|
|
1454
|
+
if (apply === void 0) {
|
|
1455
|
+
throw new GraphError(`${path2}: manni cannot write ${format} metadata`);
|
|
1456
|
+
}
|
|
1457
|
+
return { content: apply(content, patch, { filePath: path2 }), applied, skipped };
|
|
1383
1458
|
}
|
|
1384
1459
|
function frontmatterData(content) {
|
|
1385
1460
|
const split = splitYamlFrontmatter(content, "");
|
|
@@ -1579,9 +1654,13 @@ var FillGuard = class _FillGuard {
|
|
|
1579
1654
|
if (guarded().length === 0) return { values: current, rejected };
|
|
1580
1655
|
const baseline = await this.baseline();
|
|
1581
1656
|
while (guarded().length > 0) {
|
|
1582
|
-
const applied =
|
|
1583
|
-
|
|
1584
|
-
|
|
1657
|
+
const applied = writeGraphFields(
|
|
1658
|
+
content,
|
|
1659
|
+
path2,
|
|
1660
|
+
formatOf(path2, this.analyzeOptions.format),
|
|
1661
|
+
current,
|
|
1662
|
+
{ force: this.force }
|
|
1663
|
+
);
|
|
1585
1664
|
const model = analyzeDoc(
|
|
1586
1665
|
applied.content,
|
|
1587
1666
|
path2,
|
|
@@ -2153,7 +2232,8 @@ async function runFill(opts = {}) {
|
|
|
2153
2232
|
...stdinDocument === void 0 ? {} : { stdinDocument }
|
|
2154
2233
|
};
|
|
2155
2234
|
async function fillOne(path2, absPath, content) {
|
|
2156
|
-
|
|
2235
|
+
const pageFormat = formatOf(path2, format);
|
|
2236
|
+
if ((pageFormat === "markdown" || pageFormat === "mdx") && frontmatterKind(content) === "unsupported") {
|
|
2157
2237
|
throw new GraphError(
|
|
2158
2238
|
"only YAML frontmatter can be edited (found a TOML/JSON fence) \u2014 exclude this file or convert its frontmatter"
|
|
2159
2239
|
);
|
|
@@ -2164,17 +2244,21 @@ async function runFill(opts = {}) {
|
|
|
2164
2244
|
throw failure instanceof Error ? failure : new GraphError(errorMessage(failure));
|
|
2165
2245
|
}
|
|
2166
2246
|
if (absPath !== void 0) {
|
|
2167
|
-
const own2 =
|
|
2168
|
-
if (
|
|
2169
|
-
const home = await view.home(path2, own2,
|
|
2247
|
+
const own2 = metadataOf(content, path2, pageFormat).data;
|
|
2248
|
+
if (GRAPH_KEY2 in own2) {
|
|
2249
|
+
const home = await view.home(path2, own2, GRAPH_KEY2);
|
|
2170
2250
|
if (home.kind !== "unowned") {
|
|
2171
2251
|
throw new GraphError(
|
|
2172
|
-
`"${
|
|
2252
|
+
`"${GRAPH_KEY2}" is owned by manifest ${home.file} (collection ${home.collection}); remove it from the document`
|
|
2173
2253
|
);
|
|
2174
2254
|
}
|
|
2175
2255
|
}
|
|
2176
2256
|
}
|
|
2177
|
-
const
|
|
2257
|
+
const held = metadataOf(effective, path2, pageFormat).data;
|
|
2258
|
+
const heldGraph = held[GRAPH_KEY2];
|
|
2259
|
+
const present = new Set(
|
|
2260
|
+
heldGraph !== null && typeof heldGraph === "object" && !Array.isArray(heldGraph) ? Object.keys(heldGraph) : []
|
|
2261
|
+
);
|
|
2178
2262
|
const missing = opts.force ? fields : fields.filter((f) => !present.has(f));
|
|
2179
2263
|
if (missing.length === 0 && !withSections) {
|
|
2180
2264
|
return {
|
|
@@ -2305,8 +2389,8 @@ async function runFill(opts = {}) {
|
|
|
2305
2389
|
if (config.fill.writeProvenance) {
|
|
2306
2390
|
const recordable = realFields.filter((f) => !f.includes(".")).sort();
|
|
2307
2391
|
if (recordable.length < realFields.length) sectionsUnrecorded.push(path2);
|
|
2308
|
-
const
|
|
2309
|
-
const priorEntry = Array.isArray(
|
|
2392
|
+
const heldProvenance = held[META_PROVENANCE_KEY];
|
|
2393
|
+
const priorEntry = Array.isArray(heldProvenance) ? heldProvenance.find(
|
|
2310
2394
|
(e) => !!e && typeof e === "object" && !Array.isArray(e) && e["generated-by"] === identity.model
|
|
2311
2395
|
) : void 0;
|
|
2312
2396
|
const priorConfidence = numberMap(priorEntry?.["confidence"]);
|
|
@@ -2322,7 +2406,7 @@ async function runFill(opts = {}) {
|
|
|
2322
2406
|
([f, name]) => confidence[f] === void 0 && priorConfidence[name] === void 0
|
|
2323
2407
|
).map(([, name]) => name);
|
|
2324
2408
|
const merged = mergeMetaProvenance(
|
|
2325
|
-
|
|
2409
|
+
heldProvenance,
|
|
2326
2410
|
identity.model,
|
|
2327
2411
|
"fields",
|
|
2328
2412
|
proposed
|
|
@@ -2333,7 +2417,7 @@ async function runFill(opts = {}) {
|
|
|
2333
2417
|
provenanceList = merged.list;
|
|
2334
2418
|
}
|
|
2335
2419
|
}
|
|
2336
|
-
const applied =
|
|
2420
|
+
const applied = writeGraphFields(effective, path2, pageFormat, narrowed, {
|
|
2337
2421
|
force: opts.force
|
|
2338
2422
|
});
|
|
2339
2423
|
const reportedFields = applied.applied;
|
|
@@ -2349,10 +2433,10 @@ async function runFill(opts = {}) {
|
|
|
2349
2433
|
cached
|
|
2350
2434
|
};
|
|
2351
2435
|
}
|
|
2352
|
-
const own =
|
|
2353
|
-
const graphHome = absPath === void 0 ? void 0 : await view.home(path2, own,
|
|
2436
|
+
const own = metadataOf(content, path2, pageFormat).data;
|
|
2437
|
+
const graphHome = absPath === void 0 ? void 0 : await view.home(path2, own, GRAPH_KEY2);
|
|
2354
2438
|
const provenanceHome = absPath === void 0 || provenanceList === void 0 ? void 0 : await view.home(path2, own, META_PROVENANCE_KEY);
|
|
2355
|
-
const graphTarget = writeTarget(path2, graphHome,
|
|
2439
|
+
const graphTarget = writeTarget(path2, graphHome, GRAPH_KEY2);
|
|
2356
2440
|
if (typeof graphTarget === "string") throw new GraphError(graphTarget);
|
|
2357
2441
|
let provenanceTarget = writeTarget(path2, provenanceHome, META_PROVENANCE_KEY);
|
|
2358
2442
|
if (typeof provenanceTarget === "string") {
|
|
@@ -2364,9 +2448,10 @@ async function runFill(opts = {}) {
|
|
|
2364
2448
|
if (provenanceList !== void 0 && provenanceTarget === null) {
|
|
2365
2449
|
pageKeys[META_PROVENANCE_KEY] = provenanceList;
|
|
2366
2450
|
}
|
|
2367
|
-
const pageContent =
|
|
2451
|
+
const pageContent = writeGraphFields(
|
|
2368
2452
|
content,
|
|
2369
2453
|
path2,
|
|
2454
|
+
pageFormat,
|
|
2370
2455
|
graphTarget === null ? narrowed : {},
|
|
2371
2456
|
{ force: opts.force, page: pageKeys }
|
|
2372
2457
|
).content;
|
|
@@ -2374,8 +2459,8 @@ async function runFill(opts = {}) {
|
|
|
2374
2459
|
if (graphTarget !== null) {
|
|
2375
2460
|
manifestWrites.push({
|
|
2376
2461
|
home: graphTarget,
|
|
2377
|
-
key:
|
|
2378
|
-
value:
|
|
2462
|
+
key: GRAPH_KEY2,
|
|
2463
|
+
value: metadataOf(applied.content, path2, pageFormat).data[GRAPH_KEY2]
|
|
2379
2464
|
});
|
|
2380
2465
|
}
|
|
2381
2466
|
if (provenanceList !== void 0 && provenanceTarget !== null) {
|
|
@@ -2408,7 +2493,7 @@ async function runFill(opts = {}) {
|
|
|
2408
2493
|
};
|
|
2409
2494
|
}
|
|
2410
2495
|
}
|
|
2411
|
-
var
|
|
2496
|
+
var GRAPH_KEY2 = "graph";
|
|
2412
2497
|
function writeTarget(path2, home, key) {
|
|
2413
2498
|
if (home === void 0 || home.kind === "unowned") return null;
|
|
2414
2499
|
if (home.kind === "url") return urlManifestMessage(key, home.file);
|
|
@@ -2455,16 +2540,18 @@ async function spliceAll(writes) {
|
|
|
2455
2540
|
return [...out.values()];
|
|
2456
2541
|
}
|
|
2457
2542
|
async function mergedText(view, path2, content, format) {
|
|
2458
|
-
|
|
2459
|
-
|
|
2543
|
+
const markdown = format === "markdown" || format === "mdx";
|
|
2544
|
+
if (markdown && frontmatterKind(content) === "unsupported") return content;
|
|
2545
|
+
const own = metadataOf(content, path2, format);
|
|
2546
|
+
const { supplied } = await mergePage(view, path2, own.data, own.present, format);
|
|
2547
|
+
if (Object.keys(supplied).length === 0) return content;
|
|
2460
2548
|
try {
|
|
2461
|
-
|
|
2549
|
+
return writeGraphFields(content, path2, format, {}, { page: supplied }).content;
|
|
2462
2550
|
} catch (e) {
|
|
2463
|
-
|
|
2551
|
+
const noFence = (format === "asciidoc" || format === "rst") && e instanceof DocmetaError;
|
|
2552
|
+
if (!noFence) throw e;
|
|
2553
|
+
return applyGraphFields(content, path2, {}, { page: supplied }).content;
|
|
2464
2554
|
}
|
|
2465
|
-
const { supplied } = await mergePage(view, path2, own.data, own.present, format);
|
|
2466
|
-
if (Object.keys(supplied).length === 0) return content;
|
|
2467
|
-
return applyGraphFields(content, path2, {}, { page: supplied }).content;
|
|
2468
2555
|
}
|
|
2469
2556
|
async function openMetaViewPerPage(source, cwd, paths, base2, failures) {
|
|
2470
2557
|
try {
|
|
@@ -3869,4 +3956,4 @@ export {
|
|
|
3869
3956
|
runTraverse,
|
|
3870
3957
|
renderTraverse
|
|
3871
3958
|
};
|
|
3872
|
-
//# sourceMappingURL=chunk-
|
|
3959
|
+
//# sourceMappingURL=chunk-EL2BZTDL.js.map
|