prosebook 0.2.0 → 0.3.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 (112) hide show
  1. package/README.md +274 -29
  2. package/dist/bun.d.ts +34 -0
  3. package/dist/bun.d.ts.map +1 -0
  4. package/dist/bun.js +98 -0
  5. package/dist/bun.js.map +1 -0
  6. package/dist/bundle-DboItAre.js +111 -0
  7. package/dist/bundle-DboItAre.js.map +1 -0
  8. package/dist/bundle-KD-DiiFa.d.ts +6 -0
  9. package/dist/bundle-KD-DiiFa.d.ts.map +1 -0
  10. package/dist/cli.js +51 -56
  11. package/dist/cli.js.map +1 -1
  12. package/dist/compile-xF3F4oIp.d.ts +16 -0
  13. package/dist/compile-xF3F4oIp.d.ts.map +1 -0
  14. package/dist/{config-D--RITk2.js → config-BPSmoYel.js} +36 -212
  15. package/dist/config-BPSmoYel.js.map +1 -0
  16. package/dist/{config-_4HfnJQu.d.ts → config-DdMkKt_N.d.ts} +61 -2
  17. package/dist/config-DdMkKt_N.d.ts.map +1 -0
  18. package/dist/config.d.ts +2 -2
  19. package/dist/config.js +1 -1
  20. package/dist/{copy-DXnzXsJa.d.ts → copy-B3V_QRkT.d.ts} +20 -7
  21. package/dist/copy-B3V_QRkT.d.ts.map +1 -0
  22. package/dist/copy-Bo_FIoLy.js +154 -0
  23. package/dist/copy-Bo_FIoLy.js.map +1 -0
  24. package/dist/endpoints-CnUfCkIk.js +96 -0
  25. package/dist/endpoints-CnUfCkIk.js.map +1 -0
  26. package/dist/generate-9pR3i5Bj.js +5173 -0
  27. package/dist/generate-9pR3i5Bj.js.map +1 -0
  28. package/dist/helpers-BWGcD0kS.js +96 -0
  29. package/dist/helpers-BWGcD0kS.js.map +1 -0
  30. package/dist/icu-Dej0mNsF.js +218 -0
  31. package/dist/icu-Dej0mNsF.js.map +1 -0
  32. package/dist/index.d.ts +12 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +4 -188
  35. package/dist/inspector.d.ts +4 -1
  36. package/dist/inspector.d.ts.map +1 -1
  37. package/dist/inspector.js +7 -2
  38. package/dist/inspector.js.map +1 -1
  39. package/dist/locale-DpQA1pqH.js +70 -0
  40. package/dist/locale-DpQA1pqH.js.map +1 -0
  41. package/dist/next-loader.d.ts +11 -0
  42. package/dist/next-loader.d.ts.map +1 -0
  43. package/dist/next-loader.js +17 -0
  44. package/dist/next-loader.js.map +1 -0
  45. package/dist/next.d.ts +30 -0
  46. package/dist/next.d.ts.map +1 -0
  47. package/dist/next.js +160 -0
  48. package/dist/next.js.map +1 -0
  49. package/dist/react/index.d.ts +3 -3
  50. package/dist/react/index.d.ts.map +1 -1
  51. package/dist/react/index.js.map +1 -1
  52. package/dist/react/server.d.ts +20 -0
  53. package/dist/react/server.d.ts.map +1 -0
  54. package/dist/react/server.js +34 -0
  55. package/dist/react/server.js.map +1 -0
  56. package/dist/{sarif-CI8HOokm.js → sarif-CWyTAQ0y.js} +103 -87
  57. package/dist/sarif-CWyTAQ0y.js.map +1 -0
  58. package/dist/scan-Bx0_yDSi.js +387 -0
  59. package/dist/scan-Bx0_yDSi.js.map +1 -0
  60. package/dist/tools.d.ts +83 -90
  61. package/dist/tools.d.ts.map +1 -1
  62. package/dist/tools.js +5 -4
  63. package/dist/vite.d.ts +3 -2
  64. package/dist/vite.d.ts.map +1 -1
  65. package/dist/vite.js +29 -109
  66. package/dist/vite.js.map +1 -1
  67. package/package.json +37 -4
  68. package/src/bun.ts +132 -0
  69. package/src/cli.ts +60 -58
  70. package/src/index.ts +1 -1
  71. package/src/inspector.ts +8 -3
  72. package/src/next-loader.ts +16 -0
  73. package/src/next.ts +188 -0
  74. package/src/react/index.tsx +6 -6
  75. package/src/react/server.ts +37 -0
  76. package/src/runtime/copy.ts +22 -3
  77. package/src/runtime/helpers.ts +54 -18
  78. package/src/runtime/locale.ts +19 -0
  79. package/src/runtime/types.ts +21 -6
  80. package/src/tools/bundle.ts +131 -0
  81. package/src/tools/catalog.ts +2 -2
  82. package/src/tools/compile.ts +60 -23
  83. package/src/tools/config.ts +39 -0
  84. package/src/tools/endpoints.ts +121 -0
  85. package/src/tools/entry.ts +77 -0
  86. package/src/tools/generate.ts +2 -0
  87. package/src/tools/icu.ts +63 -7
  88. package/src/tools/index.ts +6 -3
  89. package/src/tools/lock.ts +7 -0
  90. package/src/tools/mf1.ts +21 -7
  91. package/src/tools/mf2.ts +249 -57
  92. package/src/tools/migrate.ts +3 -2
  93. package/src/tools/native/emit.ts +87 -0
  94. package/src/tools/native/index.ts +36 -0
  95. package/src/tools/native/kotlin.ts +269 -0
  96. package/src/tools/native/model.ts +280 -0
  97. package/src/tools/native/number.ts +210 -0
  98. package/src/tools/native/plurals.ts +103 -0
  99. package/src/tools/native/rust.ts +367 -0
  100. package/src/tools/native/swift.ts +326 -0
  101. package/src/tools/syntax.ts +3 -3
  102. package/src/tools/todo.ts +118 -0
  103. package/src/vite.ts +28 -114
  104. package/dist/config-D--RITk2.js.map +0 -1
  105. package/dist/config-_4HfnJQu.d.ts.map +0 -1
  106. package/dist/copy-DXnzXsJa.d.ts.map +0 -1
  107. package/dist/helpers-BPuPGjQP.js +0 -61
  108. package/dist/helpers-BPuPGjQP.js.map +0 -1
  109. package/dist/index.js.map +0 -1
  110. package/dist/sarif-CI8HOokm.js.map +0 -1
  111. package/dist/scan-Ch2BfIUD.js +0 -2561
  112. package/dist/scan-Ch2BfIUD.js.map +0 -1
@@ -1,197 +1,7 @@
1
+ import { d as staticLiteral, p as walk, t as TYPE } from "./icu-Dej0mNsF.js";
1
2
  import { isAbsolute, join, resolve } from "node:path";
2
3
  import { pathToFileURL } from "node:url";
3
4
  import { existsSync, readFileSync } from "node:fs";
