@heroiclands/package-build 8.1.0 → 10.0.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.
Files changed (122) hide show
  1. package/CHANGELOG.md +748 -0
  2. package/CONTENT.md +273 -13
  3. package/bin/content-build.mjs +479 -123
  4. package/bin/package-build.mjs +27 -69
  5. package/bin/report.mjs +1 -2
  6. package/bundle.mjs +2 -10
  7. package/config.mjs +31 -106
  8. package/container.mjs +13 -57
  9. package/content-config.mjs +300 -188
  10. package/coverage.mjs +14 -55
  11. package/deploy.mjs +4 -13
  12. package/docs/content-format.md +1418 -0
  13. package/e2e.mjs +16 -55
  14. package/engine/address-charset.mjs +62 -0
  15. package/engine/address-diff.mjs +1 -4
  16. package/engine/alias-index.mjs +153 -0
  17. package/engine/base-compiler.mjs +203 -31
  18. package/engine/code-fences.mjs +4 -13
  19. package/engine/compendiums.mjs +13 -37
  20. package/engine/content-address.mjs +6 -10
  21. package/engine/content-format-check.mjs +570 -0
  22. package/engine/content-format.mjs +253 -0
  23. package/engine/content-links.mjs +144 -99
  24. package/engine/content-lint.mjs +12 -16
  25. package/engine/content-slug.mjs +2 -6
  26. package/engine/content-tables.mjs +26 -79
  27. package/engine/diagnostics.mjs +37 -15
  28. package/engine/document-subtypes.mjs +440 -0
  29. package/engine/field-reference.mjs +6 -20
  30. package/engine/field-spec.mjs +49 -45
  31. package/engine/foreign-catalog.mjs +7 -22
  32. package/engine/foreign-manifests.mjs +1 -4
  33. package/engine/frontmatter-lint.mjs +347 -43
  34. package/engine/frontmatter.mjs +3 -8
  35. package/engine/generate.mjs +36 -20
  36. package/engine/helpers.mjs +54 -81
  37. package/engine/homepage.mjs +4 -15
  38. package/engine/ids.mjs +21 -12
  39. package/engine/index.mjs +15 -0
  40. package/engine/item-registry.mjs +72 -9
  41. package/engine/journals.mjs +4 -14
  42. package/engine/kb-manifest.mjs +41 -24
  43. package/engine/macros.mjs +2 -10
  44. package/engine/manifest-emit.mjs +6 -17
  45. package/engine/map-notes.mjs +53 -87
  46. package/engine/note-claims.mjs +383 -0
  47. package/engine/note-package.mjs +1 -4
  48. package/engine/note-vocabulary.mjs +678 -0
  49. package/engine/pack-config.mjs +56 -60
  50. package/engine/pack-router.mjs +18 -8
  51. package/engine/prose-config.mjs +20 -4
  52. package/engine/prose-lint.mjs +61 -17
  53. package/engine/region-events.mjs +1 -3
  54. package/engine/retired-fields.mjs +117 -3
  55. package/engine/scene-levels.mjs +8 -22
  56. package/engine/scenes.mjs +31 -47
  57. package/engine/schema-check.mjs +348 -7
  58. package/engine/schema-extract.mjs +11 -39
  59. package/engine/site-build.mjs +13 -38
  60. package/engine/site-index.mjs +40 -35
  61. package/engine/system-block.mjs +513 -0
  62. package/engine/web-wikilinks.mjs +115 -92
  63. package/engine/wikilink-syntax.mjs +30 -0
  64. package/engine/wikilinks.mjs +147 -183
  65. package/index.mjs +1 -5
  66. package/lang.mjs +1 -3
  67. package/manifest.mjs +10 -37
  68. package/markdownlint-config.mjs +1 -5
  69. package/package.json +6 -2
  70. package/sohl/actors.mjs +251 -68
  71. package/sohl/being-info.mjs +3 -6
  72. package/sohl/document-subtypes.mjs +82 -0
  73. package/sohl/index.mjs +4 -6
  74. package/sohl/item-builders.mjs +1 -3
  75. package/sohl/item-fields.mjs +16 -34
  76. package/sohl/items.mjs +111 -17
  77. package/sohl/kb-passes.mjs +29 -39
  78. package/sohl/note-schemas.mjs +11 -7
  79. package/sohl/skill-base.mjs +7 -23
  80. package/stage.mjs +3 -13
  81. package/templates.mjs +4 -15
  82. package/types/bundle.d.mts +1 -1
  83. package/types/container.d.mts +2 -2
  84. package/types/content-config.d.mts +48 -4
  85. package/types/coverage.d.mts +1 -1
  86. package/types/e2e.d.mts +4 -4
  87. package/types/engine/address-charset.d.mts +45 -0
  88. package/types/engine/alias-index.d.mts +122 -0
  89. package/types/engine/base-compiler.d.mts +132 -4
  90. package/types/engine/content-address.d.mts +2 -2
  91. package/types/engine/content-format-check.d.mts +163 -0
  92. package/types/engine/content-format.d.mts +101 -0
  93. package/types/engine/content-links.d.mts +16 -1
  94. package/types/engine/content-lint.d.mts +6 -0
  95. package/types/engine/diagnostics.d.mts +29 -0
  96. package/types/engine/document-subtypes.d.mts +233 -0
  97. package/types/engine/field-spec.d.mts +76 -23
  98. package/types/engine/frontmatter-lint.d.mts +47 -2
  99. package/types/engine/generate.d.mts +15 -2
  100. package/types/engine/helpers.d.mts +22 -14
  101. package/types/engine/ids.d.mts +10 -0
  102. package/types/engine/index.d.mts +5 -0
  103. package/types/engine/item-registry.d.mts +21 -2
  104. package/types/engine/kb-manifest.d.mts +35 -8
  105. package/types/engine/map-notes.d.mts +21 -11
  106. package/types/engine/note-claims.d.mts +113 -0
  107. package/types/engine/note-vocabulary.d.mts +251 -0
  108. package/types/engine/pack-config.d.mts +4 -3
  109. package/types/engine/pack-router.d.mts +4 -4
  110. package/types/engine/prose-lint.d.mts +6 -2
  111. package/types/engine/retired-fields.d.mts +73 -2
  112. package/types/engine/schema-check.d.mts +182 -0
  113. package/types/engine/schema-extract.d.mts +1 -1
  114. package/types/engine/site-index.d.mts +1 -1
  115. package/types/engine/system-block.d.mts +281 -0
  116. package/types/engine/web-wikilinks.d.mts +23 -12
  117. package/types/engine/wikilink-syntax.d.mts +29 -0
  118. package/types/manifest.d.mts +1 -1
  119. package/types/sohl/actors.d.mts +62 -6
  120. package/types/sohl/document-subtypes.d.mts +14 -0
  121. package/types/sohl/index.d.mts +1 -0
  122. package/types/sohl/items.d.mts +21 -0
