@astryxdesign/cli 0.7.2-canary.db3a2e7 → 0.7.2-canary.ebcc404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/component/_adapter.d.mts +27 -1
- package/api/component/_adapter.mjs +45 -7
- package/api/component/component.mjs +12 -3
- package/api/component/component.test.mjs +420 -167
- package/api/component/integration-export-name.test.mjs +419 -0
- package/api/component/list/list.mjs +42 -4
- package/api/gap-report/gap-report.mjs +66 -4
- package/api/integration/pack-check.mjs +13 -104
- package/api/integration/pack-check.test.mjs +112 -0
- package/api/search/search.d.mts +9 -0
- package/api/search/search.mjs +90 -10
- package/api/search/search.test.mjs +36 -0
- package/api/swizzle/copy/copy.mjs +28 -14
- package/api/template/template.test.mjs +120 -3
- package/api/theme/build/build.family.test.mjs +16 -0
- package/api/theme/build/build.mjs +77 -18
- 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/tree/component-imports.doc.mjs +8 -0
- package/assets/docs/working-with-ai.doc.mjs +43 -4
- 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-inbox/page.tsx +10 -8
- package/authoring/doctypes/base/type.ts +6 -0
- package/authoring/doctypes/component/component.doc.mjs +3 -3
- package/authoring/doctypes/component/type.ts +6 -3
- 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/theme-build.doc.mjs +2 -2
- package/clients/cli/lib/component-format.mjs +5 -1
- package/foundation/discovery/component-discovery.d.mts +95 -6
- package/foundation/discovery/component-discovery.export-names.test.mjs +293 -0
- package/foundation/discovery/component-discovery.mjs +524 -49
- package/foundation/discovery/component-discovery.test.mjs +96 -0
- package/foundation/discovery/component-replacement.mjs +18 -0
- package/foundation/discovery/component-replacement.test.mjs +20 -0
- package/foundation/discovery/module-exports.d.mts +21 -0
- package/foundation/discovery/module-exports.mjs +343 -31
- package/foundation/discovery/module-exports.test.mjs +172 -0
- package/foundation/discovery/template-adapter.mjs +74 -5
- package/foundation/doc-compiler/doc-loads.test.mjs +5 -1
- package/foundation/doc-compiler/inputs.mjs +23 -0
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/xle/registry.mjs +4 -0
- package/foundation/xle/registry.test.mjs +28 -0
- package/package.json +10 -10
|
@@ -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,6 @@ export function scopeSubComponent(docs: LoadedComponentDoc, dirName: string, cor
|
|
|
210
231
|
};
|
|
211
232
|
matchingComponent: any;
|
|
212
233
|
} | null;
|
|
213
|
-
export { CORE_PACKAGE };
|
|
214
234
|
/**
|
|
215
235
|
* Internal ambiguity marker. Single-component callers still receive the same
|
|
216
236
|
* AstryxError code, message, and suggestions; batch callers can additionally
|
|
@@ -261,6 +281,10 @@ export type ComponentOwner = {
|
|
|
261
281
|
sourcePath: string | null;
|
|
262
282
|
issuesUrl: string | undefined;
|
|
263
283
|
integration: import("../../foundation/integrations/integrations.mjs").LoadedIntegration | null;
|
|
284
|
+
/**
|
|
285
|
+
* how the owner holds the name, for the owner rule
|
|
286
|
+
*/
|
|
287
|
+
hold: import("../../foundation/discovery/component-discovery.mjs").NameHold;
|
|
264
288
|
};
|
|
265
289
|
/**
|
|
266
290
|
* What ownership shaping needs from an owner. The core and legacy-external
|
|
@@ -303,4 +327,6 @@ export type ResolvedUnscopedDoc = {
|
|
|
303
327
|
resolvedSourcePath: string | null;
|
|
304
328
|
};
|
|
305
329
|
import { CORE_PACKAGE } from '../../foundation/discovery/component-discovery.mjs';
|
|
330
|
+
import { unscopedComponentOwners } from '../../foundation/discovery/component-discovery.mjs';
|
|
306
331
|
import { AstryxError } from '../error.mjs';
|
|
332
|
+
export { CORE_PACKAGE, unscopedComponentOwners };
|
|
@@ -28,13 +28,14 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
CORE_PACKAGE,
|
|
30
30
|
discoverComponents,
|
|
31
|
+
docStem,
|
|
31
32
|
findComponentReadme,
|
|
32
33
|
findComponentSource,
|
|
33
34
|
findExternalComponentDoc,
|
|
34
|
-
|
|
35
|
-
findIntegrationComponentSource,
|
|
35
|
+
findIntegrationComponent,
|
|
36
36
|
resolveImportPath,
|
|
37
37
|
resolveIntegrationImportPath as resolveIntegrationImport,
|
|
38
|
+
unscopedComponentOwners,
|
|
38
39
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
39
40
|
import {Project} from '../../foundation/config/project.mjs';
|
|
40
41
|
import {loadComponentDoc as loadValidatedComponentDoc} from '../../foundation/discovery/component-loader.mjs';
|
|
@@ -42,7 +43,7 @@ import {resolveComponentReplacements} from '../../foundation/discovery/component
|
|
|
42
43
|
import {searchComponents} from '../../foundation/text/string-utils.mjs';
|
|
43
44
|
import {AstryxError} from '../error.mjs';
|
|
44
45
|
|
|
45
|
-
export {CORE_PACKAGE};
|
|
46
|
+
export {CORE_PACKAGE, unscopedComponentOwners};
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* A loaded component doc. The shared validated loader accepts stamped and legacy
|
|
@@ -71,6 +72,8 @@ export {CORE_PACKAGE};
|
|
|
71
72
|
* @property {string|null} sourcePath
|
|
72
73
|
* @property {string|undefined} issuesUrl
|
|
73
74
|
* @property {import('../../foundation/integrations/integrations.mjs').LoadedIntegration|null} integration
|
|
75
|
+
* @property {import('../../foundation/discovery/component-discovery.mjs').NameHold} hold
|
|
76
|
+
* how the owner holds the name, for the owner rule
|
|
74
77
|
*/
|
|
75
78
|
|
|
76
79
|
/**
|
|
@@ -240,17 +243,19 @@ export function resolveOwners(coreDir, dirName, loadedIntegrations) {
|
|
|
240
243
|
sourcePath: findComponentSource(coreDir, dirName),
|
|
241
244
|
issuesUrl: undefined,
|
|
242
245
|
integration: null,
|
|
246
|
+
hold: 'core',
|
|
243
247
|
});
|
|
244
248
|
}
|
|
245
249
|
for (const integration of loadedIntegrations) {
|
|
246
|
-
const
|
|
247
|
-
if (!
|
|
250
|
+
const found = findIntegrationComponent(integration, dirName);
|
|
251
|
+
if (!found) continue;
|
|
248
252
|
owners.push({
|
|
249
253
|
package: integration.name,
|
|
250
|
-
docPath,
|
|
251
|
-
sourcePath:
|
|
254
|
+
docPath: found.docPath,
|
|
255
|
+
sourcePath: found.sourcePath,
|
|
252
256
|
issuesUrl: integration.issuesUrl,
|
|
253
257
|
integration,
|
|
258
|
+
hold: found.hold,
|
|
254
259
|
});
|
|
255
260
|
}
|
|
256
261
|
return owners;
|
|
@@ -361,6 +366,39 @@ export function resolveLegacyExternalDoc(ext, dirName) {
|
|
|
361
366
|
return extDocPath && extDocPath.endsWith('.doc.mjs') ? extDocPath : null;
|
|
362
367
|
}
|
|
363
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Whether a legacy external package documents `dirName`.
|
|
371
|
+
* @param {string} cwd
|
|
372
|
+
* @param {string} dirName
|
|
373
|
+
* @returns {boolean}
|
|
374
|
+
*/
|
|
375
|
+
export function legacyExternalDocuments(cwd, dirName) {
|
|
376
|
+
return discoverExternalPackages(cwd).some(
|
|
377
|
+
ext => resolveLegacyExternalDoc(ext, dirName) != null,
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Whether a legacy docs package keeps `dirName` over these owners, each of which
|
|
383
|
+
* holds it only as an export a doc records.
|
|
384
|
+
* @param {string} cwd
|
|
385
|
+
* @param {string} dirName
|
|
386
|
+
* @param {Array<{hold?: string, docPath?: string | null}>} owners
|
|
387
|
+
* @returns {boolean}
|
|
388
|
+
*/
|
|
389
|
+
export function legacyExternalKeeps(cwd, dirName, owners) {
|
|
390
|
+
return (
|
|
391
|
+
owners.length > 0 &&
|
|
392
|
+
owners.every(
|
|
393
|
+
owner =>
|
|
394
|
+
owner.hold === 'doc' &&
|
|
395
|
+
owner.docPath != null &&
|
|
396
|
+
docStem(owner.docPath).toLowerCase() !== dirName.toLowerCase(),
|
|
397
|
+
) &&
|
|
398
|
+
legacyExternalDocuments(cwd, dirName)
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
364
402
|
/**
|
|
365
403
|
* The core source file for `dirName` (the no-scope `--source` path reads core
|
|
366
404
|
* directly — it does NOT fall back to externals or fuzzy search).
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
classifyScope,
|
|
23
23
|
assertUnambiguousOwners,
|
|
24
24
|
resolveLegacyExternalDoc,
|
|
25
|
+
legacyExternalKeeps,
|
|
25
26
|
resolveCoreSourcePath,
|
|
26
27
|
resolveUnscopedDoc,
|
|
27
28
|
loadComponentDoc,
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
ComponentAmbiguityError,
|
|
30
31
|
installedComponentPackageVersion,
|
|
31
32
|
resolveComponentReplacement,
|
|
33
|
+
unscopedComponentOwners,
|
|
32
34
|
} from './_adapter.mjs';
|
|
33
35
|
import {componentList} from './list/list.mjs';
|
|
34
36
|
import {componentDetail} from './detail/detail.mjs';
|
|
@@ -481,12 +483,14 @@ export async function component(name, options = {}) {
|
|
|
481
483
|
});
|
|
482
484
|
}
|
|
483
485
|
|
|
486
|
+
// The owner rule runs first, over valid and invalid owners alike.
|
|
487
|
+
const ruled = unscopedComponentOwners(owners);
|
|
484
488
|
// Invalid integration metadata does not create ambiguity against a valid
|
|
485
|
-
// owner. Keep
|
|
489
|
+
// owner. Keep ruled owners only when no doc owner is valid, so an integration-
|
|
486
490
|
// only component still exposes its source and returns ERR_INVALID_DOC for
|
|
487
491
|
// detail instead of degrading to an unrelated unknown-component error.
|
|
488
492
|
const validOwners = [];
|
|
489
|
-
for (const owner of
|
|
493
|
+
for (const owner of ruled) {
|
|
490
494
|
if (owner.package === CORE_PACKAGE) {
|
|
491
495
|
validOwners.push(owner);
|
|
492
496
|
continue;
|
|
@@ -498,7 +502,12 @@ export async function component(name, options = {}) {
|
|
|
498
502
|
// Project/Doctor report invalid metadata; it is not an effective owner.
|
|
499
503
|
}
|
|
500
504
|
}
|
|
501
|
-
const
|
|
505
|
+
const loadable = validOwners.length > 0 ? validOwners : ruled;
|
|
506
|
+
// A legacy docs package's exact doc keeps its name over an export name a doc
|
|
507
|
+
// records, as Core and file-named owners do.
|
|
508
|
+
const effectiveOwners = legacyExternalKeeps(cwd, dirName, loadable)
|
|
509
|
+
? []
|
|
510
|
+
: loadable;
|
|
502
511
|
|
|
503
512
|
// ── Ambiguity: owned by MORE THAN ONE valid package, no --package ──
|
|
504
513
|
assertUnambiguousOwners(effectiveOwners, dirName);
|