1 | # VictoryVendor
|
2 |
|
3 | Vendored dependencies for Victory.
|
4 |
|
5 | ## Background
|
6 |
|
7 | D3 has released most of its libraries as ESM-only. This means that consumers in Node.js applications can no longer just `require()` anything with a d3 transitive dependency, including much of Victory.
|
8 |
|
9 | To help provide an easy path to folks still using CommonJS in their Node.js applications that consume Victory, we now provide this package to vendor in various d3-related packages.
|
10 |
|
11 | ## Packages
|
12 |
|
13 | We presently provide the following top-level libraries:
|
14 |
|
15 |
|
16 | - d3-ease
|
17 | - d3-interpolate
|
18 | - d3-scale
|
19 | - d3-shape
|
20 | - d3-timer
|
21 |
|
22 | This is the total list of top and transitive libraries we vendor:
|
23 |
|
24 |
|
25 | - d3-array
|
26 | - d3-color
|
27 | - d3-ease
|
28 | - d3-format
|
29 | - d3-interpolate
|
30 | - d3-path
|
31 | - d3-scale
|
32 | - d3-shape
|
33 | - d3-time
|
34 | - d3-time-format
|
35 | - d3-timer
|
36 | - internmap
|
37 |
|
38 | Note that this does _not_ include the following D3 libraries that still support CommonJS:
|
39 |
|
40 | - d3-voronoi
|
41 |
|
42 | ## How it works
|
43 |
|
44 | We provide two alternate paths and behaviors -- for ESM and CommonJS
|
45 |
|
46 | ### ESM
|
47 |
|
48 | If you do a Node.js import like:
|
49 |
|
50 | ```js
|
51 | import { interpolate } from "victory-vendor/d3-interpolate";
|
52 | ```
|
53 |
|
54 | under the hood it's going to just re-export and pass you through to `node_modules/d3-interpolate`, the **real** ESM library from D3.
|
55 |
|
56 | ### CommonJS
|
57 |
|
58 | If you do a Node.js import like:
|
59 |
|
60 | ```js
|
61 | const { interpolate } = require("victory-vendor/d3-interpolate");
|
62 | ```
|
63 |
|
64 | under the hood it's going to will go to an alternate path that contains the transpiled version of the underlying d3 library to be found at `victory-vendor/lib-vendor/d3-interpolate/**/*.js`. This futher has internally consistent import references to other `victory-vendor/lib-vendor/<pkg-name>` paths.
|
65 |
|
66 | Note that for some tooling (like Jest) that doesn't play well with `package.json:exports` routing to this CommonJS path, we **also** output a root file in the form of `victory-vendor/d3-interpolate.js`.
|
67 |
|
68 | ## Licenses
|
69 |
|
70 | This project is released under the MIT license, but the vendor'ed in libraries include other licenses (e.g. ISC) that we enumerate in our `package.json:license` field.
|