import type { ImportSpec } from '~/registry/types'; import { PACKAGE } from './package-name'; /** * The import line for a registry entry, rendered rather than stored. * * All 40 entries used to spell out `'cbar-uikit-plate/'`, which is the * scaffold's package name — the one thing a kit is expected to change first. A * rebranded kit therefore documented itself under a name it no longer had, on * every component page, while the snippets right below on the same page already * said the real one (`chrome/lib/codegen.ts` has derived `PACKAGE` from * `package.json` since it was written). * * The output is deliberately byte-identical to `printImports()` in * `chrome/lib/codegen.ts` for the single-subpath case: a page shows this line in its * header and a snippet's import block a few hundred pixels below, and two * spellings of one import would read as two different packages. */ export function importLineOf({ subpath, names }: ImportSpec): string { return `import { ${names.join(', ')} } from '${PACKAGE}/${subpath}';`; }