@astryxdesign/cli 0.6.5-canary.9430d22 → 0.6.5-canary.9a35bb5

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 (216) hide show
  1. package/README.md +23 -21
  2. package/api/build/build.test.mjs +1 -1
  3. package/api/component/_adapter.d.mts +19 -0
  4. package/api/component/_adapter.mjs +33 -0
  5. package/api/component/component-replacement.test.mjs +603 -0
  6. package/api/component/component.mjs +32 -0
  7. package/api/component/component.test.mjs +32 -0
  8. package/api/component/list/list.mjs +110 -4
  9. package/api/docs/docOverlays.test.mjs +10 -6
  10. package/api/docs/docs.test.mjs +1 -1
  11. package/api/docs/index/index.test.mjs +5 -1
  12. package/api/docs/integrationDocs.test.mjs +6 -5
  13. package/api/doctor/_adapter.d.mts +43 -0
  14. package/api/doctor/_adapter.mjs +142 -0
  15. package/api/doctor/doctor.d.mts +0 -10
  16. package/api/doctor/doctor.doc.mjs +1 -3
  17. package/api/doctor/doctor.mjs +6 -123
  18. package/api/doctor/theme-checks.d.mts +12 -0
  19. package/api/doctor/theme-checks.mjs +1117 -0
  20. package/api/doctor/theme-checks.test.mjs +526 -0
  21. package/api/gap-report/gap-report.mjs +15 -1
  22. package/api/index.d.mts +1 -1
  23. package/api/index.mjs +4 -0
  24. package/api/init/run/run.d.mts +3 -5
  25. package/api/init/run/run.mjs +10 -11
  26. package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
  27. package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
  28. package/api/integration/add-helpers.d.mts +26 -5
  29. package/api/integration/add-helpers.mjs +50 -5
  30. package/api/integration/add-theme.mjs +16 -2
  31. package/api/integration/add-theme.test.mjs +66 -15
  32. package/api/integration/authoring-checks.mjs +21 -1
  33. package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
  34. package/api/integration/pack-check.component-replaces.test.mjs +126 -0
  35. package/api/integration/pack-check.d.mts +10 -0
  36. package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
  37. package/api/integration/pack-check.mjs +483 -1
  38. package/api/integration/pack-check.test.mjs +568 -8
  39. package/api/search/search.doc.mjs +1 -1
  40. package/api/search/search.mjs +49 -11
  41. package/api/search/search.test.mjs +5 -1
  42. package/api/search/search.type.d.mts +1 -1
  43. package/api/search/search.type.mjs +1 -1
  44. package/api/swizzle/_adapter.d.mts +9 -0
  45. package/api/swizzle/_adapter.mjs +20 -0
  46. package/api/swizzle/copy/copy.d.mts +5 -6
  47. package/api/swizzle/copy/copy.mjs +28 -9
  48. package/api/swizzle/swizzle.test.mjs +55 -5
  49. package/api/theme/_adapter.d.mts +106 -6
  50. package/api/theme/_adapter.mjs +687 -18
  51. package/api/theme/add/add.binary.test.mjs +76 -3
  52. package/api/theme/add/add.d.mts +5 -9
  53. package/api/theme/add/add.mjs +87 -64
  54. package/api/theme/add/add.rollback.test.mjs +9 -9
  55. package/api/theme/add/add.staging.test.mjs +9 -9
  56. package/api/theme/add/add.test.mjs +461 -55
  57. package/api/theme/add/add.types.test.mjs +151 -0
  58. package/api/theme/build/build.d.mts +26 -2
  59. package/api/theme/build/build.family.test.mjs +13 -4
  60. package/api/theme/build/build.mjs +82 -78
  61. package/api/theme/build/build.test.mjs +30 -0
  62. package/api/theme/eject/eject.binary.test.mjs +90 -0
  63. package/api/theme/eject/eject.d.mts +17 -0
  64. package/api/theme/eject/eject.mjs +65 -0
  65. package/api/theme/eject/eject.rollback.test.mjs +158 -0
  66. package/api/theme/eject/eject.staging.test.mjs +83 -0
  67. package/api/theme/eject/eject.test.mjs +160 -0
  68. package/api/theme/integration-themes.test.mjs +30 -6
  69. package/api/theme/list/list.d.mts +10 -0
  70. package/api/theme/list/list.mjs +75 -7
  71. package/api/theme/list/list.test.mjs +155 -4
  72. package/api/theme/remove/remove.d.mts +12 -0
  73. package/api/theme/remove/remove.mjs +15 -0
  74. package/api/theme/remove/remove.test.mjs +94 -0
  75. package/api/theme/template/template.mjs +3 -4
  76. package/api/theme/theme.d.mts +5 -2
  77. package/api/theme/theme.mjs +13 -8
  78. package/api/theme/theme.type.d.mts +106 -2
  79. package/api/theme/theme.type.mjs +54 -5
  80. package/api/theme/themeAdd.doc.d.mts +1 -3
  81. package/api/theme/themeAdd.doc.mjs +35 -22
  82. package/api/theme/themeBuild.doc.mjs +1 -1
  83. package/api/theme/themeEject.doc.d.mts +8 -0
  84. package/api/theme/themeEject.doc.mjs +89 -0
  85. package/api/theme/themeListAvailable.doc.mjs +4 -4
  86. package/api/theme/themeListCopySources.doc.d.mts +8 -0
  87. package/api/theme/themeListCopySources.doc.mjs +60 -0
  88. package/api/theme/themeRemove.doc.d.mts +6 -0
  89. package/api/theme/themeRemove.doc.mjs +50 -0
  90. package/api/theme/themeTemplate.doc.mjs +4 -3
  91. package/api/theme/themeUse.doc.d.mts +6 -0
  92. package/api/theme/themeUse.doc.mjs +47 -0
  93. package/api/theme/use/use.d.mts +12 -0
  94. package/api/theme/use/use.mjs +15 -0
  95. package/api/theme/use/use.test.mjs +98 -0
  96. package/assets/codemods/integration-discovery.mjs +1 -1
  97. package/assets/codemods/integration-discovery.test.mjs +64 -0
  98. package/assets/codemods/transforms/next/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
  99. package/assets/codemods/transforms/next/index.mjs +14 -1
  100. package/assets/codemods/transforms/next/migrate-copied-themes-to-descriptors.mjs +54 -0
  101. package/assets/docs/author-a-theme.doc.mjs +161 -0
  102. package/assets/docs/getting-started.doc.mjs +59 -15
  103. package/assets/docs/principles.doc.dense.mjs +2 -2
  104. package/assets/docs/principles.doc.mjs +2 -2
  105. package/assets/docs/principles.doc.zh.mjs +2 -2
  106. package/assets/docs/styling-libraries.doc.mjs +1 -1
  107. package/assets/docs/styling.doc.mjs +2 -2
  108. package/assets/docs/theme.doc.dense.mjs +10 -198
  109. package/assets/docs/theme.doc.mjs +13 -771
  110. package/assets/docs/theme.doc.zh.mjs +31 -12
  111. package/assets/docs/tokens.doc.mjs +1 -1
  112. package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
  113. package/assets/docs/tree/checks.doc.mjs +5 -4
  114. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  115. package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
  116. package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
  117. package/assets/docs/tree/headers-and-footers.doc.mjs +68 -0
  118. package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
  119. package/assets/docs/tree/layout.doc.mjs +32 -0
  120. package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
  121. package/assets/docs/tree/responsive.doc.mjs +102 -0
  122. package/assets/docs/tree/scaffold.doc.mjs +145 -0
  123. package/assets/docs/tree/side-panels.doc.mjs +82 -0
  124. package/assets/docs/tree/structure.doc.mjs +144 -0
  125. package/assets/docs/tree/themes.doc.mjs +2 -2
  126. package/assets/docs/tree/troubleshooting.doc.mjs +4 -0
  127. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
  128. package/assets/docs/tree/versioning.doc.mjs +4 -1
  129. package/assets/docs/use-a-theme.doc.mjs +97 -0
  130. package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
  131. package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
  132. package/assets/templates/pages/table-comparison/page.tsx +1449 -0
  133. package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
  134. package/authoring/doctypes/command/command.doc.mjs +5 -0
  135. package/authoring/doctypes/command/type.ts +2 -0
  136. package/authoring/doctypes/component/component.doc.mjs +1 -1
  137. package/authoring/doctypes/component/type.ts +8 -4
  138. package/authoring/integration/integration.doc.mjs +1 -1
  139. package/clients/cli/commands/build-theme.mjs +271 -28
  140. package/clients/cli/commands/component/index.mjs +54 -6
  141. package/clients/cli/commands/component-replacement.text.test.mjs +271 -0
  142. package/clients/cli/commands/component.doc.mjs +9 -2
  143. package/clients/cli/commands/docs.test.mjs +2 -3
  144. package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
  145. package/clients/cli/commands/doctor.doc.mjs +1 -1
  146. package/clients/cli/commands/doctor.test.mjs +9 -51
  147. package/clients/cli/commands/gap-report.doc.mjs +2 -2
  148. package/clients/cli/commands/import-hint-correctness.test.mjs +5 -5
  149. package/clients/cli/commands/init.next-steps.test.mjs +18 -23
  150. package/clients/cli/commands/integration-real-world.test.mjs +61 -12
  151. package/clients/cli/commands/layout-check.doc.mjs +1 -0
  152. package/clients/cli/commands/layout-expand.doc.mjs +1 -0
  153. package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
  154. package/clients/cli/commands/layout.doc.mjs +1 -0
  155. package/clients/cli/commands/layout.mjs +45 -4
  156. package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
  157. package/clients/cli/commands/search.test.mjs +4 -2
  158. package/clients/cli/commands/swizzle.doc.mjs +12 -3
  159. package/clients/cli/commands/template.mjs +46 -0
  160. package/clients/cli/commands/text-json-parity.test.mjs +18 -0
  161. package/clients/cli/commands/theme-add-lifecycle.test.mjs +132 -0
  162. package/clients/cli/commands/theme-add.doc.mjs +19 -19
  163. package/clients/cli/commands/theme-eject.doc.mjs +47 -0
  164. package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
  165. package/clients/cli/commands/theme-list.doc.mjs +2 -2
  166. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
  167. package/clients/cli/commands/theme-remove.doc.mjs +22 -0
  168. package/clients/cli/commands/theme-template.doc.mjs +4 -3
  169. package/clients/cli/commands/theme-use.doc.mjs +22 -0
  170. package/clients/cli/commands/theme.doc.mjs +21 -16
  171. package/clients/cli/index.mjs +3 -0
  172. package/clients/cli/lib/component-format.mjs +19 -2
  173. package/clients/cli/lib/resolve-theme.mjs +80 -78
  174. package/clients/cli/lib/resolve-theme.test.mjs +523 -27
  175. package/foundation/agent-docs/agent-docs.mjs +31 -29
  176. package/foundation/agent-docs/agent-docs.test.mjs +29 -34
  177. package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
  178. package/foundation/config/project.d.mts +20 -5
  179. package/foundation/config/project.mjs +43 -6
  180. package/foundation/config/theme-private-vars.d.mts +12 -0
  181. package/foundation/config/theme-private-vars.mjs +107 -0
  182. package/foundation/config/theme-private-vars.test.mjs +55 -0
  183. package/foundation/config/theme-state.d.mts +145 -0
  184. package/foundation/config/theme-state.mjs +417 -0
  185. package/foundation/config/theme-state.test.mjs +182 -0
  186. package/foundation/discovery/component-discovery.d.mts +5 -2
  187. package/foundation/discovery/component-discovery.mjs +12 -6
  188. package/foundation/discovery/component-replacement.d.mts +91 -0
  189. package/foundation/discovery/component-replacement.mjs +417 -0
  190. package/foundation/discovery/component-replacement.test.mjs +480 -0
  191. package/foundation/discovery/module-exports.d.mts +10 -0
  192. package/foundation/discovery/module-exports.mjs +146 -0
  193. package/foundation/discovery/package-exports.d.mts +29 -0
  194. package/foundation/discovery/package-exports.mjs +200 -0
  195. package/foundation/discovery/theme-discovery.d.mts +72 -5
  196. package/foundation/discovery/theme-discovery.mjs +134 -18
  197. package/foundation/discovery/theme-discovery.test.mjs +9 -3
  198. package/foundation/discovery/theme-imports.d.mts +15 -0
  199. package/foundation/discovery/theme-imports.mjs +217 -0
  200. package/foundation/discovery/theme-imports.test.mjs +173 -0
  201. package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
  202. package/foundation/doc-compiler/inputs.mjs +2 -1
  203. package/foundation/doc-compiler/tree.test.mjs +2 -2
  204. package/foundation/fs/module-loader.d.mts +9 -0
  205. package/foundation/fs/module-loader.mjs +71 -2
  206. package/foundation/integrations/cli-requirement.d.mts +22 -0
  207. package/foundation/integrations/cli-requirement.mjs +31 -0
  208. package/foundation/integrations/cli-requirement.test.mjs +70 -0
  209. package/foundation/integrations/contribution-inventory.mjs +3 -3
  210. package/foundation/response/response-types.doc.mjs +13 -3
  211. package/foundation/response/response.doc.mjs +1 -1
  212. package/foundation/text/copyright-header.mjs +1 -1
  213. package/foundation/text/copyright-header.test.mjs +1 -1
  214. package/package.json +9 -9
  215. package/assets/docs/layout.doc.dense.mjs +0 -388
  216. package/assets/docs/layout.doc.mjs +0 -550
