Skip to content

feat: mark geo-layers and aggregation-layers as optional peers - #228

Open
jsve wants to merge 2 commits into
geoarrow:mainfrom
jsve:fix/optional-specialized-peers
Open

jsve wants to merge 2 commits into
geoarrow:mainfrom
jsve:fix/optional-specialized-peers

Conversation

@jsve

@jsve jsve commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

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-layers is only used by the A5, Geohash, H3 hexagon, S2, and trips layers, and @deck.gl/aggregation-layers only by the heatmap layer. This marks both as optional in peerDependenciesMeta, 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-layers when importing even just GeoArrowScatterplotLayer from 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 the deck.gl umbrella 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, and apache-arrow plus the packed package:

npm pnpm
before 150 packages, both installed 150 resolved, both installed
after 63 packages, neither installed 63 resolved, neither installed
  • pnpm install --frozen-lockfile passes and pnpm-lock.yaml is unchanged (the lockfile doesn't record the package's own peer metadata).
  • biome ci . passes.
  • The examples in the workspace are unaffected. Most depend on the deck.gl umbrella package, and inside the workspace the package's devDependencies still provide both.

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
@kylebarron

Copy link
Copy Markdown
Member

Can we have optional peers without the change in #224 to add subpath exports?

@jsve

jsve commented Sep 23, 2026

Copy link
Copy Markdown
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.

@kylebarron

Copy link
Copy Markdown
Member

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 😅

bundlers can't see that if you're only importing from a few files, you don't need, say, @deck.gl/aggregation-layers?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark specialized deck.gl layer packages as optional peers

2 participants