@heroiclands/package-build 20.3.0 → 20.4.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 (178) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/CONTENT.md +111 -92
  3. package/README.md +2 -9
  4. package/bin/content-build.mjs +70 -61
  5. package/bin/package-build.mjs +2 -2
  6. package/config.mjs +6 -8
  7. package/content-config.mjs +187 -64
  8. package/docs/content-format.md +57 -68
  9. package/e2e.mjs +4 -4
  10. package/engine/actor-compiler.mjs +36 -36
  11. package/engine/address-charset.mjs +6 -6
  12. package/engine/address-diff.mjs +12 -11
  13. package/engine/anchored-sections.mjs +1 -1
  14. package/engine/anchors.mjs +1 -1
  15. package/engine/base-compiler.mjs +36 -38
  16. package/engine/bundle-notes.mjs +4 -4
  17. package/engine/bundles.mjs +8 -8
  18. package/engine/code-fences.mjs +3 -3
  19. package/engine/compendiums.mjs +8 -8
  20. package/engine/compile-corpus.mjs +4 -5
  21. package/engine/content-address.mjs +15 -15
  22. package/engine/content-charset.mjs +1 -1
  23. package/engine/content-format-check.mjs +24 -25
  24. package/engine/content-format.mjs +8 -8
  25. package/engine/content-html.mjs +202 -0
  26. package/engine/content-icons.mjs +225 -98
  27. package/engine/content-index.mjs +17 -17
  28. package/engine/content-links.mjs +30 -30
  29. package/engine/content-lint.mjs +20 -24
  30. package/engine/content-package.mjs +7 -9
  31. package/engine/content-slug.mjs +2 -2
  32. package/engine/content-tables.mjs +7 -8
  33. package/engine/content-tree.mjs +1 -1
  34. package/engine/derived-fields.mjs +174 -0
  35. package/engine/diagnostics.mjs +3 -4
  36. package/engine/document-subtypes.mjs +6 -7
  37. package/engine/field-reference.mjs +8 -8
  38. package/engine/field-spec.mjs +29 -30
  39. package/engine/folder-notes.mjs +14 -14
  40. package/engine/foreign-catalog.mjs +8 -9
  41. package/engine/foundry-entries.mjs +19 -20
  42. package/engine/frontmatter-lint.mjs +64 -69
  43. package/engine/frontmatter.mjs +11 -11
  44. package/engine/generate.mjs +39 -39
  45. package/engine/helpers.mjs +63 -54
  46. package/engine/homepage.mjs +20 -22
  47. package/engine/ids.mjs +15 -15
  48. package/engine/index-records.mjs +4 -4
  49. package/engine/index.mjs +14 -8
  50. package/engine/item-compiler.mjs +54 -29
  51. package/engine/item-docs.mjs +11 -13
  52. package/engine/item-registry.mjs +13 -13
  53. package/engine/journals.mjs +15 -15
  54. package/engine/macros.mjs +3 -3
  55. package/engine/map-notes.mjs +6 -6
  56. package/engine/metadata-index.mjs +5 -5
  57. package/engine/note-claims.mjs +36 -34
  58. package/engine/note-ids.mjs +5 -5
  59. package/engine/note-package.mjs +4 -4
  60. package/engine/note-renames.mjs +3 -3
  61. package/engine/note-schemas.mjs +3 -3
  62. package/engine/note-vocabulary.mjs +27 -26
  63. package/engine/pack-config.mjs +13 -13
  64. package/engine/pack-router.mjs +0 -0
  65. package/engine/prose-config.mjs +9 -9
  66. package/engine/prose-lint.mjs +12 -13
  67. package/engine/region-events.mjs +2 -2
  68. package/engine/retired-fields.mjs +24 -22
  69. package/engine/runtime-only-fields.mjs +1 -1
  70. package/engine/scene-levels.mjs +1 -1
  71. package/engine/scenes.mjs +19 -20
  72. package/engine/schema-check.mjs +20 -20
  73. package/engine/schema-extract.mjs +1 -1
  74. package/engine/site-build.mjs +45 -47
  75. package/engine/site-index.mjs +17 -18
  76. package/engine/sql-tables.mjs +21 -13
  77. package/engine/subtype-registry.mjs +5 -4
  78. package/engine/system-block.mjs +18 -19
  79. package/engine/systems.mjs +2 -2
  80. package/engine/web-wikilinks.mjs +35 -35
  81. package/engine/wikilink-syntax.mjs +16 -16
  82. package/engine/wikilinks.mjs +39 -39
  83. package/hm3/actors.mjs +22 -22
  84. package/hm3/document-subtypes.mjs +5 -5
  85. package/hm3/index.mjs +2 -2
  86. package/hm3/item-builders.mjs +1 -1
  87. package/hm3/item-fields.mjs +3 -3
  88. package/hm3/items.mjs +20 -8
  89. package/hm3/template-priority.mjs +2 -2
  90. package/lang.mjs +3 -3
  91. package/manifest.mjs +17 -20
  92. package/package.json +1 -2
  93. package/release.mjs +3 -3
  94. package/sohl/actors.mjs +28 -28
  95. package/sohl/affiliation-standings.mjs +2 -2
  96. package/sohl/being-info.mjs +5 -5
  97. package/sohl/default-item-art.mjs +5 -5
  98. package/sohl/document-subtypes.mjs +5 -5
  99. package/sohl/index.mjs +3 -3
  100. package/sohl/item-builders.mjs +7 -7
  101. package/sohl/item-fields.mjs +8 -9
  102. package/sohl/items.mjs +20 -6
  103. package/sohl/kb-passes.mjs +5 -5
  104. package/sohl/note-schemas.mjs +7 -7
  105. package/sohl/skill-base.mjs +1 -1
  106. package/types/content-config.d.mts +25 -24
  107. package/types/e2e.d.mts +3 -3
  108. package/types/engine/actor-compiler.d.mts +14 -13
  109. package/types/engine/address-charset.d.mts +6 -6
  110. package/types/engine/address-diff.d.mts +3 -3
  111. package/types/engine/base-compiler.d.mts +17 -19
  112. package/types/engine/bundle-notes.d.mts +3 -3
  113. package/types/engine/bundles.d.mts +1 -1
  114. package/types/engine/code-fences.d.mts +3 -3
  115. package/types/engine/compendiums.d.mts +3 -3
  116. package/types/engine/compile-corpus.d.mts +1 -1
  117. package/types/engine/content-address.d.mts +11 -11
  118. package/types/engine/content-format-check.d.mts +6 -6
  119. package/types/engine/content-format.d.mts +2 -2
  120. package/types/engine/content-html.d.mts +78 -0
  121. package/types/engine/content-icons.d.mts +150 -62
  122. package/types/engine/content-index.d.mts +2 -2
  123. package/types/engine/content-links.d.mts +8 -8
  124. package/types/engine/content-lint.d.mts +2 -2
  125. package/types/engine/content-package.d.mts +6 -8
  126. package/types/engine/derived-fields.d.mts +101 -0
  127. package/types/engine/diagnostics.d.mts +2 -2
  128. package/types/engine/document-subtypes.d.mts +3 -3
  129. package/types/engine/field-spec.d.mts +37 -39
  130. package/types/engine/folder-notes.d.mts +4 -5
  131. package/types/engine/foreign-catalog.d.mts +3 -3
  132. package/types/engine/foundry-entries.d.mts +6 -7
  133. package/types/engine/frontmatter-lint.d.mts +7 -7
  134. package/types/engine/frontmatter.d.mts +7 -7
  135. package/types/engine/generate.d.mts +7 -7
  136. package/types/engine/helpers.d.mts +25 -27
  137. package/types/engine/homepage.d.mts +16 -18
  138. package/types/engine/ids.d.mts +13 -13
  139. package/types/engine/index-records.d.mts +3 -3
  140. package/types/engine/index.d.mts +2 -0
  141. package/types/engine/item-compiler.d.mts +21 -5
  142. package/types/engine/item-docs.d.mts +2 -2
  143. package/types/engine/item-registry.d.mts +6 -6
  144. package/types/engine/journals.d.mts +3 -3
  145. package/types/engine/map-notes.d.mts +2 -2
  146. package/types/engine/metadata-index.d.mts +4 -4
  147. package/types/engine/note-claims.d.mts +16 -15
  148. package/types/engine/note-ids.d.mts +4 -4
  149. package/types/engine/note-package.d.mts +1 -1
  150. package/types/engine/note-renames.d.mts +3 -3
  151. package/types/engine/note-vocabulary.d.mts +9 -8
  152. package/types/engine/pack-config.d.mts +3 -3
  153. package/types/engine/pack-router.d.mts +1 -1
  154. package/types/engine/prose-config.d.mts +9 -9
  155. package/types/engine/prose-lint.d.mts +3 -4
  156. package/types/engine/region-events.d.mts +2 -2
  157. package/types/engine/retired-fields.d.mts +10 -9
  158. package/types/engine/schema-check.d.mts +11 -11
  159. package/types/engine/site-build.d.mts +18 -19
  160. package/types/engine/site-index.d.mts +3 -4
  161. package/types/engine/sql-tables.d.mts +11 -5
  162. package/types/engine/subtype-registry.d.mts +3 -3
  163. package/types/engine/system-block.d.mts +3 -3
  164. package/types/engine/web-wikilinks.d.mts +7 -7
  165. package/types/engine/wikilink-syntax.d.mts +17 -17
  166. package/types/engine/wikilinks.d.mts +13 -12
  167. package/types/hm3/actors.d.mts +1 -1
  168. package/types/hm3/document-subtypes.d.mts +1 -1
  169. package/types/hm3/items.d.mts +1 -2
  170. package/types/hm3/template-priority.d.mts +1 -1
  171. package/types/manifest.d.mts +8 -8
  172. package/types/sohl/actors.d.mts +2 -2
  173. package/types/sohl/affiliation-standings.d.mts +2 -2
  174. package/types/sohl/being-info.d.mts +2 -2
  175. package/types/sohl/document-subtypes.d.mts +1 -1
  176. package/types/sohl/items.d.mts +1 -2
  177. package/types/sohl/note-schemas.d.mts +1 -1
  178. package/MIGRATING.md +0 -608
