@astryxdesign/cli 0.7.17 → 0.7.18-canary.g32556bb

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 (261) hide show
  1. package/README.md +1 -1
  2. package/api/discover/_adapter.d.mts +7 -5
  3. package/api/discover/_adapter.mjs +12 -11
  4. package/api/docs/_adapter.d.mts +19 -2
  5. package/api/docs/_adapter.mjs +66 -5
  6. package/api/doctor/_adapter.d.mts +11 -62
  7. package/api/doctor/_adapter.mjs +242 -472
  8. package/api/doctor/doctor.d.mts +1 -1
  9. package/api/doctor/doctor.mjs +3 -3
  10. package/api/doctor/theme-checks.mjs +37 -45
  11. package/api/error.d.mts +21 -0
  12. package/api/error.mjs +89 -0
  13. package/api/hook/list/list.d.mts +1 -1
  14. package/api/icon/_adapter.d.mts +8 -0
  15. package/api/icon/_adapter.mjs +17 -0
  16. package/api/icon/_authoring.mjs +6 -6
  17. package/api/icon/_default-look.mjs +16 -16
  18. package/api/icon/add/add.mjs +3 -3
  19. package/api/icon/exportIconIndex.doc.mjs +2 -2
  20. package/api/icon/icon.doc.mjs +2 -2
  21. package/api/icon/icon.type.d.mts +4 -0
  22. package/api/icon/icon.type.mjs +2 -1
  23. package/api/icon/search/icon-index.mjs +16 -3
  24. package/api/icon/search/search.d.mts +15 -5
  25. package/api/icon/search/search.mjs +74 -16
  26. package/api/icon/use/use.mjs +4 -4
  27. package/api/render/_adapter.mjs +233 -40
  28. package/api/render/render.type.d.mts +1 -1
  29. package/api/render/render.type.mjs +1 -1
  30. package/api/search/ORDERING.md +2 -2
  31. package/api/search/_adapter.mjs +4 -0
  32. package/api/search/_candidate-score.mjs +32 -8
  33. package/api/search/_cards.json +1 -1
  34. package/api/search/_compound.d.mts +0 -1
  35. package/api/search/_compound.mjs +93 -2
  36. package/api/search/_icons.d.mts +4 -2
  37. package/api/search/_icons.mjs +4 -2
  38. package/api/search/_lexical.mjs +177 -17
  39. package/api/search/_order.d.mts +3 -1
  40. package/api/search/_order.mjs +16 -5
  41. package/api/search/_result.d.mts +9 -0
  42. package/api/search/_result.mjs +10 -0
  43. package/api/search/_score.mjs +21 -3
  44. package/api/swizzle/_moduleGraph.d.mts +8 -0
  45. package/api/swizzle/_moduleGraph.mjs +61 -3
  46. package/api/template/copy/copy.mjs +5 -3
  47. package/api/template/template.type.d.mts +3 -3
  48. package/api/template/template.type.mjs +3 -3
  49. package/api/theme/_adapter.mjs +48 -12
  50. package/api/theme/build/build.d.mts +4 -0
  51. package/api/theme/build/build.mjs +69 -18
  52. package/api/theme/build/style-keys.mjs +4 -5
  53. package/api/theme/build/theme-object.mjs +5 -0
  54. package/api/theme/palette/generate/color.d.mts +47 -0
  55. package/api/theme/palette/generate/color.mjs +58 -1
  56. package/api/theme/palette/generate/derive-look.d.mts +293 -0
  57. package/api/theme/palette/generate/derive-look.mjs +1362 -0
  58. package/api/theme/palette/generate/editor-look.d.mts +62 -0
  59. package/api/theme/palette/generate/editor-look.mjs +550 -0
  60. package/api/theme/palette/generate/mapping.d.mts +94 -9
  61. package/api/theme/palette/generate/mapping.mjs +94 -22
  62. package/api/theme-edit/_adapter.mjs +13 -2
  63. package/api/theme-edit/_catalog.d.mts +13 -13
  64. package/api/theme-edit/_catalog.mjs +66 -28
  65. package/api/theme-edit/_check.d.mts +82 -6
  66. package/api/theme-edit/_check.mjs +1270 -238
  67. package/api/theme-edit/_color.d.mts +74 -0
  68. package/api/theme-edit/_color.mjs +168 -3
  69. package/api/theme-edit/_compiler.d.mts +3 -5
  70. package/api/theme-edit/_compiler.mjs +122 -23
  71. package/api/theme-edit/_context.d.mts +55 -12
  72. package/api/theme-edit/_context.mjs +114 -60
  73. package/api/theme-edit/_css.d.mts +11 -0
  74. package/api/theme-edit/_css.mjs +40 -0
  75. package/api/theme-edit/_edit.d.mts +15 -2
  76. package/api/theme-edit/_edit.mjs +1469 -133
  77. package/api/theme-edit/_how-commands.d.mts +116 -0
  78. package/api/theme-edit/_how-commands.mjs +227 -115
  79. package/api/theme-edit/_how-question.d.mts +74 -29
  80. package/api/theme-edit/_how-question.mjs +8514 -1256
  81. package/api/theme-edit/_how-sides.d.mts +22 -0
  82. package/api/theme-edit/_how-sides.mjs +173 -0
  83. package/api/theme-edit/_how-steps.d.mts +42 -0
  84. package/api/theme-edit/_how-steps.mjs +208 -0
  85. package/api/theme-edit/_how-values.d.mts +29 -0
  86. package/api/theme-edit/_how-values.mjs +111 -0
  87. package/api/theme-edit/_how-words.d.mts +15 -0
  88. package/api/theme-edit/_how-words.mjs +239 -0
  89. package/api/theme-edit/_how.d.mts +1 -1
  90. package/api/theme-edit/_how.mjs +422 -37
  91. package/api/theme-edit/_missed.d.mts +2 -1
  92. package/api/theme-edit/_missed.mjs +125 -13
  93. package/api/theme-edit/_normal.d.mts +5 -3
  94. package/api/theme-edit/_normal.mjs +54 -14
  95. package/api/theme-edit/_palette.d.mts +204 -4
  96. package/api/theme-edit/_palette.mjs +901 -25
  97. package/api/theme-edit/_part-pieces.d.mts +54 -0
  98. package/api/theme-edit/_part-pieces.mjs +179 -0
  99. package/api/theme-edit/_part-words.mjs +33 -5
  100. package/api/theme-edit/_parts.d.mts +133 -0
  101. package/api/theme-edit/_parts.mjs +599 -10
  102. package/api/theme-edit/_picture-traits.d.mts +259 -0
  103. package/api/theme-edit/_picture-traits.mjs +1030 -0
  104. package/api/theme-edit/_preview.d.mts +95 -4
  105. package/api/theme-edit/_preview.mjs +284 -31
  106. package/api/theme-edit/_project.d.mts +14 -4
  107. package/api/theme-edit/_project.mjs +95 -26
  108. package/api/theme-edit/_resolved.d.mts +46 -0
  109. package/api/theme-edit/_resolved.mjs +800 -0
  110. package/api/theme-edit/_set-line.d.mts +29 -0
  111. package/api/theme-edit/_set-line.mjs +100 -0
  112. package/api/theme-edit/_settings.d.mts +625 -28
  113. package/api/theme-edit/_settings.mjs +4867 -888
  114. package/api/theme-edit/_tables.d.mts +25 -1
  115. package/api/theme-edit/_tables.mjs +115 -11
  116. package/api/theme-edit/_text-looks.d.mts +78 -0
  117. package/api/theme-edit/_text-looks.mjs +376 -0
  118. package/api/theme-edit/_vet.d.mts +3 -26
  119. package/api/theme-edit/_vet.mjs +5 -89
  120. package/api/theme-edit/how/how.d.mts +1 -1
  121. package/api/theme-edit/how/how.mjs +1 -1
  122. package/api/theme-edit/show/show.d.mts +4 -3
  123. package/api/theme-edit/show/show.mjs +3 -2
  124. package/api/theme-edit/theme-edit.type.d.mts +117 -1
  125. package/api/theme-edit/theme-edit.type.mjs +46 -3
  126. package/api/theme-edit/themeEditHow.doc.mjs +3 -3
  127. package/api/theme-edit/themeEditNew.doc.mjs +4 -0
  128. package/api/theme-edit/themeEditSet.doc.mjs +6 -2
  129. package/api/theme-edit/themeEditShow.doc.mjs +22 -3
  130. package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
  131. package/assets/component-list.generated.json +1 -1
  132. package/assets/docs/author-a-theme.doc.mjs +7 -4
  133. package/assets/docs/icons.doc.mjs +7 -6
  134. package/assets/docs/theme.doc.dense.mjs +10 -0
  135. package/assets/docs/theme.doc.mjs +10 -0
  136. package/assets/docs/theme.doc.zh.mjs +10 -0
  137. package/assets/docs/tree/export-pages.doc.mjs +1 -1
  138. package/assets/docs/tree/icon-sets.doc.mjs +1 -1
  139. package/assets/docs/use-a-theme.doc.mjs +89 -17
  140. package/assets/docs-routes.generated.json +1 -1
  141. package/assets/docs.generated.json +2 -2
  142. package/assets/icons/definitions/article.doc.mjs +9 -0
  143. package/assets/icons/template-icons.json +5 -0
  144. package/assets/search-catalog.generated.json +2 -2
  145. package/assets/self-audit.generated.json +1 -1
  146. package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
  147. package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
  148. package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
  149. package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
  150. package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
  151. package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
  152. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
  153. package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
  154. package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +9 -1
  155. package/assets/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonShowcase.doc.mjs +9 -2
  156. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.doc.mjs +3 -2
  157. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -1
  158. package/assets/templates/blocks/components/SideNavItem/SideNavItemShowcase.doc.mjs +3 -2
  159. package/assets/templates/blocks/components/SideNavSection/SideNavSectionShowcase.doc.mjs +2 -1
  160. package/assets/templates/components.generated.json +1 -1
  161. package/assets/templates/pages/ide/page.tsx +5 -10
  162. package/assets/templates/pages/payment-form/page.tsx +16 -60
  163. package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
  164. package/authoring/config/parse.mjs +1 -1
  165. package/authoring/debug/parse.d.mts +1 -1
  166. package/authoring/doctypes/_schema.d.mts +13 -13
  167. package/authoring/doctypes/icon-definition/parse.mjs +2 -2
  168. package/authoring/doctypes/icon-set/parse.mjs +1 -1
  169. package/authoring/doctypes/template/parse.mjs +1 -4
  170. package/authoring/gap-report/parse.d.mts +1 -1
  171. package/clients/cli/build-id.generated.json +1 -1
  172. package/clients/cli/commands/ensure-core-built.mjs +17 -10
  173. package/clients/cli/commands/experimental/icon.mjs +7 -7
  174. package/clients/cli/commands/experimental/theme.mjs +175 -13
  175. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  176. package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
  177. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
  178. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
  179. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +15 -5
  180. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  181. package/clients/cli/commands/hook.mjs +7 -0
  182. package/clients/cli/commands/template.mjs +1 -1
  183. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  184. package/clients/cli/index.mjs +6 -2
  185. package/clients/cli/lib/hook-format.mjs +41 -1
  186. package/clients/cli/lib/json-shim.mjs +34 -14
  187. package/clients/cli/lib/other-cli-words.mjs +7 -0
  188. package/clients/cli/lib/unknown-command.mjs +345 -46
  189. package/clients/cli/manifest.generated.json +1 -1
  190. package/foundation/agent-docs/agent-docs.d.mts +11 -2
  191. package/foundation/agent-docs/agent-docs.mjs +51 -8
  192. package/foundation/config/project.d.mts +11 -1
  193. package/foundation/config/project.mjs +11 -2
  194. package/foundation/discovery/component-replacement.d.mts +5 -8
  195. package/foundation/discovery/component-replacement.mjs +12 -14
  196. package/foundation/discovery/core-augmentation-points.d.mts +35 -0
  197. package/foundation/discovery/core-augmentation-points.mjs +410 -9
  198. package/foundation/discovery/core-elements.d.mts +6 -0
  199. package/foundation/discovery/core-elements.mjs +10 -2
  200. package/foundation/discovery/core-prop-types.d.mts +5 -0
  201. package/foundation/discovery/core-prop-types.mjs +10 -3
  202. package/foundation/discovery/core-props.d.mts +8 -0
  203. package/foundation/discovery/core-props.mjs +29 -13
  204. package/foundation/discovery/icon-ranking.d.mts +5 -2
  205. package/foundation/discovery/icon-ranking.mjs +101 -18
  206. package/foundation/discovery/icon-set-checks.mjs +1 -1
  207. package/foundation/discovery/icon-set-writer.mjs +1 -1
  208. package/foundation/discovery/official-list.d.mts +17 -0
  209. package/foundation/discovery/official-list.mjs +77 -0
  210. package/foundation/discovery/template-icon-notes.mjs +3 -3
  211. package/foundation/discovery/template-icons.mjs +2 -2
  212. package/foundation/discovery/template-placeholders.mjs +1 -1
  213. package/foundation/discovery/unknown-core-props.d.mts +130 -0
  214. package/foundation/discovery/unknown-core-props.mjs +601 -0
  215. package/foundation/discovery/written-prop-values.d.mts +35 -0
  216. package/foundation/discovery/written-prop-values.mjs +258 -0
  217. package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
  218. package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
  219. package/foundation/fs/package-name.d.mts +10 -0
  220. package/foundation/fs/package-name.mjs +37 -0
  221. package/foundation/fs/project-source-files.d.mts +27 -0
  222. package/foundation/fs/project-source-files.mjs +115 -0
  223. package/foundation/fs/project-sources.d.mts +25 -0
  224. package/foundation/fs/project-sources.mjs +83 -0
  225. package/foundation/fs/read-record.d.mts +18 -0
  226. package/foundation/fs/read-record.mjs +36 -2
  227. package/foundation/integrations/integration-warnings.d.mts +39 -7
  228. package/foundation/integrations/integration-warnings.mjs +141 -19
  229. package/foundation/integrations/missing-dependency.d.mts +11 -0
  230. package/foundation/integrations/missing-dependency.mjs +20 -5
  231. package/foundation/release/folder-lock.d.mts +5 -2
  232. package/foundation/release/folder-lock.mjs +9 -3
  233. package/foundation/release/notices.mjs +2 -8
  234. package/foundation/render/cut-short.d.mts +8 -2
  235. package/foundation/render/cut-short.mjs +50 -5
  236. package/foundation/render/drawn-contrast.d.mts +40 -0
  237. package/foundation/render/drawn-contrast.mjs +355 -0
  238. package/foundation/render/file-header.mjs +4 -0
  239. package/foundation/render/layers.d.mts +2 -1
  240. package/foundation/render/layers.mjs +22 -1
  241. package/foundation/render/package-resolve-hooks.d.mts +38 -9
  242. package/foundation/render/package-resolve-hooks.mjs +124 -32
  243. package/foundation/render/page-worker.mjs +95 -23
  244. package/foundation/render/part-boxes.d.mts +27 -0
  245. package/foundation/render/part-boxes.mjs +45 -0
  246. package/foundation/render/picture-chrome.mjs +36 -4
  247. package/foundation/render/picture-playwright.mjs +26 -2
  248. package/foundation/render/picture-window.d.mts +29 -2
  249. package/foundation/render/picture-window.mjs +99 -1
  250. package/foundation/render/render-page.d.mts +39 -6
  251. package/foundation/render/render-page.mjs +26 -10
  252. package/foundation/render/ts-paths.mjs +2 -1
  253. package/foundation/response/error-codes.doc.mjs +1 -1
  254. package/foundation/response/error-codes.mjs +1 -1
  255. package/foundation/response/response-types.doc.mjs +9 -5
  256. package/foundation/suggest/other-command.mjs +25 -1
  257. package/foundation/text/icon-set-next.d.mts +1 -1
  258. package/foundation/text/icon-set-next.mjs +2 -2
  259. package/foundation/text/written-string.d.mts +4 -1
  260. package/foundation/text/written-string.mjs +4 -1
  261. package/package.json +8 -7
