Skip to content

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

TypeScript

fix(cli): generate bare IconRegistry/DefinedTheme type imports in theme build (#3024)

EJ Hammond71e3daabfd51
diff --git a/.changeset/cli-generated-types-astryx.md b/.changeset/cli-generated-types-astryx.md
new file mode 100644
index 0000000000..5191fea7ee
--- /dev/null
+++ b/.changeset/cli-generated-types-astryx.md
@@ -0,0 +1,11 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[fix] `theme build` generates valid bare type imports (IconRegistry/DefinedTheme)
+@ejhammond
+
+`astryx theme build` emitted `.d.ts` files importing `XDSIconRegistry` /
+`XDSDefinedTheme` from `@xds/core`, but those aliases were removed — the
+generated types failed to resolve. Generate `IconRegistry` / `DefinedTheme`
+(the bare names `@xds/core` now exports) instead.
diff --git a/packages/cli/src/commands/build-theme.mjs b/packages/cli/src/commands/build-theme.mjs
index 1b3b8d15e6..e9344d998f 100644
--- a/packages/cli/src/commands/build-theme.mjs
+++ b/packages/cli/src/commands/build-theme.mjs
@@ -250,7 +250,7 @@ const THEME_SCOPE_TO = `[data-astryx-theme]`;
/**
* Import a theme module using jiti and find the defineTheme() result.
- * Returns the resolved XDSDefinedTheme object.
+ * Returns the resolved DefinedTheme object.
*/
async function importThemeModule(filePath) {
const jiti = createJiti(import.meta.url, {
@@ -417,12 +417,12 @@ ${iconReExport}`;
*/
function generateBuiltTypes(themeDef, iconInfo) {
const iconType = iconInfo
- ? `import type { XDSIconRegistry } from '@astryxdesign/core/Icon';
-export declare const ${iconInfo.exportName}: XDSIconRegistry;
+ ? `import type { IconRegistry } from '@astryxdesign/core/Icon';
+export declare const ${iconInfo.exportName}: IconRegistry;
`
: '';
- return `import type { XDSDefinedTheme } from '@astryxdesign/core/theme';
-${iconType}export declare const ${toIdentifier(themeDef.name)}Theme: XDSDefinedTheme;
+ return `import type { DefinedTheme } from '@astryxdesign/core/theme';
+${iconType}export declare const ${toIdentifier(themeDef.name)}Theme: DefinedTheme;
`;
}