@heroiclands/package-build 23.1.0 → 23.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 +71 -0
- package/bin/content-commands.mjs +68 -149
- package/bin/package-build.mjs +56 -10
- package/ci/check-banners.mjs +42 -6
- package/ci/confirm-npm-version.mjs +135 -0
- package/ci/content-format-reference.mjs +14 -5
- package/config.mjs +1 -0
- package/container.mjs +185 -4
- package/content-config.mjs +333 -210
- package/deploy.mjs +116 -10
- package/docs/api.md +238 -246
- package/docs/authoring/assets.md +11 -5
- package/docs/authoring/frontmatter.md +1 -1
- package/docs/authoring/links-and-markup.md +87 -0
- package/docs/commands.md +138 -99
- package/docs/configuration.md +277 -125
- package/docs/content-format.md +2 -0
- package/docs/diagnostics.md +48 -13
- package/docs/guides/book.md +341 -21
- package/docs/guides/e2e.md +13 -2
- package/docs/guides/icons.md +14 -4
- package/docs/guides/module-project.md +18 -8
- package/docs/guides/release-and-deploy.md +54 -6
- package/docs/guides/site.md +5 -2
- package/docs/project-setup.md +30 -10
- package/docs/reference/format-details.md +373 -170
- package/docs/reference/note-types.md +128 -109
- package/docs/reference/theme-pages.md +31 -6
- package/e2e.mjs +140 -28
- package/engine/actor-compiler.mjs +22 -31
- package/engine/address-charset.mjs +4 -17
- package/engine/address-fields.mjs +1 -1
- package/engine/address-render.mjs +12 -1
- package/engine/address-values.mjs +6 -0
- package/engine/address.mjs +46 -33
- package/engine/art-fields.mjs +30 -5
- package/engine/art-slots.mjs +10 -1
- package/engine/asset-bindings.mjs +12 -1
- package/engine/base-compiler.mjs +34 -65
- package/engine/being-age.mjs +2 -7
- package/engine/being-measurements.mjs +12 -1
- package/engine/calendar-artifacts.mjs +6 -0
- package/engine/calendar-choice.mjs +12 -1
- package/engine/calendar-format.mjs +12 -1
- package/engine/calendar-human.mjs +12 -1
- package/engine/compile-corpus.mjs +3 -1
- package/engine/content-address.mjs +9 -12
- package/engine/content-alerts.mjs +13 -1
- package/engine/content-blocks.mjs +14 -3
- package/engine/content-embeds.mjs +11 -3
- package/engine/content-figures.mjs +9 -0
- package/engine/content-footnotes.mjs +12 -1
- package/engine/content-format-check.mjs +11 -262
- package/engine/content-format.yaml +5 -2
- package/engine/content-images.mjs +3 -0
- package/engine/content-index.mjs +443 -20
- package/engine/content-links.mjs +29 -35
- package/engine/content-lint.mjs +2 -3
- package/engine/content-poetry.mjs +12 -1
- package/engine/content-slug.mjs +2 -14
- package/engine/content-spans.mjs +13 -1
- package/engine/content-tables.mjs +12 -1
- package/engine/culture-choice.mjs +210 -13
- package/engine/data-keys.mjs +19 -16
- package/engine/date-conversion.mjs +12 -1
- package/engine/declaration-check.mjs +9 -0
- package/engine/derived-fields.mjs +6 -7
- package/engine/diagnostics.mjs +34 -4
- package/engine/docs-checks.mjs +9 -0
- package/engine/document-subtypes.mjs +47 -34
- package/engine/event-views.mjs +139 -14
- package/engine/exported-scene.mjs +92 -28
- package/engine/extension-attributes.mjs +12 -1
- package/engine/field-spec.mjs +11 -102
- package/engine/folder-notes.mjs +0 -64
- package/engine/foreign-catalog.mjs +2 -1
- package/engine/format-generated.mjs +9 -0
- package/engine/foundry-entries.mjs +10 -28
- package/engine/frontmatter-lint.mjs +83 -392
- package/engine/frontmatter.mjs +20 -70
- package/engine/generate.mjs +10 -15
- package/engine/heading-attributes.mjs +12 -1
- package/engine/helpers.mjs +41 -102
- package/engine/holdings.mjs +1 -1
- package/engine/homepage.mjs +3 -10
- package/engine/ids.mjs +1 -167
- package/engine/index-records.mjs +6 -4
- package/engine/index.mjs +0 -3
- package/engine/infobox-render.mjs +15 -3
- package/engine/infobox.mjs +13 -14
- package/engine/item-compiler.mjs +4 -10
- package/engine/item-docs.mjs +3 -5
- package/engine/item-registry.mjs +2 -10
- package/engine/journals.mjs +1 -5
- package/engine/literature-notes.mjs +4 -12
- package/engine/macros.mjs +1 -2
- package/engine/map-graphviz.mjs +12 -1
- package/engine/markdown-expressions.mjs +12 -1
- package/engine/markdownlint-run.mjs +567 -0
- package/engine/metadata-index.mjs +42 -12
- package/engine/note-addresses.mjs +143 -35
- package/engine/note-claims.mjs +14 -28
- package/engine/note-dates.mjs +3 -3
- package/engine/note-frontmatter.mjs +6 -0
- package/engine/note-ids.mjs +8 -14
- package/engine/note-package.mjs +8 -25
- package/engine/note-state.mjs +1 -3
- package/engine/note-vocabulary.mjs +148 -84
- package/engine/number-words.mjs +12 -1
- package/engine/pack-config.mjs +15 -25
- package/engine/pack-router.mjs +10 -16
- package/engine/pathnames.mjs +8 -22
- package/engine/pdf-build.mjs +773 -121
- package/engine/pdf-coverage.mjs +188 -0
- package/engine/pdf-index.mjs +54 -7
- package/engine/pdf-pages.mjs +247 -0
- package/engine/pdf-render.mjs +114 -4
- package/engine/pdf-toc.mjs +29 -32
- package/engine/project-init.mjs +46 -6
- package/engine/prose-config.mjs +1 -1
- package/engine/prose-lint.mjs +52 -88
- package/engine/readability-lint.mjs +9 -0
- package/engine/reckoning-markers.mjs +12 -1
- package/engine/reference-targets.mjs +7 -0
- package/engine/runtime-only-fields.mjs +5 -8
- package/engine/scene-levels.mjs +2 -2
- package/engine/scenes.mjs +1 -1
- package/engine/shortcode-references.mjs +7 -0
- package/engine/site-build.mjs +30 -16
- package/engine/site-index.mjs +10 -16
- package/engine/site-preview.mjs +6 -0
- package/engine/site-root.mjs +8 -1
- package/engine/social-tie-terms.mjs +12 -1
- package/engine/social-ties.mjs +3 -0
- package/engine/sql-tables.mjs +56 -20
- package/engine/standing-terms.mjs +11 -1
- package/engine/standings.mjs +11 -27
- package/engine/system-block.mjs +39 -141
- package/engine/system-vocabulary.mjs +6 -0
- package/engine/walk-files.mjs +69 -0
- package/engine/web-wikilinks.mjs +23 -3
- package/engine/wikilink-syntax.mjs +32 -21
- package/engine/wikilinks.mjs +27 -16
- package/engine/yaml-lint.mjs +7 -4
- package/githooks/attribution.mjs +8 -0
- package/githooks/commit-message.mjs +9 -0
- package/hm3/actors.mjs +9 -48
- package/hm3/default-item-art.mjs +9 -9
- package/hm3/item-fields.mjs +2 -9
- package/hm3/template-priority.mjs +6 -7
- package/hugo-theme/data/banner-kinds.yaml +78 -0
- package/hugo-theme/data/banners.yaml +2 -3
- package/hugo-theme/layouts/404.html +3 -3
- package/hugo-theme/layouts/partials/banner-url.html +31 -7
- package/hugo-theme/layouts/partials/hero-banner.html +13 -14
- package/hugo-theme/layouts/partials/related.html +1 -1
- package/hugo-theme/layouts/partials/warn-missing-banner.html +1 -1
- package/hugo-theme/static/css/style.css +1 -1
- package/manifest.mjs +11 -4
- package/markdownlint-config.mjs +1 -1
- package/package.json +6 -3
- package/release.mjs +83 -18
- package/sohl/actors.mjs +16 -27
- package/sohl/default-item-art.mjs +3 -3
- package/sohl/document-subtypes.mjs +1 -16
- package/sohl/infobox.mjs +2 -3
- package/sohl/item-builders.mjs +5 -8
- package/sohl/item-fields.mjs +5 -35
- package/sohl/items.mjs +0 -4
- package/sohl/kb-passes.mjs +3 -3
- package/types/container.d.mts +116 -5
- package/types/content-config.d.mts +83 -35
- package/types/deploy.d.mts +42 -6
- package/types/e2e.d.mts +35 -3
- package/types/engine/address-charset.d.mts +4 -17
- package/types/engine/address.d.mts +17 -8
- package/types/engine/art-fields.d.mts +7 -4
- package/types/engine/art-slots.d.mts +6 -0
- package/types/engine/base-compiler.d.mts +15 -17
- package/types/engine/content-address.d.mts +9 -12
- package/types/engine/content-embeds.d.mts +4 -2
- package/types/engine/content-format-check.d.mts +0 -64
- package/types/engine/content-index.d.mts +82 -3
- package/types/engine/content-links.d.mts +2 -4
- package/types/engine/culture-choice.d.mts +51 -8
- package/types/engine/data-keys.d.mts +2 -2
- package/types/engine/derived-fields.d.mts +1 -2
- package/types/engine/diagnostics.d.mts +27 -4
- package/types/engine/document-subtypes.d.mts +12 -31
- package/types/engine/event-views.d.mts +14 -2
- package/types/engine/exported-scene.d.mts +3 -2
- package/types/engine/field-spec.d.mts +13 -122
- package/types/engine/folder-notes.d.mts +0 -39
- package/types/engine/foreign-catalog.d.mts +2 -1
- package/types/engine/foundry-entries.d.mts +4 -5
- package/types/engine/frontmatter-lint.d.mts +2 -2
- package/types/engine/frontmatter.d.mts +19 -45
- package/types/engine/generate.d.mts +1 -1
- package/types/engine/helpers.d.mts +25 -42
- package/types/engine/homepage.d.mts +3 -10
- package/types/engine/ids.d.mts +0 -114
- package/types/engine/index-records.d.mts +6 -4
- package/types/engine/index.d.mts +0 -1
- package/types/engine/infobox-render.d.mts +7 -1
- package/types/engine/infobox.d.mts +3 -2
- package/types/engine/item-docs.d.mts +1 -1
- package/types/engine/item-registry.d.mts +2 -4
- package/types/engine/literature-notes.d.mts +1 -1
- package/types/engine/markdownlint-run.d.mts +40 -0
- package/types/engine/metadata-index.d.mts +9 -1
- package/types/engine/note-addresses.d.mts +27 -2
- package/types/engine/note-claims.d.mts +3 -5
- package/types/engine/note-ids.d.mts +2 -4
- package/types/engine/note-package.d.mts +1 -1
- package/types/engine/note-state.d.mts +1 -3
- package/types/engine/note-vocabulary.d.mts +28 -21
- package/types/engine/pack-config.d.mts +2 -6
- package/types/engine/pack-router.d.mts +4 -4
- package/types/engine/pathnames.d.mts +3 -3
- package/types/engine/pdf-build.d.mts +98 -12
- package/types/engine/pdf-coverage.d.mts +60 -0
- package/types/engine/pdf-index.d.mts +34 -5
- package/types/engine/pdf-pages.d.mts +143 -0
- package/types/engine/pdf-render.d.mts +45 -1
- package/types/engine/pdf-toc.d.mts +12 -14
- package/types/engine/prose-config.d.mts +1 -1
- package/types/engine/prose-lint.d.mts +11 -10
- package/types/engine/runtime-only-fields.d.mts +2 -2
- package/types/engine/site-build.d.mts +9 -5
- package/types/engine/site-index.d.mts +4 -5
- package/types/engine/site-root.d.mts +1 -1
- package/types/engine/sql-tables.d.mts +31 -2
- package/types/engine/standing-terms.d.mts +2 -1
- package/types/engine/standings.d.mts +7 -9
- package/types/engine/system-block.d.mts +10 -44
- package/types/engine/walk-files.d.mts +15 -0
- package/types/engine/wikilink-syntax.d.mts +18 -19
- package/types/engine/yaml-lint.d.mts +5 -4
- package/types/hm3/actors.d.mts +1 -2
- package/types/hm3/item-fields.d.mts +2 -4
- package/types/hm3/template-priority.d.mts +6 -7
- package/types/manifest.d.mts +3 -2
- package/types/release.d.mts +12 -7
- package/types/sohl/actors.d.mts +2 -1
- package/types/sohl/document-subtypes.d.mts +1 -2
- package/types/sohl/item-fields.d.mts +3 -7
- package/engine/retired-fields.mjs +0 -631
- package/types/engine/retired-fields.d.mts +0 -354
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a note declaring `draft:` is told, in one place.
|
|
3
|
-
*
|
|
4
|
-
* Written once and shared by the compile-time refusal and the frontmatter lint,
|
|
5
|
-
* because an author meets whichever of the two runs first and they should read
|
|
6
|
-
* the same. It says what the field did and what to write instead, rather than
|
|
7
|
-
* which value to correct: no value makes declaring it right.
|
|
8
|
-
*
|
|
9
|
-
* @param {string} [file] - The note's path, named in the message. Omit it where
|
|
10
|
-
* the caller emits through a diagnostic, whose locator already starts the
|
|
11
|
-
* line — repeating it prints the path twice.
|
|
12
|
-
* @returns {string} The message, unpunctuated at the end as a finding is.
|
|
13
|
-
*/
|
|
14
|
-
export function draftRetiredMessage(file?: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Refuse a note that declares `draft:` at all.
|
|
17
|
-
*
|
|
18
|
-
* Presence is the whole test. `draft: false` is as retired as `draft: true` —
|
|
19
|
-
* it reads as "publish this note", which is what happens either way, and is
|
|
20
|
-
* exactly the belief the message exists to correct.
|
|
21
|
-
*
|
|
22
|
-
* @param {object|null|undefined} fm - Parsed frontmatter, or nothing when it
|
|
23
|
-
* could not be parsed.
|
|
24
|
-
* @param {object} [options] - Options.
|
|
25
|
-
* @param {string} [options.file] - The note's path, named in the message. Omit
|
|
26
|
-
* it where the caller emits through a diagnostic, which puts the locator at
|
|
27
|
-
* the start of the line already — repeating it prints the path twice.
|
|
28
|
-
* @param {string} [options.absPath] - The note's file on disk, read only on the
|
|
29
|
-
* failing path to locate the offending line and column. The position rides on
|
|
30
|
-
* the thrown error as `position`, for a caller that emits a diagnostic.
|
|
31
|
-
* @returns {void}
|
|
32
|
-
* @throws {Error} When the note declares the field.
|
|
33
|
-
*/
|
|
34
|
-
export function assertNoDraftField(fm: object | null | undefined, { file, absPath }?: {
|
|
35
|
-
file?: string | undefined;
|
|
36
|
-
absPath?: string | undefined;
|
|
37
|
-
}): void;
|
|
38
|
-
/**
|
|
39
|
-
* What a note declaring a top-level `aliases:` is told, in one place.
|
|
40
|
-
*
|
|
41
|
-
* Shared by the compile-time refusal and the frontmatter lint, because an
|
|
42
|
-
* author meets whichever of the two runs first and they should read the same.
|
|
43
|
-
* It says what the field fed and what to write instead, rather than which value
|
|
44
|
-
* to correct: no value makes declaring it right.
|
|
45
|
-
*
|
|
46
|
-
* **What it did.** It was the authored half of the alias index — the
|
|
47
|
-
* namespace a bare `[[Alias]]` was looked up in. Across the three content trees
|
|
48
|
-
* not one bare link resolved through it, while the collision rule that kept it
|
|
49
|
-
* unambiguous folded in every note's `name.full` and so dictated what a note
|
|
50
|
-
* could be named. The form is retired, so the list has no reader.
|
|
51
|
-
*
|
|
52
|
-
* **`name.aliases` is a different field.** It lists alternate names in the
|
|
53
|
-
* infobox and is deliberately unmentioned by this message. See
|
|
54
|
-
* {@link assertNoAliasesField}.
|
|
55
|
-
*
|
|
56
|
-
* @param {string} [file] - The note's path, named in the message. Omit it where
|
|
57
|
-
* the caller emits through a diagnostic, whose locator already starts the
|
|
58
|
-
* line — repeating it prints the path twice.
|
|
59
|
-
* @returns {string} The message, unpunctuated at the end as a finding is.
|
|
60
|
-
*/
|
|
61
|
-
export function aliasesRetiredMessage(file?: string): string;
|
|
62
|
-
/**
|
|
63
|
-
* Refuse a note that declares a top-level `aliases:`.
|
|
64
|
-
*
|
|
65
|
-
* Presence is the whole test. `aliases: []` is as retired as a populated one —
|
|
66
|
-
* it reads as "this note claims no other names", a statement about a namespace
|
|
67
|
-
* that no longer exists.
|
|
68
|
-
*
|
|
69
|
-
* **The nested `name.aliases` is deliberately not refused.** It is the note's
|
|
70
|
-
* ordered alternate names and appears in the note infobox. It does not create
|
|
71
|
-
* addresses or change how authored links resolve.
|
|
72
|
-
*
|
|
73
|
-
* That distinction is the reason this checks `Object.hasOwn(fm, "aliases")`
|
|
74
|
-
* rather than resolving a dotted key: the top-level field is the whole subject,
|
|
75
|
-
* and reaching into `name` at all is the thing being avoided.
|
|
76
|
-
*
|
|
77
|
-
* @param {object|null|undefined} fm - Parsed frontmatter, or nothing when it
|
|
78
|
-
* could not be parsed.
|
|
79
|
-
* @param {object} [options] - Options.
|
|
80
|
-
* @param {string} [options.file] - The note's path, named in the message. Omit
|
|
81
|
-
* it where the caller emits through a diagnostic, which puts the locator at
|
|
82
|
-
* the start of the line already — repeating it prints the path twice.
|
|
83
|
-
* @param {string} [options.absPath] - The note's file on disk, read only on the
|
|
84
|
-
* failing path to locate the offending line and column. The position rides on
|
|
85
|
-
* the thrown error as `position`, for a caller that emits a diagnostic.
|
|
86
|
-
* @returns {void}
|
|
87
|
-
* @throws {Error} When the note declares a top-level `aliases`.
|
|
88
|
-
*/
|
|
89
|
-
export function assertNoAliasesField(fm: object | null | undefined, { file, absPath }?: {
|
|
90
|
-
file?: string | undefined;
|
|
91
|
-
absPath?: string | undefined;
|
|
92
|
-
}): void;
|
|
93
|
-
/**
|
|
94
|
-
* Whether a note declares the retired top-level `aliases:`.
|
|
95
|
-
*
|
|
96
|
-
* A nested `name.aliases` is **not** this field and never answers true here —
|
|
97
|
-
* see {@link assertNoAliasesField} for why the two part company.
|
|
98
|
-
*
|
|
99
|
-
* @param {object|null|undefined} fm - Parsed frontmatter.
|
|
100
|
-
* @returns {boolean} Whether the retired field is declared.
|
|
101
|
-
*/
|
|
102
|
-
export function declaresRetiredAliasesField(fm: object | null | undefined): boolean;
|
|
103
|
-
/**
|
|
104
|
-
* What a note declaring `section:` is told, in one place.
|
|
105
|
-
*
|
|
106
|
-
* Shared by the compile-time refusal and the frontmatter lint, because an
|
|
107
|
-
* author meets whichever of the two runs first and they should read the same.
|
|
108
|
-
* It names what lands a section now rather than a value to correct: no value
|
|
109
|
-
* makes declaring the field right.
|
|
110
|
-
*
|
|
111
|
-
* **What it did.** It named the section a `collection` note headed,
|
|
112
|
-
* under the `collection` landing rule — the only reader it ever had, in the
|
|
113
|
-
* second branch of `landingOf` (`engine/content-address.mjs`). That rule went
|
|
114
|
-
* first, and the whole mechanism went with it: a section is a Hugo
|
|
115
|
-
* directory the note format does not carry, so no note lands one and a page
|
|
116
|
-
* that introduces a type is an ordinary note addressed `doc-<type>`. Nothing
|
|
117
|
-
* else read the field, and no schema or vocabulary declared it, so left in
|
|
118
|
-
* place it would be ignored in silence — the note saying one thing and the
|
|
119
|
-
* build doing another.
|
|
120
|
-
*
|
|
121
|
-
* @param {string} [file] - The note's path, named in the message. Omit it where
|
|
122
|
-
* the caller emits through a diagnostic, whose locator already starts the
|
|
123
|
-
* line — repeating it prints the path twice.
|
|
124
|
-
* @returns {string} The message, unpunctuated at the end as a finding is.
|
|
125
|
-
*/
|
|
126
|
-
export function sectionRetiredMessage(file?: string): string;
|
|
127
|
-
/**
|
|
128
|
-
* Refuse a note that declares `section:` at all.
|
|
129
|
-
*
|
|
130
|
-
* Presence is the whole test, as it is for `draft:` and `aliases:`: an empty
|
|
131
|
-
* value reads as "this note heads a section and names none", a statement about
|
|
132
|
-
* a rule that no longer exists.
|
|
133
|
-
*
|
|
134
|
-
* @param {object|null|undefined} fm - Parsed frontmatter, or nothing when it
|
|
135
|
-
* could not be parsed.
|
|
136
|
-
* @param {object} [options] - Options.
|
|
137
|
-
* @param {string} [options.file] - The note's path, named in the message. Omit
|
|
138
|
-
* it where the caller emits through a diagnostic, which puts the locator at
|
|
139
|
-
* the start of the line already — repeating it prints the path twice.
|
|
140
|
-
* @param {string} [options.absPath] - The note's file on disk, read only on the
|
|
141
|
-
* failing path to locate the offending line and column. The position rides on
|
|
142
|
-
* the thrown error as `position`, for a caller that emits a diagnostic.
|
|
143
|
-
* @returns {void}
|
|
144
|
-
* @throws {Error} When the note declares the field.
|
|
145
|
-
*/
|
|
146
|
-
export function assertNoSectionField(fm: object | null | undefined, { file, absPath }?: {
|
|
147
|
-
file?: string | undefined;
|
|
148
|
-
absPath?: string | undefined;
|
|
149
|
-
}): void;
|
|
150
|
-
/**
|
|
151
|
-
* What a note writing a top-level `traits:` block is told.
|
|
152
|
-
*
|
|
153
|
-
* The message states the **mapping**, not just the destination, because three
|
|
154
|
-
* of the keys reshaped as well as moved: the block nested its measurements
|
|
155
|
-
* where the format flattens them. A bare "write `data:` instead" would send an
|
|
156
|
-
* author to author `data.height: {m: 1.78}`, which is a declared key holding an
|
|
157
|
-
* undeclared shape.
|
|
158
|
-
*
|
|
159
|
-
* @param {string} [file] - The note's path, named in the message. Omit it where
|
|
160
|
-
* the caller emits through a diagnostic, whose locator already starts the
|
|
161
|
-
* line — repeating it prints the path twice.
|
|
162
|
-
* @returns {string} The message, unpunctuated at the end as a finding is.
|
|
163
|
-
*/
|
|
164
|
-
export function traitsRetiredMessage(file?: string): string;
|
|
165
|
-
/**
|
|
166
|
-
* Refuse a note that declares a top-level `traits:` block at all.
|
|
167
|
-
*
|
|
168
|
-
* Presence is the whole test, as it is for `draft:` and `aliases:`: an empty
|
|
169
|
-
* `traits:` is still a note claiming a block that no longer exists.
|
|
170
|
-
*
|
|
171
|
-
* @param {object|null|undefined} fm - Parsed frontmatter, or nothing when it
|
|
172
|
-
* could not be parsed.
|
|
173
|
-
* @param {object} [options] - Options.
|
|
174
|
-
* @param {string} [options.file] - The note's path, named in the message. Omit
|
|
175
|
-
* it where the caller emits through a diagnostic, which puts the locator at
|
|
176
|
-
* the start of the line already.
|
|
177
|
-
* @param {string} [options.absPath] - The note's file on disk, read only on the
|
|
178
|
-
* failing path to locate the offending line and column. The position rides on
|
|
179
|
-
* the thrown error as `position`, for a caller that emits a diagnostic.
|
|
180
|
-
* @returns {void}
|
|
181
|
-
* @throws {Error} When the note declares the block.
|
|
182
|
-
*/
|
|
183
|
-
export function assertNoTraitsField(fm: object | null | undefined, { file, absPath }?: {
|
|
184
|
-
file?: string | undefined;
|
|
185
|
-
absPath?: string | undefined;
|
|
186
|
-
}): void;
|
|
187
|
-
/**
|
|
188
|
-
* A frontmatter key's position in a note's file, or nothing.
|
|
189
|
-
*
|
|
190
|
-
* {@link positionInFrontmatter} answers the same question from the file's
|
|
191
|
-
* *text*; this reads the file to ask it. Kept apart from either caller because
|
|
192
|
-
* both refusals need it and a second copy is a second thing to keep correct.
|
|
193
|
-
*
|
|
194
|
-
* @param {string|undefined} absPath - The note's file.
|
|
195
|
-
* @param {string} key - The frontmatter key.
|
|
196
|
-
* @param {string} [value] - When given, prefer the occurrence whose line also
|
|
197
|
-
* carries this text — so a finding about one entry of a block opens on that
|
|
198
|
-
* entry rather than on the key that introduces it.
|
|
199
|
-
* @param {object} [options] - Options, forwarded to
|
|
200
|
-
* {@link positionInFrontmatter}.
|
|
201
|
-
* @param {boolean} [options.topLevel=false] - Require the key at column 1, so
|
|
202
|
-
* an identically named nested key cannot answer for it.
|
|
203
|
-
* @returns {{line?: number, column?: number}|undefined} Spreadable position
|
|
204
|
-
* fields, dropped rather than guessed when the file cannot be read or the key
|
|
205
|
-
* cannot be found — as `formatDiagnostic` requires.
|
|
206
|
-
*/
|
|
207
|
-
export function locateFrontmatterKey(absPath: string | undefined, key: string, value?: string, { topLevel }?: {
|
|
208
|
-
topLevel?: boolean | undefined;
|
|
209
|
-
}): {
|
|
210
|
-
line?: number;
|
|
211
|
-
column?: number;
|
|
212
|
-
} | undefined;
|
|
213
|
-
/**
|
|
214
|
-
* What a note writing a renamed field is told, in one place.
|
|
215
|
-
*
|
|
216
|
-
* Shared by the compile-time report and the frontmatter lint, because an author
|
|
217
|
-
* meets whichever runs first and they should read the same. It names the key to
|
|
218
|
-
* write rather than a value to correct — no value makes the retired spelling
|
|
219
|
-
* right — and it says the note compiles either way, so a reader knows this is a
|
|
220
|
-
* rename to schedule rather than a build to unbreak.
|
|
221
|
-
*
|
|
222
|
-
* @param {string} retired - The spelling the note used.
|
|
223
|
-
* @param {string} current - What to write instead.
|
|
224
|
-
* @param {string} [file] - The note's path, named in the message. Omit it where
|
|
225
|
-
* the caller emits through a diagnostic, whose locator already starts the
|
|
226
|
-
* line — repeating it prints the path twice.
|
|
227
|
-
* @returns {string} The message, unpunctuated at the end as a finding is.
|
|
228
|
-
*/
|
|
229
|
-
export function retiredAliasMessage(retired: string, current: string, file?: string): string;
|
|
230
|
-
/**
|
|
231
|
-
* What a note writing a field at its **legacy in-block position** is told.
|
|
232
|
-
*
|
|
233
|
-
* The same three-step retirement `retiredAliasMessage` announces, applied to a
|
|
234
|
-
* *position* rather than a spelling. A field whose shared source moved
|
|
235
|
-
* under `data:` keeps reading the key its block still carries, that read wins,
|
|
236
|
-
* and it is reported here so a sweep has something to count down — without it,
|
|
237
|
-
* moving a field into `data:` would be a flag day across every repository that
|
|
238
|
-
* authors it.
|
|
239
|
-
*
|
|
240
|
-
* It names the block, because the key is `hm3.species` and not `species`: an
|
|
241
|
-
* author told to move "`species`" has two regions to guess between.
|
|
242
|
-
*
|
|
243
|
-
* @param {string} block - The system block the key was written in.
|
|
244
|
-
* @param {{name?: string, legacyKey?: string}} field - The declaration, which
|
|
245
|
-
* names both positions.
|
|
246
|
-
* @param {string} [file] - The note's path, named in the message. Omit it where
|
|
247
|
-
* the caller emits through a diagnostic, whose locator already starts the
|
|
248
|
-
* line — repeating it prints the path twice.
|
|
249
|
-
* @returns {string} The message, unpunctuated at the end as a finding is.
|
|
250
|
-
*/
|
|
251
|
-
export function legacyKeyMessage(block: string, field: {
|
|
252
|
-
name?: string;
|
|
253
|
-
legacyKey?: string;
|
|
254
|
-
}, file?: string): string;
|
|
255
|
-
/**
|
|
256
|
-
* What a note writing a field at the **top-level key `data:` gathered it off**
|
|
257
|
-
* is told.
|
|
258
|
-
*
|
|
259
|
-
* {@link legacyKeyMessage}'s counterpart for the other retiring position.
|
|
260
|
-
* `portrait:` beside `img:` is the bare spelling of `data.portrait`, and both
|
|
261
|
-
* are read for the same reason both in-block spellings are: a package moves its
|
|
262
|
-
* corpus when it is ready, not on a flag day.
|
|
263
|
-
*
|
|
264
|
-
* It says nothing about which value is emitted, because that is not what an
|
|
265
|
-
* author needs from it. The value is the same either way; what the finding
|
|
266
|
-
* counts is one more note still on the old position.
|
|
267
|
-
*
|
|
268
|
-
* @param {{name?: string}} field - The declaration, which names the current
|
|
269
|
-
* position; the retiring one is derived from it.
|
|
270
|
-
* @param {string} [file] - The note's path, named in the message. Omit it where
|
|
271
|
-
* the caller emits through a diagnostic, whose locator already starts the
|
|
272
|
-
* line — repeating it prints the path twice.
|
|
273
|
-
* @returns {string} The message, unpunctuated at the end as a finding is.
|
|
274
|
-
*/
|
|
275
|
-
export function retiredTopLevelMessage(field: {
|
|
276
|
-
name?: string;
|
|
277
|
-
}, file?: string): string;
|
|
278
|
-
/**
|
|
279
|
-
* Whether a note writes the retired spelling of a field, wherever it put it.
|
|
280
|
-
*
|
|
281
|
-
* Both regions are searched, because {@link sohlField} reads both: a note that
|
|
282
|
-
* moved the key to the top level without renaming it has done half the
|
|
283
|
-
* migration, and should be told so rather than passing in silence.
|
|
284
|
-
*
|
|
285
|
-
* @param {object|null|undefined} fm - Parsed frontmatter.
|
|
286
|
-
* @param {string} current - The field's current name.
|
|
287
|
-
* @param {object} [options] - Options.
|
|
288
|
-
* @param {boolean} [options.inData=false] - Search the `data:` container
|
|
289
|
-
* instead. A `data:` field has exactly one home, so its retired spelling has
|
|
290
|
-
* exactly one too, and searching the block or the top level for it would
|
|
291
|
-
* answer about a key the container check has already refused.
|
|
292
|
-
* @returns {boolean} Whether the retired spelling is declared.
|
|
293
|
-
*/
|
|
294
|
-
export function declaresRetiredAlias(fm: object | null | undefined, current: string, { inData }?: {
|
|
295
|
-
inData?: boolean | undefined;
|
|
296
|
-
}): boolean;
|
|
297
|
-
/**
|
|
298
|
-
* Read a field that has a retired spelling, the current name winning.
|
|
299
|
-
*
|
|
300
|
-
* This is the whole of the retirement window's behaviour, in one function, so
|
|
301
|
-
* the compiler and the linter cannot disagree about which value a note carries.
|
|
302
|
-
* Resolution within each spelling is {@link sohlField}'s — the `sohl:` block
|
|
303
|
-
* first, then the note's top level — so a renamed field keeps working wherever
|
|
304
|
-
* it was already written while the canonical home is the top level.
|
|
305
|
-
*
|
|
306
|
-
* A blank value counts as absent: `relations:` cleared in an editor means the
|
|
307
|
-
* note records no standings there, and falling through to the retired spelling
|
|
308
|
-
* is what an author part-way through the rename means by it.
|
|
309
|
-
*
|
|
310
|
-
* @param {object|null|undefined} fm - Parsed frontmatter.
|
|
311
|
-
* @param {string} current - The field's current name.
|
|
312
|
-
* @param {object} [options] - Options.
|
|
313
|
-
* @param {boolean} [options.inData=false] - Read the `data:` container instead,
|
|
314
|
-
* which is where a `data:` field and its retired spelling are both written.
|
|
315
|
-
* Dotted names resolve inside it, so `appearance.eye_color` reads the way it
|
|
316
|
-
* is authored.
|
|
317
|
-
* @returns {any} The value, or `undefined` when neither spelling carries one.
|
|
318
|
-
*/
|
|
319
|
-
export function readAliasedField(fm: object | null | undefined, current: string, { inData }?: {
|
|
320
|
-
inData?: boolean | undefined;
|
|
321
|
-
}): any;
|
|
322
|
-
/**
|
|
323
|
-
* The current field name a retired spelling was renamed to.
|
|
324
|
-
*
|
|
325
|
-
* Keyed by the **current** name, because that is what a type's schema declares
|
|
326
|
-
* and what every reader asks for; the value is the spelling still honoured.
|
|
327
|
-
* The table is therefore scoped by the schema without saying so twice: an alias
|
|
328
|
-
* applies to a note only where that note's type declares the current field, so
|
|
329
|
-
* `relation` is retired on an affiliation — which declares `relations` — and
|
|
330
|
-
* remains an unknown key anywhere else.
|
|
331
|
-
*
|
|
332
|
-
* **`templatePriority`.** The number that decides which of several
|
|
333
|
-
* competing templates the Create dialog offers was called `archetype`, and
|
|
334
|
-
* `archetypes` — one letter apart — is a list of what *sort* a character is.
|
|
335
|
-
* A priority and a taxonomy cannot be told apart by a plural `s`, so the
|
|
336
|
-
* priority takes the name that says what it is. The specification already
|
|
337
|
-
* called it `templatePriority` on two of its three sides.
|
|
338
|
-
*
|
|
339
|
-
* **`relations`.** The field holds a *map* of standings, one per
|
|
340
|
-
* affiliation — its own description says so, and `resolveRelation` has always
|
|
341
|
-
* read it that way. `relation` named the many as one, which every author had to
|
|
342
|
-
* read past. Only `affiliation` declares the field, so the alias is reported
|
|
343
|
-
* there and the old spelling stays an ordinary unknown key everywhere else.
|
|
344
|
-
*
|
|
345
|
-
* **`born`.** A birthday is a day that recurs; what a note records is the date
|
|
346
|
-
* somebody was born, once. The two read alike while every value belonged to a
|
|
347
|
-
* living person, and `born` is what the field has to be called beside `died`,
|
|
348
|
-
* which a being now also states. It is the first alias whose field lives in
|
|
349
|
-
* `data:` rather than in a system block, so the two readers below take
|
|
350
|
-
* `inData`.
|
|
351
|
-
*
|
|
352
|
-
* @type {Readonly<Record<string, string>>}
|
|
353
|
-
*/
|
|
354
|
-
export const RETIRED_FIELD_ALIASES: Readonly<Record<string, string>>;
|