Skip to content

Commit 3c4c4ea

Browse files
authored
chore(deps): switch from lodash-es to es-toolkit (#3142)
> es-toolkit is a state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations. Advantages for `bpmn-visualization`: - receive more updates - optimize for ESM - better tree-shaking - provide types out of the box (for lodash-es, we needed to use a package provided by DefinitevlyTyped) - provide CommonJS files as well, so we are no longer forced to use a trick as we did for lodash-es in the jest configuration of the integration test (which doesn't provide CommonJS file) The performance tests were run on Ubuntu 22. They include results for master a5886d1 and for switching to es-toolkit.
1 parent a1c7c26 commit 3c4c4ea

5 files changed

Lines changed: 20 additions & 51 deletions

File tree

package-lock.json

Lines changed: 16 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@
105105
},
106106
"dependencies": {
107107
"@typed-mxgraph/typed-mxgraph": "~1.0.8",
108+
"es-toolkit": "~1.16.0",
108109
"fast-xml-parser": "4.4.1",
109-
"lodash-es": "~4.17.21",
110110
"mxgraph": "4.2.2",
111111
"strnum": "1.0.5"
112112
},
@@ -118,7 +118,6 @@
118118
"@rollup/plugin-terser": "~0.4.4",
119119
"@types/debug": "~4.1.12",
120120
"@types/jest-image-snapshot": "~6.4.0",
121-
"@types/lodash-es": "~4.17.12",
122121
"@types/minimist": "~1.2.5",
123122
"@typescript-eslint/eslint-plugin": "~7.18.0",
124123
"@typescript-eslint/parser": "~7.18.0",

src/component/mxgraph/BpmnGraph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
import type { FitOptions, ZoomConfiguration } from '../options';
1818
import type { mxCellRenderer, mxCellState, mxGraphView, mxPoint } from 'mxgraph';
1919

20-
import { debounce, throttle } from 'lodash-es';
20+
import { debounce, throttle } from 'es-toolkit';
2121

2222
import { ensurePositiveValue, ensureValidZoomConfiguration } from '../helpers/validators';
2323
import { FitType } from '../options';

test/integration/jest.config.cjs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ module.exports = {
3030
},
3131
],
3232
},
33-
moduleNameMapper: {
34-
...moduleNameMapper,
35-
// Hack to use lodash instead of lodash-es in integration tests.
36-
// This is only to resolve the import, otherwise Jest fails to parse the lodash-es files.
37-
// For more details, see https://github.com/process-analytics/bpmn-visualization-js/pull/2678
38-
// The lodash code is not called in integration tests, so changing the lodash implementation in used in not an issue.
39-
'^lodash-es$': 'lodash',
40-
},
33+
moduleNameMapper,
4134
collectCoverageFrom: ['src/**/*.{ts,js}'],
4235
coveragePathIgnorePatterns: ['/src/model/'],
4336
coverageReporters: ['lcov', 'text-summary'],

0 commit comments

Comments
 (0)