@astryxdesign/cli 0.7.11 → 0.7.12-canary.0840fcc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/build/blocks/blocks.d.mts +41 -0
- package/api/build/blocks/blocks.mjs +118 -68
- package/api/build/kit/rank.mjs +21 -4
- package/api/build/kit/words.d.mts +1 -0
- package/api/build/kit/words.mjs +1 -1
- package/api/component/__fixtures__/resolutions/modules.txt +5 -5
- package/api/docs/_adapter.d.mts +22 -0
- package/api/docs/_adapter.mjs +81 -3
- package/api/docs/docs.doc.mjs +5 -5
- package/api/docs/docs.type.d.mts +21 -0
- package/api/docs/docs.type.mjs +11 -0
- package/api/docs/list/list.d.mts +5 -1
- package/api/docs/list/list.mjs +72 -6
- package/api/docs/node/node.mjs +2 -40
- package/api/icon/_adapter.d.mts +3 -2
- package/api/icon/_adapter.mjs +8 -2
- package/api/icon/_authoring.d.mts +1 -0
- package/api/icon/_authoring.mjs +594 -67
- package/api/icon/_default-look.d.mts +155 -0
- package/api/icon/_default-look.mjs +474 -0
- package/api/icon/_records.d.mts +1 -1
- package/api/icon/_records.mjs +1 -0
- package/api/icon/add/add.mjs +269 -43
- package/api/icon/icon.type.d.mts +46 -2
- package/api/icon/icon.type.mjs +12 -2
- package/api/icon/iconAdd.doc.mjs +2 -2
- package/api/icon/iconNewDefinition.doc.mjs +3 -2
- package/api/icon/iconNewSet.doc.mjs +4 -4
- package/api/icon/map/map.mjs +11 -4
- package/api/icon/search/search.mjs +10 -9
- package/api/index.d.mts +1 -0
- package/api/index.mjs +1 -0
- package/api/integration/add-helpers.d.mts +15 -1
- package/api/integration/add-helpers.mjs +5 -2
- package/api/integration/authoring-checks.d.mts +0 -2
- package/api/integration/authoring-checks.mjs +1 -6
- package/api/logger.mjs +2 -1
- package/api/render/_adapter.mjs +9 -0
- package/api/render/render.doc.mjs +3 -3
- package/api/render/render.type.d.mts +1 -1
- package/api/render/render.type.mjs +1 -1
- package/api/search/ORDERING.md +3 -0
- package/api/search/_adapter.d.mts +32 -3
- package/api/search/_adapter.mjs +50 -22
- package/api/search/_fit-order.d.mts +47 -0
- package/api/search/_fit-order.mjs +257 -0
- package/api/search/_main-searcher.mjs +15 -5
- package/api/search/exportSearchIndex.doc.d.mts +10 -0
- package/api/search/exportSearchIndex.doc.mjs +58 -0
- package/api/search/rankSearchIndex.doc.d.mts +10 -0
- package/api/search/rankSearchIndex.doc.mjs +79 -0
- package/api/search/search-index.d.mts +44 -0
- package/api/search/search-index.mjs +270 -0
- package/api/search/search.type.d.mts +28 -0
- package/api/search/search.type.mjs +17 -0
- package/api/swizzle/_adapter.d.mts +1 -0
- package/api/swizzle/_adapter.mjs +4 -1
- package/api/swizzle/_moduleGraph.d.mts +178 -0
- package/api/swizzle/_moduleGraph.mjs +903 -0
- package/api/swizzle/copy/copy.d.mts +2 -43
- package/api/swizzle/copy/copy.mjs +287 -315
- package/api/swizzle/swizzle.d.mts +0 -2
- package/api/swizzle/swizzle.doc.mjs +13 -4
- package/api/swizzle/swizzle.mjs +3 -7
- package/api/swizzle/swizzle.type.d.mts +7 -1
- package/api/swizzle/swizzle.type.mjs +4 -2
- package/api/template/template.mjs +1 -0
- package/assets/discover/official-packages.json +36 -0
- package/assets/docs/browser-support.doc.mjs +2 -2
- package/assets/docs/styling-overview.doc.mjs +6 -2
- package/assets/docs/tree/icon-sets.doc.mjs +13 -7
- package/assets/docs/tree/render-pages.doc.mjs +3 -3
- package/assets/docs/tree/tailwind.doc.mjs +41 -1
- package/assets/docs/tree/type-scale.doc.mjs +19 -2
- package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Calendar/useCalendarConstraintsHookUsage.tsx +146 -0
- package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Calendar/useCalendarNavigationHookUsage.tsx +173 -0
- package/assets/templates/blocks/components/Hooks/useInputStatusIconHookUsage.tsx +1 -0
- package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Hooks/useInteractiveRoleHookUsage.tsx +56 -0
- package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.doc.mjs +2 -2
- package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +66 -10
- package/assets/templates/blocks/components/Link/useLinkifyHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Link/useLinkifyHookUsage.tsx +39 -0
- package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/PowerSearch/usePowerSearchConfigHookUsage.tsx +83 -0
- package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/RowsVirtualizationHookUsage.tsx +41 -0
- package/assets/templates/blocks/components/Table/TableRowIndexTable.doc.mjs +1 -1
- package/assets/templates/blocks/components/Table/TableRowIndexTable.tsx +2 -2
- package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/useTableColumnSettingsStateHookUsage.tsx +97 -0
- package/assets/templates/pages/course-detail/page.tsx +699 -0
- package/assets/templates/pages/course-detail/template.doc.mjs +37 -0
- package/assets/templates/pages/file-explorer/page.tsx +103 -79
- package/assets/templates/pages/table-filter/page.tsx +15 -23
- package/assets/templates/pages/table-grouped/page.tsx +160 -232
- package/assets/templates/pages/table-grouped/template.doc.mjs +0 -2
- package/assets/templates/pages/table-inbox/page.tsx +3 -6
- package/assets/templates/pages/theme-showcase/page.tsx +724 -792
- package/assets/templates/pages/theme-showcase/template.doc.mjs +4 -5
- package/assets/templates/themes/butter/butterTheme.ts +2 -2
- package/assets/templates/themes/gothic/gothicTheme.ts +16 -0
- package/assets/templates/themes/matcha/matchaTheme.ts +1 -1
- package/assets/templates/themes/neutral/neutralTheme.ts +6 -0
- package/assets/templates/themes/stone/stoneTheme.ts +1 -1
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/y2k/y2kTheme.ts +2 -2
- package/authoring/doctypes/template/type.ts +1 -0
- package/clients/cli/commands/docs.doc.mjs +5 -1
- package/clients/cli/commands/docs.mjs +30 -2
- package/clients/cli/commands/experimental/icon.mjs +56 -14
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +2 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
- package/clients/cli/commands/experimental-render.doc.mjs +1 -1
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +33 -9
- package/clients/cli/lib/resolve-theme.mjs +16 -7
- package/foundation/discovery/component-loader.d.mts +1 -1
- package/foundation/discovery/doc-types.mjs +9 -2
- package/foundation/discovery/hook-discovery.mjs +31 -8
- package/foundation/discovery/icon-ranking.d.mts +27 -3
- package/foundation/discovery/icon-ranking.mjs +125 -8
- package/foundation/discovery/icon-set-checks.mjs +44 -35
- package/foundation/discovery/icon-set-discovery.d.mts +13 -0
- package/foundation/discovery/icon-set-discovery.mjs +25 -0
- package/foundation/discovery/icon-set-writer.d.mts +258 -20
- package/foundation/discovery/icon-set-writer.mjs +785 -87
- package/foundation/discovery/module-exports.d.mts +3 -2
- package/foundation/discovery/module-exports.mjs +167 -37
- package/foundation/doc-compiler/import.d.mts +5 -1
- package/foundation/doc-compiler/import.mjs +40 -6
- package/foundation/fs/import-url.d.mts +20 -0
- package/foundation/fs/import-url.mjs +22 -0
- package/foundation/fs/module-loader.d.mts +24 -3
- package/foundation/fs/module-loader.mjs +69 -47
- package/foundation/fs/paths.d.mts +2 -1
- package/foundation/fs/paths.mjs +3 -4
- package/foundation/render/charts.d.mts +59 -0
- package/foundation/render/charts.mjs +216 -0
- package/foundation/render/embedded-imports.d.mts +7 -7
- package/foundation/render/embedded-imports.mjs +63 -54
- package/foundation/render/page-host.d.mts +4 -0
- package/foundation/render/page-host.mjs +45 -0
- package/foundation/render/page-worker.mjs +350 -57
- package/foundation/render/render-page.d.mts +11 -6
- package/foundation/render/render-page.mjs +164 -54
- package/foundation/render/ts-paths.d.mts +63 -0
- package/foundation/render/ts-paths.mjs +138 -0
- package/foundation/response/error-codes.doc.mjs +3 -3
- package/foundation/response/error-codes.mjs +3 -2
- package/foundation/text/levenshtein.d.mts +6 -1
- package/foundation/text/levenshtein.mjs +25 -9
- package/foundation/text/shell-arg.d.mts +14 -0
- package/foundation/text/shell-arg.mjs +17 -0
- package/foundation/text/suggest-order.d.mts +8 -1
- package/foundation/text/suggest-order.mjs +72 -6
- package/package.json +7 -6
package/api/icon/icon.type.mjs
CHANGED
|
@@ -156,6 +156,7 @@
|
|
|
156
156
|
* @property {string} data.file - The data file, relative to the package.
|
|
157
157
|
* @property {Array<{definition: string, icon: string, previous: string | null, changed: boolean}>} data.entries - Each pair, in order, and what it replaced.
|
|
158
158
|
* @property {boolean} data.changed - Whether the file was written.
|
|
159
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
159
160
|
* @property {string[]} [data.files] - The generated module and its types, when its theme map was rewritten.
|
|
160
161
|
*/
|
|
161
162
|
|
|
@@ -172,6 +173,7 @@
|
|
|
172
173
|
* @property {string | null} data.icon - The id of the icon now mapped (the icon may be named by any name `map` accepts); null after `remove`.
|
|
173
174
|
* @property {string | null} data.previous - The icon id it replaced.
|
|
174
175
|
* @property {boolean} data.changed - Whether the file was written.
|
|
176
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
175
177
|
* @property {string[]} [data.files] - The generated module and its types, when its theme map was rewritten.
|
|
176
178
|
*/
|
|
177
179
|
|
|
@@ -183,7 +185,7 @@
|
|
|
183
185
|
* @property {string} from - The module the icon is exported from: a package, a package subpath, or a relative path in this package.
|
|
184
186
|
* @property {string} [set] - The set to edit, when the package ships several.
|
|
185
187
|
* @property {string} [definition] - The icon definition to map the icon to.
|
|
186
|
-
* @property {string} [newDefinition] - Add the set's own definition with this name and map the icon to it.
|
|
188
|
+
* @property {string} [newDefinition] - Add the set's own definition with this name (camelCase, or kebab-case written as camelCase) and map the icon to it.
|
|
187
189
|
* @property {string} [description] - With `newDefinition`: what the icon is for.
|
|
188
190
|
* @property {string[]} [words] - With `newDefinition`: words people search for.
|
|
189
191
|
* @property {boolean} [useDefault] - The module's default export is the icon.
|
|
@@ -207,6 +209,7 @@
|
|
|
207
209
|
* @property {string[]} data.missing - Ids of icons `from` has no export for; they keep no such variant.
|
|
208
210
|
* @property {string[]} data.files - Files written, relative to the package.
|
|
209
211
|
* @property {boolean} data.changed
|
|
212
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
210
213
|
*/
|
|
211
214
|
|
|
212
215
|
/**
|
|
@@ -223,6 +226,8 @@
|
|
|
223
226
|
* @property {string} [data.newDefinition] - The set's own definition the command wrote.
|
|
224
227
|
* @property {string[]} data.files - Files written, relative to the package.
|
|
225
228
|
* @property {boolean} data.changed - Whether anything was written.
|
|
229
|
+
* @property {boolean} data.added - Whether the icon, its variant, its `map` entry, or a new definition was added. False when the set already had them, even when `changed` is true because the command wrote a renamed package's new name.
|
|
230
|
+
* @property {{previous: string, module: string}} [data.moduleUpdate] - The data file's `module` before and after this command, when the package was renamed and the command wrote its new name.
|
|
226
231
|
* @property {string} [data.note] - What the package still needs, as text to copy: the entry line that exports the icon from the set's module, and the package.json `files` that publishes a `./` source.
|
|
227
232
|
*/
|
|
228
233
|
|
|
@@ -249,6 +254,7 @@
|
|
|
249
254
|
* @property {string} data.id - The id the icon would get.
|
|
250
255
|
* @property {IconDefinitionMatch[]} data.matches - At most 10, best first.
|
|
251
256
|
* @property {string | null} data.newDefinition - The command that adds the set's own definition, when no match fits.
|
|
257
|
+
* @property {string} [data.variant] - When the set already has an icon for the export's glyph from another export of the library: the command that adds this export as that icon's variant.
|
|
252
258
|
*/
|
|
253
259
|
|
|
254
260
|
/**
|
|
@@ -293,7 +299,7 @@
|
|
|
293
299
|
* @property {string} [from] - A module whose every icon component the set wraps: a package, a package subpath, or a ./ path in the package.
|
|
294
300
|
* @property {string[] | string} [exclude] - With `from`: export names that are not icons; a string is split on commas.
|
|
295
301
|
* @property {string[] | string} [variants] - The variants the set supplies, such as `outline,solid`; a string is split on commas.
|
|
296
|
-
* @property {string} [defaultVariant] - With `variants`: the variant each icon's own export draws; the first variant
|
|
302
|
+
* @property {string} [defaultVariant] - With `variants`: the variant each icon's own export draws; when absent, the look the icons' exports draw in a library whose names encode looks; otherwise the set's current default, else, on a set without icons, the first variant. A set with icons changes it only with `from`, and only in a library whose names encode looks.
|
|
297
303
|
* @property {string} [displayName] - The descriptor's display name; the set name in title case when absent.
|
|
298
304
|
* @property {string} [description] - The descriptor's one-line description; `<Display name> icons.` when absent.
|
|
299
305
|
*/
|
|
@@ -324,10 +330,14 @@
|
|
|
324
330
|
* @property {string} [from]
|
|
325
331
|
* @property {number} [icons] - With `from`: how many icons it wrote.
|
|
326
332
|
* @property {boolean} [refreshed] - With `from` on an existing set: the set was refreshed, not created.
|
|
333
|
+
* @property {boolean} [updated] - Without `from` on an existing set: its variants, default variant, display name, or description were updated in place, not created.
|
|
334
|
+
* @property {Array<{id: string, from: string, to: string}>} [moved] - On a refresh from a package root: the icons that read one file of that package (`from`) and now import from the root (`to`); each keeps its id, export, `map` entries, variants, and words.
|
|
335
|
+
* @property {{library: string, path: string}} [licenseNoticeMissing] - With `from`: the wrapped library (`name@version`) ships no license file to copy and the set has none. `path` is where to add a NOTICE file that names the library and its license; the CLI never writes it.
|
|
327
336
|
* @property {Array<{from: string, to: string}>} [renamed] - On a refresh: the icons whose id this release's id rule changes, matched by the export the library still has; each keeps its `map` entries, variants, and words.
|
|
328
337
|
* @property {Array<{definition: string, icon: string}>} [mapped] - With `from`: the `map` entries an icon with the definition's exact name gives (on a refresh, every such entry, kept or new); check each.
|
|
329
338
|
* @property {Array<{definition: string, icon: string, word: string}>} [suggestions] - With `from`: for each unmapped Astryx definition, up to three icons it might map to, best first: the definition's name in another spelling or as another name of an icon, ids that start with it, an id or another name that is one of its words, then two-word ids that are a one-word word sized, shaped, or numbered (`grid-2x2`); never a negated form, the opposite direction, or an icon already mapped. `word` is the name or word that matched. Never written.
|
|
330
339
|
* @property {string[]} [notes] - What the author does next, including each change the package needs that the CLI never makes itself (its entry, peers, scripts), as text to copy.
|
|
340
|
+
* @property {{previous: string, module: string}} [moduleUpdate] - On a refresh, an update, or a new definition with `icon`: the data file's `module` before and after this command, when the package was renamed and the command writes its new name.
|
|
331
341
|
*/
|
|
332
342
|
|
|
333
343
|
/**
|
package/api/icon/iconAdd.doc.mjs
CHANGED
|
@@ -53,7 +53,7 @@ export const doc = {
|
|
|
53
53
|
name: 'options.newDefinition',
|
|
54
54
|
type: 'string',
|
|
55
55
|
description:
|
|
56
|
-
"Add the set's own definition with this name, then map the icon to it.",
|
|
56
|
+
"Add the set's own definition with this name, in camelCase (`aiHelper`) or kebab-case (`ai-helper`), then map the icon to it.",
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
name: 'options.description',
|
|
@@ -119,7 +119,7 @@ export const doc = {
|
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
code: 'ERR_INVALID_ARGUMENT',
|
|
122
|
-
when:
|
|
122
|
+
when: "the export is data rather than a component, a new definition is named like an Astryx one, or the variant is not one the set declares, is the look each icon's own export already draws, or is no look word of a library whose export names encode looks, or `id` starts with a digit",
|
|
123
123
|
},
|
|
124
124
|
{code: 'ERR_FILE_EXISTS', when: 'another icon already has the id'},
|
|
125
125
|
{
|
|
@@ -19,7 +19,8 @@ export const doc = {
|
|
|
19
19
|
{
|
|
20
20
|
name: 'name',
|
|
21
21
|
type: 'string',
|
|
22
|
-
description:
|
|
22
|
+
description:
|
|
23
|
+
'The definition name, in camelCase (`rocketLaunch`) or kebab-case (`rocket-launch`); it is written in camelCase.',
|
|
23
24
|
required: true,
|
|
24
25
|
},
|
|
25
26
|
{
|
|
@@ -66,7 +67,7 @@ export const doc = {
|
|
|
66
67
|
throws: [
|
|
67
68
|
{
|
|
68
69
|
code: 'ERR_INVALID_ARGUMENT',
|
|
69
|
-
when: 'the name is
|
|
70
|
+
when: 'the name is neither camelCase nor kebab-case, or Astryx already has it',
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
code: 'ERR_MISSING_ARGUMENT',
|
|
@@ -10,7 +10,7 @@ export const doc = {
|
|
|
10
10
|
displayName: 'iconNewSet()',
|
|
11
11
|
summary: 'Add an icon set to an integration package.',
|
|
12
12
|
description:
|
|
13
|
-
"Creates an integration manifest when the package has none, writes the set directory with its strongly typed same-stem IconSetDoc and a starter data file (schemaVersion 1, module set to the package name, no icons and an empty map yet), and the set's generated module with its declaration file and an empty themeIcons theme map; with from, it wraps a library's icons into them, records the installed library and version as the data file's source, copies the library's license notices into the set, uses the library's license, maps each Astryx definition whose name is an icon id, and returns up to three likely icons for each other definition as suggestions (by its name, its words, and the other names the library gives an icon; never a part of a word, a negated form, or the opposite direction), never written. It declares the manifest's `experimental.iconSets` root on first use, and includes the manifest and root in package.json files when the package already uses an allowlist. It never writes the package's entry, exports, main, types, files list, peers, or scripts: its notes name each change the package needs as text to copy. Every path is confined to the package and existing
|
|
13
|
+
"Creates an integration manifest when the package has none, writes the set directory with its strongly typed same-stem IconSetDoc and a starter data file (schemaVersion 1, module set to the package name, no icons and an empty map yet), and the set's generated module with its declaration file and an empty themeIcons theme map; with from, it wraps a library's icons into them, records the installed library and version as the data file's source, copies the library's license notices into the set, uses the library's license, maps each Astryx definition whose name is an icon id, and returns up to three likely icons for each other definition as suggestions (by its name, its words, and the other names the library gives an icon; never a part of a word, a negated form, or the opposite direction), never written. A library whose export names end in style, size and weight words gives one icon per glyph, named without those words, in the look the default variant names, else the library's usual default (outline, regular, the middle weight). Over an existing set, `from` refreshes it; without `from`, `variants`, `defaultVariant`, `displayName` and `description` update it in place and leave its icons, map and generated module unchanged (a variant an icon has must stay declared, and a set with icons keeps its default variant). It declares the manifest's `experimental.iconSets` root on first use, and includes the manifest and root in package.json files when the package already uses an allowlist. It never writes the package's entry, exports, main, types, files list, peers, or scripts: its notes name each change the package needs as text to copy. Every path is confined to the package, and an existing set is changed only as above. Experimental: it may change or be removed in a patch release.",
|
|
14
14
|
importPath: '@astryxdesign/cli/api',
|
|
15
15
|
signature:
|
|
16
16
|
'iconNewSet(name: string, options?: IconNewSetOptions): Promise<IconNewSetResponse>',
|
|
@@ -56,7 +56,7 @@ export const doc = {
|
|
|
56
56
|
name: 'options.defaultVariant',
|
|
57
57
|
type: 'string',
|
|
58
58
|
description:
|
|
59
|
-
"With variants: the variant each icon's own export draws, written to the data file's default; the first variant when
|
|
59
|
+
"With variants: the variant each icon's own export draws, written to the data file's default. In a library whose export names encode looks, it must be one of the library's look words, and when absent it is the look the icons' exports draw (with from and no icons yet, the library's usual default), which variants must list. Otherwise, when absent, an existing set keeps its default while variants declares it; a set without icons takes the first variant, and a set with icons and none declared needs it. Without from, a set with icons refuses a default other than the look they draw; when its icons' export names name no looks, it refuses one other than its declared default with from too.",
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
name: 'options.displayName',
|
|
@@ -81,11 +81,11 @@ export const doc = {
|
|
|
81
81
|
throws: [
|
|
82
82
|
{
|
|
83
83
|
code: 'ERR_INVALID_ARGUMENT',
|
|
84
|
-
when: 'the name is not lowercase kebab-case, package.json has no name, or a variant name or the default variant is invalid',
|
|
84
|
+
when: 'the name is not lowercase kebab-case, package.json has no name, or a variant name or the default variant is invalid; the default variant is no look word of a library whose export names encode looks; or the default variant would change on a set that has icons: without `from` (wrap the library again with `from` and `defaultVariant`), or with or without it when the export names of its icons name no looks (add the look as a variant instead)',
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
code: 'ERR_INVALID_OPTION',
|
|
88
|
-
when: '`exclude` is given without `from`, or `defaultVariant` without `variants`',
|
|
88
|
+
when: '`exclude` is given without `from`, or `defaultVariant` without `variants`; `variants` leave out the default variant: the look the icons draw in a library whose export names encode looks, or the declared default of a set with icons whose export names name no looks; or such a set declares no default and `defaultVariant` names none',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
code: 'ERR_FILE_EXISTS',
|
package/api/icon/map/map.mjs
CHANGED
|
@@ -77,7 +77,8 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
77
77
|
ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
|
-
const {packageDir, set} =
|
|
80
|
+
const {packageDir, set, moduleRenamed, moduleUpdate} =
|
|
81
|
+
await findLocalIconSet(cwd, selector);
|
|
81
82
|
// The docs' kebab id (`eye-slash`) names the same definition, and a
|
|
82
83
|
// library's other name for an icon (`trash-2`) names the same icon.
|
|
83
84
|
definition = definitionNameOf(definition, mappableDefinitions(set));
|
|
@@ -112,7 +113,8 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
112
113
|
}
|
|
113
114
|
map[definition] = /** @type {string} */ (icon);
|
|
114
115
|
}
|
|
115
|
-
const changed =
|
|
116
|
+
const changed =
|
|
117
|
+
(remove ? previous != null : previous !== icon) || moduleRenamed;
|
|
116
118
|
/** @type {string[]} */
|
|
117
119
|
const files = [];
|
|
118
120
|
if (changed) {
|
|
@@ -139,6 +141,7 @@ export async function iconMap(definition, icon, options = {}) {
|
|
|
139
141
|
icon: remove ? null : /** @type {string} */ (icon),
|
|
140
142
|
previous,
|
|
141
143
|
changed,
|
|
144
|
+
...(moduleUpdate ? {moduleUpdate} : {}),
|
|
142
145
|
...(files.length > 0 ? {files} : {}),
|
|
143
146
|
},
|
|
144
147
|
};
|
|
@@ -161,7 +164,10 @@ async function mapMany({cwd, selector, pairs}) {
|
|
|
161
164
|
ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
162
165
|
);
|
|
163
166
|
}
|
|
164
|
-
const {packageDir, set} = await findLocalIconSet(
|
|
167
|
+
const {packageDir, set, moduleRenamed, moduleUpdate} = await findLocalIconSet(
|
|
168
|
+
cwd,
|
|
169
|
+
selector,
|
|
170
|
+
);
|
|
165
171
|
const known = mappableDefinitions(set);
|
|
166
172
|
const ids = set.data.icons.map(each => each.id);
|
|
167
173
|
const map = {...(set.data.map ?? {})};
|
|
@@ -204,7 +210,7 @@ async function mapMany({cwd, selector, pairs}) {
|
|
|
204
210
|
changed: previous !== id,
|
|
205
211
|
});
|
|
206
212
|
}
|
|
207
|
-
const changed = entries.some(each => each.changed);
|
|
213
|
+
const changed = entries.some(each => each.changed) || moduleRenamed;
|
|
208
214
|
/** @type {string[]} */
|
|
209
215
|
const files = [];
|
|
210
216
|
if (changed) {
|
|
@@ -228,6 +234,7 @@ async function mapMany({cwd, selector, pairs}) {
|
|
|
228
234
|
file: path.relative(packageDir, set.dataPath).split(path.sep).join('/'),
|
|
229
235
|
entries,
|
|
230
236
|
changed,
|
|
237
|
+
...(moduleUpdate ? {moduleUpdate} : {}),
|
|
231
238
|
...(files.length > 0 ? {files} : {}),
|
|
232
239
|
},
|
|
233
240
|
};
|
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
import {AstryxError} from '../../error.mjs';
|
|
13
13
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
14
14
|
import {loadIconSets} from '../_adapter.mjs';
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
import {
|
|
16
|
+
answeringMatches,
|
|
17
|
+
rankIcons,
|
|
18
|
+
setsNamed,
|
|
19
|
+
unusableSet,
|
|
20
|
+
} from '../_records.mjs';
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Every icon of one set, by id: `--set <name> --all-icons`, so an author can read
|
|
@@ -75,11 +77,10 @@ export async function iconSearch(query, {cwd, set, limit}) {
|
|
|
75
77
|
if (searched.length === 0) throw unusableSet(sets, withdrawn, set);
|
|
76
78
|
}
|
|
77
79
|
const ranked = rankIcons(searched, query);
|
|
78
|
-
// A
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
: ranked;
|
|
80
|
+
// A word start (`start` for `star`) answers only when nothing matches a
|
|
81
|
+
// whole word, and a partial match (`pin` inside `shopping`) only when
|
|
82
|
+
// nothing matches a whole word or a word start.
|
|
83
|
+
const matches = answeringMatches(ranked);
|
|
83
84
|
return {
|
|
84
85
|
type: 'icon.search',
|
|
85
86
|
data: {
|
package/api/index.d.mts
CHANGED
|
@@ -47,6 +47,7 @@ export * from "./integration/authoring-checks.type.mjs";
|
|
|
47
47
|
export * from "./integration/integration-check.type.mjs";
|
|
48
48
|
export type Logger = import("./logger.mjs").Logger;
|
|
49
49
|
export { themeBuild, themeAdd, themeRemove, themeUse, themeEject, themeTemplate, themeList, themeListAvailable, themeListCopySources, themeTargets, themePaletteGenerate, generateTonalPalette, listThemes } from "./theme/theme.mjs";
|
|
50
|
+
export { exportSearchIndex, rankSearchIndex } from "./search/search-index.mjs";
|
|
50
51
|
export { integrationAdd, integrationAddAgentDoc, integrationAddCodemod, integrationAddComponent, integrationAddDoc, integrationAddTemplate } from "./integration/add-contribution.mjs";
|
|
51
52
|
export { validateIntegration, summarizeIssues } from "./integration/validate-integration.mjs";
|
|
52
53
|
export { integrationTemplateConflicts, integrationComponentConflicts, integrationDocConflicts } from "./integration/authoring-checks.mjs";
|
package/api/index.mjs
CHANGED
|
@@ -48,6 +48,7 @@ export {
|
|
|
48
48
|
} from './theme/theme.mjs';
|
|
49
49
|
export {hook} from './hook/hook.mjs';
|
|
50
50
|
export {search} from './search/search.mjs';
|
|
51
|
+
export {exportSearchIndex, rankSearchIndex} from './search/search-index.mjs';
|
|
51
52
|
export {build} from './build/build.mjs';
|
|
52
53
|
export {swizzle} from './swizzle/swizzle.mjs';
|
|
53
54
|
export {gapReport} from './gap-report/gap-report.mjs';
|
|
@@ -92,7 +92,7 @@ export function loadCurrentManifest(manifestFile: string, manifestExists: boolea
|
|
|
92
92
|
* @param {string} manifestPath
|
|
93
93
|
* @param {string[]} files
|
|
94
94
|
* @param {boolean} dryRun
|
|
95
|
-
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, renamed?: Array<{from: string, to: string}>, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[]}}}
|
|
95
|
+
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, updated?: boolean, renamed?: Array<{from: string, to: string}>, moved?: Array<{id: string, from: string, to: string}>, licenseNoticeMissing?: {library: string, path: string}, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[], moduleUpdate?: {previous: string, module: string}}}}
|
|
96
96
|
*/
|
|
97
97
|
export function receipt<K extends import("./integration-authoring.type.mjs").IntegrationAddData["kind"] | import("../icon/icon.type.mjs").IconNewData["kind"]>(kind: K, name: string, root: {
|
|
98
98
|
path: string;
|
|
@@ -103,10 +103,20 @@ export function receipt<K extends import("./integration-authoring.type.mjs").Int
|
|
|
103
103
|
kind: K;
|
|
104
104
|
icons?: number;
|
|
105
105
|
refreshed?: boolean;
|
|
106
|
+
updated?: boolean;
|
|
106
107
|
renamed?: Array<{
|
|
107
108
|
from: string;
|
|
108
109
|
to: string;
|
|
109
110
|
}>;
|
|
111
|
+
moved?: Array<{
|
|
112
|
+
id: string;
|
|
113
|
+
from: string;
|
|
114
|
+
to: string;
|
|
115
|
+
}>;
|
|
116
|
+
licenseNoticeMissing?: {
|
|
117
|
+
library: string;
|
|
118
|
+
path: string;
|
|
119
|
+
};
|
|
110
120
|
mapped?: Array<{
|
|
111
121
|
definition: string;
|
|
112
122
|
icon: string;
|
|
@@ -117,6 +127,10 @@ export function receipt<K extends import("./integration-authoring.type.mjs").Int
|
|
|
117
127
|
word: string;
|
|
118
128
|
}>;
|
|
119
129
|
notes?: string[];
|
|
130
|
+
moduleUpdate?: {
|
|
131
|
+
previous: string;
|
|
132
|
+
module: string;
|
|
133
|
+
};
|
|
120
134
|
};
|
|
121
135
|
};
|
|
122
136
|
/** @param {string} slug */
|
|
@@ -131,7 +131,10 @@ export function packageJsonFilesUpdate(
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
if (
|
|
134
|
+
if (
|
|
135
|
+
(pkg.exports !== undefined || createExports) &&
|
|
136
|
+
publicExports.length > 0
|
|
137
|
+
) {
|
|
135
138
|
const authored = pkg.exports;
|
|
136
139
|
/** @type {Record<string, unknown>} */
|
|
137
140
|
let exportsMap;
|
|
@@ -483,7 +486,7 @@ export async function loadCurrentManifest(manifestFile, manifestExists) {
|
|
|
483
486
|
* @param {string} manifestPath
|
|
484
487
|
* @param {string[]} files
|
|
485
488
|
* @param {boolean} dryRun
|
|
486
|
-
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, renamed?: Array<{from: string, to: string}>, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[]}}}
|
|
489
|
+
* @returns {{type: 'integration.add', data: Omit<import('./integration-authoring.type.mjs').IntegrationAddData, 'kind'> & {kind: K, icons?: number, refreshed?: boolean, updated?: boolean, renamed?: Array<{from: string, to: string}>, moved?: Array<{id: string, from: string, to: string}>, licenseNoticeMissing?: {library: string, path: string}, mapped?: Array<{definition: string, icon: string}>, suggestions?: Array<{definition: string, icon: string, word: string}>, notes?: string[], moduleUpdate?: {previous: string, module: string}}}}
|
|
487
490
|
*/
|
|
488
491
|
export function receipt(kind, name, root, manifestPath, files, dryRun) {
|
|
489
492
|
return {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/** @param {string} value */
|
|
5
|
-
export function shellArg(value: string): string;
|
|
6
4
|
/**
|
|
7
5
|
* Find integration template ids that are also owned by Core.
|
|
8
6
|
* @param {string} [pkg] Installed integration package; omit for the local package.
|
|
@@ -57,12 +57,7 @@ import {
|
|
|
57
57
|
} from './validate-integration.mjs';
|
|
58
58
|
import {rootProblem} from '../../foundation/integrations/validate-contributions.mjs';
|
|
59
59
|
import {normalizeProviderId} from '../../foundation/identity/provider-identity.mjs';
|
|
60
|
-
|
|
61
|
-
/** @param {string} value */
|
|
62
|
-
export function shellArg(value) {
|
|
63
|
-
if (/^[A-Za-z0-9@/._-]+$/.test(value)) return value;
|
|
64
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
65
|
-
}
|
|
60
|
+
import {shellArg} from '../../foundation/text/shell-arg.mjs';
|
|
66
61
|
|
|
67
62
|
/**
|
|
68
63
|
* The provider ID a package without a name is checked under: a valid bare
|
package/api/logger.mjs
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file The one `Logger`. Source of truth: the `Logger` type is generated from
|
|
5
5
|
* the JSDoc here, and `logger` is the single instance every side-effecting
|
|
6
|
-
* command (`upgrade`, `init`, `themeBuild
|
|
6
|
+
* command (`upgrade`, `init`, `themeBuild`, the experimental icon commands)
|
|
7
|
+
* writes progress through.
|
|
7
8
|
*
|
|
8
9
|
* It is silent by default, so a programmatic caller (or `--json` mode) sees
|
|
9
10
|
* nothing but the returned `{type, data}`. The CLI calls `logger.setSilent(false)`
|
package/api/render/_adapter.mjs
CHANGED
|
@@ -548,6 +548,15 @@ export function reverseToFile({cwd, input, output, overwrite}) {
|
|
|
548
548
|
...(missing.length > 0 ? {missing} : {}),
|
|
549
549
|
};
|
|
550
550
|
}
|
|
551
|
+
// A file a render wrote, whose source block was taken out on the way
|
|
552
|
+
// (sanitizers and editors strip <script> elements), says so.
|
|
553
|
+
if (!isAstryxMarkup(html) && /<meta name="generator" content="Astryx[ "]/.test(html)) {
|
|
554
|
+
throw new AstryxError(
|
|
555
|
+
`${shown(cwd, input)} was rendered by Astryx, but its embedded source was removed (a sanitizer or an editor strips <script> blocks) and it has no Astryx components to rebuild from; nothing was written. Render the page again from its source and send the new file as is.`,
|
|
556
|
+
[],
|
|
557
|
+
ERROR_CODES.ERR_RENDER_SOURCE_DAMAGED,
|
|
558
|
+
);
|
|
559
|
+
}
|
|
551
560
|
if (!isAstryxMarkup(html)) {
|
|
552
561
|
throw new AstryxError(
|
|
553
562
|
`${shown(cwd, input)} is not an Astryx page: it has no embedded source and no Astryx components to rebuild from. To start an Astryx page like it, run astryx build "<what the page is>".`,
|
|
@@ -96,12 +96,12 @@ export const doc = {
|
|
|
96
96
|
{code: 'ERR_RENDER_BROWSER_API', when: 'the page reads a browser-only API, such as window or document, while rendering'},
|
|
97
97
|
{code: 'ERR_RENDER_ASSET_TOO_LARGE', when: 'a local file the page uses is over 8 MB'},
|
|
98
98
|
{code: 'ERR_RENDER_TIMEOUT', when: 'the page does not finish rendering within 60 seconds'},
|
|
99
|
-
{code: 'ERR_RENDER_FAILED', when: 'the page throws while rendering for any other reason'},
|
|
99
|
+
{code: 'ERR_RENDER_FAILED', when: 'the page throws while rendering for any other reason, or Node itself crashes (a crash signal, or a crash status on Windows) or is stopped by a signal while it renders the page (the message names the Node version and path)'},
|
|
100
100
|
{
|
|
101
101
|
code: 'ERR_RENDER_NOT_ASTRYX',
|
|
102
|
-
when: 'reversing a file with no embedded source and no Astryx markup; the suggestion is `astryx build "<what the page is>"`',
|
|
102
|
+
when: 'reversing a file a render did not write, with no embedded source and no Astryx markup; the suggestion is `astryx build "<what the page is>"`',
|
|
103
103
|
},
|
|
104
|
-
{code: 'ERR_RENDER_SOURCE_DAMAGED', when: 'reversing a file whose embedded source is damaged, lists a path twice, carries a module, stylesheet or JSON file the page does not reach through its imports, or an image, font or media file whose bytes are not one, or carries a file a render never embeds (a dotfile or dot-folder, `node_modules`, a package manifest, lockfile or tool configuration, or any kind but a page module, stylesheet, JSON or image)'},
|
|
104
|
+
{code: 'ERR_RENDER_SOURCE_DAMAGED', when: 'reversing a file a render wrote whose embedded source was removed (and that has no Astryx components to rebuild from), a file whose embedded source is damaged, lists a path twice, carries a module, stylesheet or JSON file the page does not reach through its imports, or an image, font or media file whose bytes are not one, or carries a file a render never embeds (a dotfile or dot-folder, `node_modules`, a package manifest, lockfile or tool configuration, or any kind but a page module, stylesheet, JSON or image)'},
|
|
105
105
|
{code: 'ERR_PATH_TRAVERSAL', when: 'a file would be written outside the current folder (symlinks followed), or through a symbolic link: `out`, or with `reverse` the page or an embedded file; or, with `reverse`, a file other than the page would go into a folder that already exists'},
|
|
106
106
|
],
|
|
107
107
|
examples: [
|
|
@@ -31,7 +31,7 @@ export type RenderWarning = {
|
|
|
31
31
|
/**
|
|
32
32
|
* - What kind of problem.
|
|
33
33
|
*/
|
|
34
|
-
code: "dropped-children" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "not-embedded";
|
|
34
|
+
code: "dropped-children" | "remote-asset" | "missing-asset" | "page-output" | "page-script" | "no-astryx-styles" | "chart-size" | "not-embedded" | "node-crash";
|
|
35
35
|
/**
|
|
36
36
|
* - What happened and what to do, in one sentence.
|
|
37
37
|
*/
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* author meant.
|
|
23
23
|
* @experimental May change or be removed in a patch release.
|
|
24
24
|
* @typedef {object} RenderWarning
|
|
25
|
-
* @property {'dropped-children' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'not-embedded'} code - What kind of problem.
|
|
25
|
+
* @property {'dropped-children' | 'remote-asset' | 'missing-asset' | 'page-output' | 'page-script' | 'no-astryx-styles' | 'chart-size' | 'not-embedded' | 'node-crash'} code - What kind of problem.
|
|
26
26
|
* @property {string} message - What happened and what to do, in one sentence.
|
|
27
27
|
*/
|
|
28
28
|
|
package/api/search/ORDERING.md
CHANGED
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
`spec:AST-083` owns search's result order; this file describes the data that implements it. Inside one score band, a searcher's static weights decide the order. Matches with the same score move together as one block, placed by the learned position of the block's first match: moving each one on its own breaks search's existing rules for tied matches. Inside a block, the lexical ranker's order holds, except below the first result: there a block of one domain puts a part of the first result first (its name words start with the first result's; at most two parts lead across an answer), then the match whose matched words are rarer in the catalog. Matches never cross bands or kinds. There is no model runtime: every number is a plain static value read at load time.
|
|
8
8
|
|
|
9
|
+
After that order, one fit pass reads the first ten results (`_fit-order.mjs`). The first result stays. The others split into runs of one band and kind. Inside a run, each match gets a fit to the whole query from build's block-picker match (`../build/blocks/blocks.mjs` with `blocks.weights.json`) over the match's own docs: its name words, display name or title, description, and keywords. A match whose fit is under 1.7 times the run's median fit moves, in order, after the others in its run, unless its name spells two or more of the query's words. Such a match never moves down; it can still move up when others move after it. A run whose median fit is zero or less keeps its order. A query that is an entry's whole name skips the pass, as it skips the learned order. The pass always reads ten places before the limit cuts the answer. At the default limit, and at any limit of 10 or more, the set of results stays the same. A smaller limit shows the top of the new order, so it can show a different result. Build's loader (`loadBlockPicker` in `../build/_adapter.mjs`) reads and checks the block-picker weights for both commands. When the file is missing, unreadable, or not the picker's shape, the loader returns null and the pass keeps the order. The pass reads the weights only when a run holds two or more matches, and it decodes only the matrix rows that the query's words and those matches' docs use, so a search does not pay for the whole catalog.
|
|
10
|
+
|
|
9
11
|
## Files
|
|
10
12
|
|
|
11
13
|
| File | What it holds |
|
|
12
14
|
| ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
15
|
| `tree.weights.json` | The root classifier: for each query word or word pair, one number per class (component, hook, doc, template, theme, none). The query's tokens vote, and a topic searcher takes the query only when its class wins by the floor in `tree.mjs`. |
|
|
14
16
|
| `_main-searcher.weights.json`, `_doc-searcher.weights.json`, `_template-searcher.weights.json` | One weight, mean and spread per signal for each searcher (see `SIGNALS` and `PER_DOMAIN` in `_features.mjs`). A match's place inside its band is the weighted sum of its standardized signals. |
|
|
17
|
+
| `../build/blocks/blocks.weights.json` | The block picker's vocabulary, idf and two projection matrices, shared with build. The fit pass reads them through build's loader; search ships no copy. |
|
|
15
18
|
| `_cards.json` | One card per Core component and hook: what it is, the words people use for it, and its main props, written from the item's own source. Cards feed one signal, word overlap with the card. |
|
|
16
19
|
|
|
17
20
|
The signals are counts over the query and each entry's own text: the lexical score and rank, BM25 over the entry's name, docs text and card, how many query words the entry covers, whether the query holds the entry's name, and the classifier's guess of the domain.
|
|
@@ -16,7 +16,7 @@ export function requireSearchCoreDir(cwd: string): string;
|
|
|
16
16
|
* in the CLI's searches. A caller that runs its own operation shares it.
|
|
17
17
|
*
|
|
18
18
|
* @param {{cwd?: string, type?: string}} options
|
|
19
|
-
* @returns {Promise<{all: Candidate[], components: Candidate[], searchedComponents: boolean, outside: boolean, coreSkipped: string | null}>}
|
|
19
|
+
* @returns {Promise<{all: Candidate[], components: Candidate[], searchedComponents: boolean, outside: boolean, coreSkipped: string | null, coreSkippedCode: string | null}>}
|
|
20
20
|
*/
|
|
21
21
|
export function gatherCandidates(options: {
|
|
22
22
|
cwd?: string;
|
|
@@ -27,7 +27,28 @@ export function gatherCandidates(options: {
|
|
|
27
27
|
searchedComponents: boolean;
|
|
28
28
|
outside: boolean;
|
|
29
29
|
coreSkipped: string | null;
|
|
30
|
+
coreSkippedCode: string | null;
|
|
30
31
|
}>;
|
|
32
|
+
/**
|
|
33
|
+
* The Core a search of `type` reads, and the domains it gathers. `astryx docs`
|
|
34
|
+
* reads docs without @astryxdesign/core, and `astryx theme list` reads themes
|
|
35
|
+
* without it, so a docs or themes search never looks for Core. Every other
|
|
36
|
+
* domain reads Core: the project's, else the answering release's own,
|
|
37
|
+
* installed into the per-user cache on first need (spec AST-081 FR3). A Core
|
|
38
|
+
* domain asked for by name throws the lookup's coded error. An open search
|
|
39
|
+
* without Core gathers the docs and themes alone and records why in
|
|
40
|
+
* `coreSkipped`; it never fails silently.
|
|
41
|
+
* @param {string | undefined} type
|
|
42
|
+
* @param {(cwd: string) => string} lookup finds the Core folder, or throws
|
|
43
|
+
* @param {string} cwd
|
|
44
|
+
* @returns {{coreDir: string | null, coreSkipped: string | null, coreSkippedCode: string | null, wants: (domain: string) => boolean}}
|
|
45
|
+
*/
|
|
46
|
+
export function resolveSearchCore(type: string | undefined, lookup: (cwd: string) => string, cwd: string): {
|
|
47
|
+
coreDir: string | null;
|
|
48
|
+
coreSkipped: string | null;
|
|
49
|
+
coreSkippedCode: string | null;
|
|
50
|
+
wants: (domain: string) => boolean;
|
|
51
|
+
};
|
|
31
52
|
/**
|
|
32
53
|
* gatherCandidates, reused within one process: a later search in the same
|
|
33
54
|
* folder, for the same `type`, ranks the candidates an earlier search
|
|
@@ -46,8 +67,10 @@ export function gatherCandidatesReused(options: {
|
|
|
46
67
|
type?: string;
|
|
47
68
|
}): Promise<Gathered>;
|
|
48
69
|
/**
|
|
49
|
-
* The search tree's static data, read once: the entry cards
|
|
50
|
-
* weights file.
|
|
70
|
+
* The search tree's static data, read once: the entry cards, each node's
|
|
71
|
+
* weights file, and build's block-picker weights for the fit pass. Build's
|
|
72
|
+
* loader (loadBlockPicker) reads and checks the picker weights, only when the
|
|
73
|
+
* pass first needs them.
|
|
51
74
|
*
|
|
52
75
|
* These files are static, reviewed data that only order matches inside a score
|
|
53
76
|
* band; ORDERING.md beside them says what each holds and how
|
|
@@ -89,6 +112,12 @@ export type SearchData = {
|
|
|
89
112
|
* The template searcher's weights.
|
|
90
113
|
*/
|
|
91
114
|
template: SearcherWeights;
|
|
115
|
+
/**
|
|
116
|
+
* Build's block-picker weights, which the fit pass (_fit-order.mjs) reads;
|
|
117
|
+
* null when build's loader finds the file absent, unreadable, or the wrong
|
|
118
|
+
* shape.
|
|
119
|
+
*/
|
|
120
|
+
picker: import("../build/blocks/blocks.mjs").BlockPickerWeights | null;
|
|
92
121
|
};
|
|
93
122
|
export type SearchCatalog = Awaited<ReturnType<typeof gatherCandidates>> & {
|
|
94
123
|
data: SearchData;
|