Commit 5473f20
authored
[ML] Update some d3 v3 usage to d3 v4 packages. (#233638)
## Summary
Part of #194171.
Updates some imports still using the full `d3` v3 package to use smaller
focused v4 versions instead.
Note instead of plain `d3-color` we have to use
`@elastic/kibana-d3-color` v2.0.1.
Background: The original `d3-color` has a bug in v1+2, therefore Elastic
manages its own fork of the packages with a fix. The original `d3-color`
v3.1.0 fixes the bug too, but we cannot update to it yet because the
package setup switched to ESM only which Kibana doesn't support yet.
Related issue about ESM support (upvote!):
#106868
### New dependency `@types/d3-color`
- **Purpose**: `@types/d3-color` provides typescript support for the
`d3-color` package. So far `d3-color` was already present as a child
dependency in `node_modules`, for example as part of `d3-scale`. This PR
makes use of `d3-color` as a direct import that's why this adds the TS
package too.
- **Justification**: Since `d3-color` is already part of Kibana, we need
`@types/d3-color` for TS support when using it as a direct import.
- **Alternatives explored**: No real alternative since we need it for
`d3-color`.
- **Existing dependencies**: It augments `d3-color` with TS support.
### Note on increased async bundle size.
Async bundle size increases with this PR by ~7.1KB. That's because we're
still using full `d3` v3 in other places and now use more v4 packages on
top of it. This refactor is related to the overall effort to [fix
loading async bundles](#197967) on
every page load so in the long run it will be a benefit.
<img width="1798" height="324" alt="CleanShot 2025-09-02 at 09 14 49@2x"
src="https://github.com/user-attachments/assets/2716d3de-a91e-45d6-9eb7-5b643b23d1cc"
/>
### Checklist
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.1 parent 13b8a83 commit 5473f20
File tree
7 files changed
+36
-28
lines changed- .buildkite/scripts/steps/security
7 files changed
+36
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
1720 | 1721 | | |
1721 | 1722 | | |
1722 | 1723 | | |
| 1724 | + | |
1723 | 1725 | | |
1724 | 1726 | | |
1725 | 1727 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2229 | 2229 | | |
2230 | 2230 | | |
2231 | 2231 | | |
| 2232 | + | |
2232 | 2233 | | |
2233 | 2234 | | |
2234 | 2235 | | |
| 2236 | + | |
2235 | 2237 | | |
2236 | 2238 | | |
2237 | 2239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2361 | 2361 | | |
2362 | 2362 | | |
2363 | 2363 | | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
2364 | 2367 | | |
2365 | 2368 | | |
2366 | 2369 | | |
| |||
Lines changed: 18 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | | - | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
128 | | - | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | | - | |
168 | | - | |
| 168 | + | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
175 | | - | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
| 185 | + | |
187 | 186 | | |
188 | 187 | | |
189 | 188 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2312 | 2312 | | |
2313 | 2313 | | |
2314 | 2314 | | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
2315 | 2320 | | |
2316 | 2321 | | |
2317 | 2322 | | |
| |||
12522 | 12527 | | |
12523 | 12528 | | |
12524 | 12529 | | |
12525 | | - | |
| 12530 | + | |
12526 | 12531 | | |
12527 | 12532 | | |
12528 | 12533 | | |
| |||
17571 | 17576 | | |
17572 | 17577 | | |
17573 | 17578 | | |
17574 | | - | |
17575 | | - | |
17576 | | - | |
17577 | | - | |
17578 | | - | |
17579 | 17579 | | |
17580 | 17580 | | |
17581 | 17581 | | |
| |||
0 commit comments