4
- import { TYPE as TYPE$1, isDateElement, isNumberElement, isTimeElement, parse } from "@formatjs/icu-messageformat-parser";
5
- // src/tools/icu.ts
6
- /**
7
- * What an ICU message declares, read off its AST: argument types, tags, and whether each number and
8
- * date style is one the formatter honors. Shared by the loader, the compiler and the lint.
9
- */
10
- function parseMessage(text) {
11
- const ast = parse(text, {
12
- shouldParseSkeletons: true,
13
- requiresOtherClause: true
14
- });
15
- walk(ast, (el) => {
16
- if ((isDateElement(el) || isTimeElement(el)) && typeof el.style === "object" && el.style !== null && el.style.pattern.includes("j")) el.style.parsedOptions = localHour(el.style.pattern);
17
- });
18
- return ast;
19
- }
20
- /**
21
- * A skeleton's `j` is the hour as the locale writes it, 12 or 24. The parser resolves it only when
22
- * given a locale and drops it otherwise, so `::yMMMdjmm` showed the minute alone. Read here as an
23
- * hour with no cycle, which `Intl` gives the cycle of whatever locale formats it: "2:05 PM", "14:05".
24
- */
25
- function localHour(pattern) {
26
- const run = /j+/.exec(pattern)[0];
27
- const rest = pattern.replaceAll("j", "");
28
- return {
29
- ...rest === "" ? {} : dateFields(rest),
30
- hour: run.length % 2 === 0 ? "2-digit" : "numeric"
31
- };
32
- }
33
- /** What the parser reads from a date skeleton on its own; nothing where it can't parse it. */
34
- function dateFields(skeleton) {
35
- try {
36
- const el = parse(`{d, date, ::${skeleton}}`, { shouldParseSkeletons: true })[0];
37
- return el !== void 0 && isDateElement(el) && typeof el.style === "object" && el.style !== null ? el.style.parsedOptions : {};
38
- } catch {
39
- return {};
40
- }
41
- }
42
- /**
43
- * ICU argument types, as TypeScript. A bare `{x}` is a string: a number spliced in raw is printed by
44
- * `String()`, which knows no locale, so a quantity says `{x, number}` and the type is what asks for it.
45
- * A `select` narrows to the arms it names, and still takes any string, since `other` catches the rest.
46
- */
47
- function argType(el) {
48
- switch (el.type) {
49
- case TYPE$1.argument: return "string";
50
- case TYPE$1.number:
51
- case TYPE$1.plural: return "number";
52
- case TYPE$1.date:
53
- case TYPE$1.time: return "Date | number";
54
- case TYPE$1.select: {
55
- const named = Object.keys(el.options).filter((o) => o !== "other");
56
- return named.length > 0 ? `${named.map((o) => JSON.stringify(o)).join(" | ")} | (string & {})` : "string";
57
- }
58
- case TYPE$1.literal:
59
- case TYPE$1.pound:
60
- case TYPE$1.tag:
61
- default: return;
62
- }
63
- }
64
- /** Calls `visit` on every element, inside plural and select arms and tags too. */
65
- function walk(elements, visit) {
66
- for (const el of elements) {
67
- visit(el);
68
- if (el.type === TYPE$1.select || el.type === TYPE$1.plural) for (const option of Object.values(el.options)) walk(option.value, visit);
69
- if (el.type === TYPE$1.tag) walk(el.children, visit);
70
- }
71
- }
72
- function argsOf(elements, clash = () => {}) {
73
- const args = /* @__PURE__ */ new Map();
74
- walk(elements, (el) => {
75
- const type = argType(el);
76
- if (type === void 0 || !("value" in el) || typeof el.value !== "string") return;
77
- const seen = args.get(el.value);
78
- if (seen !== void 0 && seen !== type) clash(el.value);
79
- else args.set(el.value, type);
80
- });
81
- return args;
82
- }
83
- function tagsOf(elements) {
84
- const tags = /* @__PURE__ */ new Set();
85
- walk(elements, (el) => {
86
- if (el.type === TYPE$1.tag) tags.add(el.value);
87
- });
88
- return [...tags].sort();
89
- }
90
- /** A message with no placeholders and no tags renders to one literal, which ships as a plain string. */
91
- function staticLiteral(ast) {
92
- if (ast.length === 0) return "";
93
- if (ast.length === 1 && ast[0].type === TYPE$1.literal) return ast[0].value;
94
- }
95
- const NUMBER_STYLES = {
96
- integer: { maximumFractionDigits: 0 },
97
- percent: { style: "percent" }
98
- };
99
- const DATE_STYLES = [
100
- "short",
101
- "medium",
102
- "long",
103
- "full"
104
- ];
105
- /** The `Intl` options a number element formats with. Throws, with the fix, where the style is wrong. */
106
- function numberOptions(el) {
107
- const style = el.style;
108
- if (style === null || style === void 0) return void 0;
109
- if (typeof style === "string") {
110
- if (style === "currency") throw new Error(`{${el.value}} needs its currency named: {${el.value}, number, ::currency/EUR}`);
111
- const named = NUMBER_STYLES[style];
112
- if (named === void 0) throw new Error(`{${el.value}} asks for number style "${style}": integer, percent, or a ::skeleton`);
113
- return named;
114
- }
115
- const unknown = style.tokens.filter((t) => !stemIsKnown(t.stem, t.options)).map((t) => t.stem);
116
- if (unknown.length > 0) throw new Error(`{${el.value}} has skeleton stems the formatter drops without a word: ${unknown.join(", ")}`);
117
- const options = style.parsedOptions;
118
- try {
119
- new Intl.NumberFormat("en", options).resolvedOptions();
120
- } catch (e) {
121
- throw new Error(`{${el.value}} has a skeleton Intl refuses: ${e.message}`, { cause: e });
122
- }
123
- return options;
124
- }
125
- /** The `Intl` options a date or time element formats with. Throws, with the fix, where the style is wrong. */
126
- function dateOptions(el) {
127
- const style = el.style;
128
- const field = el.type === TYPE$1.time ? "timeStyle" : "dateStyle";
129
- if (style === null || style === void 0) return el.type === TYPE$1.time ? { timeStyle: "short" } : void 0;
130
- if (typeof style === "string") {
131
- if (!DATE_STYLES.includes(style)) {
132
- const kind = el.type === TYPE$1.time ? "time" : "date";
133
- throw new Error(`{${el.value}} asks for ${kind} style "${style}": ${DATE_STYLES.join(", ")}, or a ::skeleton`);
134
- }
135
- return { [field]: style };
136
- }
137
- const dropped = (style.pattern.match(/([A-Za-z])*/g) ?? []).filter((f) => !f.startsWith("j") && Object.keys(dateFields(f)).length === 0);
138
- if (dropped.length > 0) throw new Error(`{${el.value}} has date fields the formatter drops without a word: ${dropped.join(", ")}`);
139
- if (Object.keys(style.parsedOptions).length === 0) throw new Error(`{${el.value}} has a date skeleton the formatter reads nothing from: "${style.pattern}"`);
140
- try {
141
- new Intl.DateTimeFormat("en", style.parsedOptions).resolvedOptions();
142
- } catch (e) {
143
- throw new Error(`{${el.value}} has a skeleton Intl refuses: ${e.message}`, { cause: e });
144
- }
145
- return style.parsedOptions;
146
- }
147
- /**
148
- * Whether the formatter understands a skeleton stem. One it does not is dropped without a word, so
149
- * `::compact-shortt` reaches the screen as `5` where `5K` was written. Every stem it understands sets
150
- * at least one option, so an empty result is the answer.
151
- */
152
- function stemIsKnown(stem, options) {
153
- try {
154
- const el = parse(`{n, number, ::${[stem, ...options].join("/")}}`, { shouldParseSkeletons: true })[0];
155
- if (el === void 0 || !isNumberElement(el) || typeof el.style !== "object" || el.style === null) return false;
156
- return Object.keys(el.style.parsedOptions).length > 0;
157
- } catch {
158
- return false;
159
- }
160
- }
161
- /** Every format problem in a message, as sentences. */
162
- function formatProblems(ast) {
163
- const found = [];
164
- walk(ast, (el) => {
165
- try {
166
- if (isNumberElement(el)) numberOptions(el);
167
- if (isDateElement(el) || isTimeElement(el)) dateOptions(el);
168
- } catch (e) {
169
- found.push(e.message);
170
- }
171
- });
172
- return found;
173
- }
174
- /** How each number or date argument is formatted, for the generated doc comment: `date medium, time short`. */
175
- function formatsOf(ast) {
176
- const formats = /* @__PURE__ */ new Map();
177
- walk(ast, (el) => {
178
- if (!isNumberElement(el) && !isDateElement(el) && !isTimeElement(el)) return;
179
- const style = el.style;
180
- if (style === null || style === void 0) return;
181
- const kind = el.type === TYPE$1.number ? "number" : el.type === TYPE$1.date ? "date" : "time";
182
- let said;
183
- if (typeof style === "string") said = `${kind} \`${style}\``;
184
- else if ("mf2" in style) {
185
- const { name, options } = style.mf2;
186
- said = `\`${[`:${name}`, ...Object.entries(options).map(([k, v]) => `${k}=${v}`)].join(" ")}\``;
187
- } else if ("tokens" in style) said = `${kind} \`::${style.tokens.map((t) => [t.stem, ...t.options].join("/")).join(" ")}\``;
188
- else said = `${kind} \`::${style.pattern}\``;
189
- const list = formats.get(el.value) ?? [];
190
- if (!list.includes(said)) list.push(said);
191
- formats.set(el.value, list);
192
- });
193
- return new Map([...formats].map(([name, list]) => [name, list.join(", ")]));
194
- }
195
5
  // src/tools/lint.ts
196
6
  /** Typed plugin, for `lint.plugins`. */
