ADR 0001 — Single package with subpath exports and optional peers
Status: Accepted
Context
Section titled “Context”The kit spans many kinds of code:
- runtime code (storage drivers, auth, HTTP plumbing, adapters);
- browser code (the React admin shell and embed);
- build-time code (config factories, CSS scoping, docs-site tooling).
The products already ship as one package with subpath exports and optional peers (flags ADR 0001), and
the user decided on one new package, @xtandard/kit, separate from @xtandard/lib, whose core stays
zero-dependency.
The options were:
- several packages (
@xtandard/kit-storage,-ui,-site…); - one package with one entry point;
- one package with subpath exports.
Decision
Section titled “Decision”Ship one package with explicit subpath exports, mirroring flags and webhooks:
- Each subpath is a thin
src/entry-*.ts, built byvp packinto dual ESM/CJS with.d.mts/.d.cts. - The UI subpaths are ESM-only.
- Every driver, framework and tool dependency is an optional peer, owned by exactly one subpath
and loaded with a dynamic
import()behindrequirePeer. valibotis the only runtime dependency.- Build and site tooling live in the same package, under
/buildand/siteand thextandard-kitbin. They are only reachable through those subpaths, so a product’s users never load them.
Consequences
Section titled “Consequences”- Products add one dependency. Installing a product never pulls a database client, a framework or build tooling.
- Kit and product versions stay coherent within one package; there is no matrix between kit parts.
- The tarball is somewhat larger, because of the build/site tooling. That is accepted: it is a few hundred KB and is never imported at runtime.
entry-*.tsfiles and thepackage.jsonexports must stay in sync. The api-surface check (ADR 0003) and publint catch drift.