(
item: RegistryItem,
originalTarget: string,
paths: { blocks: string; components: string },
)
| 35 | // without editing every item's manifest. |
| 36 | |
| 37 | export function remapTarget( |
| 38 | item: RegistryItem, |
| 39 | originalTarget: string, |
| 40 | paths: { blocks: string; components: string }, |
| 41 | ): string { |
| 42 | if (item.type === "hyperframes:block") { |
| 43 | // Anchored to the default target prefix from DEFAULT_PROJECT_CONFIG.paths.blocks. |
| 44 | // Targets that don't start with "compositions/" pass through unchanged. |
| 45 | // Strip trailing slashes to prevent double-slash in output. |
| 46 | const blocksDir = paths.blocks.replace(/\/+$/, ""); |
| 47 | return originalTarget.replace(/^compositions\//, `${blocksDir}/`); |
| 48 | } |
| 49 | if (item.type === "hyperframes:component") { |
| 50 | // Anchored to the default target prefix from DEFAULT_PROJECT_CONFIG.paths.components. |
| 51 | const componentsDir = paths.components.replace(/\/+$/, ""); |
| 52 | return originalTarget.replace(/^compositions\/components\//, `${componentsDir}/`); |
| 53 | } |
| 54 | // Examples are installed by `init`, not `add` — no remapping. |
| 55 | return originalTarget; |
| 56 | } |
| 57 | |
| 58 | // ── Include-snippet builders ──────────────────────────────────────────────── |
| 59 | // Shown to the user after install so they know how to wire the item into |
no outgoing calls
no test coverage detected