Skip to content

Commit

Permalink
perf: lodash => lodash-es (#8606)
Browse files Browse the repository at this point in the history
* chore: update packageManager

* perf: 统一使用 lodash-es 减小打包体积
  • Loading branch information
sushi-su authored Aug 5, 2024
1 parent f27a1f8 commit 455b4f1
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 82 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@
"@types/chroma-js": "^2.4.4",
"@types/glob": "^8.1.0",
"@types/history": "^4.7.11",
"@types/lodash": "^4.17.7",
"@types/lodash.merge": "^4.6.9",
"@types/lodash-es": "^4.17.12",
"@types/mockjs": "^1.0.10",
"@types/node": "^14.18.63",
"@types/react": "^18.3.3",
Expand Down Expand Up @@ -120,7 +119,7 @@
"jsdom": "^19.0.0",
"lerna": "^3.22.1",
"lint-staged": "^10.5.4",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"mockdate": "^3.0.5",
"mockjs": "^1.1.0",
"moment": "^2.30.1",
Expand Down Expand Up @@ -170,5 +169,5 @@
"pre-commit": "pretty-quick --staged",
"commit-msg": "fabric verify-commit"
},
"packageManager": "pnpm@8.6.0"
"packageManager": "pnpm@9.6.0"
}
4 changes: 2 additions & 2 deletions packages/field/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
"@chenshuai2144/sketch-color": "^1.0.8",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"lodash.tonumber": "^4.0.3",
"lodash-es": "^4.17.21",
"omit.js": "^2.0.2",
"rc-util": "^5.4.0",
"swr": "^2.0.0"
},
"devDependencies": {
"@types/lodash.tonumber": "^4.0.6",
"@types/lodash-es": "^4.17.12",
"@types/react-color": "^3.0.4",
"rc-resize-observer": "^0.2.3",
"typescript": "^5.0.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/field/src/components/Percent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useIntl } from '@ant-design/pro-provider';
import { InputNumber } from 'antd';
import toNumber from 'lodash.tonumber';
import { toNumber } from 'lodash-es';
import type { ReactNode } from 'react';
import React, { Fragment, useMemo } from 'react';
import type { ProFieldFC } from '../../index';
Expand Down
3 changes: 2 additions & 1 deletion packages/field/src/components/Progress/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useIntl } from '@ant-design/pro-provider';
import { InputNumber, Progress } from 'antd';
import toNumber from 'lodash.tonumber';
import { toNumber } from 'lodash-es';
import React, { useMemo } from 'react';
import type { ProFieldFC } from '../../index';

// 兼容代码-----------
import 'antd/lib/input-number/style';
import 'antd/lib/progress/style';

//------------

export function getProgressStatus(
Expand Down
2 changes: 1 addition & 1 deletion packages/field/src/components/TextArea/readonly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { ProFieldFC } from '../../index';

// 兼容代码-----------
import 'antd/lib/input/style';
import { omit } from 'lodash';
import { omit } from 'lodash-es';
//------------

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@
"@umijs/use-params": "^1.0.9",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"lodash.merge": "^4.6.2",
"lodash-es": "^4.17.21",
"omit.js": "^2.0.2",
"rc-resize-observer": "^1.1.0",
"rc-util": "^5.0.6"
},
"devDependencies": {
"@types/lodash.merge": "^4.6.7",
"@types/lodash-es": "^4.17.12",
"typescript": "^5.0.4"
},
"peerDependencies": {
"@types/lodash.merge": "^4.6.7",
"@types/lodash-es": "^4.17.12",
"antd": "^4.24.15 || ^5.11.2",
"rc-field-form": "^1.22.0",
"react": ">=17.0.0",
"react-dom": ">=17.0.0"
},
"peerDependenciesMeta": {
"@types/lodash.merge": {
"@types/lodash-es": {
"optional": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/layouts/DrawerForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import type { DrawerProps, FormProps } from 'antd';
import { ConfigProvider, Drawer } from 'antd';
import classNames from 'classnames';
import merge from 'lodash.merge';
import { merge } from 'lodash-es';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import { noteOnce } from 'rc-util/lib/warning';
import React, {
Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/layouts/ModalForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { openVisibleCompatible } from '@ant-design/pro-utils';
import type { FormProps, ModalProps } from 'antd';
import { ConfigProvider, Modal } from 'antd';
import merge from 'lodash.merge';
import { merge } from 'lodash-es';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import { noteOnce } from 'rc-util/lib/warning';
import React, {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@umijs/route-utils": "^4.0.0",
"@umijs/use-params": "^1.0.9",
"classnames": "^2.3.2",
"lodash.merge": "^4.6.2",
"lodash-es": "^4.17.21",
"omit.js": "^2.0.2",
"path-to-regexp": "2.4.0",
"rc-resize-observer": "^1.1.0",
Expand All @@ -50,6 +50,7 @@
"warning": "^4.0.3"
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"typescript": "^5.0.4"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
"@dnd-kit/utilities": "^3.2.1",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"lodash.merge": "^4.6.2",
"lodash-es": "^4.17.21",
"omit.js": "^2.0.2",
"rc-resize-observer": "^1.0.0",
"rc-util": "^5.0.1"
},
"devDependencies": {
"@types/lodash.merge": "^4.6.7",
"@types/lodash-es": "^4.7.12",
"typescript": "^5.0.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/Store/Provide.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TableColumnType } from 'antd';
import merge from 'lodash.merge';
import { merge } from 'lodash-es';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import { noteOnce } from 'rc-util/lib/warning';
import {
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@
"@babel/runtime": "^7.18.0",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"lodash.merge": "^4.6.2",
"lodash-es": "^4.17.21",
"rc-util": "^5.0.6",
"safe-stable-stringify": "^2.4.3",
"swr": "^2.0.0"
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"typescript": "^5.0.4"
},
"peerDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/src/transformKeySubmitValue/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/ban-types */
import deepMerge from 'lodash.merge';
import { merge as deepMerge } from 'lodash-es';
import get from 'rc-util/lib/utils/get';
import namePathSet from 'rc-util/lib/utils/set';
import React from 'react';
Expand Down
Loading

0 comments on commit 455b4f1

Please sign in to comment.