@astryxdesign/cli 0.7.1-canary.ff40b78 → 0.7.2-canary.01eab6a
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/CHANGELOG.md +35 -0
- package/README.md +7 -7
- package/api/build/_adapter.d.mts +1 -0
- package/api/build/_adapter.mjs +7 -0
- package/api/build/build.mjs +4 -1
- package/api/component/_adapter.d.mts +41 -1
- package/api/component/_adapter.mjs +93 -7
- package/api/component/component.mjs +22 -5
- package/api/component/component.test.mjs +420 -167
- package/api/component/integration-export-name.test.mjs +644 -0
- package/api/component/list/list.mjs +42 -4
- package/api/gap-report/gap-report.mjs +67 -4
- package/api/integration/_adapter.d.mts +12 -0
- package/api/integration/_adapter.mjs +54 -0
- package/api/integration/add-contribution.component-names.test.mjs +66 -0
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/authoring-checks.mjs +11 -2
- package/api/integration/authoring-checks.test.mjs +39 -0
- package/api/integration/authoring-checks.type.d.mts +9 -0
- package/api/integration/authoring-checks.type.mjs +14 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +21 -5
- package/api/integration/pack-check.mjs +61 -107
- package/api/integration/pack-check.test.mjs +359 -0
- package/api/search/search.d.mts +9 -0
- package/api/search/search.mjs +120 -16
- package/api/search/search.test.mjs +36 -0
- package/api/swizzle/copy/copy.mjs +28 -14
- package/api/template/table-filter-view-tabs.test.mjs +45 -0
- package/api/template/template.test.mjs +120 -3
- package/api/theme/build/build.core-on-demand.test.mjs +113 -0
- package/api/theme/build/build.d.mts +13 -13
- package/api/theme/build/build.family.test.mjs +16 -0
- package/api/theme/build/build.mjs +149 -55
- package/api/theme/themeBuild.doc.mjs +3 -3
- package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
- package/assets/docs/getting-started.doc.mjs +0 -10
- package/assets/docs/styling-overview.doc.mjs +54 -15
- package/assets/docs/tree/add-a-component.doc.mjs +10 -0
- package/assets/docs/tree/check-the-props.doc.mjs +145 -0
- package/assets/docs/tree/checks.doc.mjs +4 -4
- package/assets/docs/tree/component-family.doc.mjs +5 -1
- package/assets/docs/tree/component-imports.doc.mjs +8 -0
- package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
- package/assets/docs/tree/migration-setup.doc.mjs +31 -6
- package/assets/docs/tree/responsive.doc.mjs +37 -0
- package/assets/docs/tree/single-component.doc.mjs +3 -2
- package/assets/docs/tree/tailwind.doc.mjs +12 -0
- package/assets/docs/tree/tokens-and-setup.doc.mjs +3 -2
- package/assets/docs/tree/tokens-syntax.doc.mjs +20 -0
- package/assets/docs/tree/tokens.doc.mjs +1 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +9 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -0
- package/assets/docs/working-with-ai.doc.mjs +43 -4
- package/assets/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx +6 -1
- package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
- package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
- package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
- package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
- package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
- package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
- package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
- package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
- package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
- package/assets/templates/pages/detail-page/page.tsx +3 -3
- package/assets/templates/pages/table-filter/page.tsx +3 -2
- package/assets/templates/pages/table-inbox/page.tsx +10 -8
- package/assets/templates/themes/butter/butterTheme.ts +53 -11
- package/assets/templates/themes/chocolate/chocolateTheme.ts +29 -5
- package/assets/templates/themes/gothic/gothicTheme.ts +44 -9
- package/assets/templates/themes/stone/stoneTheme.ts +58 -11
- package/assets/templates/themes/y2k/y2kTheme.ts +60 -10
- package/authoring/doctypes/base/type.ts +6 -0
- package/authoring/doctypes/component/component.doc.mjs +4 -4
- package/authoring/doctypes/component/type.ts +6 -3
- package/clients/cli/commands/build-theme.mjs +32 -4
- package/clients/cli/commands/build-theme.path-safety.test.mjs +84 -0
- package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
- package/clients/cli/commands/build-theme.watch.test.mjs +63 -2
- package/clients/cli/commands/doctor-integration-components.doc.mjs +9 -3
- package/clients/cli/commands/doctor-integration.test.mjs +327 -0
- package/clients/cli/commands/doctor.mjs +74 -0
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/lib/component-format.mjs +5 -1
- package/foundation/discovery/component-discovery.d.mts +190 -10
- package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
- package/foundation/discovery/component-discovery.mjs +889 -80
- package/foundation/discovery/component-discovery.test.mjs +96 -0
- package/foundation/discovery/component-replacement.mjs +18 -0
- package/foundation/discovery/component-replacement.test.mjs +40 -0
- package/foundation/discovery/hook-discovery.mjs +13 -12
- package/foundation/discovery/module-exports.d.mts +27 -0
- package/foundation/discovery/module-exports.mjs +356 -31
- package/foundation/discovery/module-exports.test.mjs +172 -0
- package/foundation/discovery/package-tsconfig.d.mts +14 -0
- package/foundation/discovery/package-tsconfig.mjs +228 -0
- package/foundation/discovery/package-tsconfig.test.mjs +210 -0
- package/foundation/discovery/project-typescript.d.mts +23 -0
- package/foundation/discovery/project-typescript.mjs +61 -0
- package/foundation/discovery/prop-drift.d.mts +220 -0
- package/foundation/discovery/prop-drift.mjs +1765 -0
- package/foundation/discovery/prop-drift.test.mjs +1197 -0
- package/foundation/discovery/template-adapter.mjs +74 -5
- package/foundation/discovery/unresolved-references.d.mts +62 -0
- package/foundation/discovery/unresolved-references.mjs +790 -0
- package/foundation/discovery/unresolved-references.test.mjs +567 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +9 -1
- package/foundation/doc-compiler/inputs.mjs +23 -0
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/fs/listing-cache.d.mts +36 -0
- package/foundation/fs/listing-cache.mjs +95 -0
- package/foundation/fs/listing-cache.test.mjs +88 -0
- package/foundation/fs/paths.mjs +3 -2
- package/foundation/integrations/contribution-inventory.mjs +6 -1
- package/foundation/response/response-types.doc.mjs +1 -1
- package/foundation/xle/registry.mjs +4 -0
- package/foundation/xle/registry.test.mjs +28 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @xds/cli
|
|
2
2
|
|
|
3
|
+
# 0.7.1
|
|
4
|
+
|
|
5
|
+
#### Fixes
|
|
6
|
+
|
|
7
|
+
- `CommandPaletteInput` now exposes the semantics and name that its visible state promises. (#7321)
|
|
8
|
+
- A standalone field with no popup attributes was `role="combobox"` with `aria-expanded="true"` and `aria-autocomplete="list"`; it is now `role="searchbox"` with no popup state. Pass `role="combobox"`, or your popup's own ARIA attributes, to keep the old semantics. A field that already passes popup attributes (`aria-expanded`, `aria-controls`, `aria-owns`, `aria-haspopup`, and the like) stays a `combobox` and keeps them, and a field inside `CommandPalette` is unchanged.
|
|
9
|
+
|
|
10
|
+
- The field's default accessible name was its placeholder (`Search…`, or the caller's `placeholder`); it is now `Search commands`, translated. Pass `label` to keep a specific name, for example `label="Search…"` for the old default. A caller whose custom `placeholder` served as the name keeps working code and hears the generic name until it passes `label`.
|
|
11
|
+
|
|
12
|
+
- The CLI's async-search CommandPalette block names its field `Search files`.
|
|
13
|
+
|
|
14
|
+
- `endContent={true}` no longer renders an empty trailing slot, and `endContent={0}` renders inside the trailing slot instead of after it.
|
|
15
|
+
- Stone, Y2K, and Gothic set `CodeBlock`'s diff row slots in their own syntax palettes, so a reader of a diff on those themes gets added and removed rows whose code, line numbers, and `+`/`-` glyphs stay readable: every syntax token keeps at least 4.5:1 on the tinted rows in Stone (light and dark) and Y2K (light and dark), and in Gothic the rows take a deep green and a deep red at the background's own luminance, so every token keeps the contrast it has on the plain background. Line numbers and glyphs on changed rows use each theme's own green and red. The CLI's bundled copies of the three themes (`astryx theme eject`) carry the same palettes. (#7428)
|
|
16
|
+
- A `secondary` Selector, MultiSelector, or ComplexSelector now matches the theme's secondary Button: under butter, chocolate, gothic, stone, and y2k it takes that Button's border, fill, text color, and hover instead of the default borderless neutral fill, so a toolbar mixing secondary buttons and selectors reads as one set of controls. Disabled and read-only triggers keep a still fill on hover, as a disabled Button does, and a Selector or MultiSelector inside an InputGroup keeps the group's neutral fill and edges. The default theme is unchanged, the selector docs now say `secondary` follows the theme's secondary Button, and themes added with the CLI get the same parity. (#7548)
|
|
17
|
+
- `astryx theme build --watch` stops as soon as it is interrupted (Ctrl-C or SIGTERM). A change saved while a rebuild was running no longer starts another rebuild after "Stopped watching.", and a rebuild in progress stops with the watcher instead of keeping the process alive. (#7508)
|
|
18
|
+
|
|
19
|
+
#### Performance
|
|
20
|
+
|
|
21
|
+
- `astryx search` and `astryx build`, and the `search` and `build` API functions, read each source directory once per call instead of once per candidate. Results are unchanged. A warm `search` drops from about 1.9 s to 0.4 s on macOS. (#7421)
|
|
22
|
+
|
|
23
|
+
#### Documentation
|
|
24
|
+
|
|
25
|
+
- The generated token docs list the five diff row slots of the syntax vocabulary — `--color-syntax-added`, `--color-syntax-removed`, `--color-syntax-diff-header`, `--color-syntax-added-marker`, `--color-syntax-removed-marker` — with their defaults, so `astryx docs tokens` describes nineteen syntax slots. (#7389)
|
|
26
|
+
- The Tailwind and migration setup docs now say that `globals.css` (or a `layers.css` holding only the `@layer` line) must be the first import in the root layout or app entry, before the `astryx-themes` module or any component that imports theme CSS; otherwise Tailwind preflight overrides Astryx base styles and theme overrides lose. The Tailwind v3 coexistence snippet moves its `@layer` line into a `layers.css` imported first, because Next.js (webpack or Turbopack) hoists CSS imports above an inline `@layer` line. (#7534)
|
|
27
|
+
- Grid's `columns` docs now lead with the shape that reflows: a numeric `columns` is exactly N columns at every width and never reflows, and `columns={{minWidth, max}}` is the form for columns that must survive a phone. The `astryx docs layout/responsive` topic gains a "Columns that reflow" section with a reflowing stat row beside a fixed week row. No behavior changes. (#7340)
|
|
28
|
+
- The styling setup docs now load the prebuilt stylesheets on every path. The "StyleX from source" path becomes "StyleX for your own code": it keeps `astryx.css` and points the StyleX compiler at your own and swizzled source only. A new "Other Astryx packages" section lists each package's stylesheet (`richtext.css`, `lab.css`, `charts.css`) and where to import it. Getting started no longer lists the two example setups that compile Astryx source; the remaining examples all load `astryx.css`. (#7587)
|
|
29
|
+
|
|
30
|
+
#### Contributors
|
|
31
|
+
|
|
32
|
+
Thanks to everyone who contributed to this release:
|
|
33
|
+
|
|
34
|
+
- @cixzhang
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
3
38
|
# 0.7.0
|
|
4
39
|
|
|
5
40
|
#### Breaking Changes
|
package/README.md
CHANGED
|
@@ -478,7 +478,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
478
478
|
| `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |
|
|
479
479
|
| `integration.validate` | The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
|
|
480
480
|
| `integration.template-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |
|
|
481
|
-
| `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), 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.
|
|
481
|
+
| `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), 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. When the manifest loads and declares a components root, propDrift compares documented props with the TypeScript props: status (checked \| skipped), reason, typescript, components, findings (all warnings), unchecked, and propsNotChecked. |
|
|
482
482
|
| `integration.doc-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
|
|
483
483
|
|
|
484
484
|
<!-- END GENERATED: response-types -->
|
|
@@ -551,12 +551,12 @@ data: { checks, summary } }`) that AI agents and scripts can parse.
|
|
|
551
551
|
Omit `[package]` to inspect the package at the current directory, or pass an
|
|
552
552
|
installed package name:
|
|
553
553
|
|
|
554
|
-
| Command | What it checks
|
|
555
|
-
| ----------------------------------------- |
|
|
556
|
-
| `doctor integration validate [package]` | Manifest shape and every declared contribution
|
|
557
|
-
| `doctor integration templates [package]` | Template IDs shared with Core
|
|
558
|
-
| `doctor integration components [package]` | Component names shared with Core
|
|
559
|
-
| `doctor integration docs [package]` | Core topic replacements, extensions, and same-name conflicts
|
|
554
|
+
| Command | What it checks | Exit `1` when |
|
|
555
|
+
| ----------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
556
|
+
| `doctor integration validate [package]` | Manifest shape and every declared contribution | A structural issue has error severity |
|
|
557
|
+
| `doctor integration templates [package]` | Template IDs shared with Core | The integration is invalid; ID conflicts are warnings |
|
|
558
|
+
| `doctor integration components [package]` | Component names shared with Core, and each props table against the TypeScript props | The integration is invalid; name conflicts and prop differences are warnings |
|
|
559
|
+
| `doctor integration docs [package]` | Core topic replacements, extensions, and same-name conflicts | A Core overlap is accidental or the docs are invalid |
|
|
560
560
|
|
|
561
561
|
Template and component conflicts include the exact `--package` command needed
|
|
562
562
|
to select the integration contribution. Doc replacements and extensions are
|
package/api/build/_adapter.d.mts
CHANGED
|
@@ -66,6 +66,7 @@ export function isWeightsFile(file: any): file is import("./kit/weights.mjs").We
|
|
|
66
66
|
* @returns {string[]} Setup notes (empty when the template needs nothing).
|
|
67
67
|
*/
|
|
68
68
|
export function templateSetupNotes(template: PageTemplate, cwd: string): string[];
|
|
69
|
+
export { withListingCache } from "../../foundation/fs/listing-cache.mjs";
|
|
69
70
|
/**
|
|
70
71
|
* A page template the kit can recommend starting from.
|
|
71
72
|
*/
|
package/api/build/_adapter.mjs
CHANGED
|
@@ -23,6 +23,13 @@ import {componentKeywords} from '../search/search.mjs';
|
|
|
23
23
|
import {findCoreDir} from '../../foundation/fs/paths.mjs';
|
|
24
24
|
import {analyzeTemplateNeeds} from '../../foundation/discovery/template-needs.mjs';
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Runs one build with a single directory listing per path: the kit resolves
|
|
28
|
+
* every candidate's source and docs by walking the same tree, which does not
|
|
29
|
+
* change during the call.
|
|
30
|
+
*/
|
|
31
|
+
export {withListingCache} from '../../foundation/fs/listing-cache.mjs';
|
|
32
|
+
|
|
26
33
|
/**
|
|
27
34
|
* A page template the kit can recommend starting from.
|
|
28
35
|
* @typedef {object} PageTemplate
|
package/api/build/build.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import {AstryxError} from '../error.mjs';
|
|
|
17
17
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
18
18
|
import {buildHelp} from './help/help.mjs';
|
|
19
19
|
import {buildKit} from './kit/kit.mjs';
|
|
20
|
+
import {withListingCache} from './_adapter.mjs';
|
|
20
21
|
|
|
21
22
|
// Barrel: surface the leaves alongside the dispatcher for the fractal shape.
|
|
22
23
|
export {buildHelp, buildKit};
|
|
@@ -40,5 +41,7 @@ export async function build(query, options = {}) {
|
|
|
40
41
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
41
42
|
);
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
// The kit resolves every candidate's source and docs by walking the same
|
|
45
|
+
// tree; read each directory once for this call.
|
|
46
|
+
return withListingCache(() => buildKit(query, options));
|
|
44
47
|
}
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
* @property {string|null} sourcePath
|
|
27
27
|
* @property {string|undefined} issuesUrl
|
|
28
28
|
* @property {import('../../foundation/integrations/integrations.mjs').LoadedIntegration|null} integration
|
|
29
|
+
* @property {import('../../foundation/discovery/component-discovery.mjs').NameHold} hold
|
|
30
|
+
* how the owner holds the name, for the owner rule
|
|
29
31
|
*/
|
|
30
32
|
/**
|
|
31
33
|
* What ownership shaping needs from an owner. The core and legacy-external
|
|
@@ -138,6 +140,25 @@ export function assertUnambiguousOwners(owners: ComponentOwner[], dirName: strin
|
|
|
138
140
|
* @returns {string | null}
|
|
139
141
|
*/
|
|
140
142
|
export function resolveLegacyExternalDoc(ext: ExternalPackageRef, dirName: string): string | null;
|
|
143
|
+
/**
|
|
144
|
+
* Whether a legacy external package documents `dirName`.
|
|
145
|
+
* @param {string} cwd
|
|
146
|
+
* @param {string} dirName
|
|
147
|
+
* @returns {boolean}
|
|
148
|
+
*/
|
|
149
|
+
export function legacyExternalDocuments(cwd: string, dirName: string): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Whether a legacy docs package keeps `dirName` over these owners, each of which
|
|
152
|
+
* holds it only as an export a doc records.
|
|
153
|
+
* @param {string} cwd
|
|
154
|
+
* @param {string} dirName
|
|
155
|
+
* @param {Array<{hold?: string, docPath?: string | null}>} owners
|
|
156
|
+
* @returns {boolean}
|
|
157
|
+
*/
|
|
158
|
+
export function legacyExternalKeeps(cwd: string, dirName: string, owners: Array<{
|
|
159
|
+
hold?: string;
|
|
160
|
+
docPath?: string | null;
|
|
161
|
+
}>): boolean;
|
|
141
162
|
/**
|
|
142
163
|
* The core source file for `dirName` (the no-scope `--source` path reads core
|
|
143
164
|
* directly — it does NOT fall back to externals or fuzzy search).
|
|
@@ -210,7 +231,20 @@ export function scopeSubComponent(docs: LoadedComponentDoc, dirName: string, cor
|
|
|
210
231
|
};
|
|
211
232
|
matchingComponent: any;
|
|
212
233
|
} | null;
|
|
213
|
-
|
|
234
|
+
/**
|
|
235
|
+
* The doc an integration owner shows for `dirName`: when `dirName` is a member
|
|
236
|
+
* its family doc lists under its own name (`AcmeSlide` in an `AcmeCarousel`
|
|
237
|
+
* doc), the doc scoped to that member as {@link scopeSubComponent} scopes
|
|
238
|
+
* Core's, keeping the import the family doc states; otherwise `docs` itself.
|
|
239
|
+
* @param {LoadedComponentDoc} docs
|
|
240
|
+
* @param {OwnershipSubject} owner
|
|
241
|
+
* @param {string} dirName
|
|
242
|
+
* @returns {LoadedComponentDoc & {parentDoc?: string, import?: string}}
|
|
243
|
+
*/
|
|
244
|
+
export function scopeIntegrationMember(docs: LoadedComponentDoc, owner: OwnershipSubject, dirName: string): LoadedComponentDoc & {
|
|
245
|
+
parentDoc?: string;
|
|
246
|
+
import?: string;
|
|
247
|
+
};
|
|
214
248
|
/**
|
|
215
249
|
* Internal ambiguity marker. Single-component callers still receive the same
|
|
216
250
|
* AstryxError code, message, and suggestions; batch callers can additionally
|
|
@@ -261,6 +295,10 @@ export type ComponentOwner = {
|
|
|
261
295
|
sourcePath: string | null;
|
|
262
296
|
issuesUrl: string | undefined;
|
|
263
297
|
integration: import("../../foundation/integrations/integrations.mjs").LoadedIntegration | null;
|
|
298
|
+
/**
|
|
299
|
+
* how the owner holds the name, for the owner rule
|
|
300
|
+
*/
|
|
301
|
+
hold: import("../../foundation/discovery/component-discovery.mjs").NameHold;
|
|
264
302
|
};
|
|
265
303
|
/**
|
|
266
304
|
* What ownership shaping needs from an owner. The core and legacy-external
|
|
@@ -303,4 +341,6 @@ export type ResolvedUnscopedDoc = {
|
|
|
303
341
|
resolvedSourcePath: string | null;
|
|
304
342
|
};
|
|
305
343
|
import { CORE_PACKAGE } from '../../foundation/discovery/component-discovery.mjs';
|
|
344
|
+
import { unscopedComponentOwners } from '../../foundation/discovery/component-discovery.mjs';
|
|
306
345
|
import { AstryxError } from '../error.mjs';
|
|
346
|
+
export { CORE_PACKAGE, unscopedComponentOwners };
|
|
@@ -28,13 +28,17 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
CORE_PACKAGE,
|
|
30
30
|
discoverComponents,
|
|
31
|
+
docStem,
|
|
31
32
|
findComponentReadme,
|
|
32
33
|
findComponentSource,
|
|
33
34
|
findExternalComponentDoc,
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
findIntegrationComponent,
|
|
36
|
+
integrationMemberEntry,
|
|
37
|
+
isIntegrationMember,
|
|
38
|
+
recordedDocName,
|
|
36
39
|
resolveImportPath,
|
|
37
40
|
resolveIntegrationImportPath as resolveIntegrationImport,
|
|
41
|
+
unscopedComponentOwners,
|
|
38
42
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
39
43
|
import {Project} from '../../foundation/config/project.mjs';
|
|
40
44
|
import {loadComponentDoc as loadValidatedComponentDoc} from '../../foundation/discovery/component-loader.mjs';
|
|
@@ -42,7 +46,7 @@ import {resolveComponentReplacements} from '../../foundation/discovery/component
|
|
|
42
46
|
import {searchComponents} from '../../foundation/text/string-utils.mjs';
|
|
43
47
|
import {AstryxError} from '../error.mjs';
|
|
44
48
|
|
|
45
|
-
export {CORE_PACKAGE};
|
|
49
|
+
export {CORE_PACKAGE, unscopedComponentOwners};
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* A loaded component doc. The shared validated loader accepts stamped and legacy
|
|
@@ -71,6 +75,8 @@ export {CORE_PACKAGE};
|
|
|
71
75
|
* @property {string|null} sourcePath
|
|
72
76
|
* @property {string|undefined} issuesUrl
|
|
73
77
|
* @property {import('../../foundation/integrations/integrations.mjs').LoadedIntegration|null} integration
|
|
78
|
+
* @property {import('../../foundation/discovery/component-discovery.mjs').NameHold} hold
|
|
79
|
+
* how the owner holds the name, for the owner rule
|
|
74
80
|
*/
|
|
75
81
|
|
|
76
82
|
/**
|
|
@@ -240,17 +246,19 @@ export function resolveOwners(coreDir, dirName, loadedIntegrations) {
|
|
|
240
246
|
sourcePath: findComponentSource(coreDir, dirName),
|
|
241
247
|
issuesUrl: undefined,
|
|
242
248
|
integration: null,
|
|
249
|
+
hold: 'core',
|
|
243
250
|
});
|
|
244
251
|
}
|
|
245
252
|
for (const integration of loadedIntegrations) {
|
|
246
|
-
const
|
|
247
|
-
if (!
|
|
253
|
+
const found = findIntegrationComponent(integration, dirName);
|
|
254
|
+
if (!found) continue;
|
|
248
255
|
owners.push({
|
|
249
256
|
package: integration.name,
|
|
250
|
-
docPath,
|
|
251
|
-
sourcePath:
|
|
257
|
+
docPath: found.docPath,
|
|
258
|
+
sourcePath: found.sourcePath,
|
|
252
259
|
issuesUrl: integration.issuesUrl,
|
|
253
260
|
integration,
|
|
261
|
+
hold: found.hold,
|
|
254
262
|
});
|
|
255
263
|
}
|
|
256
264
|
return owners;
|
|
@@ -361,6 +369,39 @@ export function resolveLegacyExternalDoc(ext, dirName) {
|
|
|
361
369
|
return extDocPath && extDocPath.endsWith('.doc.mjs') ? extDocPath : null;
|
|
362
370
|
}
|
|
363
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Whether a legacy external package documents `dirName`.
|
|
374
|
+
* @param {string} cwd
|
|
375
|
+
* @param {string} dirName
|
|
376
|
+
* @returns {boolean}
|
|
377
|
+
*/
|
|
378
|
+
export function legacyExternalDocuments(cwd, dirName) {
|
|
379
|
+
return discoverExternalPackages(cwd).some(
|
|
380
|
+
ext => resolveLegacyExternalDoc(ext, dirName) != null,
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Whether a legacy docs package keeps `dirName` over these owners, each of which
|
|
386
|
+
* holds it only as an export a doc records.
|
|
387
|
+
* @param {string} cwd
|
|
388
|
+
* @param {string} dirName
|
|
389
|
+
* @param {Array<{hold?: string, docPath?: string | null}>} owners
|
|
390
|
+
* @returns {boolean}
|
|
391
|
+
*/
|
|
392
|
+
export function legacyExternalKeeps(cwd, dirName, owners) {
|
|
393
|
+
return (
|
|
394
|
+
owners.length > 0 &&
|
|
395
|
+
owners.every(
|
|
396
|
+
owner =>
|
|
397
|
+
owner.hold === 'doc' &&
|
|
398
|
+
owner.docPath != null &&
|
|
399
|
+
docStem(owner.docPath).toLowerCase() !== dirName.toLowerCase(),
|
|
400
|
+
) &&
|
|
401
|
+
legacyExternalDocuments(cwd, dirName)
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
|
|
364
405
|
/**
|
|
365
406
|
* The core source file for `dirName` (the no-scope `--source` path reads core
|
|
366
407
|
* directly — it does NOT fall back to externals or fuzzy search).
|
|
@@ -583,3 +624,48 @@ export function scopeSubComponent(docs, dirName, coreDir) {
|
|
|
583
624
|
|
|
584
625
|
return {scoped, matchingComponent};
|
|
585
626
|
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* The doc an integration owner shows for `dirName`: when `dirName` is a member
|
|
630
|
+
* its family doc lists under its own name (`AcmeSlide` in an `AcmeCarousel`
|
|
631
|
+
* doc), the doc scoped to that member as {@link scopeSubComponent} scopes
|
|
632
|
+
* Core's, keeping the import the family doc states; otherwise `docs` itself.
|
|
633
|
+
* @param {LoadedComponentDoc} docs
|
|
634
|
+
* @param {OwnershipSubject} owner
|
|
635
|
+
* @param {string} dirName
|
|
636
|
+
* @returns {LoadedComponentDoc & {parentDoc?: string, import?: string}}
|
|
637
|
+
*/
|
|
638
|
+
export function scopeIntegrationMember(docs, owner, dirName) {
|
|
639
|
+
const record = {name: dirName, docPath: owner.docPath ?? null};
|
|
640
|
+
if (!isIntegrationMember(record)) return docs;
|
|
641
|
+
const entry = integrationMemberEntry(docs, record);
|
|
642
|
+
// The files list the member but the doc this process loaded has no entry
|
|
643
|
+
// for it (the doc changed after it loaded): never answer with the family.
|
|
644
|
+
if (entry == null) {
|
|
645
|
+
throw new AstryxError(
|
|
646
|
+
`No component named "${dirName}": its family doc changed after this process loaded it.`,
|
|
647
|
+
undefined,
|
|
648
|
+
ERROR_CODES.ERR_UNKNOWN_COMPONENT,
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
// Built from the entry, as scopeSubComponent scopes Core's, so a member that
|
|
652
|
+
// shares the doc's own `name` is scoped too.
|
|
653
|
+
/** @type {LoadedComponentDoc & {parentDoc?: string, import?: string}} */
|
|
654
|
+
const scoped = {
|
|
655
|
+
name: dirName,
|
|
656
|
+
description: entry.description,
|
|
657
|
+
props: entry.props,
|
|
658
|
+
components: [entry],
|
|
659
|
+
// The name the family doc opens under, for every member.
|
|
660
|
+
parentDoc:
|
|
661
|
+
owner.integration && record.docPath
|
|
662
|
+
? recordedDocName(owner.integration, record.docPath)
|
|
663
|
+
: docs.name === dirName && record.docPath
|
|
664
|
+
? docStem(record.docPath)
|
|
665
|
+
: docs.name,
|
|
666
|
+
};
|
|
667
|
+
if (docs.usage) scoped.usage = docs.usage;
|
|
668
|
+
if (docs.theming) scoped.theming = docs.theming;
|
|
669
|
+
if (docs.import) scoped.import = docs.import;
|
|
670
|
+
return scoped;
|
|
671
|
+
}
|
|
@@ -19,9 +19,11 @@ import {
|
|
|
19
19
|
requireCoreDir,
|
|
20
20
|
loadIntegrationsSafely,
|
|
21
21
|
resolveOwners,
|
|
22
|
+
scopeIntegrationMember,
|
|
22
23
|
classifyScope,
|
|
23
24
|
assertUnambiguousOwners,
|
|
24
25
|
resolveLegacyExternalDoc,
|
|
26
|
+
legacyExternalKeeps,
|
|
25
27
|
resolveCoreSourcePath,
|
|
26
28
|
resolveUnscopedDoc,
|
|
27
29
|
loadComponentDoc,
|
|
@@ -29,6 +31,7 @@ import {
|
|
|
29
31
|
ComponentAmbiguityError,
|
|
30
32
|
installedComponentPackageVersion,
|
|
31
33
|
resolveComponentReplacement,
|
|
34
|
+
unscopedComponentOwners,
|
|
32
35
|
} from './_adapter.mjs';
|
|
33
36
|
import {componentList} from './list/list.mjs';
|
|
34
37
|
import {componentDetail} from './detail/detail.mjs';
|
|
@@ -427,7 +430,13 @@ export async function component(name, options = {}) {
|
|
|
427
430
|
if (blocks) {
|
|
428
431
|
return componentDetailBlocks(dirName, cwd, owner.package);
|
|
429
432
|
}
|
|
430
|
-
const
|
|
433
|
+
const loaded = await loadComponentDoc(owner.docPath, docOpts);
|
|
434
|
+
// A family member an integration lists under its own name reads as that
|
|
435
|
+
// member, the way a Core sub-component does below.
|
|
436
|
+
const docs =
|
|
437
|
+
scoped.kind === 'integration'
|
|
438
|
+
? scopeIntegrationMember(loaded, owner, dirName)
|
|
439
|
+
: loaded;
|
|
431
440
|
if (props) return componentDetailProps(docs, owner.package);
|
|
432
441
|
return componentDetail(docs, owner, dirName, coreDir);
|
|
433
442
|
}
|
|
@@ -481,12 +490,14 @@ export async function component(name, options = {}) {
|
|
|
481
490
|
});
|
|
482
491
|
}
|
|
483
492
|
|
|
493
|
+
// The owner rule runs first, over valid and invalid owners alike.
|
|
494
|
+
const ruled = unscopedComponentOwners(owners);
|
|
484
495
|
// Invalid integration metadata does not create ambiguity against a valid
|
|
485
|
-
// owner. Keep
|
|
496
|
+
// owner. Keep ruled owners only when no doc owner is valid, so an integration-
|
|
486
497
|
// only component still exposes its source and returns ERR_INVALID_DOC for
|
|
487
498
|
// detail instead of degrading to an unrelated unknown-component error.
|
|
488
499
|
const validOwners = [];
|
|
489
|
-
for (const owner of
|
|
500
|
+
for (const owner of ruled) {
|
|
490
501
|
if (owner.package === CORE_PACKAGE) {
|
|
491
502
|
validOwners.push(owner);
|
|
492
503
|
continue;
|
|
@@ -498,7 +509,12 @@ export async function component(name, options = {}) {
|
|
|
498
509
|
// Project/Doctor report invalid metadata; it is not an effective owner.
|
|
499
510
|
}
|
|
500
511
|
}
|
|
501
|
-
const
|
|
512
|
+
const loadable = validOwners.length > 0 ? validOwners : ruled;
|
|
513
|
+
// A legacy docs package's exact doc keeps its name over an export name a doc
|
|
514
|
+
// records, as Core and file-named owners do.
|
|
515
|
+
const effectiveOwners = legacyExternalKeeps(cwd, dirName, loadable)
|
|
516
|
+
? []
|
|
517
|
+
: loadable;
|
|
502
518
|
|
|
503
519
|
// ── Ambiguity: owned by MORE THAN ONE valid package, no --package ──
|
|
504
520
|
assertUnambiguousOwners(effectiveOwners, dirName);
|
|
@@ -516,7 +532,8 @@ export async function component(name, options = {}) {
|
|
|
516
532
|
// Integration components don't carry showcases — fail without scanning.
|
|
517
533
|
return componentDetailShowcase(dirName, {cwd, name, resolve: false, ownerPackage: owner.package});
|
|
518
534
|
}
|
|
519
|
-
const
|
|
535
|
+
const loaded = await loadComponentDoc(owner.docPath, docOpts);
|
|
536
|
+
const docs = scopeIntegrationMember(loaded, owner, dirName);
|
|
520
537
|
if (props) return componentDetailProps(docs, owner.package);
|
|
521
538
|
return componentDetail(docs, owner, dirName, coreDir);
|
|
522
539
|
}
|