Skip to content

Commit 191d419

Browse files
authored
Convert d3 packages to ESM (#1648)
* d3tooltip * Add back type-check * Remove dependency * map2tree * Use lodash-es * Update jest invocation * Transform lodash-es * d3-state-visualizer * Use module: node16 * Update * Create chilly-fans-hunt.md
1 parent 629419b commit 191d419

28 files changed

+75
-174
lines changed

.changeset/chilly-fans-hunt.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'remotedev-redux-devtools-extension': patch
3+
'd3-state-visualizer': major
4+
'd3tooltip': major
5+
'map2tree': major
6+
'@redux-devtools/app': patch
7+
---
8+
9+
Convert d3 packages to ESM

extension/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ module.exports = {
66
'\\.css$': '<rootDir>/test/__mocks__/styleMock.ts',
77
},
88
transformIgnorePatterns: [
9-
'node_modules/(?!.pnpm|@babel/code-frame|@babel/highlight|@babel/helper-validator-identifier|chalk|d3|dateformat|delaunator|internmap|jsondiffpatch|nanoid|robust-predicates|uuid)',
9+
'node_modules/(?!.pnpm|@babel/code-frame|@babel/highlight|@babel/helper-validator-identifier|chalk|d3|dateformat|delaunator|internmap|jsondiffpatch|lodash-es|nanoid|robust-predicates|uuid)',
1010
],
1111
};
File renamed without changes.

packages/d3-state-visualizer/babel.config.esm.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/d3-state-visualizer/babel.config.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/d3-state-visualizer/package.json

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,23 @@
2020
"lib",
2121
"src"
2222
],
23-
"main": "lib/cjs/index.js",
24-
"module": "lib/esm/index.js",
25-
"types": "lib/types/index.d.ts",
23+
"main": "lib/index.js",
24+
"types": "lib/index.d.ts",
25+
"type": "module",
2626
"sideEffects": false,
2727
"repository": {
2828
"type": "git",
2929
"url": "https://github.com/reduxjs/redux-devtools.git"
3030
},
3131
"scripts": {
32-
"build": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
33-
"build:cjs": "babel src --extensions \".ts\" --out-dir lib/cjs",
34-
"build:esm": "babel src --config-file ./babel.config.esm.json --extensions \".ts\" --out-dir lib/esm",
35-
"build:types": "tsc --emitDeclarationOnly",
32+
"build": "tsc",
3633
"clean": "rimraf lib",
3734
"lint": "eslint . --ext .ts",
3835
"type-check": "tsc --noEmit",
3936
"prepack": "pnpm run clean && pnpm run build",
40-
"prepublish": "pnpm run type-check && pnpm run lint"
37+
"prepublish": "pnpm run lint"
4138
},
4239
"dependencies": {
43-
"@babel/runtime": "^7.24.1",
4440
"@types/d3": "^7.4.3",
4541
"d3": "^7.9.0",
4642
"d3tooltip": "^3.0.0",
@@ -49,11 +45,6 @@
4945
"ramda": "^0.29.1"
5046
},
5147
"devDependencies": {
52-
"@babel/cli": "^7.24.1",
53-
"@babel/core": "^7.24.3",
54-
"@babel/eslint-parser": "^7.24.1",
55-
"@babel/preset-env": "^7.24.3",
56-
"@babel/preset-typescript": "^7.24.1",
5748
"@types/ramda": "^0.29.11",
5849
"@typescript-eslint/eslint-plugin": "^7.4.0",
5950
"@typescript-eslint/parser": "^7.4.0",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export type { HierarchyPointNode } from 'd3';
22
export type { StyleValue } from 'd3tooltip';
3-
export { default as tree } from './tree/tree';
4-
export type { Node, Options } from './tree/tree';
3+
export { default as tree } from './tree/tree.js';
4+
export type { Node, Options } from './tree/tree.js';

packages/d3-state-visualizer/src/charts/tree/tree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
toggleChildren,
1010
visit,
1111
getNodeGroupByDepthCount,
12-
} from './utils';
12+
} from './utils.js';
1313
import { tooltip } from 'd3tooltip';
1414
import type { StyleValue } from 'd3tooltip';
1515

packages/d3-state-visualizer/src/charts/tree/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { is, join, pipe, replace } from 'ramda';
2-
import sortAndSerialize from './sortAndSerialize';
3-
import type { InternalNode } from './tree';
2+
import sortAndSerialize from './sortAndSerialize.js';
3+
import type { InternalNode } from './tree.js';
44

55
export function collapseChildren(node: InternalNode) {
66
if (node.children) {
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
export { tree } from './charts';
2-
export type { HierarchyPointNode, Node, Options, StyleValue } from './charts';
1+
export { tree } from './charts/index.js';
2+
export type {
3+
HierarchyPointNode,
4+
Node,
5+
Options,
6+
StyleValue,
7+
} from './charts/index.js';

0 commit comments

Comments
 (0)