197
7
  function definePlugin(plugin) {
@@ -209,9 +19,9 @@ const VERBATIM_TAGS = /* @__PURE__ */ new Set([
209
19
  ]);
210
20
  function renderAs(elements, arm) {
211
21
  let out = "";
212
- for (const el of elements) if (el.type === TYPE$1.literal) out += el.value;
213
- else if (el.type === TYPE$1.tag) out += VERBATIM_TAGS.has(el.value) ? "⁣" : renderAs(el.children, arm);
214
- else if (el.type === TYPE$1.plural || el.type === TYPE$1.select) {
22
+ for (const el of elements) if (el.type === TYPE.literal) out += el.value;
23
+ else if (el.type === TYPE.tag) out += VERBATIM_TAGS.has(el.value) ? "⁣" : renderAs(el.children, arm);
24
+ else if (el.type === TYPE.plural || el.type === TYPE.select) {
215
25
  const option = arm === null ? void 0 : el.options[arm] ?? el.options["other"];
216
26
  out += option === void 0 ? "⁣" : renderAs(option.value, arm);
217
27
  } else out += "⁣";
@@ -220,17 +30,17 @@ function renderAs(elements, arm) {
220
30
  function readings(message) {
221
31
  const literal = staticLiteral(message);
222
32
  const ast = literal === void 0 ? message : [{
223
- type: TYPE$1.literal,
33
+ type: TYPE.literal,
224
34
  value: literal
225
35
  }];
226
36
  const arms = /* @__PURE__ */ new Set();
227
37
  const collect = (els) => {
228
38
  for (const el of els) {
229
- if (el.type === TYPE$1.plural || el.type === TYPE$1.select) for (const [name, option] of Object.entries(el.options)) {
39
+ if (el.type === TYPE.plural || el.type === TYPE.select) for (const [name, option] of Object.entries(el.options)) {
230
40
  arms.add(name);
231
41
  collect(option.value);
232
42
  }
233
- if (el.type === TYPE$1.tag) collect(el.children);
43
+ if (el.type === TYPE.tag) collect(el.children);
234
44
  }
235
45
  };
236
46
  collect(ast);
@@ -324,9 +134,9 @@ const CONTRACTIONS = [
324
134
  function eachRun(elements, visit, counted = /* @__PURE__ */ new Set()) {
325
135
  visit(elements, counted);
326
136
  for (const el of elements) {
327
- if (el.type === TYPE$1.plural) for (const o of Object.values(el.options)) eachRun(o.value, visit, /* @__PURE__ */ new Set([...counted, el.value]));
328
- if (el.type === TYPE$1.select) for (const o of Object.values(el.options)) eachRun(o.value, visit, counted);
329
- if (el.type === TYPE$1.tag) eachRun(el.children, visit, counted);
137
+ if (el.type === TYPE.plural) for (const o of Object.values(el.options)) eachRun(o.value, visit, /* @__PURE__ */ new Set([...counted, el.value]));
138
+ if (el.type === TYPE.select) for (const o of Object.values(el.options)) eachRun(o.value, visit, counted);
139
+ if (el.type === TYPE.tag) eachRun(el.children, visit, counted);
330
140
  }
331
141
  }
332
142
  /** A plain placeholder named as a count. A number placeholder is one whatever its name. */
@@ -496,10 +306,10 @@ const CORE_RULES = {
496
306
  check: ({ ast }) => {
497
307
  const said = [];
498
308
  eachRun(ast, (run, counted) => run.forEach((el, i) => {
499
- if (el.type !== TYPE$1.number && el.type !== TYPE$1.argument) return;
500
- if (counted.has(el.value) || el.type === TYPE$1.argument && !COUNT_NAME.test(el.value)) return;
309
+ if (el.type !== TYPE.number && el.type !== TYPE.argument) return;
310
+ if (counted.has(el.value) || el.type === TYPE.argument && !COUNT_NAME.test(el.value)) return;
501
311
  const next = run[i + 1];
502
- const word = next?.type === TYPE$1.literal ? /^\s+(\p{L}+)(?![\p{L}'])/u.exec(next.value)?.[1] : void 0;
312
+ const word = next?.type === TYPE.literal ? /^\s+(\p{L}+)(?![\p{L}'])/u.exec(next.value)?.[1] : void 0;
503
313
  const one = word === void 0 ? void 0 : singularOf(word);
504
314
  if (word !== void 0 && one !== void 0) said.push({
505
315
  message: `${el.value} is followed by "${word}", which reads "1 ${word}": make it a plural with a "# ${one}" arm`,
@@ -516,13 +326,13 @@ const CORE_RULES = {
516
326
  check: ({ ast, locale, config }) => {
517
327
  const said = [];
518
328
  walk(ast, (el) => {
519
- if (el.type !== TYPE$1.plural || el.pluralType !== "cardinal") return;
329
+ if (el.type !== TYPE.plural || el.pluralType !== "cardinal") return;
520
330
  const { one, other } = el.options;
521
331
  if (one === void 0) return;
522
332
  if (locale === config.source && other !== void 0 && renderAs(one.value, "other") === renderAs(other.value, "other")) said.push({ message: `the one and other arms of ${el.value} say the same: write the singular in one` });
523
333
  let literalOne = false;
524
334
  walk(one.value, (inner) => {
525
- if (inner.type === TYPE$1.literal && /(?<![\d.,])1(?![\d.,])/.test(inner.value)) literalOne = true;
335
+ if (inner.type === TYPE.literal && /(?<![\d.,])1(?![\d.,])/.test(inner.value)) literalOne = true;
526
336
  });
527
337
  if (!literalOne) return;
528
338
  const message = `the one arm of ${el.value} writes 1, which one is not in every language: write #, or make the arm =1`;
@@ -541,7 +351,7 @@ const CORE_RULES = {
541
351
  check: ({ ast }) => {
542
352
  const said = [];
543
353
  walk(ast, (el) => {
544
- if (el.type !== TYPE$1.plural && el.type !== TYPE$1.select) return;
354
+ if (el.type !== TYPE.plural && el.type !== TYPE.select) return;
545
355
  if (new Set(Object.values(el.options).flatMap((o) => endsWithStop(o.value) ?? [])).size > 1) said.push(`some arms of ${el.value} end with a stop and some without: end them alike`);
546
356
  });
547
357
  return said;
@@ -558,12 +368,12 @@ const CORE_RULES = {
558
368
  match
559
369
  });
560
370
  eachRun(ast, (run) => run.forEach((el, i) => {
561
- if (el.type !== TYPE$1.number && el.type !== TYPE$1.argument) return;
371
+ if (el.type !== TYPE.number && el.type !== TYPE.argument) return;
562
372
  const before = run[i - 1];
563
373
  const after = run[i + 1];
564
- const symbol = before?.type === TYPE$1.literal ? CURRENCY_BEFORE.exec(before.value)?.[0].trim() : void 0;
374
+ const symbol = before?.type === TYPE.literal ? CURRENCY_BEFORE.exec(before.value)?.[0].trim() : void 0;
565
375
  if (symbol !== void 0) say(`"${symbol}" is typed before ${el.value}: format it as a currency, which puts the symbol where the locale does`, symbol);
566
- if (after?.type === TYPE$1.literal && /^\s?%/.test(after.value)) say(`"%" is typed after ${el.value}: format it as a percent, which takes the fraction (0.5 for 50%)`, "%");
376
+ if (after?.type === TYPE.literal && /^\s?%/.test(after.value)) say(`"%" is typed after ${el.value}: format it as a percent, which takes the fraction (0.5 for 50%)`, "%");
567
377
  }));
568
378
  const grouped = text.variants.map((v) => /\d{1,3}(?:,\d{3})+(?!\d)/.exec(v)?.[0]).find((g) => g !== void 0);
569
379
  if (grouped !== void 0) say(`"${grouped}" groups its digits the English way: make it a placeholder formatted as a number`, grouped);
@@ -731,7 +541,7 @@ function literalsIn(ast, text) {
731
541
  const found = [];
732
542
  let from = 0;
733
543
  walk(ast, (el) => {
734
- if (el.type !== TYPE$1.literal || el.value === "") return;
544
+ if (el.type !== TYPE.literal || el.value === "") return;
735
545
  const next = text.indexOf(el.value, from);
736
546
  const start = next === -1 ? text.indexOf(el.value) : next;
737
547
  if (start === -1) return;
@@ -1104,6 +914,11 @@ const STRICT_LISTS = {
1104
914
  * `prosebook/config`: where the catalog lives, what an entry may say about itself, and how strictly
1105
915
  * its words are checked. Written as `prosebook.config.ts` (or `.js`, `.mjs`, `.json`) at the project root.
1106
916
  */
917
+ const NATIVE_NAMES = {
918
+ rust: "Locale",
919
+ swift: "Copy",
920
+ kotlin: "Copy"
921
+ };
1107
922
  /** Typed config, for `prosebook.config.ts`. */
1108
923
  function defineConfig(config) {
1109
924
  return config;
@@ -1140,6 +955,7 @@ function resolveConfig(root, config) {
1140
955
  lock: at(config.lock ?? "copy/lock.json"),
1141
956
  source: config.source ?? "en",
1142
957
  messageFormat: config.messageFormat ?? 1,
958
+ isolate: config.isolate ?? "rtl",
1143
959
  bundled: config.bundled ?? [],
1144
960
  pseudo: config.pseudo ?? false,
1145
961
  stale: config.stale ?? "use",
@@ -1160,6 +976,14 @@ function resolveConfig(root, config) {
1160
976
  properNouns: lint.properNouns ?? [],
1161
977
  pathSeparator: lint.pathSeparator ?? "›"
1162
978
  },
979
+ native: (config.native ?? []).map((target, i) => {
980
+ if (!(target.language in NATIVE_NAMES)) throw new Error(`native[${i}].language is "${target.language}": name one of ${Object.keys(NATIVE_NAMES).join(", ")}`);
981
+ return {
982
+ ...target,
983
+ out: at(target.out),
984
+ name: target.name ?? NATIVE_NAMES[target.language]
985
+ };
986
+ }),
1163
987
  scan: {
1164
988
  dirs: (config.scan?.dirs ?? ["src"]).map(at),
1165
989
  extensions: config.scan?.extensions ?? [
@@ -1203,6 +1027,6 @@ function lintRules(lint) {
1203
1027
  for (const name of Object.keys(lint.rules ?? {})) if (!(name in rules)) throw new Error(`lint.rules.${name} is not a rule: name one of ${Object.keys(rules).join(", ")}`);
1204
1028
  return rules;
1205
1029
  }
1206
- export { numberOptions as C, walk as D, tagsOf as E, formatsOf as S, staticLiteral as T, words as _, DEFAULT_KINDS as a, dateOptions as b, CORE_RULES as c, compileRule as d, definePlugin as f, singularOf as g, sentences as h, resolveConfig as i, HOLE as l, phrase as m, defineConfig as n, DEFAULT_SURFACES as o, lint as p, loadConfig as r, STRICT_LISTS as s, CONFIG_FILES as t, applyEdits as u, TYPE$1 as v, parseMessage as w, formatProblems as x, argsOf as y };
1030
+ export { words as _, DEFAULT_KINDS as a, CORE_RULES as c, compileRule as d, definePlugin as f, singularOf as g, sentences as h, resolveConfig as i, HOLE as l, phrase as m, defineConfig as n, DEFAULT_SURFACES as o, lint as p, loadConfig as r, STRICT_LISTS as s, CONFIG_FILES as t, applyEdits as u };
1207
1031
 
1208
- //# sourceMappingURL=config-D--RITk2.js.map
1032
+ //# sourceMappingURL=config-BPSmoYel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-BPSmoYel.js","names":[],"sources":["../src/tools/lint.ts","../src/tools/presets.ts","../src/tools/config.ts"],"sourcesContent":["/**\n * Holds every source message to the mechanical half of a writing guide: budgets, periods, case,\n * dashes, spelling, contractions, the product's one word per concept, and banned words. What needs\n * judgment stays with review. An entry a rule is wrong about says so under `allow`, with the reason,\n * and an exemption that no longer matches anything fails too, so none outlive the words they excused.\n *\n * The core rules are written as a plugin's are: a project adds its own through `lint.plugins`, as\n * code or as data, and they read the same readings of a message and are exempted the same way.\n */\nimport type { Message } from './catalog.ts';\nimport type { ResolvedConfig } from './config.ts';\nimport { staticLiteral, TYPE, walk, type MessageFormatElement } from './icu.ts';\nimport type { KindRule, Severity } from './presets.ts';\n\n/** What a rule is given about one message in one locale. */\nexport interface RuleContext {\n /** The entry, as the source catalog has it. */\n message: Message;\n /** The locale read: the source, or a translation's. */\n locale: string;\n /** The message in that locale. */\n ast: MessageFormatElement[];\n /** The shape the message's kind is held to, when it names a kind the config defines. */\n kind: KindRule | undefined;\n /** The message in that locale, as prose. */\n text: Readings;\n /** The source message as prose, to hold a translation to it: `text` itself in the source locale. */\n source: Readings;\n config: ResolvedConfig;\n}\n\ninterface RuleBase {\n /** One sentence: what the rule holds a string to. */\n description: string;\n /** Its severity under `extends: 'recommended'`; off when unset. */\n recommended?: Severity;\n /** Its severity under `extends: 'strict'`; `error` when unset. */\n strict?: Severity;\n /**\n * Only entries of these kinds, on these surfaces, or in these areas (a key's first segment); an\n * entry that says no kind or surface is skipped by a rule that names some. Only the source unless\n * `locale` says otherwise, since most writing rules are written for one language: `all` reads\n * every locale, and a list those languages and their regions (`de` covers `de-CH`).\n */\n on?: { kind?: string[]; surface?: string[]; area?: string[]; locale?: 'all' | string[] };\n}\n\n/** A rule written as code. */\nexport interface CheckRule extends RuleBase {\n /** What is wrong with the message, a sentence each that states the fix; none when it passes. */\n check(context: RuleContext): (string | Report)[];\n}\n\n/** A finding that can say where it is, and what to write instead. */\nexport interface Report {\n message: string;\n /** The words the finding is about, as a reading has them: found in the message's text, in any case. */\n match?: string;\n /** What `prosebook lint --fix` writes in place of `match`, wherever it stands; its case follows the text's. */\n fix?: string;\n}\n\n/** A replacement in a message's text, by offset. */\nexport interface Edit {\n start: number;\n end: number;\n text: string;\n}\n\n/*\n * Rules written as data, after Vale's, so a JSON config can carry them. Words and patterns are looked\n * for in every reading, so one in a `one` arm is found; counts and case read the `other` arms. A\n * pattern is a regular expression with the `u` flag, and sees a placeholder as `HOLE`. A message\n * names what was found with `{match}`, and the other fields its rule lists.\n */\n\n/** Words or patterns a string never uses. */\nexport interface ExistenceRule extends RuleBase {\n type: 'existence';\n /** Words or phrases, matched whole and in any case. `{match}` is the one listed. */\n words?: string[];\n /** `{match}` is the text matched. */\n patterns?: string[];\n ignoreCase?: boolean;\n message: string;\n}\n\n/** A word or phrase the product writes another way. */\nexport interface SubstitutionRule extends RuleBase {\n type: 'substitution';\n /** A word or phrase, matched whole and in any case, and the one written instead. */\n swap: Record<string, string>;\n /** `{match}` and `{use}`; `\"{match}\" is written \"{use}\"` when unset. */\n message?: string;\n}\n\n/** A budget, beside the one a kind sets: per surface, say, or in characters. */\nexport interface OccurrenceRule extends RuleBase {\n type: 'occurrence';\n /** Every word, placeholders included; sentences; or characters, placeholders not included. */\n count: 'words' | 'sentences' | 'characters';\n max?: number;\n min?: number;\n /** `max` and `min` are multiples of the source's count: `max: 1.4` is 40% longer than the source at most. */\n relative?: boolean;\n /** `{count}`, `{max}`, `{min}`, and with `relative`, `{source}` (the source's count) and `{limit}`. */\n message?: string;\n}\n\nexport interface CapitalizationRule extends RuleBase {\n type: 'capitalization';\n /** `sentence` capitalizes only the first word and proper nouns, `title` every word but short function words. */\n case: 'sentence' | 'title' | 'lower' | 'upper';\n /** Words that keep their case, beside `lint.properNouns`. */\n exceptions?: string[];\n /** `{match}` is the first word out of case. */\n message?: string;\n}\n\n/** A string that matches `when` (every string, when unset) matches `require` too. */\nexport interface ConditionalRule extends RuleBase {\n type: 'conditional';\n when?: string;\n require: string;\n ignoreCase?: boolean;\n /** `{match}` is the text `when` matched. */\n message: string;\n}\n\nexport type Rule = CheckRule | ExistenceRule | SubstitutionRule | OccurrenceRule | CapitalizationRule | ConditionalRule;\n\n/** A set of rules, named `<name>/<rule>` in `lint.rules` and in an entry's `allow`. */\nexport interface Plugin {\n name: string;\n rules: Record<string, Rule>;\n}\n\n/** Typed plugin, for `lint.plugins`. */\nexport function definePlugin(plugin: Plugin): Plugin {\n return plugin;\n}\n\nexport interface Finding {\n key: string;\n /** The catalog file, or for a translation, the locale's file. */\n file: string;\n /** The locale whose text the finding is about; the source for an `allow` finding. */\n locale: string;\n /** The rule's name, or `allow` for an exemption that is itself wrong. */\n rule: string;\n severity: Exclude<Severity, 'off'>;\n message: string;\n /** Where in the locale's message text, when the rule named a match and it is written there as read. */\n at?: { start: number; end: number };\n /** The edits that fix it, at every place the match stands. */\n fix?: Edit[];\n}\n\n/** Stands in for a placeholder in a reading, which no prose rule reads. */\nexport const HOLE = '\\u2063';\n/** Tags whose content is code or a literal the reader types, not prose. */\nconst VERBATIM_TAGS = new Set(['code', 'mono', 'kbd', 'keycap', 'nums']);\n\nfunction renderAs(elements: MessageFormatElement[], arm: string | null): string {\n let out = '';\n for (const el of elements) {\n if (el.type === TYPE.literal) {\n out += el.value;\n } else if (el.type === TYPE.tag) {\n out += VERBATIM_TAGS.has(el.value) ? HOLE : renderAs(el.children, arm);\n } else if (el.type === TYPE.plural || el.type === TYPE.select) {\n const option = arm === null ? undefined : (el.options[arm] ?? el.options['other']);\n out += option === undefined ? HOLE : renderAs(option.value, arm);\n } else {\n out += HOLE;\n }\n }\n return out;\n}\n\n/** The message as prose: placeholders and verbatim tags read as `HOLE`, and `’` as `'` in `variants`. */\nexport interface Readings {\n /** Every `other` arm taken: what a budget is measured on. */\n primary: string;\n /** One reading per arm, so a word hidden in `one` is still found. */\n variants: string[];\n /** Only the words the message always carries. */\n skeleton: string;\n}\n\nfunction readings(message: MessageFormatElement[]): Readings {\n const literal = staticLiteral(message);\n const ast = literal === undefined ? message : ([{ type: TYPE.literal, value: literal }] as MessageFormatElement[]);\n const arms = new Set<string>();\n const collect = (els: MessageFormatElement[]) => {\n for (const el of els) {\n if (el.type === TYPE.plural || el.type === TYPE.select) {\n for (const [name, option] of Object.entries(el.options)) {\n arms.add(name);\n collect(option.value);\n }\n }\n if (el.type === TYPE.tag) collect(el.children);\n }\n };\n collect(ast);\n const primary = renderAs(ast, 'other');\n const variants = new Set([primary, ...[...arms].map((arm) => renderAs(ast, arm))]);\n return { primary, variants: [...variants].map((v) => v.replace(/\\u2019/g, \"'\")), skeleton: renderAs(ast, null) };\n}\n\n/** What a reader sees end to end, less a placeholder appended at the very end. */\nconst prose = (text: string) => text.replace(new RegExp(`[\\\\s${HOLE}]+$`), '');\n\nconst FREE = new Set('a an the this that these those it its them your and or to of for by in on at from with'.split(' '));\n\nconst tokens = (text: string) => text.split(/\\s+/).filter((w) => /[\\p{L}\\p{N}]/u.test(w) || w.includes(HOLE));\n\n/** The words a budget counts: articles, short prepositions and asides in parentheses are free. */\nexport function words(text: string): string[] {\n return tokens(text.replace(/\\s*\\([^)]*\\)/g, '')).filter((w) => !FREE.has(w.toLowerCase().replace(/[^\\p{L}]/gu, '')));\n}\n\nconst ABBREVIATIONS = /\\b(?:e\\.g|i\\.e|vs|etc)\\.$/i;\n\nexport function sentences(text: string): number {\n let count = 1;\n const boundary = /[.!?…]+[\"')\\]]*\\s+(?=\\S)/g;\n for (let m = boundary.exec(text); m !== null; m = boundary.exec(text))\n if (!ABBREVIATIONS.test(text.slice(0, m.index + m[0].trimEnd().length))) count += 1;\n\n return count;\n}\n\n/** A word or phrase on its own, not inside a longer word or a hyphenated compound. */\nexport function phrase(p: string): RegExp {\n const escaped = p.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/ /g, '\\\\s+');\n return new RegExp(`(?<![\\\\p{L}\\\\p{N}'-])${escaped}(?![\\\\p{L}\\\\p{N}'-])`, 'iu');\n}\n\n/** The words and phrases of `list` that some reading carries. */\nconst listed = (variants: string[], list: string[]) => list.filter((w) => variants.some((v) => phrase(w).test(v)));\n\nconst unquoted = (token: string) => token.replace(/^[(\"'“‘]+|[)\"'”’.,:;!?]+$/g, '');\n\nfunction capitalizedWord(text: string, proper: Set<string>): string | undefined {\n const parts = text.split(/\\s+/).filter(Boolean);\n for (let i = 1; i < parts.length; i++) {\n const word = unquoted(parts[i]!);\n if (!/^\\p{Lu}\\p{Ll}/u.test(word) || proper.has(word)) continue;\n if (/[.:?!][\"')]*$/.test(parts[i - 1]!)) continue;\n return word;\n }\n return undefined;\n}\n\n/** Words a count is followed by that are not plural nouns, though they end in s. */\nconst NOT_PLURAL = new Set([\n 'is',\n 'was',\n 'has',\n 'does',\n 'this',\n 'its',\n 'plus',\n 'minus',\n 'less',\n 'yes',\n 'us',\n 'as',\n 'bus',\n 'gas',\n 'news',\n 'series',\n]);\n\n/**\n * The singular of an English plural noun, or nothing where it doesn't look like one. A word with no\n * vowel is a unit or an abbreviation (`kbps`, `fps`, `hrs`), which reads the same after 1.\n */\nexport function singularOf(word: string): string | undefined {\n const lower = word.toLowerCase();\n if (word.length < 3 || !lower.endsWith('s') || lower.endsWith('ss') || NOT_PLURAL.has(lower)) return undefined;\n if (!/[aeiouy]/.test(lower)) return undefined;\n if (/[^aeiou]ies$/.test(lower)) return `${word.slice(0, -3)}y`;\n if (/(?:s|x|z|ch|sh)es$/.test(lower)) return word.slice(0, -2);\n return word.slice(0, -1);\n}\n\nconst MINOR = new Set('a an the and but or nor for so yet as at by in of off on per to up via with'.split(' '));\n\n/** The first word out of `style` case, less those in `keep`. */\nfunction outOfCase(text: string, style: CapitalizationRule['case'], keep: Set<string>): string | undefined {\n if (style === 'sentence') return capitalizedWord(text, keep);\n const list = text\n .split(/\\s+/)\n .map(unquoted)\n .filter((w) => /\\p{L}/u.test(w) && !keep.has(w));\n return list.find((w, i) => {\n if (style === 'lower') return /\\p{Lu}/u.test(w);\n if (style === 'upper') return /\\p{Ll}/u.test(w);\n return /^\\p{Ll}/u.test(w) && (i === 0 || !MINOR.has(w));\n });\n}\n\nconst CONTRACTIONS: [RegExp, string][] = [\n [/\\bcannot\\b/i, \"can't\"],\n [/\\bcan not\\b/i, \"can't\"],\n [/\\bwill not\\b/i, \"won't\"],\n [/\\b(could|would|should|is|are|was|were|do|does|did|has|have|had|must|need) not\\b/i, \"n't\"],\n];\n\n/** Calls `visit` on every run of elements that sit side by side, with the arguments a plural around it counts. */\nfunction eachRun(\n elements: MessageFormatElement[],\n visit: (run: MessageFormatElement[], counted: ReadonlySet<string>) => void,\n counted: ReadonlySet<string> = new Set(),\n): void {\n visit(elements, counted);\n for (const el of elements) {\n if (el.type === TYPE.plural) for (const o of Object.values(el.options)) eachRun(o.value, visit, new Set([...counted, el.value]));\n if (el.type === TYPE.select) for (const o of Object.values(el.options)) eachRun(o.value, visit, counted);\n if (el.type === TYPE.tag) eachRun(el.children, visit, counted);\n }\n}\n\n/** A plain placeholder named as a count. A number placeholder is one whatever its name. */\nconst COUNT_NAME = /^(?:n|num|count|total|amount|quantity)$|(?:count|total)$/i;\n\n/**\n * Whether an arm ends with a stop; nothing for an arm with no words, or one that trails off in an\n * ellipsis (`Saving…`, `Save as…`), which is neither. Which stop is the arm's own: a question in\n * `one` and a second sentence after it in `other` both end well.\n */\nfunction endsWithStop(arm: MessageFormatElement[]): boolean | undefined {\n const text = prose(renderAs(arm, 'other')).trim();\n if (text.replaceAll(HOLE, '').trim() === '' || /(?:…|\\.{3})[\"')”»」』]*$/u.test(text)) return undefined;\n return hasStop(text);\n}\n\n/** Ends with a stop in any script (`。`, `؟`, `;` as Greek writes `?`), though not a comma. */\nconst hasStop = (text: string) => /(?![,,、،])[\\p{Terminal_Punctuation}…][\"')”»」』]*$/u.test(prose(text).trim());\n\nconst CURRENCY_BEFORE = /[$€£¥₹]\\s?$/;\n\n/**\n * The ways a path through menus is written, the separator in a group: an arrow or `›` however\n * spaced, and `>` or `/` only spaced between words or placeholders, with a capital after a slash,\n * since \"2 > 1\" and \"and / or\" are no paths. The match takes the spaces around, so the fix spaces\n * the separator.\n */\nconst PATH_SEPARATORS = new RegExp(\n String.raw`\\s*(→|->|›)\\s*|(?<=[\\p{L}${HOLE}])\\s+(>)\\s+(?=[\\p{L}${HOLE}])|(?<=\\p{L})\\s+(\\/)\\s+(?=\\p{Lu})`,\n 'gu',\n);\n\nconst OFF_SCREEN = new Set(['aria']);\n\nconst an = (word = 'string') => `${/^[aeiou]/i.test(word) ? 'an' : 'a'} ${word}`;\n\nexport const CORE_RULES = {\n whitespace: {\n description: 'No leading, trailing or doubled spaces.',\n recommended: 'error',\n on: { locale: 'all' },\n check: ({ text }) => {\n const message = 'no leading, trailing or doubled spaces';\n // As a match, two spaces stand for a run of any length.\n if (text.variants.some((v) => v.includes(' '))) return [{ message, match: ' ', fix: ' ' }];\n return text.variants.some((v) => /^\\s|\\s$/.test(v.replaceAll(HOLE, 'x'))) ? [message] : [];\n },\n },\n 'word-budget': {\n description: \"A kind with `maxWords` stays within it. Articles, short prepositions and asides in parentheses don't count.\",\n recommended: 'warn',\n check: ({ message: m, kind, text }) => {\n if (kind?.maxWords === undefined || OFF_SCREEN.has(m.surface ?? '')) return [];\n const n = words(text.primary).length;\n return n > kind.maxWords ? [`${an(m.kind)} is ${kind.maxWords} words at most, and this is ${n}`] : [];\n },\n },\n 'sentence-budget': {\n description: 'A kind with `maxSentences` stays within it.',\n recommended: 'warn',\n check: ({ message: m, kind, text }) => {\n const most = (m.surface !== undefined ? kind?.maxSentencesOn?.[m.surface] : undefined) ?? kind?.maxSentences;\n if (most === undefined) return [];\n const n = sentences(prose(text.primary));\n return n > most\n ? [\n `${an(m.kind)}${kind?.maxSentencesOn?.[m.surface ?? ''] !== undefined ? ` on ${m.surface}` : ''} is ${most} sentence(s) at most, and this is ${n}`,\n ]\n : [];\n },\n },\n period: {\n description: 'A kind with `period: always` (or on a listed surface) ends with a period, unless the entry is a fragment.',\n recommended: 'warn',\n check: ({ message: m, kind, text }) => {\n const rule = kind?.period;\n const applies = rule === 'always' || (Array.isArray(rule) && rule.includes(m.surface ?? ''));\n return applies && !m.fragment && !/[.?!…:][\"')”]*$/.test(prose(text.primary))\n ? [`${an(m.kind)} ends with a period, or is marked fragment: true`]\n : [];\n },\n },\n 'no-period': {\n description: 'A kind with `period: never` ends without one.',\n recommended: 'warn',\n check: ({ message: m, kind, text }) =>\n kind?.period === 'never' && /[^.]\\.$/.test(prose(text.primary)) ? [`${an(m.kind)} ends without a period`] : [],\n },\n 'bare-name': {\n description: 'A kind with `bare: true` carries no explanation after a dash or a colon.',\n recommended: 'warn',\n // A colon before a value is a readout, as in \"Zoom: 120%\", not an explanation.\n check: ({ message: m, kind, text }) =>\n kind?.bare === true && new RegExp(`\\\\s[—–-]\\\\s|\\\\p{L}:\\\\s(?!${HOLE})`, 'u').test(text.skeleton)\n ? [`${an(m.kind)} carries no explanation after a dash or a colon`]\n : [],\n },\n 'sentence-case': {\n description: 'A kind with `sentenceCase: true` capitalizes only its first word and proper nouns.',\n check: ({ message: m, kind, text, config }) => {\n if (kind?.sentenceCase !== true) return [];\n const word = outOfCase(text.primary, 'sentence', new Set(config.lint.properNouns));\n if (word === undefined) return [];\n return [\n { message: `\"${word}\" is capitalized in a sentence-case ${m.kind}: add it to lint.properNouns if it is a name`, match: word },\n ];\n },\n },\n 'banned-word': {\n description: 'A word or phrase from the banned lists.',\n recommended: 'warn',\n check: ({ text, config }) =>\n config.lint.banned.flatMap(({ words: list, why }) =>\n listed(text.variants, list).map((w) => ({ message: `\"${w}\" ${why}`, match: w })),\n ),\n },\n spelling: {\n description: 'A spelling the product writes another way.',\n recommended: 'warn',\n check: ({ text, config: { lint } }) =>\n listed(text.variants, Object.keys(lint.spelling)).map((w) => ({\n message: `\"${w}\" is spelled \"${lint.spelling[w]}\"`,\n match: w,\n fix: lint.spelling[w],\n })),\n },\n 'one-word': {\n description: 'A near-synonym for a concept the product has one word for.',\n recommended: 'warn',\n check: ({ text, config: { lint } }) =>\n listed(text.variants, Object.keys(lint.concepts)).map((w) => ({\n message: `\"${w}\" is \"${lint.concepts[w]}\" everywhere in the product`,\n match: w,\n fix: lint.concepts[w],\n })),\n },\n 'no-em-dash': {\n description: 'No em-dashes, and no spaced hyphen standing in for one.',\n check: ({ text }) => {\n const match = text.variants.map((v) => /—|\\s[–-]\\s/.exec(v)?.[0]).find((m) => m !== undefined);\n return match === undefined ? [] : [{ message: 'no em-dash: a comma, a period or a colon does the job', match }];\n },\n },\n path: {\n description: 'A path through menus or settings is written with `lint.pathSeparator`, spaced: Settings › General.',\n check: ({ text, config }) => {\n const use = config.lint.pathSeparator;\n for (const v of text.variants) {\n for (const m of v.matchAll(PATH_SEPARATORS)) {\n if ((m[1] ?? m[2] ?? m[3]) === use) continue;\n return [{ message: `a path is written with a spaced ${use}`, match: m[0], fix: ` ${use} ` }];\n }\n }\n return [];\n },\n },\n contractions: {\n description: '`could not`, `is not` and `cannot` are written as contractions.',\n check: ({ text }) =>\n CONTRACTIONS.flatMap(([pattern, short]) => {\n const found = text.variants.map((v) => pattern.exec(v)).find((f) => f !== null);\n if (found === undefined || found === null) return [];\n const fix = short === \"n't\" ? `${found[1]}n't` : short;\n return [{ message: `\"${found[0]}\" is written as a contraction (${short})`, match: found[0], fix }];\n }),\n },\n ellipsis: {\n description: 'An ellipsis is one character, `…`, not three periods.',\n on: { locale: 'all' },\n check: ({ text }) =>\n text.variants.some((v) => v.includes('...')) ? [{ message: 'an ellipsis is one character: …', match: '...', fix: '…' }] : [],\n },\n 'plural-count': {\n description: 'A count followed by a plural noun, `{count} files`, is a plural, or it reads \"1 files\". English.',\n recommended: 'warn',\n check: ({ ast }) => {\n const said: Report[] = [];\n eachRun(ast, (run, counted) =>\n run.forEach((el, i) => {\n if (el.type !== TYPE.number && el.type !== TYPE.argument) return;\n if (counted.has(el.value) || (el.type === TYPE.argument && !COUNT_NAME.test(el.value))) return;\n const next = run[i + 1];\n const word = next?.type === TYPE.literal ? /^\\s+(\\p{L}+)(?![\\p{L}'])/u.exec(next.value)?.[1] : undefined;\n const one = word === undefined ? undefined : singularOf(word);\n if (word !== undefined && one !== undefined) {\n said.push({\n message: `${el.value} is followed by \"${word}\", which reads \"1 ${word}\": make it a plural with a \"# ${one}\" arm`,\n match: word,\n });\n }\n }),\n );\n return said;\n },\n },\n 'plural-one': {\n description: \"A plural's `one` arm says something other than `other`, and says `#` rather than `1`.\",\n recommended: 'warn',\n on: { locale: 'all' },\n check: ({ ast, locale, config }) => {\n const said: Report[] = [];\n walk(ast, (el) => {\n if (el.type !== TYPE.plural || el.pluralType !== 'cardinal') return;\n const { one, other } = el.options;\n if (one === undefined) return;\n // Turkish says \"# dosya\" for one and other alike, so only the source must tell them apart.\n if (locale === config.source && other !== undefined && renderAs(one.value, 'other') === renderAs(other.value, 'other'))\n said.push({ message: `the one and other arms of ${el.value} say the same: write the singular in one` });\n let literalOne = false;\n walk(one.value, (inner) => {\n if (inner.type === TYPE.literal && /(?<![\\d.,])1(?![\\d.,])/.test(inner.value)) literalOne = true;\n });\n // Russian's `one` is also 21 and 31, so a translator copying a written 1 gets it wrong there.\n if (!literalOne) return;\n const message = `the one arm of ${el.value} writes 1, which one is not in every language: write #, or make the arm =1`;\n said.push({ message, match: '1' });\n });\n return said;\n },\n },\n 'arm-endings': {\n description: 'The arms of a plural or select end alike: all with a stop, or all without one.',\n recommended: 'warn',\n on: { locale: 'all' },\n check: ({ ast }) => {\n const said: string[] = [];\n walk(ast, (el) => {\n if (el.type !== TYPE.plural && el.type !== TYPE.select) return;\n const endings = new Set(Object.values(el.options).flatMap((o) => endsWithStop(o.value) ?? []));\n if (endings.size > 1) said.push(`some arms of ${el.value} end with a stop and some without: end them alike`);\n });\n return said;\n },\n },\n 'formatted-by-hand': {\n description: 'A currency symbol or `%` typed beside a placeholder, or digits grouped by hand, which only suit one locale.',\n recommended: 'warn',\n on: { locale: 'all' },\n check: ({ ast, text }) => {\n const said = new Map<string, Report>();\n const say = (message: string, match: string) => said.set(message, { message, match });\n eachRun(ast, (run) =>\n run.forEach((el, i) => {\n if (el.type !== TYPE.number && el.type !== TYPE.argument) return;\n const before = run[i - 1];\n const after = run[i + 1];\n const symbol = before?.type === TYPE.literal ? CURRENCY_BEFORE.exec(before.value)?.[0].trim() : undefined;\n if (symbol !== undefined)\n say(`\"${symbol}\" is typed before ${el.value}: format it as a currency, which puts the symbol where the locale does`, symbol);\n if (after?.type === TYPE.literal && /^\\s?%/.test(after.value))\n say(`\"%\" is typed after ${el.value}: format it as a percent, which takes the fraction (0.5 for 50%)`, '%');\n }),\n );\n const grouped = text.variants.map((v) => /\\d{1,3}(?:,\\d{3})+(?!\\d)/.exec(v)?.[0]).find((g) => g !== undefined);\n if (grouped !== undefined)\n say(`\"${grouped}\" groups its digits the English way: make it a placeholder formatted as a number`, grouped);\n return [...said.values()];\n },\n },\n 'source-ending': {\n description: 'A translation ends with a stop where its source does, and without one where it does not.',\n recommended: 'warn',\n on: { locale: 'all' },\n check: ({ text, source }) => {\n const ends = hasStop(text.primary);\n if (ends === hasStop(source.primary)) return [];\n return [\n ends\n ? 'ends with a stop, and the source does not: drop it'\n : 'the source ends with a stop, and this does not: end it as the source does',\n ];\n },\n },\n} satisfies Record<string, CheckRule>;\n\nexport type CoreRule = keyof typeof CORE_RULES;\n\nconst fill = (message: string, values: Record<string, string | number | undefined>) =>\n message.replace(/\\{(\\w+)\\}/g, (all, name: string) => (values[name] === undefined ? all : String(values[name])));\n\nconst graphemes = new Intl.Segmenter();\n\nconst COUNTERS: Record<OccurrenceRule['count'], (text: string) => number> = {\n words: (text) => tokens(text).length,\n sentences: (text) => sentences(prose(text)),\n characters: (text) => [...graphemes.segment(text.replaceAll(HOLE, ''))].length,\n};\n\n/** A rule as code, checked once when the config loads: a JSON config is not type-checked. */\nexport function compileRule(name: string, rule: Rule): CheckRule {\n const fail = (problem: string): never => {\n throw new Error(`lint rule ${name} ${problem}`);\n };\n const pattern = (source: unknown, field: string, ignoreCase: boolean | undefined) => {\n if (typeof source !== 'string') return fail(`${field} is not a string: write the pattern as one`);\n try {\n return new RegExp(source, ignoreCase === true ? 'iu' : 'u');\n } catch (e) {\n return fail(`${field} is not a regular expression: ${e instanceof Error ? e.message : String(e)}`);\n }\n };\n const said = (message: unknown) =>\n typeof message === 'string' && message !== '' ? message : fail('has no message: say what to write instead');\n if (typeof rule.description !== 'string' || rule.description === '') fail('has no description: say what it holds a string to');\n if ('check' in rule) return typeof rule.check === 'function' ? rule : fail('has a check that is not a function');\n const { description, recommended, strict, on } = rule;\n const base = { description, recommended, strict, on };\n switch (rule.type) {\n case 'existence': {\n const list = rule.words ?? [];\n const patterns = (rule.patterns ?? []).map((p, i) => pattern(p, `patterns[${i}]`, rule.ignoreCase));\n if (list.length + patterns.length === 0) fail('has no words or patterns: list what a string never says');\n const message = said(rule.message);\n return {\n ...base,\n check: ({ text }) => {\n const matched = patterns.flatMap((p) => text.variants.map((v) => p.exec(v)?.[0]).find((m) => m !== undefined) ?? []);\n return [...new Set([...listed(text.variants, list), ...matched])].map((match) => ({ message: fill(message, { match }), match }));\n },\n };\n }\n case 'substitution': {\n const swap = rule.swap ?? {};\n if (Object.keys(swap).length === 0) fail('has nothing in swap: map a word to the one written instead');\n const message = rule.message === undefined ? '\"{match}\" is written \"{use}\"' : said(rule.message);\n return {\n ...base,\n check: ({ text }) =>\n listed(text.variants, Object.keys(swap)).map((match) => ({\n message: fill(message, { match, use: swap[match] }),\n match,\n fix: swap[match],\n })),\n };\n }\n case 'occurrence': {\n const { count: unit, max, min, relative } = rule;\n const counter = Object.hasOwn(COUNTERS, unit) ? COUNTERS[unit] : fail(`counts ${unit}: count words, sentences or characters`);\n if (max === undefined && min === undefined) fail('has no max or min: give it one');\n if (rule.message !== undefined) said(rule.message);\n return {\n ...base,\n check: ({ text, source }) => {\n const count = counter(text.primary);\n const of = relative === true ? counter(source.primary) : 1;\n const over = max !== undefined && count > max * of;\n const under = min !== undefined && count < min * of;\n if (!over && !under) return [];\n // The limit shown is one the count could meet: 1.5 times 11 characters is 16 at most, 17 at least.\n const limit = over && max !== undefined ? Math.floor(max * of) : Math.ceil((min ?? 0) * of);\n const bound = over ? 'at most' : 'at least';\n const fallback =\n relative === true\n ? `{limit} ${unit} ${bound} ({${over ? 'max' : 'min'}} times the source's {source}), and this is {count}`\n : `{${over ? 'max' : 'min'}} ${unit} ${bound}, and this is {count}`;\n return [fill(rule.message ?? fallback, { count, max, min, source: relative === true ? of : undefined, limit })];\n },\n };\n }\n case 'capitalization': {\n const style = rule.case;\n if (!['sentence', 'title', 'lower', 'upper'].includes(style)) fail(`has case ${style}: use sentence, title, lower or upper`);\n const message =\n rule.message === undefined\n ? `\"{match}\" is out of ${style} case: change it, or add it to exceptions if it is a name`\n : said(rule.message);\n const exceptions = rule.exceptions ?? [];\n return {\n ...base,\n check: ({ text, config }) => {\n const match = outOfCase(text.primary, style, new Set([...config.lint.properNouns, ...exceptions]));\n return match === undefined ? [] : [{ message: fill(message, { match }), match }];\n },\n };\n }\n case 'conditional': {\n const when = rule.when === undefined ? undefined : pattern(rule.when, 'when', rule.ignoreCase);\n const required = pattern(rule.require, 'require', rule.ignoreCase);\n const message = said(rule.message);\n return {\n ...base,\n check: ({ text }) => {\n for (const v of text.variants) {\n const match = when === undefined ? '' : when.exec(v)?.[0];\n if (match !== undefined && !required.test(v)) return [fill(message, { match })];\n }\n return [];\n },\n };\n }\n default:\n return fail(\n `has type ${String((rule as { type?: unknown }).type)}: use existence, substitution, occurrence, capitalization or conditional, or give it a check`,\n );\n }\n}\n\n/** A reason is a sentence a reviewer can check, not a shrug. */\nfunction reasonProblem(why: string): string | undefined {\n if (why.split(/\\s+/).length < 4) return 'is four words at least: say why the rule is wrong here';\n if (/^(?:intentional|needed|required|ok|fine|false positive|by design|legacy|todo)\\b/i.test(why))\n return 'names the reason, not that there is one';\n return undefined;\n}\n\n/** A locale is one a rule reads when it names its language, or the locale and a region of it. */\nconst readsLocale = (locales: 'all' | string[] | undefined, locale: string, sourceLocale: string) =>\n locales === undefined\n ? locale === sourceLocale\n : locales === 'all' ||\n locales.some((l) => locale.toLowerCase() === l.toLowerCase() || locale.toLowerCase().startsWith(`${l.toLowerCase()}-`));\n\nfunction applies(rule: RuleBase, message: Message, locale: string, sourceLocale: string): boolean {\n const { kind, surface, area, locale: locales } = rule.on ?? {};\n return (\n readsLocale(locales, locale, sourceLocale) &&\n (kind === undefined || (message.kind !== undefined && kind.includes(message.kind))) &&\n (surface === undefined || (message.surface !== undefined && surface.includes(message.surface))) &&\n (area === undefined || area.includes(message.area))\n );\n}\n\n/** A rule's severity for an entry: its area's, where `lint.areas` sets one. */\nexport const severityOf = (config: ResolvedConfig, name: string, message: Message): Severity | undefined =>\n config.lint.areas[message.area]?.[name] ?? config.lint.rules[name]?.severity;\n\ninterface Literal {\n start: number;\n value: string;\n}\n\n/**\n * Where the message's literals are written in its text, each looked for after the one before. A\n * literal escaped in the text (`''`, `\\{`) isn't written as read, so it has no place, and nor does a\n * finding in it.\n */\nfunction literalsIn(ast: MessageFormatElement[], text: string): Literal[] {\n const found: Literal[] = [];\n let from = 0;\n walk(ast, (el) => {\n if (el.type !== TYPE.literal || el.value === '') return;\n // MF2's `.match` is read into arms in another order than they are written, so look from the top too.\n const next = text.indexOf(el.value, from);\n const start = next === -1 ? text.indexOf(el.value) : next;\n if (start === -1) return;\n found.push({ start, value: el.value });\n from = start + el.value.length;\n });\n return found;\n}\n\n/** Every place `match` stands in the literals, in any case, whole where it starts or ends with a letter. */\nfunction placesOf(match: string, literals: Literal[]): { start: number; end: number }[] {\n const body = match\n .replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n .replace(/ /g, '\\\\s+')\n .replace(/'/g, \"['’]\");\n const before = /^[\\p{L}\\p{N}]/u.test(match) ? '(?<![\\\\p{L}\\\\p{N}])' : '';\n const after = /[\\p{L}\\p{N}]$/u.test(match) ? '(?![\\\\p{L}\\\\p{N}])' : '';\n const pattern = new RegExp(`${before}${body}${after}`, 'giu');\n const places = new Map<number, number>();\n for (const { start, value } of literals)\n for (const m of value.matchAll(pattern)) places.set(start + m.index, start + m.index + m[0].length);\n return [...places].sort(([a], [b]) => a - b).map(([start, end]) => ({ start, end }));\n}\n\n/** A fix in the case of what it replaces: \"Colour\" becomes \"Color\". */\nconst inCaseOf = (found: string, fix: string) =>\n /^\\p{Lu}/u.test(found) && /^\\p{Ll}/u.test(fix) ? fix.charAt(0).toUpperCase() + fix.slice(1) : fix;\n\n/** `text` with the edits made, leaving out any that overlaps one before it. */\nexport function applyEdits(text: string, edits: Edit[]): string {\n let out = '';\n let at = 0;\n for (const edit of [...edits].sort((a, b) => a.start - b.start)) {\n if (edit.start < at) continue;\n out += text.slice(at, edit.start) + edit.text;\n at = edit.end;\n }\n return out + text.slice(at);\n}\n\nexport function lint(messages: Message[], config: ResolvedConfig): Finding[] {\n const findings: Finding[] = [];\n const rules = Object.entries(config.lint.rules);\n for (const message of messages) {\n const kind = message.kind === undefined ? undefined : config.kinds[message.kind];\n const source = readings(message.ast);\n const locales = [\n { locale: config.source, ast: message.ast, written: message.text, file: message.file },\n ...[...message.translations].map(([locale, t]) => ({ locale, ast: t.ast, written: t.text, file: t.file })),\n ];\n // An exemption is the entry's, so it holds in every locale, and is still needed if any locale needs it.\n const fired = new Set<string>();\n for (const { locale, ast, written, file } of locales) {\n const text = locale === config.source ? source : readings(ast);\n const context: RuleContext = { message, locale, ast, kind, text, source, config };\n let literals: Literal[] | undefined;\n for (const [name, { rule }] of rules) {\n const severity = severityOf(config, name, message)!;\n if (severity === 'off' || !applies(rule, message, locale, config.source)) continue;\n let said: (string | Report)[];\n try {\n said = rule.check(context);\n } catch (cause) {\n throw new Error(`lint rule ${name} failed on ${message.key} in ${locale}: fix or turn off the rule`, { cause });\n }\n if (said.length === 0) continue;\n fired.add(name);\n if (message.allow.has(name)) continue;\n for (const s of said) {\n const { message: text, match, fix } = typeof s === 'string' ? { message: s } : s;\n const finding: Finding = { key: message.key, file, locale, rule: name, severity, message: text };\n if (match !== undefined && match !== '') {\n literals ??= literalsIn(ast, written);\n const places = placesOf(match, literals);\n if (places.length > 0) finding.at = places[0];\n if (places.length > 0 && fix !== undefined)\n finding.fix = places.map((p) => ({ ...p, text: inCaseOf(written.slice(p.start, p.end), fix) }));\n }\n findings.push(finding);\n }\n }\n }\n for (const [name, why] of message.allow) {\n const at = { key: message.key, file: message.file, locale: config.source, rule: 'allow', severity: 'error' as const };\n const rule = config.lint.rules[name];\n if (rule === undefined) {\n findings.push({ ...at, message: `allow.${name} is not a rule: ${rules.map(([n]) => n).join(', ')}` });\n } else if (severityOf(config, name, message) === 'off') {\n continue;\n } else if (!fired.has(name)) {\n findings.push({ ...at, message: `allow.${name} exempts the entry from a rule it passes: remove it` });\n } else {\n const problem = reasonProblem(why);\n if (problem !== undefined) findings.push({ ...at, message: `allow.${name} ${problem}` });\n }\n }\n }\n return findings;\n}\n","/**\n * The defaults: four kinds of string, the surfaces they sit on, and the word lists of the strict lint preset.\n *\n * The kinds are the four any UI writing guide comes down to. A name identifies, an action says what\n * pressing it does, a description adds what the name cannot carry, a state reports what is true.\n * Each carries a budget and a grammar, which is what makes a mechanical check of the words possible.\n */\nexport type Severity = 'error' | 'warn' | 'off';\n\nexport interface KindRule {\n /** What the kind is for, shown when an editor completes it. */\n doc: string;\n /** The most words it may have. Articles, short prepositions and asides in parentheses are free. */\n maxWords?: number;\n /** The most sentences it may have, and per surface where that differs. */\n maxSentences?: number;\n maxSentencesOn?: Record<string, number>;\n /** Whether it ends with a period: always, never, or only on the surfaces listed. */\n period?: 'always' | 'never' | string[];\n /** Capitalizes only its first word and proper nouns. */\n sentenceCase?: boolean;\n /** Carries no explanation after a dash or colon: `Quick capture`, not `Quick capture: choose an area`. */\n bare?: boolean;\n}\n\nexport const DEFAULT_KINDS: Record<string, KindRule> = {\n name: {\n doc: 'Identifies a thing so it can be found again. One to four words, a noun phrase, no period.',\n maxWords: 4,\n period: 'never',\n sentenceCase: true,\n bare: true,\n },\n action: {\n doc: 'Says what pressing it does. One to three words, verb first, no period.',\n maxWords: 3,\n period: 'never',\n sentenceCase: true,\n },\n description: {\n doc: 'Adds only what the name cannot carry. One sentence, two at most, with a period.',\n maxSentences: 2,\n period: 'always',\n },\n state: {\n doc: 'Reports what is true right now. One sentence, present tense; on an error or empty state, one more saying what to do.',\n maxSentences: 1,\n maxSentencesOn: { error: 2, empty: 2, hint: 2, status: 2 },\n period: ['hint', 'status', 'error', 'empty', 'confirm'],\n },\n};\n\nexport const DEFAULT_SURFACES: Record<string, string> = {\n action: 'The text of a button or a menu entry.',\n aria: 'Reached only by a screen reader, so nothing on screen carries it.',\n choice: 'One option among a set offered together.',\n confirm: 'The question of a confirmation, or the verb that answers it.',\n empty: 'Fills a list or a panel that has nothing in it.',\n error: 'Says what failed.',\n heading: 'Heads a section, group, dialog or list.',\n hint: 'A subordinate line under the thing it qualifies.',\n label: 'Names a control, a field, a section or a destination.',\n placeholder: 'Sits inside an empty field, and goes when typing starts.',\n status: 'Reports what is true right now, on a badge or beside a row.',\n title: 'The title of a page, window or document.',\n toast: 'A notification that comes and goes.',\n tooltip: 'Appears on hover.',\n};\n\n/** The word lists of the strict preset: filler, marketing and reassurance, and American spelling. */\nexport const STRICT_LISTS = {\n banned: [\n {\n words: ['seamless', 'seamlessly', 'effortless', 'effortlessly', 'hassle-free', 'frictionless'],\n why: 'promises a feeling rather than saying what happens',\n },\n {\n words: ['leverage', 'leverages', 'leveraging', 'utilize', 'utilizes', 'utilizing', 'harness', 'take advantage of'],\n why: 'is a long way to say use',\n },\n {\n words: [\n 'delve',\n 'dive into',\n 'deep dive',\n 'embark',\n 'journey',\n 'tapestry',\n 'realm',\n 'landscape',\n 'testament',\n 'synergy',\n 'paradigm',\n 'holistic',\n ],\n why: 'is filler, not a thing on the screen',\n },\n {\n words: [\n 'robust',\n 'powerful',\n 'cutting-edge',\n 'state-of-the-art',\n 'best-in-class',\n 'world-class',\n 'next-generation',\n 'revolutionary',\n 'game-changing',\n ],\n why: 'is marketing: say what it does',\n },\n {\n words: ['streamline', 'streamlined', 'empower', 'unlock', 'unleash', 'elevate', 'supercharge', 'boost', 'enhance', 'enhanced'],\n why: 'claims an improvement without naming it',\n },\n { words: ['meticulous', 'crucial', 'pivotal', 'vital', 'paramount'], why: 'tells the reader how to feel instead of what it is' },\n {\n words: ['comprehensive', 'myriad', 'plethora', 'a variety of', 'a wide range of'],\n why: 'is padding: name the things, or say how many',\n },\n {\n words: ['furthermore', 'moreover', 'additionally', 'in order to', 'please note', 'note that', 'keep in mind', 'rest assured'],\n why: 'is a connective a short string has no room for',\n },\n { words: ['intuitive', 'sleek', 'stunning', 'beautiful', 'delightful', 'magical'], why: 'grades the product instead of describing it' },\n { words: ['simply', 'just', 'easily', 'easy', 'quickly'], why: 'says it is easy, which helps nobody it is not easy for' },\n { words: ['so you can', 'allows you to', 'lets you', 'enables you to', \"don't worry\"], why: 'justifies or reassures: state the fact' },\n { words: ['please', 'oops', 'whoops', 'sorry'], why: 'pleads or apologizes: say what failed and what to do' },\n { words: ['etc', 'and more', 'and so on'], why: 'trails off: name the things or stop' },\n ],\n spelling: {\n colour: 'color',\n colours: 'colors',\n behaviour: 'behavior',\n favourite: 'favorite',\n cancelled: 'canceled',\n cancelling: 'canceling',\n labelled: 'labeled',\n centre: 'center',\n licence: 'license',\n grey: 'gray',\n organise: 'organize',\n recognise: 'recognize',\n customise: 'customize',\n optimise: 'optimize',\n minimise: 'minimize',\n maximise: 'maximize',\n synchronise: 'synchronize',\n authorise: 'authorize',\n initialise: 'initialize',\n analyse: 'analyze',\n catalogue: 'catalog',\n dialogue: 'dialog',\n artefact: 'artifact',\n judgement: 'judgment',\n whilst: 'while',\n amongst: 'among',\n } as Record<string, string>,\n};\n","/**\n * `prosebook/config`: where the catalog lives, what an entry may say about itself, and how strictly\n * its words are checked. Written as `prosebook.config.ts` (or `.js`, `.mjs`, `.json`) at the project root.\n */\nimport { existsSync, readFileSync } from 'node:fs';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { compileRule, CORE_RULES, type CheckRule, type CoreRule, type Plugin } from './lint.ts';\nimport type { Isolate } from './mf2.ts';\nimport { DEFAULT_KINDS, DEFAULT_SURFACES, STRICT_LISTS, type KindRule, type Severity } from './presets.ts';\n\nexport type { KindRule, Severity };\nexport {\n definePlugin,\n HOLE,\n phrase,\n sentences,\n words,\n type CapitalizationRule,\n type CheckRule,\n type ConditionalRule,\n type ExistenceRule,\n type OccurrenceRule,\n type Plugin,\n type Readings,\n type Report,\n type Rule,\n type RuleContext,\n type SubstitutionRule,\n} from './lint.ts';\n\nexport interface WordLists {\n /** Words a string never uses, in groups that say why. */\n banned?: { words: string[]; why: string }[];\n /** A spelling, and the one the product uses instead. */\n spelling?: Record<string, string>;\n /** A near-synonym, and the one word the product uses for that concept. */\n concepts?: Record<string, string>;\n /** Words that keep their capital inside a sentence-case string: product names, platforms. */\n properNouns?: string[];\n /** What a path through menus or settings is written with, spaced: `›` by default, as in Settings › General. */\n pathSeparator?: string;\n}\n\ntype RuleSeverities = Partial<Record<CoreRule, Severity>> & Record<string, Severity>;\n\nexport interface LintConfig extends WordLists {\n /** `recommended` (the default) checks shape; `strict` adds the word lists and rules of a house style guide. */\n extends?: 'recommended' | 'strict' | 'none';\n /** Rules of your own, as `<plugin>/<rule>`. Each takes the severity it gives itself under `extends`. */\n plugins?: Plugin[];\n rules?: RuleSeverities;\n /** Severities for one area's entries (a key's first segment) over `rules`: `{ native: { 'sentence-case': 'off' } }`. */\n areas?: Record<string, RuleSeverities>;\n}\n\n/**\n * Native code generated from the catalog, for the parts of an app outside the browser: a tray, a\n * menu bar, a CLI. One file, holding every locale, with a typed function per message.\n */\nexport interface NativeTarget {\n language: 'rust' | 'swift' | 'kotlin';\n /** The file written. */\n out: string;\n /**\n * Key prefixes the file holds: `['native']` takes every `native.*` key, which it names without the\n * prefix (`native.tray.quit` is `tray_quit`). Every key, named in full, by default.\n */\n keys?: string[];\n /** The type holding the locales and messages: `Locale` in Rust, `Copy` in Swift and Kotlin. */\n name?: string;\n /** Kotlin's package. */\n package?: string;\n}\n\nexport interface ProsebookConfig {\n /** The source-language catalog: one `<area>.yaml` per area. */\n catalog?: string;\n /** Translations: `<locale>/<area>.yaml` or `<locale>.yaml`, holding `key: message`. */\n locales?: string;\n /** Where the generated modules go. */\n out?: string;\n /** Records which source text each translation was made from, so a changed source marks it stale. */\n lock?: string;\n /** The locale the catalog is written in. Its code is also the field holding the message. */\n source?: string;\n /**\n * The syntax messages are written in: ICU MessageFormat (1) or Unicode MessageFormat 2. Source and\n * translations alike; `prosebook migrate` rewrites a catalog from one to the other.\n */\n messageFormat?: 1 | 2;\n /**\n * In MF2, when a placeholder is wrapped in Unicode isolation marks, so a value written the other\n * way (a Latin name in Hebrew) can't reorder the text around it. `'rtl'`, the default: in locales\n * written right to left, and wherever `u:dir` asks. `'always'`: also every string in any locale,\n * as the spec's default has it. `false`: never.\n */\n isolate?: Isolate;\n /** Locales that ship in the main bundle beside the source, rather than loading when first used. */\n bundled?: string[];\n /** A pseudo-locale generated from the source (accented and lengthened) to find layout bugs and hardcoded text. */\n pseudo?: string | false;\n /** What a translation whose source changed since does: still show (`use`) or show the source (`fallback`). */\n stale?: 'use' | 'fallback';\n /** Generated modules as TypeScript or as JavaScript with a `.d.ts` beside the index. */\n language?: 'ts' | 'js';\n /** The extension generated imports name: `.js` suits most TypeScript setups, `.ts` suits Node's type stripping. */\n importExtension?: '.js' | '.ts' | '';\n /** The fields every entry must have. A shorthand `key: message` entry satisfies none of them. */\n require?: ('context' | 'kind' | 'surface')[];\n /** The kinds of string an entry may say it is, with the shape each one is held to. */\n kinds?: Record<string, KindRule>;\n /** Where a string may sit, with what each surface means. */\n surfaces?: Record<string, string>;\n lint?: LintConfig;\n /** Rust, Swift or Kotlin files `generate` writes beside the TypeScript. */\n native?: NativeTarget[];\n /** Where `prosebook scan` looks for hardcoded text and catalog keys. */\n scan?: {\n dirs?: string[];\n extensions?: string[];\n /** JSX attributes whose literal value a person reads. */\n attributes?: string[];\n };\n}\n\nexport interface ResolvedConfig {\n root: string;\n catalog: string;\n locales: string;\n out: string;\n lock: string;\n source: string;\n messageFormat: 1 | 2;\n isolate: Isolate;\n bundled: string[];\n pseudo: string | false;\n stale: 'use' | 'fallback';\n language: 'ts' | 'js';\n importExtension: '.js' | '.ts' | '';\n require: ('context' | 'kind' | 'surface')[];\n kinds: Record<string, KindRule>;\n surfaces: Record<string, string>;\n lint: {\n rules: Record<string, { rule: CheckRule; severity: Severity }>;\n areas: Record<string, Record<string, Severity>>;\n } & Required<WordLists>;\n native: (NativeTarget & { name: string })[];\n scan: { dirs: string[]; extensions: string[]; attributes: string[] };\n}\n\nconst NATIVE_NAMES = { rust: 'Locale', swift: 'Copy', kotlin: 'Copy' };\n\n/** Typed config, for `prosebook.config.ts`. */\nexport function defineConfig(config: ProsebookConfig): ProsebookConfig {\n return config;\n}\n\nexport const CONFIG_FILES = [\n 'prosebook.config.ts',\n 'prosebook.config.mts',\n 'prosebook.config.js',\n 'prosebook.config.mjs',\n 'prosebook.config.json',\n];\n\n/** Finds and reads the config at `root`, or the defaults when there is none. */\nexport async function loadConfig(root: string, inline?: ProsebookConfig): Promise<ResolvedConfig> {\n if (inline) return resolveConfig(root, inline);\n for (const name of CONFIG_FILES) {\n const path = join(root, name);\n if (!existsSync(path)) continue;\n if (name.endsWith('.json')) return resolveConfig(root, JSON.parse(readFileSync(path, 'utf8')) as ProsebookConfig);\n const mod = (await import(pathToFileURL(path).href)) as { default?: ProsebookConfig };\n return resolveConfig(root, mod.default ?? {});\n }\n return resolveConfig(root, {});\n}\n\nexport function resolveConfig(root: string, config: ProsebookConfig): ResolvedConfig {\n const at = (path: string) => (isAbsolute(path) ? path : resolve(root, path));\n const lint = config.lint ?? {};\n const base = lint.extends ?? 'recommended';\n const strict = base === 'strict';\n const rules = lintRules(lint);\n for (const [area, severities] of Object.entries(lint.areas ?? {})) {\n for (const name of Object.keys(severities))\n if (!(name in rules)) throw new Error(`lint.areas.${area}.${name} is not a rule: name one of ${Object.keys(rules).join(', ')}`);\n }\n return {\n root,\n catalog: at(config.catalog ?? 'copy/catalog'),\n locales: at(config.locales ?? 'copy/locales'),\n out: at(config.out ?? 'src/copy'),\n lock: at(config.lock ?? 'copy/lock.json'),\n source: config.source ?? 'en',\n messageFormat: config.messageFormat ?? 1,\n isolate: config.isolate ?? 'rtl',\n bundled: config.bundled ?? [],\n pseudo: config.pseudo ?? false,\n stale: config.stale ?? 'use',\n language: config.language ?? 'ts',\n importExtension: config.importExtension ?? '.js',\n require: config.require ?? ['context'],\n kinds: config.kinds ?? DEFAULT_KINDS,\n surfaces: config.surfaces ?? DEFAULT_SURFACES,\n lint: {\n rules,\n areas: lint.areas ?? {},\n banned: [...(strict ? STRICT_LISTS.banned : []), ...(lint.banned ?? [])],\n spelling: { ...(strict ? STRICT_LISTS.spelling : {}), ...lint.spelling },\n concepts: { ...lint.concepts },\n properNouns: lint.properNouns ?? [],\n pathSeparator: lint.pathSeparator ?? '›',\n },\n native: (config.native ?? []).map((target, i) => {\n if (!(target.language in NATIVE_NAMES))\n throw new Error(`native[${i}].language is \"${target.language}\": name one of ${Object.keys(NATIVE_NAMES).join(', ')}`);\n return { ...target, out: at(target.out), name: target.name ?? NATIVE_NAMES[target.language] };\n }),\n scan: {\n dirs: (config.scan?.dirs ?? ['src']).map(at),\n extensions: config.scan?.extensions ?? ['.ts', '.tsx', '.js', '.jsx', '.mts', '.mjs'],\n attributes: config.scan?.attributes ?? ['alt', 'title', 'placeholder', 'label', 'aria-label', 'aria-description', 'aria-placeholder'],\n },\n };\n}\n\nfunction lintRules(lint: LintConfig): ResolvedConfig['lint']['rules'] {\n const base = lint.extends ?? 'recommended';\n const all: [string, CheckRule][] = Object.entries(CORE_RULES);\n const seen = new Set<string>();\n for (const plugin of lint.plugins ?? []) {\n if (!/^[a-z][a-z0-9-]*$/i.test(plugin.name))\n throw new Error(`lint.plugins: \"${plugin.name}\" is not a plugin name: use letters, digits and dashes`);\n if (seen.has(plugin.name)) throw new Error(`lint.plugins: \"${plugin.name}\" is added twice: remove one`);\n seen.add(plugin.name);\n for (const [name, rule] of Object.entries(plugin.rules)) {\n const full = `${plugin.name}/${name}`;\n all.push([full, compileRule(full, rule)]);\n }\n }\n const preset = (rule: CheckRule): Severity =>\n base === 'none' ? 'off' : base === 'strict' ? (rule.strict ?? 'error') : (rule.recommended ?? 'off');\n const rules = Object.fromEntries(all.map(([name, rule]) => [name, { rule, severity: lint.rules?.[name] ?? preset(rule) }]));\n for (const name of Object.keys(lint.rules ?? {}))\n if (!(name in rules)) throw new Error(`lint.rules.${name} is not a rule: name one of ${Object.keys(rules).join(', ')}`);\n return rules;\n}\n"],"mappings":";;;;;;AA0IA,SAAgB,aAAa,QAAwB;CACnD,OAAO;AACT;;AAmBA,MAAa,OAAO;;AAEpB,MAAM,gCAAgB,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAO;CAAU;AAAM,CAAC;AAEvE,SAAS,SAAS,UAAkC,KAA4B;CAC9E,IAAI,MAAM;CACV,KAAK,MAAM,MAAM,UACf,IAAI,GAAG,SAAS,KAAK,SACnB,OAAO,GAAG;MACL,IAAI,GAAG,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