You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #719 (commit 9406db4) introduced a clean pattern for making next-auth and Google auth integrations conditionally imported and tree-shakeable:
Moved integration code into dedicated top-level directories (auth/, google/, nextauth/, terra/)
Added subpath exports in package.json so consumers import @databiosphere/findable-ui/<scope>/* directly
Marked next-auth as optional in peerDependenciesMeta so consumers that don't use it don't have to install it
We should evaluate where else this pattern applies, and whether there are additional bundle-size wins beyond it. Not every consumer uses Azul, TSV, the chat/research mode, MDX static generation, etc. — carrying that code (and its transitive deps) in every downstream app is waste.
Goals
Identify modules/features in findable-ui that are optional per consumer.
Propose refactors to isolate them behind subpath exports (and where applicable, optional peer deps).
Identify general bundle-size improvements that apply across the library.
Produce a prioritized list of refactor PRs with expected savings.
Audit barrel re-exports — confirm no barrel pulls whole feature trees. Current src/index.ts is already minimal (good); keep it that way.
Bundle analyzer in a test consumer — wire @next/bundle-analyzer in one consumer app temporarily to measure what findable-ui contributes; use it as a baseline to track PR-level improvements.
Dynamic imports for heavy features — for genuinely heavy components (charts, MDX renderer, chat UI), consider exporting a loader pattern (() => import(...)) so consumers can code-split them even if they do use them.
Heavy transitive deps audit — review size of ky, yup, @tanstack/*, chart libs, etc. Look for lighter alternatives or confirm they are already tree-shakeable. Check for any CJS-only deps that block tree-shaking.
Ensure all direct deps are ESM / tree-shakeable — verify each peerDependency ships ESM + proper sideEffects hints.
MUI import discipline — confirm every @mui/* import is a named import from @mui/material (not default imports from deep paths that can't be tree-shaken). ESLint rule no-restricted-imports can enforce.
Icon imports — @mui/icons-material individual imports only (already standard, but worth verifying).
Subpath exports strategy: keep both /lib/* passthrough (as escape hatch) and scoped paths like /azul, /tsv. Don't retroactively re-scope existing paths.
Plugin composition: skip for now.
Backward compatibility: migrate all consumers forward; no deprecation window. Each migration must be mechanical find-replace — not a structural refactor.
Deliverables
Written audit doc mapping each candidate → effort estimate (S/M/L) + expected bytes saved (rough)
Baseline bundle-size measurement from a test consumer for regression tracking
Prioritized list of follow-up PRs, each small enough to ship independently
Summary
PR #719 (commit 9406db4) introduced a clean pattern for making
next-authand Google auth integrations conditionally imported and tree-shakeable:auth/,google/,nextauth/,terra/)exportsinpackage.jsonso consumers import@databiosphere/findable-ui/<scope>/*directlynext-authasoptionalinpeerDependenciesMetaso consumers that don't use it don't have to install itWe should evaluate where else this pattern applies, and whether there are additional bundle-size wins beyond it. Not every consumer uses Azul, TSV, the chat/research mode, MDX static generation, etc. — carrying that code (and its transitive deps) in every downstream app is waste.
Goals
findable-uithat are optional per consumer.Candidates for conditional / isolated import
src/apis/azul/,src/entity/azul/, azul-relatedviewModelBuilders/src/entity/tsv/src/entity/apicf/src/utils/mdx/next-mdx-remote,gray-matter,remark-gfmfeat: add research mode with chat-driven dataset discovery(#800)src/components/Export/,src/providers/fileManifestState*,terra/src/providers/dataDictionary*,src/components/DataDictionary*(if present)src/common/analytics/react-gtm-modulecleanup.src/google/,src/providers/googleSignInAuthentication/General bundle-size improvements to evaluate
sideEffectsfield in package.json — not currently set. Tracked as sub-issue Add sideEffects field to package.json to enable bundler tree-shaking #886.react-gtm-modulepeer dep — tracked as sub-issue Remove unused react-gtm-module peer dependency #887.src/index.tsis already minimal (good); keep it that way.@next/bundle-analyzerin one consumer app temporarily to measure what findable-ui contributes; use it as a baseline to track PR-level improvements.() => import(...)) so consumers can code-split them even if they do use them.ky,yup,@tanstack/*, chart libs, etc. Look for lighter alternatives or confirm they are already tree-shakeable. Check for any CJS-only deps that block tree-shaking.peerDependencyships ESM + propersideEffectshints.@mui/*import is a named import from@mui/material(not default imports from deep paths that can't be tree-shaken). ESLint ruleno-restricted-importscan enforce.@mui/icons-materialindividual imports only (already standard, but worth verifying).Resolved open questions
See this comment for decisions:
/lib/*passthrough (as escape hatch) and scoped paths like/azul,/tsv. Don't retroactively re-scope existing paths.Deliverables
Acceptance criteria