@heroiclands/package-build 23.8.0 → 23.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/bin/content-commands.mjs +12 -4
  3. package/docs/api.md +328 -28
  4. package/docs/authoring/first-note.md +1 -1
  5. package/docs/authoring/links-and-markup.md +140 -56
  6. package/docs/commands.md +19 -10
  7. package/docs/content-format.md +2 -2
  8. package/docs/diagnostics.md +1 -1
  9. package/docs/guides/packs.md +2 -1
  10. package/docs/guides/reference-pages.md +86 -63
  11. package/docs/reference/format-details.md +269 -123
  12. package/docs/reference/note-types.md +184 -170
  13. package/engine/anchors.mjs +7 -20
  14. package/engine/compile-corpus.mjs +3 -2
  15. package/engine/content-format.yaml +1 -0
  16. package/engine/content-index.mjs +412 -11
  17. package/engine/content-links.mjs +43 -15
  18. package/engine/content-tables.mjs +8 -4
  19. package/engine/culture-reach.mjs +61 -34
  20. package/engine/data-keys.mjs +3 -1
  21. package/engine/dictionary-layout.mjs +151 -19
  22. package/engine/dictionary-rows.mjs +129 -79
  23. package/engine/foundry-entries.mjs +21 -3
  24. package/engine/glossary-entries.mjs +11 -11
  25. package/engine/heading-attributes.mjs +21 -28
  26. package/engine/helpers.mjs +12 -6
  27. package/engine/journals.mjs +4 -1
  28. package/engine/language-data.mjs +53 -0
  29. package/engine/language-terms.mjs +86 -0
  30. package/engine/language-words.mjs +2 -2
  31. package/engine/lexical-sections.mjs +247 -0
  32. package/engine/note-claims.mjs +2 -0
  33. package/engine/note-state.mjs +9 -3
  34. package/engine/note-vocabulary.mjs +7 -6
  35. package/engine/pdf-build.mjs +9 -9
  36. package/engine/site-build.mjs +16 -2
  37. package/engine/sql-tables.mjs +262 -43
  38. package/engine/stub-lint.mjs +6 -2
  39. package/engine/web-wikilinks.mjs +8 -6
  40. package/engine/word-rows.mjs +20 -12
  41. package/engine/word-terms.mjs +15 -6
  42. package/package.json +1 -1
  43. package/types/engine/content-index.d.mts +65 -1
  44. package/types/engine/content-tables.d.mts +2 -1
  45. package/types/engine/culture-reach.d.mts +22 -2
  46. package/types/engine/data-keys.d.mts +7 -0
  47. package/types/engine/dictionary-layout.d.mts +35 -4
  48. package/types/engine/dictionary-rows.d.mts +9 -0
  49. package/types/engine/foundry-entries.d.mts +3 -1
  50. package/types/engine/heading-attributes.d.mts +2 -2
  51. package/types/engine/helpers.d.mts +4 -1
  52. package/types/engine/language-terms.d.mts +7 -0
  53. package/types/engine/lexical-sections.d.mts +95 -0
  54. package/types/engine/note-state.d.mts +2 -1
  55. package/types/engine/site-build.d.mts +4 -1
  56. package/types/engine/sql-tables.d.mts +33 -3
  57. package/types/engine/word-rows.d.mts +9 -7
@@ -319,6 +319,19 @@ export function indexRecordsFor({ contentBase, assetsBase, config, skipDirectori
319
319
  bodyColumn?: number;
320
320
  }> | undefined;
321
321
  }): object[];
