diff --git a/.changeset/trim-dependencies.md b/.changeset/trim-dependencies.md new file mode 100644 index 0000000000..1a2c1c3cbc --- /dev/null +++ b/.changeset/trim-dependencies.md @@ -0,0 +1,5 @@ +--- +'layerchart': patch +--- + +chore: Remove `d3-dsv`, `d3-geo-polygon` and `d3-sankey` dependencies, dropping 12 packages (~2.9 MB) from installs, including the command-line-only `commander`, `iconv-lite` and `rw`, and older duplicate versions of `d3-array`, `d3-shape` and `d3-path` (`sankeyGraphFromCsv()` no longer handles quoted fields) diff --git a/docs/package.json b/docs/package.json index 2947d92c4f..c75b370dd0 100644 --- a/docs/package.json +++ b/docs/package.json @@ -55,7 +55,6 @@ "@types/d3-hierarchy": "^3.1.7", "@types/d3-interpolate": "^3.0.4", "@types/d3-random": "^3.0.3", - "@types/d3-sankey": "^0.12.5", "@types/d3-scale": "^4.0.9", "@types/d3-scale-chromatic": "^3.1.0", "@types/d3-shape": "^3.1.8", @@ -78,7 +77,6 @@ "d3-hierarchy": "^3.1.2", "d3-interpolate": "^3.0.1", "d3-random": "^3.0.1", - "d3-sankey": "^0.12.3", "d3-scale": "^4.0.2", "d3-scale-chromatic": "^3.1.0", "d3-shape": "^3.2.0", diff --git a/docs/src/content/guides/bundle-size.md b/docs/src/content/guides/bundle-size.md index f1db405581..d06875f602 100644 --- a/docs/src/content/guides/bundle-size.md +++ b/docs/src/content/guides/bundle-size.md @@ -36,12 +36,12 @@ These additions to your chart cause an extra HTTP fetch the first time the corre Components that bring in large d3 modules or framework-specific libraries are not re-exported from the root `'layerchart'` entry. They live behind opt-in sub-paths so the default barrel doesn't drag those deps into bundlers that don't tree-shake aggressively. -| Sub-path | Components | Heavy dep saved | -| ---------------------- | -------------------------------------- | -------------------------------------------------- | -| `layerchart/geo` | `Geo*` (12), `Graticule`, `TileImage` | `d3-geo` (~15 KB), `d3-tile` | -| `layerchart/hierarchy` | `Tree`, `Treemap`, `Pack`, `Partition` | `d3-hierarchy` (~6 KB) | -| `layerchart/force` | `ForceSimulation` | `d3-force` (~7 KB) | -| `layerchart/graph` | `Dagre`, `Sankey`, `Chord`, `Ribbon` | `@dagrejs/dagre` (~22 KB), `d3-sankey`, `d3-chord` | +| Sub-path | Components | Heavy dep saved | +| ---------------------- | -------------------------------------- | ---------------------------------------------------- | +| `layerchart/geo` | `Geo*` (12), `Graticule`, `TileImage` | `d3-geo` (~15 KB), `d3-tile` | +| `layerchart/hierarchy` | `Tree`, `Treemap`, `Pack`, `Partition` | `d3-hierarchy` (~6 KB) | +| `layerchart/force` | `ForceSimulation` | `d3-force` (~7 KB) | +| `layerchart/graph` | `Dagre`, `Sankey`, `Chord`, `Ribbon` | `@dagrejs/dagre` (~22 KB), Sankey layout, `d3-chord` | If you use these components, just import from the sub-path: diff --git a/docs/src/examples/components/Sankey/complex.svelte b/docs/src/examples/components/Sankey/complex.svelte index f911389719..53f475f221 100644 --- a/docs/src/examples/components/Sankey/complex.svelte +++ b/docs/src/examples/components/Sankey/complex.svelte @@ -53,7 +53,6 @@ onUpdate={(e) => { // Calculate domain extents from Sankey data // TODO: Update as 'nodeColorBy' changes - // @ts-expect-error const extents = extent(e.nodes, (d) => d[config.nodeColorBy]); // @ts-expect-error colorScale.domain(extents); @@ -93,7 +92,7 @@ { highlightLinkIndexes = [ diff --git a/docs/src/examples/components/Sankey/hierarchy.svelte b/docs/src/examples/components/Sankey/hierarchy.svelte index c7a9ea043e..411e879e28 100644 --- a/docs/src/examples/components/Sankey/hierarchy.svelte +++ b/docs/src/examples/components/Sankey/hierarchy.svelte @@ -59,7 +59,6 @@ onUpdate={(e) => { // Calculate domain extents from Sankey data // TODO: Update as 'nodeColorBy' changes - // @ts-expect-error const extents = extent(e.nodes, (d) => d[config.nodeColorBy]); // @ts-expect-error colorScale.domain(extents); @@ -94,7 +93,7 @@ { highlightLinkIndexes = [ diff --git a/docs/src/examples/components/Sankey/node-select.svelte b/docs/src/examples/components/Sankey/node-select.svelte index f0bbca7fd0..ec17ecd3a8 100644 --- a/docs/src/examples/components/Sankey/node-select.svelte +++ b/docs/src/examples/components/Sankey/node-select.svelte @@ -4,7 +4,7 @@