package/README.md CHANGED
@@ -78,24 +78,24 @@ Options:
78
78
 
79
79
  <!-- BEGIN GENERATED: commands -->
80
80
 
81
- | Command | Description |
82
- | ------------- | --------------------------------------------------------------------------------------------- |
83
- | `blog` | Read the Astryx blog from the published feed |
84
- | `build` | Build a page: the template to start from, or the workflow playbook (no query) |
85
- | `component` | List components or print component docs |
86
- | `discover` | Browse and search integrations: the ones you have and the ones you could add |
87
- | `docs` | Print reference docs |
88
- | `doctor` | Diagnose Astryx projects and integration packages |
89
- | `gap-report` | Report a missing component or feature to the package that owns it |
90
- | `hook` | List hooks or print hook docs |
91
- | `init` | Initialize the design system in your project |
92
- | `integration` | Author and verify an Astryx integration package |
93
- | `layout` | Generate XDS layouts from compressed expressions (XLE/XLO) |
94
- | `search` | Search components, hooks, docs, templates, and themes in one ranked list |
95
- | `swizzle` | Copy component source for customization |
96
- | `template` | List, show, or scaffold page and block templates |
97
- | `theme` | Create and build themes: add a shipped one, compile to CSS, or list what a theme can override |
98
- | `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components |
81
+ | Command | Description |
82
+ | ------------- | ----------------------------------------------------------------------------- |
83
+ | `blog` | Read the Astryx blog from the published feed |
84
+ | `build` | Build a page: the template to start from, or the workflow playbook (no query) |
85
+ | `component` | List components or print component docs |
86
+ | `discover` | Browse and search integrations: the ones you have and the ones you could add |
87
+ | `docs` | Print reference docs |
88
+ | `doctor` | Diagnose Astryx projects and integration packages |
89
+ | `gap-report` | Report a missing component or feature to the package that owns it |
90
+ | `hook` | List hooks or print hook docs |
91
+ | `init` | Initialize the design system in your project |
92
+ | `integration` | Author and verify an Astryx integration package |
93
+ | `layout` | Generate XDS layouts from compressed expressions (XLE/XLO) |
94
+ | `search` | Search components, hooks, docs, templates, and themes in one ranked list |
95
+ | `swizzle` | Copy component source for customization |
96
+ | `template` | List, show, or scaffold page and block templates |
97
+ | `theme` | Add, switch, build, and author themes |
98
+ | `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components |
99
99
 