322
+ /**
323
+ * Prepare the complete bodies a content-index publication describes.
324
+ * Prose declarations use each source's audience. Native SQL uses the complete
325
+ * corpus, with target maps limited to that source's declared prose slugs.
326
+ * No output files are written, and the returned inputs are read-only to the emitter.
327
+ *
328
+ * @param {{contentBase?: string, config?: object}} [options]
329
+ * @returns {Promise<PreparedContentIndex>}
330
+ */
331
+ export function prepareContentIndex({ contentBase, config }?: {
332
+ contentBase?: string;
333
+ config?: object;
334
+ }): Promise<PreparedContentIndex>;
322
335
  /**
323
336
  * Emit this package's content index.
324
337
  *
@@ -328,6 +341,7 @@ export function indexRecordsFor({ contentBase, assetsBase, config, skipDirectori
328
341
  * @param {string} [options.outDir] - Where to write; defaults to the configured
329
342
  * `paths.contentIndex`.
330
343
  * @param {object} [options.config] - A resolved configuration; loaded when omitted.
344
+ * @param {PreparedContentIndex} [options.publication] - Complete preparation for this tree and configuration.
331
345
  * @returns {{file: string, notes: number, assets: number, records: number,
332
346
  * bytes: number, full: number, draft: number, stub: number,
333
347
  * dictionary: {file: string, rows: number}, terms: {file: string, rows: number}}}
@@ -341,10 +355,11 @@ export function indexRecordsFor({ contentBase, assetsBase, config, skipDirectori
341
355
  * reader would take it as the authoritative statement that this package has
342
356
  * no content.
343
357
  */
