Skip to content

DEVPROD-11621: Use subpath exports for lib#1338

Draft
sophstad wants to merge 8 commits intoevergreen-ci:mainfrom
sophstad:DEVPROD-11621
Draft

DEVPROD-11621: Use subpath exports for lib#1338
sophstad wants to merge 8 commits intoevergreen-ci:mainfrom
sophstad:DEVPROD-11621

Conversation

@sophstad
Copy link
Contributor

@sophstad sophstad commented Feb 3, 2026

DEVPROD-11621

Description

Although there are tons of files changed, this PR is very boring; it simply reorganizes the export/import patterns of @evg-ui/lib. Doing so will allow us to more easily use absolute imports in lib since we no longer rely on tsconfig paths. I'll open a second PR since this is huge enough.

  • Strictly define lib exports: analytics, components, constants, context, hooks, types, utils, and test_utils. Components must be imported from one of these exact subpaths, e.g.
    import { tokens } from "@evg-ui/lib/constants";
  • Apply changes to consumer imports to use new paths and remove @evg-ui/lib from the tsconfig's compilerOptions.paths field. These changes are visible in commits 2-6
  • Set sideEffects: false in lib's package.json to improve tree shaking

- Phase 1: Fix intermediate barrels
  - utils/request: export streamedFetch, StreamedFetchOptions, post
  - utils/string: export trimSeverity, getSeverityMapping, mapLogLevelToColor from logs
  - utils/observability: export AttributeStore type
- Phase 2: Add src/index.ts root barrel exporting all production code
- Phase 3: test_utils barrel now exports types, snapshotSerializer, RenderFakeToastContext
- Phase 4: Add package.json exports field for . and ./test_utils

Consumers can use @evg-ui/lib and @evg-ui/lib/test_utils. Import migration (phase 5) is separate.
- Add subpath barrels: analytics, components, constants, context, hooks, types, utils
- Remove root export (.) and delete src/index.ts
- Export beta-features GQL from hooks only (useBetaFeatures)
- Add usePagination to hooks barrel
- Simplify package.json exports (shorthand, no "types" condition)

Consumers must use subpaths, e.g. @evg-ui/lib/components, @evg-ui/lib/hooks.
- Update all fungi imports to subpaths (@evg-ui/lib/components, .constants, .test_utils)
- Remove @evg-ui/lib/* from fungi tsconfig.compilerOptions.paths
- In lib: add triple-slash reference to vite-env.d.ts from components and hooks barrels
  so consumers get .graphql/.svg declarations without per-app tsconfig include
…fig path

- Update email import to @evg-ui/lib/utils (was utils/string)
- Remove @evg-ui/lib/* from deploy-utils tsconfig.compilerOptions.paths
- In lib: add vite-env.d.ts reference to utils barrel for Window.AttributeStore
- Update all @evg-ui/lib imports to use subpath barrels (components, hooks,
  utils, constants, analytics, types, test_utils) instead of deep paths
- Convert default Icon/Accordion/Popconfirm/LoginPage etc. to named imports
- Source GQL beta feature types and operations from @evg-ui/lib/hooks
- Remove @evg-ui/lib/* path mapping from apps/parsley/tsconfig.json
- Export WithToastContext from lib test_utils, TextInputWithGlyph from lib
  components for parsley Storybook and SearchBar
- Consolidate duplicate imports and fix import order for eslint
- Use barrel imports (e.g. @evg-ui/lib/components, @evg-ui/lib/hooks)
  instead of deep paths; use named imports instead of default
- Remove @evg-ui/lib/* path mapping from apps/spruce/tsconfig.json
- Fix stray commas and duplicate test_utils imports in test files
- Normalize multi-line imports (alphabetical, single statement per module)
- Fix parsley sort-imports for staged lib imports
@sophstad sophstad added spruce parsley lib Updates to the @evg-ui/lib package fungi Updates to the @evg-ui/fungi package labels Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fungi Updates to the @evg-ui/fungi package lib Updates to the @evg-ui/lib package parsley spruce

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant