@heroiclands/package-build 21.0.0 → 21.2.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 +228 -0
- package/CONTENT.md +109 -7
- package/assets/fonts/libertinus/LibertinusMono-Regular.otf +0 -0
- package/assets/fonts/libertinus/LibertinusSans-Bold.otf +0 -0
- package/assets/fonts/libertinus/LibertinusSans-Italic.otf +0 -0
- package/assets/fonts/libertinus/LibertinusSans-Regular.otf +0 -0
- package/assets/fonts/libertinus/OFL.txt +94 -0
- package/assets/fonts/libertinus/provenance.yaml +11 -0
- package/assets/images/banners/afflictionbnr.webp +0 -0
- package/assets/images/banners/armorclothingbnr.webp +0 -0
- package/assets/images/banners/attributebnr.webp +0 -0
- package/assets/images/banners/containerbnr.webp +0 -0
- package/assets/images/banners/devdocsbnr.webp +0 -0
- package/assets/images/banners/miscgearbnr.webp +0 -0
- package/assets/images/banners/mysticalabilitybnr.webp +0 -0
- package/assets/images/banners/projectilebnr.webp +0 -0
- package/assets/images/banners/rulesbnr.webp +0 -0
- package/assets/images/banners/skillbnr.webp +0 -0
- package/assets/images/banners/traumabnr.webp +0 -0
- package/assets/images/banners/userguidebnr.webp +0 -0
- package/assets/images/banners/weapongearbnr.webp +0 -0
- package/assets/images/provenance.yaml +4 -0
- package/bin/content-build.mjs +19 -5
- package/ci/emit-asset-index.mjs +32 -0
- package/content-config.mjs +30 -1
- package/docs/api.md +100 -26
- package/docs/configuration.md +16 -7
- package/docs/content-format.md +512 -109
- package/engine/actor-compiler.mjs +58 -9
- package/engine/art-fields.mjs +292 -0
- package/engine/asset-index.mjs +397 -0
- package/engine/asset-types.mjs +192 -0
- package/engine/base-compiler.mjs +69 -1
- package/engine/bundles.mjs +5 -5
- package/engine/compile-corpus.mjs +4 -0
- package/engine/content-address.mjs +14 -2
- package/engine/content-charset.mjs +5 -1
- package/engine/content-embeds.mjs +314 -0
- package/engine/content-html.mjs +5 -1
- package/engine/content-icons.mjs +5 -1
- package/engine/content-images.mjs +26 -5
- package/engine/content-index.mjs +68 -33
- package/engine/content-links.mjs +164 -24
- package/engine/frontmatter-lint.mjs +36 -23
- package/engine/helpers.mjs +83 -31
- package/engine/index-records.mjs +63 -4
- package/engine/index.mjs +15 -0
- package/engine/infobox-registry.mjs +50 -3
- package/engine/infobox-render.mjs +4 -3
- package/engine/infobox.mjs +12 -8
- package/engine/item-compiler.mjs +10 -10
- package/engine/journals.mjs +3 -0
- package/engine/macros.mjs +16 -13
- package/engine/map-notes.mjs +29 -22
- package/engine/metadata-index.mjs +44 -36
- package/engine/note-vocabulary.mjs +71 -29
- package/engine/pack-router.mjs +14 -0
- package/engine/packagebuild-index.mjs +124 -0
- package/engine/packages.mjs +83 -0
- package/engine/pathnames.mjs +74 -0
- package/engine/pdf-build.mjs +133 -10
- package/engine/pdf-render.mjs +41 -41
- package/engine/scenes.mjs +12 -9
- package/engine/site-build.mjs +43 -16
- package/engine/site-index.mjs +10 -1
- package/engine/subtype-registry.mjs +21 -0
- package/engine/web-wikilinks.mjs +46 -12
- package/engine/wikilink-syntax.mjs +20 -2
- package/engine/wikilinks.mjs +15 -2
- package/hm3/actors.mjs +11 -38
- package/hm3/infobox.mjs +1 -1
- package/package.json +5 -2
- package/packagebuild-metadata.jsonl +13 -0
- package/sohl/actors.mjs +12 -86
- package/sohl/infobox.mjs +1 -1
- package/sohl/note-schemas.mjs +4 -16
- package/types/content-config.d.mts +8 -0
- package/types/engine/actor-compiler.d.mts +29 -0
- package/types/engine/art-fields.d.mts +192 -0
- package/types/engine/asset-index.d.mts +92 -0
- package/types/engine/asset-types.d.mts +110 -0
- package/types/engine/base-compiler.d.mts +42 -1
- package/types/engine/compile-corpus.d.mts +4 -1
- package/types/engine/content-charset.d.mts +4 -0
- package/types/engine/content-embeds.d.mts +218 -0
- package/types/engine/content-html.d.mts +4 -0
- package/types/engine/content-icons.d.mts +4 -0
- package/types/engine/content-images.d.mts +15 -2
- package/types/engine/content-index.d.mts +27 -15
- package/types/engine/frontmatter-lint.d.mts +11 -14
- package/types/engine/helpers.d.mts +7 -2
- package/types/engine/index-records.d.mts +44 -3
- package/types/engine/index.d.mts +5 -0
- package/types/engine/infobox-registry.d.mts +36 -1
- package/types/engine/infobox.d.mts +6 -4
- package/types/engine/macros.d.mts +9 -5
- package/types/engine/map-notes.d.mts +10 -6
- package/types/engine/metadata-index.d.mts +2 -17
- package/types/engine/note-vocabulary.d.mts +30 -0
- package/types/engine/packagebuild-index.d.mts +56 -0
- package/types/engine/packages.d.mts +62 -0
- package/types/engine/pathnames.d.mts +41 -81
- package/types/engine/pdf-build.d.mts +58 -1
- package/types/engine/pdf-render.d.mts +3 -3
- package/types/engine/scenes.d.mts +2 -1
- package/types/engine/site-build.d.mts +5 -1
- package/types/engine/site-index.d.mts +4 -1
- package/types/engine/subtype-registry.d.mts +20 -0
- package/types/engine/web-wikilinks.d.mts +14 -4
- package/types/engine/wikilink-syntax.d.mts +13 -1
- package/types/engine/wikilinks.d.mts +7 -1
- package/types/sohl/actors.d.mts +0 -1
|
@@ -47,6 +47,26 @@ export function schemaSubtypeOf(system: string | undefined, type: string): strin
|
|
|
47
47
|
* @type {readonly import("./document-subtypes.mjs").DocumentSubtypeMap[]}
|
|
48
48
|
*/
|
|
49
49
|
export const KNOWN_DOCUMENT_SUBTYPE_MAPS: readonly import("./document-subtypes.mjs").DocumentSubtypeMap[];
|
|
50
|
+
/**
|
|
51
|
+
* The map a pack declaring no `system:` compiles its documents against.
|
|
52
|
+
*
|
|
53
|
+
* A pack names the system its documents are shaped for, and one declaring none
|
|
54
|
+
* is compiled by the fallback pass for its document type — a single-system
|
|
55
|
+
* package's ordinary arrangement, and the one `sohl-thalorna` ships. That pass
|
|
56
|
+
* follows one map whatever a note carries, which makes this the answer to "a
|
|
57
|
+
* document compiled here belongs to *which* system?" wherever a pack has not
|
|
58
|
+
* said.
|
|
59
|
+
*
|
|
60
|
+
* Stated here rather than read off the compiler classes because those are not
|
|
61
|
+
* reachable from a leaf: `engine/item-compiler.mjs` imports the journals pass,
|
|
62
|
+
* which draws infoboxes, so anything the infobox reads cannot import a pass.
|
|
63
|
+
* `tests/default-document-subtypes.test.ts` holds this to `compilerFor`, which
|
|
64
|
+
* is where the fallback is actually decided — so the two cannot drift apart in
|
|
65
|
+
* silence.
|
|
66
|
+
*
|
|
67
|
+
* @type {import("./document-subtypes.mjs").DocumentSubtypeMap}
|
|
68
|
+
*/
|
|
69
|
+
export const DEFAULT_DOCUMENT_SUBTYPES: import("./document-subtypes.mjs").DocumentSubtypeMap;
|
|
50
70
|
/**
|
|
51
71
|
* Every note type any shipped map compiles into an **Actor**.
|
|
52
72
|
*
|
|
@@ -66,15 +66,25 @@ export function frontmatterWikilinks(fm: unknown): Array<{
|
|
|
66
66
|
* web pages, so the author wrote a real address and there is simply nothing to
|
|
67
67
|
* link to.
|
|
68
68
|
*
|
|
69
|
+
* ## Embeds first, and they are not links
|
|
70
|
+
*
|
|
71
|
+
* `![[address|label]]` names a file rather than a note, so it is resolved into
|
|
72
|
+
* an ordinary markdown image before anything looks for a link — which is what
|
|
73
|
+
* stops the link pass reading an embed's interior as a link to a note nobody
|
|
74
|
+
* wrote. The image the rewrite leaves behind is what
|
|
75
|
+
* {@link module:engine/content-images.renderImageFigures} turns into a figure
|
|
76
|
+
* for the website, and what the book reads its staging list out of.
|
|
77
|
+
*
|
|
69
78
|
* @param {string} body - The markdown body.
|
|
70
|
-
* @param {object} ctx - `{ index, collide, sections, contentTypes,
|
|
71
|
-
* foreign, type, errors, src, file }`.
|
|
79
|
+
* @param {object} ctx - `{ index, assets, collide, sections, contentTypes,
|
|
80
|
+
* packages, foreign, type, errors, src, file }`.
|
|
72
81
|
* `packages` is every package an address may name, without which the leading
|
|
73
82
|
* package segment of a canonical address reads as an unknown type; `foreign`
|
|
74
|
-
* is the cross-package manifest index
|
|
83
|
+
* is the cross-package manifest index; `assets` is the address space an embed
|
|
84
|
+
* resolves against. `src` is the page's display
|
|
75
85
|
* path and `file` the source file a diagnostic should name — absent, `src`
|
|
76
86
|
* stands in.
|
|
77
|
-
* @returns {string} The body with wikilinks rewritten.
|
|
87
|
+
* @returns {string} The body with embeds and wikilinks rewritten.
|
|
78
88
|
*/
|
|
79
89
|
export function resolveWebWikilinks(body: string, ctx: object): string;
|
|
80
90
|
export { slugify };
|
|
@@ -128,15 +128,18 @@ export function ambiguousAddressMessage(target: string, packages?: Iterable<stri
|
|
|
128
128
|
* @param {Iterable<string>} [finding.packages] - For `ambiguous`, the
|
|
129
129
|
* claimants.
|
|
130
130
|
* @param {string} [finding.anchor] - For `unknown-anchor`, the section named.
|
|
131
|
+
* @param {string} [finding.type] - For `not-an-asset`, the type the address
|
|
132
|
+
* named.
|
|
131
133
|
* @returns {string} The message.
|
|
132
134
|
* @throws {Error} On a reason outside the closed set — a resolver inventing one
|
|
133
135
|
* would otherwise report a link with no explanation at all.
|
|
134
136
|
*/
|
|
135
|
-
export function linkFindingMessage({ reason, target, packages, anchor }: {
|
|
137
|
+
export function linkFindingMessage({ reason, target, packages, anchor, type }: {
|
|
136
138
|
reason: string;
|
|
137
139
|
target: string;
|
|
138
140
|
packages?: Iterable<string> | undefined;
|
|
139
141
|
anchor?: string | undefined;
|
|
142
|
+
type?: string | undefined;
|
|
140
143
|
}): string;
|
|
141
144
|
/**
|
|
142
145
|
* Whether a parsed link addresses a section of the page it is written on.
|
|
@@ -193,6 +196,13 @@ export function isSamePage({ target, anchor }: ParsedWikilink): boolean;
|
|
|
193
196
|
* unclosed `[[` is a typo, and the alternative is letting it swallow arbitrary
|
|
194
197
|
* prose in search of a closer. Erring towards "not a link" leaves the author's
|
|
195
198
|
* text as written, which is the safe direction for a rewriter.
|
|
199
|
+
*
|
|
200
|
+
* **A leading `!` makes it an embed, not a link**, and the lookbehind is what
|
|
201
|
+
* keeps every reader from seeing one as the other. Stated here rather than in
|
|
202
|
+
* each reader for the reason the rest of this module exists: the checker, the
|
|
203
|
+
* pack compilers and the web resolver all match on this pattern, and three
|
|
204
|
+
* copies of the exclusion is three places for it to be forgotten. An embed's
|
|
205
|
+
* own grammar is {@link module:engine/content-embeds}.
|
|
196
206
|
*/
|
|
197
207
|
export const WIKILINK: RegExp;
|
|
198
208
|
/**
|
|
@@ -207,7 +217,9 @@ export const WIKILINK: RegExp;
|
|
|
207
217
|
*
|
|
208
218
|
* - `unlabelled` — no `|`, so the link addresses nothing.
|
|
209
219
|
* - `not-an-address` — labelled, but the target does not parse as an address.
|
|
220
|
+
* - `not-lowercase` — a package, system or type segment carries a capital.
|
|
210
221
|
* - `unknown-type` — definitely qualified, but names no type this build knows.
|
|
222
|
+
* - `not-an-asset` — a real address, embedded where only a file can be drawn.
|
|
211
223
|
* - `unresolved` — parses as an address, and nothing publishes it.
|
|
212
224
|
* - `ambiguous` — more than one package publishes the short address.
|
|
213
225
|
* - `unknown-anchor` — the address resolved, the `#section` it names did not.
|
|
@@ -128,6 +128,10 @@ export function anchorPageId(noteId: string, anchorSlug: string): string;
|
|
|
128
128
|
* vendored manifests of packages this build links into but does not publish.
|
|
129
129
|
* @param {string} [contentPackage] - This build's *content* package, which an
|
|
130
130
|
* authored address may name explicitly. Defaults to `packageId`.
|
|
131
|
+
* @param {object} [opts] - Options.
|
|
132
|
+
* @param {Map<string, object>} [opts.assets] - The files this package ships, by
|
|
133
|
+
* canonical address. They resolve no link — an asset is not a document — and
|
|
134
|
+
* answer only the art fields, which name a file and never a document.
|
|
131
135
|
* @returns {{byShortcode: Map<string, object>, types: Set<string>}} `types` is
|
|
132
136
|
* every type the tree actually contains, so a qualifier naming no real type
|
|
133
137
|
* can be told apart from a missing target.
|
|
@@ -140,7 +144,9 @@ export function buildWikilinkIndex(docs: Array<{
|
|
|
140
144
|
pack?: string;
|
|
141
145
|
docPack?: string;
|
|
142
146
|
draft?: boolean;
|
|
143
|
-
}>, packageId: string, foreign?: Map<string, object>, contentPackage?: string
|
|
147
|
+
}>, packageId: string, foreign?: Map<string, object>, contentPackage?: string, { assets }?: {
|
|
148
|
+
assets?: Map<string, object> | undefined;
|
|
149
|
+
}): {
|
|
144
150
|
byShortcode: Map<string, object>;
|
|
145
151
|
types: Set<string>;
|
|
146
152
|
};
|