@heroiclands/package-build 23.8.0 → 23.10.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 (114) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +2 -0
  3. package/bin/content-commands.mjs +207 -70
  4. package/docs/api.md +646 -78
  5. package/docs/authoring/first-note.md +1 -1
  6. package/docs/authoring/links-and-markup.md +253 -102
  7. package/docs/commands.md +111 -13
  8. package/docs/content-format.md +7 -2
  9. package/docs/diagnostics.md +1 -1
  10. package/docs/guides/packs.md +2 -1
  11. package/docs/guides/reference-pages.md +86 -63
  12. package/docs/reference/format-details.md +398 -137
  13. package/docs/reference/note-types.md +188 -174
  14. package/engine/anchors.mjs +15 -26
  15. package/engine/base-compiler.mjs +6 -4
  16. package/engine/changelog-group.mjs +58 -34
  17. package/engine/changelog-lint.mjs +6 -2
  18. package/engine/compendiums.mjs +15 -1
  19. package/engine/compile-corpus.mjs +17 -3
  20. package/engine/content-charset.mjs +13 -1
  21. package/engine/content-format.yaml +1 -0
  22. package/engine/content-html.mjs +18 -4
  23. package/engine/content-icons.mjs +15 -1
  24. package/engine/content-images.mjs +28 -9
  25. package/engine/content-index.mjs +496 -16
  26. package/engine/content-links.mjs +70 -27
  27. package/engine/content-session.mjs +247 -0
  28. package/engine/content-sources.mjs +110 -0
  29. package/engine/content-spans.mjs +87 -8
  30. package/engine/content-tables.mjs +9 -4
  31. package/engine/content-tasklists.mjs +20 -4
  32. package/engine/culture-reach.mjs +61 -34
  33. package/engine/data-keys.mjs +3 -1
  34. package/engine/diagnostics.mjs +17 -6
  35. package/engine/dictionary-layout.mjs +151 -19
  36. package/engine/dictionary-rows.mjs +129 -79
  37. package/engine/extension-attributes.mjs +28 -5
  38. package/engine/first-use.mjs +371 -0
  39. package/engine/foundry-entries.mjs +29 -8
  40. package/engine/generate.mjs +13 -4
  41. package/engine/glossary-entries.mjs +11 -11
  42. package/engine/heading-attributes.mjs +21 -28
  43. package/engine/helpers.mjs +54 -19
  44. package/engine/index-records.mjs +1 -0
  45. package/engine/index.mjs +3 -0
  46. package/engine/journals.mjs +13 -6
  47. package/engine/language-data.mjs +55 -2
  48. package/engine/language-rows.mjs +4 -4
  49. package/engine/language-terms.mjs +90 -4
  50. package/engine/language-words.mjs +2 -2
  51. package/engine/lexical-sections.mjs +247 -0
  52. package/engine/markup-validation.mjs +7 -2
  53. package/engine/metadata-index.mjs +1 -0
  54. package/engine/name-markup.mjs +114 -0
  55. package/engine/name-rows.mjs +70 -0
  56. package/engine/names.mjs +460 -0
  57. package/engine/note-addresses.mjs +25 -4
  58. package/engine/note-claims.mjs +2 -0
  59. package/engine/note-state.mjs +9 -3
  60. package/engine/note-vocabulary.mjs +7 -6
  61. package/engine/path-charset.mjs +24 -1
  62. package/engine/pdf-build.mjs +9 -9
  63. package/engine/pdf-render.mjs +15 -1
  64. package/engine/site-build.mjs +16 -2
  65. package/engine/site-index.mjs +5 -1
  66. package/engine/sql-tables.mjs +324 -44
  67. package/engine/stub-lint.mjs +10 -5
  68. package/engine/web-wikilinks.mjs +8 -6
  69. package/engine/word-rows.mjs +20 -12
  70. package/engine/word-terms.mjs +15 -6
  71. package/engine/yaml-lint.mjs +3 -5
  72. package/hugo-theme/static/css/style.css +4 -0
  73. package/package.json +1 -1
  74. package/types/engine/anchors.d.mts +4 -2
  75. package/types/engine/compendiums.d.mts +5 -1
  76. package/types/engine/compile-corpus.d.mts +5 -2
  77. package/types/engine/content-charset.d.mts +5 -1
  78. package/types/engine/content-html.d.mts +5 -1
  79. package/types/engine/content-icons.d.mts +5 -1
  80. package/types/engine/content-images.d.mts +5 -1
  81. package/types/engine/content-index.d.mts +102 -18
  82. package/types/engine/content-links.d.mts +22 -8
  83. package/types/engine/content-session.d.mts +108 -0
  84. package/types/engine/content-sources.d.mts +32 -0
  85. package/types/engine/content-spans.d.mts +3 -5
  86. package/types/engine/content-tables.d.mts +2 -1
  87. package/types/engine/content-tasklists.d.mts +5 -1
  88. package/types/engine/culture-reach.d.mts +22 -2
  89. package/types/engine/data-keys.d.mts +7 -0
  90. package/types/engine/diagnostics.d.mts +10 -0
  91. package/types/engine/dictionary-layout.d.mts +35 -4
  92. package/types/engine/dictionary-rows.d.mts +9 -0
  93. package/types/engine/extension-attributes.d.mts +16 -2
  94. package/types/engine/first-use.d.mts +31 -0
  95. package/types/engine/foundry-entries.d.mts +14 -5
  96. package/types/engine/generate.d.mts +5 -1
  97. package/types/engine/heading-attributes.d.mts +2 -2
  98. package/types/engine/helpers.d.mts +33 -7
  99. package/types/engine/index.d.mts +1 -0
  100. package/types/engine/journals.d.mts +5 -2
  101. package/types/engine/language-terms.d.mts +7 -0
  102. package/types/engine/lexical-sections.d.mts +96 -0
  103. package/types/engine/markup-validation.d.mts +2 -1
  104. package/types/engine/name-markup.d.mts +176 -0
  105. package/types/engine/name-rows.d.mts +35 -0
  106. package/types/engine/names.d.mts +356 -0
  107. package/types/engine/note-addresses.d.mts +3 -3
  108. package/types/engine/note-state.d.mts +2 -1
  109. package/types/engine/path-charset.d.mts +16 -1
  110. package/types/engine/site-build.d.mts +6 -3
  111. package/types/engine/site-index.d.mts +3 -1
  112. package/types/engine/sql-tables.d.mts +39 -4
  113. package/types/engine/stub-lint.d.mts +3 -1
  114. package/types/engine/word-rows.d.mts +9 -7
