Mature UI libraries (MUI, Mantine, Radix, Tamagui) let consumers do
import { Button, Dialog, Switch } from '@oxyhq/bloom'
…from any toolchain (Expo / Metro / Vite / Webpack) with no bundler tricks
on the consumer side. Today, importing the Dialog subpath from a Vite +
react-native-web project crashes because the package only ships a
react-native-rooted entry, and bundlers without RN-style platform-extension
resolution land on it.
Phase 1 — make the existing .web forks reachable through the standard
Node `exports` mechanism. Phase 2 (separate release) will add web forks
to the remaining native-only subpaths (bottom-sheet, icons,
segmented-control).
Changes:
- package.json#exports: add a "browser" condition to the 6 subpaths that
have a working web fork (dialog, menu, tooltip, select, context-menu,
toast) and to the root "." entry. Conditions point at the bob-emitted
.web.js / .web.d.ts artifacts. Web-safe subpaths (button, switch, …) are
unchanged — they don't need a browser condition.
- src/dialog/index.web.ts: tiny barrel that re-exports the existing
Dialog.web component. Mirrors the structure of the other forked
subpaths whose index is the platform-forked file itself.
- src/index.web.ts: AUTO-GENERATED web variant of the root barrel.
Identical to src/index.ts except every line that re-exports a
web-forked subpath is retargeted to its .web entry. Generated from
src/index.ts so the two files cannot drift.
- scripts/generate-platform-exports.mjs: the generator. Walks src/,
validates that every web-forked subpath has a corresponding .web source
file, then deterministically writes both the package.json `exports`
field and src/index.web.ts. Wired as a prebuild step.
- src/theme/adaptive-colors.web.ts: removed. The non-web counterpart
already gates expo-router behind a Platform.OS check that returns null
on web; the .web file was net-zero duplication.
Version bump to 0.2.0 (additive: new conditions and one new published
file; no breaking changes to the existing API).