@astryxdesign/cli 0.7.17 → 0.7.18-canary.g1f336a6
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/README.md +1 -1
- package/api/discover/_adapter.d.mts +7 -5
- package/api/discover/_adapter.mjs +12 -11
- package/api/docs/_adapter.d.mts +19 -2
- package/api/docs/_adapter.mjs +66 -5
- package/api/doctor/_adapter.d.mts +11 -62
- package/api/doctor/_adapter.mjs +242 -472
- package/api/doctor/doctor.d.mts +1 -1
- package/api/doctor/doctor.mjs +3 -3
- package/api/doctor/theme-checks.mjs +37 -45
- package/api/error.d.mts +21 -0
- package/api/error.mjs +89 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/icon/_adapter.d.mts +8 -0
- package/api/icon/_adapter.mjs +17 -0
- package/api/icon/_authoring.mjs +6 -6
- package/api/icon/_default-look.mjs +16 -16
- package/api/icon/add/add.mjs +3 -3
- package/api/icon/exportIconIndex.doc.mjs +2 -2
- package/api/icon/icon.doc.mjs +2 -2
- package/api/icon/icon.type.d.mts +4 -0
- package/api/icon/icon.type.mjs +2 -1
- package/api/icon/search/icon-index.mjs +16 -3
- package/api/icon/search/search.d.mts +15 -5
- package/api/icon/search/search.mjs +74 -16
- package/api/icon/use/use.mjs +4 -4
- package/api/integration/pack-check.d.mts +2 -2
- package/api/integration/pack-check.mjs +2 -2
- package/api/render/_adapter.mjs +233 -40
- package/api/render/render.type.d.mts +1 -1
- package/api/render/render.type.mjs +1 -1
- package/api/search/ORDERING.md +2 -2
- package/api/search/_adapter.mjs +4 -0
- package/api/search/_candidate-score.mjs +32 -8
- package/api/search/_cards.json +1 -1
- package/api/search/_compound.d.mts +0 -1
- package/api/search/_compound.mjs +93 -2
- package/api/search/_icons.d.mts +4 -2
- package/api/search/_icons.mjs +4 -2
- package/api/search/_lexical.mjs +177 -17
- package/api/search/_order.d.mts +3 -1
- package/api/search/_order.mjs +16 -5
- package/api/search/_result.d.mts +9 -0
- package/api/search/_result.mjs +10 -0
- package/api/search/_score.mjs +21 -3
- package/api/swizzle/_moduleGraph.d.mts +8 -0
- package/api/swizzle/_moduleGraph.mjs +61 -3
- package/api/template/copy/copy.mjs +5 -3
- package/api/template/template.type.d.mts +3 -3
- package/api/template/template.type.mjs +3 -3
- package/api/theme/_adapter.mjs +48 -12
- package/api/theme/build/build.d.mts +9 -5
- package/api/theme/build/build.mjs +76 -29
- package/api/theme/build/style-keys.mjs +4 -5
- package/api/theme/build/theme-object.mjs +5 -0
- package/api/theme/palette/generate/color.d.mts +47 -0
- package/api/theme/palette/generate/color.mjs +58 -1
- package/api/theme/palette/generate/derive-look.d.mts +293 -0
- package/api/theme/palette/generate/derive-look.mjs +1362 -0
- package/api/theme/palette/generate/editor-look.d.mts +62 -0
- package/api/theme/palette/generate/editor-look.mjs +550 -0
- package/api/theme/palette/generate/mapping.d.mts +94 -9
- package/api/theme/palette/generate/mapping.mjs +94 -22
- package/api/theme-edit/_adapter.mjs +13 -2
- package/api/theme-edit/_catalog.d.mts +13 -13
- package/api/theme-edit/_catalog.mjs +66 -28
- package/api/theme-edit/_check.d.mts +82 -6
- package/api/theme-edit/_check.mjs +1270 -238
- package/api/theme-edit/_color.d.mts +74 -0
- package/api/theme-edit/_color.mjs +168 -3
- package/api/theme-edit/_compiler.d.mts +3 -5
- package/api/theme-edit/_compiler.mjs +122 -23
- package/api/theme-edit/_context.d.mts +55 -12
- package/api/theme-edit/_context.mjs +114 -60
- package/api/theme-edit/_css.d.mts +11 -0
- package/api/theme-edit/_css.mjs +40 -0
- package/api/theme-edit/_edit.d.mts +15 -2
- package/api/theme-edit/_edit.mjs +1469 -133
- package/api/theme-edit/_how-commands.d.mts +116 -0
- package/api/theme-edit/_how-commands.mjs +227 -115
- package/api/theme-edit/_how-question.d.mts +74 -29
- package/api/theme-edit/_how-question.mjs +8514 -1256
- package/api/theme-edit/_how-sides.d.mts +22 -0
- package/api/theme-edit/_how-sides.mjs +173 -0
- package/api/theme-edit/_how-steps.d.mts +42 -0
- package/api/theme-edit/_how-steps.mjs +208 -0
- package/api/theme-edit/_how-values.d.mts +29 -0
- package/api/theme-edit/_how-values.mjs +111 -0
- package/api/theme-edit/_how-words.d.mts +15 -0
- package/api/theme-edit/_how-words.mjs +239 -0
- package/api/theme-edit/_how.d.mts +1 -1
- package/api/theme-edit/_how.mjs +422 -37
- package/api/theme-edit/_missed.d.mts +2 -1
- package/api/theme-edit/_missed.mjs +125 -13
- package/api/theme-edit/_normal.d.mts +5 -3
- package/api/theme-edit/_normal.mjs +54 -14
- package/api/theme-edit/_palette.d.mts +204 -4
- package/api/theme-edit/_palette.mjs +901 -25
- package/api/theme-edit/_part-pieces.d.mts +54 -0
- package/api/theme-edit/_part-pieces.mjs +179 -0
- package/api/theme-edit/_part-words.mjs +33 -5
- package/api/theme-edit/_parts.d.mts +133 -0
- package/api/theme-edit/_parts.mjs +599 -10
- package/api/theme-edit/_picture-traits.d.mts +259 -0
- package/api/theme-edit/_picture-traits.mjs +1030 -0
- package/api/theme-edit/_preview.d.mts +95 -4
- package/api/theme-edit/_preview.mjs +284 -31
- package/api/theme-edit/_project.d.mts +14 -4
- package/api/theme-edit/_project.mjs +95 -26
- package/api/theme-edit/_resolved.d.mts +46 -0
- package/api/theme-edit/_resolved.mjs +800 -0
- package/api/theme-edit/_set-line.d.mts +29 -0
- package/api/theme-edit/_set-line.mjs +100 -0
- package/api/theme-edit/_settings.d.mts +625 -28
- package/api/theme-edit/_settings.mjs +4867 -888
- package/api/theme-edit/_tables.d.mts +25 -1
- package/api/theme-edit/_tables.mjs +115 -11
- package/api/theme-edit/_text-looks.d.mts +78 -0
- package/api/theme-edit/_text-looks.mjs +376 -0
- package/api/theme-edit/_vet.d.mts +3 -26
- package/api/theme-edit/_vet.mjs +5 -89
- package/api/theme-edit/how/how.d.mts +1 -1
- package/api/theme-edit/how/how.mjs +1 -1
- package/api/theme-edit/show/show.d.mts +4 -3
- package/api/theme-edit/show/show.mjs +3 -2
- package/api/theme-edit/theme-edit.type.d.mts +117 -1
- package/api/theme-edit/theme-edit.type.mjs +46 -3
- package/api/theme-edit/themeEditHow.doc.mjs +3 -3
- package/api/theme-edit/themeEditNew.doc.mjs +4 -0
- package/api/theme-edit/themeEditSet.doc.mjs +6 -2
- package/api/theme-edit/themeEditShow.doc.mjs +22 -3
- package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/author-a-theme.doc.mjs +7 -4
- package/assets/docs/icons.doc.mjs +7 -6
- package/assets/docs/theme.doc.dense.mjs +10 -0
- package/assets/docs/theme.doc.mjs +10 -0
- package/assets/docs/theme.doc.zh.mjs +10 -0
- package/assets/docs/tree/export-pages.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +89 -17
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/definitions/article.doc.mjs +9 -0
- package/assets/icons/template-icons.json +5 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
- package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +9 -1
- package/assets/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonShowcase.doc.mjs +9 -2
- package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.doc.mjs +3 -2
- package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -1
- package/assets/templates/blocks/components/SideNavItem/SideNavItemShowcase.doc.mjs +3 -2
- package/assets/templates/blocks/components/SideNavSection/SideNavSectionShowcase.doc.mjs +2 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ide/page.tsx +5 -10
- package/assets/templates/pages/payment-form/page.tsx +16 -60
- package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
- package/authoring/config/parse.mjs +1 -1
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/doctypes/_schema.d.mts +13 -13
- package/authoring/doctypes/icon-definition/parse.mjs +2 -2
- package/authoring/doctypes/icon-set/parse.mjs +1 -1
- package/authoring/doctypes/template/parse.mjs +1 -4
- package/authoring/gap-report/parse.d.mts +1 -1
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/ensure-core-built.mjs +17 -10
- package/clients/cli/commands/experimental/icon.mjs +7 -7
- package/clients/cli/commands/experimental/theme.mjs +175 -13
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +15 -5
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/hook.mjs +7 -0
- package/clients/cli/commands/template.mjs +1 -1
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/index.mjs +6 -2
- package/clients/cli/lib/hook-format.mjs +41 -1
- package/clients/cli/lib/json-shim.mjs +34 -14
- package/clients/cli/lib/other-cli-words.mjs +7 -0
- package/clients/cli/lib/unknown-command.mjs +345 -46
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +11 -2
- package/foundation/agent-docs/agent-docs.mjs +51 -8
- package/foundation/config/project.d.mts +11 -1
- package/foundation/config/project.mjs +11 -2
- package/foundation/discovery/component-replacement.d.mts +5 -8
- package/foundation/discovery/component-replacement.mjs +12 -14
- package/foundation/discovery/core-augmentation-points.d.mts +35 -0
- package/foundation/discovery/core-augmentation-points.mjs +410 -9
- package/foundation/discovery/core-elements.d.mts +6 -0
- package/foundation/discovery/core-elements.mjs +10 -2
- package/foundation/discovery/core-prop-types.d.mts +5 -0
- package/foundation/discovery/core-prop-types.mjs +10 -3
- package/foundation/discovery/core-props.d.mts +8 -0
- package/foundation/discovery/core-props.mjs +29 -13
- package/foundation/discovery/icon-ranking.d.mts +5 -2
- package/foundation/discovery/icon-ranking.mjs +101 -18
- package/foundation/discovery/icon-set-checks.mjs +1 -1
- package/foundation/discovery/icon-set-writer.mjs +1 -1
- package/foundation/discovery/official-list.d.mts +17 -0
- package/foundation/discovery/official-list.mjs +77 -0
- package/foundation/discovery/template-icon-notes.mjs +3 -3
- package/foundation/discovery/template-icons.mjs +2 -2
- package/foundation/discovery/template-placeholders.mjs +1 -1
- package/foundation/discovery/unknown-core-props.d.mts +130 -0
- package/foundation/discovery/unknown-core-props.mjs +601 -0
- package/foundation/discovery/written-prop-values.d.mts +35 -0
- package/foundation/discovery/written-prop-values.mjs +258 -0
- package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
- package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
- package/foundation/fs/package-name.d.mts +10 -0
- package/foundation/fs/package-name.mjs +37 -0
- package/foundation/fs/project-source-files.d.mts +27 -0
- package/foundation/fs/project-source-files.mjs +115 -0
- package/foundation/fs/project-sources.d.mts +25 -0
- package/foundation/fs/project-sources.mjs +83 -0
- package/foundation/fs/read-record.d.mts +18 -0
- package/foundation/fs/read-record.mjs +36 -2
- package/foundation/integrations/integration-warnings.d.mts +39 -7
- package/foundation/integrations/integration-warnings.mjs +141 -19
- package/foundation/integrations/missing-dependency.d.mts +11 -0
- package/foundation/integrations/missing-dependency.mjs +20 -5
- package/foundation/release/folder-lock.d.mts +5 -2
- package/foundation/release/folder-lock.mjs +9 -3
- package/foundation/release/notices.mjs +2 -8
- package/foundation/render/cut-short.d.mts +8 -2
- package/foundation/render/cut-short.mjs +50 -5
- package/foundation/render/drawn-contrast.d.mts +40 -0
- package/foundation/render/drawn-contrast.mjs +355 -0
- package/foundation/render/file-header.mjs +4 -0
- package/foundation/render/layers.d.mts +2 -1
- package/foundation/render/layers.mjs +22 -1
- package/foundation/render/package-resolve-hooks.d.mts +38 -9
- package/foundation/render/package-resolve-hooks.mjs +124 -32
- package/foundation/render/page-worker.mjs +95 -23
- package/foundation/render/part-boxes.d.mts +27 -0
- package/foundation/render/part-boxes.mjs +45 -0
- package/foundation/render/picture-chrome.mjs +36 -4
- package/foundation/render/picture-playwright.mjs +26 -2
- package/foundation/render/picture-window.d.mts +29 -2
- package/foundation/render/picture-window.mjs +99 -1
- package/foundation/render/render-page.d.mts +39 -6
- package/foundation/render/render-page.mjs +26 -10
- package/foundation/render/ts-paths.mjs +2 -1
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/error-codes.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +9 -5
- package/foundation/suggest/other-command.mjs +25 -1
- package/foundation/text/icon-set-next.d.mts +1 -1
- package/foundation/text/icon-set-next.mjs +2 -2
- package/foundation/text/written-string.d.mts +4 -1
- package/foundation/text/written-string.mjs +4 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -234,7 +234,7 @@ if (isError(result)) {
|
|
|
234
234
|
| `ERR_PALETTE_GENERATION` | A palette generation request or one of its constraints was invalid. |
|
|
235
235
|
| `ERR_VERSION_DETECT` | The current `@astryxdesign/core` version could not be detected. |
|
|
236
236
|
| `ERR_INVALID_VERSION` | A `--from`/`--to` value was not a valid semver string. |
|
|
237
|
-
| `ERR_DEP_MISSING` | A required external dependency (e.g. jscodeshift) is missing.
|
|
237
|
+
| `ERR_DEP_MISSING` | A required external dependency (e.g. jscodeshift) is missing, or an installed package needs a package it declares that is not installed (a broken install; installing again repairs it). |
|
|
238
238
|
| `ERR_GH_CLI` | GitHub CLI (`gh`) is not installed or not authenticated. |
|
|
239
239
|
| `ERR_UNKNOWN_POST` | No blog post matched the requested slug in the feed. |
|
|
240
240
|
| `ERR_FETCH_FAILED` | A network fetch (RSS feed or post text) failed. |
|
|
@@ -191,13 +191,15 @@ export function officialFirst<T>(items: T[], official: OfficialPackage[], nameOf
|
|
|
191
191
|
* own version when the project has no Core. It is not listed beside a
|
|
192
192
|
* released or declared Core, which it cannot be installed with.
|
|
193
193
|
*
|
|
194
|
-
* @param {{file?: string, version?: string, project?: Project}} [options] the
|
|
194
|
+
* @param {{file?: string, root?: string, version?: string, project?: Project}} [options] the
|
|
195
195
|
* list file and the CLI version to read it for, both defaulting to this
|
|
196
|
-
* CLI's own
|
|
196
|
+
* CLI's own; the repository a checkout derives its own list from
|
|
197
|
+
* ({@link readOfficialList}); and the project whose Core decides the versions
|
|
197
198
|
* @returns {OfficialList}
|
|
198
199
|
*/
|
|
199
|
-
export function officialList({ file, version, project, }?: {
|
|
200
|
+
export function officialList({ file, root, version, project, }?: {
|
|
200
201
|
file?: string;
|
|
202
|
+
root?: string;
|
|
201
203
|
version?: string;
|
|
202
204
|
project?: Project;
|
|
203
205
|
}): OfficialList;
|
|
@@ -278,8 +280,7 @@ export function iconSetCoverage(definitions: string[]): {
|
|
|
278
280
|
};
|
|
279
281
|
/** The name the official list goes by, as a source and on each of its entries. */
|
|
280
282
|
export const OFFICIAL_SOURCE_NAME: "Astryx";
|
|
281
|
-
|
|
282
|
-
export const OFFICIAL_LIST_FILE: string;
|
|
283
|
+
export { OFFICIAL_LIST_FILE };
|
|
283
284
|
/**
|
|
284
285
|
* The experimental item kinds a catalog may list (spec:AST-017 FR27):
|
|
285
286
|
* `icon-set`, read only where the icon feature gate is on.
|
|
@@ -404,3 +405,4 @@ export type ComponentResolution = {
|
|
|
404
405
|
};
|
|
405
406
|
import { Project } from '../../foundation/config/project.mjs';
|
|
406
407
|
import { AstryxError } from '../error.mjs';
|
|
408
|
+
import { OFFICIAL_LIST_FILE } from '../../foundation/discovery/official-list.mjs';
|
|
@@ -56,6 +56,10 @@ import {
|
|
|
56
56
|
parseDiscoverCatalog,
|
|
57
57
|
} from '../../authoring/discover/parse.mjs';
|
|
58
58
|
import {AstryxError} from '../error.mjs';
|
|
59
|
+
import {
|
|
60
|
+
OFFICIAL_LIST_FILE,
|
|
61
|
+
readOfficialList,
|
|
62
|
+
} from '../../foundation/discovery/official-list.mjs';
|
|
59
63
|
import {CORE_PACKAGE_NAME} from '../../foundation/release/project.mjs';
|
|
60
64
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
61
65
|
import {installGuidanceFor} from '../../foundation/env/cli-command.mjs';
|
|
@@ -68,13 +72,7 @@ export const OFFICIAL_SOURCE_NAME = 'Astryx';
|
|
|
68
72
|
/** Where the official list comes from: the CLI package that carries it. */
|
|
69
73
|
const OFFICIAL_SOURCE_FROM = '@astryxdesign/cli';
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
export const OFFICIAL_LIST_FILE = path.join(
|
|
73
|
-
CLI_ROOT,
|
|
74
|
-
'assets',
|
|
75
|
-
'discover',
|
|
76
|
-
'official-packages.json',
|
|
77
|
-
);
|
|
75
|
+
export {OFFICIAL_LIST_FILE};
|
|
78
76
|
|
|
79
77
|
const DEPENDENCY_FIELDS = [
|
|
80
78
|
'dependencies',
|
|
@@ -302,7 +300,8 @@ async function describeInstalledFresh(project, scanned) {
|
|
|
302
300
|
const docs = await projectDocs(project);
|
|
303
301
|
// The skills its docs declare, as the docs tree and the skill places keep
|
|
304
302
|
// them.
|
|
305
|
-
let declaredSkills =
|
|
303
|
+
let declaredSkills =
|
|
304
|
+
/** @type {Array<{name: string, package: string}>} */ ([]);
|
|
306
305
|
try {
|
|
307
306
|
declaredSkills = (await projectIntegrationSkills(project.cwd)).skills;
|
|
308
307
|
} catch {
|
|
@@ -1145,13 +1144,15 @@ export function officialFirst(items, official, nameOf) {
|
|
|
1145
1144
|
* own version when the project has no Core. It is not listed beside a
|
|
1146
1145
|
* released or declared Core, which it cannot be installed with.
|
|
1147
1146
|
*
|
|
1148
|
-
* @param {{file?: string, version?: string, project?: Project}} [options] the
|
|
1147
|
+
* @param {{file?: string, root?: string, version?: string, project?: Project}} [options] the
|
|
1149
1148
|
* list file and the CLI version to read it for, both defaulting to this
|
|
1150
|
-
* CLI's own
|
|
1149
|
+
* CLI's own; the repository a checkout derives its own list from
|
|
1150
|
+
* ({@link readOfficialList}); and the project whose Core decides the versions
|
|
1151
1151
|
* @returns {OfficialList}
|
|
1152
1152
|
*/
|
|
1153
1153
|
export function officialList({
|
|
1154
1154
|
file = OFFICIAL_LIST_FILE,
|
|
1155
|
+
root,
|
|
1155
1156
|
version,
|
|
1156
1157
|
project,
|
|
1157
1158
|
} = {}) {
|
|
@@ -1159,7 +1160,7 @@ export function officialList({
|
|
|
1159
1160
|
const cli = version ?? packageVersion(CLI_ROOT);
|
|
1160
1161
|
if (cli == null) throw new Error('the CLI package names no version');
|
|
1161
1162
|
const core = project == null ? null : projectCore(project);
|
|
1162
|
-
const list =
|
|
1163
|
+
const list = readOfficialList({file, root});
|
|
1163
1164
|
const canaryCli = /-canary\./u.test(cli);
|
|
1164
1165
|
/** @type {(v: string | undefined) => v is string} */
|
|
1165
1166
|
const isRelease = v => v != null && !v.includes('-');
|
package/api/docs/_adapter.d.mts
CHANGED
|
@@ -464,12 +464,29 @@ export function packageDocSections(catalog: DocsCatalog, tree: DocsTree, owner:
|
|
|
464
464
|
* @returns {TreeNode | null}
|
|
465
465
|
*/
|
|
466
466
|
export function routeOwner(tree: DocsTree, entry: import("../../foundation/discovery/docs-discovery.mjs").DocsTopicEntry): TreeNode | null;
|
|
467
|
+
/**
|
|
468
|
+
* A namespace's ordered children with the page further down placed as
|
|
469
|
+
* spec:AST-046 FR6 says: right after the child that route words alone put
|
|
470
|
+
* first, when the typed text names that child, and first otherwise. A page
|
|
471
|
+
* that is that child is listed once, first.
|
|
472
|
+
* @template {{name: string}} T
|
|
473
|
+
* @param {string} topic
|
|
474
|
+
* @param {T[]} byRoute the children as route words order them
|
|
475
|
+
* @param {T[]} ordered the children as {@link namedFirst} orders them
|
|
476
|
+
* @param {T[]} deeper the page further down ({@link pageBelow}), or none
|
|
477
|
+
* @returns {T[]}
|
|
478
|
+
*/
|
|
479
|
+
export function withPageBelow<T extends {
|
|
480
|
+
name: string;
|
|
481
|
+
}>(topic: string, byRoute: T[], ordered: T[], deeper: T[]): T[];
|
|
467
482
|
/**
|
|
468
483
|
* The error for a docs argument that names nothing. For a route, it suggests
|
|
469
484
|
* every child of the deepest namespace the route reaches, closest first by
|
|
470
485
|
* each child's route, title and keywords, with a child the route names kept
|
|
471
|
-
* first
|
|
472
|
-
*
|
|
486
|
+
* first; the one page further down that the rest of the route names
|
|
487
|
+
* ({@link pageBelow}) comes right after that child, or first. Otherwise it
|
|
488
|
+
* suggests the docs whose own name it is, or whose route it spells with
|
|
489
|
+
* hyphens; failing that, the topics and top-level namespaces,
|
|
473
490
|
* closest first and cut where the matches get weaker (every one of them when
|
|
474
491
|
* none shares a word with the argument, with the names a slip or two from it
|
|
475
492
|
* first). When the argument matches a component, hook or template
|
package/api/docs/_adapter.mjs
CHANGED
|
@@ -2457,12 +2457,64 @@ function fewerWordMatches(topic, everyDoc, byWords, taken) {
|
|
|
2457
2457
|
);
|
|
2458
2458
|
}
|
|
2459
2459
|
|
|
2460
|
+
/**
|
|
2461
|
+
* The one page below `route`, at any depth, whose last route segment or
|
|
2462
|
+
* title has the words of `rest` (nameWords): `authoring/define-the-theme`
|
|
2463
|
+
* finds `authoring/building-blocks/themes/define-the-theme`. None when no page or more than one has them.
|
|
2464
|
+
* An experimental page is never found.
|
|
2465
|
+
* @param {DocsTree} tree
|
|
2466
|
+
* @param {string} route
|
|
2467
|
+
* @param {string} rest the typed segments after `route`
|
|
2468
|
+
* @returns {Array<{name: string, reason: string}>}
|
|
2469
|
+
*/
|
|
2470
|
+
function pageBelow(tree, route, rest) {
|
|
2471
|
+
const words = nameWords(rest).join(' ');
|
|
2472
|
+
if (words === '') return [];
|
|
2473
|
+
const found = [...tree.nodes.values()].filter(
|
|
2474
|
+
node =>
|
|
2475
|
+
node.route.startsWith(`${route}/`) &&
|
|
2476
|
+
[node.route.slice(node.route.lastIndexOf('/') + 1), node.title].some(
|
|
2477
|
+
name => name != null && nameWords(name).join(' ') === words,
|
|
2478
|
+
) &&
|
|
2479
|
+
!isExperimentalTreeNode(tree, node),
|
|
2480
|
+
);
|
|
2481
|
+
return found.length === 1
|
|
2482
|
+
? [{name: found[0].route, reason: found[0].summary}]
|
|
2483
|
+
: [];
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
/**
|
|
2487
|
+
* A namespace's ordered children with the page further down placed as
|
|
2488
|
+
* spec:AST-046 FR6 says: right after the child that route words alone put
|
|
2489
|
+
* first, when the typed text names that child, and first otherwise. A page
|
|
2490
|
+
* that is that child is listed once, first.
|
|
2491
|
+
* @template {{name: string}} T
|
|
2492
|
+
* @param {string} topic
|
|
2493
|
+
* @param {T[]} byRoute the children as route words order them
|
|
2494
|
+
* @param {T[]} ordered the children as {@link namedFirst} orders them
|
|
2495
|
+
* @param {T[]} deeper the page further down ({@link pageBelow}), or none
|
|
2496
|
+
* @returns {T[]}
|
|
2497
|
+
*/
|
|
2498
|
+
export function withPageBelow(topic, byRoute, ordered, deeper) {
|
|
2499
|
+
const kept = namesRoute(topic, byRoute[0]?.name ?? '') ? 1 : 0;
|
|
2500
|
+
const lead = ordered.slice(0, kept);
|
|
2501
|
+
const below = deeper.filter(
|
|
2502
|
+
page => !lead.some(entry => entry.name === page.name),
|
|
2503
|
+
);
|
|
2504
|
+
const rest = ordered
|
|
2505
|
+
.slice(kept)
|
|
2506
|
+
.filter(entry => !below.some(page => page.name === entry.name));
|
|
2507
|
+
return [...lead, ...below, ...rest];
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2460
2510
|
/**
|
|
2461
2511
|
* The error for a docs argument that names nothing. For a route, it suggests
|
|
2462
2512
|
* every child of the deepest namespace the route reaches, closest first by
|
|
2463
2513
|
* each child's route, title and keywords, with a child the route names kept
|
|
2464
|
-
* first
|
|
2465
|
-
*
|
|
2514
|
+
* first; the one page further down that the rest of the route names
|
|
2515
|
+
* ({@link pageBelow}) comes right after that child, or first. Otherwise it
|
|
2516
|
+
* suggests the docs whose own name it is, or whose route it spells with
|
|
2517
|
+
* hyphens; failing that, the topics and top-level namespaces,
|
|
2466
2518
|
* closest first and cut where the matches get weaker (every one of them when
|
|
2467
2519
|
* none shares a word with the argument, with the names a slip or two from it
|
|
2468
2520
|
* first). When the argument matches a component, hook or template
|
|
@@ -2485,6 +2537,8 @@ export async function unknownTopicError(topic, catalog, {cwd} = {}) {
|
|
|
2485
2537
|
let suggestions = [];
|
|
2486
2538
|
// Route children stay whole (spec:AST-046); only the other lists are cut.
|
|
2487
2539
|
let routeChildren = false;
|
|
2540
|
+
/** @type {Array<{name: string, reason: string}>} */
|
|
2541
|
+
let deeper = [];
|
|
2488
2542
|
if (typeof topic === 'string' && topic.includes('/')) {
|
|
2489
2543
|
const parts = topic.split('/');
|
|
2490
2544
|
for (
|
|
@@ -2495,6 +2549,7 @@ export async function unknownTopicError(topic, catalog, {cwd} = {}) {
|
|
|
2495
2549
|
const near = tree.get(parts.slice(0, depth).join('/'));
|
|
2496
2550
|
if (near) {
|
|
2497
2551
|
routeChildren = true;
|
|
2552
|
+
deeper = pageBelow(tree, near.route, parts.slice(depth).join('/'));
|
|
2498
2553
|
suggestions = near.slots.flatMap(slot =>
|
|
2499
2554
|
slot.children.map(route => ({
|
|
2500
2555
|
name: route,
|
|
@@ -2529,10 +2584,16 @@ export async function unknownTopicError(topic, catalog, {cwd} = {}) {
|
|
|
2529
2584
|
];
|
|
2530
2585
|
}
|
|
2531
2586
|
if (typeof topic === 'string' && routeChildren) {
|
|
2532
|
-
|
|
2587
|
+
const byRoute = orderRouteSuggestions(topic, suggestions, {closest: false});
|
|
2588
|
+
suggestions = withPageBelow(
|
|
2533
2589
|
topic,
|
|
2534
|
-
|
|
2535
|
-
|
|
2590
|
+
byRoute,
|
|
2591
|
+
namedFirst(
|
|
2592
|
+
topic,
|
|
2593
|
+
byRoute,
|
|
2594
|
+
orderDocPages(tree, topic, suggestions, false),
|
|
2595
|
+
),
|
|
2596
|
+
deeper,
|
|
2536
2597
|
);
|
|
2537
2598
|
} else if (typeof topic === 'string') {
|
|
2538
2599
|
// Every topic and namespace is listed, so a near name (`tokns` for
|
|
@@ -34,25 +34,6 @@ export function themeRecordOwner(theme: import("../../foundation/discovery/theme
|
|
|
34
34
|
export function readTextFile(file: string): string;
|
|
35
35
|
/** @param {string} file */
|
|
36
36
|
export function readTextFileIfExists(file: string): string | null;
|
|
37
|
-
/**
|
|
38
|
-
* A bounded app-source walk that excludes dependencies, generated output, and
|
|
39
|
-
* links. The doctor parses the returned bytes without executing app code.
|
|
40
|
-
* @param {string} root
|
|
41
|
-
* @param {string} generatedModule
|
|
42
|
-
* @param {{stylesheets?: boolean, pages?: boolean, markup?: boolean, outputAtRootsOnly?: boolean, skippedLinks?: string[]}} [options] - also list
|
|
43
|
-
* `.css` files, `.html` pages, and `.mdx` and `.astro` pages; with
|
|
44
|
-
* `outputAtRootsOnly`, skip a `build`, `dist` or `coverage` folder only in
|
|
45
|
-
* a folder with a package.json, where a build writes its output, and read
|
|
46
|
-
* one anywhere else (an app route named `build`); `skippedLinks` collects
|
|
47
|
-
* each linked folder or source file the walk does not follow
|
|
48
|
-
*/
|
|
49
|
-
export function listProjectSourceFiles(root: string, generatedModule: string, options?: {
|
|
50
|
-
stylesheets?: boolean;
|
|
51
|
-
pages?: boolean;
|
|
52
|
-
markup?: boolean;
|
|
53
|
-
outputAtRootsOnly?: boolean;
|
|
54
|
-
skippedLinks?: string[];
|
|
55
|
-
}): string[];
|
|
56
37
|
/**
|
|
57
38
|
* Each file in the project's own source that still uses the placeholder
|
|
58
39
|
* component the CLI writes for a missing icon: the file, the component's
|
|
@@ -84,38 +65,20 @@ export function findButtonsWithoutAction(projectDir: string): {
|
|
|
84
65
|
incomplete: boolean;
|
|
85
66
|
domListener?: string;
|
|
86
67
|
};
|
|
87
|
-
/**
|
|
88
|
-
* @typedef {object} UnknownCoreProp
|
|
89
|
-
* @property {string} file relative to the project, with `/`
|
|
90
|
-
* @property {number} line
|
|
91
|
-
* @property {number} column
|
|
92
|
-
* @property {string} component
|
|
93
|
-
* @property {string} prop
|
|
94
|
-
* @property {string | null} suggestion a documented prop with the same
|
|
95
|
-
* words, when there is one
|
|
96
|
-
*/
|
|
97
68
|
/**
|
|
98
69
|
* The props the project's own source gives Core components that the
|
|
99
|
-
* component does not take
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* it on to the element it renders, and neither is a prop JSX gives every
|
|
107
|
-
* component. A component with no docs, one TypeScript cannot read, a generic
|
|
108
|
-
* one, and a module that compiles its JSX with another runtime are not
|
|
109
|
-
* judged. Test, story and fixture files are not read. Each page is judged
|
|
110
|
-
* with the config TypeScript reads for it. `skipped` says why nothing was
|
|
111
|
-
* checked: no TypeScript, a config that compiles JSX with another runtime, or
|
|
112
|
-
* more source files than doctor reads, whatever the pages hold; or, for a
|
|
113
|
-
* prop the docs leave out, types or augmentations it could not read.
|
|
70
|
+
* component does not take, judged by `judgeCoreProps`. Test, story and
|
|
71
|
+
* fixture files are not read, and neither is a module that compiles its JSX
|
|
72
|
+
* with another runtime (a pragma). `skipped` says why nothing was checked:
|
|
73
|
+
* no TypeScript, more source files than doctor reads, pages that find no
|
|
74
|
+
* installed Core, or a config or build on another JSX runtime, whatever the
|
|
75
|
+
* pages hold; or, for a prop the docs leave out, the reason `judgeCoreProps`
|
|
76
|
+
* gives.
|
|
114
77
|
* @param {string} projectDir
|
|
115
|
-
* @returns {Promise<{found: UnknownCoreProp[], uses: number, skipped: string | null}>}
|
|
78
|
+
* @returns {Promise<{found: import('../../foundation/discovery/unknown-core-props.mjs').UnknownCoreProp[], uses: number, skipped: string | null}>}
|
|
116
79
|
*/
|
|
117
80
|
export function findUnknownCoreProps(projectDir: string): Promise<{
|
|
118
|
-
found: UnknownCoreProp[];
|
|
81
|
+
found: import("../../foundation/discovery/unknown-core-props.mjs").UnknownCoreProp[];
|
|
119
82
|
uses: number;
|
|
120
83
|
skipped: string | null;
|
|
121
84
|
}>;
|
|
@@ -542,26 +505,10 @@ export namespace BUTTON_ACTIONS_CODEC {
|
|
|
542
505
|
export function valid_2(value: any): any;
|
|
543
506
|
export { valid_2 as valid };
|
|
544
507
|
}
|
|
545
|
-
export const SOURCE_EXTENSIONS: Set<string>;
|
|
546
508
|
export { displayHomePath };
|
|
547
509
|
/** `doctor --built` reads at most this many files, of at most this size. */
|
|
548
510
|
export const BUILT_FILE_LIMIT: 20000;
|
|
549
511
|
export const BUILT_FILE_MAX_MB: 5;
|
|
550
|
-
export type UnknownCoreProp = {
|
|
551
|
-
/**
|
|
552
|
-
* relative to the project, with `/`
|
|
553
|
-
*/
|
|
554
|
-
file: string;
|
|
555
|
-
line: number;
|
|
556
|
-
column: number;
|
|
557
|
-
component: string;
|
|
558
|
-
prop: string;
|
|
559
|
-
/**
|
|
560
|
-
* a documented prop with the same
|
|
561
|
-
* words, when there is one
|
|
562
|
-
*/
|
|
563
|
-
suggestion: string | null;
|
|
564
|
-
};
|
|
565
512
|
/**
|
|
566
513
|
* What doctor reads about the project's skill places.
|
|
567
514
|
*/
|
|
@@ -627,6 +574,8 @@ import { lastNoticeSkip } from '../../foundation/release/notices.mjs';
|
|
|
627
574
|
import { lastCheckFailure } from '../../foundation/release/global-state.mjs';
|
|
628
575
|
import { stateLockHolder } from '../../foundation/release/global-state.mjs';
|
|
629
576
|
import { displayHomePath } from '../../foundation/agent-docs/computer-agent-text.mjs';
|
|
577
|
+
export { listProjectSourceFiles, SOURCE_EXTENSIONS } from "../../foundation/fs/project-source-files.mjs";
|
|
578
|
+
export { projectImportsModule, specifierTargets } from "../../foundation/fs/project-sources.mjs";
|
|
630
579
|
export { iconUseCommand, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
|
|
631
580
|
export { isLocalThemeOwner, planThemeAppWrite, readThemeState, resolveThemeModule } from "../../foundation/config/theme-state.mjs";
|
|
632
581
|
export { fileMark, generatedSourceCommand, isPrivateVarRefusal, missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
|