Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

Icon sets: reuse topLevel for module declarations; shorten the look-refresh comment (#10449)

Joey3df65bfa2b4a
diff --git a/.changeset/cli-icon-set-reader-tidy.md b/.changeset/cli-icon-set-reader-tidy.md
new file mode 100644
index 0000000000..c737540688
--- /dev/null
+++ b/.changeset/cli-icon-set-reader-tidy.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[chore] Internal: the icon-set export reader reuses the shared top-level helper, and a source comment on look refreshes is shorter. No change to any command's output.
+
+@josephfarina
diff --git a/packages/cli/api/icon/_authoring.mjs b/packages/cli/api/icon/_authoring.mjs
index 4e96aaecab..c6504b9e69 100644
--- a/packages/cli/api/icon/_authoring.mjs
+++ b/packages/cli/api/icon/_authoring.mjs
@@ -992,13 +992,9 @@ async function refreshIconSet(
const bySource = new Map(
supplied.map(icon => [origins.get(icon.export)?.source, icon]),
);
- // A library that draws each icon in several looks gives one icon per
- // glyph. A look the set already wraps keeps its icon as it is (a set an
- // earlier release wrapped one look at a time keeps every icon and id);
- // only a glyph the set has no look of comes in once, in the look the
- // set's default variant or the library's usual default prefers. A new
- // default variant moves each glyph's own icon to the look it names, so
- // its export draws the default; the icon keeps its id, name and fields.
+ // One icon per glyph. A look the set already wraps keeps its icon and id.
+ // A new glyph comes in once, in the preferred look. A new default variant
+ // moves each glyph's icon to that look.
const preferred = looks?.default ?? current;
const {icons: looksOf} = libraryLooks(
everyIcon,
diff --git a/packages/cli/foundation/discovery/module-exports.mjs b/packages/cli/foundation/discovery/module-exports.mjs
index 9e640129ef..1cc294a403 100644
--- a/packages/cli/foundation/discovery/module-exports.mjs
+++ b/packages/cli/foundation/discovery/module-exports.mjs
@@ -181,9 +181,7 @@ function nodesOfType(node, type) {
* @returns {readonly any[]}
*/
function moduleDeclarations(program, type) {
- return cachedNodes(program, `top\0${type}`, () =>
- program.body.filter((/** @type {any} */ each) => each.type === type),
- );
+ return cachedNodes(program, `top\0${type}`, () => topLevel(program, type));
}
/**