@@ -10,6 +10,13 @@ import {pluralOf} from './_query.mjs';
10
10
 
11
11
  /** @typedef {import('./_lexical.mjs').Candidate} Candidate */
12
12
 
13
+ /**
14
+ * How much of a component's or hook's joined name a run cut short must
15
+ * cover to name it (the 95 tier below). The runs a candidate visits are
16
+ * found with the same share (see runsToVisit).
17
+ */
18
+ const SPELLED_SHARE = 0.75;
19
+
13
20
  /**
14
21
  * The strongest hit a run of two or more adjacent query words has when it is
15
22
  * read as one joined word, and the query words it covers. Readers type a
@@ -55,7 +62,7 @@ export function compoundHit(words, candidate) {
55
62
  );
56
63
  /** @type {{score: number, reason: string, covered: Set<string>, alias?: 'partial' | 'keyword', aliasWords?: number} | null} */
57
64
  let best = null;
58
- for (const {run, word} of queryRuns(words)) {
65
+ for (const {run, word} of runsToVisit(words, names, partial, keywords)) {
59
66
  let score = 0;
60
67
  let reason = '';
61
68
  /** @type {'partial' | 'keyword' | null} */
@@ -72,7 +79,7 @@ export function compoundHit(words, candidate) {
72
79
  continue;
73
80
  } else if (
74
81
  nameJoined.startsWith(word) &&
75
- word.length / nameJoined.length >= 0.75
82
+ word.length / nameJoined.length >= SPELLED_SHARE
76
83
  ) {
77
84
  // Most of the name, cut short: `dropdown menu radio` is
78
85
  // DropdownMenuRadioItem.
@@ -162,6 +169,90 @@ function queryRuns(words) {
162
169
  return runs;
163
170
  }
164
171
 
172
+ /**
173
+ * Where each joined word stands among a query's runs (queryRuns), by word.
174
+ * Computed once per query.
175
+ * @type {WeakMap<string[], Map<string, number[]>>}
176
+ */
177
+ const runsAtOf = new WeakMap();
178
+
179
+ /**
180
+ * @param {string[]} words
181
+ * @returns {Map<string, number[]>}
182
+ */
183
+ function runsAt(words) {
184
+ let at = runsAtOf.get(words);
185
+ if (at) return at;
186
+ at = new Map();
187
+ const runs = queryRuns(words);
188
+ for (let i = 0; i < runs.length; i++) {
189
+ const list = at.get(runs[i].word);
190
+ if (list) list.push(i);
191
+ else at.set(runs[i].word, [i]);
192
+ }
193
+ runsAtOf.set(words, at);
194
+ return at;
195
+ }
196
+
197
+ /**
198
+ * The query's runs that can score against a candidate, in their order. A run
199
+ * scores in compoundHit only when its joined word is one of these:
200
+ * - a joined name, its plural (with `s` or `es`), or a hook's name without
201
+ * its leading `use`;
202
+ * - for a component or hook, a start of a joined name that covers at least
203
+ * SPELLED_SHARE of it, or the joined words of a stretch of a name's words
204
+ * (its leading words, or words it holds);
205
+ * - a one-word keyword.
206
+ * Each is a lowercase string of letters and digits, compared whole. Every
207
+ * other run leaves the score at 0, so it is not visited. When there are no
208
+ * more runs than words to look up, every run is visited.
209
+ * @param {string[]} words
210
+ * @param {Array<{nameJoined: string, nameWords: readonly string[]}>} names
211
+ * @param {boolean} partial - whether part of a name counts (a component or hook)
212
+ * @param {string[]} keywords - the one-word lowercase keywords
213
+ * @returns {{run: string[], word: string}[]}
214
+ */
215
+ function runsToVisit(words, names, partial, keywords) {
216
+ const runs = queryRuns(words);
217
+ /** @param {string} nameJoined */
218
+ const shortest = nameJoined => Math.floor(SPELLED_SHARE * nameJoined.length);
219
+ let lookups = keywords.length;
220
+ for (const {nameJoined, nameWords} of names) {
221
+ lookups += 4;
222
+ if (partial) {
223
+ const n = nameWords.length;
224
+ lookups += nameJoined.length - shortest(nameJoined) + (n * (n + 1)) / 2;
225
+ }
226
+ }
227
+ if (lookups >= runs.length) return runs;
228
+ const at = runsAt(words);
229
+ /** @type {Set<number>} */
230
+ const visit = new Set();
231
+ /** @param {string} word */
232
+ const look = word => {
233
+ for (const i of at.get(word) ?? []) visit.add(i);
234
+ };
235
+ for (const {nameJoined, nameWords} of names) {
236
+ look(nameJoined);
237
+ look(`${nameJoined}s`);
238
+ look(`${nameJoined}es`);
239
+ if (nameJoined.startsWith('use')) look(nameJoined.slice(3));
240
+ if (!partial) continue;
241
+ for (let len = shortest(nameJoined); len < nameJoined.length; len++) {
242
+ look(nameJoined.slice(0, len));
243
+ }
244
+ for (let a = 0; a < nameWords.length; a++) {
245
+ let stretch = '';
246
+ for (let b = a; b < nameWords.length; b++) {
247
+ stretch += nameWords[b];
248
+ look(stretch);
249
+ }
250
+ }
251
+ }
252
+ for (const keyword of keywords) look(keyword);
253
+ return [...visit].sort((x, y) => x - y).map(i => runs[i]);
254
+ }
255
+
165
256
  /**
166
257
  * Each candidate's compound hit from its last scoreQuery, so domainPriority
167
258
  * reads it without walking the query's runs again.
@@ -16,8 +16,9 @@
16
16
  * project's look (`experimental.iconVariant`), as `astryx experimental icon
17
17
  * <words>` gives them.
18
18
  * @param {string} query
19
- * @param {{setNames: string[], read: () => Promise<InstalledIcons>}} source
20
- * the installed sets' names, and a read of the sets
19
+ * @param {{setNames: string[], read: () => Promise<InstalledIcons>, componentNames?: () => Iterable<string>}} source
20
+ * the installed sets' names, a read of the sets, and the names of the
21
+ * project's Core components, as the icon finder reads them
21
22
  * @param {{declaredNames: string[], resultDomains: string[], limit: number}} search
22
23
  * the names of the components and hooks search reads, the domains of its
23
24
  * results, and its limit
@@ -26,6 +27,7 @@
26
27
  export function iconSection(query: string, source: {
27
28
  setNames: string[];
28
29
  read: () => Promise<InstalledIcons>;
30
+ componentNames?: () => Iterable<string>;
29
31
  }, { declaredNames, resultDomains, limit }: {
30
32
  declaredNames: string[];
31
33
  resultDomains: string[];
@@ -34,8 +34,9 @@ export const ICON_SECTION_LIMIT = 3;
34
34
  * project's look (`experimental.iconVariant`), as `astryx experimental icon
35
35
  * <words>` gives them.
36
36
  * @param {string} query
37
- * @param {{setNames: string[], read: () => Promise<InstalledIcons>}} source
38
- * the installed sets' names, and a read of the sets
37
+ * @param {{setNames: string[], read: () => Promise<InstalledIcons>, componentNames?: () => Iterable<string>}} source
38
+ * the installed sets' names, a read of the sets, and the names of the
39
+ * project's Core components, as the icon finder reads them
39
40
  * @param {{declaredNames: string[], resultDomains: string[], limit: number}} search
40
41
  * the names of the components and hooks search reads, the domains of its
41
42
  * results, and its limit
@@ -63,6 +64,7 @@ export async function iconSection(
63
64
  const {data} = rankIconSets(sets, withdrawn, query, {
64
65
  limit: Math.min(ICON_SECTION_LIMIT, limit),
65
66
  looks: projectLooks(choice),
67
+ componentNames: source.componentNames,
66
68
  });
67
69
  if (data.matchCount === 0) return null;
68
70
  return {
@@ -53,9 +53,14 @@
53
53
  */
54
54
 
55
55
  import {spellIdentifiers, joined, sameWord, typoDistance} from './_words.mjs';
56
- import {tokenizeQuery, phraseWords, pluralOf} from './_query.mjs';
56
+ import {
57
+ tokenizeQuery,
58
+ phraseWords,
59
+ pluralOf,
60
+ samePhraseWord,
61
+ } from './_query.mjs';
57
62
  import {MAX_RUN_WORDS} from './_compound.mjs';
58
- import {scoreQuery} from './_score.mjs';
63
+ import {scoreQuery, STRONG_TOKEN_SCORE} from './_score.mjs';
59
64
  import {heldTitle} from './_titles.mjs';
60
65
  import {scoreCandidate} from './_candidate-score.mjs';
61
66
  import {domainPriority} from './_priority.mjs';
@@ -64,12 +69,22 @@ import {
64
69
  searchedComponentsOf,
65
70
  namedLeadsOf,
66
71
  rootLeadsOf,
72
+ weakRootsOf,
67
73
  answeredTerms,
68
74
  } from './_result.mjs';
69
- import {nameWords} from './_query-words.mjs';
75
+ import {fold, nameWords} from './_query-words.mjs';
70
76
  import {compareText} from '../../foundation/text/compare-text.mjs';
71
77
  import {COMPONENT_NAME_RE} from '../../foundation/text/entry-names.mjs';
72
78
 
79
+ /**
80
+ * The fewest words a name needs for the query to name it by writing its words
81
+ * apart (see spelledOut in rankLexical). Two words apart read as plain
82
+ * language (`multiline text input` asks for no TextInput, `alert dialog` may
83
+ * ask for either), so only a longer name, which plain language rarely spells
84
+ * out whole, counts.
85
+ */
86
+ const SPELLED_NAME_WORDS = 3;
87
+
73
88
  /**
74
89
  * A search candidate gathered from one content domain. Extra underscore-
75
90
  * prefixed fields carry domain-specific payload used only by {@link toResult}.
@@ -332,6 +347,56 @@ export function rankLexical(query, options, catalog) {
332
347
  return best;
333
348
  };
334
349
 
350
+ /**
351
+ * Where the query spells out the candidate's whole name of
352
+ * SPELLED_NAME_WORDS or more words as words apart (see spelledOut below),
353
+ * or null; the longest of its names. A doc page goes by its route's last
354
+ * part, as in namedSpan.
355
+ * @param {Candidate} candidate
356
+ * @returns {[number, number] | null}
357
+ */
358
+ const spelledSpan = candidate => {
359
+ const doc = candidate.domain === 'doc';
360
+ if (doc && candidate._topic != null && candidate._topic !== candidate.name)
361
+ return null;
362
+ const route = String(candidate.name);
363
+ const names = doc
364
+ ? [route.slice(route.lastIndexOf('/') + 1)]
365
+ : [candidate.name, ...(candidate.aliases ?? [])];
366
+ /** @type {[number, number] | null} */
367
+ let best = null;
368
+ for (const name of names) {
369
+ const words = phraseWords(spellIdentifiers(String(name)));
370
+ if (words.length < SPELLED_NAME_WORDS) continue;
371
+ if (best && best[1] - best[0] >= words.length) continue;
372
+ for (let a = 0; a + words.length <= queryWords.length; a++) {
373
+ const b = a + words.length;
374
+ const run = queryWords.slice(a, b);
375
+ // Every word stands as written (a plural on any), except at most one,
376
+ // which keeps its first letter, and the run read joined is a typo of
377
+ // the name joined as the scorer reads a misspelled name
378
+ // (typoDistance): `with` never stands in for `dot`, nor `list` for
379
+ // `ghost`.
380
+ const typos = words.flatMap((word, n) =>
381
+ samePhraseWord(run[n], word) ? [] : [n],
382
+ );
383
+ if (
384
+ typedAs[a - 1] === typedAs[a] ||
385
+ typedAs[b] === typedAs[b - 1] ||
386
+ typedAs[a] === typedAs[b - 1] ||
387
+ typos.length > 1 ||
388
+ typos.some(n => run[n][0] !== words[n][0]) ||
389
+ (typos.length === 1 &&
390
+ typoDistance(run.join(''), words.join('')) === null)
391
+ )
392
+ continue;
393
+ best = [a, b];
394
+ break;
395
+ }
396
+ }
397
+ return best;
398
+ };
399
+
335
400
  // In search's reading (`ownEvidence`, set by searchView), the query words
336
401
  // that name a component or hook outright (its whole name, as `namedSpan`
337
402
  // and `wordNamed` read it) and no doc. Such a word asks for that entry, and
@@ -376,7 +441,7 @@ export function rankLexical(query, options, catalog) {
376
441
  // role (page / block / component) and takes the top of each, so there's no
377
442
  // cross-role competition to engineer — a target page only needs to be the
378
443
  // strongest PAGE, not outrank every component.
379
- /** @type {{result: any, priority: 0 | 1 | 2, key: number, alias: 'partial' | 'keyword' | false, aliasWords: number, candidate: Candidate, span: [number, number] | null, word: [number, number] | null}[]} */
444
+ /** @type {{result: any, priority: 0 | 1 | 2, key: number, alias: 'partial' | 'keyword' | false, aliasWords: number, candidate: Candidate, hits: Map<string, {fuzzy: boolean, hit: {score: number, reason: string} | null}>, span: [number, number] | null, word: [number, number] | null}[]} */
380
445
  const ranked = [];
381
446
  for (const candidate of all) {
382
447
  // What scoreQuery scored each token as, for domainPriority below.
@@ -423,6 +488,7 @@ export function rankLexical(query, options, catalog) {
423
488
  alias: hit.alias ?? false,
424
489
  aliasWords: hit.aliasWords ?? 0,
425
490
  candidate,
491
+ hits: tokenHits,
426
492
  span: namedSpan(candidate),
427
493
  word: wordNamed(candidate),
428
494
  });
@@ -563,14 +629,36 @@ export function rankLexical(query, options, catalog) {
563
629
  const typedNamed = typed.filter(
564
630
  ({span}) => !runs.some(run => inside(span, run)),
565
631
  );
632
+ // In search's reading, an entry whose whole name of SPELLED_NAME_WORDS or
633
+ // more words the query spells out as words apart leads its run of matches
634
+ // (_order.mjs): the run's words are the name's words in order (a plural on
635
+ // any), at most one of them misspelled with its first letter kept, as the
636
+ // scorer reads a misspelled name: `glim tray sortde rows` for
637
+ // GlimTraySortedRows. Such a run names the entry more fully than a
638
+ // component that holds only its first words, or than its family's root. Two words apart stay plain language (see above). It leads
639
+ // only its run: it moves first among the matches scored the same and is
640
+ // first in its band, never past a match of another band.
641
+ const spelledOut = (catalog.ownEvidence ? ranked : []).flatMap(r => {
642
+ const span = spelledSpan(r.candidate);
643
+ return span ? [{r, span}] : [];
644
+ });
645
+ // A name inside a longer named run, spelled out or joined, names less of
646
+ // the query than that run: the longest wins.
647
+ const longer = [...runs, ...spelledOut.map(({span}) => span)];
648
+ const spelledNamed = spelledOut.filter(
649
+ ({r, span}) =>
650
+ !typedNamed.some(t => t.r === r) &&
651
+ !longer.some(run => inside(span, run)),
652
+ );
566
653
  // A longer name of another entry the query holds, a block's display name or
567
654
  // a doc's title or heading (`ChatComposerInput — Controlled`), names that
568
655
  // entry more fully, so the name inside it does not lead. It is held as the
569
656
  // title tier holds a title (heldTitle), with the query's identifiers spelled
570
- // out on both sides.
571
- /** @type {[number, number][]} */
657
+ // out on both sides. An entry's own display name or title does not stop
658
+ // its spelled-out name.
659
+ /** @type {{at: [number, number], of: Candidate}[]} */
572
660
  const labels = [];
573
- if (typedNamed.length) {
661
+ if (typedNamed.length || spelledNamed.length) {
574
662
  const spelledWords = (/** @type {string} */ text) =>
575
663
  phraseWords(spellIdentifiers(text));
576
664
  for (const candidate of all) {
@@ -579,17 +667,46 @@ export function rankLexical(query, options, catalog) {
579
667
  ...(candidate.titles ?? []),
580
668
  ]) {
581
669
  const held = heldTitle(queryWords, [label], spelledWords);
582
- if (held) labels.push(held.at);
670
+ if (held) labels.push({at: held.at, of: candidate});
583
671
  }
584
672
  }
585
673
  }
586
- const leads = new Set(
674
+ const typedLeads = new Set(
587
675
  typedNamed
588
- .filter(({span}) => !labels.some(label => inside(span, label)))
676
+ .filter(({span}) => !labels.some(label => inside(span, label.at)))
589
677
  .map(({r}) => r.result),
590
678
  );
591
- if (leads.size) {
592
- scored.sort((a, b) => Number(leads.has(b)) - Number(leads.has(a)));
679
+ const spelledLeads = spelledNamed
680
+ .filter(
681
+ ({r, span}) =>
682
+ !labels.some(
683
+ label => label.of !== r.candidate && inside(span, label.at),
684
+ ),
685
+ )
686
+ .map(({r}) => r.result);
687
+ // A part whose whole name the query spells out keeps its band lead over
688
+ // its family's root (rootLeads below).
689
+ const spelledLed = new Set(spelledLeads);
690
+ const leads = new Set([...typedLeads, ...spelledLeads]);
691
+ if (typedLeads.size) {
692
+ scored.sort(
693
+ (a, b) => Number(typedLeads.has(b)) - Number(typedLeads.has(a)),
694
+ );
695
+ }
696
+ // A spelled-out name goes first among the matches scored the same next to
697
+ // it, which move as one block in _order.mjs.
698
+ if (spelledLeads.length) {
699
+ const spelled = new Set(spelledLeads);
700
+ for (let a = 0; a < scored.length;) {
701
+ let b = a + 1;
702
+ while (b < scored.length && scored[b].score === scored[a].score) b++;
703
+ const tie = scored.slice(a, b);
704
+ if (tie.some(r => spelled.has(r))) {
705
+ tie.sort((x, y) => Number(spelled.has(y)) - Number(spelled.has(x)));
706
+ scored.splice(a, b - a, ...tie);
707
+ }
708
+ a = b;
709
+ }
593
710
  }
594
711
 
595
712
  // A family's root leads a part of its own family (its doc lists the part
@@ -602,10 +719,14 @@ export function rankLexical(query, options, catalog) {
602
719
  // asks for TabList before its Tab, and `code sample` for CodeBlock before
603
720
  // its Code, whatever their scores; a query holding
604
721
  // "item" keeps ListItem before List, and `breadcrumbitm` keeps
605
- // BreadcrumbItem first. The scores and this order stay as they are: the
722
+ // BreadcrumbItem first. A root whose hits are weaker than keyword strength
723
+ // leads only inside its part's run (weakRootsOf). The scores and this order
724
+ // stay as they are: the
606
725
  // order of matches moves the root directly before its part (rootLeadsOf).
607
726
  /** @type {Map<object, object>} */
608
727
  const rootLeads = new Map();
728
+ /** @type {Set<object>} */
729
+ const weakRoots = new Set();
609
730
  if (ranked.some(r => r.candidate._family)) {
610
731
  /** @type {Map<string, (typeof ranked)[number]>} */
611
732
  const byName = new Map();
@@ -615,14 +736,51 @@ export function rankLexical(query, options, catalog) {
615
736
  }
616
737
  const asked = nameWords(String(query));
617
738
  const typedJoined = String(query).trim().split(/\s+/).map(joined);
618
- /** @param {(typeof ranked)[number]} r */
619
- const misspelled = r =>
739
+ // A typed word that is the root's own name (`stack` for HStack's root
740
+ // Stack) asks for the root, not a misspelled part.
741
+ const misspelled = (
742
+ /** @type {(typeof ranked)[number]} */ r,
743
+ /** @type {string} */ family,
744
+ ) =>
620
745
  phraseWords(spellIdentifiers(String(r.candidate.name))).length >= 2 &&
621
- typedJoined.some(t => typoDistance(t, joined(r.candidate.name)) != null);
746
+ typedJoined.some(
747
+ t =>
748
+ t !== joined(family) &&
749
+ !pluralOf(t, joined(family)) &&
750
+ typoDistance(t, joined(r.candidate.name)) != null,
751
+ );
752
+ // Whether a root's own hits on the words its part answers have keyword
753
+ // strength (STRONG_TOKEN_SCORE: the whole name, the name's head word, or a
754
+ // keyword, also one edit away, since a misspelled
755
+ // name still names the root), not a word inside its name or a mention in
756
+ // its text. A root with weaker hits leads its part only inside the part's
757
+ // run (rootsFirst): `router` keeps a part whose keyword is `router` above
758
+ // a root whose description only mentions it.
759
+ /**
760
+ * @param {(typeof ranked)[number]} root
761
+ * @param {Set<string> | null} terms the words the part answered, or null
762
+ * for the whole query
763
+ */
764
+ const strong = (root, terms) => {
765
+ const scores = [...root.hits]
766
+ .filter(([t]) => !terms || terms.has(fold(t)))
767
+ .map(([, {hit}]) => hit?.score ?? 0);
768
+ return scores.length
769
+ ? scores.every(score => score >= STRONG_TOKEN_SCORE)
770
+ : root.key >= STRONG_TOKEN_SCORE;
771
+ };
622
772
  for (const r of ranked) {
623
773
  const family = r.candidate._family;
624
774
  const root = family && byName.get(`${r.result.domain}:${family}`);
625
- if (!root || root === r || typedSpan(r) || misspelled(r)) continue;
775
+ if (
776
+ !root ||
777
+ root === r ||
778
+ typedSpan(r) ||
779
+ misspelled(r, family) ||
780
+ spelledLed.has(r.result)
781
+ ) {
782
+ continue;
783
+ }
626
784
  const ofPart = answeredTerms(r.result.reason);
627
785
  const ofRoot = answeredTerms(root.result.reason);
628
786
  if (ofRoot && (!ofPart || [...ofPart].some(w => !ofRoot.has(w)))) {
@@ -634,6 +792,7 @@ export function rankLexical(query, options, catalog) {
634
792
  );
635
793
  if (own.some(w => asked.some(q => sameWord(q, w)))) continue;
636
794
  rootLeads.set(r.result, root.result);
795
+ if (!strong(root, ofPart)) weakRoots.add(r.result);
637
796
  }
638
797
  }
639
798
 
@@ -666,6 +825,7 @@ export function rankLexical(query, options, catalog) {
666
825
  }
667
826
  if (leads.size) namedLeadsOf.set(response, leads);
668
827
  if (rootLeads.size) rootLeadsOf.set(response, rootLeads);
828
+ if (weakRoots.size) weakRootsOf.set(response, weakRoots);
669
829
  if (catalog.searchedComponents) {
670
830
  searchedComponentsOf.set(
671
831
  response,
@@ -52,9 +52,11 @@ export function integrationTies(items: Item[]): Item[];
52
52
  * root's result
53
53
  * @param {Map<object, object>} [moved] filled with each part whose root
54
54
  * moved, mapped to that root
55
+ * @param {Set<object>} [weak] parts whose root leads them only inside their
56
+ * own run
55
57
  * @returns {Item[]}
56
58
  */
57
- export function rootsFirst(ranked: Item[], roots: Map<object, object>, moved?: Map<object, object>): Item[];
59
+ export function rootsFirst(ranked: Item[], roots: Map<object, object>, moved?: Map<object, object>, weak?: Set<object>): Item[];
58
60
  export function bandOf(score: number): number;
59
61
  export type EntryTable = import("./_entries.mjs").EntryTable;
60
62
  export type Item = {
@@ -6,7 +6,8 @@
6
6
  * reason. A match never moves past one of another score band (BANDS below)
7
7
  * or another kind, doc or not; between runs the lexical order holds. The one
8
8
  * exception is a family's root that the lexical ranker marks as leading its
9
- * part: it moves directly before the part. A band
9
+ * part with hits of keyword strength: it moves directly before the part. A
10
+ * band
10
11
  * can be wide: 55–99 holds keyword matches beside one-word description hits,
11
12
  * and a synonym name match can score under 55, so inside a band a weaker match
12
13
  * can lead a stronger one when the weights favor it. Inside such a
@@ -20,7 +21,8 @@
20
21
  * own name holds more query words leads (tieByOwnName). Last, a family's root
21
22
  * that the lexical ranker marks as leading a part of its own family
22
23
  * (rootLeadsOf) moves directly before the part when it sits below it
23
- * (rootsFirst), after the part's tie is ordered as one block.
24
+ * (rootsFirst), after the part's tie is ordered as one block; a root with
25
+ * weaker hits (weakRootsOf) moves so only inside the part's run.
24
26
  */
25
27
 
26
28
  import {entryOf} from './_entries.mjs';
@@ -31,6 +33,7 @@ import {
31
33
  namedLeadsOf,
32
34
  rootLeadsOf,
33
35
  searchedComponentsOf,
36
+ weakRootsOf,
34
37
  } from './_result.mjs';
35
38
 
36
39
  /** @typedef {import('./_entries.mjs').EntryTable} EntryTable */
@@ -94,6 +97,7 @@ export function orderMatches(table, order, lexical, query, limit, families) {
94
97
  };
95
98
  });
96
99
  const roots = rootLeadsOf.get(lexical);
100
+ const weak = weakRootsOf.get(lexical);
97
101
  // An entry the query names: by a name match, or by a name of two or more
98
102
  // words the lexical ranker put first (namedLeadsOf).
99
103
  const leads = namedLeadsOf.get(lexical);
@@ -137,11 +141,15 @@ export function orderMatches(table, order, lexical, query, limit, families) {
137
141
  // the roots move: a part's root, when the part comes first.
138
142
  const head = ranked[0];
139
143
  const headRoot = head && roots?.get(head.res);
140
- const lead = ranked.find(it => it.res === headRoot) ?? head;
144
+ const rootItem = ranked.find(it => it.res === headRoot);
145
+ const lead =
146
+ rootItem && !(weak?.has(head.res) && rootItem.band !== head.band)
147
+ ? rootItem
148
+ : head;
141
149
  ranked = tiesByFit(ranked, table, blockOf, lead);
142
150
  /** @type {Map<object, object>} */
143
151
  const moved = new Map();
144
- if (roots) ranked = rootsFirst(ranked, roots, moved);
152
+ if (roots) ranked = rootsFirst(ranked, roots, moved, weak);
145
153
  const shown = ranked.slice(0, limit);
146
154
  const response = {
147
155
  ...lexical,
@@ -358,15 +366,18 @@ function answered(it) {
358
366
  * root's result
359
367
  * @param {Map<object, object>} [moved] filled with each part whose root
360
368
  * moved, mapped to that root
369
+ * @param {Set<object>} [weak] parts whose root leads them only inside their
370
+ * own run
361
371
  * @returns {Item[]}
362
372
  */
363
- export function rootsFirst(ranked, roots, moved) {
373
+ export function rootsFirst(ranked, roots, moved, weak) {
364
374
  const out = [...ranked];
365
375
  for (let a = 0; a < out.length; a++) {
366
376
  const root = roots.get(out[a].res);
367
377
  if (!root) continue;
368
378
  const b = out.findIndex((it, n) => n > a && it.res === root);
369
379
  if (b < 0) continue;
380
+ if (weak?.has(out[a].res) && out[b].band !== out[a].band) continue;
370
381
  out.splice(a, 0, ...out.splice(b, 1));
371
382
  moved?.set(out[a + 1].res, root);
372
383
  }
@@ -128,4 +128,13 @@ export const rootLeadsOf: WeakMap<object, Map<object, object>>;
128
128
  * @type {WeakMap<object, Map<object, object>>}
129
129
  */
130
130
  export const movedRootsOf: WeakMap<object, Map<object, object>>;
131
+ /**
132
+ * The parts, by lexical response, whose root leads them on hits weaker than
133
+ * keyword strength (STRONG_TOKEN_SCORE; see rankLexical): such a root leads
134
+ * its part
135
+ * only inside the part's run. Module-private, so they never enter search's
136
+ * JSON.
137
+ * @type {WeakMap<object, Set<object>>}
138
+ */
139
+ export const weakRootsOf: WeakMap<object, Set<object>>;
131
140
  export type Candidate = import("./_lexical.mjs").Candidate;
@@ -168,6 +168,16 @@ export const rootLeadsOf = new WeakMap();
168
168
  */
169
169
  export const movedRootsOf = new WeakMap();
170
170
 
171
+ /**
172
+ * The parts, by lexical response, whose root leads them on hits weaker than
173
+ * keyword strength (STRONG_TOKEN_SCORE; see rankLexical): such a root leads
174
+ * its part
175
+ * only inside the part's run. Module-private, so they never enter search's
176
+ * JSON.
177
+ * @type {WeakMap<object, Set<object>>}
178
+ */
179
+ export const weakRootsOf = new WeakMap();
180
+
171
181
  /**
172
182
  * The query words a match answered: the terms its reason lists, folded, or
173
183
  * null when it answered the whole query (a name, keyword, or title hit).
@@ -209,6 +209,11 @@ export function scoreQuery(
209
209
  // Multi-word natural language: score each content token, counting only
210
210
  // strong hits, then reward coverage so candidates matching more terms win.
211
211
  let strongest = 0;
212
+ // The distinct query words a hit of keyword strength answers, or a word of
213
+ // the candidate's own name (see ownName below). A word said twice counts
214
+ // once.
215
+ /** @type {Set<string>} */
216
+ const strongWords = new Set();
212
217
  // Words the candidate answers with its own text: not only through a
213
218
  // component a template uses (see STRONG_TOKEN_SCORE). A word of its own
214
219
  // name, display name or title, or the start of one, is its own answer,
@@ -256,10 +261,16 @@ export function scoreQuery(
256
261
  }
257
262
  if (h && h.score >= MIN_TOKEN_SCORE) {
258
263
  if (h.score > strongest) strongest = h.score;
264
+ /** @type {boolean | undefined} */
265
+ let inOwnName;
266
+ const own = () => (inOwnName ??= ownName(tok));
267
+ if (h.score >= STRONG_TOKEN_SCORE || (ownEvidence && own())) {
268
+ strongWords.add(joined(tok));
269
+ }
259
270
  if (
260
271
  !('used' in h && h.used) ||
261
272
  (h.own ?? 0) >= MIN_TOKEN_SCORE ||
262
- ownName(tok)
273
+ own()
263
274
  ) {
264
275
  ownMatched++;
265
276
  }
@@ -303,6 +314,7 @@ export function scoreQuery(
303
314
  for (const tok of tokens) {
304
315
  if (!hitTerms.includes(tok) && inTitle(tok)) {
305
316
  if (STRONG_TOKEN_SCORE > strongest) strongest = STRONG_TOKEN_SCORE;
317
+ strongWords.add(joined(tok));
306
318
  matched++;
307
319
  ownMatched++;
308
320
  hitTerms.push(tok);
@@ -321,7 +333,12 @@ export function scoreQuery(
321
333
  // both; a candidate that has both comes first, ordered among its peers by
322
334
  // how strong its matches are. It needs one keyword-strength hit:
323
335
  // every word mentioned in prose, or rendered by a page, is breadth, and
324
- // stays on the token sum below an exact hit on one word.
336
+ // stays on the token sum below an exact hit on one word. In search's
337
+ // reading (`ownEvidence`), an entry that is not a doc needs two strong
338
+ // words: a hit of keyword strength, or a word of its own name, display
339
+ // name or title, or the start of one. One strong word and a mention of the others is a match on
340
+ // that word, not on the ask. A doc answers in prose, so it keeps the bar
341
+ // of one.
325
342
  //
326
343
  // The TOTAL quality of matches orders candidates within this tier, not
327
344
  // just the strongest single hit. A doc matching both words by keyword
@@ -331,7 +348,8 @@ export function scoreQuery(
331
348
  if (
332
349
  matched === tokens.length &&
333
350
  ownMatched === tokens.length &&
334
- strongest >= STRONG_TOKEN_SCORE
351
+ strongest >= STRONG_TOKEN_SCORE &&
352
+ (!ownEvidence || candidate.domain === 'doc' || strongWords.size >= 2)
335
353
  ) {
336
354
  return {
337
355
  score:
@@ -170,3 +170,11 @@ export type CopyPlan = {
170
170
  */
171
171
  dependencies: Record<string, string>;
172
172
  };
173
+ /**
174
+ * Export origins by module, as {@link moduleExportOrigins} memoizes them:
175
+ * value and type reads apart.
176
+ */
177
+ export type ExportMemos = {
178
+ value: Map<string, any>;
179
+ type: Map<string, any>;
180
+ };