Skip to content

Commit 6f8114f

Browse files
wojtekmajmerceyz
andauthored
chore: replace lodash with es-toolkit (#6502)
## What's the problem this PR addresses? es-toolkit is a modern lodash alternative that claims to be much faster and lighter, potentially improving Yarn overall performance: https://es-toolkit.slash.page/intro.html ## How did you fix it? The lazy way, frankly: using es-toolkit/compat to provide practically drop-in lodash replacement with minimal effort. ## Checklist <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed. --------- Co-authored-by: Kristoffer K. <[email protected]>
1 parent 6887b28 commit 6f8114f

File tree

30 files changed

+206
-263
lines changed

30 files changed

+206
-263
lines changed

.pnp.cjs

Lines changed: 119 additions & 199 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

.yarn/versions/4251696d.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
releases:
2+
"@yarnpkg/core": patch
3+
"@yarnpkg/plugin-constraints": patch
4+
"@yarnpkg/plugin-essentials": patch
5+
"@yarnpkg/plugin-git": patch
6+
"@yarnpkg/plugin-npm": patch
7+
"@yarnpkg/plugin-version": patch
8+
"@yarnpkg/plugin-workspace-tools": patch
9+
"@yarnpkg/sdks": patch
10+
11+
declined:
12+
- "@yarnpkg/plugin-compat"
13+
- "@yarnpkg/plugin-dlx"
14+
- "@yarnpkg/plugin-exec"
15+
- "@yarnpkg/plugin-file"
16+
- "@yarnpkg/plugin-github"
17+
- "@yarnpkg/plugin-http"
18+
- "@yarnpkg/plugin-init"
19+
- "@yarnpkg/plugin-interactive-tools"
20+
- "@yarnpkg/plugin-jsr"
21+
- "@yarnpkg/plugin-link"
22+
- "@yarnpkg/plugin-nm"
23+
- "@yarnpkg/plugin-npm-cli"
24+
- "@yarnpkg/plugin-pack"
25+
- "@yarnpkg/plugin-patch"
26+
- "@yarnpkg/plugin-pnp"
27+
- "@yarnpkg/plugin-pnpm"
28+
- "@yarnpkg/plugin-stage"
29+
- "@yarnpkg/plugin-typescript"
30+
- "@yarnpkg/builder"
31+
- "@yarnpkg/cli"
32+
- "@yarnpkg/doctor"
33+
- "@yarnpkg/extensions"
34+
- "@yarnpkg/nm"
35+
- "@yarnpkg/pnpify"

packages/acceptance-tests/pkg-tests-specs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@yarnpkg/monorepo": "workspace:^",
2222
"@yarnpkg/parsers": "workspace:^",
2323
"@yarnpkg/pnp": "workspace:^",
24-
"lodash": "^4.17.15",
24+
"es-toolkit": "^1.39.7",
2525
"pkg-tests-core": "workspace:^",
2626
"tar": "^6.0.5",
2727
"tslib": "^2.4.0"

packages/acceptance-tests/pkg-tests-specs/sources/plugins/plugin-typescript.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Manifest} from '@yarnpkg/core';
22
import {PortablePath, ppath, xfs} from '@yarnpkg/fslib';
3-
import {merge} from 'lodash';
3+
import {merge} from 'es-toolkit/compat';
44
import {fs, yarn} from 'pkg-tests-core';
55

66
const {unpackToDirectory} = fs;

packages/docusaurus/config/remark/commandLineHighlight.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {YarnCli, getCli} from '@yarnpkg/cli';
22
import {parseShell} from '@yarnpkg/parsers';
33
import type {Definition, Token} from 'clipanion';
4+
import {capitalize} from 'es-toolkit/compat';
45
import {fromJs} from 'esast-util-from-js';
5-
import {capitalize} from 'lodash';
66
import type {MdxJsxFlowElement} from 'mdast-util-mdx-jsx';
77
import type {Parent, Root} from 'mdast';
88
import type {Transformer} from 'unified';

packages/docusaurus/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
"clsx": "^1.2.1",
3939
"docusaurus-plugin-typedoc-api": "patch:docusaurus-plugin-typedoc-api@npm%3A4.4.0#~/.yarn/patches/docusaurus-plugin-typedoc-api-npm-4.4.0-2657a63517.patch",
4040
"dompurify": "^3.0.5",
41+
"es-toolkit": "^1.39.7",
4142
"esast-util-from-js": "^2.0.1",
4243
"esbuild-loader": "^2.20.0",
4344
"fast-glob": "^3.2.2",
4445
"git-url-parse": "^13.1.0",
4546
"github-markdown-css": "^5.1.0",
4647
"jiti": "^1.21.0",
47-
"lodash": "^4.17.15",
4848
"markdown-it": "^13.0.1",
4949
"marked": "^5.1.1",
5050
"monaco-editor": "^0.24.0",
@@ -79,7 +79,6 @@
7979
"@docusaurus/types": "^3.7.0",
8080
"@types/dompurify": "^3",
8181
"@types/git-url-parse": "^9.0.0",
82-
"@types/lodash": "^4.14.136",
8382
"@types/markdown-it": "^12.2.3",
8483
"@types/marked": "^5.0.0",
8584
"@types/mdast": "^4.0.3",

packages/plugin-constraints/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@yarnpkg/fslib": "workspace:^",
1717
"clipanion": "^4.0.0-rc.2",
18-
"lodash": "^4.17.15",
18+
"es-toolkit": "^1.39.7",
1919
"tau-prolog": "^0.2.66",
2020
"tslib": "^2.4.0"
2121
},
@@ -24,7 +24,6 @@
2424
"@yarnpkg/core": "workspace:^"
2525
},
2626
"devDependencies": {
27-
"@types/lodash": "^4.14.136",
2827
"@yarnpkg/builder": "workspace:^",
2928
"@yarnpkg/cli": "workspace:^",
3029
"@yarnpkg/core": "workspace:^",

packages/plugin-constraints/sources/constraintUtils.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import {Configuration, formatUtils, Manifest, miscUtils, nodeUtils, Project, treeUtils, Workspace} from '@yarnpkg/core';
22
import {PortablePath} from '@yarnpkg/fslib';
3-
import get from 'lodash/get';
4-
import set from 'lodash/set';
5-
import toPath from 'lodash/toPath';
6-
import unset from 'lodash/unset';
3+
import {get, set, toPath, unset} from 'es-toolkit/compat';
74

85
export type ProcessResult = {
96
manifestUpdates: Map<PortablePath, Map<string, Map<any, Set<nodeUtils.Caller>>>>;

packages/plugin-constraints/sources/tauModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import {Project, structUtils} from '@yarnpkg/core';
44
import {PortablePath} from '@yarnpkg/fslib';
5-
import getPath from 'lodash/get';
5+
import {get as getPath} from 'es-toolkit/compat';
66
import pl from 'tau-prolog';
77
import vm from 'vm';
88

0 commit comments

Comments
 (0)