@@ -10,14 +10,27 @@
10
10
  * order among packs of one type — and every one of them is written before the
11
11
  * actors pass that reads them.
12
12
  *
13
+ * **Scoped to one system when the caller has one (#58).** A being addresses an
14
+ * item by `(type, shortcode)`, and that address is unique within one system and
15
+ * not across two: `skill:sword` is an HM3 skill *and* a SoHL skill, with
16
+ * different data models behind them. The reference itself is unambiguous — it
17
+ * sits inside a system block, so position says which it means — but the
18
+ * resolver has to know which catalogue it is searching, or it resolves the pair
19
+ * by whichever pack was read first. So an Actor pass reads the Item packs of
20
+ * **its own** system plus the system-neutral ones, which belong to every
21
+ * system. Asking for no system reads them all, which is every single-system
22
+ * build and the behaviour this always had.
23
+ *
13
24
  * @param {object} [config] - The resolved build configuration. Defaults to this
14
25
  * repository's.
26
+ * @param {string|null} [system] - The system whose catalogue is wanted. Omitted
27
+ * or `null`, every Item pack is read.
15
28
  * @returns {string[]} Each Item pack's JSON directory. Empty when the
16
29
  * repository ships no items at all, which is a legitimate package: the actors
17
30
  * pass accepts an empty list and reports an item it cannot resolve per
18
31
  * `(type, shortcode)` instead, naming the being (#49).
19
32
  */
20
- export function itemPackJsonDirs(config?: object): string[];
33
+ export function itemPackJsonDirs(config?: object, system?: string | null): string[];
21
34
  /**
22
35
  * The passes to run, ordered so that each one follows the output it reads.
23
36
  *
@@ -98,7 +111,7 @@ export function emptyPassErrors(passes: Array<{
98
111
  * @throws {Error} If the configured Foundry package id has drifted from the
99
112
  * shipped manifest's `id` (see `package-manifest.mjs`).
100
113
  */
101
- export function generatePacksJson({ only, config, }?: {
114
+ export function generatePacksJson({ only, config }?: {
102
115
  only?: string | undefined;
103
116
  config?: object | undefined;
104
117
  }): Promise<number>;
@@ -62,8 +62,8 @@ export function walkMarkdownTree(rootDir: string, { skipDirectories }?: {
62
62
  }, void, unknown>;
63
63
  /**
64
64
  * Resolve the required `sohl.archetype` frontmatter for an Item/Actor entry
65
- * (see the archetype contract, #604 — `flags.sohl.docArchetype`). The property
66
- * is a nullable number that authors must state explicitly:
65
+ * (the archetype contract, #604). The property is a nullable number that
66
+ * authors must state explicitly:
67
67
  * - a number → the document is an archetype of that priority.
68
68
  * - `null` → the document is not an archetype.
69
69
  * - absent → an authoring error (throws), so "not an archetype" is never
@@ -79,19 +79,27 @@ export function walkMarkdownTree(rootDir: string, { skipDirectories }?: {
79
79
  */
80
80
  export function resolveArchetype(fm: object, label: string): number | undefined;
81
81
  /**
82
- * Merge the required `sohl.archetype` frontmatter into a document's `flags`,
83
- * returning a new object (the input is never mutated). A numeric archetype
84
- * seeds `flags.sohl.docArchetype`; `null` omits the flag (and clears any stale
85
- * `docArchetype` while preserving sibling `sohl` flags); an absent value
86
- * throws. See {@link resolveArchetype}.
87
- *
88
- * @param {object} fm Parsed frontmatter.
89
- * @param {object} [flags] The entry's existing flags (e.g. `fm.flags`).
90
- * @param {string} label Human-readable context for error messages.
91
- * @returns {object} The flags object with the archetype applied.
82
+ * The value a document's `system.archetype` carries, from the required
83
+ * `sohl.archetype` frontmatter (#126, sohl#1780).
84
+ *
85
+ * A **schema field**, so the tri-state is written out in full rather than
86
+ * expressed by a key's presence: a number is an archetype at that priority,
87
+ * and `null` is not an archetype. This is where {@link resolveArchetype}'s
88
+ * `undefined` becomes the field's `null` — an emitted `undefined` would be
89
+ * dropped by `JSON.stringify`, leaving the compiled document with no
90
+ * `archetype` at all and the tri-state readable as two.
91
+ *
92
+ * **`0` is an archetype.** It is the priority SoHL's own archetypes ship at,
93
+ * and it is falsy, so this returns it unchanged and every caller must ask
94
+ * `typeof v === "number"` rather than testing truthiness.
95
+ *
96
+ * @param {object} fm Parsed frontmatter.
97
+ * @param {string} label Human-readable context for error messages.
98
+ * @returns {number|null} The archetype priority, or `null` for a document
99
+ * that is not an archetype.
92
100
  * @throws {Error} When `sohl.archetype` is absent or invalid.
93
101
  */
94
- export function withArchetypeFlag(fm: object, flags?: object, label: string): object;
102
+ export function systemArchetype(fm: object, label: string): number | null;
95
103
  /**
96
104
  * Generates a compendium-source filename: `Name_id.json` with non-
97
105
  * alphanumeric runs replaced by underscores.
@@ -276,7 +284,7 @@ export function buildContentLinkIndex(contentBase: string, router?: object): {
276
284
  * carries `file` and `position`, so a caller reports it in the same form
277
285
  * rather than re-deriving one.
278
286
  */
279
- export function convertNoteWikilinks(body: string, { type, id, pack, docPack, index, name, file, bodyLine, bodyColumn, lineMap, }: object): {
287
+ export function convertNoteWikilinks(body: string, { type, id, pack, docPack, index, name, file, bodyLine, bodyColumn, lineMap }: object): {
280
288
  markdown: string;
281
289
  unresolved: Array<object>;
282
290
  };
@@ -84,6 +84,16 @@ export function pageUuid(entryUuid: string, pageId: string): string;
84
84
  * @type {ReadonlySet<string>}
85
85
  */
86
86
  export const MAP_TYPES: ReadonlySet<string>;
87
+ /**
88
+ * The map subTypes, which differ only in the canvas defaults derived for them.
89
+ *
90
+ * They were three *types* until #174, which cost three entries in the pack
91
+ * router, three in the claims set and three in every consumer's section config
92
+ * — for one idea that the specification had always described as one type.
93
+ *
94
+ * @type {readonly string[]}
95
+ */
96
+ export const MAP_SUBTYPES: readonly string[];
87
97
  /**
88
98
  * Content type → the pack its documents compile into, and the document type
89
99
  * that pack holds.
@@ -1,14 +1,17 @@
1
1
  export * as ids from "./ids.mjs";
2
+ export * as systemBlock from "./system-block.mjs";
2
3
  export * as codeFences from "./code-fences.mjs";
3
4
  export * as frontmatter from "./frontmatter.mjs";
4
5
  export * as contentTree from "./content-tree.mjs";
5
6
  export * as packConfig from "./pack-config.mjs";
6
7
  export * as packRouter from "./pack-router.mjs";
8
+ export * as noteClaims from "./note-claims.mjs";
7
9
  export * as contentPackage from "./content-package.mjs";
8
10
  export * as notePackage from "./note-package.mjs";
9
11
  export * as retiredFields from "./retired-fields.mjs";
10
12
  export * as homepage from "./homepage.mjs";
11
13
  export * as noteSchemas from "./note-schemas.mjs";
14
+ export * as noteVocabulary from "./note-vocabulary.mjs";
12
15
  export * as contentSlug from "./content-slug.mjs";
13
16
  export * as contentAddress from "./content-address.mjs";
14
17
  export * as foreignManifests from "./foreign-manifests.mjs";
@@ -21,9 +24,11 @@ export * as webWikilinks from "./web-wikilinks.mjs";
21
24
  export * as contentTables from "./content-tables.mjs";
22
25
  export * as helpers from "./helpers.mjs";
23
26
  export * as itemRegistry from "./item-registry.mjs";
27
+ export * as documentSubtypes from "./document-subtypes.mjs";
24
28
  export * as itemDocs from "./item-docs.mjs";
25
29
  export * as wikilinks from "./wikilinks.mjs";
26
30
  export * as wikilinkSyntax from "./wikilink-syntax.mjs";
31
+ export * as aliasIndex from "./alias-index.mjs";
27
32
  export * as siteIndex from "./site-index.mjs";
28
33
  export * as baseCompiler from "./base-compiler.mjs";
29
34
  export * as journals from "./journals.mjs";
@@ -24,10 +24,27 @@ export function itemTypes(): ReadonlySet<string>;
24
24
  * failing as an anonymous `is not a function` (#1504).
25
25
  *
26
26
  * @param {string} type - The note's `type` frontmatter.
27
+ * @param {string} [system] - The system compiling it, where a build declares
28
+ * more than one registry. Omitted, a type only one registry declares still
29
+ * resolves; a contested one throws rather than picking a side.
27
30
  * @returns {(fm: object) => object} The builder for that type.
28
31
  * @throws {Error} When the configuration registers no builder for `type`.
29
32
  */
30
- export function itemBuilder(type: string): (fm: object) => object;
33
+ export function itemBuilder(type: string, system?: string): (fm: object) => object;
34
+ /**
35
+ * The frontmatter fields a type's registry entry declares, if any.
36
+ *
37
+ * Sparse by design: a type whose entry declares none compiles normally and is
38
+ * simply undocumented (#22). What reads it is the `system`-block passthrough,
39
+ * which has to know which paths a declared field already writes before it
40
+ * writes the rest (#58).
41
+ *
42
+ * @param {string} type - The item type.
43
+ * @param {string} [system] - The system compiling it, where a build declares
44
+ * more than one registry.
45
+ * @returns {readonly object[]|undefined} The declaration, or `undefined`.
46
+ */
47
+ export function itemFields(type: string, system?: string): readonly object[] | undefined;
31
48
  /**
32
49
  * The default art for an item type — the image a note of that type is given
33
50
  * when it carries no `img:` of its own.
@@ -51,7 +68,9 @@ export function itemBuilder(type: string): (fm: object) => object;
51
68
  * One spelling, one meaning, wherever it is written.
52
69
  *
53
70
  * @param {string} type - the item type.
71
+ * @param {string} [system] - The system compiling it, where a build declares
72
+ * more than one registry.
54
73
  * @returns {string} The default image path for that type.
55
74
  * @throws {Error} When the type's registry entry pairs no `img`.
56
75
  */
57
- export function itemArt(type: string): string;
76
+ export function itemArt(type: string, system?: string): string;
@@ -24,18 +24,34 @@ export function canonicalKey(pkg: string, type: string, shortcode: string): stri
24
24
  /**
25
25
  * Reads a canonical key back into its parts.
26
26
  *
27
- * Unambiguous because no package, type or shortcode contains a hyphen — types
28
- * are bare words and shortcodes are `^[A-Za-z0-9]+$` (#1397).
29
- *
30
- * @param {string} key - A canonical key.
31
- * @returns {{package: string, type: string, shortcode: string}|null} The parts,
32
- * or `null` when the key is not in canonical form.
27
+ * Parsing is plain positional counting: split on the separator, require
28
+ * {@link CANONICAL_KEY_SEGMENTS} of them, and assign each position its field.
29
+ * **The charset rule is what makes that sound** — every segment is
30
+ * `^[A-Za-z0-9]+$` (`ADDRESS_SEGMENT_PATTERN` in `engine/address-charset.mjs`),
31
+ * so the hyphen is purely a separator and the count alone determines every
32
+ * field. That is enforced at each of the three sources rather than assumed of
33
+ * the data: shortcodes by `content-lint.mjs` (#1397), `contentPackage` by
34
+ * `defineConfig` (#59), and types are bare words. Were any of them free to
35
+ * carry a hyphen, no amount of counting would recover the fields and the reader
36
+ * would need a vocabulary to match against instead.
37
+ *
38
+ * **Nothing to read and nothing readable are different answers.** A key that
39
+ * cannot be canonical — `harn-adventures-skill-melee`, four segments — yields
40
+ * `null`, while an absent or blank input yields `undefined`. Both are falsy, so
41
+ * every call site (all of which test the result for truthiness) is unaffected;
42
+ * the distinction is there so a caller reporting "this key is unreadable" can
43
+ * tell that it has a key to report about.
44
+ *
45
+ * @param {unknown} key - A canonical key, or nothing.
46
+ * @returns {{package: string, type: string, shortcode: string}|null|undefined}
47
+ * The parts; `null` when there is a string that is not in canonical form;
48
+ * `undefined` when there is no key at all.
33
49
  */
34
- export function readCanonicalKey(key: string): {
50
+ export function readCanonicalKey(key: unknown): {
35
51
  package: string;
36
52
  type: string;
37
53
  shortcode: string;
38
- } | null;
54
+ } | null | undefined;
39
55
  /**
40
56
  * The package-relative address a site-absolute URL records as.
41
57
  *
@@ -151,6 +167,17 @@ export function manifestsComplete(localPackages: Iterable<string>, manifestPacka
151
167
  * relaxes the build rather than breaking it.
152
168
  */
153
169
  export const LINK_PACKAGES: readonly string[];
170
+ /**
171
+ * How many segments a canonical key has, and therefore how many the reader
172
+ * below counts.
173
+ *
174
+ * Named rather than written as a literal because it is the *grammar*, not an
175
+ * implementation detail of one function: it is the number a change to the
176
+ * address form would move, and the thing a reader of that change has to find.
177
+ *
178
+ * @type {number}
179
+ */
180
+ export const CANONICAL_KEY_SEGMENTS: number;
154
181
  /**
155
182
  * Manifest format version.
156
183
  *
@@ -6,14 +6,19 @@
6
6
  */
7
7
  export function isMapType(type?: string): boolean;
8
8
  /**
9
- * The canvas profile for a map type.
9
+ * The canvas profile for a map subType.
10
10
  *
11
- * @param {string} type - The note's `type`.
12
- * @returns {object} The profile from {@link MAP_TYPE_PROFILES}.
13
- * @throws {Error} When the type is not a map type — the build's fail-fast
14
- * contract, so a typo never ships a scene with Foundry's own defaults.
11
+ * Keyed on the subType rather than the type since #174: every map note is
12
+ * `type: map`, and which canvas it derives is the one thing the three
13
+ * spellings ever decided.
14
+ *
15
+ * @param {string} subType - The note's `subType`.
16
+ * @returns {object} The profile from {@link MAP_SUBTYPE_PROFILES}.
17
+ * @throws {Error} When the subType is not a map subType — the build's
18
+ * fail-fast contract, so a typo never ships a scene with Foundry's own
19
+ * defaults.
15
20
  */
16
- export function mapProfile(type: string): object;
21
+ export function mapProfile(subType: string): object;
17
22
  /**
18
23
  * The id of one region within its scene.
19
24
  *
@@ -141,7 +146,7 @@ export function buildShape(spec: object, geom: MapGeometry): object;
141
146
  */
142
147
  export function buildScene(fm: object, ctx: object): object;
143
148
  /**
144
- * Synthesise the scene's single embedded Level from `image:` / `overlay:`.
149
+ * Synthesise the scene's single embedded Level from `img:` / `overlay:`.
145
150
  *
146
151
  * Authors never write `levels:`. A scene must ship at least one Level — the
147
152
  * client-side `_preCreate` net that would create one does not run for offline
@@ -151,9 +156,13 @@ export function buildScene(fm: object, ctx: object): object;
151
156
  *
152
157
  * @param {object} sohl - The note's `sohl:` block.
153
158
  * @param {string} sceneId - The owning scene's `_id`.
159
+ * @param {string} [img] - The background art, already resolved from the note.
160
+ * Passed by {@link buildScene}, which reads it from the note rather than from
161
+ * the block; defaults to whichever spelling the block itself carries, so a
162
+ * direct two-argument call still works (#142).
154
163
  * @returns {object} The Level document, keyed for the pack.
155
164
  */
156
- export function buildLevel(sohl: object, sceneId: string): object;
165
+ export function buildLevel(sohl: object, sceneId: string, img?: string): object;
157
166
  /**
158
167
  * Compile the `walls:` and `doors:` blocks into Wall documents.
159
168
  *
@@ -225,9 +234,8 @@ export function buildLocations(sohl: object, geom: MapGeometry, ctx: object): ob
225
234
  * @returns {object[]} The Region documents.
226
235
  */
227
236
  export function buildRegions(sohl: object, geom: MapGeometry, ctx: object): object[];
228
- export { MAP_TYPES };
229
237
  /**
230
- * Per-type canvas defaults, emitted **explicitly** on every scene.
238
+ * Per-subtype canvas defaults, emitted **explicitly** on every scene.
231
239
  *
232
240
  * This is not a convenience. `grid.type`, `grid.distance` and `grid.units` all
233
241
  * declare `initial: () => game.system.grid.*`, and there is no `game` at build
@@ -237,7 +245,7 @@ export { MAP_TYPES };
237
245
  *
238
246
  * @type {Readonly<Record<string, object>>}
239
247
  */
240
- export const MAP_TYPE_PROFILES: Readonly<Record<string, object>>;
248
+ export const MAP_SUBTYPE_PROFILES: Readonly<Record<string, object>>;
241
249
  /**
242
250
  * Foundry's own id for the level a scene is created with
243
251
  * (`Scene.metadata.defaultLevelId`). Adopting it makes every reference to the
@@ -280,4 +288,6 @@ export type MapGeometry = {
280
288
  */
281
289
  dimensions: number[];
282
290
  };
291
+ import { MAP_SUBTYPES } from "./ids.mjs";
283
292
  import { MAP_TYPES } from "./ids.mjs";
293
+ export { MAP_SUBTYPES, MAP_TYPES };
@@ -0,0 +1,113 @@
1
+ /**
2
+ * The note types a pass of one document type claims — the claim table.
3
+ *
4
+ * Each row restates one pass's `selects`, in the only form that can be asked of
5
+ * a pack the configuration does not declare. A document type no compiler is
6
+ * registered for claims nothing, which is what keeps a prebuilt `Adventure`
7
+ * pack from appearing to answer for any note.
8
+ *
9
+ * @param {string} docType - The Foundry document type a pack holds.
10
+ * @param {ClaimSources} [sources] - What to answer from. Defaults to the
11
+ * configured registries and the systems this toolchain ships.
12
+ * @returns {ReadonlySet<string>} The note types such a pass would claim.
13
+ */
14
+ export function noteTypesClaimedBy(docType: string, sources?: ClaimSources): ReadonlySet<string>;
15
+ /**
16
+ * Every note type some pack in a configuration would compile.
17
+ *
18
+ * The union across the configured pack list, so a type claimed by any one pack
19
+ * is claimed — which is what keeps a type deliberately unmapped for one system,
20
+ * and claimed for another, silent (#79).
21
+ *
22
+ * @param {object} [config] - The resolved build configuration. Defaults to this
23
+ * repository's.
24
+ * @param {ClaimSources} [sources] - What to answer from.
25
+ * @returns {ReadonlySet<string>} The claimed note types.
26
+ */
27
+ export function claimedNoteTypes(config?: object, sources?: ClaimSources): ReadonlySet<string>;
28
+ /**
29
+ * Every note type this build knows, whatever any one repository configures.
30
+ *
31
+ * Wider than {@link claimedNoteTypes} on purpose: it is what distinguishes a
32
+ * repository that has not configured a pack for a real content type from an
33
+ * author who wrote a word nothing anywhere compiles. The engine's own types,
34
+ * the types every shipped system maps, and whatever the configured registries
35
+ * declare on top.
36
+ *
37
+ * @param {ClaimSources} [sources] - What to answer from.
38
+ * @returns {ReadonlySet<string>} The vocabulary.
39
+ */
40
+ export function noteTypeVocabulary(sources?: ClaimSources): ReadonlySet<string>;
41
+ /**
42
+ * Every note in the content tree that no configured pack would compile.
43
+ *
44
+ * Read-only: it walks the tree and reports, and writes nothing. Three kinds of
45
+ * note are passed over, each for a stated reason rather than by omission — a
46
+ * file with no frontmatter is not a note; a note with no `type:` is the
47
+ * frontmatter linter's finding, which can say what a type is *for*; and a
48
+ * retired type is answered by `assertTypeNotRetired` in `ids.mjs`, which names the
49
+ * replacement.
50
+ *
51
+ * @param {object} [config] - The resolved build configuration. Defaults to this
52
+ * repository's.
53
+ * @param {ClaimSources} [sources] - What to answer from.
54
+ * @returns {Array<{file: string, line?: number, column?: number,
55
+ * severity: "error", message: string, type: string}>} One finding per note.
56
+ */
57
+ export function unclaimedNoteFindings(config?: object, sources?: ClaimSources): Array<{
58
+ file: string;
59
+ line?: number;
60
+ column?: number;
61
+ severity: "error";
62
+ message: string;
63
+ type: string;
64
+ }>;
65
+ /**
66
+ * Note types that compile into **no compendium document, by design**.
67
+ *
68
+ * A homepage compiles into a *page*: it carries no compendium UUID, appears in
69
+ * no pack and in no link-manifest entry, and every package that publishes one
70
+ * would otherwise be told its front page is unclaimed. It is the one type whose
71
+ * absence from every pack is the intended state rather than a gap.
72
+ *
73
+ * @type {ReadonlySet<string>}
74
+ */
75
+ export const NEVER_PACKED_TYPES: ReadonlySet<string>;
76
+ /**
77
+ * The note-type → document-subtype maps this toolchain ships.
78
+ *
79
+ * One today. `hm3/` is #139, and when it lands its map joins this list rather
80
+ * than the claim table below growing a second copy of the same fact.
81
+ *
82
+ * `engine/` importing from `sohl/` is the arrangement `generate.mjs` already
83
+ * has — its `COMPILERS` table names the SoHL compilers by class — and for the
84
+ * same reason: the engine owns the *mechanism* that asks each system what it
85
+ * compiles, and the systems own the answers.
86
+ *
87
+ * @type {readonly import("./document-subtypes.mjs").DocumentSubtypeMap[]}
88
+ */
89
+ export const KNOWN_DOCUMENT_SUBTYPE_MAPS: readonly import("./document-subtypes.mjs").DocumentSubtypeMap[];
90
+ /**
91
+ * What a claim question is asked against.
92
+ *
93
+ * Each field defaults to what the compilers themselves read, so the answer here
94
+ * and the answer a pass gives are drawn from one source. They are parameters so
95
+ * that a test can pose a configuration this toolchain does not ship — two
96
+ * systems cutting the vocabulary differently, a registry declaring nothing —
97
+ * without a content tree or a config file on disk.
98
+ */
99
+ export type ClaimSources = {
100
+ /**
101
+ * -
102
+ * The systems' note-type → document-subtype maps.
103
+ */
104
+ maps?: readonly import("./document-subtypes.mjs").DocumentSubtypeMap[] | undefined;
105
+ /**
106
+ * - The declared item vocabulary.
107
+ */
108
+ itemTypes?: ReadonlySet<string> | undefined;
109
+ /**
110
+ * - The doc-carrying types.
111
+ */
112
+ docEntryTypes?: ReadonlySet<string> | undefined;
113
+ };