add D3 fork

Summary:
`react-d3-tree` is using version `3.5.17` of `d3`. However, this version of D3.js makes some assumptions about the context, which are not compatible with the way metro is bundling our plugins.

In this version of D3, they reference the `window` by using `this`. However, in metro a top level `this` is `undefined`. This causes the library to break. New versions of D3 have removed referencing the `window` using `this`. Updating `react-d3-tree` to a more recent version of D3 is not easy, because there are many breaking changes in D3 (the current version of D3 is 5.x).

This is why we decided to fix the callsites in `d3@3.5.17`. As these thinks are fixed in `d3@4.x` as well, it doesn't make sense to bring these changes upstream. For this reason, we are committing the fixed version of D3 and use yarn resolutions to resolve D3 with the version including our fixes.

These things were patched in `d3.js`:

- adding `/* eslint-disable */`
- replacing `this.document` with `window.document`
- replacing `this.navigator` with `window.navigator`
- replacing `this.requestAnimationFrame` with `window.requestAnimationFrame`

Reviewed By: priteshrnandgaonkar

Differential Revision: D13377064

fbshipit-source-id: 492eaad4f283fb6901cab089f6092b0bf62d5499
This commit is contained in:
Daniel Büchele
2018-12-14 10:09:51 -08:00
committed by Facebook Github Bot
parent c92efdf945
commit 88820d4865

View File

@@ -7,6 +7,7 @@
.*/static/.*
<PROJECT_ROOT>/src/fb/plugins/relaydevtools/relay-devtools/DevtoolsUI.js$
.*/website/.*
<PROJECT_ROOT>/src/fb/plugins/componenttree/d3/d3.js$
[libs]
flow-typed