- Status: Accepted
- Date: 2026-06-23
- Author: Kevin Ghadyani
- Source: chat session, 2026-06-23
- Area: architecture
- Tags: #architecture #blueprint
When a public package wraps a third-party library, re-export a specific, curated set of that
library's functions — or require it as a peerDependency — never the library's entire catch-all
namespace object.
Re-exporting zod's z catch-all from Blueprint. It looks convenient (one export, everything
available), but it forces every consumer to pull in the entire package and couples them to the
full third-party surface, defeating the point of wrapping the library at all.
A catch-all re-export means the wrapper hides nothing — consumers transitively depend on the whole library and its bundle cost, and the wrapper can't evolve independently. Curated re-exports (or a peer dependency) keep the public surface small, tree-shakeable, and swappable. This is the same principle as the "hide implementation libraries" rule, applied to re-export granularity.
- Re-export named functions the wrapper actually supports, not the library's umbrella object.
- If consumers genuinely need the full library, make it a
peerDependencythey install directly. - Don't
export * from "third-party"or re-export its top-level namespace object.