344
- export function emitContentIndex({ contentBase, outDir, config }?: {
358
+ export function emitContentIndex({ contentBase, outDir, config, publication }?: {
345
359
  contentBase?: string | undefined;
346
360
  outDir?: string | undefined;
347
361
  config?: object | undefined;
362
+ publication?: PreparedContentIndex | undefined;
348
363
  }): {
349
364
  file: string;
350
365
  notes: number;
@@ -363,6 +378,55 @@ export function emitContentIndex({ contentBase, outDir, config }?: {
363
378
  rows: number;
364
379
  };
365
380
  };
381
+ /**
382
+ * A captured source context, consumed without mutation by the synchronous emitter.
383
+ */
384
+ export type PreparedContentIndex = {
385
+ /**
386
+ * - The exact resolved configuration for preparation.
387
+ */
388
+ config: object;
389
+ /**
390
+ * - The absolute captured source root.
391
+ */
392
+ contentBase: string;
393
+ /**
394
+ * - Complete index records, including hidden providers.
395
+ */
396
+ records: object[];
397
+ /**
398
+ * - Authored sources by absolute file.
399
+ */
400
+ parsed: Map<string, {
401
+ frontmatter: object | null;
402
+ body: string;
403
+ raw: string;
404
+ bodyLine?: number;
405
+ bodyColumn?: number;
406
+ }>;
407
+ /**
408
+ * - Complete rendered bodies in each note's audience.
409
+ */
410
+ expandedBodies: Map<string, {
411
+ markdown: string;
412
+ lineMap: Array<{
413
+ line: number;
414
+ generated: boolean;
415
+ }>;
416
+ generatedFrom?: number;
417
+ }>;
418
+ /**
419
+ * - Complete native bodies with explicit SQL using the ALL corpus.
420
+ */
421
+ foundryBodies: Map<string, {
422
+ markdown: string;
423
+ lineMap: Array<{
424
+ line: number;
425
+ generated: boolean;
426
+ }>;
427
+ generatedFrom?: number;
428
+ }>;
429
+ };
366
430
  import { collectAnchors } from "./anchors.mjs";
367
431
  import { authoredFrontmatter } from "./index-records.mjs";
368
432
  import { DERIVED_KEYS } from "./index-records.mjs";
@@ -12,7 +12,8 @@
12
12
  * Prepared results.
13
13
  * A note's generated sections — see {@link module:engine/generated-sections} —
14
14
  * are appended to the body first, from the `generated` text the preparation
15
- * set on its results, and expanded with it.
15
+ * set on its results, and expanded with it. Automatic lexical lists, carried
16
+ * on `lexical`, then fill their authored sections or append a new section.
16
17
  *
17
18
  * @returns {{markdown: string, errors: object[], warnings: object[], lineMap: object[],
18
19
  * generatedFrom?: number}} `generatedFrom` is the 0-based line of the
@@ -32,12 +32,15 @@ export function glossaryCorpus(index: object): GlossaryCorpus;
32
32
  *
33
33
  * @param {object} index - The link index.
34
34
  * @param {object} note - The culture or affiliation note.
35
+ * @param {object} [entry] - A glossary entry, whose resolved language selects
36
+ * its dictionary words. Absent, the note's own language is used.
35
37
  * @returns {Map<string, string[]>} The terms; empty for a note no source reaches.
36
38
  */
37
- export function noteTerms(index: object, note: object): Map<string, string[]>;
39
+ export function noteTerms(index: object, note: object, entry?: object): Map<string, string[]>;
38
40
  /**
39
41
  * Warn of an affiliation that reaches no culture, its own or one it inherits,
40
- * in a tree that describes peoples.
42
+ * in a tree that describes peoples. Its ranks and offices then have no
43
+ * culture associations for term queries.
41
44
  *
42
45
  * @param {object} note - An `affiliation` note.
43
46
  * @param {{index?: object}} [context]
@@ -63,4 +66,21 @@ export type GlossaryCorpus = {
63
66
  * give it.
64
67
  */
65
68
  terms: Map<string, Map<string, string[]>>;
69
+ /**
70
+ * - The ranks and
71
+ * offices each owner can name.
72
+ */
73
+ governance: Map<string, Map<string, string[]>>;
74
+ /**
75
+ * - Each
76
+ * language's dictionary words.
77
+ */
78
+ words: Map<string, Array<{
79
+ form: string;
80
+ gloss: unknown;
81
+ }>>;
82
+ /**
83
+ * - Each language's parent.
84
+ */
85
+ families: Map<string, string | undefined>;
66
86
  };
@@ -13,6 +13,8 @@
13
13
  * every surface shows it exactly as written, never recased.
14
14
  * @property {string} shape - The shape in words, for a finding and the reference.
15
15
  * @property {boolean} [required] - The key must be stated, with a value.
16
+ * @property {boolean} [allowEmpty] - A required string may be empty where
17
+ * empty text is a stated value.
16
18
  * @property {boolean} [nullable] - An explicit `null` states the key, for a
17
19
  * required key whose null has a meaning of its own.
18
20
  * @property {string} [label] - The infobox row label, where humanising the key
@@ -117,6 +119,11 @@ export type InnerKeySpec = {
117
119
  * - The key must be stated, with a value.
118
120
  */
119
121
  required?: boolean | undefined;
122
+ /**
123
+ * - A required string may be empty where
124
+ * empty text is a stated value.
125
+ */
126
+ allowEmpty?: boolean | undefined;
120
127
  /**
121
128
  * - An explicit `null` states the key, for a
122
129
  * required key whose null has a meaning of its own.
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Render a dictionary entry's marked headword as an inline native heading in
3
+ * Foundry. Its paragraph becomes a div, so the heading has a valid container.
4
+ * The shared Markdown keeps its span and its containing journal page.
5
+ *
6
+ * @param {import("markdown-it")} md - The Foundry Markdown parser.
7
+ */
8
+ export function dictionaryEntryPlugin(md: typeof import("markdown-it")): void;
1
9
  /**
2
10
  * @typedef {object} LayoutOptions
3
11
  * @property {(ref: object) => boolean} [linkable] - Whether an Address can be
@@ -6,10 +14,16 @@
6
14
  * @property {object} [addressContext] - Address resolution context.
7
15
  * @property {(address: string) => string|undefined} [labelOf] - A note's
8
16
  * `name.full`, by its Address.
9
- * @property {boolean|"only"} [showKey=true] - Whether the key is printed;
10
- * `"only"` prints the key and nothing else.
17
+ * @property {boolean|"only"} [showKey=true] - Whether the key and dictionary
18
+ * head tables are printed; `"only"` prints the key and nothing else.
11
19
  * @property {string} [pageLanguage] - The language of the page the fence is
12
20
  * on, which no entry is tagged with.
21
+ * @property {string} [pageOwner] - The containing page's canonical note Address;
22
+ * a sense attributed only to its own row's owner omits that label on this page.
23
+ * @property {boolean} [entryAnchors=true] - Whether dictionary headwords carry
24
+ * their canonical targets; custom SQL views leave those to the automatic list.
25
+ * @property {object} [verbs] - The owning language's stated pattern, including
26
+ * when its automatic dictionary has no eligible word entries.
13
27
  */
14
28
  /**
15
29
  * Render a result of words as a dictionary.
@@ -44,6 +58,8 @@ export const LAYOUT_REQUIRED_COLUMNS: Readonly<{
44
58
  }>;
45
59
  /** The mark a common entry opens with. */
46
60
  export const COMMON_MARK: "\u2022";
61
+ /** The word-entry span class whose Foundry rendering is a native TOC heading. */
62
+ export const DICTIONARY_ENTRY_CLASS: "dictionary-entry";
47
63
  export type LayoutOptions = {
48
64
  /**
49
65
  * - Whether an Address can be
@@ -64,8 +80,8 @@ export type LayoutOptions = {
64
80
  */
65
81
  labelOf?: ((address: string) => string | undefined) | undefined;
66
82
  /**
67
- * - Whether the key is printed;
68
- * `"only"` prints the key and nothing else.
83
+ * - Whether the key and dictionary
84
+ * head tables are printed; `"only"` prints the key and nothing else.
69
85
  */
70
86
  showKey?: boolean | "only" | undefined;
71
87
  /**
@@ -73,4 +89,19 @@ export type LayoutOptions = {
73
89
  * on, which no entry is tagged with.
74
90
  */
75
91
  pageLanguage?: string | undefined;
92
+ /**
93
+ * - The containing page's canonical note Address;
94
+ * a sense attributed only to its own row's owner omits that label on this page.
95
+ */
96
+ pageOwner?: string | undefined;
97
+ /**
98
+ * - Whether dictionary headwords carry
99
+ * their canonical targets; custom SQL views leave those to the automatic list.
100
+ */
101
+ entryAnchors?: boolean | undefined;
102
+ /**
103
+ * - The owning language's stated pattern, including
104
+ * when its automatic dictionary has no eligible word entries.
105
+ */
106
+ verbs?: object | undefined;
76
107
  };
@@ -1,3 +1,12 @@
1
+ /**
2
+ * The stable prose anchor of a word in one language's dictionary. The exact
3
+ * language and NFC form identify it, including case and accents.
4
+ *
5
+ * @param {string} language - The language's canonical note Address.
6
+ * @param {string} name - The dictionary headword.
7
+ * @returns {string} The anchor slug.
8
+ */
9
+ export function dictionaryEntryAnchor(language: string, name: string): string;
1
10
  /**
2
11
  * The heading letter of a sort key: its first letter or digit, accents taken
3
12
  * off and apostrophes skipped, in capitals; `#` where it has none.
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Every page of a note's journal, as `anchorName → whole UUID`.
2
+ * Every anchor of a note's journal, as `anchorName → Foundry target`.
3
+ * A dictionary word's native heading carries its fragment after the
4
+ * containing page's UUID.
3
5
  *
4
6
  * Whole, not a fragment appended to the entry's UUID: nothing owns a page
5
7
  * address, so a complete link restates no fact, and it keeps the page-id hash
@@ -46,8 +46,8 @@ export function opensPage({ level, id }: {
46
46
  /**
47
47
  * Every heading in a body, with what its attribute block declares.
48
48
  *
49
- * Fenced code is skipped: `#` opens a comment in most of what gets fenced, and
50
- * an example heading in a document is not a heading of it.
49
+ * Code and raw HTML blocks are skipped: an example heading in a document is
50
+ * not a heading of it, including an example in an HTML comment.
51
51
  *
52
52
  * @param {string} source - A note's markdown body.
53
53
  * @param {number} [bodyLine=1] - The 1-based file line the body starts on, so a
@@ -364,11 +364,14 @@ export function defaultStats(): object;
364
364
  * omitted.
365
365
  * @param {readonly object[]} [opts.records] - The corpus, derived once per
366
366
  * compile and handed in. Required: see {@link assertSuppliedCorpus}.
367
+ * @param {Map<string, object[]>} [opts.sqlTables] - Prepared directives,
368
+ * including the anchors and Foundry page maps of their expanded bodies.
367
369
  * @returns {{byShortcode: Map, types: Set}} From `buildWikilinkIndex`.
368
370
  */
369
- export function buildContentLinkIndex(contentBase: string, router?: object, { config, records }?: {
371
+ export function buildContentLinkIndex(contentBase: string, router?: object, { config, records, sqlTables }?: {
370
372
  config?: object | undefined;
371
373
  records?: readonly object[] | undefined;
374
+ sqlTables?: Map<string, object[]> | undefined;
372
375
  }): {
373
376
  byShortcode: Map<any, any>;
374
377
  types: Set<any>;
@@ -319,6 +319,13 @@ export const NEAR_NAME_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[]
319
319
  * @type {readonly import("./data-keys.mjs").InnerKeySpec[]}
320
320
  */
321
321
  export const NAMING_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[];
322
+ /**
323
+ * The six present persons of the one optional regular verb pattern, in
324
+ * presentation order. Empty endings leave the citation form unchanged.
325
+ *
326
+ * @type {readonly import("./data-keys.mjs").InnerKeySpec[]}
327
+ */
328
+ export const VERB_PERSON_FIELDS: readonly import("./data-keys.mjs").InnerKeySpec[];
322
329
  /**
323
330
  * The `data` fields this module declares, in the order the vocabulary lists
324
331
  * them. {@link module:engine/language-data.checkLanguageData} checks what the
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Whether frontmatter supplies an automatic lexical section, including on a
3
+ * note with no authored prose. Such a note has content and is not a stub.
4
+ *
5
+ * @param {object|null|undefined} frontmatter - A note or its index record.
6
+ * @returns {boolean} Whether its own nonempty words or glossary qualify.
7
+ */
8
+ export function hasLexicalEntries(frontmatter: object | null | undefined): boolean;
9
+ /**
10
+ * One automatic section, whose rows are rendered at its containing heading's
11
+ * level when inserted.
12
+ *
13
+ * @typedef {object} LexicalSection
14
+ * @property {string} slug - The canonical section anchor and layout name.
15
+ * @property {string} heading - The heading used when none is authored.
16
+ * @property {readonly string[]} aliases - Authored heading anchors to reuse.
17
+ * @property {{columns: string[], rows: object[]}} result - The selected rows.
18
+ * @property {import("./dictionary-layout.mjs").LayoutOptions} options - Labels,
19
+ * linkability and the page's language, shared by every surface.
20
+ */
21
+ /**
22
+ * Automatic lexical sections by owning note's canonical Address. Only
23
+ * nonempty own `words` or `glossary` arrays qualify. A glossary selects only
24
+ * explicitly declared owner entries, including a rank only when named there.
25
+ *
26
+ * @param {object[]} records - The audience's visible index records.
27
+ * @param {object[]} [all=records] - Complete records for lineage traversal.
28
+ * @returns {Map<string, LexicalSection[]>} Sections by owning Address.
29
+ */
30
+ export function lexicalSectionsFor(records: object[], all?: object[]): Map<string, LexicalSection[]>;
31
+ /**
32
+ * Insert lists at the end of their authored anchored sections, or append a
33
+ * new H1 section when no heading names one. Source lines after an insertion
34
+ * retain their original positions; inserted lines point to their heading.
35
+ *
36
+ * @param {string} markdown - The body with authored directives expanded.
37
+ * @param {LexicalSection[]} [sections=[]] - From {@link lexicalSectionsFor}.
38
+ * @param {{authored?: string, lineMap?: object[], generatedFrom?: number}} [context] -
39
+ * The original authored body, source mappings and the start of appended
40
+ * nonlexical generated sections. Without `authored`, `markdown` is the source.
41
+ * @returns {{markdown: string, lineMap: object[], generatedFrom?: number}}
42
+ */
43
+ export function insertLexicalSections(markdown: string, sections?: LexicalSection[], { authored, lineMap, generatedFrom }?: {
44
+ authored?: string;
45
+ lineMap?: object[];
46
+ generatedFrom?: number;
47
+ }): {
48
+ markdown: string;
49
+ lineMap: object[];
50
+ generatedFrom?: number;
51
+ };
52
+ /** The automatic lexical sections and the authored anchors each may reuse. */
53
+ export const LEXICAL_SECTIONS: readonly Readonly<{
54
+ aliases: readonly string[];
55
+ types: readonly Readonly<{
56
+ type: string;
57
+ subType: string;
58
+ } | {
59
+ type: string;
60
+ subType?: undefined;
61
+ }>[];
62
+ slug: string;
63
+ heading: string;
64
+ dataKey: string;
65
+ }>[];
66
+ /**
67
+ * One automatic section, whose rows are rendered at its containing heading's
68
+ * level when inserted.
69
+ */
70
+ export type LexicalSection = {
71
+ /**
72
+ * - The canonical section anchor and layout name.
73
+ */
74
+ slug: string;
75
+ /**
76
+ * - The heading used when none is authored.
77
+ */
78
+ heading: string;
79
+ /**
80
+ * - Authored heading anchors to reuse.
81
+ */
82
+ aliases: readonly string[];
83
+ /**
84
+ * - The selected rows.
85
+ */
86
+ result: {
87
+ columns: string[];
88
+ rows: object[];
89
+ };
90
+ /**
91
+ * - Labels,
92
+ * linkability and the page's language, shared by every surface.
93
+ */
94
+ options: import("./dictionary-layout.mjs").LayoutOptions;
95
+ };
@@ -43,7 +43,8 @@ export function isStubbableType(type: string | null | undefined, vocabulary?: Re
43
43
  stubbable?: boolean;
44
44
  }>>): boolean;
45
45
  /**
46
- * Whether a note is a stub: an empty body on a type an empty body suppresses.
46
+ * Whether a note is a stub: an empty body on a type an empty body suppresses,
47
+ * without an automatic dictionary or glossary supplied by its frontmatter.
47
48
  *
48
49
  * The one place the two halves are put together, so the index, the lint and the
49
50
  * guard cannot answer it differently.
@@ -109,11 +109,14 @@ export function writeHomepages(outRoot: string, pages: readonly object[], config
109
109
  * @param {object} options
110
110
  * @param {object} options.config - The resolved build configuration.
111
111
  * @param {object[]} options.records - Content-index records.
112
+ * @param {Map<string, object[]>} [options.sqlTables] - Prepared directives,
113
+ * whose emitted anchors belong to the pages they expand in.
112
114
  * @returns {object} The gate results and, when they pass, the built index.
113
115
  */
114
- export function siteGates(pages: object[], findings: object, { config, records }: {
116
+ export function siteGates(pages: object[], findings: object, { config, records, sqlTables }: {
115
117
  config: object;
116
118
  records: object[];
119
+ sqlTables?: Map<string, object[]> | undefined;
117
120
  }): object;
118
121
  /**
119
122
  * The gate result of a build that ran none of them.
@@ -191,20 +191,25 @@ export function prepareInlineSqlExpressions(db: any, sources: any): Promise<Map<
191
191
  * @param {Map<string, Map<string, string>>} [opts.derived] - The derived
192
192
  * lists, from an earlier call over the same records, which are not derived
193
193
  * again.
194
+ * @param {object[]} [opts.all=records] - Complete records for lexical lineage
195
+ * traversal through providers outside the surface's audience.
194
196
  * @returns {Promise<{sections: Map<string, string>, views: Set<string>,
195
- * derived: Map<string, Map<string, string>>}>} Note file to its sections,
197
+ * derived: Map<string, Map<string, string>>,
198
+ * lexical: Map<string, import("./lexical-sections.mjs").LexicalSection[]>}>} Note file to its sections,
196
199
  * joined in order; the files whose sections hold an event view's fence; and
197
200
  * the derived lists alone.
198
201
  */
199
- export function generatedSectionsFor(db: object | undefined, records: object[], contentBase: string, { only, foreignIndex, config, derived: given }?: {
202
+ export function generatedSectionsFor(db: object | undefined, records: object[], contentBase: string, { only, foreignIndex, config, derived: given, all }?: {
200
203
  only?: string | undefined;
201
204
  foreignIndex?: Map<string, object> | undefined;
202
205
  config?: object | undefined;
203
206
  derived?: Map<string, Map<string, string>> | undefined;
207
+ all?: object[] | undefined;
204
208
  }): Promise<{
205
209
  sections: Map<string, string>;
206
210
  views: Set<string>;
207
211
  derived: Map<string, Map<string, string>>;
212
+ lexical: Map<string, import("./lexical-sections.mjs").LexicalSection[]>;
208
213
  }>;
209
214
  /**
210
215
  * Join each note's generated sections to its body among the sources a
@@ -243,12 +248,13 @@ export function joinGeneratedSections(generated: {
243
248
  * empty set carrying them.
244
249
  *
245
250
  * @param {Map<string, object[]>} prepared - From {@link prepareSqlTables}.
246
- * @param {{sections: Map<string, string>}} generated - From
251
+ * @param {{sections: Map<string, string>, lexical?: Map<string, import("./lexical-sections.mjs").LexicalSection[]>}} generated - From
247
252
  * {@link generatedSectionsFor}.
248
253
  * @returns {void}
249
254
  */
250
255
  export function attachGeneratedSections(prepared: Map<string, object[]>, generated: {
251
256
  sections: Map<string, string>;
257
+ lexical?: Map<string, import("./lexical-sections.mjs").LexicalSection[]>;
252
258
  }): void;
253
259
  /**
254
260
  * Each declared dependency's cached index, as {@link openNotesDatabase} attaches
@@ -313,6 +319,30 @@ export function prepareTreeSqlTables(contentBase: string, { config, skipDirector
313
319
  audience?: "all" | "public" | undefined;
314
320
  foreignIndex?: Map<string, object> | undefined;
315
321
  }): Promise<Map<string, object[]> | undefined>;
322
+ /**
323
+ * Prepare authored link-check tables in each source note's audience. Public
324
+ * sources share one public database; GM sources share one complete database.
325
+ * Complete records remain available for authored-link checks.
326
+ *
327
+ * @param {string} contentBase - Root of the content tree.
328
+ * @param {object} [opts]
329
+ * @param {object} [opts.config] - Resolved configuration.
330
+ * @param {readonly string[]} [opts.skipDirectories] - The walk's scope.
331
+ * @param {object[]} [opts.records] - Complete index records already derived.
332
+ * @param {Map<string, {body: string, frontmatter: object|null}>} [opts.parsed] - Parsed notes.
333
+ * @param {Map<string, object>} [opts.foreignIndex] - Published dependency indexes.
334
+ * @returns {Promise<Map<string, object[]>|undefined>} Prepared tables by source.
335
+ */
336
+ export function prepareLinkSqlTables(contentBase: string, { config, skipDirectories, records, parsed, foreignIndex }?: {
337
+ config?: object | undefined;
338
+ skipDirectories?: readonly string[] | undefined;
339
+ records?: object[] | undefined;
340
+ parsed?: Map<string, {
341
+ body: string;
342
+ frontmatter: object | null;
343
+ }> | undefined;
344
+ foreignIndex?: Map<string, object> | undefined;
345
+ }): Promise<Map<string, object[]> | undefined>;
316
346
  /**
317
347
  * Aliases the renderer reads rather than printing.
318
348
  *
@@ -1,13 +1,15 @@
1
1
  /**
2
- * A lookup from a built piece to its gloss, over the words (stems included)
3
- * and affixes of one or more languages.
2
+ * A lookup from a built piece to its gloss, over the words (stems included),
3
+ * affixes and elements of one or more languages.
4
4
  *
5
- * Languages are given nearest first: a language's own words, then its own
6
- * affixes, then the next language's, so a daughter's entry wins over its
7
- * parent's. A piece matches an entry written exactly as it is, and failing
8
- * that one written with the same letters and different joining hyphens, so
5
+ * For each spelling, languages are given nearest first: a language's own
6
+ * words, then its affixes and elements, then the next language's. A piece
7
+ * matches an exact spelling across the lineage first, and failing that one
8
+ * written with the same letters and different joining hyphens, so
9
9
  * `wulf-` finds the word `wulf`. Within a language a word's own gloss wins over
10
- * an affix's.
10
+ * an affix's, and both precede an element's sense. Elements also match their
11
+ * declared variants; affixes also match their front-vowel forms. Spelling,
12
+ * including case and accents, is preserved.
11
13
  *
12
14
  * @param {...object} datas - Each language note's `data`, nearest first.
13
15
  * @returns {(piece: string) => string|null} The gloss, or `null` where none resolves.