Skip to content

Commit

Permalink
node modules: Add d3 TypeScript type definitions from @types/d3
Browse files Browse the repository at this point in the history
- Add select d3 types to node_modules/@types. These are needed for type
  checking the chrome://discards page.
- Add a local patch for the main d3 index.d.ts. This is done to avoid
  pulling in significantly more d3-*/ type files, which are not actually
  used in Chromium.

This adds about 36k to the size of node_modules after filtering.

Bug: 1189595
Change-Id: I0c8a595130813c09b475b9305a2c4f728590885d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3523470
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#981407}
  • Loading branch information
freshp86 authored and Chromium LUCI CQ committed Mar 16, 2022
1 parent b501c4e commit d7d3058
Show file tree
Hide file tree
Showing 7 changed files with 532 additions and 1 deletion.
16 changes: 16 additions & 0 deletions third_party/node/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ Local Modifications:
(none)


Name: Type Definition for D3 library
Short Name: @types/d3
URL: https://www.npmjs.com/package/@types/d3
Version: 5.16.0
License: MIT
Security Critical: No. The types are only used when type checking the discards
page.

Description:
This package contains type definitions for d3.

Local Modifications:
See chromium_d3_types_index.patch, which is used to reduce the types to only
the necessary parts of the library:
d3-drag, d3-force, d3-scale-chromatic, d3-selection, d3-transition.

Name: Type Definition for W3C MediaStream Recording
Short Name: @types/dom-mediacapture-record
URL: https://www.npmjs.com/package/@types/dom-mediacapture-record
Expand Down
38 changes: 38 additions & 0 deletions third_party/node/chromium_d3_types_index.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff -u a/index.d.ts b/index.d.ts
--- a/index.d.ts 2022-03-14 12:45:14.281492632 -0700
+++ b/index.d.ts 2022-03-14 12:44:58.281583117 -0700
@@ -20,34 +20,8 @@
*/
export const version: string;

-export * from 'd3-array';
-export * from 'd3-axis';
-export * from 'd3-brush';
-export * from 'd3-chord';
-export * from 'd3-collection';
-export * from 'd3-color';
-export * from 'd3-contour';
-export * from 'd3-dispatch';
export * from 'd3-drag';
-export * from 'd3-dsv';
-export * from 'd3-ease';
-export * from 'd3-fetch';
export * from 'd3-force';
-export * from 'd3-format';
-export * from 'd3-geo';
-export * from 'd3-hierarchy';
-export * from 'd3-interpolate';
-export * from 'd3-path';
-export * from 'd3-polygon';
-export * from 'd3-quadtree';
-export * from 'd3-random';
-export * from 'd3-scale';
export * from 'd3-scale-chromatic';
export * from 'd3-selection';
-export * from 'd3-shape';
-export * from 'd3-time';
-export * from 'd3-time-format';
-export * from 'd3-timer';
export * from 'd3-transition';
-export * from 'd3-voronoi';
-export * from 'd3-zoom';
2 changes: 1 addition & 1 deletion third_party/node/node_modules.tar.gz.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aad6877c8cd3cff0ef1ba628d71acc981c520c29
0baf1b0dba664e771dfe0ea3c155674bef85ca39
6 changes: 6 additions & 0 deletions third_party/node/npm_include.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
@types/chai/index.d.ts
@types/d3/index.d.ts
@types/d3-drag/index.d.ts
@types/d3-force/index.d.ts
@types/d3-scale-chromatic/index.d.ts
@types/d3-selection/index.d.ts
@types/d3-transition/index.d.ts
@types/dom-mediacapture-record
@types/dom-mediacapture-record/*.d.ts
@types/dom-speech-recognition/index.d.ts
Expand Down
Loading

0 comments on commit d7d3058

Please sign in to comment.