Files
hanzo.ai/components/ui/index.ts
zeekay b3eba940f5 Server components reach @hanzo/ui's barrels through the client boundary
components/code.tsx, a server component, imported Line from the
@hanzo/ui/marketing barrel, which registers every marketing component
(Plans, Faq, Hero, Media, ...) as a client entry of its route; the
chunk of app/(marketing)/[...mod], which uses it, loads on every page,
so every page carried them. components/models/Links.tsx, also a server
component, imported the root barrel, about 150 client components onto
every model page (605 KB against a 400 KB budget, and weight.spec red).
Both now import through components/ui, which re-exports Line too.

With the brand marks, a product page's first-party JavaScript goes from
404 KB to 383, /settings from 403 to 389, /bot from 416 to 397 and
/board from 555 to 479. /kai (405) and /gen (403) stay over: their own
page code and @hanzo/rooms' ProviderMark table.
2026-10-17 08:54:33 -07:00

27 lines
1.3 KiB
TypeScript

'use client'
/**
* @hanzo/ui, for server components.
*
* The package's root barrel carries no 'use client' and re-exports its whole
* surface from a second barrel. A server component that imports it walks every
* re-export, and Next registers each 'use client' module it reaches — about
* 150, kanban boards, stock screeners, 3D cards, code editors — as a client
* entry of the route. `experimental.optimizePackageImports` cannot prune it:
* Next's barrel loader follows `export *`, not named re-exports of a nested
* barrel.
*
* Through this module the server sees one client reference, and the client
* bundle keeps only the members named here. They load wherever this module
* does, so name only what server components render on most pages; a file that
* needs anything else is a client component and says 'use client'. Client
* components import `@hanzo/ui` directly. `e2e/gates/weight.spec.ts` holds the
* rule.
*/
export { Box, Text, Toaster, View, XStack, YStack } from '@hanzo/ui'
// The marketing barrel is the same case: a server component that imports one
// member of it registers every marketing component (Plans, Faq, Hero, ...) as a
// client entry of its route. components/code.tsx did, and the chunk of
// app/(marketing)/[...mod] loads on every page, so every page carried them.
export { Line } from '@hanzo/ui/marketing'