@@ -120,7 +120,7 @@ export function catalogDir(config, id, version) {
120
120
  const itemsDir = (dir) => path.join(dir, "items");
121
121
 
122
122
  /**
123
- * The file a system publishes its `system` field sets as (#60).
123
+ * The file a system publishes its `system` field sets as.
124
124
  *
125
125
  * @type {string}
126
126
  */
@@ -166,7 +166,7 @@ function cacheSchemaArtifact(root, dir) {
166
166
 
167
167
  /**
168
168
  * What each extracted pack is, written beside the items rather than inferred
169
- * from the directory it landed in (#58).
169
+ * from the directory it landed in.
170
170
  *
171
171
  * A dependency may ship a pack per system — `items-sohl` and `items-hm3` — and
172
172
  * the two hold documents of the *same* `(type, shortcode)` addresses with
@@ -219,7 +219,7 @@ function cachedItemPacks(dir) {
219
219
  * Whether a dependency's cache is present and complete.
220
220
  *
221
221
  * **A cache without its pack manifest is incomplete**, not merely unlabelled.
222
- * One written before #58 holds the items and not what they are, and the two
222
+ * An older one holds the items and not what they are, and the two
223
223
  * ways of proceeding without it are both wrong: reading every pack resolves an
224
224
  * `hm3` reference against `sohl` documents — the silent-wrong-output failure
225
225
  * this scoping exists to remove — and reading none fails a build that was
@@ -309,7 +309,7 @@ async function extractItemPacks(id, version, manifest, root, dir) {
309
309
  );
310
310
  }
311
311
  // What each pack is, from the only place that knows: the manifest that
312
- // declared it (#58). Written before the stamp, so the stamp continues to
312
+ // declared it. Written before the stamp, so the stamp continues to
313
313
  // mean the cache is whole.
314
314
  fs.writeFileSync(
315
315
  path.join(dir, ITEM_PACKS),
@@ -519,7 +519,7 @@ export async function fetchCatalogFromPath(config, rel, source) {
519
519
  }
520
520
 
521
521
  /**
522
- * Fetch one dependency's published content index (#239).
522
+ * Fetch one dependency's published content index.
523
523
  *
524
524
  * **The chain is entirely declared.** The relationship names the dependency's
525
525
  * manifest, the manifest advertises `flags.metadataUrl`, and that URL is the
@@ -720,7 +720,7 @@ export async function fetchAllCatalogs(config) {
720
720
  * Reads the cache only. A cold cache is an error naming the command that fills
721
721
  * it, rather than a download nobody asked for.
722
722
  *
723
- * **Scoped to one system when the caller compiles for one (#58)**, exactly as
723
+ * **Scoped to one system when the caller compiles for one**, exactly as
724
724
  * {@link module:engine/generate.itemPackJsonDirs} scopes the local half. The
725
725
  * two halves answer the same lookup — `loadItemsMap` merges them into one
726
726
  * address space keyed by `subType:shortcode` — so scoping only the local one
@@ -759,8 +759,7 @@ export function foreignItemCatalogDirs(config, system = null) {
759
759
  // the currently declared one, so that is the one to use. The
760
760
  // comparison is the content-index cache's, shared rather than
761
761
  // rewritten: a plain string sort would put `0.8.10` before `0.8.2` and
762
- // silently resolve every embedded item against the older catalogue
763
- // (#272).
762
+ // silently resolve every embedded item against the older catalogue.
764
763
  const newest = newestVersionDir(cached);
765
764
  const packSystems = cachedItemPacks(newest);
766
765
  const items = itemsDir(newest);
@@ -768,7 +767,7 @@ export function foreignItemCatalogDirs(config, system = null) {
768
767
  if (!entry.isDirectory()) continue;
769
768
  const packSystem = packSystems.get(entry.name) ?? null;
770
769
  if (system != null && packSystem != null && packSystem !== system) continue;
771
- // The dependency's own id travels with its directory (#334): a
770
+ // The dependency's own id travels with its directory: a
772
771
  // being's `model:` names the package its template comes from, and
773
772
  // the address cannot be built from the path.
774
773
  dirs.push({ dir: path.join(items, entry.name), package: rel.id });
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  /**
15
- * Emitting this package's cross-package link manifest (#58).
15
+ * Emitting this package's cross-package link manifest.
16
16
  *
17
17
  * `engine/content-address.mjs` owns the address *grammar* — how a key is
18
18
  * version is read, how a foreign file resolves. This module owns the *pass*:
@@ -27,16 +27,16 @@
27
27
  * to strip that same prefix back off; the value never reached the file. So
28
28
  * nothing here composes one. An address is derived package-relative from the
29
29
  * start, by {@link packageAddress}, and the emitting build's mount point is not
30
- * a fact it has to be told (#1465).
30
+ * a fact it has to be told.
31
31
  *
32
- * **An entry's `path` is derivable from the key it is filed under** (#181).
32
+ * **An entry's `path` is derivable from the key it is filed under**.
33
33
  * `sohl-sohl-affliction-aconite` publishes at `affliction-aconite/` — the key
34
34
  * with its package and system segments dropped — because a page's URL *is* its
35
35
  * address; nothing in it comes from a display name, so a rename moves no URL and
36
36
  * no uniqueness check stands between the two. The system segment goes with the
37
37
  * package because a note publishes one page however many systems' documents it
38
- * compiles into (#59). Every entry is
39
- * derivable that way since #204 retired the section landing, which was the one
38
+ * compiles into. Every entry is
39
+ * derivable that way, sections being retired the section landing was the one
40
40
  * that was not. The field is still written rather than left for a consumer to
41
41
  * compute, because an absent `path` already means something else entirely (a
42
42
  * package that publishes no pages).
@@ -124,8 +124,8 @@ export function anchorsOf(entryUuid, entryId, body, name) {
124
124
  * An item note produces **two**: the item, and separately the JournalEntry its
125
125
  * prose compiles into. They are two documents with two UUIDs, so they get two
126
126
  * addresses; the item's entry points at the other by address rather than
127
- * repeating its UUID, because the doc entry owns that fact (#1499). A `macro`
128
- * note is the same arrangement (#1514), which is why the type set comes from
127
+ * repeating its UUID, because the doc entry owns that fact. A `macro`
128
+ * note is the same arrangement, which is why the type set comes from
129
129
  * {@link hasDocEntry} rather than being spelled here — the journals compiler
130
130
  * reads the same one, so a manifest cannot claim documentation nothing compiled.
131
131
  *
@@ -137,7 +137,7 @@ export function anchorsOf(entryUuid, entryId, body, name) {
137
137
  * UUID. The two are one fact — a UUID ends in the id — but only the entry knows
138
138
  * which derivation produced it: an item's is its note's `fm.id`, and its
139
139
  * documentation journal's is {@link itemDocEntryId} of that. Stating it here is
140
- * what lets the content index publish an identity it did not re-derive (#310).
140
+ * what lets the content index publish an identity it did not re-derive.
141
141
  *
142
142
  * @param {object} ctx - Resolved identities: `{ contentPackage,
143
143
  * foundryPackageId, packRouter }`.
@@ -161,11 +161,11 @@ export function entriesForNote(fm, name, address, body, ctx) {
161
161
 
162
162
  // A published address must name the pack the document actually shipped in:
163
163
  // a consumer resolves the UUID verbatim, and a repository may ship several
164
- // packs of one type (#1566).
164
+ // packs of one type.
165
165
  const uuidFor = (type, id, routeFm) =>
166
166
  // A type this cannot name a single compendium document for has no UUID
167
167
  // to publish, whatever id it derives. That used to follow from such a
168
- // note authoring no `id:`; since #270 every addressable note derives
168
+ // note authoring no `id:`; every addressable note derives
169
169
  // one, so "has an id" stopped being evidence a document exists and the
170
170
  // rule is stated where it belongs — beside the addresses — rather than
171
171
  // resting on an absent field. `collectFoundryEntries` skips such a note
@@ -175,7 +175,7 @@ export function entriesForNote(fm, name, address, body, ctx) {
175
175
  // Two sets, for opposite reasons (see `note-claims.mjs`). A **homepage**
176
176
  // is in no pack: it compiles to a page and there is nothing to address.
177
177
  // A **folder** may be in several — it materialises in every pack holding
178
- // a document that references it (#276) — so no one UUID identifies it,
178
+ // a document that references it — so no one UUID identifies it,
179
179
  // and its id is hashed under the `folder` namespace against its own
180
180
  // address rather than under `document`. Emitting one would publish an
181
181
  // `Item` UUID for a `Folder`, at an id no document carries.
@@ -222,7 +222,7 @@ export function entriesForNote(fm, name, address, body, ctx) {
222
222
  // content index publishes it beside the UUID, so an entry the
223
223
  // index gives an identity to states both halves of it rather
224
224
  // than leaving a consumer to parse the id back out of the
225
- // UUID's last segment (#310).
225
+ // UUID's last segment.
226
226
  id: docEntryId,
227
227
  uuid: docUuid,
228
228
  anchors: docUuid ? anchorsOf(docUuid, docEntryId, body ?? "", name) : undefined,
@@ -250,12 +250,11 @@ export function entriesForNote(fm, name, address, body, ctx) {
250
250
  * Every note this package publishes, as manifest entries.
251
251
  *
252
252
  * Every note in the tree is this package's, so nothing here selects by package:
253
- * the key's first segment is `contentPackage` (#56). A note still declaring the
253
+ * the key's first segment is `contentPackage`. A note still declaring the
254
254
  * retired `package:` or `draft:` field **throws** rather than being skipped —
255
255
  * skipping one silently is how a whole tree came to be filtered out of a
256
256
  * manifest that then claimed the package published nothing, and it is what let
257
- * a drafted note's inbound links look like links to a note that never existed
258
- * (#69).
257
+ * a drafted note's inbound links look like links to a note that never existed.
259
258
  *
260
259
  * A note that has no address is **reported, not guessed** — the finding carries
261
260
  * the file and the reason, so a caller can print it or fail on it. Inventing an
@@ -278,8 +277,8 @@ export function collectFoundryEntries(contentBase, ctx) {
278
277
  skipDirectories: ctx.skipDirectories,
279
278
  })) {
280
279
  if (!fm) continue;
281
- // Its authored pin, or the id derived from its canonical address
282
- // (#270). Resolved before anything reads `fm.id`, so the UUID this
280
+ // Its authored pin, or the id derived from its canonical address.
281
+ // Resolved before anything reads `fm.id`, so the UUID this
283
282
  // pass publishes is the one the pack passes compiled under.
284
283
  resolveNoteId(fm, { pkg: ctx.contentPackage });
285
284
  const rel = path.relative(contentBase, absPath);
@@ -294,7 +293,7 @@ export function collectFoundryEntries(contentBase, ctx) {
294
293
  assertNoSectionField(fm, { file: rel, absPath });
295
294
  assertNoTraitsField(fm, { file: rel, absPath });
296
295
  if (!fm.type || !fm.shortcode) continue;
297
- // A homepage is addressed like every other note since #182, and a
296
+ // A homepage is addressed like every other note, and a
298
297
  // shortcode alone would now put it here. It stays out for the reason it
299
298
  // always did, which that change does not touch: a manifest entry is how
300
299
  // another package resolves a **document**, and a homepage compiles into
@@ -337,7 +336,7 @@ export function foundryIdentities(config = loadPackConfig()) {
337
336
  // Carried in the context rather than read from the global config at the
338
337
  // call site, so the pass really is a pure function of what it is handed
339
338
  // — which is what lets the content index drive the same derivation with
340
- // a configuration it resolved itself (#239).
339
+ // a configuration it resolved itself.
341
340
  docEntryTypes: config.docEntryTypes,
342
341
  };
343
342
  }
@@ -348,7 +347,7 @@ export function foundryIdentities(config = loadPackConfig()) {
348
347
  * {@link foundryIdentities} plus what only a *manifest* emission needs. The
349
348
  * split is what lets the content index derive the same Foundry addresses from
350
349
  * the same code without also depending on whether the package publishes pages,
351
- * which is no part of a UUID (#239).
350
+ * which is no part of a UUID.
352
351
  *
353
352
  * @param {object} [config] - A resolved configuration; loaded when omitted.
354
353
  * @returns {{contentPackage: string, foundryPackageId: string, packRouter: object,