refactor: add es-toolkit#3652
Conversation
- swap lodash/isEmpty for es-toolkit/compat isEmpty in oidc-server util - replace just-debounce with es-toolkit debounce (trailing default matches) - replace just-throttle with es-toolkit throttle (now leading+trailing) - replace kebab-case with es-toolkit kebabCase - drop lodash, just-debounce, just-throttle, kebab-case deps; add es-toolkit
- replace local omit util with es-toolkit omit (array key signature) - convert search-attribute decode reduce-with-spread to es-toolkit mapValues (also removes an O(n^2) accumulator spread) - delete dead unique util and now-unused local omit util
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| type Request, | ||
| type Response, | ||
| urlencoded, | ||
| } from 'express'; |
There was a problem hiding this comment.
⚠️ Could not find a declaration file for module 'oidc-provider'. '/home/runner/work/ui/ui/node_modules/.pnpm/oidc-provider@9.8.6/node_modules/oidc-provider/lib/index.js' implicitly has an 'any' type.
| urlencoded, | ||
| } from 'express'; | ||
| import isEmpty from 'lodash/isEmpty.js'; | ||
| import type Provider from 'oidc-provider'; |
There was a problem hiding this comment.
⚠️ Could not find a declaration file for module 'oidc-provider'. '/home/runner/work/ui/ui/node_modules/.pnpm/oidc-provider@9.8.6/node_modules/oidc-provider/lib/index.js' implicitly has an 'any' type.
|
It is imported by bundled/published frontend code (debounce, throttle, kebabCase, omit, mapValues), and the packages it replaced (just-debounce/just-throttle/kebab-case) were regular dependencies too.
# Conflicts: # src/lib/components/workflow/pending-activity/pending-activity-card.svelte
| @@ -1,4 +1,4 @@ | |||
| import throttle from 'just-throttle'; | |||
| import { throttle } from 'es-toolkit'; | |||
There was a problem hiding this comment.
just-throttle fired leading-only (it forces trailing false when leading is true). Looks like es-toolkit's throttle defaults to leading and trailing. Do we want to update throttleRefresh to keep the leading-only behavior?
There was a problem hiding this comment.
yeah I noticed that. I decided not to force trailing to false because IMO it's more intuitive to be have trailing on and I doubt having trailing false was intentional
There was a problem hiding this comment.
I final refresh makes sense to me if we had invoked a refresh after the last one but before the throttle delay
| @@ -1,5 +1,5 @@ | |||
| <script lang="ts"> | |||
| import kebabCase from 'kebab-case'; | |||
| import { kebabCase } from 'es-toolkit'; | |||
There was a problem hiding this comment.
This is existing, but wondering why we have kebabCase on the default id here when it just removes the dash 🤔
There was a problem hiding this comment.
I thought it was for if label or name had dashes already. not sure why it needed to be kebab anyways though
Summary
Consolidates several small third-party utility packages and hand-rolled helpers onto
es-toolkit. Note: es-toolkit was already present in the tree as a transitive dependency (via@storybook/addon-svelte-csf, at 1.43.0); this PR promotes it to a directdependency(^1.49.0) — it's imported by bundled/published frontend code, matching the classification of thejust-*/kebab-casepackages it replaces — and dedupes the version.lodash,just-debounce,just-throttle,kebab-case; addedes-toolkit.lodash/isEmpty→es-toolkit/compatisEmpty(oidc-server dev util; server-only)just-debounce→ es-toolkitdebouncejust-throttle→ es-toolkitthrottlekebab-case→ es-toolkitkebabCase(cleaner output; only affects a fallbackidinsearch.svelte, no test depends on the old leading-dash format)omit→ es-toolkitomit(array-key signature; 5 call sites)reduce-with-spread →mapValues(also removes an O(n²) accumulator spread) inworkflow-execution.tsandstandalone-activity-workers.svelteuniqueutil and the now-unused localomitutil (+ their testsBundle impact
Full production build compared before/after: net-neutral — raw JS +253 B, gzipped −92 B. Tree-shaking pulls only the used functions.
Testing
pnpm check→ 0 errorspnpm test -- --run→ all passingpnpm lintclean