@heroiclands/package-build 24.1.1 → 25.1.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 +36 -0
- package/README.md +1 -0
- package/bin/content-commands.mjs +30 -96
- package/bin/encoding-commands.mjs +146 -0
- package/bin/package-build.mjs +35 -24
- package/config.mjs +25 -0
- package/convert.mjs +182 -0
- package/docs/api.md +154 -11
- package/docs/authoring/links-and-markup.md +260 -473
- package/docs/commands.md +118 -119
- package/docs/configuration.md +31 -13
- package/docs/content-format.md +11 -4
- package/docs/diagnostics.md +43 -16
- package/docs/encoding-core.md +135 -0
- package/docs/guides/book.md +2 -2
- package/docs/guides/module-project.md +23 -1
- package/docs/guides/site.md +2 -2
- package/docs/guides/writing-in-invented-scripts.md +453 -569
- package/docs/reference/format-details.md +290 -380
- package/docs/reference/note-types.md +80 -62
- package/docs/source-preview.md +8 -0
- package/e2e.mjs +1 -1
- package/engine/base-compiler.mjs +27 -9
- package/engine/content-charset.mjs +21 -1
- package/engine/content-format.yaml +7 -2
- package/engine/content-index.mjs +6 -2
- package/engine/content-links.mjs +1 -0
- package/engine/content-scripts.mjs +658 -423
- package/engine/content-scroll.mjs +4 -4
- package/engine/content-spans.mjs +40 -9
- package/engine/content-verse.mjs +1 -1
- package/engine/converter-data.mjs +70 -0
- package/engine/dictionary-rows.mjs +2 -34
- package/engine/encoding-integrity.mjs +94 -0
- package/engine/encoding-language.mjs +506 -0
- package/engine/encoding-lexicon.mjs +699 -0
- package/engine/encoding-notes.mjs +186 -0
- package/engine/encoding-standard.mjs +42 -0
- package/engine/encoding-template.mjs +313 -0
- package/engine/encoding-terms.mjs +141 -0
- package/engine/encoding.mjs +946 -0
- package/engine/extension-attributes.mjs +2 -0
- package/engine/helpers.mjs +1 -1
- package/engine/index.mjs +10 -0
- package/engine/language-data.mjs +4 -1
- package/engine/language-terms.mjs +23 -12
- package/engine/{logographic.mjs → language-writings.mjs} +29 -38
- package/engine/markup-validation.mjs +1 -1
- package/engine/note-vocabulary.mjs +4 -158
- package/engine/pdf-render.mjs +31 -3
- package/engine/roman-characters.mjs +232 -0
- package/engine/roman-run.mjs +149 -0
- package/engine/roman-verse.mjs +95 -0
- package/engine/run-rows.mjs +29 -31
- package/engine/run-words.mjs +2 -2
- package/engine/script-emphasis-terms.mjs +3 -0
- package/engine/script-emphasis.mjs +3 -10
- package/engine/script-font-delivery.mjs +9 -12
- package/engine/script-fonts.mjs +2 -1
- package/engine/site-build.mjs +14 -5
- package/engine/site-preview.mjs +12 -2
- package/engine/sql-tables.mjs +36 -31
- package/engine/verse-metre.mjs +1 -1
- package/engine/word-forms.mjs +1 -1
- package/engine/word-inflections.mjs +48 -0
- package/engine/word-rows.mjs +1 -1
- package/engine/word-terms.mjs +16 -17
- package/package.json +11 -5
- package/types/config.d.mts +5 -0
- package/types/convert.d.mts +44 -0
- package/types/e2e.d.mts +1 -1
- package/types/engine/base-compiler.d.mts +4 -2
- package/types/engine/content-charset.d.mts +8 -0
- package/types/engine/content-index.d.mts +4 -1
- package/types/engine/content-scripts.d.mts +108 -42
- package/types/engine/converter-data.d.mts +11 -0
- package/types/engine/dictionary-rows.d.mts +1 -25
- package/types/engine/encoding-integrity.d.mts +14 -0
- package/types/engine/encoding-language.d.mts +36 -0
- package/types/engine/encoding-lexicon.d.mts +259 -0
- package/types/engine/encoding-notes.d.mts +39 -0
- package/types/engine/encoding-standard.d.mts +11 -0
- package/types/engine/encoding-template.d.mts +43 -0
- package/types/engine/encoding-terms.d.mts +105 -0
- package/types/engine/encoding.d.mts +155 -0
- package/types/engine/helpers.d.mts +1 -1
- package/types/engine/index.d.mts +5 -0
- package/types/engine/language-terms.d.mts +1 -1
- package/types/engine/{logographic.d.mts → language-writings.d.mts} +6 -6
- package/types/engine/markup-validation.d.mts +1 -1
- package/types/engine/pdf-render.d.mts +1 -1
- package/types/engine/roman-characters.d.mts +45 -0
- package/types/engine/roman-run.d.mts +101 -0
- package/types/engine/roman-verse.d.mts +23 -0
- package/types/engine/run-rows.d.mts +13 -20
- package/types/engine/script-emphasis-terms.d.mts +2 -0
- package/types/engine/script-emphasis.d.mts +1 -1
- package/types/engine/script-font-delivery.d.mts +2 -3
- package/types/engine/script-fonts.d.mts +5 -0
- package/types/engine/site-preview.d.mts +1 -1
- package/types/engine/word-inflections.d.mts +25 -0
- package/engine/map-lexicon.mjs +0 -1034
- package/engine/text-maps.mjs +0 -654
- package/engine/written-in.mjs +0 -204
- package/types/engine/map-lexicon.d.mts +0 -330
- package/types/engine/text-maps.d.mts +0 -189
- package/types/engine/written-in.d.mts +0 -76
|
@@ -212,6 +212,8 @@ export function resolveCultures(records: Array<Record<string, any>>, { contentPa
|
|
|
212
212
|
* calendar note's shortcode; see {@link module:engine/note-calendars}.
|
|
213
213
|
* @param {string} [options.configFile] - The configuration file, where an
|
|
214
214
|
* unknown `defaultCalendar` is reported.
|
|
215
|
+
* @param {string} [options.rootDir] - Consumer package root for loading installed
|
|
216
|
+
* encodings when filling language native-writing defaults.
|
|
215
217
|
* @param {Readonly<Record<string, {tag: string}>>} [options.languages] - The
|
|
216
218
|
* configured languages, which give each run's `lang=` its tag.
|
|
217
219
|
* @param {(key: string) => ({culture?: unknown}|undefined)} [options.foreignRecord] -
|
|
@@ -226,7 +228,7 @@ export function resolveCultures(records: Array<Record<string, any>>, { contentPa
|
|
|
226
228
|
* @returns {Array<Record<string, any>>} The records, in a total order that does
|
|
227
229
|
* not depend on directory-read order.
|
|
228
230
|
*/
|
|
229
|
-
export function collectContentIndex(contentBase: string, { contentPackage, currentDate, defaultCalendar, configFile, languages, skipDirectories, assetsBase, manifest, problems, addressContext, foreignRecord, parsed, sources, syntax, nameTypes, }: {
|
|
231
|
+
export function collectContentIndex(contentBase: string, { contentPackage, currentDate, defaultCalendar, configFile, rootDir, languages, skipDirectories, assetsBase, manifest, problems, addressContext, foreignRecord, parsed, sources, syntax, nameTypes, }: {
|
|
230
232
|
contentPackage: string;
|
|
231
233
|
skipDirectories: readonly string[];
|
|
232
234
|
assetsBase?: string | undefined;
|
|
@@ -236,6 +238,7 @@ export function collectContentIndex(contentBase: string, { contentPackage, curre
|
|
|
236
238
|
currentDate?: string | undefined;
|
|
237
239
|
defaultCalendar?: string | undefined;
|
|
238
240
|
configFile?: string | undefined;
|
|
241
|
+
rootDir?: string | undefined;
|
|
239
242
|
languages?: Readonly<Record<string, {
|
|
240
243
|
tag: string;
|
|
241
244
|
}>> | undefined;
|
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The context a resolved configuration gives, and the
|
|
2
|
+
* The context a resolved configuration gives, and the encodings an index holds.
|
|
3
3
|
*
|
|
4
|
-
* @param {{languages?: object, rootDir?: string}|undefined} config - The
|
|
4
|
+
* @param {{languages?: object, rootDir?: string, contentPackage?:string, paths?:{content?:string}}|undefined} config - The
|
|
5
5
|
* resolved configuration.
|
|
6
6
|
* @param {Iterable<Record<string, any>>} [records] - The content index's
|
|
7
|
-
* records, whose
|
|
7
|
+
* records, whose language notes supply lexical writings and script choices.
|
|
8
8
|
* @returns {RunContext} Its languages, the faces installed where it sits, and
|
|
9
|
-
* the
|
|
9
|
+
* the encodings. A fonts package that cannot be read gives no faces; a run naming
|
|
10
10
|
* one is reported.
|
|
11
11
|
*/
|
|
12
12
|
export function runContext(config: {
|
|
13
13
|
languages?: object;
|
|
14
14
|
rootDir?: string;
|
|
15
|
+
contentPackage?: string;
|
|
16
|
+
paths?: {
|
|
17
|
+
content?: string;
|
|
18
|
+
};
|
|
15
19
|
} | undefined, records?: Iterable<Record<string, any>>): RunContext;
|
|
16
20
|
/**
|
|
17
21
|
* Find the spans, divs and verse fences marked with `lang=`, `font=` or
|
|
18
|
-
* `
|
|
22
|
+
* `enc=`, and every fault in their markup and their text.
|
|
19
23
|
*
|
|
20
24
|
* @param {string} source - Authored Markdown: a note body, or a whole file
|
|
21
25
|
* whose frontmatter is blanked.
|
|
22
26
|
* @param {RunContext} [ctx] - The configured languages, the installed faces
|
|
23
|
-
* and the
|
|
24
|
-
*
|
|
27
|
+
* and the encodings. Without them every `lang=` must be a tag, every face and
|
|
28
|
+
* enc is unknown, and only `mono`, `serif` and `sans` are fonts.
|
|
25
29
|
* @param {import("./content-session.mjs").ContentSyntax} [syntax] - Session
|
|
26
30
|
* scanner projections, so the source's spans and blocks are scanned once.
|
|
27
|
-
* @returns {{runs: Run[], errors: Array<{line: number, column: number, message: string}>, warnings: Array<{line: number, column: number, message: string}>}}
|
|
31
|
+
* @returns {{runs: Run[], errors: Array<{file?: string, line: number, column: number, message: string}>, warnings: Array<{line: number, column: number, message: string}>}}
|
|
28
32
|
* The runs in source order, and each finding at its 1-based position. A
|
|
29
33
|
* warning is a `lang=` read as a tag that sits within one edit of a
|
|
30
|
-
* declared name.
|
|
34
|
+
* declared name. Diagnostic columns count Unicode code points; each run's
|
|
35
|
+
* source offsets and column remain UTF-16 units.
|
|
31
36
|
*/
|
|
32
37
|
export function scanRuns(source: string, ctx?: RunContext, syntax?: import("./content-session.mjs").ContentSyntax): {
|
|
33
38
|
runs: Run[];
|
|
34
39
|
errors: Array<{
|
|
40
|
+
file?: string;
|
|
35
41
|
line: number;
|
|
36
42
|
column: number;
|
|
37
43
|
message: string;
|
|
@@ -43,13 +49,13 @@ export function scanRuns(source: string, ctx?: RunContext, syntax?: import("./co
|
|
|
43
49
|
}>;
|
|
44
50
|
};
|
|
45
51
|
/**
|
|
46
|
-
* Rewrite text marked with `lang=`, `font=` and `
|
|
52
|
+
* Rewrite text marked with `lang=`, `font=` and `enc=` into the plain span,
|
|
47
53
|
* div and verse grammar the rest of each chain renders, one line for one line.
|
|
48
54
|
*
|
|
49
55
|
* - **Numbered verse prefixes and indentation markers** stay outside run text.
|
|
50
56
|
* Each authored run chooses its own language and presentation; physical
|
|
51
57
|
* lines and source positions remain unchanged.
|
|
52
|
-
* - **The
|
|
58
|
+
* - **The enc, if any, is applied first.** Characters Markdown would read are
|
|
53
59
|
* then backslash-escaped, so they reach every later pass as characters.
|
|
54
60
|
* - **Emphasis in a face** becomes an `<em>` or a `<strong>` carrying its
|
|
55
61
|
* convention's class, or no class where none is stated. The book reads
|
|
@@ -63,19 +69,19 @@ export function scanRuns(source: string, ctx?: RunContext, syntax?: import("./co
|
|
|
63
69
|
* mark, `<bdo>` or `<bdi>` is ever written: the code points carry their own
|
|
64
70
|
* direction.
|
|
65
71
|
* - **A scroll fence's body** is rewritten to one line per paragraph, its
|
|
66
|
-
* lines joined by what the
|
|
72
|
+
* lines joined by what the enc writes for a space, and left unescaped,
|
|
67
73
|
* since the body is raw. Its layout, each character with the source text it
|
|
68
74
|
* was written from, is returned for the book, which draws it.
|
|
69
75
|
*
|
|
70
76
|
* A run with a finding is left as written; {@link scanRuns} reports it.
|
|
71
77
|
*
|
|
72
78
|
* @param {string} source - Authored Markdown: a note body.
|
|
73
|
-
* @param {RunContext} [ctx] - The configured languages, faces and
|
|
79
|
+
* @param {RunContext} [ctx] - The configured languages, faces and encodings.
|
|
74
80
|
* @param {import("./content-session.mjs").ContentSyntax} [syntax] - Session
|
|
75
81
|
* scanner projections.
|
|
76
82
|
* @param {{target?: "site"|"foundry"|"book"}} [options] - The target the
|
|
77
83
|
* Markdown is rendered for; only `site` writes the search marker.
|
|
78
|
-
* @returns {{markdown: string, errors: Array<{line: number, column: number, message: string}>, scrolls: Map<string, import("./content-scroll.mjs").ScrollLayout>}}
|
|
84
|
+
* @returns {{markdown: string, errors: Array<{file?: string, line: number, column: number, message: string}>, scrolls: Map<string, import("./content-scroll.mjs").ScrollLayout>}}
|
|
79
85
|
* The rewritten Markdown, the findings of {@link scanRuns}, and each
|
|
80
86
|
* rewritten scroll fence's layout, by its rewritten body.
|
|
81
87
|
*/
|
|
@@ -84,6 +90,7 @@ export function renderRuns(source: string, ctx?: RunContext, syntax?: import("./
|
|
|
84
90
|
}): {
|
|
85
91
|
markdown: string;
|
|
86
92
|
errors: Array<{
|
|
93
|
+
file?: string;
|
|
87
94
|
line: number;
|
|
88
95
|
column: number;
|
|
89
96
|
message: string;
|
|
@@ -92,8 +99,6 @@ export function renderRuns(source: string, ctx?: RunContext, syntax?: import("./
|
|
|
92
99
|
};
|
|
93
100
|
/** The keys this module reads, which no construct passes through as written. */
|
|
94
101
|
export const RUN_KEYS: readonly string[];
|
|
95
|
-
/** Explicit opt-in to native-script presentation on this construct. */
|
|
96
|
-
export const NATIVEFONT_CLASS: "nativefont";
|
|
97
102
|
/** The generic families `font=` may name, each with the class that sets it. */
|
|
98
103
|
export const GENERIC_FONTS: Readonly<{
|
|
99
104
|
mono: "font-mono";
|
|
@@ -155,14 +160,14 @@ export type RunDetail = {
|
|
|
155
160
|
*/
|
|
156
161
|
generic: string | undefined;
|
|
157
162
|
/**
|
|
158
|
-
* - Its
|
|
163
|
+
* - Its enc.
|
|
159
164
|
*/
|
|
160
|
-
|
|
165
|
+
encoding: ReturnType<typeof import("./encoding.mjs").compileEncoding> | undefined;
|
|
161
166
|
/**
|
|
162
|
-
* - Its
|
|
167
|
+
* - Its enc,
|
|
163
168
|
* face and lexicon, which its text is set by.
|
|
164
169
|
*/
|
|
165
|
-
|
|
170
|
+
selection: ReturnType<typeof encodingFor> | undefined;
|
|
166
171
|
/**
|
|
167
172
|
* - The marked spans inside it.
|
|
168
173
|
*/
|
|
@@ -196,6 +201,16 @@ export type RunDetail = {
|
|
|
196
201
|
* - The emphasis it holds, by absolute offset.
|
|
197
202
|
*/
|
|
198
203
|
emphasis: Delimiter[];
|
|
204
|
+
/**
|
|
205
|
+
* - Its inline source structure permits Roman
|
|
206
|
+
* inventory validation, independently of encoding and face resolution.
|
|
207
|
+
*/
|
|
208
|
+
checkRoman?: boolean | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* - Its selection and source structure permit
|
|
211
|
+
* native encoding and output glyph validation.
|
|
212
|
+
*/
|
|
213
|
+
checkText?: boolean | undefined;
|
|
199
214
|
/**
|
|
200
215
|
* - A scroll fence whose opening has a finding,
|
|
201
216
|
* which is left as written.
|
|
@@ -206,6 +221,10 @@ export type RunDetail = {
|
|
|
206
221
|
* What a run is checked against.
|
|
207
222
|
*/
|
|
208
223
|
export type RunContext = {
|
|
224
|
+
/**
|
|
225
|
+
* - The citing content package.
|
|
226
|
+
*/
|
|
227
|
+
contentPackage?: string | undefined;
|
|
209
228
|
/**
|
|
210
229
|
* - The
|
|
211
230
|
* configured languages.
|
|
@@ -221,25 +240,73 @@ export type RunContext = {
|
|
|
221
240
|
faces?: ReadonlyMap<string, import("./script-fonts.mjs").Face> | undefined;
|
|
222
241
|
/**
|
|
223
242
|
* -
|
|
224
|
-
* The
|
|
225
|
-
|
|
243
|
+
* The compiled encoding documents, keyed by canonical and local Addresses.
|
|
244
|
+
*/
|
|
245
|
+
encodings?: ReadonlyMap<string, Readonly<{
|
|
246
|
+
name: any;
|
|
247
|
+
language?: any;
|
|
248
|
+
font?: any;
|
|
249
|
+
template?: Readonly<{
|
|
250
|
+
normalization: "NFC";
|
|
251
|
+
vowelGroups: any;
|
|
252
|
+
maxVowelGroup: number;
|
|
253
|
+
stress: "󠄔" | undefined;
|
|
254
|
+
diaeresis: boolean;
|
|
255
|
+
grave: boolean;
|
|
256
|
+
}> | undefined;
|
|
257
|
+
fonts: readonly any[];
|
|
258
|
+
separator: any;
|
|
259
|
+
separatorRow: {
|
|
260
|
+
from: string;
|
|
261
|
+
to: any;
|
|
262
|
+
key: string;
|
|
263
|
+
};
|
|
264
|
+
vowels: Set<any>;
|
|
265
|
+
accepted: Set<any>;
|
|
266
|
+
controls: any;
|
|
267
|
+
groupCase: any;
|
|
268
|
+
roundTrip: any;
|
|
269
|
+
shared: {
|
|
270
|
+
rows: any;
|
|
271
|
+
index: Map<any, any>;
|
|
272
|
+
readings: Map<any, any>;
|
|
273
|
+
};
|
|
274
|
+
faces: Map<any, any>;
|
|
275
|
+
codes: {
|
|
276
|
+
rows: any;
|
|
277
|
+
index: Map<any, any>;
|
|
278
|
+
readings: Map<any, any>;
|
|
279
|
+
};
|
|
280
|
+
}>> | undefined;
|
|
281
|
+
/**
|
|
282
|
+
* - Encoding-document or font-code findings.
|
|
226
283
|
*/
|
|
227
|
-
|
|
284
|
+
encodingFindings?: readonly {
|
|
285
|
+
file?: string;
|
|
286
|
+
line?: number;
|
|
287
|
+
column?: number;
|
|
288
|
+
message: string;
|
|
289
|
+
}[] | undefined;
|
|
228
290
|
/**
|
|
229
|
-
* -
|
|
230
|
-
* The script each configured language's note names, by language name, from
|
|
231
|
-
* {@link module :engine/written-in.writtenInOf}.
|
|
291
|
+
* - Serialized encoding documents and their selected font codes.
|
|
232
292
|
*/
|
|
233
|
-
|
|
293
|
+
encodingDefinitions?: ReadonlyMap<string, {
|
|
294
|
+
data: object;
|
|
295
|
+
codes: Record<string, string>;
|
|
296
|
+
}> | undefined;
|
|
297
|
+
/**
|
|
298
|
+
* - The configured language notes.
|
|
299
|
+
*/
|
|
300
|
+
languageRecords?: ReadonlyMap<string, Record<string, any>> | undefined;
|
|
234
301
|
/**
|
|
235
302
|
* -
|
|
236
303
|
* Each configured language's lexicon by name, from
|
|
237
|
-
* {@link module :engine/
|
|
304
|
+
* {@link module :engine/encoding-lexicon.lexiconsFromRecords}.
|
|
238
305
|
*/
|
|
239
|
-
lexicons?: ReadonlyMap<string, import("./
|
|
306
|
+
lexicons?: ReadonlyMap<string, import("./encoding-lexicon.mjs").Lexicon> | undefined;
|
|
240
307
|
/**
|
|
241
308
|
* -
|
|
242
|
-
* What each configured language's
|
|
309
|
+
* What each configured language's encoded runs are checked against, from
|
|
243
310
|
* {@link module :engine/run-words.wordBooksFromRecords}.
|
|
244
311
|
*/
|
|
245
312
|
wordBooks?: ReadonlyMap<string, import("./run-words.mjs").WordBook> | undefined;
|
|
@@ -254,6 +321,11 @@ export type RunContext = {
|
|
|
254
321
|
* {@link module :engine/verse-metre.metreBooksFromRecords}.
|
|
255
322
|
*/
|
|
256
323
|
metreBooks?: ReadonlyMap<string, import("./verse-metre.mjs").MetreBook> | undefined;
|
|
324
|
+
/**
|
|
325
|
+
* -
|
|
326
|
+
* Exact Roman source inventories by configured alias and BCP 47 tag.
|
|
327
|
+
*/
|
|
328
|
+
romanInventories?: ReadonlyMap<string, import("./roman-characters.mjs").RomanInventory> | undefined;
|
|
257
329
|
/**
|
|
258
330
|
* -
|
|
259
331
|
* Each face's emphasis conventions, from the script notes, by
|
|
@@ -274,11 +346,9 @@ export type RunContext = {
|
|
|
274
346
|
directions?: ReadonlyMap<string, "vertical-rl"> | undefined;
|
|
275
347
|
};
|
|
276
348
|
/**
|
|
277
|
-
* One span, div, verse fence or scroll fence carrying
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* defaults are selected only by this construct's explicit `.nativefont`
|
|
281
|
-
* opt-in; marked children make their own presentation choice.
|
|
349
|
+
* One span, div, verse fence or scroll fence carrying run attributes.
|
|
350
|
+
* Values combine explicit choices, class-only inheritance, encoding-document
|
|
351
|
+
* language/font defaults and the Roman default encoding.
|
|
282
352
|
*/
|
|
283
353
|
export type Run = {
|
|
284
354
|
/**
|
|
@@ -299,9 +369,9 @@ export type Run = {
|
|
|
299
369
|
*/
|
|
300
370
|
font: string | undefined;
|
|
301
371
|
/**
|
|
302
|
-
* - The
|
|
372
|
+
* - The resolved document Address, or default for Roman text.
|
|
303
373
|
*/
|
|
304
|
-
|
|
374
|
+
enc: string | undefined;
|
|
305
375
|
/**
|
|
306
376
|
* - 1-based line of the construct's opening.
|
|
307
377
|
*/
|
|
@@ -320,9 +390,5 @@ export type Run = {
|
|
|
320
390
|
* fence's 0-based closing line.
|
|
321
391
|
*/
|
|
322
392
|
end: number;
|
|
323
|
-
/**
|
|
324
|
-
* - True only for an explicit native opt-in
|
|
325
|
-
* with its own language; retained by index records for deferred defaults.
|
|
326
|
-
*/
|
|
327
|
-
nativefont?: boolean | undefined;
|
|
328
393
|
};
|
|
394
|
+
import { encodingFor } from "./encoding-lexicon.mjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Return only the published definitions and lexical inputs the converter reads. */
|
|
2
|
+
export function buildConverterData(config: any, records: any): import("../convert.mjs").ConverterData;
|
|
3
|
+
/** Write opted-in converter inputs during the package's manifest build. */
|
|
4
|
+
export function writeConverterData({ config, packageBuild, records }: {
|
|
5
|
+
config: any;
|
|
6
|
+
packageBuild: any;
|
|
7
|
+
records: any;
|
|
8
|
+
}): {
|
|
9
|
+
path: string;
|
|
10
|
+
data: import("../convert.mjs").ConverterData;
|
|
11
|
+
} | undefined;
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A noun's stated plural, or the first literal ending replacement that fits.
|
|
3
|
-
*
|
|
4
|
-
* @param {{form: string, class?: unknown, plural?: unknown}} word - A word of
|
|
5
|
-
* `data.words`.
|
|
6
|
-
* @param {Record<string, any>|undefined} grammar - Its language's
|
|
7
|
-
* `data.grammar`.
|
|
8
|
-
* @returns {string|null} The plural, or `null` for a word that is no noun or
|
|
9
|
-
* that no rule fits.
|
|
10
|
-
*/
|
|
11
|
-
export function pluralOf(word: {
|
|
12
|
-
form: string;
|
|
13
|
-
class?: unknown;
|
|
14
|
-
plural?: unknown;
|
|
15
|
-
}, grammar: Record<string, any> | undefined): string | null;
|
|
16
|
-
/**
|
|
17
|
-
* The plural a language's `data.grammar.plural` rule gives a form: the first
|
|
18
|
-
* literal ending replacement that fits, whatever the form's class.
|
|
19
|
-
*
|
|
20
|
-
* @param {string} form - The form.
|
|
21
|
-
* @param {Record<string, any>|undefined} grammar - Its language's
|
|
22
|
-
* `data.grammar`.
|
|
23
|
-
* @returns {string|null} The plural, or `null` where no rule fits.
|
|
24
|
-
*/
|
|
25
|
-
export function pluralByRule(form: string, grammar: Record<string, any> | undefined): string | null;
|
|
26
1
|
/**
|
|
27
2
|
* The stable prose anchor of a word in one language's dictionary. The exact
|
|
28
3
|
* language and NFC form identify it, including case and accents.
|
|
@@ -71,3 +46,4 @@ export const DICTIONARY_COLUMNS: readonly string[];
|
|
|
71
46
|
export const TERM_COLUMNS: readonly string[];
|
|
72
47
|
/** The keys of a word's `etymology`, in order. */
|
|
73
48
|
export const ETYMOLOGY_KEYS: readonly string[];
|
|
49
|
+
export { pluralOf, pluralByRule } from "./word-inflections.mjs";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Prove ordinary output tokens uniquely decodable without adding invisible metadata. */
|
|
2
|
+
/**
|
|
3
|
+
* Check codeword integrity with a trie and finite Sardinas–Patterson residuals.
|
|
4
|
+
* Source-equivalent compositions are redundant rules, not distinct spellings.
|
|
5
|
+
* @param {Array<{from:string,to:string,key:string,before?:string,at?:string}>} rows - Validated ordinary rows.
|
|
6
|
+
* @param {(key:string,message:string)=>never} fault - Positioned schema-error constructor.
|
|
7
|
+
*/
|
|
8
|
+
export function assertUniqueOutputs(rows: Array<{
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
key: string;
|
|
12
|
+
before?: string;
|
|
13
|
+
at?: string;
|
|
14
|
+
}>, fault: (key: string, message: string) => never): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode using the lexicon's own and composed writings before the encoding rows.
|
|
3
|
+
* @param {ReturnType<import("./encoding.mjs").compileEncoding>} enc
|
|
4
|
+
* @param {string} text
|
|
5
|
+
* @param {{font?:string,verse?:boolean,lexicon?:{language:string,data:Record<string,any>}}} [options]
|
|
6
|
+
* @returns {{text:string,pieces:object[],findings:object[]}}
|
|
7
|
+
*/
|
|
8
|
+
export function encodeWithLanguage(enc: ReturnType<typeof import("./encoding.mjs").compileEncoding>, text: string, options?: {
|
|
9
|
+
font?: string;
|
|
10
|
+
verse?: boolean;
|
|
11
|
+
lexicon?: {
|
|
12
|
+
language: string;
|
|
13
|
+
data: Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
}): {
|
|
16
|
+
text: string;
|
|
17
|
+
pieces: object[];
|
|
18
|
+
findings: object[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Decode with explicit writings first and recover unmarked words from the lexicon.
|
|
22
|
+
* @param {ReturnType<import("./encoding.mjs").compileEncoding>} enc
|
|
23
|
+
* @param {string} text
|
|
24
|
+
* @param {{font?:string,lexicon?:{language:string,data:Record<string,any>}}} [options]
|
|
25
|
+
* @returns {{text:string,findings:object[]}}
|
|
26
|
+
*/
|
|
27
|
+
export function decodeWithLanguage(enc: ReturnType<typeof import("./encoding.mjs").compileEncoding>, text: string, options?: {
|
|
28
|
+
font?: string;
|
|
29
|
+
lexicon?: {
|
|
30
|
+
language: string;
|
|
31
|
+
data: Record<string, any>;
|
|
32
|
+
};
|
|
33
|
+
}): {
|
|
34
|
+
text: string;
|
|
35
|
+
findings: object[];
|
|
36
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each configured language's lexicon, read from the language note its `note`
|
|
3
|
+
* names and its family chain. The nearest exact NFC form supplies the whole
|
|
4
|
+
* word; grammar, registers and other settings remain the daughter's own.
|
|
5
|
+
* A language with no `note`, or one naming no language note, has none.
|
|
6
|
+
*
|
|
7
|
+
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
8
|
+
* @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string}} config -
|
|
9
|
+
* The resolved configuration.
|
|
10
|
+
* @returns {Map<string, Lexicon>} The lexicons by language name.
|
|
11
|
+
*/
|
|
12
|
+
export function lexiconsFromRecords(records: Iterable<Record<string, any>> | undefined, config?: {
|
|
13
|
+
languages?: Readonly<Record<string, {
|
|
14
|
+
tag: string;
|
|
15
|
+
note?: string;
|
|
16
|
+
}>>;
|
|
17
|
+
contentPackage?: string;
|
|
18
|
+
}): Map<string, Lexicon>;
|
|
19
|
+
/**
|
|
20
|
+
* The language note each configured language's `note` names, by language
|
|
21
|
+
* name. A language with no `note`, or one naming no language note, is absent.
|
|
22
|
+
*
|
|
23
|
+
* @param {Iterable<Record<string, any>>|undefined} records - Index records.
|
|
24
|
+
* @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string}} config -
|
|
25
|
+
* The resolved configuration.
|
|
26
|
+
* @returns {Map<string, Record<string, any>>} The records.
|
|
27
|
+
*/
|
|
28
|
+
export function languageRecordsByName(records: Iterable<Record<string, any>> | undefined, { languages, contentPackage }?: {
|
|
29
|
+
languages?: Readonly<Record<string, {
|
|
30
|
+
tag: string;
|
|
31
|
+
note?: string;
|
|
32
|
+
}>>;
|
|
33
|
+
contentPackage?: string;
|
|
34
|
+
}): Map<string, Record<string, any>>;
|
|
35
|
+
/**
|
|
36
|
+
* Each `languages.<name>.note` that names no language note, at its key.
|
|
37
|
+
*
|
|
38
|
+
* @param {{languages?: Readonly<Record<string, {tag: string, note?: string}>>, contentPackage?: string, configFile?: string, configText?: string}} config -
|
|
39
|
+
* The resolved configuration, and where it was read from.
|
|
40
|
+
* @param {Iterable<Record<string, any>>} records - Index records.
|
|
41
|
+
* @returns {object[]} The findings.
|
|
42
|
+
*/
|
|
43
|
+
export function languageNoteFindings(config: {
|
|
44
|
+
languages?: Readonly<Record<string, {
|
|
45
|
+
tag: string;
|
|
46
|
+
note?: string;
|
|
47
|
+
}>>;
|
|
48
|
+
contentPackage?: string;
|
|
49
|
+
configFile?: string;
|
|
50
|
+
configText?: string;
|
|
51
|
+
}, records: Iterable<Record<string, any>>): object[];
|
|
52
|
+
/**
|
|
53
|
+
* One row per native form of a language note's word, for the `natives`
|
|
54
|
+
* relation: a text is a value of a row, never a struct key, so forms that
|
|
55
|
+
* differ only in case stay apart.
|
|
56
|
+
*
|
|
57
|
+
* @param {Iterable<Record<string, any>>} records - Index records.
|
|
58
|
+
* @returns {Array<Record<string, string|number|null>>} The rows; `word` is the
|
|
59
|
+
* word's 0-based place in `data.words`, `native` the form's in its `native`.
|
|
60
|
+
*/
|
|
61
|
+
export function nativeRows(records: Iterable<Record<string, any>>): Array<Record<string, string | number | null>>;
|
|
62
|
+
/** Project only conversion-readable language data to a JSON-safe object. */
|
|
63
|
+
export function serializeLexicon(lexicon: any): {
|
|
64
|
+
language: any;
|
|
65
|
+
data: {
|
|
66
|
+
grammar?: {
|
|
67
|
+
[k: string]: any;
|
|
68
|
+
} | undefined;
|
|
69
|
+
words: {
|
|
70
|
+
[k: string]: any;
|
|
71
|
+
}[];
|
|
72
|
+
affixes: {
|
|
73
|
+
[k: string]: any;
|
|
74
|
+
}[];
|
|
75
|
+
register: {
|
|
76
|
+
[k: string]: any;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
} | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve encoding, face and optional language input without loading files.
|
|
82
|
+
*
|
|
83
|
+
* @param {import("./content-scripts.mjs").RunContext} ctx - Installed encodings,
|
|
84
|
+
* document aliases and lexicons prepared by the caller.
|
|
85
|
+
* @param {object} [options] - Explicit selections; an omitted encoding is the Roman default.
|
|
86
|
+
* @param {string} [options.enc] - Encoding document Address.
|
|
87
|
+
* @param {string} [options.font] - The encoding document's font.
|
|
88
|
+
* @param {string} [options.lang] - Configured language whose lexicon to use.
|
|
89
|
+
*/
|
|
90
|
+
export function encodingFor(ctx: import("./content-scripts.mjs").RunContext, { enc, font, lang }?: {
|
|
91
|
+
enc?: string | undefined;
|
|
92
|
+
font?: string | undefined;
|
|
93
|
+
lang?: string | undefined;
|
|
94
|
+
}): {
|
|
95
|
+
encoding: Readonly<{
|
|
96
|
+
name: any;
|
|
97
|
+
language?: any;
|
|
98
|
+
font?: any;
|
|
99
|
+
template?: Readonly<{
|
|
100
|
+
normalization: "NFC";
|
|
101
|
+
vowelGroups: any;
|
|
102
|
+
maxVowelGroup: number;
|
|
103
|
+
stress: "󠄔" | undefined;
|
|
104
|
+
diaeresis: boolean;
|
|
105
|
+
grave: boolean;
|
|
106
|
+
}> | undefined;
|
|
107
|
+
fonts: readonly any[];
|
|
108
|
+
separator: any;
|
|
109
|
+
separatorRow: {
|
|
110
|
+
from: string;
|
|
111
|
+
to: any;
|
|
112
|
+
key: string;
|
|
113
|
+
};
|
|
114
|
+
vowels: Set<any>;
|
|
115
|
+
accepted: Set<any>;
|
|
116
|
+
controls: any;
|
|
117
|
+
groupCase: any;
|
|
118
|
+
roundTrip: any;
|
|
119
|
+
shared: {
|
|
120
|
+
rows: any;
|
|
121
|
+
index: Map<any, any>;
|
|
122
|
+
readings: Map<any, any>;
|
|
123
|
+
};
|
|
124
|
+
faces: Map<any, any>;
|
|
125
|
+
codes: {
|
|
126
|
+
rows: any;
|
|
127
|
+
index: Map<any, any>;
|
|
128
|
+
readings: Map<any, any>;
|
|
129
|
+
};
|
|
130
|
+
}>;
|
|
131
|
+
font: any;
|
|
132
|
+
lexicon: {
|
|
133
|
+
language: any;
|
|
134
|
+
data: {
|
|
135
|
+
grammar?: {
|
|
136
|
+
[k: string]: any;
|
|
137
|
+
} | undefined;
|
|
138
|
+
words: {
|
|
139
|
+
[k: string]: any;
|
|
140
|
+
}[];
|
|
141
|
+
affixes: {
|
|
142
|
+
[k: string]: any;
|
|
143
|
+
}[];
|
|
144
|
+
register: {
|
|
145
|
+
[k: string]: any;
|
|
146
|
+
}[];
|
|
147
|
+
};
|
|
148
|
+
} | undefined;
|
|
149
|
+
} | undefined;
|
|
150
|
+
/** Why a face is incompatible with the selected encoding. */
|
|
151
|
+
export function fontProblem(encoding: any, font: any): string | undefined;
|
|
152
|
+
/** List authored and optionally derived forms with their selected native writings. */
|
|
153
|
+
export function lexiconEntries(ctx: any, { lang, enc, font, derived }: {
|
|
154
|
+
lang: any;
|
|
155
|
+
enc: any;
|
|
156
|
+
font: any;
|
|
157
|
+
derived?: boolean | undefined;
|
|
158
|
+
}): {
|
|
159
|
+
about: string;
|
|
160
|
+
problem: string;
|
|
161
|
+
entries?: undefined;
|
|
162
|
+
} | {
|
|
163
|
+
entries: {
|
|
164
|
+
from?: any;
|
|
165
|
+
ambiguous?: boolean | undefined;
|
|
166
|
+
form: any;
|
|
167
|
+
native: string;
|
|
168
|
+
class: any;
|
|
169
|
+
gloss: any;
|
|
170
|
+
source: string;
|
|
171
|
+
exception: boolean;
|
|
172
|
+
}[];
|
|
173
|
+
about?: undefined;
|
|
174
|
+
problem?: undefined;
|
|
175
|
+
};
|
|
176
|
+
/** Validate word, affix and grammar-ending native entries against installed encodings. */
|
|
177
|
+
export function checkLexiconNatives(note: any, ctx: any): any[];
|
|
178
|
+
/** Validate every authored word and name against its language's encoding documents.
|
|
179
|
+
* @param {{fm:Record<string,any>,file:string,raw?:string}} note - The source language note.
|
|
180
|
+
* @param {import("./content-scripts.mjs").RunContext} ctx - Compiled documents and language identities.
|
|
181
|
+
* @returns {object[]} Positioned orthography findings, independent of lexical native overrides.
|
|
182
|
+
*/
|
|
183
|
+
export function checkEncodingLexicon(note: {
|
|
184
|
+
fm: Record<string, any>;
|
|
185
|
+
file: string;
|
|
186
|
+
raw?: string;
|
|
187
|
+
}, ctx: import("./content-scripts.mjs").RunContext): object[];
|
|
188
|
+
/** Every column of the `natives` relation, in order. */
|
|
189
|
+
export const NATIVE_COLUMNS: readonly string[];
|
|
190
|
+
/**
|
|
191
|
+
* One native form, read.
|
|
192
|
+
*/
|
|
193
|
+
export type NativeForm = {
|
|
194
|
+
/**
|
|
195
|
+
* - The encoding it is written for.
|
|
196
|
+
*/
|
|
197
|
+
enc: string;
|
|
198
|
+
/**
|
|
199
|
+
* - The one face it is for.
|
|
200
|
+
*/
|
|
201
|
+
font: string | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* - The word in the script.
|
|
204
|
+
*/
|
|
205
|
+
text: string;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* One word of a lexicon.
|
|
209
|
+
*/
|
|
210
|
+
export type LexiconWord = {
|
|
211
|
+
/**
|
|
212
|
+
* - The word as cited.
|
|
213
|
+
*/
|
|
214
|
+
form: string;
|
|
215
|
+
/**
|
|
216
|
+
* - Its class.
|
|
217
|
+
*/
|
|
218
|
+
class: string | null;
|
|
219
|
+
/**
|
|
220
|
+
* - Its senses, joined by `; `.
|
|
221
|
+
*/
|
|
222
|
+
gloss: string | null;
|
|
223
|
+
/**
|
|
224
|
+
* - Its native forms.
|
|
225
|
+
*/
|
|
226
|
+
natives: readonly NativeForm[];
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* A language's lexicon.
|
|
230
|
+
*/
|
|
231
|
+
export type Lexicon = {
|
|
232
|
+
/**
|
|
233
|
+
* - The language's configured name.
|
|
234
|
+
*/
|
|
235
|
+
language: string;
|
|
236
|
+
/**
|
|
237
|
+
* - Its words, in `data.words` order.
|
|
238
|
+
*/
|
|
239
|
+
words: readonly LexiconWord[];
|
|
240
|
+
/**
|
|
241
|
+
* - The native
|
|
242
|
+
* forms by the word's form, NFC; the first word of a form keeps it.
|
|
243
|
+
*/
|
|
244
|
+
byForm: ReadonlyMap<string, readonly NativeForm[]>;
|
|
245
|
+
/**
|
|
246
|
+
* - The
|
|
247
|
+
* forms the language's rules derive from its words, folded, as the mapped-run
|
|
248
|
+
* word check accepts them (see {@link module :engine/word-forms.derivedForms}).
|
|
249
|
+
*/
|
|
250
|
+
derived: ReadonlyArray<{
|
|
251
|
+
form: string;
|
|
252
|
+
from: LexiconWord;
|
|
253
|
+
}>;
|
|
254
|
+
/**
|
|
255
|
+
* - The language note's `data`, which a
|
|
256
|
+
* encoding writes words from.
|
|
257
|
+
*/
|
|
258
|
+
data: Record<string, any>;
|
|
259
|
+
};
|