@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.
- package/CHANGELOG.md +97 -0
- package/CONTENT.md +111 -92
- package/README.md +2 -9
- package/bin/content-build.mjs +70 -61
- package/bin/package-build.mjs +2 -2
- package/config.mjs +6 -8
- package/content-config.mjs +187 -64
- package/docs/content-format.md +57 -68
- package/e2e.mjs +4 -4
- package/engine/actor-compiler.mjs +36 -36
- package/engine/address-charset.mjs +6 -6
- package/engine/address-diff.mjs +12 -11
- package/engine/anchored-sections.mjs +1 -1
- package/engine/anchors.mjs +1 -1
- package/engine/base-compiler.mjs +36 -38
- package/engine/bundle-notes.mjs +4 -4
- package/engine/bundles.mjs +8 -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 +15 -15
- 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 +225 -98
- package/engine/content-index.mjs +17 -17
- package/engine/content-links.mjs +30 -30
- package/engine/content-lint.mjs +20 -24
- package/engine/content-package.mjs +7 -9
- package/engine/content-slug.mjs +2 -2
- package/engine/content-tables.mjs +7 -8
- 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 +14 -14
- package/engine/foreign-catalog.mjs +8 -9
- package/engine/foundry-entries.mjs +19 -20
- package/engine/frontmatter-lint.mjs +64 -69
- package/engine/frontmatter.mjs +11 -11
- package/engine/generate.mjs +39 -39
- package/engine/helpers.mjs +63 -54
- package/engine/homepage.mjs +20 -22
- package/engine/ids.mjs +15 -15
- package/engine/index-records.mjs +4 -4
- package/engine/index.mjs +14 -8
- 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 +15 -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 +36 -34
- 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 -3
- package/engine/note-vocabulary.mjs +27 -26
- package/engine/pack-config.mjs +13 -13
- package/engine/pack-router.mjs +0 -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 +19 -20
- package/engine/schema-check.mjs +20 -20
- package/engine/schema-extract.mjs +1 -1
- package/engine/site-build.mjs +45 -47
- 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 +35 -35
- package/engine/wikilink-syntax.mjs +16 -16
- package/engine/wikilinks.mjs +39 -39
- package/hm3/actors.mjs +22 -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 +20 -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 +3 -3
- package/sohl/actors.mjs +28 -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 +20 -6
- package/sohl/kb-passes.mjs +5 -5
- package/sohl/note-schemas.mjs +7 -7
- package/sohl/skill-base.mjs +1 -1
- package/types/content-config.d.mts +25 -24
- package/types/e2e.d.mts +3 -3
- package/types/engine/actor-compiler.d.mts +14 -13
- package/types/engine/address-charset.d.mts +6 -6
- package/types/engine/address-diff.d.mts +3 -3
- package/types/engine/base-compiler.d.mts +17 -19
- package/types/engine/bundle-notes.d.mts +3 -3
- package/types/engine/bundles.d.mts +1 -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 +11 -11
- 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 +150 -62
- package/types/engine/content-index.d.mts +2 -2
- package/types/engine/content-links.d.mts +8 -8
- package/types/engine/content-lint.d.mts +2 -2
- package/types/engine/content-package.d.mts +6 -8
- 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 +7 -7
- package/types/engine/frontmatter.d.mts +7 -7
- package/types/engine/generate.d.mts +7 -7
- package/types/engine/helpers.d.mts +25 -27
- 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 +2 -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 +3 -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 +16 -15
- 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 +9 -8
- package/types/engine/pack-config.d.mts +3 -3
- package/types/engine/pack-router.d.mts +1 -1
- 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/schema-check.d.mts +11 -11
- package/types/engine/site-build.d.mts +18 -19
- 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 +13 -12
- package/types/hm3/actors.d.mts +1 -1
- package/types/hm3/document-subtypes.d.mts +1 -1
- package/types/hm3/items.d.mts +1 -2
- package/types/hm3/template-priority.d.mts +1 -1
- package/types/manifest.d.mts +8 -8
- package/types/sohl/actors.d.mts +2 -2
- 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 +1 -2
- package/types/sohl/note-schemas.d.mts +1 -1
- 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
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
30
|
+
* a fact it has to be told.
|
|
31
31
|
*
|
|
32
|
-
* **An entry's `path` is derivable from the key it is filed under
|
|
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
|
|
39
|
-
* derivable that way
|
|
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
|
|
128
|
-
* note is the same arrangement
|
|
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
|
|
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
|
|
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:`;
|
|
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
|
|
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
|
|
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
|
|
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
|
-
//
|
|
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
|
|
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
|
|
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
|
|
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,
|