Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace lodash to lodash-es #211 #218

Closed
wants to merge 13 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
shamefully-hoist=true
auto-install-peers=true
strict-peer-dependencies=false
72 changes: 36 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,66 @@
{
"name": "@vue-hooks-plus/monorepo",
"version": "1.0.0",
"private": true,
"name": "@vue-hooks-plus/monorepo",
"version": "1.0.0",
"private": true,
"scripts": {
"bootstrap": "tsx scripts/bootstrap.ts",
"docs:dev":"tsx scripts/docs.ts dev",
"docs:build":"tsx scripts/docs.ts build",
"docs:build-github":"tsx scripts/gitPage.ts github",
"docs:build-gitee":"tsx scripts/gitPage.ts gitee",
"clean": " rimraf dist lib es",
"bootstrap": "tsx scripts/bootstrap.ts",
"docs:dev": "tsx scripts/docs.ts dev",
"docs:build": "tsx scripts/docs.ts build",
"docs:build-github": "tsx scripts/gitPage.ts github",
"docs:build-gitee": "tsx scripts/gitPage.ts gitee",
"clean": " rimraf dist lib es",
"build": "pnpm bootstrap && tsx scripts/build.ts",
"test": "vitest",
"test": "vitest",
"test:ui": "vitest --ui",
"coverage": "vitest run --coverage",
"coverage": "vitest run --coverage",
"prepare": "husky install"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@types/md5": "^2.3.2",
"@types/prettier": "^2.6.3",
"@types/react-dom": "^18.0.6",
"@vitest/ui": "^0.25.3",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.0.0",
"@types/lodash": "^4.14.178",
"@types/lodash-es": "^4.17.12",
"@types/marked": "^4.0.3",
"@types/md5": "^2.3.2",
"@types/node": "^17.0.21",
"@types/prettier": "^2.6.3",
"@types/qs": "^6.9.7",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-vue": "^2.3.1",
"@vue/compiler-core": "^3.2.37",
"@vue-hooks-plus/vite-plugin-gen-temp": "^2.6.6",
"@vitest/coverage-c8": "^0.25.7",
"@vitest/ui": "^0.25.3",
"@vue-hooks-plus/eslint-config": "workspace:^1.0.0",
"@vue-hooks-plus/md-demo-plugins": "^1.0.0",
"@vue-hooks-plus/types": "workspace:^2.0.0",
"@vue-hooks-plus/use-immer": "workspace:^1.0.0",
"@vue-hooks-plus/use-request": "workspace:^2.0.0",
"@vue-hooks-plus/use-request-plugins": "workspace:^2.0.0",
"@vue-hooks-plus/use-worker": "workspace:^1.0.0",
"@vue-hooks-plus/vite-plugin-gen-temp": "^2.6.6",
"@vue-hooks-plus/vitepress": "^1.2.4",
"@vue-hooks-plus/vitepress-demo-block": "workspace:^1.0.0",
"@vue-hooks-plus/use-immer":"workspace:^1.0.0",
"@vue-hooks-plus/use-worker":"workspace:^1.0.0",
"@vue-hooks-plus/use-request":"workspace:^2.0.0",
"@vue-hooks-plus/use-request-plugins":"workspace:^2.0.0",
"@vue-hooks-plus/types":"workspace:^2.0.0",
"@vue-hooks-plus/eslint-config":"workspace:^1.0.0",
"@vue/compiler-core": "^3.2.37",
"@vue/test-utils": "^2.1.0",
"@vitest/coverage-c8":"^0.25.7",
"execa":"^6.1.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"axios": "^1.4.0",
"broadcast-channel": "^5.1.0",
"cross-env": "^7.0.3",
"execa": "^6.1.0",
"fast-glob": "^3.2.12",
"fs-extra": "^10.1.0",
"gh-pages": "^4.0.0",
"happy-dom": "^7.5.10",
"husky": "^8.0.1",
"kolorist": "^1.6.0",
"less": "^4.1.3",
"kolorist": "^1.6.0",
"lint-staged": "^13.0.3",
"pinia": "^2.0.34",
"prettier": "^1.19.1",
"rimraf": "^3.0.2",
"three": "0.147.0",
"ts-morph": "^13.0.2",
"ts-node": "^10.7.0",
"tsx": "^3.11.0",
"tsx": "^3.11.0",
"typeit": "^8.7.0",
"typescript": "^5.0.4",
"vite": "3.0.2",
@@ -65,13 +69,9 @@
"vitepress": "1.0.0-alpha.60",
"vitest": "0.25.3",
"vue": "^3.2.25",
"vue-demi": "^0.13.11",
"vue-tsc": "1.0.9",
"vue-typical": "^2.1.0",
"pinia":"^2.0.34",
"broadcast-channel":"^5.1.0",
"three":"0.147.0",
"axios": "^1.4.0",
"vue-demi": "^0.13.11"
"vue-typical": "^2.1.0"
},
"lint-staged": {
"*.{js,ts,tsx,vue}": [
6 changes: 3 additions & 3 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
@@ -33,15 +33,15 @@
"type": "tsc -d"
},
"dependencies": {
"@vue/devtools-api": "^6.5.0",
"@types/js-cookie": "^3.0.1",
"@vue/devtools-api": "^6.5.0",
"js-cookie": "^3.0.1",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"qs": "^6.11.0",
"query-string": "^7.1.1",
"screenfull": "^5.0.0"
},
"peerDependencies": {
"peerDependencies": {
"vue": "^3.2.25"
},
"repository": "https://github.com/InhiblabCore/vue-hooks-plus",
2 changes: 1 addition & 1 deletion packages/hooks/src/useDebounceFn/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import debounce from 'lodash/debounce'
import { debounce } from 'lodash-es'

export interface DebounceOptions {
/**
2 changes: 1 addition & 1 deletion packages/hooks/src/useEventEmitter/event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cloneDeep from 'lodash/cloneDeep'
import { cloneDeep } from 'lodash-es'
import { ref, watchEffect } from 'vue'

type SubscriptionParams<T = any> = {
4 changes: 2 additions & 2 deletions packages/hooks/src/useRequest/plugins/useDebouncePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, computed, watchEffect, unref } from "vue";
import type { DebouncedFunc, DebounceSettings } from "lodash";
import debounce from "lodash/debounce";
import type { DebouncedFunc, DebounceSettings } from "lodash-es";
import { debounce } from "lodash-es";
import type { UseRequestPlugin } from "../types";

const useDebouncePlugin: UseRequestPlugin<unknown, unknown[]> = (
6 changes: 3 additions & 3 deletions packages/hooks/src/useRequest/plugins/useThrottlePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed, unref, watchEffect } from 'vue'
import { DebouncedFunc, ThrottleSettings } from 'lodash'
import throttle from 'lodash/throttle'
import { DebouncedFunc, ThrottleSettings } from 'lodash-es'
import { throttle } from 'lodash-es'
import { UseRequestPlugin } from '../types'

const useThrottlePlugin: UseRequestPlugin<unknown, unknown[]> = (
@@ -52,7 +52,7 @@ const useThrottlePlugin: UseRequestPlugin<unknown, unknown[]> = (
}

return {
name: "throttlePlugin",
name: 'throttlePlugin',
onCancel: () => {
throttledRef.value?.cancel()
},
8 changes: 4 additions & 4 deletions packages/hooks/src/useSetState/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ref, Ref, unref, UnwrapRef, readonly, DeepReadonly, UnwrapNestedRefs } from 'vue'
import merge from 'lodash/merge'
import { merge } from 'lodash-es'

type UseSetStateType<S> = S | (() => S) | Ref<S> | (() => Ref<S>)

function useSetState<S extends Record<string, any>>(
initialState: UseSetStateType<S>,
): [
DeepReadonly<UnwrapNestedRefs<[S] extends [Ref<any>] ? S : Ref<UnwrapRef<S>>>>,
(patch: Record<string, any>, cover?: boolean) => void,
] {
DeepReadonly<UnwrapNestedRefs<[S] extends [Ref<any>] ? S : Ref<UnwrapRef<S>>>>,
(patch: Record<string, any>, cover?: boolean) => void,
] {
const getInitialState = () => unref(initialState)

const state = ref<S>(getInitialState() as S)
2 changes: 1 addition & 1 deletion packages/hooks/src/useThrottleFn/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import throttle from 'lodash/throttle'
import { throttle } from 'lodash-es'
import { onUnmounted, ref, computed } from 'vue'
import { UseThrottleOptions } from '../useThrottle'

2 changes: 1 addition & 1 deletion packages/hooks/src/utils/useDeepCompareWithTarget.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ref } from 'vue'
import isEqual from 'lodash/isEqual'
import { isEqual } from 'lodash-es'
import { EffectCallback } from './createEffectWithTarget'
import { DependencyList } from './depsAreSame'
import { BasicTarget } from './domTarget'
26 changes: 13 additions & 13 deletions packages/use-request/package.json
Original file line number Diff line number Diff line change
@@ -2,27 +2,27 @@
"name": "@vue-hooks-plus/use-request",
"version": "2.2.0",
"description": "Vue use-request hooks library",
"files": [
"dist",
"LICENSE",
"package.json",
"README.md"
],
"files": [
"dist",
"LICENSE",
"package.json",
"README.md"
],
"main": "./dist/useRequest.cjs.js",
"module": "./dist/useRequest.es.js",
"types":"./dist/types/index.d.ts" ,
"module": "./dist/useRequest.es.js",
"types": "./dist/types/index.d.ts",
"scripts": {
"sync":"rimraf src & tsx scripts/sync.ts",
"sync": "rimraf src & tsx scripts/sync.ts",
"build": "npm run clean && vite build",
"clean": "rimraf dist"
},
"keywords": [],
"dependencies": {
"@vue/devtools-api": "^6.5.0",
"lodash": "^4.17.21"
"lodash-es": "^4.17.21"
},
"repository": "https://github.com/InhiblabCore/vue-hooks-plus",
"homepage": "https://github.com/InhiblabCore/vue-hooks-plus",
"author": "NelsonYong",
"license": "MIT"
"homepage": "https://github.com/InhiblabCore/vue-hooks-plus",
"author": "NelsonYong",
"license": "MIT"
}
4 changes: 2 additions & 2 deletions packages/use-request/src/plugins/useDebouncePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, computed, watchEffect, unref } from "vue";
import type { DebouncedFunc, DebounceSettings } from "lodash";
import debounce from "lodash/debounce";
import type { DebouncedFunc, DebounceSettings } from "lodash-es";
import { debounce } from "lodash-es";
import type { UseRequestPlugin } from "../types";

const useDebouncePlugin: UseRequestPlugin<unknown, unknown[]> = (
6 changes: 3 additions & 3 deletions packages/use-request/src/plugins/useThrottlePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed, unref, watchEffect } from 'vue'
import { DebouncedFunc, ThrottleSettings } from 'lodash'
import throttle from 'lodash/throttle'
import { DebouncedFunc, ThrottleSettings } from 'lodash-es'
import { throttle } from 'lodash-es'
import { UseRequestPlugin } from '../types'

const useThrottlePlugin: UseRequestPlugin<unknown, unknown[]> = (
@@ -52,7 +52,7 @@ const useThrottlePlugin: UseRequestPlugin<unknown, unknown[]> = (
}

return {
name: "throttlePlugin",
name: 'throttlePlugin',
onCancel: () => {
throttledRef.value?.cancel()
},
2 changes: 1 addition & 1 deletion packages/use-worker/package.json
Original file line number Diff line number Diff line change
@@ -24,6 +24,6 @@
"author": "NelsonYong",
"license": "MIT",
"dependencies": {
"lodash": "^4.17.21"
"lodash-es": "^4.17.21"
}
}
2 changes: 1 addition & 1 deletion packages/use-worker/src/hook/useDeepCompareWithTarget.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { computed, ref, WatchSource } from 'vue'
import isEqual from 'lodash/isEqual'
import { isEqual } from 'lodash-es'

export type EffectCallback = () => void
export type DependencyList = WatchSource | any[] | any
2,458 changes: 1,258 additions & 1,200 deletions pnpm-lock.yaml

Large diffs are not rendered by default.