/** * The published package name, read from `package.json` so a rebranded kit * prints its own imports rather than the scaffold's. * * It comes through `import.meta.glob` rather than a plain * `import { name } from '../../../../package.json'`: TypeScript 6 will not * resolve a JSON module above the showcase's own tsconfig directory (TS2307) * even with `resolveJsonModule` on, while Vite resolves the glob happily. * * The pattern below is the one place in this folder that counts `../` levels, * so it moves whenever this file moves — there is no alias pointing at the kit * *root* (`@` is the kit's `src`, `~` is the showcase's). * * Its own module, one line long, because `codegen.ts` — where this used to live * — eagerly globs every component and the whole icon barrel to build its * identity map. Any page that wanted the package name was paying ~400 kB for it. */ const manifests = import.meta.glob<{ name?: string; exports?: Record }>( '../../../../package.json', { eager: true } ); const manifest = Object.values(manifests)[0]; export const PACKAGE = manifest?.name ?? 'cbar-uikit-plate'; /** * How many import paths the package publishes. * * Counted from the real `exports` map rather than written down, for the same * reason the introduction page counts components off the registry: that map is * generated by `pnpm exports:gen`, so a component added tomorrow moves this * number on its own. It counts the stylesheet and token entries too, which is * correct — `/styles.css` is an import path a consumer writes. */ export const SUBPATHS = Object.keys(manifest?.exports ?? {}).length;