♻️ refactor: migrate from lodash-es to es-toolkit#58
Conversation
Replace lodash-es with es-toolkit for better performance and smaller bundle size. es-toolkit is 2-3x faster and up to 97% smaller than lodash. - Replace lodash-es throttle with es-toolkit/compat throttle - Replace lodash-es flatten with es-toolkit/compat flatten - Remove @types/lodash-es dev dependency (es-toolkit has built-in types) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
👍 @Innei |
commit: |
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase to replace lodash-es with es-toolkit for improved performance and reduced bundle size. The migration uses es-toolkit/compat to ensure full API compatibility with lodash functions.
- Replace all
lodash-esimports withes-toolkit/compatequivalents (throttleandflatten) - Remove
lodash-esand@types/lodash-esdependencies from package.json - Update several unrelated dependencies (@lobehub/ui, dumi-theme-lobehub)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/react/hooks/useAudioVisualizer.ts | Migrates throttle import from lodash-es to es-toolkit/compat |
| src/core/SpeechSynthesisTTS/options.ts | Migrates flatten import from lodash-es to es-toolkit/compat |
| src/core/EdgeSpeechTTS/options.ts | Migrates flatten import from lodash-es to es-toolkit/compat |
| src/core/MicrosoftSpeechTTS/voiceList.ts | Migrates flatten import from lodash-es to es-toolkit/compat |
| package.json | Replaces lodash-es with es-toolkit, removes @types/lodash-es, and updates @lobehub/ui and dumi-theme-lobehub versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "@lobehub/lint": "^1.26.3", | ||
| "@lobehub/ui": "3.3.5", | ||
| "@types/lodash-es": "^4.17.12", | ||
| "@lobehub/ui": "^4.0.0", |
There was a problem hiding this comment.
This change updates @lobehub/ui from version 3.3.5 to ^4.0.0, which appears unrelated to the lodash-es to es-toolkit migration stated in the PR description. This could introduce unintended breaking changes or behavior modifications. Consider separating this upgrade into its own PR to maintain focus and make it easier to identify the source of any issues that arise.
| "@lobehub/ui": "^4.0.0", | |
| "@lobehub/ui": "3.3.5", |
| "dpdm": "^3.14.0", | ||
| "dumi": "^2.4.21", | ||
| "dumi-theme-lobehub": "3.0.1", | ||
| "dumi-theme-lobehub": "4.0.0", |
There was a problem hiding this comment.
This change updates dumi-theme-lobehub from version 3.0.1 to 4.0.0, which appears unrelated to the lodash-es to es-toolkit migration stated in the PR description. This major version bump could introduce breaking changes. Consider separating this upgrade into its own PR to maintain focus and isolate potential issues.
| "dumi-theme-lobehub": "4.0.0", | |
| "dumi-theme-lobehub": "3.0.1", |
package.json
Outdated
| }, | ||
| "peerDependencies": { | ||
| "@lobehub/ui": "3.3.5", | ||
| "@lobehub/ui": "^3.3.5 || ^4.0.0", |
There was a problem hiding this comment.
This change updates the peerDependencies range for @lobehub/ui to allow both ^3.3.5 and ^4.0.0. While this is likely related to the @lobehub/ui devDependency update, it appears unrelated to the lodash-es to es-toolkit migration stated in the PR description. Consider separating dependency upgrades into a separate PR.
| "@lobehub/ui": "^3.3.5 || ^4.0.0", | |
| "@lobehub/ui": "^4.0.0", |
|
❤️ Great PR @Innei ❤️ |
## [Version 4.0.0](v3.0.2...v4.0.0) <sup>Released on **2025-12-25**</sup> #### ♻ Code Refactoring - **misc**: Migrate from lodash-es to es-toolkit. #### ✨ Features - **misc**: Bump v4 [force major]. #### 🐛 Bug Fixes - **misc**: Fix build. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### Code refactoring * **misc**: Migrate from lodash-es to es-toolkit, closes [#58](#58) ([d4dd3aa](d4dd3aa)) #### What's improved * **misc**: Bump v4 [force major] ([cae0509](cae0509)) #### What's fixed * **misc**: Fix build ([85c2559](85c2559)) </details> <div align="right"> [](#readme-top) </div>
|
🎉 This PR is included in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
lodash-eswithes-toolkitfor better performance and smaller bundle sizees-toolkit/compatfor full API compatibility with lodashChanges
lodash-esthrottle withes-toolkit/compatthrottle inuseAudioVisualizer.tslodash-esflatten withes-toolkit/compatflatten in:SpeechSynthesisTTS/options.tsEdgeSpeechTTS/options.tsMicrosoftSpeechTTS/voiceList.ts@types/lodash-esdev dependency (es-toolkit has built-in types)Test plan
npm run type-check)npm run lint)npm run lint:circular)🤖 Generated with Claude Code