@@ -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.
@@ -21,13 +21,28 @@ export function offendingPathCharacters(text: string): string[];
21
21
  * @param {string} opts.assetsBase - The package's asset directory, whose
22
22
  * picture roots are walked.
23
23
  * @param {readonly string[]} [opts.skipDirectories] - Directory names to ignore.
24
+ * @param {ReturnType<import("./content-sources.mjs").captureContentSources>} [opts.inventory] - Captured physical paths in root walk order.
24
25
  * @returns {{findings: Array<{file: string, severity: "error", message: string}>,
25
26
  * files: number}} The findings, and how many paths were checked.
26
27
  */
27
- export function lintPathCharset({ contentBase, assetsBase, skipDirectories }: {
28
+ export function lintPathCharset({ contentBase, assetsBase, skipDirectories, inventory }: {
28
29
  contentBase: string;
29
30
  assetsBase: string;
30
31
  skipDirectories?: readonly string[] | undefined;
32
+ inventory?: {
33
+ sources: Map<string, {
34
+ raw: string;
35
+ }>;
36
+ indexSources: Map<string, {
37
+ raw: string;
38
+ }>;
39
+ paths: Array<{
40
+ root: string;
41
+ file: string;
42
+ name: string;
43
+ directory: boolean;
44
+ }>;
45
+ } | undefined;
31
46
  }): {
32
47
  findings: Array<{
33
48
  file: string;
@@ -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.
@@ -250,8 +253,8 @@ export function renderSitePage(page: any, { index, foreign, universe, pass, deco
250
253
  secretErrors: {
251
254
  file: any;
252
255
  line: number;
253
- column: any;
254
- message: any;
256
+ column: number;
257
+ message: string;
255
258
  }[];
256
259
  captionErrors: {
257
260
  file: any;
@@ -13,9 +13,10 @@
13
13
  * ordinary dead address.
14
14
  * @param {object[]} [options.records] - Content-index records.
15
15
  * @param {Map<string, object>} [options.foreignReferences] - Foreign reference targets.
16
+ * @param {import("./content-session.mjs").ContentSyntax} [options.syntax] - Exact-text scanner projections.
16
17
  * @returns {SiteIndex} The index, and what could not be addressed unambiguously.
17
18
  */
18
- export function buildSiteIndex(entries: readonly SiteEntry[], { foreignIndex, noIndexPackages, package: builderPackage, records, foreignReferences, }?: {
19
+ export function buildSiteIndex(entries: readonly SiteEntry[], { foreignIndex, noIndexPackages, package: builderPackage, records, foreignReferences, syntax, }?: {
19
20
  foreignIndex?: Map<string, {
20
21
  package: string;
21
22
  type?: string;
@@ -23,6 +24,7 @@ export function buildSiteIndex(entries: readonly SiteEntry[], { foreignIndex, no
23
24
  noIndexPackages?: Set<string> | undefined;
24
25
  records?: object[] | undefined;
25
26
  foreignReferences?: Map<string, object> | undefined;
27
+ syntax?: import("./content-session.mjs").ContentSyntax | undefined;
26
28
  }): SiteIndex;
27
29
  /**
28
30
  * The address keys one page's figures are reachable by — the same two forms
@@ -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
@@ -297,11 +303,12 @@ export function cachedDependencies(config?: object): Promise<Array<{
297
303
  * @param {Map<string, object>} [opts.foreignIndex] - The fetched indexes the
298
304
  * generated sections take in, where the caller holds them already; absent,
299
305
  * they are read from the cache.
306
+ * @param {import("./content-session.mjs").ContentSyntax} [opts.syntax] - Exact-text scanner projections.
300
307
  * @returns {Promise<Map<string, object[]>|undefined>} Results by note path,
301
308
  * carrying `inline` and `pageLists` beside them, or nothing when the tree
302
309
  * holds no such directive and no note is given a generated section.
303
310
  */
304
- export function prepareTreeSqlTables(contentBase: string, { config, skipDirectories, records, parsed, database, audience, foreignIndex }?: {
311
+ export function prepareTreeSqlTables(contentBase: string, { config, skipDirectories, records, parsed, database, audience, foreignIndex, syntax, }?: {
305
312
  config?: object | undefined;
306
313
  skipDirectories?: readonly string[] | undefined;
307
314
  records?: object[] | undefined;
@@ -312,6 +319,34 @@ export function prepareTreeSqlTables(contentBase: string, { config, skipDirector
312
319
  database?: object | undefined;
313
320
  audience?: "all" | "public" | undefined;
314
321
  foreignIndex?: Map<string, object> | undefined;
322
+ syntax?: import("./content-session.mjs").ContentSyntax | undefined;
323
+ }): Promise<Map<string, object[]> | undefined>;
324
+ /**
325
+ * Prepare authored link-check tables in each source note's audience. Public
326
+ * sources share one public database; GM sources share one complete database.
327
+ * Complete records remain available for authored-link checks.
328
+ *
329
+ * @param {string} contentBase - Root of the content tree.
330
+ * @param {object} [opts]
331
+ * @param {object} [opts.config] - Resolved configuration.
332
+ * @param {readonly string[]} [opts.skipDirectories] - The walk's scope.
333
+ * @param {object[]} [opts.records] - Complete index records already derived.
334
+ * @param {Map<string, {body: string, frontmatter: object|null}>} [opts.parsed] - Parsed notes.
335
+ * @param {Map<string, object>} [opts.foreignIndex] - Published dependency indexes.
336
+ * @param {(audience: "all"|"public") => Promise<Map<string, object[]>|undefined>} [opts.prepareAudience] -
337
+ * Context-bound preparation shared with other operations in the same session.
338
+ * @returns {Promise<Map<string, object[]>|undefined>} Prepared tables by source.
339
+ */
340
+ export function prepareLinkSqlTables(contentBase: string, { config, skipDirectories, records, parsed, foreignIndex, prepareAudience }?: {
341
+ config?: object | undefined;
342
+ skipDirectories?: readonly string[] | undefined;
343
+ records?: object[] | undefined;
344
+ parsed?: Map<string, {
345
+ body: string;
346
+ frontmatter: object | null;
347
+ }> | undefined;
348
+ foreignIndex?: Map<string, object> | undefined;
349
+ prepareAudience?: ((audience: "all" | "public") => Promise<Map<string, object[]> | undefined>) | undefined;
315
350
  }): Promise<Map<string, object[]> | undefined>;
316
351
  /**
317
352
  * Aliases the renderer reads rather than printing.
@@ -11,15 +11,17 @@
11
11
  * @param {object} opts
12
12
  * @param {readonly object[]} opts.records - Index records the caller derived.
13
13
  * @param {string} [opts.contentPackage] - Named in the counts line.
14
+ * @param {Map<string, import("./content-session.mjs").ContentNoteSource>} [opts.parsed] - Captured sources, with the file reader as fallback.
14
15
  * @returns {{findings: object[], counts: {full: number, draft: number,
15
16
  * stub: number}, byType: Array<{type: string, full: number, draft: number,
16
17
  * stub: number}>, oldestDrafts: Array<{file: string, modified: Date}>,
17
18
  * summary: string[]}} The findings, the ladder's counts, and the lines a
18
19
  * reader is shown as prose rather than as findings.
19
20
  */
20
- export function lintNoteStates(contentBase: string, { records, contentPackage }?: {
21
+ export function lintNoteStates(contentBase: string, { records, contentPackage, parsed }?: {
21
22
  records: readonly object[];
22
23
  contentPackage?: string | undefined;
24
+ parsed?: Map<string, import("./content-session.mjs").ContentNoteSource> | undefined;
23
25
  }): {
24
26
  findings: object[];
25
27
  counts: {
@@ -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.