@astryxdesign/cli 0.7.11-canary.3bbab18 → 0.7.11-canary.4e6e67d

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.
@@ -707,7 +707,12 @@ function exportOriginsOf(file, read) {
707
707
  for (const node of declarations) {
708
708
  for (const name of declaredNames(node.declaration, types)) {
709
709
  named.add(name);
710
- if (!origins.has(name)) origins.set(name, {file, name});
710
+ if (!origins.has(name)) {
711
+ origins.set(
712
+ name,
713
+ declaredOrigin(ast, file, node.declaration, name, types),
714
+ );
715
+ }
711
716
  }
712
717
  }
713
718
  for (const [exportName, entries] of specifiers) {
@@ -1211,7 +1216,15 @@ function exportOrigin(file, exportName, seen, read, types = false) {
1211
1216
  const {declarations, specifiers} = namedExportIndex(ast.program, types, read);
1212
1217
  for (const node of declarations) {
1213
1218
  if (declarationExports(node.declaration, exportName, types)) {
1214
- return {file, name: exportName};
1219
+ return declaredOrigin(
1220
+ ast,
1221
+ file,
1222
+ node.declaration,
1223
+ exportName,
1224
+ types,
1225
+ seen,
1226
+ read,
1227
+ );
1215
1228
  }
1216
1229
  }
1217
1230
  for (const {node, specifier} of specifiers.get(exportName) ?? []) {
@@ -1690,6 +1703,48 @@ export function elementPropOrigins(file, {sources, name, prop, unwrap}) {
1690
1703
  return origins;
1691
1704
  }
1692
1705
 
1706
+ /**
1707
+ * Where a declared export is defined. An `export const X = Y` whose value is
1708
+ * another binding is that binding, so an alias of an imported value has the
1709
+ * imported value's origin.
1710
+ * @param {any} ast
1711
+ * @param {string} file
1712
+ * @param {any} declaration
1713
+ * @param {string} name
1714
+ * @param {boolean} types
1715
+ * @param {Set<string>} [seen]
1716
+ * @param {(node: any, type: string) => readonly any[]} [read]
1717
+ * @returns {{file: string, name: string}}
1718
+ */
1719
+ function declaredOrigin(
1720
+ ast,
1721
+ file,
1722
+ declaration,
1723
+ name,
1724
+ types,
1725
+ seen = new Set(),
1726
+ read = nodesOfType,
1727
+ ) {
1728
+ if (
1729
+ declaration?.type === 'VariableDeclaration' &&
1730
+ declaration.kind === 'const'
1731
+ ) {
1732
+ for (const declarator of declaration.declarations) {
1733
+ if (
1734
+ declarator.id?.type === 'Identifier' &&
1735
+ declarator.id.name === name &&
1736
+ declarator.init?.type === 'Identifier'
1737
+ ) {
1738
+ const init = declarator.init.name;
1739
+ return (
1740
+ bindingOrigin(ast, file, init, seen, types, read) ?? {file, name}
1741
+ );
1742
+ }
1743
+ }
1744
+ }
1745
+ return {file, name};
1746
+ }
1747
+
1693
1748
  /**
1694
1749
  * Where a top-level binding of a parsed module comes from: an import from a
1695
1750
  * local module is followed to its origin; anything else is declared here.
@@ -166,7 +166,8 @@ export function discoverExternalPackages(startDir?: string): {
166
166
  }[];
167
167
  /**
168
168
  * List available component directories in packages/core/src.
169
- * Returns directory names that contain Astryx*.tsx files.
169
+ * Component directories are capitalized (`Button`, `Dialog`); lowercase
170
+ * directories hold shared infrastructure and are never listed.
170
171
  * @param {string} coreDir
171
172
  */
172
173
  export function listComponents(coreDir: string): string[];
@@ -854,7 +854,8 @@ export function discoverExternalPackages(startDir = process.cwd()) {
854
854
 
855
855
  /**
856
856
  * List available component directories in packages/core/src.
857
- * Returns directory names that contain Astryx*.tsx files.
857
+ * Component directories are capitalized (`Button`, `Dialog`); lowercase
858
+ * directories hold shared infrastructure and are never listed.
858
859
  * @param {string} coreDir
859
860
  */
860
861
  export function listComponents(coreDir) {
@@ -865,9 +866,7 @@ export function listComponents(coreDir) {
865
866
  return entries
866
867
  .filter(e => {
867
868
  if (!e.isDirectory()) return false;
868
- // Skip non-component dirs
869
- if (['hooks', 'theme', 'utils'].includes(e.name)) return false;
870
- return true;
869
+ return /^[A-Z]/.test(e.name);
871
870
  })
872
871
  .map(e => e.name)
873
872
  .sort();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.11-canary.3bbab18",
3
+ "version": "0.7.11-canary.4e6e67d",
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.11-canary.3bbab18"
127
+ "@astryxdesign/core": "0.7.11-canary.4e6e67d"
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.11-canary.3bbab18",
136
- "@astryxdesign/core": "0.7.11-canary.3bbab18",
137
- "@astryxdesign/lab": "0.7.11-canary.3bbab18",
138
- "@astryxdesign/theme-neutral": "0.7.11-canary.3bbab18",
135
+ "@astryxdesign/charts": "0.7.11-canary.4e6e67d",
136
+ "@astryxdesign/core": "0.7.11-canary.4e6e67d",
137
+ "@astryxdesign/lab": "0.7.11-canary.4e6e67d",
138
+ "@astryxdesign/theme-neutral": "0.7.11-canary.4e6e67d",
139
139
  "@heroicons/react": "^2.2.0",
140
140
  "@stylexjs/stylex": "^0.19.0",
141
141
  "@types/babel__core": "^7.20.5",