From 5c0271fac3ba4a195a08f3c74d0ac765f10ce9e4 Mon Sep 17 00:00:00 2001 From: Johan Svensson Date: Thu, 10 Sep 2026 11:13:49 +0200 Subject: [PATCH] feat: add subpath exports for individual layer modules Expose each module in dist/layers as @geoarrow/deck.gl-geoarrow/layers/ 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 #221 --- README.md | 12 ++++++++++++ packages/deck.gl-geoarrow/package.json | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12f0753..c13c95b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,18 @@ Standalone examples exist in the [`examples/`](examples/) directory. Create an i More hosted examples on Observable are planned. +## Importing individual layers + +Every layer is exported from the package root. Each layer is also available from its own subpath, named after its module: + +```ts +import { GeoArrowPathLayer } from "@geoarrow/deck.gl-geoarrow/layers/path-layer"; +import { GeoArrowPolygonLayer } from "@geoarrow/deck.gl-geoarrow/layers/polygon-layer"; +import { GeoArrowScatterplotLayer } from "@geoarrow/deck.gl-geoarrow/layers/scatterplot-layer"; +``` + +Importing from a subpath means your bundler only resolves the dependencies of the layers you use. For example, the imports above never load `@deck.gl/geo-layers` (used by the A5, Geohash, H3 hexagon, S2, and trips layers) or `@deck.gl/aggregation-layers` (used by the heatmap layer). + ## Providing accessors All deck.gl layers have two types of properties: ["Render Options"](https://deck.gl/docs/api-reference/layers/scatterplot-layer#render-options) — constant properties across a layer — and "Data Accessors" — properties that can vary across rows. An accessor is any property prefixed with `get`, like `GeoArrowScatterplotLayer`'s `getFillColor`. diff --git a/packages/deck.gl-geoarrow/package.json b/packages/deck.gl-geoarrow/package.json index 3cb44e0..f6c621f 100644 --- a/packages/deck.gl-geoarrow/package.json +++ b/packages/deck.gl-geoarrow/package.json @@ -9,7 +9,12 @@ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" - } + }, + "./layers/*": { + "types": "./dist/layers/*.d.ts", + "default": "./dist/layers/*.js" + }, + "./layers/text-layer": null }, "sideEffects": false, "files": [