Repository navigation
Enable subpath exports and per-component tree-shaking - #91
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #91 +/- ##
=======================================
Coverage 95.62% 95.62%
=======================================
Files 34 34
Lines 320 320
Branches 109 109
=======================================
Hits 306 306
Misses 3 3
Partials 11 11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Build every component as its own ESM file via `preserveModules` and add an `exports` entry for each so consumers can either rely on tree-shaking of the barrel import or import components directly (e.g. `@dracor/react/NavBar`). Mark all non-React peers as optional so users only install the packages needed by the components they import; move `react-markdown` out of `dependencies` accordingly. Document both import styles and the optional-peer matrix in the README. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Moving react-markdown from `dependencies` to an optional peer would force consumers of `DocPage`/`AuthorInfo` to install it explicitly — a breaking change requiring a major bump. Since per-component tree shaking already ensures unused consumers pay zero bundle-size cost, keep react-markdown auto-installed and drop it from `peerDependenciesMeta` so the branch can ship as a minor release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Refresh the Architecture section: React is now the only required peer, the build emits one file per module via `preserveModules`, every component is reachable through a subpath export, and `tei.css` joins `dracor.css` as a shipped stylesheet. Record the intent to demote `react-markdown` from `dependencies` to an optional peer with the next major release under a new "Deferred for next major" section. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`src/einakter-gh.tsx` and `src/Theme.tsx` are Storybook demo sources that aren't part of the public API, but vite-plugin-dts was still emitting `dist/einakter-gh.d.ts` and `dist/Theme.d.ts` for them. Exclude both so the published tarball only contains declaration files that correspond to real exports. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
preserveModules, add a"sideEffects": ["**/*.css"]field, and expose each component through anexportssubpath (e.g.@dracor/react/NavBar). Modern bundlers can now drop unused components from the barrel import, and bundler-less consumers can import components directly.optionalinpeerDependenciesMetaso consumers only need to install the packages used by the components they actually import.react-markdownstays a runtimedependencyfor now — demoting it would be a breaking change for consumers ofDocPage/AuthorInfo, so it's queued for the next major (noted inCLAUDE.md).vite-plugin-dtsexclude list to drop.d.tsleakage for Storybook-only source files, and refreshREADME.mdandCLAUDE.mdto document the new import styles and optional-peer matrix.This is a non-breaking change — SemVer-safe for a
1.9.0minor. Needs aversionbump inpackage.jsonbefore release.🤖 Generated with Claude Code