@astryxdesign/cli 0.6.3-canary.db4e378 → 0.6.3-canary.dea6813
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 +57 -57
- package/api/component/component.doc.mjs +1 -1
- package/api/component/component.mjs +3 -3
- package/api/component/component.type.d.mts +4 -5
- package/api/component/component.type.mjs +4 -5
- package/api/component/detail/blocks/blocks.d.mts +1 -2
- package/api/component/detail/blocks/blocks.mjs +3 -4
- package/api/component/list/list.d.mts +5 -0
- package/api/component/list/list.mjs +9 -37
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +165 -86
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +210 -72
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +115 -83
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +186 -57
- package/clients/cli/commands/component-package.test.mjs +0 -28
- package/foundation/response/response-types.doc.mjs +7 -7
- package/package.json +9 -9
- package/assets/codemods/transform-prop.mjs +0 -109
- package/assets/codemods/transform-prop.test.mjs +0 -95
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +0 -14
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +0 -61
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +0 -14
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +0 -126
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +0 -15
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +0 -86
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +0 -14
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +0 -99
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +0 -14
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +0 -122
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +0 -14
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +0 -95
- package/foundation/response/response-types.doc.test.mjs +0 -158
package/README.md
CHANGED
|
@@ -397,63 +397,63 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
397
397
|
|
|
398
398
|
<!-- BEGIN GENERATED: response-types -->
|
|
399
399
|
|
|
400
|
-
| Type | What `data` carries
|
|
401
|
-
| --------------------------------- |
|
|
402
|
-
| `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted.
|
|
403
|
-
| `init.remove` | Confirmation that the managed agent-docs block was removed (`data.removed: true`) — returned when --remove-agents is set.
|
|
404
|
-
| `component.list` | The component catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries, or a full ComponentDoc per entry.
|
|
405
|
-
| `component.detail` | One component's authored ComponentDoc plus ownership
|
|
406
|
-
| `component.detail.props` | Just one component's props table (ComponentPropDoc[]).
|
|
407
|
-
| `component.detail.source` | One component's source file, as {component, source}.
|
|
408
|
-
| `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}.
|
|
409
|
-
| `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry.
|
|
410
|
-
| `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description}), in discovery order.
|
|
411
|
-
| `docs.detail` | One topic's full ReferenceDoc, with token-ref blocks inlined.
|
|
412
|
-
| `docs.index` | One topic's section index (--index):
|
|
413
|
-
| `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined.
|
|
414
|
-
| `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL.
|
|
415
|
-
| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body.
|
|
416
|
-
| `discover.list` | The configured external packages (name, category, components, version, description); when empty it carries meta.configured to tell "nothing configured" from "nothing discovered".
|
|
417
|
-
| `discover.detail` | A single external package entry, for an @scope/name query.
|
|
418
|
-
| `discover.detail.doc` | The validated ComponentDoc for one external component: an @scope/name/Component query, or a free-text term resolving to exactly one component.
|
|
419
|
-
| `discover.search` | The echoed query plus the matching {package, component} pairs, when a free-text term matches several components.
|
|
420
|
-
| `search` | The echoed query, `matchCount` (total
|
|
421
|
-
| `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation.
|
|
422
|
-
| `build.kit` | The composition kit: echoed query, hasResults
|
|
423
|
-
| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core.
|
|
424
|
-
| `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and an optional maintainer note.
|
|
425
|
-
| `gap-report.categories` | The fixed gap category values and human-readable labels.
|
|
426
|
-
| `gap-report.file` | An aggregate receipt
|
|
427
|
-
| `template.list` | Every discovered template (page + block); each entry carries id, name, description, kind, owning package, optional category and componentsUsed, and readiness flags.
|
|
428
|
-
| `template.show` | The resolved template's raw source plus its description, kind, and the component names it composes.
|
|
429
|
-
| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes.
|
|
430
|
-
| `template.copy` | A scaffold receipt: template id, output directory, written file name, and file count.
|
|
431
|
-
| `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success.
|
|
432
|
-
| `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry.
|
|
433
|
-
| `hook.detail` | One hook's full authored HookDoc.
|
|
434
|
-
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]).
|
|
435
|
-
| `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load).
|
|
436
|
-
| `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing.
|
|
437
|
-
| `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS.
|
|
438
|
-
| `theme.list` | Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package.
|
|
439
|
-
| `theme.add` | A scaffold receipt: resolved slug, displayName, maintained flag, owner package, outputDir (relative to cwd), the theme entry file, its exportName, and the files written.
|
|
440
|
-
| `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success.
|
|
441
|
-
| `theme.targets` | The whole themeable surface: the echoed filter,
|
|
442
|
-
| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result.
|
|
443
|
-
| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything.
|
|
444
|
-
| `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary.
|
|
445
|
-
| `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, and (apply mode) filesChanged, transformsApplied, and per-codemod errors.
|
|
446
|
-
| `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index.
|
|
447
|
-
| `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and a fix when not passing) plus a `summary` of counts per status.
|
|
448
|
-
| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun.
|
|
449
|
-
| `integration.pack-check` | The packed-package check:
|
|
450
|
-
| `integration.validate` | The validation result: the package name and version (both null when no local manifest is found) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}.
|
|
451
|
-
| `integration.template-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration template id is also owned by Core; each conflict includes the exact package-qualified command.
|
|
452
|
-
| `integration.component-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command.
|
|
453
|
-
| `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps classified as intentional replacements, intentional extensions, or accidental same-name conflicts.
|
|
454
|
-
| `layout.expand` | The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, and written (the output path, or null when nothing was written).
|
|
455
|
-
| `layout.check` | The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline).
|
|
456
|
-
| `layout.grammar` | The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry.
|
|
400
|
+
| Type | What `data` carries |
|
|
401
|
+
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
402
|
+
| `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
|
|
403
|
+
| `init.remove` | Confirmation that the managed agent-docs block was removed (`data.removed: true`) — returned when --remove-agents is set. |
|
|
404
|
+
| `component.list` | The component catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries, or a full ComponentDoc per entry. |
|
|
405
|
+
| `component.detail` | One component's authored ComponentDoc plus ownership metadata (owner package, import specifier, and whether source is available). |
|
|
406
|
+
| `component.detail.props` | Just one component's props table (ComponentPropDoc[]). |
|
|
407
|
+
| `component.detail.source` | One component's source file, as {component, source}. |
|
|
408
|
+
| `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. |
|
|
409
|
+
| `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry. |
|
|
410
|
+
| `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description}), in discovery order. |
|
|
411
|
+
| `docs.detail` | One topic's full ReferenceDoc, with token-ref blocks inlined. |
|
|
412
|
+
| `docs.index` | One topic's section index (--index): each section's key, title, and one-line summary. |
|
|
413
|
+
| `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined. |
|
|
414
|
+
| `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
|
|
415
|
+
| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
|
|
416
|
+
| `discover.list` | The configured external packages (name, category, components, version, description); when empty it carries meta.configured to tell "nothing configured" from "nothing discovered". |
|
|
417
|
+
| `discover.detail` | A single external package entry, for an @scope/name query. |
|
|
418
|
+
| `discover.detail.doc` | The validated ComponentDoc for one external component: an @scope/name/Component query, or a free-text term resolving to exactly one component. |
|
|
419
|
+
| `discover.search` | The echoed query plus the matching {package, component} pairs, when a free-text term matches several components. |
|
|
420
|
+
| `search` | The echoed query, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit` (domain, name, score, reason, description, follow-up command, and import path where relevant). |
|
|
421
|
+
| `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |
|
|
422
|
+
| `build.kit` | The grouped composition kit: echoed query, hasResults/matchCount/directMatch fields (matchCount is the total matched, never a cap read back), the closest page templates, drop-in block patterns, idea-specific components/hooks, and the always-on frame + foundation component-name arrays. |
|
|
423
|
+
| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. |
|
|
424
|
+
| `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and an optional maintainer note. |
|
|
425
|
+
| `gap-report.categories` | The fixed gap category values and human-readable labels. |
|
|
426
|
+
| `gap-report.file` | An aggregate receipt with overall status, the selected package and issues URL, ordered per-handler deliveries, and filedCount/routedOnlyCount totals. |
|
|
427
|
+
| `template.list` | Every discovered template (page + block); each entry carries id, name, description, kind, owning package, optional category and componentsUsed, and readiness flags. |
|
|
428
|
+
| `template.show` | The resolved template's raw source plus its description, kind, and the component names it composes. |
|
|
429
|
+
| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. |
|
|
430
|
+
| `template.copy` | A scaffold receipt: template id, output directory, written file name, and file count. |
|
|
431
|
+
| `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
|
|
432
|
+
| `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. |
|
|
433
|
+
| `hook.detail` | One hook's full authored HookDoc. |
|
|
434
|
+
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). |
|
|
435
|
+
| `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
|
|
436
|
+
| `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
|
|
437
|
+
| `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
|
|
438
|
+
| `theme.list` | Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package. |
|
|
439
|
+
| `theme.add` | A scaffold receipt: resolved slug, displayName, maintained flag, owner package, outputDir (relative to cwd), the theme entry file, its exportName, and the files written. |
|
|
440
|
+
| `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
|
|
441
|
+
| `theme.targets` | The whole themeable surface: the echoed filter, the component count, and one entry per theming target — {key, className, component, props, states}, where props and states are its legal override keys. |
|
|
442
|
+
| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
|
|
443
|
+
| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. |
|
|
444
|
+
| `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
|
|
445
|
+
| `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
|
|
446
|
+
| `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |
|
|
447
|
+
| `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and a fix when not passing) plus a `summary` of counts per status. |
|
|
448
|
+
| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
|
|
449
|
+
| `integration.pack-check` | The packed-package check: package identity, tarball facts, local and packed contribution inventories, and issues. |
|
|
450
|
+
| `integration.validate` | The validation result: the package name and version (both null when no local manifest is found) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
|
|
451
|
+
| `integration.template-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration template id is also owned by Core; each conflict includes the exact package-qualified command. |
|
|
452
|
+
| `integration.component-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
|
|
453
|
+
| `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps classified as intentional replacements, intentional extensions, or accidental same-name conflicts. |
|
|
454
|
+
| `layout.expand` | The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, and written (the output path, or null when nothing was written). |
|
|
455
|
+
| `layout.check` | The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline). |
|
|
456
|
+
| `layout.grammar` | The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry. |
|
|
457
457
|
|
|
458
458
|
<!-- END GENERATED: response-types -->
|
|
459
459
|
<!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->
|
|
@@ -109,7 +109,7 @@ export const doc = {
|
|
|
109
109
|
{
|
|
110
110
|
type: 'component.list',
|
|
111
111
|
description:
|
|
112
|
-
"The catalog grouped by category. data.detail is the level ('names' | 'compact' | 'full') and data.components is the grouped map: names entries with name, package, and an optional canonical import for
|
|
112
|
+
"The catalog grouped by category. data.detail is the level ('names' | 'compact' | 'full') and data.components is the grouped map: names entries with name, package, and an optional canonical import for integrations; brief entries; or full ComponentDoc entries.",
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
type: 'component.detail',
|
|
@@ -165,7 +165,7 @@ export async function component(name, options = {}) {
|
|
|
165
165
|
: componentDetailShowcase(dirName, {cwd, name, resolve: false});
|
|
166
166
|
}
|
|
167
167
|
if (blocks) {
|
|
168
|
-
return componentDetailBlocks(dirName
|
|
168
|
+
return componentDetailBlocks(dirName);
|
|
169
169
|
}
|
|
170
170
|
const docs = await loadComponentDoc(owner.docPath, docOpts);
|
|
171
171
|
if (props) return componentDetailProps(docs);
|
|
@@ -183,7 +183,7 @@ export async function component(name, options = {}) {
|
|
|
183
183
|
return componentDetailSource(dirName, null, {name, notFoundInPackage: packageScope});
|
|
184
184
|
}
|
|
185
185
|
if (blocks) {
|
|
186
|
-
return componentDetailBlocks(dirName
|
|
186
|
+
return componentDetailBlocks(dirName);
|
|
187
187
|
}
|
|
188
188
|
const docs = await loadComponentDoc(extDocPath, docOpts);
|
|
189
189
|
if (props) return componentDetailProps(docs);
|
|
@@ -224,7 +224,7 @@ export async function component(name, options = {}) {
|
|
|
224
224
|
|
|
225
225
|
// ── Blocks mode ──────────────────────────────────────────────
|
|
226
226
|
if (blocks) {
|
|
227
|
-
return componentDetailBlocks(dirName
|
|
227
|
+
return componentDetailBlocks(dirName);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
// ── Sub-component scoping ────────────────────────────────────
|
|
@@ -31,10 +31,9 @@ export type ComponentListData = ({
|
|
|
31
31
|
/**
|
|
32
32
|
* A single entry in a `component.list` group at `detail: 'names'`. Pre-1.0 the
|
|
33
33
|
* list moved from bare strings to package-qualified objects so consumers can
|
|
34
|
-
* disambiguate ownership (core vs. an integration package). Integration
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* from the component name by the renderer).
|
|
34
|
+
* disambiguate ownership (core vs. an integration package). Integration entries
|
|
35
|
+
* carry `import` — the package-authored specifier; core entries omit it (the
|
|
36
|
+
* specifier is derived from the component name by the renderer).
|
|
38
37
|
*/
|
|
39
38
|
export type ComponentListEntry = {
|
|
40
39
|
name: string;
|
|
@@ -43,7 +42,7 @@ export type ComponentListEntry = {
|
|
|
43
42
|
*/
|
|
44
43
|
package: string;
|
|
45
44
|
/**
|
|
46
|
-
* - Import specifier; present for integration
|
|
45
|
+
* - Import specifier; present for integration components, absent for core.
|
|
47
46
|
*/
|
|
48
47
|
import?: string | undefined;
|
|
49
48
|
};
|
|
@@ -52,14 +52,13 @@
|
|
|
52
52
|
/**
|
|
53
53
|
* A single entry in a `component.list` group at `detail: 'names'`. Pre-1.0 the
|
|
54
54
|
* list moved from bare strings to package-qualified objects so consumers can
|
|
55
|
-
* disambiguate ownership (core vs. an integration package). Integration
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* from the component name by the renderer).
|
|
55
|
+
* disambiguate ownership (core vs. an integration package). Integration entries
|
|
56
|
+
* carry `import` — the package-authored specifier; core entries omit it (the
|
|
57
|
+
* specifier is derived from the component name by the renderer).
|
|
59
58
|
* @typedef {object} ComponentListEntry
|
|
60
59
|
* @property {string} name
|
|
61
60
|
* @property {string} package - Owner package, e.g. '@astryxdesign/core' or '@acme/astryx-meta'.
|
|
62
|
-
* @property {string} [import] - Import specifier; present for integration
|
|
61
|
+
* @property {string} [import] - Import specifier; present for integration components, absent for core.
|
|
63
62
|
*/
|
|
64
63
|
|
|
65
64
|
/**
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* envelope, splitting them into the hero showcase, component-specific examples,
|
|
7
7
|
* and broader related blocks.
|
|
8
8
|
* @param {string} componentName
|
|
9
|
-
* @param {string} cwd - project to discover blocks from; never the process cwd
|
|
10
9
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
|
|
11
10
|
*/
|
|
12
|
-
export function componentDetailBlocks(componentName: string
|
|
11
|
+
export function componentDetailBlocks(componentName: string): Promise<import("../../component.type.mjs").ComponentDetailBlocksResponse>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file `component.detail.blocks` leaf — a component's example/related blocks.
|
|
5
5
|
*
|
|
6
|
-
* @input a component name
|
|
6
|
+
* @input a component name
|
|
7
7
|
* @output the `component.detail.blocks` envelope (showcase, examples, related)
|
|
8
8
|
* @position api/component/detail/blocks (projection leaf; routed by component.mjs)
|
|
9
9
|
*/
|
|
@@ -16,11 +16,10 @@ import {findRelatedBlocks} from '../../../template/template.mjs';
|
|
|
16
16
|
* envelope, splitting them into the hero showcase, component-specific examples,
|
|
17
17
|
* and broader related blocks.
|
|
18
18
|
* @param {string} componentName
|
|
19
|
-
* @param {string} cwd - project to discover blocks from; never the process cwd
|
|
20
19
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
|
|
21
20
|
*/
|
|
22
|
-
export async function componentDetailBlocks(componentName
|
|
23
|
-
const allBlocks = await findRelatedBlocks(componentName
|
|
21
|
+
export async function componentDetailBlocks(componentName) {
|
|
22
|
+
const allBlocks = await findRelatedBlocks(componentName);
|
|
24
23
|
const toEntry = (/** @type {any} */ b) => ({
|
|
25
24
|
name: b.dirName,
|
|
26
25
|
displayName: b.name,
|
|
@@ -1,6 +1,11 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* @typedef {import('../component.type.mjs').ComponentListResponse} ComponentListResponse
|
|
6
|
+
* @typedef {import('../component.type.mjs').ComponentListEntry} ComponentListEntry
|
|
7
|
+
* @typedef {import('../component.type.mjs').ComponentBriefEntry} ComponentBriefEntry
|
|
8
|
+
*/
|
|
4
9
|
/**
|
|
5
10
|
* Build the `component.list` envelope. The list taxonomy is collapsed: all
|
|
6
11
|
* three detail levels emit ONE `component.list` type; the depth rides in
|
|
@@ -17,14 +17,13 @@ import {
|
|
|
17
17
|
discoverExternalComponentsGrouped,
|
|
18
18
|
discoverIntegrationComponents,
|
|
19
19
|
findComponentReadme,
|
|
20
|
-
findExternalComponentDoc,
|
|
21
20
|
resolveImportPath,
|
|
22
21
|
resolveIntegrationImportPath,
|
|
23
22
|
} from '../../../foundation/discovery/component-discovery.mjs';
|
|
24
23
|
import {discoverExternalPackages} from '../../../foundation/fs/paths.mjs';
|
|
25
24
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
26
25
|
import {AstryxError} from '../../error.mjs';
|
|
27
|
-
import {loadComponentDoc, loadIntegrationsSafely
|
|
26
|
+
import {loadComponentDoc, loadIntegrationsSafely} from '../_adapter.mjs';
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* @typedef {import('../component.type.mjs').ComponentListResponse} ComponentListResponse
|
|
@@ -32,29 +31,6 @@ import {loadComponentDoc, loadIntegrationsSafely, withOwnership} from '../_adapt
|
|
|
32
31
|
* @typedef {import('../component.type.mjs').ComponentBriefEntry} ComponentBriefEntry
|
|
33
32
|
*/
|
|
34
33
|
|
|
35
|
-
/**
|
|
36
|
-
* The import a legacy `pkg.astryx.docs` component's detail reports, derived the
|
|
37
|
-
* same way (`withOwnership`) so list and detail agree.
|
|
38
|
-
* @param {{name: string, docsDir: string}} ext
|
|
39
|
-
* @param {string} name
|
|
40
|
-
* @param {string} coreDir
|
|
41
|
-
* @param {{zh: boolean, lang: string|null}} docOpts
|
|
42
|
-
* @returns {Promise<string>}
|
|
43
|
-
*/
|
|
44
|
-
async function legacyImport(ext, name, coreDir, docOpts) {
|
|
45
|
-
const docPath = findExternalComponentDoc(ext.docsDir, name);
|
|
46
|
-
/** @type {import('../_adapter.mjs').LoadedComponentDoc} */
|
|
47
|
-
let docs = {};
|
|
48
|
-
if (docPath && docPath.endsWith('.doc.mjs')) {
|
|
49
|
-
try {
|
|
50
|
-
docs = await loadComponentDoc(docPath, docOpts);
|
|
51
|
-
} catch {
|
|
52
|
-
// Keep list resilient; validation owns malformed docs.
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return withOwnership(docs, {package: ext.name, sourcePath: null}, name, coreDir).import;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
34
|
/**
|
|
59
35
|
* Build the `component.list` envelope. The list taxonomy is collapsed: all
|
|
60
36
|
* three detail levels emit ONE `component.list` type; the depth rides in
|
|
@@ -291,24 +267,20 @@ export async function componentList(
|
|
|
291
267
|
k => grouped[k].length > 1 || grouped[k][0] !== k,
|
|
292
268
|
);
|
|
293
269
|
|
|
294
|
-
/** @param {string[]} names */
|
|
295
|
-
const entriesFor = names =>
|
|
296
|
-
Promise.all(
|
|
297
|
-
names.map(async n => ({
|
|
298
|
-
name: n,
|
|
299
|
-
package: ext.name,
|
|
300
|
-
import: await legacyImport(ext, n, coreDir, {zh, lang}),
|
|
301
|
-
})),
|
|
302
|
-
);
|
|
303
|
-
|
|
304
270
|
if (hasGroups) {
|
|
305
271
|
for (const [group, members] of Object.entries(grouped)) {
|
|
306
|
-
listData[`${group} (${ext.name})`] =
|
|
272
|
+
listData[`${group} (${ext.name})`] = members.map(n => ({
|
|
273
|
+
name: n,
|
|
274
|
+
package: ext.name,
|
|
275
|
+
}));
|
|
307
276
|
}
|
|
308
277
|
} else {
|
|
309
278
|
const allComps = Object.values(grouped).flat().sort();
|
|
310
279
|
if (allComps.length > 0) {
|
|
311
|
-
listData[`${ext.category} (${ext.name})`] =
|
|
280
|
+
listData[`${ext.category} (${ext.name})`] = allComps.map(n => ({
|
|
281
|
+
name: n,
|
|
282
|
+
package: ext.name,
|
|
283
|
+
}));
|
|
312
284
|
}
|
|
313
285
|
}
|
|
314
286
|
}
|