100
100
  <!-- END GENERATED: commands -->
101
101
  <!-- Generated by scripts/generate-cli-readme.mjs from `astryx manifest`. Run `pnpm -F @astryxdesign/cli readme`. -->
@@ -458,11 +458,13 @@ Every response has a `type` discriminant. The full set is below (generated from
458
458
  | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |
459
459
  | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
460
460
  | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
461
- | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
461
+ | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
462
462
  | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
463
463
  | `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
464
- | `theme.list` | Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package. |
465
- | `theme.add` | A scaffold receipt: resolved slug, displayName, maintained flag, owner package, outputDir (relative to cwd), the theme entry file, its exportName, and the files written. |
464
+ | `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |
465
+ | `theme.add` | The released source-copy receipt: slug, displayName, maintained flag, owner package, outputDir, source entry, exportName, and files. Its additive meta.deprecations entry names DEP-0005 and the source-fork/import replacements. |
466
+ | `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |
467
+ | `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |
466
468
  | `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
467
469
  | `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states, deprecatedFor?}, where props and states are its legal override keys and deprecatedFor names the canonical replacement key. |
468
470
  | `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
@@ -542,7 +542,7 @@ describe('build kit — every page starts from a template', () => {
542
542
  it('starts a page the words describe from its template', async () => {
543
543
  for (const [idea, name] of [
544
544
  ['a weekly report of sales by region', 'dashboard-scorecard'],
545
- ['a pricing page with three plans and a comparison table', 'table-page'],
545
+ ['a pricing page with three plans and a comparison table', 'table-comparison'],
546
546
  ]) {
547
547
  const r = await build(idea, {cwd: REPO});
548
548
  if (r.type !== 'build.kit') throw new Error(r.type);
@@ -68,6 +68,25 @@ export function requireCoreDir(cwd: string): string;
68
68
  * @returns {Promise<import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]>}
69
69
  */
70
70
  export function loadIntegrationsSafely(cwd: string): Promise<import("../../foundation/integrations/integrations.mjs").LoadedIntegration[]>;
71
+ /**
72
+ * Every component replacement the loaded integrations declare
73
+ * (spec:AST-035 FR10–FR15): the active one for each replaced Core component,
74
+ * and the findings Doctor reports. With no Core directory, only the opt-in
75
+ * and value findings are computed.
76
+ * @param {string|null} coreDir
77
+ * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
78
+ * @returns {Promise<import('../../foundation/discovery/component-replacement.mjs').ComponentReplacements>}
79
+ */
80
+ export function loadComponentReplacements(coreDir: string | null, loadedIntegrations: import("../../foundation/integrations/integrations.mjs").LoadedIntegration[]): Promise<import("../../foundation/discovery/component-replacement.mjs").ComponentReplacements>;
81
+ /**
82
+ * The integration component that answers to the Core component name
83
+ * `dirName` for unqualified lookup, or undefined when none replaces it.
84
+ * @param {string} coreDir
85
+ * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
86
+ * @param {string} dirName
87
+ * @returns {Promise<import('../../foundation/discovery/component-replacement.mjs').ActiveComponentReplacement | undefined>}
88
+ */
89
+ export function resolveComponentReplacement(coreDir: string, loadedIntegrations: import("../../foundation/integrations/integrations.mjs").LoadedIntegration[], dirName: string): Promise<import("../../foundation/discovery/component-replacement.mjs").ActiveComponentReplacement | undefined>;
71
90
  /**
72
91
  * Read the exact installed version available to a package-qualified component
73
92
  * selector. Legacy docs packages do not expose a reliable version here, so a
@@ -38,6 +38,7 @@ import {
38
38
  } from '../../foundation/discovery/component-discovery.mjs';
39
39
  import {Project} from '../../foundation/config/project.mjs';
40
40
  import {loadComponentDoc as loadValidatedComponentDoc} from '../../foundation/discovery/component-loader.mjs';
41
+ import {resolveComponentReplacements} from '../../foundation/discovery/component-replacement.mjs';
41
42
  import {searchComponents} from '../../foundation/text/string-utils.mjs';
42
43
  import {AstryxError} from '../error.mjs';
43
44
 
@@ -138,6 +139,38 @@ export async function loadIntegrationsSafely(cwd) {
138
139
  }
139
140
  }
140
141
 
142
+ /**
143
+ * Every component replacement the loaded integrations declare
144
+ * (spec:AST-035 FR10–FR15): the active one for each replaced Core component,
145
+ * and the findings Doctor reports. With no Core directory, only the opt-in
146
+ * and value findings are computed.
147
+ * @param {string|null} coreDir
148
+ * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
149
+ * @returns {Promise<import('../../foundation/discovery/component-replacement.mjs').ComponentReplacements>}
150
+ */
151
+ export function loadComponentReplacements(coreDir, loadedIntegrations) {
152
+ return resolveComponentReplacements(coreDir, loadedIntegrations);
153
+ }
154
+
155
+ /**
156
+ * The integration component that answers to the Core component name
157
+ * `dirName` for unqualified lookup, or undefined when none replaces it.
158
+ * @param {string} coreDir
159
+ * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations
160
+ * @param {string} dirName
161
+ * @returns {Promise<import('../../foundation/discovery/component-replacement.mjs').ActiveComponentReplacement | undefined>}
162
+ */
163
+ export async function resolveComponentReplacement(
164
+ coreDir,
165
+ loadedIntegrations,
166
+ dirName,
167
+ ) {
168
+ if (loadedIntegrations.length === 0) return undefined;
169
+ return (
170
+ await resolveComponentReplacements(coreDir, loadedIntegrations)
171
+ ).forTarget(dirName);
172
+ }
173
+
141
174
  /**
142
175
  * Resolve a loaded integration by package name.
143
176
  * @param {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} loadedIntegrations