Skip to content

Commit 1d28dc6

Browse files
authored
chore: replace lodash with es-toolkit
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
1 parent 58475b9 commit 1d28dc6

File tree

29 files changed

+209
-269
lines changed

29 files changed

+209
-269
lines changed

.pnp.cjs

Lines changed: 119 additions & 200 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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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-link"
21+
- "@yarnpkg/plugin-nm"
22+
- "@yarnpkg/plugin-npm-cli"
23+
- "@yarnpkg/plugin-pack"
24+
- "@yarnpkg/plugin-patch"
25+
- "@yarnpkg/plugin-pnp"
26+
- "@yarnpkg/plugin-pnpm"
27+
- "@yarnpkg/plugin-stage"
28+
- "@yarnpkg/plugin-typescript"
29+
- "@yarnpkg/builder"
30+
- "@yarnpkg/cli"
31+
- "@yarnpkg/doctor"
32+
- "@yarnpkg/extensions"
33+
- "@yarnpkg/nm"
34+
- "@yarnpkg/pnpify"

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@
1313
"directory": "packages/acceptance-tests/pkg-tests-specs"
1414
},
1515
"devDependencies": {
16-
"@types/lodash": "^4.14.136",
1716
"@types/tar": "^4.0.4",
1817
"@yarnpkg/cli": "workspace:^",
1918
"@yarnpkg/core": "workspace:^",
2019
"@yarnpkg/fslib": "workspace:^",
2120
"@yarnpkg/monorepo": "workspace:^",
2221
"@yarnpkg/parsers": "workspace:^",
2322
"@yarnpkg/pnp": "workspace:^",
24-
"lodash": "^4.17.15",
23+
"es-toolkit": "^1.18.0",
2524
"pkg-tests-core": "workspace:^",
2625
"tar": "^6.0.5",
2726
"tslib": "^2.4.0"
2827
},
2928
"engines": {
3029
"node": ">=18.12.0"
30+
},
31+
"dependencies": {
32+
"es-toolkit": "^1.18.0"
3133
}
3234
}

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
@@ -35,13 +35,13 @@
3535
"clsx": "^1.2.1",
3636
"docusaurus-plugin-typedoc-api": "patch:docusaurus-plugin-typedoc-api@npm%3A4.2.0#~/.yarn/patches/docusaurus-plugin-typedoc-api-npm-4.2.0-fb78ec678c.patch",
3737
"dompurify": "^3.0.5",
38+
"es-toolkit": "^1.18.0",
3839
"esast-util-from-js": "^2.0.1",
3940
"esbuild-loader": "^2.20.0",
4041
"fast-glob": "^3.2.2",
4142
"git-url-parse": "^13.1.0",
4243
"github-markdown-css": "^5.1.0",
4344
"jiti": "^1.21.0",
44-
"lodash": "^4.17.15",
4545
"markdown-it": "^13.0.1",
4646
"markdown-it-br": "^1.0.0",
4747
"marked": "^5.1.1",
@@ -83,7 +83,6 @@
8383
"@docusaurus/types": "^3.4.0",
8484
"@types/dompurify": "^3",
8585
"@types/git-url-parse": "^9.0.0",
86-
"@types/lodash": "^4.14.136",
8786
"@types/markdown-it": "^12.2.3",
8887
"@types/marked": "^5.0.0",
8988
"@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.18.0",
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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
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} from 'es-toolkit/compat';
4+
5+
function toPath(value: any): Array<string> {
6+
return Array.isArray(value) ? value : value.match(/([^[.\]])+/g);
7+
}
78

89
export type ProcessResult = {
910
manifestUpdates: Map<PortablePath, Map<string, Map<any, Set<nodeUtils.Caller>>>>;
@@ -218,7 +219,7 @@ export function applyEngineReport(project: Project, {manifestUpdates, reportedEr
218219
}
219220

220221
if (typeof newValue === `undefined`)
221-
unset(manifest, fieldPath);
222+
set(manifest, fieldPath, undefined);
222223
else
223224
set(manifest, fieldPath, newValue);
224225

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)