diff --git a/frontend/package.json b/frontend/package.json index 0899c24..d574114 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,7 +10,8 @@ "build:go": "tsc && BUILD_GO=true vite build", "prebuild:go": "rm -rf ../backend/web/assets && rm -rf ../backend/web/public", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview" + "preview": "vite preview", + "bundle": "npx vite-bundle-visualizer" }, "dependencies": { "@uiw/react-md-editor": "^4.0.0", @@ -18,6 +19,7 @@ "dayjs": "^1.11.10", "eventemitter3": "^5.0.1", "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.19.0", @@ -25,6 +27,7 @@ }, "devDependencies": { "@types/lodash": "^4.14.202", + "@types/lodash-es": "^4.17.12", "@types/node": "^20.9.0", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", diff --git a/frontend/src/components/TopView.tsx b/frontend/src/components/TopView.tsx index d9ee959..96018e9 100644 --- a/frontend/src/components/TopView.tsx +++ b/frontend/src/components/TopView.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect, useState } from 'react' -import { findIndex, pullAt } from 'lodash' +import { findIndex, pullAt } from 'lodash-es' import EventEmitter from 'eventemitter3' const DeviceEventEmitter = new EventEmitter() diff --git a/frontend/src/screens/NotesScreen/GroupedNotes.tsx b/frontend/src/screens/NotesScreen/GroupedNotes.tsx index f3a58e4..c1bdf34 100644 --- a/frontend/src/screens/NotesScreen/GroupedNotes.tsx +++ b/frontend/src/screens/NotesScreen/GroupedNotes.tsx @@ -1,5 +1,5 @@ import React from 'react' -import _ from 'lodash' +import { groupBy, sortBy } from 'lodash-es' import { NoteType } from '@/types' import { displayName } from '@/utils' import { Link } from 'react-router-dom' @@ -10,9 +10,9 @@ interface Props { } const GroupedNotes: React.FC = ({ data }) => { - const sortedNotes = _.sortBy(data, 'name') + const sortedNotes = sortBy(data, 'name') - const groupedData = _.groupBy(sortedNotes, item => { + const groupedData = groupBy(sortedNotes, item => { const firstChar = item.name[0] // eslint-disable-next-line no-control-regex return /[^\u0000-\u00FF]/.test(firstChar) ? '#' : firstChar.toUpperCase() diff --git a/frontend/src/screens/NotesScreen/NotesScreen.tsx b/frontend/src/screens/NotesScreen/NotesScreen.tsx index 1eb3a7d..4b789fc 100644 --- a/frontend/src/screens/NotesScreen/NotesScreen.tsx +++ b/frontend/src/screens/NotesScreen/NotesScreen.tsx @@ -5,7 +5,7 @@ import useRequest from '@/hooks/useRequest.ts' import useDebouncedValue from '@/hooks/useDebouncedValue.ts' import LoadingView from '@/components/LoadingView.tsx' import GroupedNotes from '@/screens/NotesScreen/GroupedNotes.tsx' -import { isEmpty } from 'lodash' +import { isEmpty } from 'lodash-es' let cachedNotes: NoteType[] = [] diff --git a/frontend/src/screens/SearchScreen/SearchScreen.tsx b/frontend/src/screens/SearchScreen/SearchScreen.tsx index eda0b42..de18f1a 100644 --- a/frontend/src/screens/SearchScreen/SearchScreen.tsx +++ b/frontend/src/screens/SearchScreen/SearchScreen.tsx @@ -7,7 +7,7 @@ import './index.css' import LoadingView from '@/components/LoadingView.tsx' import useDebouncedValue from '@/hooks/useDebouncedValue.ts' import EmptyView from '@/components/EmptyView.tsx' -import { isEmpty } from 'lodash' +import { isEmpty } from 'lodash-es' import dayjs from 'dayjs' interface SearchResponse { diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 36d4ff1..758f84e 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -503,7 +503,14 @@ resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/lodash@^4.14.202": +"@types/lodash-es@^4.17.12": + version "4.17.12" + resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.12.tgz#65f6d1e5f80539aa7cfbfc962de5def0cf4f341b" + integrity sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ== + dependencies: + "@types/lodash" "*" + +"@types/lodash@*", "@types/lodash@^4.14.202": version "4.14.202" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8" integrity sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ== @@ -1875,6 +1882,11 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lodash-es@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz"