@astryxdesign/cli 0.6.5 → 0.6.6

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.
Files changed (217) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +16 -15
  3. package/api/build/_adapter.d.mts +50 -2
  4. package/api/build/_adapter.mjs +98 -10
  5. package/api/build/build.doc.mjs +2 -2
  6. package/api/build/build.test.mjs +111 -2
  7. package/api/build/kit/kit.mjs +98 -22
  8. package/api/build/kit/rank.d.mts +32 -8
  9. package/api/build/kit/rank.mjs +291 -97
  10. package/api/build/kit/rank.test.mjs +231 -48
  11. package/api/build/kit/weights.d.mts +82 -0
  12. package/api/build/kit/weights.json +1 -0
  13. package/api/build/kit/weights.mjs +305 -0
  14. package/api/build/kit/weights.test.mjs +190 -0
  15. package/api/docs/docs.d.mts +6 -0
  16. package/api/docs/docs.depth.test.mjs +132 -0
  17. package/api/docs/docs.doc.mjs +31 -2
  18. package/api/docs/docs.mjs +44 -1
  19. package/api/docs/docs.test.mjs +279 -0
  20. package/api/docs/docs.type.d.mts +38 -1
  21. package/api/docs/docs.type.mjs +18 -1
  22. package/api/docs/integration-tree.test.mjs +572 -0
  23. package/api/docs/integrationDocs.test.mjs +336 -0
  24. package/api/docs/node/node.d.mts +28 -3
  25. package/api/docs/node/node.mjs +146 -23
  26. package/api/error.d.mts +22 -0
  27. package/api/error.mjs +42 -0
  28. package/api/gap-report/gap-report.d.mts +3 -1
  29. package/api/gap-report/gap-report.mjs +12 -2
  30. package/api/gap-report/gap-report.test.mjs +106 -0
  31. package/api/hook/list/list.d.mts +1 -1
  32. package/api/integration/add-contribution.d.mts +2 -1
  33. package/api/integration/add-contribution.mjs +7 -3
  34. package/api/integration/add-contribution.test.mjs +3 -3
  35. package/api/integration/add-theme.mjs +338 -26
  36. package/api/integration/add-theme.test.mjs +314 -1
  37. package/api/integration/authoring-checks.mjs +10 -7
  38. package/api/integration/authoring-checks.type.d.mts +8 -0
  39. package/api/integration/authoring-checks.type.mjs +7 -3
  40. package/api/integration/integration-authoring.type.d.mts +4 -1
  41. package/api/integration/integration-authoring.type.mjs +6 -1
  42. package/api/integration/integrationAdd.doc.mjs +6 -0
  43. package/api/integration/integrationAddTheme.doc.mjs +10 -0
  44. package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
  45. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  46. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
  47. package/api/integration/pack-check.mjs +12 -3
  48. package/api/integration/pack-check.test.mjs +52 -3
  49. package/api/integration/validate-integration.d.mts +4 -2
  50. package/api/integration/validate-integration.mjs +7 -2
  51. package/api/integration/validate-integration.test.mjs +55 -0
  52. package/api/integration/validate-integration.type.d.mts +5 -0
  53. package/api/integration/validate-integration.type.mjs +5 -1
  54. package/api/integration/validateIntegration.doc.mjs +1 -1
  55. package/api/layout/expand/expand.mjs +12 -7
  56. package/api/layout/expand/expand.receipt.test.mjs +74 -0
  57. package/api/layout/layout.type.d.mts +1 -0
  58. package/api/layout/layout.type.mjs +1 -0
  59. package/api/layout/layoutExpand.doc.mjs +1 -1
  60. package/api/search/search.d.mts +36 -5
  61. package/api/search/search.doc.mjs +4 -4
  62. package/api/search/search.mjs +194 -54
  63. package/api/search/search.test.mjs +825 -0
  64. package/api/search/search.type.d.mts +5 -5
  65. package/api/search/search.type.mjs +5 -5
  66. package/api/swizzle/copy/copy.mjs +66 -3
  67. package/api/swizzle/swizzle.doc.mjs +4 -0
  68. package/api/template/copy/copy.mjs +14 -8
  69. package/api/template/copy/copy.receipt.test.mjs +77 -0
  70. package/api/template/show/show.mjs +15 -4
  71. package/api/template/show/show.test.mjs +76 -0
  72. package/api/template/template-integration.test.mjs +14 -0
  73. package/api/template/template.d.mts +1 -1
  74. package/api/template/template.doc.mjs +6 -2
  75. package/api/template/template.mjs +1 -0
  76. package/api/template/template.type.d.mts +2 -0
  77. package/api/template/template.type.mjs +2 -0
  78. package/api/theme/build/build.d.mts +24 -0
  79. package/api/theme/build/build.icon-lineage.test.mjs +117 -0
  80. package/api/theme/build/build.icon-preservation.test.mjs +639 -0
  81. package/api/theme/build/build.mjs +381 -77
  82. package/api/theme/build/build.project-core.test.mjs +165 -0
  83. package/api/theme/build/build.test.mjs +190 -1
  84. package/api/theme/build/icon-imports.d.mts +47 -0
  85. package/api/theme/build/icon-imports.mjs +691 -0
  86. package/api/theme/themeBuild.doc.d.mts +4 -1
  87. package/api/theme/themeBuild.doc.mjs +14 -3
  88. package/api/upgrade/run/run.mjs +20 -3
  89. package/api/upgrade/run/run.test.mjs +45 -1
  90. package/api/upgrade/upgrade.doc.mjs +1 -1
  91. package/api/upgrade/upgrade.type.d.mts +1 -0
  92. package/api/upgrade/upgrade.type.mjs +1 -0
  93. package/assets/docs/icons.doc.mjs +1 -0
  94. package/assets/docs/theme.doc.mjs +3 -2
  95. package/assets/docs/tokens.doc.mjs +3 -3
  96. package/assets/docs/tree/add-a-theme.doc.mjs +4 -0
  97. package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
  98. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  99. package/assets/docs/tree/checks.doc.mjs +1 -1
  100. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  101. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  102. package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
  103. package/assets/docs/tree/template-doc-overview.doc.mjs +13 -1
  104. package/assets/docs/tree/troubleshooting.doc.mjs +9 -5
  105. package/assets/docs/tree/versioning.doc.mjs +7 -6
  106. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
  107. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
  108. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
  109. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
  110. package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
  111. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
  112. package/assets/templates/pages/blank/template.doc.mjs +3 -1
  113. package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
  114. package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
  115. package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
  116. package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
  117. package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
  118. package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
  119. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
  120. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
  121. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
  122. package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
  123. package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
  124. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
  125. package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
  126. package/assets/templates/pages/documentation/template.doc.mjs +10 -1
  127. package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
  128. package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
  129. package/assets/templates/pages/editor/template.doc.mjs +9 -1
  130. package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
  131. package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
  132. package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
  133. package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
  134. package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
  135. package/assets/templates/pages/ide/template.doc.mjs +9 -1
  136. package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
  137. package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
  138. package/assets/templates/pages/library/template.doc.mjs +15 -1
  139. package/assets/templates/pages/login/template.doc.mjs +10 -1
  140. package/assets/templates/pages/login-card/template.doc.mjs +11 -1
  141. package/assets/templates/pages/login-split/template.doc.mjs +10 -1
  142. package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
  143. package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
  144. package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
  145. package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
  146. package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
  147. package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
  148. package/assets/templates/pages/settings/template.doc.mjs +3 -1
  149. package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
  150. package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
  151. package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
  152. package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
  153. package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
  154. package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
  155. package/assets/templates/pages/table/template.doc.mjs +11 -1
  156. package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
  157. package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
  158. package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
  159. package/assets/templates/pages/table-page/template.doc.mjs +20 -1
  160. package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
  161. package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
  162. package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
  163. package/assets/templates/themes/butter/icons.tsx +2 -0
  164. package/assets/templates/themes/chocolate/icons.tsx +2 -0
  165. package/assets/templates/themes/gothic/icons.tsx +2 -0
  166. package/assets/templates/themes/matcha/icons.tsx +2 -0
  167. package/assets/templates/themes/neutral/icons.tsx +2 -0
  168. package/assets/templates/themes/stone/icons.tsx +2 -0
  169. package/assets/templates/themes/y2k/icons.tsx +2 -0
  170. package/authoring/doctypes/template/parse.d.mts +2 -0
  171. package/authoring/doctypes/template/parse.mjs +1 -0
  172. package/authoring/doctypes/template/parse.test.mjs +21 -0
  173. package/authoring/doctypes/template/template.doc.mjs +6 -0
  174. package/authoring/doctypes/template/type.ts +10 -0
  175. package/clients/cli/commands/build-theme.mjs +8 -2
  176. package/clients/cli/commands/discover.mjs +29 -1
  177. package/clients/cli/commands/discover.no-source.test.mjs +75 -0
  178. package/clients/cli/commands/docs.depth.test.mjs +219 -0
  179. package/clients/cli/commands/docs.doc.mjs +15 -2
  180. package/clients/cli/commands/docs.mjs +222 -5
  181. package/clients/cli/commands/docs.test.mjs +383 -0
  182. package/clients/cli/commands/doctor.mjs +4 -4
  183. package/clients/cli/commands/gap-report.mjs +12 -0
  184. package/clients/cli/commands/gap-report.test.mjs +63 -0
  185. package/clients/cli/commands/integration-add.doc.mjs +10 -0
  186. package/clients/cli/commands/integration-authoring.test.mjs +12 -2
  187. package/clients/cli/commands/integration.mjs +3 -1
  188. package/clients/cli/commands/layout-expand.doc.mjs +3 -1
  189. package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
  190. package/clients/cli/commands/layout.mjs +16 -0
  191. package/clients/cli/commands/search.doc.mjs +5 -4
  192. package/clients/cli/commands/search.mjs +30 -6
  193. package/clients/cli/commands/search.test.mjs +60 -16
  194. package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
  195. package/clients/cli/commands/template.mjs +19 -5
  196. package/clients/cli/commands/template.show-media.test.mjs +62 -0
  197. package/clients/cli/commands/theme-list.behavior.test.mjs +41 -0
  198. package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
  199. package/clients/cli/commands/write-failure.test.mjs +175 -0
  200. package/clients/cli/lib/manifest.mjs +44 -165
  201. package/clients/cli/lib/manifest.test.mjs +98 -7
  202. package/foundation/agent-docs/agent-docs.mjs +2 -1
  203. package/foundation/agent-docs/agent-docs.test.mjs +1168 -0
  204. package/foundation/discovery/template-adapter.d.mts +14 -0
  205. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
  206. package/foundation/discovery/template-adapter.mjs +21 -1
  207. package/foundation/discovery/theme-discovery.d.mts +6 -0
  208. package/foundation/discovery/theme-discovery.mjs +9 -0
  209. package/foundation/doc-compiler/doc-loads.test.mjs +3 -3
  210. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  211. package/foundation/doc-compiler/tree.test.mjs +649 -0
  212. package/foundation/integrations/cli-requirement.d.mts +57 -13
  213. package/foundation/integrations/cli-requirement.mjs +84 -22
  214. package/foundation/integrations/cli-requirement.test.mjs +135 -8
  215. package/foundation/response/response-types.doc.d.mts +5 -5
  216. package/foundation/response/response-types.doc.mjs +13 -13
  217. package/package.json +1 -1
@@ -2,6 +2,9 @@
2
2
 
3
3
  /**
4
4
  * @file theme build API — compile standalone themes or one selected family.
5
+ * @input JS/TS theme modules, build/check options, and the installed Core.
6
+ * @output Generated artifacts preserving imported and inherited icon registries.
7
+ * @position CLI theme compiler; standalone icon provenance is icon-imports.mjs.
5
8
  *
6
9
  * `themeBuild` and `themeBuildFamily` share the same loader, compiler,
7
10
  * serializers, check, and writer. They read defineTheme() sources and, via
@@ -12,11 +15,14 @@
12
15
  * - A .d.ts (plus an optional .variants.d.ts for custom prop values)
13
16
  *
14
17
  * It performs the writes and returns a `theme.build` receipt — its `warnings`
15
- * carry override problems, every declaration core's generator dropped because
16
- * its value could not stay one CSS declaration, and any fonts the theme names
17
- * but does not load (font-warning.mjs) — or `null` when the theme produced no
18
- * CSS (nothing to build). Errors throw AstryxError (with
19
- * a stable code). Human progress is emitted through the shared `logger`
18
+ * carry override problems and every declaration core's generator dropped
19
+ * because its value could not stay one CSS declaration; `notices` carry fonts
20
+ * the theme names but does not load (font-warning.mjs) — or `null` when the
21
+ * theme produced no CSS (nothing to build). Standalone icon imports come from
22
+ * the selected theme's parsed bindings and inheritance, never from comment or
23
+ * string contents. A registry that cannot be preserved fails before output
24
+ * generation, including in check mode. Errors throw AstryxError (with a stable
25
+ * code). Human progress is emitted through the shared `logger`
20
26
  * (silent by default), so the CLI keeps its exact output while a programmatic
21
27
  * caller stays quiet.
22
28
  *
@@ -45,7 +51,11 @@ import {fileURLToPath, pathToFileURL} from 'node:url';
45
51
  import {parse} from '@babel/parser';
46
52
  import {createJiti} from 'jiti';
47
53
  import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
48
- import {CLI_ROOT, findCoreDir} from '../../../foundation/fs/paths.mjs';
54
+ import {
55
+ CLI_ROOT,
56
+ findCoreDir,
57
+ findInstalledPackage,
58
+ } from '../../../foundation/fs/paths.mjs';
49
59
  import {
50
60
  assertWithin,
51
61
  sanitizeName,
@@ -63,6 +73,7 @@ import {
63
73
  import {collectUnloadedFonts, formatFontLoadingHelp} from './font-warning.mjs';
64
74
  import {interceptCore} from './core-interception.mjs';
65
75
  import {generateFamilyCSS, resolveThemeFamily} from './family.mjs';
76
+ import {resolveIconImports} from './icon-imports.mjs';
66
77
 
67
78
  // Import shared theme processing from core. `astryx theme build` MUST produce the
68
79
  // exact same CSS as the `<Theme>` runtime, so it has exactly one generation
@@ -125,6 +136,232 @@ try {
125
136
  _coreImportError = e;
126
137
  }
127
138
 
139
+ /**
140
+ * The bindings one Core provides: the namespaces interception spreads, the
141
+ * functions the build calls, and why the import failed, if it did.
142
+ * @typedef {{
143
+ * themeModule: any,
144
+ * rootModule: any,
145
+ * importError: any,
146
+ * defineTheme: any,
147
+ * generateThemeRulesSplit: any,
148
+ * generateOnMediaCSS: any,
149
+ * generateAdaptationCSS: any,
150
+ * dataTokenDefaults: any,
151
+ * }} CoreBindings
152
+ */
153
+
154
+ /**
155
+ * The bindings exactly as the CLI's own import left them, kept so each build
156
+ * can choose between them and the project's installed Core.
157
+ * @type {CoreBindings}
158
+ */
159
+ const _cliCore = {
160
+ themeModule: _coreThemeModule,
161
+ rootModule: _coreRootModule,
162
+ importError: _coreImportError,
163
+ defineTheme: _defineTheme,
164
+ generateThemeRulesSplit: _generateThemeRulesSplit,
165
+ generateOnMediaCSS: _generateOnMediaCSS,
166
+ generateAdaptationCSS: _generateAdaptationCSS,
167
+ dataTokenDefaults: _dataTokenDefaults,
168
+ };
169
+
170
+ /**
171
+ * Point the build at one Core: the module-level bindings every step reads.
172
+ * @param {CoreBindings} core
173
+ */
174
+ function setCore(core) {
175
+ _coreThemeModule = core.themeModule;
176
+ _coreRootModule = core.rootModule;
177
+ _coreImportError = core.importError;
178
+ _defineTheme = core.defineTheme;
179
+ _generateThemeRulesSplit = core.generateThemeRulesSplit;
180
+ _generateOnMediaCSS = core.generateOnMediaCSS;
181
+ _generateAdaptationCSS = core.generateAdaptationCSS;
182
+ _dataTokenDefaults = core.dataTokenDefaults;
183
+ }
184
+
185
+ /**
186
+ * The file an `import` of `subpath` reaches through a package's `exports` map,
187
+ * or null when the map has no entry for it. Conditions are taken in the map's
188
+ * own order, as Node does, accepting the ones an import matches here: `node`,
189
+ * `import`, and `default` (so `source` and `types` are skipped).
190
+ *
191
+ * @param {string} dir - The package directory.
192
+ * @param {string} subpath - `'.'` or a subpath such as `'./theme'`.
193
+ * @returns {string|null}
194
+ */
195
+ function importTarget(dir, subpath) {
196
+ let pkg;
197
+ try {
198
+ pkg = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));
199
+ } catch {
200
+ return null;
201
+ }
202
+ const map = pkg?.exports;
203
+ const bySubpath =
204
+ map &&
205
+ typeof map === 'object' &&
206
+ !Array.isArray(map) &&
207
+ Object.keys(map).some(key => key.startsWith('.'));
208
+ const entry = bySubpath ? map[subpath] : subpath === '.' ? map : undefined;
209
+ /** @param {any} value @returns {string|null} */
210
+ const pick = value => {
211
+ if (typeof value === 'string') return value;
212
+ if (!value || typeof value !== 'object' || Array.isArray(value))
213
+ return null;
214
+ for (const [condition, target] of Object.entries(value)) {
215
+ if (
216
+ condition !== 'node' &&
217
+ condition !== 'import' &&
218
+ condition !== 'default'
219
+ )
220
+ continue;
221
+ const picked = pick(target);
222
+ if (picked) return picked;
223
+ }
224
+ return null;
225
+ };
226
+ const target = pick(entry);
227
+ return target ? path.resolve(dir, target) : null;
228
+ }
229
+
230
+ /** @param {string} file @returns {string} its real path, or itself */
231
+ function realOrSelf(file) {
232
+ try {
233
+ return fs.realpathSync(file);
234
+ } catch {
235
+ return file;
236
+ }
237
+ }
238
+
239
+ /**
240
+ * The Core the project at `cwd` installed, when it differs from the one the
241
+ * CLI's own import found and loads. The app's `<Theme>` runs on the app's
242
+ * Core, so building with it keeps the CSS identical; and a CLI run one-off
243
+ * (`npx @astryxdesign/cli`) has no Core beside it at all. Null when there is
244
+ * nothing better than the CLI's own import: no installed Core (the Astryx
245
+ * repository, a bare directory), the same Core, or one that does not load.
246
+ *
247
+ * @param {string} cwd
248
+ * @returns {Promise<CoreBindings | null>}
249
+ */
250
+ async function loadProjectCore(cwd) {
251
+ const dir = findInstalledPackage(cwd, '@astryxdesign/core');
252
+ const themeFile = dir ? importTarget(dir, './theme') : null;
253
+ if (!dir || !themeFile) return null;
254
+ if (_cliCore.themeModule) {
255
+ try {
256
+ const own = fileURLToPath(
257
+ import.meta.resolve('@astryxdesign/core/theme'),
258
+ );
259
+ if (realOrSelf(own) === realOrSelf(themeFile)) return null;
260
+ } catch {
261
+ // The CLI's own Core cannot be located; load the project's.
262
+ }
263
+ }
264
+ let themeModule;
265
+ try {
266
+ themeModule = await import(pathToFileURL(themeFile).href);
267
+ } catch {
268
+ return null;
269
+ }
270
+ if (!themeModule.defineTheme || !themeModule.generateThemeRulesSplit)
271
+ return null;
272
+ let rootModule = null;
273
+ const rootFile = importTarget(dir, '.');
274
+ if (rootFile) {
275
+ try {
276
+ rootModule = await import(pathToFileURL(rootFile).href);
277
+ } catch {
278
+ // As with the CLI's own import, the theme namespace stands in for it.
279
+ }
280
+ }
281
+ return {
282
+ themeModule,
283
+ rootModule,
284
+ importError: null,
285
+ defineTheme: themeModule.defineTheme,
286
+ generateThemeRulesSplit: themeModule.generateThemeRulesSplit,
287
+ generateOnMediaCSS: themeModule.generateOnMediaCSS,
288
+ generateAdaptationCSS: themeModule.generateAdaptationCSS,
289
+ dataTokenDefaults: themeModule.dataTokenDefaults,
290
+ };
291
+ }
292
+
293
+ /** @type {Map<string, Awaited<ReturnType<typeof loadProjectCore>>>} */
294
+ const _projectCores = new Map();
295
+
296
+ /**
297
+ * Choose the Core this build generates with: the project's installed one when
298
+ * {@link loadProjectCore} finds it, else the CLI's own.
299
+ * @param {string} cwd
300
+ */
301
+ async function selectCore(cwd) {
302
+ if (!_projectCores.has(cwd))
303
+ _projectCores.set(cwd, await loadProjectCore(cwd));
304
+ setCore(_projectCores.get(cwd) ?? _cliCore);
305
+ }
306
+
307
+ /**
308
+ * Whether `cwd` sits in the Astryx repository, where Core is built from
309
+ * source rather than installed.
310
+ * @param {string} cwd
311
+ */
312
+ function inAstryxRepository(cwd) {
313
+ let dir = cwd;
314
+ for (let i = 0; i < 6; i++) {
315
+ try {
316
+ const pkg = JSON.parse(
317
+ fs.readFileSync(
318
+ path.join(dir, 'packages', 'core', 'package.json'),
319
+ 'utf-8',
320
+ ),
321
+ );
322
+ if (pkg?.name === '@astryxdesign/core') return true;
323
+ } catch {
324
+ // Not here; keep walking up.
325
+ }
326
+ const parent = path.dirname(dir);
327
+ if (parent === dir) break;
328
+ dir = parent;
329
+ }
330
+ return false;
331
+ }
332
+
333
+ /**
334
+ * Why `theme build` has no Core to generate with, and the fix for where it
335
+ * ran: the Astryx repository builds Core, an app installs it, and an installed
336
+ * Core that will not load is named.
337
+ *
338
+ * @param {string} cwd
339
+ * @param {any} importError - Why the import failed, when it threw.
340
+ * @returns {string}
341
+ */
342
+ export function coreUnavailableMessage(cwd, importError) {
343
+ const why =
344
+ '`astryx theme build` generates CSS with @astryxdesign/core, the same code the runtime <Theme> uses';
345
+ const detail = importError ? `\n Import error: ${importError.message}` : '';
346
+ if (inAstryxRepository(cwd)) {
347
+ return (
348
+ `Could not load @astryxdesign/core/theme: ${why}. Build @astryxdesign/core ` +
349
+ `first (e.g. \`pnpm -F @astryxdesign/core build\`).${detail}`
350
+ );
351
+ }
352
+ const installed = findInstalledPackage(cwd, '@astryxdesign/core');
353
+ if (installed) {
354
+ return (
355
+ `Could not load the @astryxdesign/core installed at ` +
356
+ `${path.relative(cwd, installed) || '.'}: ${why}. Reinstall it.${detail}`
357
+ );
358
+ }
359
+ return (
360
+ `This project does not have @astryxdesign/core installed: ${why}. Install ` +
361
+ `it: \`npm install @astryxdesign/core\` (or yarn/pnpm/bun).${detail}`
362
+ );
363
+ }
364
+
128
365
  /**
129
366
  * Read a package's `version` from a resolved directory. Returns `'unknown'`
130
367
  * when it can't be read so the header always has a value.
@@ -1276,6 +1513,19 @@ async function validateRegistryGraphs(/** @type {Array<{specifier: string, expor
1276
1513
  if (!(root.exportName in exports)) throw registryGraphError(`Family registry ${root.file} does not export "${root.exportName}".`);
1277
1514
  }
1278
1515
  }
1516
+ /**
1517
+ * Resolve inherited source with exactly the loader's extension precedence.
1518
+ * This reads module locations only; icon discovery never executes a second load.
1519
+ * @param {string} specifier
1520
+ * @param {string} fromFile
1521
+ * @returns {string}
1522
+ */
1523
+ function resolveThemeModule(specifier, fromFile) {
1524
+ return createJiti(fromFile, {extensions: THEME_MODULE_EXTENSIONS}).resolve(
1525
+ specifier,
1526
+ );
1527
+ }
1528
+
1279
1529
  /**
1280
1530
  * Errors that mean "the synchronous loader cannot evaluate this module", as
1281
1531
  * opposed to "this module is broken". Only the former may fall back to the
@@ -1323,7 +1573,7 @@ function isSyncLoaderLimitation(error) {
1323
1573
  *
1324
1574
  * @param {string} filePath
1325
1575
  * @param {import('./core-interception.mjs').CoreInterception} [interception]
1326
- * @returns {Promise<{theme: any, degraded: {topLevelAwait: boolean, commonJs: boolean}}>}
1576
+ * @returns {Promise<{theme: any, exportName: string, degraded: {topLevelAwait: boolean, commonJs: boolean}}>}
1327
1577
  */
1328
1578
  // prettier-ignore
1329
1579
  async function importThemeModule(filePath, interception, /** @type {any} */ loader = undefined) {
@@ -1373,12 +1623,14 @@ async function importThemeModule(filePath, interception, /** @type {any} */ load
1373
1623
  mod = await jiti.import(filePath, {default: true});
1374
1624
  }
1375
1625
 
1376
- if (isThemeObject(mod)) return {theme: mod, degraded};
1626
+ if (isThemeObject(mod)) return {theme: mod, exportName: 'default', degraded};
1377
1627
 
1378
1628
  if (mod && typeof mod === 'object') {
1379
- if (isThemeObject(mod.default)) return {theme: mod.default, degraded};
1380
- for (const value of Object.values(mod)) {
1381
- if (isThemeObject(value)) return {theme: value, degraded};
1629
+ if (isThemeObject(mod.default)) {
1630
+ return {theme: mod.default, exportName: 'default', degraded};
1631
+ }
1632
+ for (const [exportName, value] of Object.entries(mod)) {
1633
+ if (isThemeObject(value)) return {theme: value, exportName, degraded};
1382
1634
  }
1383
1635
  }
1384
1636
 
@@ -1412,7 +1664,7 @@ function isThemeObject(value) {
1412
1664
  *
1413
1665
  * @param {string} filePath
1414
1666
  * @param {import('./core-interception.mjs').CoreInterception} [interception]
1415
- * @returns {Promise<{theme: any, degraded: {topLevelAwait: boolean, commonJs: boolean}}>}
1667
+ * @returns {Promise<{theme: any, exportName?: string, degraded: {topLevelAwait: boolean, commonJs: boolean}}>}
1416
1668
  */
1417
1669
  // prettier-ignore
1418
1670
  async function extractThemeDefinition(filePath, interception, /** @type {any} */ loader = undefined) {
@@ -1437,6 +1689,8 @@ async function extractThemeDefinition(filePath, interception, /** @type {any} */
1437
1689
  /**
1438
1690
  * Fallback extraction via regex + eval.
1439
1691
  * Only works for plain object literals — can't follow imports or variables.
1692
+ * Never erase icon references: an unresolved registry must preserve the loader
1693
+ * error instead of turning an incomplete theme into a successful build.
1440
1694
  * @param {string} filePath
1441
1695
  * @returns {any}
1442
1696
  */
@@ -1458,10 +1712,6 @@ function extractThemeDefinitionLegacy(filePath) {
1458
1712
 
1459
1713
  let objStr = defineMatch[1];
1460
1714
  objStr = objStr.replace(/\s+as\s+const/g, '');
1461
- objStr = objStr.replace(
1462
- /icons:\s*[a-zA-Z_][a-zA-Z0-9_]*/g,
1463
- 'icons: undefined',
1464
- );
1465
1715
 
1466
1716
  try {
1467
1717
  return eval(`(${objStr})`);
@@ -1476,30 +1726,19 @@ function extractThemeDefinitionLegacy(filePath) {
1476
1726
  }
1477
1727
 
1478
1728
  /**
1479
- * Extract icon import info from a theme source file.
1480
- * Returns { importPath, exportName } or null if no icons.
1729
+ * Extract a family member's named registry import from its source file.
1730
+ * Returns { importPath, exportName } or null when the theme names none.
1731
+ * Standalone builds resolve icons through `resolveIconImports` instead.
1481
1732
  *
1482
1733
  * Looks for patterns like:
1483
1734
  * import { defaultIconRegistry } from './icons';
1484
1735
  * icons: defaultIconRegistry,
1485
1736
  * @param {string} filePath
1737
+ * @param {'icons' | 'indicators'} field
1486
1738
  * @returns {{exportName: string, importPath: string} | null}
1487
1739
  */
1488
- function extractRegistryInfo(filePath, field = 'icons', familyMode = false) {
1740
+ function extractRegistryInfo(filePath, field) {
1489
1741
  const content = fs.readFileSync(filePath, 'utf8');
1490
- if (!familyMode) {
1491
- const fieldMatch = content.match(
1492
- new RegExp(`${field}:\\s*([a-zA-Z_][a-zA-Z0-9_]*)`),
1493
- );
1494
- if (!fieldMatch) return null;
1495
- const varName = fieldMatch[1];
1496
- const match = content.match(
1497
- new RegExp(
1498
- `import\\s*{[^}]*\\b${varName}\\b[^}]*}\\s*from\\s*['"]([^'"]+)['"]`,
1499
- ),
1500
- );
1501
- return match ? {exportName: varName, importPath: match[1]} : null;
1502
- }
1503
1742
  const defineIndex = content.indexOf('defineTheme(');
1504
1743
  if (defineIndex < 0) return null;
1505
1744
  const themeSource = content.slice(defineIndex);
@@ -1539,17 +1778,18 @@ function extractRegistryInfo(filePath, field = 'icons', familyMode = false) {
1539
1778
  * override it had.
1540
1779
  *
1541
1780
  * The icon registry is imported rather than inlined because it holds React
1542
- * elements, which cannot be serialized. `extractIconInfo` lifts the specifier
1543
- * out of the TypeScript source, where an extensionless `./icons` is resolved by
1781
+ * elements, which cannot be serialized. `resolveIconImports` reads actual
1782
+ * imports from the selected theme's source, where extensionless `./icons` uses
1544
1783
  * the TypeScript resolver — but the artifact here is ESM JavaScript, which
1545
1784
  * requires a fully specified path. Only the caller knows what its own build
1546
1785
  * will emit and under what name, so `iconsSpecifier` lets it say. When it is
1547
- * not given, the scraped specifier is emitted unchanged.
1786
+ * not given, direct registry specifiers are preserved, and inherited relative
1787
+ * imports are rebased from the base module to the theme entry's directory.
1548
1788
  *
1549
1789
  * @param {any} themeDef
1550
- * @param {{exportName: string, importPath: string} | null} iconInfo
1551
- * @param {string} [iconsSpecifier] - Overrides the scraped icon import specifier.
1552
- * @param {{themeBinding?: string, iconBinding?: string, iconsExpression?: string, indicatorsExpression?: string, artifactBaseName?: string, exportIcons?: boolean}} [moduleOptions]
1790
+ * @param {import('./icon-imports.mjs').IconImports | null} iconInfo
1791
+ * @param {string} [iconsSpecifier] - Overrides the selected registry specifier.
1792
+ * @param {{themeBinding?: string, iconsExpression?: string, indicatorsExpression?: string, artifactBaseName?: string, exportIcons?: boolean}} [moduleOptions]
1553
1793
  * @returns {string}
1554
1794
  */
1555
1795
  function generateBuiltModule(
@@ -1560,29 +1800,46 @@ function generateBuiltModule(
1560
1800
  ) {
1561
1801
  const themeBinding =
1562
1802
  moduleOptions.themeBinding ?? `${toIdentifier(themeDef.name)}Theme`;
1563
- const iconBinding = moduleOptions.iconBinding ?? iconInfo?.exportName;
1564
1803
  const artifactBaseName = moduleOptions.artifactBaseName ?? themeDef.name;
1565
1804
  const exportIcons = moduleOptions.exportIcons ?? true;
1566
- // Preserve the historical generated bytes when no override is supplied.
1567
- // User-provided specifiers need string-literal encoding so quotes and
1568
- // backslashes cannot produce invalid JavaScript.
1569
- const renderedSpecifier =
1570
- iconsSpecifier === undefined
1571
- ? `'${iconInfo?.importPath}'`
1572
- : JSON.stringify(iconsSpecifier);
1573
- const iconImport = iconInfo
1574
- ? `import { ${iconInfo.exportName}${iconBinding === iconInfo.exportName ? '' : ` as ${iconBinding}`} } from ${renderedSpecifier};\n`
1575
- : '';
1576
- const iconsExpression =
1577
- moduleOptions.iconsExpression ?? (iconInfo ? iconBinding : undefined);
1805
+ // Keep ordinary direct named imports byte-compatible, while encoding paths
1806
+ // with quotes/escapes and retaining default, namespace, and aliased bindings.
1807
+ const iconImport = (iconInfo?.imports ?? [])
1808
+ .map(({importPath, importedName, localName}) => {
1809
+ const overridden =
1810
+ iconsSpecifier !== undefined &&
1811
+ importPath === iconInfo?.iconsSpecifierImportPath &&
1812
+ localName === iconInfo?.iconsSpecifierLocalName;
1813
+ const specifier = overridden
1814
+ ? JSON.stringify(iconsSpecifier)
1815
+ : /['\\\r\n]/u.test(importPath)
1816
+ ? JSON.stringify(importPath)
1817
+ : `'${importPath}'`;
1818
+ const imported = /^[$\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u.test(
1819
+ importedName,
1820
+ )
1821
+ ? importedName
1822
+ : JSON.stringify(importedName);
1823
+ const binding =
1824
+ importedName === 'default'
1825
+ ? localName
1826
+ : importedName === '*'
1827
+ ? `* as ${localName}`
1828
+ : `{ ${imported}${importedName === localName ? '' : ` as ${localName}`} }`;
1829
+ return `import ${binding} from ${specifier};\n`;
1830
+ })
1831
+ .join('');
1832
+ const iconDeclaration =
1833
+ iconInfo && iconInfo.expression !== iconInfo.exportName
1834
+ ? `const ${iconInfo.exportName} = ${iconInfo.expression};\n`
1835
+ : '';
1836
+ const iconsExpression = moduleOptions.iconsExpression ?? iconInfo?.exportName;
1578
1837
  const iconsField = iconsExpression ? ` icons: ${iconsExpression},` : '';
1579
1838
  const indicatorsField = moduleOptions.indicatorsExpression
1580
1839
  ? `\n indicators: ${moduleOptions.indicatorsExpression},`
1581
1840
  : '';
1582
1841
  const iconReExport =
1583
- iconInfo && exportIcons
1584
- ? `\nexport { ${iconBinding}${iconBinding === iconInfo.exportName ? '' : ` as ${iconInfo.exportName}`} };\n`
1585
- : '';
1842
+ iconInfo && exportIcons ? `\nexport { ${iconInfo.exportName} };\n` : '';
1586
1843
 
1587
1844
  // Resolve token values — tuples become light-dark() strings
1588
1845
  /** @type {Record<string, unknown>} */
@@ -1641,7 +1898,7 @@ function generateBuiltModule(
1641
1898
  serializeField('__adaptations', themeDef.__adaptations) +
1642
1899
  serializeField('__axes', themeDef.__axes ?? {}, true);
1643
1900
 
1644
- return `${iconImport}/**
1901
+ return `${iconImport}${iconDeclaration}/**
1645
1902
  * ${themeDef.name} theme — built by \`${getCliInvocation()} theme build\`
1646
1903
  * Import the CSS file alongside this module:
1647
1904
  *
@@ -1660,7 +1917,7 @@ ${iconReExport}`;
1660
1917
  /**
1661
1918
  * Generate TypeScript declarations for a built theme module.
1662
1919
  * @param {any} themeDef
1663
- * @param {{exportName: string, importPath: string} | null} iconInfo
1920
+ * @param {{exportName: string} | null} iconInfo - The re-exported registry, if any.
1664
1921
  * @param {string | null} variantsFileName
1665
1922
  * @param {{themeBinding?: string, includeIconExport?: boolean, includeThemeImport?: boolean}} [typeOptions]
1666
1923
  * @returns {string}
@@ -2086,7 +2343,7 @@ function validateHeadingTypeAugmentationSupport(themeDef) {
2086
2343
  * `out` overrides the output CSS path; `check` compares against on-disk outputs
2087
2344
  * instead of writing. `iconsSpecifier` overrides the icon registry import
2088
2345
  * specifier in the generated module (e.g. `./icons.mjs`); when omitted, the
2089
- * specifier scraped from the theme source is emitted unchanged.
2346
+ * direct registry specifiers from the theme source are emitted unchanged.
2090
2347
  * @param {{cwd?: string}} [ctx]
2091
2348
  * @returns {Promise<any>}
2092
2349
  */
@@ -2107,6 +2364,8 @@ async function themeBuildInternal(
2107
2364
 
2108
2365
  logger.log(`\nBuilding theme from ${path.relative(cwd, filePath)}...`);
2109
2366
 
2367
+ await selectCore(cwd);
2368
+
2110
2369
  // Standalone builds only need interception when an older Core could erase
2111
2370
  // adaptations. Family preparation always supplies the same recorder as its
2112
2371
  // shared loader so exact authored parent identity stays CLI-private instead
@@ -2119,6 +2378,8 @@ async function themeBuildInternal(
2119
2378
 
2120
2379
  // Extract theme definition
2121
2380
  let themeDef;
2381
+ /** The export actually selected by the loader, not the first AST match. */
2382
+ let themeExportName;
2122
2383
  /** Paths through the load that interception could not fully observe. */
2123
2384
  let loadDegradation;
2124
2385
  try {
@@ -2128,6 +2389,7 @@ async function themeBuildInternal(
2128
2389
  options.__familyLoader,
2129
2390
  );
2130
2391
  themeDef = loaded.theme;
2392
+ themeExportName = loaded.exportName;
2131
2393
  loadDegradation = loaded.degraded;
2132
2394
  } catch (e) {
2133
2395
  const err = /** @type {Error} */ (e);
@@ -2193,6 +2455,25 @@ async function themeBuildInternal(
2193
2455
  throw err;
2194
2456
  }
2195
2457
 
2458
+ // A generated module must preserve the registry through an import: it may
2459
+ // contain React elements, which cannot be serialized. Validate before CSS
2460
+ // generation so neither the no-CSS return nor --check can bypass the error.
2461
+ // Family preparation keeps its own named-import registry contract, which
2462
+ // themeBuildFamily checks against the selected members' graph.
2463
+ const standaloneIcons = !options.__prepareFamily;
2464
+ const iconResolution = {
2465
+ readSource: (/** @type {string} */ file) => fs.readFileSync(file, 'utf8'),
2466
+ resolveModule: resolveThemeModule,
2467
+ reservedNames: [`${toIdentifier(themeDef.name)}Theme`],
2468
+ rawInput: 'extends' in themeDef,
2469
+ hasIcons:
2470
+ Object.keys(themeDef.icons ?? {}).length > 0 ||
2471
+ Object.keys(themeDef.extends?.icons ?? {}).length > 0,
2472
+ };
2473
+ let iconInfo = standaloneIcons
2474
+ ? await resolveIconImports(filePath, themeExportName, iconResolution)
2475
+ : null;
2476
+
2196
2477
  // Validate component overrides
2197
2478
  const warnings = await validateComponentOverrides(themeDef);
2198
2479
  const warningMessages = [];
@@ -2233,13 +2514,7 @@ async function themeBuildInternal(
2233
2514
  // capability exports are checked against what the theme actually asks for.
2234
2515
  if (!_defineTheme || !_generateThemeRulesSplit) {
2235
2516
  throw new AstryxError(
2236
- 'Could not load @astryxdesign/core/theme: `astryx theme build` requires a ' +
2237
- 'built, resolvable @astryxdesign/core so it emits the same CSS as the ' +
2238
- 'runtime <Theme>. Build @astryxdesign/core first (e.g. `pnpm -F @astryxdesign/core ' +
2239
- 'build`)' +
2240
- (_coreImportError
2241
- ? `.\n Import error: ${_coreImportError.message}`
2242
- : '.'),
2517
+ coreUnavailableMessage(cwd, _coreImportError),
2243
2518
  undefined,
2244
2519
  ERROR_CODES.ERR_CORE_NOT_FOUND,
2245
2520
  );
@@ -2305,6 +2580,40 @@ async function themeBuildInternal(
2305
2580
  resolvedTheme = themeDef;
2306
2581
  }
2307
2582
 
2583
+ // Raw object exports can acquire icons only when Core resolves `extends`.
2584
+ // Recheck an unresolved provenance result before any generator runs.
2585
+ if (
2586
+ standaloneIcons &&
2587
+ !iconInfo &&
2588
+ Object.keys(resolvedTheme.icons ?? {}).length > 0
2589
+ ) {
2590
+ iconInfo = await resolveIconImports(filePath, themeExportName, {
2591
+ ...iconResolution,
2592
+ hasIcons: true,
2593
+ });
2594
+ }
2595
+ // An opaque package base can legitimately have no icons. Its .icons
2596
+ // reference is unnecessary; direct empty registry imports remain intact.
2597
+ if (
2598
+ iconInfo &&
2599
+ iconInfo.iconsSpecifierLocalName === undefined &&
2600
+ Object.keys(resolvedTheme.icons ?? {}).length === 0
2601
+ ) {
2602
+ iconInfo = null;
2603
+ }
2604
+ if (
2605
+ iconInfo &&
2606
+ options.iconsSpecifier !== undefined &&
2607
+ iconInfo.iconsSpecifierImportPath === undefined
2608
+ ) {
2609
+ throw new AstryxError(
2610
+ 'The icon registry is inherited through a theme import. ' +
2611
+ 'To use --icons-specifier, import the registry directly and set icons to that binding.',
2612
+ undefined,
2613
+ ERROR_CODES.ERR_THEME_INVALID,
2614
+ );
2615
+ }
2616
+
2308
2617
  // Cores that predate adaptations can still resolve typography, color,
2309
2618
  // radius, and motion into root tokens, but they do not retain the raw axis
2310
2619
  // inputs. Keep the effective metadata captured from the same defineTheme
@@ -2530,15 +2839,6 @@ async function themeBuildInternal(
2530
2839
  const jsPath = path.join(outDir, `${baseName}.js`);
2531
2840
  const dtsPath = path.join(outDir, `${baseName}.d.ts`);
2532
2841
 
2533
- const iconInfo = extractRegistryInfo(
2534
- filePath,
2535
- 'icons',
2536
- options.__prepareFamily,
2537
- );
2538
- const indicatorInfo = options.__prepareFamily
2539
- ? extractRegistryInfo(filePath, 'indicators', true)
2540
- : null;
2541
-
2542
2842
  // Type augmentation .d.ts if theme has custom prop values. Computed
2543
2843
  // before the main .d.ts so the latter can reference it (see below).
2544
2844
  const augmentationSource = resolvedTheme || themeDef;
@@ -2586,8 +2886,8 @@ async function themeBuildInternal(
2586
2886
  theme: displayTheme,
2587
2887
  sourceTheme: themeDef,
2588
2888
  sourceParent,
2589
- iconInfo,
2590
- indicatorInfo,
2889
+ iconInfo: extractRegistryInfo(filePath, 'icons'),
2890
+ indicatorInfo: extractRegistryInfo(filePath, 'indicators'),
2591
2891
  variantDecl,
2592
2892
  css: cssPlan,
2593
2893
  versions,
@@ -2807,6 +3107,7 @@ export async function themeBuildFamily(
2807
3107
  error instanceof Error ? error.message : 'Invalid family key.';
2808
3108
  throw new AstryxError(message, undefined, ERROR_CODES.ERR_THEME_INVALID);
2809
3109
  }
3110
+ await selectCore(cwd);
2810
3111
  const familyInterception = interceptCore(_coreThemeModule, _coreRootModule);
2811
3112
  // prettier-ignore
2812
3113
  const familyLoader = createJiti(import.meta.url, {moduleCache: true, interopDefault: false, jsx: true, extensions: THEME_MODULE_EXTENSIONS, virtualModules: familyInterception.modules});
@@ -2930,11 +3231,14 @@ export async function themeBuildFamily(
2930
3231
  const indicatorImport = indicator.info
2931
3232
  ? `import { ${indicator.info.exportName} as ${ownIndicators} } from ${JSON.stringify(indicator.specifier ?? indicator.info.importPath)};\n`
2932
3233
  : '';
3234
+ // The member's own registry import, bound to its family-unique name; a
3235
+ // rebased or overridden specifier replaces the scraped one.
3236
+ // prettier-ignore
3237
+ const iconImports = icon.info && ownIcons ? {imports: [{importPath: icon.info.importPath, importedName: icon.info.exportName, localName: ownIcons}], expression: ownIcons, exportName: ownIcons, iconsSpecifierImportPath: icon.info.importPath, iconsSpecifierLocalName: ownIcons} : null;
2933
3238
  return (
2934
3239
  indicatorImport +
2935
- generateBuiltModule(member.theme, icon.info, icon.specifier, {
3240
+ generateBuiltModule(member.theme, iconImports, icon.specifier, {
2936
3241
  themeBinding,
2937
- iconBinding: ownIcons ?? undefined,
2938
3242
  iconsExpression: expression(ownIcons, inheritedIcons),
2939
3243
  indicatorsExpression: expression(ownIndicators, inheritedIndicators),
2940
3244
  artifactBaseName: baseName,