@hawkeyexl/manni 4.8.0 → 4.9.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-6LJJZTT7.js → batch-W5GXL2P4.js} +10 -10
- package/dist/{build-QKFXKAXT.js → build-Q56FEXR6.js} +9 -9
- package/dist/{calibrate-UQJR3WCU.js → calibrate-XFE56P4M.js} +11 -11
- package/dist/{capture-HQ2PGM5Z.js → capture-GMYH4ATL.js} +10 -10
- package/dist/{check-BF56QRWL.js → check-HBRX4FOR.js} +9 -9
- package/dist/{check-NSDC5LSE.js → check-KUBELO5G.js} +13 -13
- package/dist/check-KUBELO5G.js.map +1 -0
- package/dist/{check-3DZOMJ7R.js → check-ZE5HIDOW.js} +10 -10
- package/dist/{chunk-GEX2HDAT.js → chunk-23UAGEKP.js} +2 -2
- package/dist/{chunk-KWAXJCKS.js → chunk-2EHDJ47Y.js} +4 -4
- package/dist/{chunk-ALAH6HNY.js → chunk-35WTFPQS.js} +2 -2
- package/dist/{chunk-QRAKST62.js → chunk-3CDZWY6M.js} +4 -4
- package/dist/{chunk-A36QDIXZ.js → chunk-3XGGF5JW.js} +809 -4
- package/dist/chunk-3XGGF5JW.js.map +1 -0
- package/dist/{chunk-ZH3VTIBL.js → chunk-3XMG4CZY.js} +7 -7
- package/dist/{chunk-J3IK5IGO.js → chunk-5EB6RIXJ.js} +2 -2
- package/dist/{chunk-G4T6SF3C.js → chunk-5LBEQ4ZU.js} +129 -26
- package/dist/chunk-5LBEQ4ZU.js.map +1 -0
- package/dist/{chunk-WZFA33SD.js → chunk-5WME4CB6.js} +6 -6
- package/dist/{chunk-W7RSTW55.js → chunk-76I6I5N2.js} +21 -3
- package/dist/{chunk-W7RSTW55.js.map → chunk-76I6I5N2.js.map} +1 -1
- package/dist/{chunk-TVKYNKB3.js → chunk-BSTXARMY.js} +10 -10
- package/dist/{chunk-UZGSFQLT.js → chunk-DTGIUMZV.js} +4 -4
- package/dist/{chunk-ZYRHDBVS.js → chunk-FGUXMZXO.js} +5 -5
- package/dist/{chunk-HYT242KI.js → chunk-FSBIPCWE.js} +6 -6
- package/dist/{chunk-UMGAACCP.js → chunk-GEMXGXPR.js} +3 -3
- package/dist/{chunk-ZJNE4BKG.js → chunk-GRILZZGS.js} +2 -2
- package/dist/{chunk-BP7LGVF3.js → chunk-HRXDM6H6.js} +7 -7
- package/dist/{chunk-AZXCL5WH.js → chunk-IN6DWNVE.js} +4 -4
- package/dist/{chunk-CGO5MNRD.js → chunk-KX5IYIOO.js} +2 -2
- package/dist/{chunk-CGO5MNRD.js.map → chunk-KX5IYIOO.js.map} +1 -1
- package/dist/{chunk-22G33NL2.js → chunk-M6GH3FGJ.js} +3 -3
- package/dist/{chunk-LRU5BK3L.js → chunk-MHAYLDBK.js} +3 -3
- package/dist/{chunk-EOGF6VCA.js → chunk-ND2S5BXB.js} +2 -2
- package/dist/{chunk-H3LM7D6K.js → chunk-OVOYKWCM.js} +4 -4
- package/dist/{chunk-RGB7WBFD.js → chunk-OWSNXPPX.js} +3 -3
- package/dist/{chunk-77WI6LJW.js → chunk-Q2H7J3FF.js} +5 -5
- package/dist/{chunk-2QEHLWYM.js → chunk-Q45PZX2D.js} +2 -2
- package/dist/{chunk-426TGC2Q.js → chunk-QAKJNPY3.js} +5 -5
- package/dist/{chunk-KRSLDZ7N.js → chunk-QCCAHV6A.js} +34 -7
- package/dist/{chunk-KRSLDZ7N.js.map → chunk-QCCAHV6A.js.map} +1 -1
- package/dist/{chunk-W6AZHTGB.js → chunk-QKE3XS2L.js} +2 -2
- package/dist/{chunk-CHDADR7F.js → chunk-RFSGKF4O.js} +35 -17
- package/dist/chunk-RFSGKF4O.js.map +1 -0
- package/dist/{chunk-GWGR7BDP.js → chunk-TKTRIZT4.js} +5 -5
- package/dist/{chunk-VCQOUFTZ.js → chunk-TMI2YF6D.js} +4 -4
- package/dist/{chunk-OA2GKJVM.js → chunk-UDUHRXJ4.js} +2 -2
- package/dist/{chunk-BMRZFTAD.js → chunk-VKWZCEWB.js} +3 -3
- package/dist/{chunk-ZDYW7XTS.js → chunk-X6WLCNKC.js} +3 -3
- package/dist/{chunk-JUN4DUHG.js → chunk-XHFHXOQQ.js} +6 -6
- package/dist/{chunk-TKVGEFMH.js → chunk-XTAHZTES.js} +3 -3
- package/dist/{chunk-HOE2C42K.js → chunk-YEUQ7OKT.js} +1291 -125
- package/dist/chunk-YEUQ7OKT.js.map +1 -0
- package/dist/{chunk-LXFY64QR.js → chunk-YUZ2ECZY.js} +3 -3
- package/dist/{cli-PNK2HTIC.js → cli-B7SFJDZA.js} +11 -11
- package/dist/{cli-EOSY3WVX.js → cli-BJ7JXJ2U.js} +10 -10
- package/dist/{cli-X24QGW6Y.js → cli-EMQXRN6E.js} +11 -11
- package/dist/{cli-WGONI6PJ.js → cli-J35OPSTP.js} +7 -7
- package/dist/{cli-CSXPJZVM.js → cli-MEPJTS2V.js} +14 -14
- package/dist/{cli-JER6KIUJ.js → cli-TPONWND4.js} +17 -17
- package/dist/{cli-IX3WSFV4.js → cli-URNPOMOH.js} +2 -2
- package/dist/{cli-IYC7F5OJ.js → cli-YDMMIL2U.js} +13 -13
- package/dist/{cli-7OIV7UXF.js → cli-ZJRHU7MO.js} +28 -28
- package/dist/cli.js +11 -11
- package/dist/docmeta.js +6 -6
- package/dist/{github-LL5LHQFG.js → github-63CZJGZS.js} +11 -11
- package/dist/{github-GFTLEZ3D.js → github-IYOVHWHG.js} +9 -9
- package/dist/index.d.ts +11 -1
- package/dist/index.js +30 -30
- package/dist/{json-XDV4CZEU.js → json-JIUPGOUQ.js} +9 -9
- package/dist/{lint-NO4GIR3Z.js → lint-TBE35CCW.js} +9 -9
- package/dist/{list-4GJ6KI4U.js → list-IZ4RIM72.js} +9 -9
- package/dist/{list-4G6F5BX2.js → list-TNEJ3J77.js} +9 -9
- package/dist/{page-4VJQELH5.js → page-WQ3GQF76.js} +8 -8
- package/dist/{prepare-TGHFPUYE.js → prepare-ZUTYXTUZ.js} +9 -9
- package/dist/{pretty-ZMKG3AJR.js → pretty-CBV5XSMZ.js} +9 -9
- package/dist/{pretty-HFA6ITJY.js → pretty-Q3C433DW.js} +10 -10
- package/dist/{reporters-DZTHBJEA.js → reporters-DH5HPFXJ.js} +8 -8
- package/dist/{reporters-FRM5BHPL.js → reporters-TTYGOUAF.js} +4 -4
- package/dist/{run-BRC64Y7B.js → run-LZXKVTM7.js} +9 -9
- package/dist/{term-PNWS7F5B.js → term-DL3YFL43.js} +278 -149
- package/dist/term-DL3YFL43.js.map +1 -0
- package/dist/{validate-ULPJI4GQ.js → validate-UVDMC5LT.js} +4 -4
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/dist/check-NSDC5LSE.js.map +0 -1
- package/dist/chunk-A36QDIXZ.js.map +0 -1
- package/dist/chunk-CHDADR7F.js.map +0 -1
- package/dist/chunk-G4T6SF3C.js.map +0 -1
- package/dist/chunk-HOE2C42K.js.map +0 -1
- package/dist/term-PNWS7F5B.js.map +0 -1
- /package/dist/{batch-6LJJZTT7.js.map → batch-W5GXL2P4.js.map} +0 -0
- /package/dist/{build-QKFXKAXT.js.map → build-Q56FEXR6.js.map} +0 -0
- /package/dist/{calibrate-UQJR3WCU.js.map → calibrate-XFE56P4M.js.map} +0 -0
- /package/dist/{capture-HQ2PGM5Z.js.map → capture-GMYH4ATL.js.map} +0 -0
- /package/dist/{check-3DZOMJ7R.js.map → check-HBRX4FOR.js.map} +0 -0
- /package/dist/{check-BF56QRWL.js.map → check-ZE5HIDOW.js.map} +0 -0
- /package/dist/{chunk-GEX2HDAT.js.map → chunk-23UAGEKP.js.map} +0 -0
- /package/dist/{chunk-KWAXJCKS.js.map → chunk-2EHDJ47Y.js.map} +0 -0
- /package/dist/{chunk-ALAH6HNY.js.map → chunk-35WTFPQS.js.map} +0 -0
- /package/dist/{chunk-QRAKST62.js.map → chunk-3CDZWY6M.js.map} +0 -0
- /package/dist/{chunk-ZH3VTIBL.js.map → chunk-3XMG4CZY.js.map} +0 -0
- /package/dist/{chunk-J3IK5IGO.js.map → chunk-5EB6RIXJ.js.map} +0 -0
- /package/dist/{chunk-WZFA33SD.js.map → chunk-5WME4CB6.js.map} +0 -0
- /package/dist/{chunk-TVKYNKB3.js.map → chunk-BSTXARMY.js.map} +0 -0
- /package/dist/{chunk-UZGSFQLT.js.map → chunk-DTGIUMZV.js.map} +0 -0
- /package/dist/{chunk-ZYRHDBVS.js.map → chunk-FGUXMZXO.js.map} +0 -0
- /package/dist/{chunk-HYT242KI.js.map → chunk-FSBIPCWE.js.map} +0 -0
- /package/dist/{chunk-UMGAACCP.js.map → chunk-GEMXGXPR.js.map} +0 -0
- /package/dist/{chunk-ZJNE4BKG.js.map → chunk-GRILZZGS.js.map} +0 -0
- /package/dist/{chunk-BP7LGVF3.js.map → chunk-HRXDM6H6.js.map} +0 -0
- /package/dist/{chunk-AZXCL5WH.js.map → chunk-IN6DWNVE.js.map} +0 -0
- /package/dist/{chunk-22G33NL2.js.map → chunk-M6GH3FGJ.js.map} +0 -0
- /package/dist/{chunk-LRU5BK3L.js.map → chunk-MHAYLDBK.js.map} +0 -0
- /package/dist/{chunk-EOGF6VCA.js.map → chunk-ND2S5BXB.js.map} +0 -0
- /package/dist/{chunk-H3LM7D6K.js.map → chunk-OVOYKWCM.js.map} +0 -0
- /package/dist/{chunk-RGB7WBFD.js.map → chunk-OWSNXPPX.js.map} +0 -0
- /package/dist/{chunk-77WI6LJW.js.map → chunk-Q2H7J3FF.js.map} +0 -0
- /package/dist/{chunk-2QEHLWYM.js.map → chunk-Q45PZX2D.js.map} +0 -0
- /package/dist/{chunk-426TGC2Q.js.map → chunk-QAKJNPY3.js.map} +0 -0
- /package/dist/{chunk-W6AZHTGB.js.map → chunk-QKE3XS2L.js.map} +0 -0
- /package/dist/{chunk-GWGR7BDP.js.map → chunk-TKTRIZT4.js.map} +0 -0
- /package/dist/{chunk-VCQOUFTZ.js.map → chunk-TMI2YF6D.js.map} +0 -0
- /package/dist/{chunk-OA2GKJVM.js.map → chunk-UDUHRXJ4.js.map} +0 -0
- /package/dist/{chunk-BMRZFTAD.js.map → chunk-VKWZCEWB.js.map} +0 -0
- /package/dist/{chunk-ZDYW7XTS.js.map → chunk-X6WLCNKC.js.map} +0 -0
- /package/dist/{chunk-JUN4DUHG.js.map → chunk-XHFHXOQQ.js.map} +0 -0
- /package/dist/{chunk-TKVGEFMH.js.map → chunk-XTAHZTES.js.map} +0 -0
- /package/dist/{chunk-LXFY64QR.js.map → chunk-YUZ2ECZY.js.map} +0 -0
- /package/dist/{cli-PNK2HTIC.js.map → cli-B7SFJDZA.js.map} +0 -0
- /package/dist/{cli-EOSY3WVX.js.map → cli-BJ7JXJ2U.js.map} +0 -0
- /package/dist/{cli-X24QGW6Y.js.map → cli-EMQXRN6E.js.map} +0 -0
- /package/dist/{cli-WGONI6PJ.js.map → cli-J35OPSTP.js.map} +0 -0
- /package/dist/{cli-CSXPJZVM.js.map → cli-MEPJTS2V.js.map} +0 -0
- /package/dist/{cli-JER6KIUJ.js.map → cli-TPONWND4.js.map} +0 -0
- /package/dist/{cli-IX3WSFV4.js.map → cli-URNPOMOH.js.map} +0 -0
- /package/dist/{cli-IYC7F5OJ.js.map → cli-YDMMIL2U.js.map} +0 -0
- /package/dist/{cli-7OIV7UXF.js.map → cli-ZJRHU7MO.js.map} +0 -0
- /package/dist/{github-GFTLEZ3D.js.map → github-63CZJGZS.js.map} +0 -0
- /package/dist/{github-LL5LHQFG.js.map → github-IYOVHWHG.js.map} +0 -0
- /package/dist/{json-XDV4CZEU.js.map → json-JIUPGOUQ.js.map} +0 -0
- /package/dist/{lint-NO4GIR3Z.js.map → lint-TBE35CCW.js.map} +0 -0
- /package/dist/{list-4G6F5BX2.js.map → list-IZ4RIM72.js.map} +0 -0
- /package/dist/{list-4GJ6KI4U.js.map → list-TNEJ3J77.js.map} +0 -0
- /package/dist/{page-4VJQELH5.js.map → page-WQ3GQF76.js.map} +0 -0
- /package/dist/{prepare-TGHFPUYE.js.map → prepare-ZUTYXTUZ.js.map} +0 -0
- /package/dist/{pretty-HFA6ITJY.js.map → pretty-CBV5XSMZ.js.map} +0 -0
- /package/dist/{pretty-ZMKG3AJR.js.map → pretty-Q3C433DW.js.map} +0 -0
- /package/dist/{reporters-DZTHBJEA.js.map → reporters-DH5HPFXJ.js.map} +0 -0
- /package/dist/{reporters-FRM5BHPL.js.map → reporters-TTYGOUAF.js.map} +0 -0
- /package/dist/{run-BRC64Y7B.js.map → run-LZXKVTM7.js.map} +0 -0
- /package/dist/{validate-ULPJI4GQ.js.map → validate-UVDMC5LT.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
renderFormatsJson,
|
|
5
5
|
renderGetJson,
|
|
6
6
|
renderListJson
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ND2S5BXB.js";
|
|
8
8
|
import {
|
|
9
9
|
renderFindingsPretty,
|
|
10
10
|
renderFormatsPretty,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
renderListPretty,
|
|
13
13
|
renderValeWiring,
|
|
14
14
|
renderWritePretty
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5LBEQ4ZU.js";
|
|
16
16
|
import {
|
|
17
17
|
FINDING_FORMATS,
|
|
18
18
|
JUNIT_CLASSNAME,
|
|
@@ -24,66 +24,80 @@ import {
|
|
|
24
24
|
runCheck,
|
|
25
25
|
summarize,
|
|
26
26
|
toResults
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-RFSGKF4O.js";
|
|
28
28
|
import {
|
|
29
29
|
LIST_FORMATS,
|
|
30
30
|
runList
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-23UAGEKP.js";
|
|
32
32
|
import {
|
|
33
33
|
renderFindingsGithub
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-5EB6RIXJ.js";
|
|
35
35
|
import {
|
|
36
|
+
DEFAULT_LANGUAGE,
|
|
36
37
|
DITA_HOLDS,
|
|
37
38
|
DOCBOOK_HOLDS,
|
|
38
39
|
LIST_HOLDS,
|
|
39
40
|
MANIFEST_FORMAT,
|
|
41
|
+
TBX_V3_NAMESPACE,
|
|
40
42
|
TERM_FIELDS,
|
|
41
43
|
TERM_READERS,
|
|
42
44
|
TERM_RULES,
|
|
43
45
|
TERM_WRITE_FORMATS,
|
|
44
46
|
TermError,
|
|
45
47
|
asciidocEntry,
|
|
48
|
+
conceptGroups,
|
|
46
49
|
displayPath,
|
|
47
50
|
ditaEntry,
|
|
48
51
|
docbookEntry,
|
|
52
|
+
droppedFields,
|
|
53
|
+
exportTbxSource,
|
|
49
54
|
extractInput,
|
|
50
55
|
fileOf,
|
|
51
56
|
formatChoice,
|
|
52
57
|
htmlDlEntry,
|
|
58
|
+
isMultilingual,
|
|
59
|
+
languageKey,
|
|
60
|
+
languageOf,
|
|
61
|
+
lf,
|
|
53
62
|
loadSet,
|
|
54
63
|
loadTerms,
|
|
55
64
|
markdownEntry,
|
|
65
|
+
mergeFirst,
|
|
56
66
|
plural,
|
|
57
67
|
readerForConstruct,
|
|
58
68
|
reindent,
|
|
69
|
+
requireShape,
|
|
59
70
|
resolveTermRun,
|
|
60
71
|
rstEntry,
|
|
61
72
|
sharedLanguage,
|
|
73
|
+
tbxEntryLines,
|
|
74
|
+
tbxInput,
|
|
75
|
+
tbxSourceOf,
|
|
62
76
|
valeConfigFor,
|
|
63
77
|
xmlAttribute,
|
|
64
78
|
xmlText
|
|
65
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-YEUQ7OKT.js";
|
|
66
80
|
import "./chunk-77AINBYM.js";
|
|
67
81
|
import "./chunk-IKEWBMCN.js";
|
|
68
|
-
import "./chunk-
|
|
82
|
+
import "./chunk-M6GH3FGJ.js";
|
|
69
83
|
import {
|
|
70
84
|
registerTermLabelSource
|
|
71
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-IN6DWNVE.js";
|
|
72
86
|
import {
|
|
73
87
|
collect,
|
|
74
88
|
readStdin,
|
|
75
89
|
splitList
|
|
76
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-QCCAHV6A.js";
|
|
77
91
|
import {
|
|
78
92
|
OMITTED_WHEN_CLEAN,
|
|
79
93
|
renderJunit,
|
|
80
94
|
renderSarif
|
|
81
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-X6WLCNKC.js";
|
|
82
96
|
import {
|
|
83
97
|
STDIN_TOKEN,
|
|
84
98
|
extractorByName,
|
|
85
99
|
extractorForExtension
|
|
86
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-3XGGF5JW.js";
|
|
87
101
|
import {
|
|
88
102
|
fail
|
|
89
103
|
} from "./chunk-YEUYKR62.js";
|
|
@@ -98,7 +112,7 @@ import {
|
|
|
98
112
|
import "./chunk-QCHVR4ZM.js";
|
|
99
113
|
import {
|
|
100
114
|
package_default
|
|
101
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-KX5IYIOO.js";
|
|
102
116
|
import "./chunk-OWBRDNRZ.js";
|
|
103
117
|
import {
|
|
104
118
|
errorMessage
|
|
@@ -160,39 +174,52 @@ function htmlPage(term) {
|
|
|
160
174
|
]);
|
|
161
175
|
}
|
|
162
176
|
|
|
163
|
-
// src/term/core/writers/render-util.ts
|
|
164
|
-
var DEFAULT_LANGUAGE = "en";
|
|
165
|
-
function droppedFields(terms, held) {
|
|
166
|
-
const dropped = [];
|
|
167
|
-
for (const term of terms) {
|
|
168
|
-
for (const field of TERM_FIELDS) {
|
|
169
|
-
if (term.record[field] !== void 0 && !held.includes(field)) dropped.push({ id: term.id, field });
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return dropped;
|
|
173
|
-
}
|
|
174
|
-
function requireShape(format, target, shape) {
|
|
175
|
-
if (target.shape === shape) return;
|
|
176
|
-
throw new TermError(
|
|
177
|
-
shape === "file" ? `-f ${format} writes one file, not a directory. Pass -o <file>.` : `-f ${format} writes a styles directory, not a file. Pass -o <styles directory>.`
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
177
|
// src/term/core/writers/documents.ts
|
|
182
178
|
var UNSAFE_NAME = /[/\\:*?"<>|]/;
|
|
183
179
|
function pagePaths(terms, target, extension) {
|
|
180
|
+
const multilingual = isMultilingual(terms);
|
|
181
|
+
const spelling = /* @__PURE__ */ new Map();
|
|
184
182
|
const seen = /* @__PURE__ */ new Set();
|
|
185
183
|
return terms.map((term) => {
|
|
186
184
|
if (UNSAFE_NAME.test(term.id) || term.id === "." || term.id === "..") {
|
|
187
185
|
throw new TermError(`the id "${term.id}" cannot name a file. Give the term an id without path characters.`);
|
|
188
186
|
}
|
|
189
|
-
if (
|
|
190
|
-
|
|
187
|
+
if (!multilingual) {
|
|
188
|
+
if (seen.has(term.id)) {
|
|
189
|
+
throw new TermError(`two terms have the id "${term.id}", and a directory holds one file per id.`);
|
|
190
|
+
}
|
|
191
|
+
seen.add(term.id);
|
|
192
|
+
return join(target.path, `${term.id}${extension}`);
|
|
193
|
+
}
|
|
194
|
+
const key = languageKey(term);
|
|
195
|
+
const language = spelling.get(key) ?? languageOf(term);
|
|
196
|
+
spelling.set(key, language);
|
|
197
|
+
if (UNSAFE_NAME.test(language) || language === "." || language === "..") {
|
|
198
|
+
throw new TermError(
|
|
199
|
+
`the language "${language}" cannot name a directory. Give the term a language without path characters.`
|
|
200
|
+
);
|
|
191
201
|
}
|
|
192
|
-
seen.
|
|
193
|
-
|
|
202
|
+
if (seen.has(`${key} ${term.id}`)) {
|
|
203
|
+
throw new TermError(
|
|
204
|
+
`two terms have the id "${term.id}" in ${language}, and a directory holds one file per id in each language.`
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
seen.add(`${key} ${term.id}`);
|
|
208
|
+
return join(target.path, language, `${term.id}${extension}`);
|
|
194
209
|
});
|
|
195
210
|
}
|
|
211
|
+
function firstLanguage(terms) {
|
|
212
|
+
const [first] = terms;
|
|
213
|
+
if (first === void 0 || !isMultilingual(terms)) return { kept: [...terms] };
|
|
214
|
+
const key = languageKey(first);
|
|
215
|
+
return {
|
|
216
|
+
kept: terms.filter((t) => languageKey(t) === key),
|
|
217
|
+
otherLanguages: {
|
|
218
|
+
written: languageOf(first),
|
|
219
|
+
terms: terms.filter((t) => languageKey(t) !== key).map((t) => ({ id: t.id, language: languageOf(t) }))
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
196
223
|
function documentWriter(spec) {
|
|
197
224
|
const { directory } = spec;
|
|
198
225
|
return {
|
|
@@ -210,24 +237,26 @@ function documentWriter(spec) {
|
|
|
210
237
|
};
|
|
211
238
|
}
|
|
212
239
|
requireShape(spec.format, target, "file");
|
|
213
|
-
const
|
|
240
|
+
const { kept, otherLanguages } = firstLanguage(terms);
|
|
241
|
+
const written = spec.file.needsDefinition ? kept.filter((t) => t.record.definition !== void 0) : kept;
|
|
214
242
|
return {
|
|
215
243
|
files: [{ path: target.path, content: spec.file.render(written) }],
|
|
216
244
|
removals: [],
|
|
217
245
|
dropped: droppedFields(written, spec.file.holds),
|
|
218
|
-
skipped:
|
|
246
|
+
skipped: kept.filter((t) => !written.includes(t)).map((t) => t.id),
|
|
247
|
+
...otherLanguages === void 0 ? {} : { otherLanguages }
|
|
219
248
|
};
|
|
220
249
|
}
|
|
221
250
|
};
|
|
222
251
|
}
|
|
223
|
-
function entriesBlock(
|
|
224
|
-
return
|
|
252
|
+
function entriesBlock(entries2, indent = "") {
|
|
253
|
+
return entries2.flatMap((entry, i) => [
|
|
225
254
|
...i === 0 ? [] : [""],
|
|
226
255
|
`${indent}${reindent(entry, indent, "\n")}`
|
|
227
256
|
]);
|
|
228
257
|
}
|
|
229
|
-
function markupBlock(
|
|
230
|
-
return
|
|
258
|
+
function markupBlock(entries2, indent) {
|
|
259
|
+
return entries2.map((entry) => `${indent}${reindent(entry, indent, "\n")}`);
|
|
231
260
|
}
|
|
232
261
|
function textPage(format) {
|
|
233
262
|
return (term) => metadataPage(format, term);
|
|
@@ -364,6 +393,18 @@ var DOCUMENT_WRITERS = [
|
|
|
364
393
|
];
|
|
365
394
|
|
|
366
395
|
// src/term/core/writers/csv.ts
|
|
396
|
+
var HOLDS = [
|
|
397
|
+
"label",
|
|
398
|
+
"definition",
|
|
399
|
+
"abstract",
|
|
400
|
+
"alt-labels",
|
|
401
|
+
"hidden-labels",
|
|
402
|
+
"broader",
|
|
403
|
+
"narrower",
|
|
404
|
+
"related-terms",
|
|
405
|
+
"see",
|
|
406
|
+
"scope-note"
|
|
407
|
+
];
|
|
367
408
|
var LANGUAGE_COLUMNS = [
|
|
368
409
|
["label", "Term"],
|
|
369
410
|
["definition", "Definition"],
|
|
@@ -382,35 +423,53 @@ var LIST_SEPARATOR = " | ";
|
|
|
382
423
|
function cell(value) {
|
|
383
424
|
return /[",\r\n]/.test(value) ? `"${value.replaceAll('"', '""')}"` : value;
|
|
384
425
|
}
|
|
385
|
-
function fieldText(
|
|
386
|
-
const value =
|
|
426
|
+
function fieldText(record, field) {
|
|
427
|
+
const value = record[field];
|
|
387
428
|
if (value === void 0) return "";
|
|
388
429
|
return typeof value === "string" ? value : value.join(LIST_SEPARATOR);
|
|
389
430
|
}
|
|
431
|
+
function rowsOf(terms) {
|
|
432
|
+
return conceptGroups(terms).flatMap((group) => {
|
|
433
|
+
const rows = [];
|
|
434
|
+
for (const term of group) {
|
|
435
|
+
const row = rows.find((r) => !r.some((t) => languageKey(t) === languageKey(term)));
|
|
436
|
+
if (row === void 0) rows.push([term]);
|
|
437
|
+
else row.push(term);
|
|
438
|
+
}
|
|
439
|
+
return rows;
|
|
440
|
+
});
|
|
441
|
+
}
|
|
390
442
|
var csvWriter = {
|
|
391
443
|
format: "csv",
|
|
392
444
|
shapes: ["file"],
|
|
393
|
-
holds: (_shape) =>
|
|
445
|
+
holds: (_shape) => HOLDS,
|
|
394
446
|
render(terms, target) {
|
|
395
447
|
requireShape("csv", target, "file");
|
|
396
|
-
const languages =
|
|
448
|
+
const languages = /* @__PURE__ */ new Map();
|
|
397
449
|
for (const term of terms) {
|
|
398
|
-
|
|
399
|
-
if (!languages.includes(language)) languages.push(language);
|
|
450
|
+
if (!languages.has(languageKey(term))) languages.set(languageKey(term), languageOf(term));
|
|
400
451
|
}
|
|
401
452
|
const header = [
|
|
402
453
|
"ID",
|
|
403
|
-
...languages.flatMap((language) => LANGUAGE_COLUMNS.map(([, name]) => `${name} [${language}]`)),
|
|
454
|
+
...[...languages.values()].flatMap((language) => LANGUAGE_COLUMNS.map(([, name]) => `${name} [${language}]`)),
|
|
404
455
|
...NEUTRAL_COLUMNS.map(([, name]) => name)
|
|
405
456
|
];
|
|
406
|
-
const
|
|
407
|
-
|
|
457
|
+
const conflicts = [];
|
|
458
|
+
const rows = rowsOf(terms).map((row) => {
|
|
459
|
+
const [first] = row;
|
|
460
|
+
const id = first?.id ?? "";
|
|
461
|
+
const neutral = mergeFirst(
|
|
462
|
+
id,
|
|
463
|
+
row.map((t) => Object.fromEntries(NEUTRAL_COLUMNS.map(([field]) => [field, t.record[field]])))
|
|
464
|
+
);
|
|
465
|
+
conflicts.push(...neutral.conflicts);
|
|
408
466
|
return [
|
|
409
|
-
|
|
410
|
-
...languages.flatMap(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
467
|
+
id,
|
|
468
|
+
...[...languages.keys()].flatMap((language) => {
|
|
469
|
+
const own = row.find((t) => languageKey(t) === language);
|
|
470
|
+
return LANGUAGE_COLUMNS.map(([field]) => own === void 0 ? "" : fieldText(own.record, field));
|
|
471
|
+
}),
|
|
472
|
+
...NEUTRAL_COLUMNS.map(([field]) => fieldText(neutral.merged, field))
|
|
414
473
|
];
|
|
415
474
|
});
|
|
416
475
|
const content = [header, ...rows].map((row) => `${row.map(cell).join(",")}
|
|
@@ -418,8 +477,9 @@ var csvWriter = {
|
|
|
418
477
|
return {
|
|
419
478
|
files: [{ path: target.path, content }],
|
|
420
479
|
removals: [],
|
|
421
|
-
dropped: droppedFields(terms,
|
|
422
|
-
skipped: []
|
|
480
|
+
dropped: droppedFields(terms, HOLDS),
|
|
481
|
+
skipped: [],
|
|
482
|
+
...conflicts.length === 0 ? {} : { conflicts }
|
|
423
483
|
};
|
|
424
484
|
}
|
|
425
485
|
};
|
|
@@ -431,7 +491,7 @@ var jsonWriter = {
|
|
|
431
491
|
holds: (_shape) => TERM_FIELDS,
|
|
432
492
|
render(terms, target) {
|
|
433
493
|
requireShape("json", target, "file");
|
|
434
|
-
const
|
|
494
|
+
const entries2 = terms.map((term) => {
|
|
435
495
|
const entry = { id: term.id };
|
|
436
496
|
if (term.language !== void 0) entry["language"] = term.language;
|
|
437
497
|
for (const field of TERM_FIELDS) {
|
|
@@ -440,7 +500,7 @@ var jsonWriter = {
|
|
|
440
500
|
}
|
|
441
501
|
return entry;
|
|
442
502
|
});
|
|
443
|
-
const content = `${JSON.stringify({ terms:
|
|
503
|
+
const content = `${JSON.stringify({ terms: entries2 }, null, 2)}
|
|
444
504
|
`;
|
|
445
505
|
return {
|
|
446
506
|
files: [{ path: target.path, content }],
|
|
@@ -452,7 +512,7 @@ var jsonWriter = {
|
|
|
452
512
|
};
|
|
453
513
|
|
|
454
514
|
// src/term/core/writers/skos.ts
|
|
455
|
-
var
|
|
515
|
+
var HOLDS2 = [
|
|
456
516
|
"label",
|
|
457
517
|
"definition",
|
|
458
518
|
"alt-labels",
|
|
@@ -511,7 +571,7 @@ function concept(terms, term) {
|
|
|
511
571
|
var skosWriter = {
|
|
512
572
|
format: "skos",
|
|
513
573
|
shapes: ["file"],
|
|
514
|
-
holds: (_shape) =>
|
|
574
|
+
holds: (_shape) => HOLDS2,
|
|
515
575
|
render(terms, target) {
|
|
516
576
|
requireShape("skos", target, "file");
|
|
517
577
|
const document = {
|
|
@@ -530,82 +590,140 @@ var skosWriter = {
|
|
|
530
590
|
return {
|
|
531
591
|
files: [{ path: target.path, content }],
|
|
532
592
|
removals: [],
|
|
533
|
-
dropped: droppedFields(terms,
|
|
593
|
+
dropped: droppedFields(terms, HOLDS2),
|
|
534
594
|
skipped: []
|
|
535
595
|
};
|
|
536
596
|
}
|
|
537
597
|
};
|
|
538
598
|
|
|
539
599
|
// src/term/core/writers/tbx.ts
|
|
540
|
-
var
|
|
541
|
-
|
|
542
|
-
|
|
600
|
+
var NOT_HELD = ["abstract", "broader", "narrower", "related-terms", "see", "scope-note"];
|
|
601
|
+
var HOLDS3 = TERM_FIELDS.filter((field) => !NOT_HELD.includes(field));
|
|
602
|
+
var LINGUIST_FIELDS = ["register", "reading", "reading-note", "grammatical-number", "transfer-comments"];
|
|
603
|
+
var ENTRY_INDENT = " ";
|
|
604
|
+
var OWN_HEADER = [" <fileDesc>", " <sourceDesc>", " <p>manni term write</p>", " </sourceDesc>", " </fileDesc>"];
|
|
605
|
+
function isLinguist(terms) {
|
|
606
|
+
return terms.some((t) => (t.record.designations ?? []).some((d) => LINGUIST_FIELDS.some((f) => d[f] !== void 0)));
|
|
607
|
+
}
|
|
608
|
+
function soleSource(terms) {
|
|
609
|
+
let found;
|
|
610
|
+
for (const term of terms) {
|
|
611
|
+
const source = tbxSourceOf(term);
|
|
612
|
+
if (source === void 0 || found !== void 0 && found.document !== source.document) return void 0;
|
|
613
|
+
found ??= { document: source.document, file: term.location.file };
|
|
614
|
+
}
|
|
615
|
+
return found?.document.body === void 0 ? void 0 : found;
|
|
543
616
|
}
|
|
544
|
-
function
|
|
545
|
-
|
|
617
|
+
function tbxHeaderFiles(terms) {
|
|
618
|
+
const files = /* @__PURE__ */ new Map();
|
|
619
|
+
for (const term of terms) {
|
|
620
|
+
const source = tbxSourceOf(term);
|
|
621
|
+
if (source !== void 0 && !files.has(source.document)) files.set(source.document, term.location.file);
|
|
622
|
+
}
|
|
623
|
+
return [...files.values()];
|
|
624
|
+
}
|
|
625
|
+
function carried(document, span, indent) {
|
|
626
|
+
if (span === void 0) return void 0;
|
|
627
|
+
const raw = lf(document.content.slice(span.start, span.end));
|
|
628
|
+
if (raw.trim() === "") return void 0;
|
|
629
|
+
const lines = raw.replace(/^(?:[ \t]*\n)+/, "").replace(/(?:\n[ \t]*)+$/, "").split("\n");
|
|
630
|
+
const blank = (line) => line.trim() === "";
|
|
631
|
+
const strip = Math.min(...lines.filter((line) => !blank(line)).map((line) => /^[ \t]*/.exec(line)?.[0].length ?? 0));
|
|
632
|
+
return lines.map((line) => blank(line) ? "" : `${indent}${line.slice(strip).trimEnd()}`);
|
|
633
|
+
}
|
|
634
|
+
function carriedBack(document, version) {
|
|
635
|
+
if (document.back === void 0) return [];
|
|
636
|
+
const [from, to] = version === 3 ? ["refObjectList", "refObjectSec"] : ["refObjectSec", "refObjectList"];
|
|
637
|
+
const rename = new RegExp(`(</?)${from}(?=[\\s/>])`, "g");
|
|
638
|
+
const lines = carried(document, document.back, " ")?.map((line) => line.replace(rename, `$1${to}`));
|
|
639
|
+
return lines === void 0 ? [" <back/>"] : [" <back>", ...lines, " </back>"];
|
|
640
|
+
}
|
|
641
|
+
function entries(terms, version) {
|
|
642
|
+
const lines = [];
|
|
643
|
+
const conflicts = [];
|
|
644
|
+
for (const group of conceptGroups(terms)) {
|
|
645
|
+
const [head, ...rest] = group;
|
|
646
|
+
if (head === void 0) continue;
|
|
647
|
+
const merge = mergeFirst(
|
|
648
|
+
head.id,
|
|
649
|
+
group.map((t) => t.record["concept-entry"]),
|
|
650
|
+
"concept-entry."
|
|
651
|
+
);
|
|
652
|
+
conflicts.push(...merge.conflicts);
|
|
653
|
+
const { "concept-entry": _concept, ...record } = head.record;
|
|
654
|
+
const joined = {
|
|
655
|
+
...head,
|
|
656
|
+
record: Object.keys(merge.merged).length === 0 ? record : { ...record, "concept-entry": merge.merged }
|
|
657
|
+
};
|
|
658
|
+
const text = tbxEntryLines([joined, ...rest], { version, style: "dca" }).join("\n");
|
|
659
|
+
lines.push(`${ENTRY_INDENT}${reindent(text, ENTRY_INDENT, "\n")}`);
|
|
660
|
+
}
|
|
661
|
+
return { lines, conflicts };
|
|
546
662
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
" </tig>"
|
|
553
|
-
];
|
|
663
|
+
function rootOpen(version, terms) {
|
|
664
|
+
const language = xmlAttribute(terms[0]?.language ?? DEFAULT_LANGUAGE);
|
|
665
|
+
if (version === 2) return `<martif type="TBX" xml:lang="${language}">`;
|
|
666
|
+
const type = isLinguist(terms) ? "TBX-Linguist" : "TBX-Basic";
|
|
667
|
+
return `<tbx type="${type}" style="dca" xml:lang="${language}" xmlns="${TBX_V3_NAMESPACE}">`;
|
|
554
668
|
}
|
|
555
|
-
function
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
669
|
+
function tbxWriterFor(format, version) {
|
|
670
|
+
return {
|
|
671
|
+
format,
|
|
672
|
+
shapes: ["file"],
|
|
673
|
+
holds: (_shape) => HOLDS3,
|
|
674
|
+
render(terms, target) {
|
|
675
|
+
requireShape(format, target, "file");
|
|
676
|
+
const dropped = droppedFields(terms, HOLDS3);
|
|
677
|
+
const source = soleSource(terms);
|
|
678
|
+
if (source?.document.version === version) {
|
|
679
|
+
const exported = exportTbxSource(source.document, source.file, terms);
|
|
680
|
+
return {
|
|
681
|
+
files: [{ path: target.path, content: exported.content }],
|
|
682
|
+
removals: [],
|
|
683
|
+
dropped,
|
|
684
|
+
skipped: [],
|
|
685
|
+
...exported.conflicts.length === 0 ? {} : { conflicts: exported.conflicts },
|
|
686
|
+
droppedHeaders: []
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
const header = (source === void 0 ? void 0 : carried(source.document, source.document.header, " ")) ?? OWN_HEADER;
|
|
690
|
+
const [root, headerTag] = version === 2 ? ["martif", "martifHeader"] : ["tbx", "tbxHeader"];
|
|
691
|
+
const body = entries(terms, version);
|
|
692
|
+
const lines = [
|
|
693
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
694
|
+
rootOpen(version, terms),
|
|
695
|
+
` <${headerTag}>`,
|
|
696
|
+
...header,
|
|
697
|
+
` </${headerTag}>`,
|
|
698
|
+
" <text>",
|
|
699
|
+
" <body>",
|
|
700
|
+
...body.lines,
|
|
701
|
+
" </body>",
|
|
702
|
+
...source === void 0 ? [] : carriedBack(source.document, version),
|
|
703
|
+
" </text>",
|
|
704
|
+
`</${root}>`
|
|
705
|
+
];
|
|
706
|
+
return {
|
|
707
|
+
files: [{ path: target.path, content: lines.map((line) => `${line}
|
|
708
|
+
`).join("") }],
|
|
709
|
+
removals: [],
|
|
710
|
+
dropped,
|
|
711
|
+
skipped: [],
|
|
712
|
+
...body.conflicts.length === 0 ? {} : { conflicts: body.conflicts },
|
|
713
|
+
droppedHeaders: source === void 0 ? tbxHeaderFiles(terms) : []
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
};
|
|
567
717
|
}
|
|
568
|
-
var tbxWriter =
|
|
569
|
-
|
|
570
|
-
shapes: ["file"],
|
|
571
|
-
holds: (_shape) => HOLDS2,
|
|
572
|
-
render(terms, target) {
|
|
573
|
-
requireShape("tbx", target, "file");
|
|
574
|
-
const language = terms[0]?.language ?? DEFAULT_LANGUAGE;
|
|
575
|
-
const lines = [
|
|
576
|
-
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
577
|
-
`<martif type="TBX" xml:lang="${attribute(language)}">`,
|
|
578
|
-
" <martifHeader>",
|
|
579
|
-
" <fileDesc>",
|
|
580
|
-
" <sourceDesc>",
|
|
581
|
-
" <p>manni term write</p>",
|
|
582
|
-
" </sourceDesc>",
|
|
583
|
-
" </fileDesc>",
|
|
584
|
-
" </martifHeader>",
|
|
585
|
-
" <text>",
|
|
586
|
-
" <body>",
|
|
587
|
-
...terms.flatMap(termEntry),
|
|
588
|
-
" </body>",
|
|
589
|
-
" </text>",
|
|
590
|
-
"</martif>"
|
|
591
|
-
];
|
|
592
|
-
const content = lines.map((line) => `${line}
|
|
593
|
-
`).join("");
|
|
594
|
-
return {
|
|
595
|
-
files: [{ path: target.path, content }],
|
|
596
|
-
removals: [],
|
|
597
|
-
dropped: droppedFields(terms, HOLDS2),
|
|
598
|
-
skipped: []
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
};
|
|
718
|
+
var tbxWriter = tbxWriterFor("tbx", 2);
|
|
719
|
+
var tbx3Writer = tbxWriterFor("tbx3", 3);
|
|
602
720
|
|
|
603
721
|
// src/term/core/writers/vale.ts
|
|
604
722
|
import { isAbsolute, join as join2, relative, sep } from "node:path";
|
|
605
723
|
import { stringify } from "yaml";
|
|
606
724
|
var VALE_MARKER = "# Generated by manni term write. Edit the terms, not this file.";
|
|
607
725
|
var STYLE = "Terms";
|
|
608
|
-
var
|
|
726
|
+
var HOLDS4 = ["label", "alt-labels", "hidden-labels"];
|
|
609
727
|
var OWN_FILES = ["Casing", "Lowercase", "SentenceStart", "Deprecated"];
|
|
610
728
|
var REGEX_METACHARACTERS = /[\\^$.|?*+()[\]{}]/g;
|
|
611
729
|
function escapeRegex(value) {
|
|
@@ -656,8 +774,8 @@ var Swaps = class {
|
|
|
656
774
|
}
|
|
657
775
|
};
|
|
658
776
|
var ASCII_WORD = /^[A-Za-z0-9_]$/;
|
|
659
|
-
function bounded(pattern,
|
|
660
|
-
const chars = Array.from(
|
|
777
|
+
function bounded(pattern, text) {
|
|
778
|
+
const chars = Array.from(text);
|
|
661
779
|
const edge = (char) => char !== void 0 && ASCII_WORD.test(char) ? "\\b" : "\\B";
|
|
662
780
|
return `${edge(chars[0])}${pattern}${edge(chars.at(-1))}`;
|
|
663
781
|
}
|
|
@@ -698,7 +816,7 @@ function firstLine(content) {
|
|
|
698
816
|
var valeWriter = {
|
|
699
817
|
format: "vale",
|
|
700
818
|
shapes: ["directory"],
|
|
701
|
-
holds: (_shape) =>
|
|
819
|
+
holds: (_shape) => HOLDS4,
|
|
702
820
|
render(terms, target, context) {
|
|
703
821
|
requireShape("vale", target, "directory");
|
|
704
822
|
const termsDir = join2(target.path, STYLE);
|
|
@@ -776,12 +894,12 @@ var valeWriter = {
|
|
|
776
894
|
for (const acronym of acronyms) add(acronym.name, acronym.content);
|
|
777
895
|
const produced = new Set(files.map((f) => relative(termsDir, f.path).toLowerCase()));
|
|
778
896
|
const removals = marked.filter((path) => !produced.has(relative(termsDir, path).toLowerCase())).sort();
|
|
779
|
-
return { files, removals, dropped: droppedFields(terms,
|
|
897
|
+
return { files, removals, dropped: droppedFields(terms, HOLDS4), skipped: [] };
|
|
780
898
|
}
|
|
781
899
|
};
|
|
782
900
|
|
|
783
901
|
// src/term/core/writers/interchange.ts
|
|
784
|
-
var INTERCHANGE_WRITERS = [tbxWriter, skosWriter, csvWriter, jsonWriter, valeWriter];
|
|
902
|
+
var INTERCHANGE_WRITERS = [tbxWriter, tbx3Writer, skosWriter, csvWriter, jsonWriter, valeWriter];
|
|
785
903
|
|
|
786
904
|
// src/term/core/writers/index.ts
|
|
787
905
|
var TERM_WRITERS = [...DOCUMENT_WRITERS, ...INTERCHANGE_WRITERS];
|
|
@@ -798,7 +916,8 @@ var DOCUMENT_RENDERS = {
|
|
|
798
916
|
docbook: { input: "xml", shapes: { file: "docbook-glossary" } }
|
|
799
917
|
};
|
|
800
918
|
var INTERCHANGE_LABELS = {
|
|
801
|
-
tbx: "TBX v2
|
|
919
|
+
tbx: "TBX v2",
|
|
920
|
+
tbx3: "TBX v3",
|
|
802
921
|
skos: "JSON-LD",
|
|
803
922
|
vale: "style"
|
|
804
923
|
};
|
|
@@ -869,7 +988,7 @@ function closestName(query, names) {
|
|
|
869
988
|
async function runGet(opts) {
|
|
870
989
|
const { set } = await loadTerms(opts);
|
|
871
990
|
const found = findTerm(set.terms, opts.term);
|
|
872
|
-
if (found !== void 0) return found;
|
|
991
|
+
if (found !== void 0) return { term: found, others: set.terms.filter((t) => t.id === found.id && t !== found) };
|
|
873
992
|
const nearest = closestName(
|
|
874
993
|
opts.term,
|
|
875
994
|
set.terms.flatMap((t) => [t.id, t.record.label])
|
|
@@ -992,9 +1111,9 @@ async function valeLsConfig(opts, spawn = spawnVale) {
|
|
|
992
1111
|
"vale is not on PATH. Install Vale, or pass -o <styles directory>."
|
|
993
1112
|
);
|
|
994
1113
|
if (result.code !== 0) {
|
|
995
|
-
const
|
|
996
|
-
if (NO_CONFIG.test(
|
|
997
|
-
throw new TermError(`vale could not resolve its configuration: ${
|
|
1114
|
+
const text = failureText(result);
|
|
1115
|
+
if (NO_CONFIG.test(text)) return null;
|
|
1116
|
+
throw new TermError(`vale could not resolve its configuration: ${text}`);
|
|
998
1117
|
}
|
|
999
1118
|
const parsed = parseJson(result.stdout, "a configuration");
|
|
1000
1119
|
if (!isMapping(parsed)) throw new TermError("vale printed a configuration that is not a JSON object.");
|
|
@@ -1138,13 +1257,13 @@ function isDirectory(path) {
|
|
|
1138
1257
|
}
|
|
1139
1258
|
var MAX_EXISTING_FILE_BYTES = 1024 * 1024;
|
|
1140
1259
|
async function filesUnder(dir, into) {
|
|
1141
|
-
let
|
|
1260
|
+
let entries2;
|
|
1142
1261
|
try {
|
|
1143
|
-
|
|
1262
|
+
entries2 = await readdir(dir, { withFileTypes: true });
|
|
1144
1263
|
} catch {
|
|
1145
1264
|
return;
|
|
1146
1265
|
}
|
|
1147
|
-
for (const entry of
|
|
1266
|
+
for (const entry of entries2) {
|
|
1148
1267
|
const path = join4(dir, entry.name);
|
|
1149
1268
|
if (entry.isDirectory()) await filesUnder(path, into);
|
|
1150
1269
|
else if (entry.isFile()) {
|
|
@@ -1259,6 +1378,10 @@ async function runWrite(opts) {
|
|
|
1259
1378
|
dropped: format === "vale" ? [] : render.dropped,
|
|
1260
1379
|
droppedFrom: droppedFrom(format, shape, readers),
|
|
1261
1380
|
skipped: render.skipped,
|
|
1381
|
+
...render.otherLanguages === void 0 ? {} : { otherLanguages: render.otherLanguages },
|
|
1382
|
+
...render.conflicts === void 0 ? {} : { conflicts: render.conflicts },
|
|
1383
|
+
// A Vale style is not a termbase, so a header it does not hold is not news either.
|
|
1384
|
+
...format === "vale" ? {} : { droppedHeaders: render.droppedHeaders ?? tbxHeaderFiles(set.terms) },
|
|
1262
1385
|
check,
|
|
1263
1386
|
dryRun,
|
|
1264
1387
|
...wiring === void 0 ? {} : { wiring }
|
|
@@ -1268,6 +1391,7 @@ function inputFor(content, path, construct, file) {
|
|
|
1268
1391
|
if (construct === "manifest") {
|
|
1269
1392
|
return { content, file, path, format: MANIFEST_FORMAT, metadata: {}, lineFor: () => void 0 };
|
|
1270
1393
|
}
|
|
1394
|
+
if (construct === "tbx-entry") return tbxInput(content, file, path);
|
|
1271
1395
|
const extractor = extractorForExtension(extname(path));
|
|
1272
1396
|
if (extractor === void 0) throw new TermError(`${file}: no reader for its extension.`);
|
|
1273
1397
|
return extractInput(content, file, path, extractor.name);
|
|
@@ -1280,14 +1404,14 @@ function carryRecords(current, edited) {
|
|
|
1280
1404
|
return match?.id === entry.id ? { ...entry, record: match.record } : entry;
|
|
1281
1405
|
});
|
|
1282
1406
|
}
|
|
1283
|
-
function applyInPlace(original, path, file, constructs, readers) {
|
|
1407
|
+
function applyInPlace(original, path, file, constructs, readers, conflicts) {
|
|
1284
1408
|
let content = original;
|
|
1285
1409
|
let first = true;
|
|
1286
1410
|
for (const [construct, terms] of constructs) {
|
|
1287
1411
|
const reader = readerForConstruct(construct, readers);
|
|
1288
1412
|
if (reader?.apply === void 0) continue;
|
|
1289
1413
|
const input = inputFor(content, path, construct, file);
|
|
1290
|
-
content = reader.apply(input, first ? terms : carryRecords(reader.read(input).terms, terms));
|
|
1414
|
+
content = reader.apply(input, first ? terms : carryRecords(reader.read(input).terms, terms), conflicts);
|
|
1291
1415
|
first = false;
|
|
1292
1416
|
}
|
|
1293
1417
|
return content;
|
|
@@ -1314,6 +1438,7 @@ async function writeInPlace(opts, check, dryRun) {
|
|
|
1314
1438
|
}
|
|
1315
1439
|
const files = [];
|
|
1316
1440
|
const existing = /* @__PURE__ */ new Map();
|
|
1441
|
+
const conflicts = [];
|
|
1317
1442
|
for (const [path, { file, constructs }] of byPath) {
|
|
1318
1443
|
let original;
|
|
1319
1444
|
try {
|
|
@@ -1322,7 +1447,7 @@ async function writeInPlace(opts, check, dryRun) {
|
|
|
1322
1447
|
throw new TermError(`${file}: could not be read: ${errorMessage(error)}`);
|
|
1323
1448
|
}
|
|
1324
1449
|
existing.set(path, original);
|
|
1325
|
-
files.push({ path, content: applyInPlace(original, path, file, constructs, readers) });
|
|
1450
|
+
files.push({ path, content: applyInPlace(original, path, file, constructs, readers, conflicts) });
|
|
1326
1451
|
}
|
|
1327
1452
|
const changes = await applyChanges(files, [], existing, cwd, !check && !dryRun);
|
|
1328
1453
|
return {
|
|
@@ -1332,6 +1457,7 @@ async function writeInPlace(opts, check, dryRun) {
|
|
|
1332
1457
|
files: files.map((f) => ({ path: displayPath(f.path, cwd), content: f.content })),
|
|
1333
1458
|
dropped: [],
|
|
1334
1459
|
skipped: [],
|
|
1460
|
+
...conflicts.length === 0 ? {} : { conflicts },
|
|
1335
1461
|
check,
|
|
1336
1462
|
dryRun
|
|
1337
1463
|
};
|
|
@@ -1344,12 +1470,13 @@ function cell2(value) {
|
|
|
1344
1470
|
}
|
|
1345
1471
|
function renderListCsv(terms) {
|
|
1346
1472
|
const rows = [
|
|
1347
|
-
["id", "label", "alt-labels", "abstract"],
|
|
1473
|
+
["id", "label", "alt-labels", "abstract", "language"],
|
|
1348
1474
|
...terms.map((t) => [
|
|
1349
1475
|
t.id,
|
|
1350
1476
|
t.record.label,
|
|
1351
1477
|
(t.record["alt-labels"] ?? []).join(LIST_SEPARATOR2),
|
|
1352
|
-
t.record.abstract ?? ""
|
|
1478
|
+
t.record.abstract ?? "",
|
|
1479
|
+
t.language ?? ""
|
|
1353
1480
|
])
|
|
1354
1481
|
];
|
|
1355
1482
|
return rows.map((row) => row.map(cell2).join(",")).join("\n");
|
|
@@ -1440,30 +1567,30 @@ async function coreOptions(paths, options) {
|
|
|
1440
1567
|
function withInputs(command) {
|
|
1441
1568
|
return command.option("--as <format>", "input format for stdin (-)").option("--ext <list>", "comma-separated extensions for directory walks").option("--exclude <glob>", "glob to exclude; repeatable", collect, []).option("--collection <name>", "configured collection to read; repeatable", collect, []).option("--allow-empty", "treat a missing path, no matched files or no terms as success").option("--no-gitignore", "read files .gitignore covers").option("-c, --config <path>", "path to a manni config file").option("--no-color", "disable colored output");
|
|
1442
1569
|
}
|
|
1443
|
-
function print(
|
|
1444
|
-
process.stdout.write(`${
|
|
1570
|
+
function print(text) {
|
|
1571
|
+
process.stdout.write(`${text}
|
|
1445
1572
|
`);
|
|
1446
1573
|
}
|
|
1447
1574
|
function renderFindings(report, format, options, references2) {
|
|
1448
|
-
let
|
|
1575
|
+
let text;
|
|
1449
1576
|
switch (format) {
|
|
1450
1577
|
case "pretty":
|
|
1451
|
-
|
|
1578
|
+
text = renderFindingsPretty(report, { color: colorFor(options), references: references2 });
|
|
1452
1579
|
break;
|
|
1453
1580
|
case "json":
|
|
1454
|
-
|
|
1581
|
+
text = renderFindingsJson(report);
|
|
1455
1582
|
break;
|
|
1456
1583
|
case "github":
|
|
1457
|
-
|
|
1584
|
+
text = renderFindingsGithub(report);
|
|
1458
1585
|
break;
|
|
1459
1586
|
case "sarif":
|
|
1460
|
-
|
|
1587
|
+
text = renderFindingsSarif(report, { onNotice: notice });
|
|
1461
1588
|
break;
|
|
1462
1589
|
case "junit":
|
|
1463
|
-
|
|
1590
|
+
text = renderFindingsJunit(report);
|
|
1464
1591
|
break;
|
|
1465
1592
|
}
|
|
1466
|
-
if (
|
|
1593
|
+
if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) print(text);
|
|
1467
1594
|
process.exitCode = report.summary.failed > 0 ? 1 : 0;
|
|
1468
1595
|
}
|
|
1469
1596
|
function buildProgram() {
|
|
@@ -1499,7 +1626,9 @@ function buildProgram() {
|
|
|
1499
1626
|
try {
|
|
1500
1627
|
const format = formatChoice(options.format, GET_FORMATS);
|
|
1501
1628
|
const found = await runGet({ ...await coreOptions(paths, options), term });
|
|
1502
|
-
print(
|
|
1629
|
+
print(
|
|
1630
|
+
format === "json" ? renderGetJson(found.term) : renderGetPretty(found.term, { color: colorFor(options), others: found.others })
|
|
1631
|
+
);
|
|
1503
1632
|
process.exitCode = 0;
|
|
1504
1633
|
} catch (err) {
|
|
1505
1634
|
fail(err);
|
|
@@ -1588,4 +1717,4 @@ export {
|
|
|
1588
1717
|
TermError,
|
|
1589
1718
|
buildProgram
|
|
1590
1719
|
};
|
|
1591
|
-
//# sourceMappingURL=term-
|
|
1720
|
+
//# sourceMappingURL=term-DL3YFL43.js.map
|