@heroiclands/package-build 20.3.1 → 20.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +351 -0
- package/CONTENT.md +322 -110
- package/README.md +21 -10
- package/bin/content-build.mjs +204 -92
- package/bin/package-build.mjs +48 -15
- package/config.mjs +6 -8
- package/content-config.mjs +518 -151
- package/docs/api.md +1352 -0
- package/docs/commands.md +1609 -0
- package/docs/configuration.md +1432 -0
- package/docs/content-format.md +73 -74
- package/docs/diagnostics.md +356 -0
- package/docs/getting-started.md +813 -0
- package/docs/project-setup.md +469 -0
- package/e2e.mjs +4 -4
- package/engine/actor-compiler.mjs +64 -61
- package/engine/address-charset.mjs +6 -6
- package/engine/address-diff.mjs +57 -52
- package/engine/anchored-sections.mjs +1 -1
- package/engine/anchors.mjs +1 -1
- package/engine/base-compiler.mjs +42 -38
- package/engine/bundle-notes.mjs +4 -4
- package/engine/bundles.mjs +17 -8
- package/engine/code-fences.mjs +3 -3
- package/engine/compendiums.mjs +8 -8
- package/engine/compile-corpus.mjs +4 -5
- package/engine/content-address.mjs +24 -24
- package/engine/content-charset.mjs +1 -1
- package/engine/content-format-check.mjs +24 -25
- package/engine/content-format.mjs +8 -8
- package/engine/content-html.mjs +202 -0
- package/engine/content-icons.mjs +196 -165
- package/engine/content-index.mjs +61 -40
- package/engine/content-links.mjs +74 -41
- package/engine/content-lint.mjs +64 -34
- package/engine/content-package.mjs +7 -9
- package/engine/content-slug.mjs +2 -2
- package/engine/content-tables.mjs +38 -34
- package/engine/content-tree.mjs +1 -1
- package/engine/derived-fields.mjs +174 -0
- package/engine/diagnostics.mjs +3 -4
- package/engine/document-subtypes.mjs +6 -7
- package/engine/field-reference.mjs +8 -8
- package/engine/field-spec.mjs +29 -30
- package/engine/folder-notes.mjs +18 -16
- package/engine/foreign-catalog.mjs +8 -9
- package/engine/foundry-entries.mjs +19 -20
- package/engine/frontmatter-lint.mjs +95 -103
- package/engine/frontmatter.mjs +11 -11
- package/engine/generate.mjs +44 -39
- package/engine/helpers.mjs +147 -84
- package/engine/homepage.mjs +20 -22
- package/engine/ids.mjs +15 -15
- package/engine/index-records.mjs +4 -4
- package/engine/index.mjs +26 -10
- package/engine/item-compiler.mjs +54 -29
- package/engine/item-docs.mjs +11 -13
- package/engine/item-registry.mjs +13 -13
- package/engine/journals.mjs +24 -15
- package/engine/macros.mjs +3 -3
- package/engine/map-notes.mjs +6 -6
- package/engine/metadata-index.mjs +5 -5
- package/engine/note-claims.mjs +51 -41
- package/engine/note-ids.mjs +5 -5
- package/engine/note-package.mjs +4 -4
- package/engine/note-renames.mjs +3 -3
- package/engine/note-schemas.mjs +3 -8
- package/engine/note-vocabulary.mjs +56 -54
- package/engine/pack-config.mjs +39 -25
- package/engine/pack-router.mjs +0 -0
- package/engine/pdf-build.mjs +464 -0
- package/engine/pdf-fonts.mjs +420 -0
- package/engine/pdf-render.mjs +798 -0
- package/engine/pdf-toc.mjs +525 -0
- package/engine/prose-config.mjs +9 -9
- package/engine/prose-lint.mjs +12 -13
- package/engine/region-events.mjs +2 -2
- package/engine/retired-fields.mjs +24 -22
- package/engine/runtime-only-fields.mjs +1 -1
- package/engine/scene-levels.mjs +1 -1
- package/engine/scenes.mjs +33 -25
- package/engine/schema-check.mjs +21 -21
- package/engine/schema-extract.mjs +1 -1
- package/engine/site-build.mjs +66 -50
- package/engine/site-index.mjs +17 -18
- package/engine/sql-tables.mjs +21 -13
- package/engine/subtype-registry.mjs +5 -4
- package/engine/system-block.mjs +18 -19
- package/engine/systems.mjs +2 -2
- package/engine/web-wikilinks.mjs +41 -38
- package/engine/wikilink-syntax.mjs +16 -16
- package/engine/wikilinks.mjs +40 -42
- package/hm3/actors.mjs +30 -22
- package/hm3/document-subtypes.mjs +5 -5
- package/hm3/index.mjs +2 -2
- package/hm3/item-builders.mjs +1 -1
- package/hm3/item-fields.mjs +3 -3
- package/hm3/items.mjs +28 -8
- package/hm3/template-priority.mjs +2 -2
- package/lang.mjs +3 -3
- package/manifest.mjs +17 -20
- package/package.json +1 -2
- package/release.mjs +66 -6
- package/sohl/actors.mjs +36 -28
- package/sohl/affiliation-standings.mjs +2 -2
- package/sohl/being-info.mjs +5 -5
- package/sohl/default-item-art.mjs +5 -5
- package/sohl/document-subtypes.mjs +5 -5
- package/sohl/index.mjs +3 -3
- package/sohl/item-builders.mjs +7 -7
- package/sohl/item-fields.mjs +8 -9
- package/sohl/items.mjs +28 -6
- package/sohl/kb-passes.mjs +5 -5
- package/sohl/note-schemas.mjs +12 -12
- package/sohl/skill-base.mjs +1 -1
- package/types/content-config.d.mts +91 -39
- package/types/e2e.d.mts +3 -3
- package/types/engine/actor-compiler.d.mts +45 -40
- package/types/engine/address-charset.d.mts +6 -6
- package/types/engine/address-diff.d.mts +60 -6
- package/types/engine/base-compiler.d.mts +27 -21
- package/types/engine/bundle-notes.d.mts +3 -3
- package/types/engine/bundles.d.mts +10 -1
- package/types/engine/code-fences.d.mts +3 -3
- package/types/engine/compendiums.d.mts +3 -3
- package/types/engine/compile-corpus.d.mts +1 -1
- package/types/engine/content-address.d.mts +20 -20
- package/types/engine/content-format-check.d.mts +6 -6
- package/types/engine/content-format.d.mts +2 -2
- package/types/engine/content-html.d.mts +78 -0
- package/types/engine/content-icons.d.mts +139 -92
- package/types/engine/content-index.d.mts +59 -15
- package/types/engine/content-links.d.mts +8 -8
- package/types/engine/content-lint.d.mts +8 -6
- package/types/engine/content-package.d.mts +6 -8
- package/types/engine/content-tables.d.mts +49 -18
- package/types/engine/derived-fields.d.mts +101 -0
- package/types/engine/diagnostics.d.mts +2 -2
- package/types/engine/document-subtypes.d.mts +3 -3
- package/types/engine/field-spec.d.mts +37 -39
- package/types/engine/folder-notes.d.mts +4 -5
- package/types/engine/foreign-catalog.d.mts +3 -3
- package/types/engine/foundry-entries.d.mts +6 -7
- package/types/engine/frontmatter-lint.d.mts +10 -9
- package/types/engine/frontmatter.d.mts +7 -7
- package/types/engine/generate.d.mts +7 -7
- package/types/engine/helpers.d.mts +128 -56
- package/types/engine/homepage.d.mts +16 -18
- package/types/engine/ids.d.mts +13 -13
- package/types/engine/index-records.d.mts +3 -3
- package/types/engine/index.d.mts +6 -0
- package/types/engine/item-compiler.d.mts +21 -5
- package/types/engine/item-docs.d.mts +2 -2
- package/types/engine/item-registry.d.mts +6 -6
- package/types/engine/journals.d.mts +12 -3
- package/types/engine/map-notes.d.mts +2 -2
- package/types/engine/metadata-index.d.mts +4 -4
- package/types/engine/note-claims.d.mts +30 -22
- package/types/engine/note-ids.d.mts +4 -4
- package/types/engine/note-package.d.mts +1 -1
- package/types/engine/note-renames.d.mts +3 -3
- package/types/engine/note-vocabulary.d.mts +31 -203
- package/types/engine/pack-config.d.mts +7 -7
- package/types/engine/pack-router.d.mts +1 -1
- package/types/engine/pdf-build.d.mts +42 -0
- package/types/engine/pdf-fonts.d.mts +30 -0
- package/types/engine/pdf-render.d.mts +144 -0
- package/types/engine/pdf-toc.d.mts +114 -0
- package/types/engine/prose-config.d.mts +9 -9
- package/types/engine/prose-lint.d.mts +3 -4
- package/types/engine/region-events.d.mts +2 -2
- package/types/engine/retired-fields.d.mts +10 -9
- package/types/engine/scenes.d.mts +10 -1
- package/types/engine/schema-check.d.mts +13 -13
- package/types/engine/site-build.d.mts +52 -25
- package/types/engine/site-index.d.mts +3 -4
- package/types/engine/sql-tables.d.mts +11 -5
- package/types/engine/subtype-registry.d.mts +3 -3
- package/types/engine/system-block.d.mts +3 -3
- package/types/engine/web-wikilinks.d.mts +7 -7
- package/types/engine/wikilink-syntax.d.mts +17 -17
- package/types/engine/wikilinks.d.mts +14 -14
- package/types/hm3/actors.d.mts +9 -1
- package/types/hm3/document-subtypes.d.mts +1 -1
- package/types/hm3/items.d.mts +9 -2
- package/types/hm3/template-priority.d.mts +1 -1
- package/types/manifest.d.mts +8 -8
- package/types/release.d.mts +15 -4
- package/types/sohl/actors.d.mts +12 -4
- package/types/sohl/affiliation-standings.d.mts +2 -2
- package/types/sohl/being-info.d.mts +2 -2
- package/types/sohl/document-subtypes.d.mts +1 -1
- package/types/sohl/items.d.mts +9 -2
- package/types/sohl/note-schemas.d.mts +1 -1
- package/MIGRATING.md +0 -608
package/engine/generate.mjs
CHANGED
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
*
|
|
23
23
|
* Each `*` compiler walks the whole content tree and selects its own entries by
|
|
24
24
|
* the note's `type` — every note in the tree belongs to this repository's
|
|
25
|
-
* `contentPackage`
|
|
25
|
+
* `contentPackage` — so routing is directory-agnostic: a file lands in a
|
|
26
26
|
* pack because of its `type`, not its location. Which packs exist is declared
|
|
27
27
|
* in `package-build.config.yaml`; the **folder hierarchy is not declared
|
|
28
|
-
* anywhere**. A folder is a note like any other
|
|
28
|
+
* anywhere**. A folder is a note like any other, named by `packFolder`
|
|
29
29
|
* — its address — and it materialises in every pack that holds a document
|
|
30
|
-
* naming it, its ancestors with it
|
|
30
|
+
* naming it, its ancestors with it. So no pack loads a folder list, and
|
|
31
31
|
* two packs can no longer disagree about a folder they both hold.
|
|
32
32
|
*
|
|
33
33
|
* **The order the passes run in is derived, not declared** — see
|
|
34
34
|
* {@link orderPassesByDependency}. The declared list is the manifest's `packs`
|
|
35
35
|
* array as well, so it is ordered for a reader; a pass that reads another's
|
|
36
|
-
* output states that on its compiler and is scheduled after it
|
|
36
|
+
* output states that on its compiler and is scheduled after it.
|
|
37
37
|
*
|
|
38
38
|
* This replaces the retired `packs:export` (vault → committed `_source/`); the
|
|
39
39
|
* HeroicLands vault is no longer a build input for SoHL content.
|
|
@@ -62,15 +62,15 @@ import {
|
|
|
62
62
|
} from "./folder-notes.mjs";
|
|
63
63
|
import { countContentNotes } from "./content-tree.mjs";
|
|
64
64
|
import { emitDiagnostic } from "./diagnostics.mjs";
|
|
65
|
-
// The corpus every pass runs over, derived once
|
|
65
|
+
// The corpus every pass runs over, derived once.
|
|
66
66
|
import { buildCompileCorpus } from "./compile-corpus.mjs";
|
|
67
|
-
// The record accessors only — see `engine/index-records.mjs
|
|
67
|
+
// The record accessors only — see `engine/index-records.mjs`.
|
|
68
68
|
import { isNoteRecord, noteFile } from "./index-records.mjs";
|
|
69
69
|
import { loadPackConfig } from "./pack-config.mjs";
|
|
70
70
|
import { routerFor } from "./pack-router.mjs";
|
|
71
71
|
import { NEVER_PACKED_TYPES, unclaimedNoteFindings } from "./note-claims.mjs";
|
|
72
72
|
// Which document a content type compiles into, so the art declaration below is
|
|
73
|
-
// answered from the same routing the compile uses
|
|
73
|
+
// answered from the same routing the compile uses.
|
|
74
74
|
import { RETIRED_TYPES, currentType, packForType } from "./ids.mjs";
|
|
75
75
|
import { contentPackage } from "./content-package.mjs";
|
|
76
76
|
|
|
@@ -90,7 +90,7 @@ import { contentPackage } from "./content-package.mjs";
|
|
|
90
90
|
* system-neutral passes have one implementation because a JournalEntry, a
|
|
91
91
|
* Macro, a Scene and an Adventure are Foundry's documents rather than any
|
|
92
92
|
* system's — an `Adventure` does not even have a `system` field, which is why a
|
|
93
|
-
* bundle spanning two systems is two documents
|
|
93
|
+
* bundle spanning two systems is two documents.
|
|
94
94
|
*/
|
|
95
95
|
const COMPILERS = {
|
|
96
96
|
Item: Items,
|
|
@@ -102,7 +102,7 @@ const COMPILERS = {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
* The system-specific compilers, by the system a pack declares
|
|
105
|
+
* The system-specific compilers, by the system a pack declares.
|
|
106
106
|
*
|
|
107
107
|
* A repository feeding two systems declares one Item pack and one Actor pack
|
|
108
108
|
* per system — `harn-ensemble` has `actors-hm3` and `actors-sohl` — and each
|
|
@@ -138,7 +138,7 @@ export function compilerFor(docType, system = null) {
|
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* The art fields a note of one content type reaches its document through, and
|
|
141
|
-
* the document it reaches
|
|
141
|
+
* the document it reaches.
|
|
142
142
|
*
|
|
143
143
|
* **Derived, never listed.** A note's type routes to a document type
|
|
144
144
|
* ({@link packForType}), a document type routes to the pass that compiles it
|
|
@@ -201,7 +201,7 @@ export const packJsonDir = (name, config = loadPackConfig()) =>
|
|
|
201
201
|
* The generated JSON of **every** configured Item pack — what the actors pass
|
|
202
202
|
* reads its predefined items from.
|
|
203
203
|
*
|
|
204
|
-
* All of them, not the first: a repository may ship several Item packs
|
|
204
|
+
* All of them, not the first: a repository may ship several Item packs,
|
|
205
205
|
* and an actor's embedded items may be sourced from any of them. Finding one
|
|
206
206
|
* pack and stopping is how embedded-item resolution would silently miss every
|
|
207
207
|
* item that landed in another. Returned in configured order, which is also the
|
|
@@ -209,7 +209,7 @@ export const packJsonDir = (name, config = loadPackConfig()) =>
|
|
|
209
209
|
* order among packs of one type — and every one of them is written before the
|
|
210
210
|
* actors pass that reads them.
|
|
211
211
|
*
|
|
212
|
-
* **Scoped to one system when the caller has one
|
|
212
|
+
* **Scoped to one system when the caller has one.** A being addresses an
|
|
213
213
|
* item by `(type, shortcode)`, and that address is unique within one system and
|
|
214
214
|
* not across two: `skill:sword` is an HM3 skill *and* a SoHL skill, with
|
|
215
215
|
* different data models behind them. The reference itself is unambiguous — it
|
|
@@ -227,7 +227,7 @@ export const packJsonDir = (name, config = loadPackConfig()) =>
|
|
|
227
227
|
* @returns {string[]} Each Item pack's JSON directory. Empty when the
|
|
228
228
|
* repository ships no items at all, which is a legitimate package: the actors
|
|
229
229
|
* pass accepts an empty list and reports an item it cannot resolve per
|
|
230
|
-
* `(type, shortcode)` instead, naming the being
|
|
230
|
+
* `(type, shortcode)` instead, naming the being.
|
|
231
231
|
*/
|
|
232
232
|
export function itemPackJsonDirs(config = loadPackConfig(), system = null) {
|
|
233
233
|
return config.packs
|
|
@@ -242,7 +242,7 @@ export function itemPackJsonDirs(config = loadPackConfig(), system = null) {
|
|
|
242
242
|
* An `Adventure` carries **copies**, not references, so a bundle resolves its
|
|
243
243
|
* `contents` against compiled output rather than against the content tree — the
|
|
244
244
|
* same arrangement the actors pass has for `itemsSourceDirs`, generalised to
|
|
245
|
-
* every document class an Adventure can hold
|
|
245
|
+
* every document class an Adventure can hold.
|
|
246
246
|
*
|
|
247
247
|
* Two kinds of pack are left out, each because it holds nothing a note
|
|
248
248
|
* addresses. A **prebuilt** pack's JSON is checked in rather than compiled, so
|
|
@@ -294,7 +294,7 @@ function readsOutputOf(type) {
|
|
|
294
294
|
/**
|
|
295
295
|
* The passes to run, ordered so that each one follows the output it reads.
|
|
296
296
|
*
|
|
297
|
-
* **Declaration order is presentation, not compile order
|
|
297
|
+
* **Declaration order is presentation, not compile order.** The same
|
|
298
298
|
* `packs:` list is the manifest's `packs` array, which a consumer orders for a
|
|
299
299
|
* reader browsing compendiums; the actors pass, meanwhile, resolves each
|
|
300
300
|
* being's embedded items against the item passes' *output*. Making one list
|
|
@@ -403,6 +403,11 @@ export function unsatisfiedPassDependencies(running, config) {
|
|
|
403
403
|
* document type that routes nowhere. True for the first configured pack of
|
|
404
404
|
* the type, so one unroutable note yields one error rather than one per
|
|
405
405
|
* pack.
|
|
406
|
+
* @param {object} folderNotes - The folder index, which resolves a note's
|
|
407
|
+
* `packFolder` address to a Foundry folder id and its ancestor chain.
|
|
408
|
+
* @param {object} corpus - The corpus this compile derived once, shared by
|
|
409
|
+
* every pass so that no two answer "which files are the corpus?"
|
|
410
|
+
* differently.
|
|
406
411
|
* @returns {Promise<{errors: number, compiled: number}>} The compiler's error
|
|
407
412
|
* count (0 on success) and the number of entries it wrote.
|
|
408
413
|
*/
|
|
@@ -431,7 +436,7 @@ async function generatePack(
|
|
|
431
436
|
// Which folder notes this pack turned out to hold something for. A folder
|
|
432
437
|
// materialises in every pack holding a document that references it, so the
|
|
433
438
|
// set is not knowable until the pass has compiled, which is why these
|
|
434
|
-
// documents are written after `compile()
|
|
439
|
+
// documents are written after `compile()`.
|
|
435
440
|
/** @type {Set<import("./folder-notes.mjs").FolderNote>} */
|
|
436
441
|
const referencedFolders = new Set();
|
|
437
442
|
|
|
@@ -441,7 +446,7 @@ async function generatePack(
|
|
|
441
446
|
* There is one spelling. `packFolder` names a folder **note**, resolved
|
|
442
447
|
* through the address index shared by the whole build; the `folder:`
|
|
443
448
|
* Foundry-id spelling and the per-pack `*-folders.yaml` it resolved
|
|
444
|
-
* against are retired together
|
|
449
|
+
* against are retired together, so there is no second source left
|
|
445
450
|
* for a value to come from.
|
|
446
451
|
*
|
|
447
452
|
* @param {string|null|undefined} value - As authored.
|
|
@@ -481,38 +486,38 @@ async function generatePack(
|
|
|
481
486
|
const pack = new packClass({
|
|
482
487
|
contentBase,
|
|
483
488
|
dest,
|
|
484
|
-
// The corpus this compile derived once, shared by every pass
|
|
489
|
+
// The corpus this compile derived once, shared by every pass.
|
|
485
490
|
corpus,
|
|
486
491
|
companionDests,
|
|
487
492
|
// The actors pass resolves each being's embedded items against the items
|
|
488
|
-
// passes' output.
|
|
493
|
+
// passes' output. An unwritten sibling-directory contract
|
|
489
494
|
// (`path.resolve(dest, "..", "items")`); the configured pack list names
|
|
490
495
|
// the Item packs, so the dependency is stated rather than assumed
|
|
491
|
-
//
|
|
492
|
-
// than one
|
|
496
|
+
// — and it is every Item pack, since a repository may ship more
|
|
497
|
+
// than one.
|
|
493
498
|
// Scoped to this pack's system, so a being resolves `(type, shortcode)`
|
|
494
|
-
// against its own system's catalogue and the neutral one
|
|
499
|
+
// against its own system's catalogue and the neutral one.
|
|
495
500
|
itemsSourceDirs: itemPackJsonDirs(config, system ?? null),
|
|
496
501
|
// The catalogue of a package this repository depends on but does
|
|
497
502
|
// not contain, for a repository that authors beings without
|
|
498
503
|
// holding the items they are assembled from. Cache-only: a cold
|
|
499
504
|
// cache throws naming `content-build deps fetch` rather than
|
|
500
505
|
// downloading inside a compile. Scoped to this pack's system for the
|
|
501
|
-
// reason the local half is
|
|
506
|
+
// reason the local half is: both halves answer one lookup, so a
|
|
502
507
|
// dependency shipping two systems' items would otherwise supply the
|
|
503
508
|
// wrong vocabulary's document for an address that exists in both.
|
|
504
509
|
foreignSourceDirs: foreignItemCatalogDirs(config, system ?? null),
|
|
505
510
|
// The bundles pass resolves each Adventure's members against the output
|
|
506
511
|
// of every pass that produces one. Stated from the configured pack list
|
|
507
|
-
// for the same reason `itemsSourceDirs` is
|
|
512
|
+
// for the same reason `itemsSourceDirs` is, and scoped to this
|
|
508
513
|
// pack's system so a bundle holds the catalogue it is compiled for.
|
|
509
514
|
bundleSourceDirs: bundleSourceJsonDirs(config, system ?? null),
|
|
510
515
|
folderResolver: resolver,
|
|
511
516
|
// One answer to "which files are the corpus?", from the configuration
|
|
512
|
-
// this build resolved rather than from the working directory
|
|
517
|
+
// this build resolved rather than from the working directory.
|
|
513
518
|
skipDirectories: config.skipDirectories,
|
|
514
519
|
packName: name,
|
|
515
|
-
// Which system this pack's documents are stamped for
|
|
520
|
+
// Which system this pack's documents are stamped for.
|
|
516
521
|
packSystem: system ?? null,
|
|
517
522
|
docType: type,
|
|
518
523
|
router,
|
|
@@ -525,7 +530,7 @@ async function generatePack(
|
|
|
525
530
|
// journals pack both hold it when both hold something filed in it — and
|
|
526
531
|
// every copy carries the same `_id`, which is what files a documentation
|
|
527
532
|
// journal beside the item it describes rather than in a folder that merely
|
|
528
|
-
// looks alike
|
|
533
|
+
// looks alike.
|
|
529
534
|
writeFolderNoteDocs(
|
|
530
535
|
referencedFolders,
|
|
531
536
|
folderNotes,
|
|
@@ -579,7 +584,7 @@ function writeFolderNoteDocs(referenced, folderNotes, stats, dest, documentType,
|
|
|
579
584
|
*
|
|
580
585
|
* A pack ships blank whenever every note in a full tree was rejected — by a
|
|
581
586
|
* `selects` that claims nothing, or a `pack:` that routes everything elsewhere
|
|
582
|
-
* — and the build then exits 0
|
|
587
|
+
* — and the build then exits 0. The empty-tree guard in
|
|
583
588
|
* {@link generatePacksJson} cannot see that: the tree is full, it is the
|
|
584
589
|
* *output* that is empty.
|
|
585
590
|
*
|
|
@@ -644,11 +649,11 @@ export async function generatePacksJson({ only, config = loadPackConfig() } = {}
|
|
|
644
649
|
// goes, and the first pack of each document type owns the error message for
|
|
645
650
|
// a note of that type that goes nowhere. Resolved here because the corpus
|
|
646
651
|
// below is derived against it, and the corpus is what every reader from
|
|
647
|
-
// this point on reads
|
|
652
|
+
// this point on reads.
|
|
648
653
|
const router = routerFor(config);
|
|
649
654
|
|
|
650
655
|
// The corpus every pass runs over, and the three whole-tree indexes built
|
|
651
|
-
// over it, derived **once** for the whole compile
|
|
656
|
+
// over it, derived **once** for the whole compile. Each is a pure
|
|
652
657
|
// function of (tree, scope, router), none of which varies between passes —
|
|
653
658
|
// `router` is one object, handed to all of them — so the passes were
|
|
654
659
|
// deriving the same answers over and over. Compiling `sohl` read every note
|
|
@@ -668,11 +673,11 @@ export async function generatePacksJson({ only, config = loadPackConfig() } = {}
|
|
|
668
673
|
for (const problem of corpusProblems) emitDiagnostic(problem);
|
|
669
674
|
|
|
670
675
|
// A note whose `type:` no configured pack claims compiles into nothing, and
|
|
671
|
-
// used to say nothing
|
|
676
|
+
// used to say nothing — no pass got far enough to reject it, so the
|
|
672
677
|
// silence had no owner. Asked once, of the whole configuration, because
|
|
673
678
|
// that is the only place it can be answered: a per-pass check would report
|
|
674
679
|
// every type a system deliberately does not map, which is exactly the
|
|
675
|
-
// silence
|
|
680
|
+
// silence the rule requires. Independent of `only`, since it is a fact about the
|
|
676
681
|
// configured pack list rather than about which passes this run executes.
|
|
677
682
|
const unclaimed = unclaimedNoteFindings(config, undefined, { records: corpus.records });
|
|
678
683
|
for (const finding of unclaimed) emitDiagnostic(finding);
|
|
@@ -684,7 +689,7 @@ export async function generatePacksJson({ only, config = loadPackConfig() } = {}
|
|
|
684
689
|
//
|
|
685
690
|
// A **prebuilt** pack has no pass either, and for a plainer reason: its
|
|
686
691
|
// per-document JSON is checked in. Passed over rather than compiled — which
|
|
687
|
-
// it could not be
|
|
692
|
+
// it could not be otherwise, since the only prebuilt pack in the wild
|
|
688
693
|
// holds Adventures and no compiler was registered for that document type,
|
|
689
694
|
// so the pack failed the build with "no compiler for document type". Now
|
|
690
695
|
// one is registered, and running it would wipe `build/packs-json/<name>/`
|
|
@@ -700,12 +705,12 @@ export async function generatePacksJson({ only, config = loadPackConfig() } = {}
|
|
|
700
705
|
// definition with one address, and every pass resolves against the same
|
|
701
706
|
// index. A dangling `parent` or a parent cycle is therefore reported once,
|
|
702
707
|
// as a fact about the tree, rather than once per pass that happened to walk
|
|
703
|
-
// it
|
|
708
|
+
// it.
|
|
704
709
|
let folderNotes;
|
|
705
710
|
try {
|
|
706
711
|
folderNotes = buildFolderNoteIndex(
|
|
707
712
|
collectFolderNotes(
|
|
708
|
-
// The corpus this compile derived picks the notes
|
|
713
|
+
// The corpus this compile derived picks the notes; the
|
|
709
714
|
// file supplies their frontmatter, and this is one of the few
|
|
710
715
|
// places where that distinction is load-bearing rather than
|
|
711
716
|
// incidental.
|
|
@@ -713,8 +718,8 @@ export async function generatePacksJson({ only, config = loadPackConfig() } = {}
|
|
|
713
718
|
// `collectFolderNotes` treats `fm.id` as an **authored pin**,
|
|
714
719
|
// which wins over the id it derives under the folder namespace.
|
|
715
720
|
// A record's `id` is not that: the index fills it in for every
|
|
716
|
-
// addressable note
|
|
717
|
-
// would make every folder look pinned.
|
|
721
|
+
// addressable note, so handing records straight over
|
|
722
|
+
// would make every folder look pinned. The *value*
|
|
718
723
|
// would be right either way — the index derives a folder's id
|
|
719
724
|
// under the folder namespace, so the two agree — but `derivedId`
|
|
720
725
|
// would not, and it is what tells an author whether a duplicate
|
|
@@ -734,7 +739,7 @@ export async function generatePacksJson({ only, config = loadPackConfig() } = {}
|
|
|
734
739
|
// The package this build resolved, not the ambient accessor:
|
|
735
740
|
// they are the same value in a real repository and different
|
|
736
741
|
// ones under `PACKAGE_BUILD_CONFIG`, in a worktree, or in a
|
|
737
|
-
// test
|
|
742
|
+
// test.
|
|
738
743
|
config.contentPackage,
|
|
739
744
|
),
|
|
740
745
|
);
|
|
@@ -754,7 +759,7 @@ export async function generatePacksJson({ only, config = loadPackConfig() } = {}
|
|
|
754
759
|
|
|
755
760
|
// Compile order is derived from what each pass reads, not from the order
|
|
756
761
|
// `packs:` declares — that list is also the manifest's, which a consumer
|
|
757
|
-
// orders for a reader
|
|
762
|
+
// orders for a reader.
|
|
758
763
|
const ordered = orderPassesByDependency(packs);
|
|
759
764
|
if (ordered.some((pack, index) => pack !== packs[index])) {
|
|
760
765
|
log.info(
|