@astryxdesign/cli 0.7.10-canary.010db3f → 0.7.10-canary.1194070
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.
|
@@ -381,6 +381,22 @@ export function familyMember(docs, name) {
|
|
|
381
381
|
* @returns {Record<string, string[]>}
|
|
382
382
|
*/
|
|
383
383
|
export function discoverComponents(coreDir) {
|
|
384
|
+
// The component matcher calls this for each name it resolves, so one
|
|
385
|
+
// operation reads the docs once. Each caller gets its own copy to change.
|
|
386
|
+
const found = oncePerListing(`components\0${coreDir}`, () =>
|
|
387
|
+
readComponentGroups(coreDir),
|
|
388
|
+
);
|
|
389
|
+
return Object.fromEntries(
|
|
390
|
+
Object.entries(found).map(([key, names]) => [key, [...names]]),
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* The component groups under `coreDir`, read from disk.
|
|
396
|
+
* @param {string} coreDir
|
|
397
|
+
* @returns {Record<string, string[]>}
|
|
398
|
+
*/
|
|
399
|
+
function readComponentGroups(coreDir) {
|
|
384
400
|
const srcDir = path.join(coreDir, 'src');
|
|
385
401
|
/** @type {Map<string, string|null>} componentName → group */
|
|
386
402
|
const componentGroups = new Map();
|
|
@@ -58,7 +58,9 @@ export function findClosestComponents(name, components, maxDistance = 3) {
|
|
|
58
58
|
*/
|
|
59
59
|
export async function searchComponents(needle, coreDir, components) {
|
|
60
60
|
const {readDocView} = await import('../doc-compiler/read.mjs');
|
|
61
|
-
const
|
|
61
|
+
const {listDirEntries, oncePerListing, pathExists} = await import(
|
|
62
|
+
'../fs/listing-cache.mjs'
|
|
63
|
+
);
|
|
62
64
|
const path = await import('node:path');
|
|
63
65
|
|
|
64
66
|
const term = needle.toLowerCase();
|
|
@@ -111,32 +113,30 @@ export async function searchComponents(needle, coreDir, components) {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
// --- Pass 2: Keyword + description matching (async, reads doc files) ---
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
const srcDir = path.join(coreDir, 'src');
|
|
117
|
+
/**
|
|
118
|
+
* The doc that Pass 2 reads for `comp`, or null.
|
|
119
|
+
* @param {string} comp
|
|
120
|
+
* @returns {string | null}
|
|
121
|
+
*/
|
|
122
|
+
function docPathOf(comp) {
|
|
118
123
|
const direct = path.join(srcDir, comp, comp + '.doc.mjs');
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (!
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
if (pathExists(direct)) return direct;
|
|
125
|
+
const xdsDirect = path.join(srcDir, comp, 'XDS' + comp + '.doc.mjs');
|
|
126
|
+
if (pathExists(xdsDirect)) return xdsDirect;
|
|
127
|
+
if (!pathExists(srcDir)) return null;
|
|
128
|
+
for (const entry of listDirEntries(srcDir)) {
|
|
129
|
+
if (!entry.isDirectory()) continue;
|
|
130
|
+
const nested = path.join(srcDir, entry.name, comp, comp + '.doc.mjs');
|
|
131
|
+
if (pathExists(nested)) return nested;
|
|
127
132
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
// Each search probes the same paths, so one operation finds each doc once.
|
|
136
|
+
for (const comp of allNames) {
|
|
137
|
+
const docPath = oncePerListing(`search-doc\0${srcDir}\0${comp}`, () =>
|
|
138
|
+
docPathOf(comp),
|
|
139
|
+
);
|
|
140
140
|
if (!docPath) continue;
|
|
141
141
|
|
|
142
142
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.10-canary.
|
|
3
|
+
"version": "0.7.10-canary.1194070",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"zod": "^4.4.3"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
|
-
"@astryxdesign/core": "0.7.10-canary.
|
|
127
|
+
"@astryxdesign/core": "0.7.10-canary.1194070"
|
|
128
128
|
},
|
|
129
129
|
"peerDependenciesMeta": {
|
|
130
130
|
"@astryxdesign/core": {
|
|
@@ -132,10 +132,10 @@
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
"devDependencies": {
|
|
135
|
-
"@astryxdesign/charts": "0.7.10-canary.
|
|
136
|
-
"@astryxdesign/core": "0.7.10-canary.
|
|
137
|
-
"@astryxdesign/lab": "0.7.10-canary.
|
|
138
|
-
"@astryxdesign/theme-neutral": "0.7.10-canary.
|
|
135
|
+
"@astryxdesign/charts": "0.7.10-canary.1194070",
|
|
136
|
+
"@astryxdesign/core": "0.7.10-canary.1194070",
|
|
137
|
+
"@astryxdesign/lab": "0.7.10-canary.1194070",
|
|
138
|
+
"@astryxdesign/theme-neutral": "0.7.10-canary.1194070",
|
|
139
139
|
"@heroicons/react": "^2.2.0",
|
|
140
140
|
"@stylexjs/stylex": "^0.19.0",
|
|
141
141
|
"@types/babel__core": "^7.20.5",
|