Repository navigation
Conversation
Expose each module in dist/layers as @geoarrow/deck.gl-geoarrow/layers/<name> so consumers can import only the layers they use, without their bundler having to resolve @deck.gl/geo-layers or @deck.gl/aggregation-layers. The root entry point is unchanged. The experimental text layer stays reachable only as _GeoArrowTextLayer from the root. Closes geoarrow#221
@deck.gl/geo-layers is only needed by the A5, Geohash, H3 hexagon, S2, and trips layers, and @deck.gl/aggregation-layers only by the heatmap layer. Marking them optional in peerDependenciesMeta stops npm and pnpm from installing them automatically for apps that don't use those layers. Importing from the package root still loads every layer, so the README now says to install both when using the root entry point. Closes geoarrow#222
Member
|
Can we have optional peers without the change in #224 to add subpath exports? |
Contributor
Author
|
Answering here as well: If we just add the optional peers and not the subpath exports, then users would need to install all peer-deps for bundlers to pass. i.e. basically the same behaviour we have today, but with additional steps 😅 This is the reason why this PR includes both commits. |
Member
bundlers can't see that if you're only importing from a few files, you don't need, say, |
This branch has not been deployed
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.
Closes #222
Note
Depends on #224. Until that merges, this diff includes its commit. Only the last commit is new here: view it on its own.
Summary
@deck.gl/geo-layersis only used by the A5, Geohash, H3 hexagon, S2, and trips layers, and@deck.gl/aggregation-layersonly by the heatmap layer. This marks both as optional inpeerDependenciesMeta, so npm and pnpm stop installing them automatically for apps that don't use those layers.The remaining peers (
@deck.gl/core,@deck.gl/layers,@math.gl/polygon,apache-arrow) stay required.Behavior change to be aware of
The root entry point still imports every layer, and bundlers resolve every import before tree-shaking. Vite/Rolldown and esbuild both fail to resolve
@deck.gl/geo-layerswhen importing even justGeoArrowScatterplotLayerfrom the root without it installed. So an app that imports from the root and relied on npm/pnpm installing these peers automatically will need to add them to its own dependencies. Apps using thedeck.glumbrella package already have both.That's why this builds on #224: with subpath imports, apps using only the basic layers don't need either package. The README section from #224 now documents when to install them.
Testing
Resolved a consumer depending on
@deck.gl/core,@deck.gl/layers, andapache-arrowplus the packed package:pnpm install --frozen-lockfilepasses andpnpm-lock.yamlis unchanged (the lockfile doesn't record the package's own peer metadata).biome ci .passes.deck.glumbrella package, and inside the workspace the package's devDependencies still provide both.