From b7bfc4bb1ade7729ee5b3cabdd5a2d85de859b4e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 14 Aug 2023 14:44:58 -0400 Subject: [PATCH] chore: Remove optimize imports to allow vite upgrade (#5691) --- .eslintrc | 3 +- app/actions/index.ts | 2 +- app/components/Analytics.tsx | 2 +- app/components/Collaborators.tsx | 5 +- app/components/DocumentExplorer.tsx | 7 ++- app/components/DocumentViews.tsx | 2 +- app/components/Editor.tsx | 4 +- app/components/Header.tsx | 2 +- app/components/Highlight.tsx | 2 +- app/components/LanguagePrompt.tsx | 2 +- app/components/List/Placeholder.tsx | 2 +- app/components/PaginatedList.tsx | 2 +- app/components/SearchPopover.tsx | 2 +- app/components/Sidebar/Settings.tsx | 2 +- app/components/Table.tsx | 2 +- app/components/WebsocketProvider.tsx | 2 +- app/editor/components/SelectionToolbar.tsx | 2 +- app/editor/components/SuggestionsMenu.tsx | 2 +- app/hooks/useCommandBarActions.ts | 2 +- app/hooks/useEmbeds.ts | 2 +- app/hooks/useIdle.ts | 2 +- app/hooks/useMenuContext.tsx | 2 +- app/hooks/useMousePosition.ts | 2 +- app/hooks/useWindowScrollPosition.ts | 2 +- app/models/BaseModel.ts | 2 +- app/models/Collection.ts | 2 +- app/models/Document.ts | 2 +- app/scenes/Collection/MembershipPreview.tsx | 2 +- app/scenes/CollectionNew.tsx | 2 +- .../AddGroupsToCollection.tsx | 2 +- .../Document/components/CommentThread.tsx | 2 +- app/scenes/Document/components/Document.tsx | 2 +- .../Document/components/MultiplayerEditor.tsx | 2 +- .../Document/components/SharePopover.tsx | 3 +- app/scenes/DocumentMove.tsx | 2 +- app/scenes/DocumentPublish.tsx | 2 +- app/scenes/GroupMembers/AddPeopleToGroup.tsx | 2 +- app/scenes/Login/index.tsx | 2 +- app/scenes/Search/Search.tsx | 2 +- app/scenes/Settings/Details.tsx | 2 +- app/scenes/Settings/GoogleAnalytics.tsx | 2 +- app/scenes/Settings/Members.tsx | 2 +- app/scenes/Settings/Notifications.tsx | 2 +- app/scenes/Settings/Security.tsx | 2 +- app/scenes/Settings/SelfHosted.tsx | 2 +- app/scenes/Settings/Shares.tsx | 2 +- .../Settings/components/UserStatusFilter.tsx | 2 +- app/stores/BaseStore.ts | 3 +- app/stores/CollectionsStore.ts | 5 +- app/stores/CommentsStore.ts | 3 +- app/stores/DocumentsStore.ts | 6 ++- app/stores/EventsStore.ts | 3 +- app/stores/FileOperationsStore.ts | 2 +- app/stores/GroupMembershipsStore.ts | 2 +- app/stores/GroupsStore.ts | 2 +- app/stores/IntegrationsStore.ts | 2 +- app/stores/NotificationsStore.ts | 3 +- app/stores/RevisionsStore.ts | 2 +- app/stores/SearchesStore.ts | 2 +- app/stores/SharesStore.ts | 5 +- app/stores/ToastsStore.ts | 2 +- app/stores/UsersStore.ts | 3 +- app/stores/ViewsStore.ts | 5 +- app/utils/ApiClient.ts | 2 +- app/utils/date.ts | 2 +- package.json | 2 +- plugins/google/server/auth/google.ts | 2 +- plugins/oidc/server/auth/oidc.ts | 2 +- plugins/slack/client/Settings.tsx | 2 +- .../slack/client/components/SlackListItem.tsx | 2 +- plugins/slack/server/api/hooks.ts | 2 +- .../components/WebhookSubscriptionForm.tsx | 6 +-- .../server/api/webhookSubscriptions.ts | 3 +- .../commands/documentCollaborativeUpdater.ts | 2 +- server/commands/documentImporter.ts | 2 +- server/commands/documentPermanentDeleter.ts | 2 +- server/commands/notificationUpdater.ts | 2 +- server/commands/teamUpdater.ts | 2 +- server/commands/userInviter.ts | 2 +- server/index.ts | 2 +- server/logging/Logger.ts | 5 +- server/middlewares/rateLimiter.ts | 2 +- server/models/Collection.ts | 5 +- server/models/Document.ts | 3 +- server/models/WebhookSubscription.ts | 2 +- server/models/decorators/Encrypted.ts | 2 +- server/models/helpers/AuthenticationHelper.ts | 3 +- server/models/helpers/DocumentHelper.tsx | 3 +- server/models/helpers/SearchHelper.ts | 3 +- server/models/validators/Length.ts | 2 +- server/models/validators/TextLength.ts | 2 +- server/onerror.ts | 4 +- server/policies/collection.ts | 2 +- server/presenters/policy.ts | 2 +- server/queues/tasks/ExportJSONTask.ts | 2 +- server/queues/tasks/ExportTask.ts | 2 +- server/queues/tasks/ImportJSONTask.ts | 3 +- server/queues/tasks/ImportMarkdownZipTask.ts | 2 +- server/queues/tasks/ImportNotionTask.ts | 3 +- server/queues/tasks/ImportTask.ts | 2 +- .../tasks/RevisionCreatedNotificationsTask.ts | 2 +- server/redis.ts | 2 +- server/routes/api/attachments/schema.ts | 2 +- server/routes/api/auth/auth.ts | 2 +- server/routes/api/collections/schema.ts | 2 +- server/routes/api/cron/schema.ts | 2 +- server/routes/api/documents/schema.ts | 2 +- server/routes/api/fileOperations/schema.ts | 2 +- .../routes/api/notifications/notifications.ts | 3 +- server/routes/api/notifications/schema.ts | 2 +- server/routes/api/revisions/schema.ts | 2 +- server/routes/api/searches/schema.ts | 2 +- server/routes/api/shares/schema.ts | 2 +- server/routes/api/shares/shares.ts | 2 +- server/routes/api/stars/schema.ts | 2 +- server/routes/api/urls/schema.ts | 2 +- server/routes/app.ts | 2 +- server/test/factories.ts | 3 +- server/utils/ShutdownHelper.ts | 2 +- server/utils/ZipHelper.ts | 2 +- server/utils/authentication.ts | 2 +- server/utils/koa.ts | 2 +- server/utils/parseAttachmentIds.ts | 3 +- server/utils/queue.ts | 2 +- server/utils/s3.ts | 2 +- server/utils/startup.ts | 2 +- .../utils/turndown/confluence-code-block.ts | 2 +- server/utils/unfurl.ts | 2 +- server/validation.ts | 2 +- shared/editor/extensions/FindAndReplace.ts | 2 +- shared/editor/extensions/Prism.ts | 3 +- shared/editor/lib/headingToSlug.ts | 2 +- shared/editor/rules/attachments.ts | 2 +- shared/utils/domains.ts | 2 +- shared/utils/naturalSort.ts | 2 +- shared/utils/urls.ts | 2 +- vite.config.ts | 4 -- yarn.lock | 49 ++++++++----------- 138 files changed, 207 insertions(+), 171 deletions(-) diff --git a/.eslintrc b/.eslintrc index 4357f69461..e02b839b6d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -21,7 +21,7 @@ "eslint-plugin-import", "eslint-plugin-node", "eslint-plugin-react", - "import" + "eslint-plugin-lodash" ], "rules": { "eqeqeq": 2, @@ -55,6 +55,7 @@ ], "padding-line-between-statements": ["error", { "blankLine": "always", "prev": "*", "next": "export" }], "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], + "lodash/import-scope": ["warn", "method"], "import/no-named-as-default": "off", "import/no-named-as-default-member": "off", "import/newline-after-import": 2, diff --git a/app/actions/index.ts b/app/actions/index.ts index 82064dd1d6..e0762a5b99 100644 --- a/app/actions/index.ts +++ b/app/actions/index.ts @@ -1,4 +1,4 @@ -import { flattenDeep } from "lodash"; +import flattenDeep from "lodash/flattenDeep"; import * as React from "react"; import { Optional } from "utility-types"; import { v4 as uuidv4 } from "uuid"; diff --git a/app/components/Analytics.tsx b/app/components/Analytics.tsx index b1da7e3c0c..4d6f56cb6d 100644 --- a/app/components/Analytics.tsx +++ b/app/components/Analytics.tsx @@ -1,6 +1,6 @@ /* eslint-disable prefer-rest-params */ /* global ga */ -import { escape } from "lodash"; +import escape from "lodash/escape"; import * as React from "react"; import { IntegrationService } from "@shared/types"; import env from "~/env"; diff --git a/app/components/Collaborators.tsx b/app/components/Collaborators.tsx index 7075ce1aee..b49aabd67d 100644 --- a/app/components/Collaborators.tsx +++ b/app/components/Collaborators.tsx @@ -1,4 +1,7 @@ -import { sortBy, filter, uniq, isEqual } from "lodash"; +import filter from "lodash/filter"; +import isEqual from "lodash/isEqual"; +import sortBy from "lodash/sortBy"; +import uniq from "lodash/uniq"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/components/DocumentExplorer.tsx b/app/components/DocumentExplorer.tsx index 54a4377e98..06069dfd86 100644 --- a/app/components/DocumentExplorer.tsx +++ b/app/components/DocumentExplorer.tsx @@ -1,5 +1,10 @@ import FuzzySearch from "fuzzy-search"; -import { includes, difference, concat, filter, map, fill } from "lodash"; +import concat from "lodash/concat"; +import difference from "lodash/difference"; +import fill from "lodash/fill"; +import filter from "lodash/filter"; +import includes from "lodash/includes"; +import map from "lodash/map"; import { observer } from "mobx-react"; import { StarredIcon, DocumentIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/components/DocumentViews.tsx b/app/components/DocumentViews.tsx index 20d3068151..15377291c5 100644 --- a/app/components/DocumentViews.tsx +++ b/app/components/DocumentViews.tsx @@ -1,4 +1,4 @@ -import { sortBy } from "lodash"; +import sortBy from "lodash/sortBy"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/components/Editor.tsx b/app/components/Editor.tsx index 1445d6de0f..d537450214 100644 --- a/app/components/Editor.tsx +++ b/app/components/Editor.tsx @@ -1,4 +1,6 @@ -import { deburr, difference, sortBy } from "lodash"; +import deburr from "lodash/deburr"; +import difference from "lodash/difference"; +import sortBy from "lodash/sortBy"; import { observer } from "mobx-react"; import { DOMParser as ProsemirrorDOMParser } from "prosemirror-model"; import { TextSelection } from "prosemirror-state"; diff --git a/app/components/Header.tsx b/app/components/Header.tsx index 330f0000ae..0ffc82cc79 100644 --- a/app/components/Header.tsx +++ b/app/components/Header.tsx @@ -1,4 +1,4 @@ -import { throttle } from "lodash"; +import throttle from "lodash/throttle"; import { observer } from "mobx-react"; import { MenuIcon } from "outline-icons"; import { transparentize } from "polished"; diff --git a/app/components/Highlight.tsx b/app/components/Highlight.tsx index f65ff125a5..f57e7135f5 100644 --- a/app/components/Highlight.tsx +++ b/app/components/Highlight.tsx @@ -1,4 +1,4 @@ -import { escapeRegExp } from "lodash"; +import escapeRegExp from "lodash/escapeRegExp"; import * as React from "react"; import replace from "string-replace-to-array"; import styled from "styled-components"; diff --git a/app/components/LanguagePrompt.tsx b/app/components/LanguagePrompt.tsx index f062d3a647..73425f4ed5 100644 --- a/app/components/LanguagePrompt.tsx +++ b/app/components/LanguagePrompt.tsx @@ -1,4 +1,4 @@ -import { find } from "lodash"; +import find from "lodash/find"; import * as React from "react"; import { Trans, useTranslation } from "react-i18next"; import styled from "styled-components"; diff --git a/app/components/List/Placeholder.tsx b/app/components/List/Placeholder.tsx index 9f7fe76af3..780dc50431 100644 --- a/app/components/List/Placeholder.tsx +++ b/app/components/List/Placeholder.tsx @@ -1,4 +1,4 @@ -import { times } from "lodash"; +import times from "lodash/times"; import * as React from "react"; import styled from "styled-components"; import Fade from "~/components/Fade"; diff --git a/app/components/PaginatedList.tsx b/app/components/PaginatedList.tsx index ac2bb9d7a0..4e30ec5303 100644 --- a/app/components/PaginatedList.tsx +++ b/app/components/PaginatedList.tsx @@ -1,4 +1,4 @@ -import { isEqual } from "lodash"; +import isEqual from "lodash/isEqual"; import { observable, action } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx index c02b42f6c1..ad696a9a0c 100644 --- a/app/components/SearchPopover.tsx +++ b/app/components/SearchPopover.tsx @@ -1,4 +1,4 @@ -import { debounce } from "lodash"; +import debounce from "lodash/debounce"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/components/Sidebar/Settings.tsx b/app/components/Sidebar/Settings.tsx index 71c33d9d76..573340fecb 100644 --- a/app/components/Sidebar/Settings.tsx +++ b/app/components/Sidebar/Settings.tsx @@ -1,4 +1,4 @@ -import { groupBy } from "lodash"; +import groupBy from "lodash/groupBy"; import { observer } from "mobx-react"; import { BackIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/components/Table.tsx b/app/components/Table.tsx index c7f6f1f308..66b00b7775 100644 --- a/app/components/Table.tsx +++ b/app/components/Table.tsx @@ -1,4 +1,4 @@ -import { isEqual } from "lodash"; +import isEqual from "lodash/isEqual"; import { observer } from "mobx-react"; import { CollapsedIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/components/WebsocketProvider.tsx b/app/components/WebsocketProvider.tsx index cac3201653..6c19b0629e 100644 --- a/app/components/WebsocketProvider.tsx +++ b/app/components/WebsocketProvider.tsx @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { find } from "lodash"; +import find from "lodash/find"; import { action, observable } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; diff --git a/app/editor/components/SelectionToolbar.tsx b/app/editor/components/SelectionToolbar.tsx index 2ade810d01..90c77a182b 100644 --- a/app/editor/components/SelectionToolbar.tsx +++ b/app/editor/components/SelectionToolbar.tsx @@ -1,4 +1,4 @@ -import { some } from "lodash"; +import some from "lodash/some"; import { EditorState, NodeSelection, TextSelection } from "prosemirror-state"; import * as React from "react"; import createAndInsertLink from "@shared/editor/commands/createAndInsertLink"; diff --git a/app/editor/components/SuggestionsMenu.tsx b/app/editor/components/SuggestionsMenu.tsx index 4e4b4dcffd..86f756bdb1 100644 --- a/app/editor/components/SuggestionsMenu.tsx +++ b/app/editor/components/SuggestionsMenu.tsx @@ -1,5 +1,5 @@ import commandScore from "command-score"; -import { capitalize } from "lodash"; +import capitalize from "lodash/capitalize"; import * as React from "react"; import { Trans } from "react-i18next"; import { VisuallyHidden } from "reakit/VisuallyHidden"; diff --git a/app/hooks/useCommandBarActions.ts b/app/hooks/useCommandBarActions.ts index 9722f73a6c..48dcd11ef6 100644 --- a/app/hooks/useCommandBarActions.ts +++ b/app/hooks/useCommandBarActions.ts @@ -1,5 +1,5 @@ import { useRegisterActions } from "kbar"; -import { flattenDeep } from "lodash"; +import flattenDeep from "lodash/flattenDeep"; import { useLocation } from "react-router-dom"; import { actionToKBar } from "~/actions"; import { Action } from "~/types"; diff --git a/app/hooks/useEmbeds.ts b/app/hooks/useEmbeds.ts index 5c55668eb2..5526b93696 100644 --- a/app/hooks/useEmbeds.ts +++ b/app/hooks/useEmbeds.ts @@ -1,4 +1,4 @@ -import { find } from "lodash"; +import find from "lodash/find"; import * as React from "react"; import embeds, { EmbedDescriptor } from "@shared/editor/embeds"; import { IntegrationType } from "@shared/types"; diff --git a/app/hooks/useIdle.ts b/app/hooks/useIdle.ts index 90847c98fc..a1452962f0 100644 --- a/app/hooks/useIdle.ts +++ b/app/hooks/useIdle.ts @@ -1,4 +1,4 @@ -import { throttle } from "lodash"; +import throttle from "lodash/throttle"; import * as React from "react"; import { Minute } from "@shared/utils/time"; diff --git a/app/hooks/useMenuContext.tsx b/app/hooks/useMenuContext.tsx index cb7cb1b974..eb408f7a5d 100644 --- a/app/hooks/useMenuContext.tsx +++ b/app/hooks/useMenuContext.tsx @@ -1,4 +1,4 @@ -import { noop } from "lodash"; +import noop from "lodash/noop"; import React from "react"; type MenuContextType = { diff --git a/app/hooks/useMousePosition.ts b/app/hooks/useMousePosition.ts index 55041bc6d1..46effdfc7f 100644 --- a/app/hooks/useMousePosition.ts +++ b/app/hooks/useMousePosition.ts @@ -1,4 +1,4 @@ -import { throttle } from "lodash"; +import throttle from "lodash/throttle"; import * as React from "react"; import useEventListener from "./useEventListener"; import useIsMounted from "./useIsMounted"; diff --git a/app/hooks/useWindowScrollPosition.ts b/app/hooks/useWindowScrollPosition.ts index d48ef11495..e006413096 100644 --- a/app/hooks/useWindowScrollPosition.ts +++ b/app/hooks/useWindowScrollPosition.ts @@ -1,6 +1,6 @@ // Based on https://github.com/rehooks/window-scroll-position which is no longer // maintained. -import { throttle } from "lodash"; +import throttle from "lodash/throttle"; import { useState, useEffect } from "react"; import { supportsPassiveListener } from "~/utils/browser"; diff --git a/app/models/BaseModel.ts b/app/models/BaseModel.ts index 265644c8db..5c1c70e909 100644 --- a/app/models/BaseModel.ts +++ b/app/models/BaseModel.ts @@ -1,4 +1,4 @@ -import { pick } from "lodash"; +import pick from "lodash/pick"; import { set, observable } from "mobx"; import Logger from "~/utils/Logger"; import { getFieldsForModel } from "./decorators/Field"; diff --git a/app/models/Collection.ts b/app/models/Collection.ts index dc4350d353..b7c43099d9 100644 --- a/app/models/Collection.ts +++ b/app/models/Collection.ts @@ -1,4 +1,4 @@ -import { trim } from "lodash"; +import trim from "lodash/trim"; import { action, computed, observable, reaction, runInAction } from "mobx"; import { CollectionPermission, diff --git a/app/models/Document.ts b/app/models/Document.ts index a501700fcf..56a1b09ccb 100644 --- a/app/models/Document.ts +++ b/app/models/Document.ts @@ -1,5 +1,5 @@ import { addDays, differenceInDays } from "date-fns"; -import { floor } from "lodash"; +import floor from "lodash/floor"; import { action, autorun, computed, observable, set } from "mobx"; import { ExportContentType } from "@shared/types"; import type { NavigationNode } from "@shared/types"; diff --git a/app/scenes/Collection/MembershipPreview.tsx b/app/scenes/Collection/MembershipPreview.tsx index 8276ddaed1..881487df8c 100644 --- a/app/scenes/Collection/MembershipPreview.tsx +++ b/app/scenes/Collection/MembershipPreview.tsx @@ -1,4 +1,4 @@ -import { sortBy } from "lodash"; +import sortBy from "lodash/sortBy"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/scenes/CollectionNew.tsx b/app/scenes/CollectionNew.tsx index c78ff588ad..bdbc8181e8 100644 --- a/app/scenes/CollectionNew.tsx +++ b/app/scenes/CollectionNew.tsx @@ -1,4 +1,4 @@ -import { intersection } from "lodash"; +import intersection from "lodash/intersection"; import { observable } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; diff --git a/app/scenes/CollectionPermissions/AddGroupsToCollection.tsx b/app/scenes/CollectionPermissions/AddGroupsToCollection.tsx index f9a875f16a..d78947d416 100644 --- a/app/scenes/CollectionPermissions/AddGroupsToCollection.tsx +++ b/app/scenes/CollectionPermissions/AddGroupsToCollection.tsx @@ -1,4 +1,4 @@ -import { debounce } from "lodash"; +import debounce from "lodash/debounce"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/scenes/Document/components/CommentThread.tsx b/app/scenes/Document/components/CommentThread.tsx index d34aa40435..ab00a50ebb 100644 --- a/app/scenes/Document/components/CommentThread.tsx +++ b/app/scenes/Document/components/CommentThread.tsx @@ -1,4 +1,4 @@ -import { throttle } from "lodash"; +import throttle from "lodash/throttle"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/scenes/Document/components/Document.tsx b/app/scenes/Document/components/Document.tsx index a826b40779..ee0e7f10dd 100644 --- a/app/scenes/Document/components/Document.tsx +++ b/app/scenes/Document/components/Document.tsx @@ -1,4 +1,4 @@ -import { debounce } from "lodash"; +import debounce from "lodash/debounce"; import { action, observable } from "mobx"; import { observer } from "mobx-react"; import { AllSelection } from "prosemirror-state"; diff --git a/app/scenes/Document/components/MultiplayerEditor.tsx b/app/scenes/Document/components/MultiplayerEditor.tsx index 83341155f9..8660ccff9d 100644 --- a/app/scenes/Document/components/MultiplayerEditor.tsx +++ b/app/scenes/Document/components/MultiplayerEditor.tsx @@ -1,5 +1,5 @@ import { HocuspocusProvider, WebSocketStatus } from "@hocuspocus/provider"; -import { throttle } from "lodash"; +import throttle from "lodash/throttle"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; diff --git a/app/scenes/Document/components/SharePopover.tsx b/app/scenes/Document/components/SharePopover.tsx index a20775f364..a4ca2fd80c 100644 --- a/app/scenes/Document/components/SharePopover.tsx +++ b/app/scenes/Document/components/SharePopover.tsx @@ -1,5 +1,6 @@ import invariant from "invariant"; -import { debounce, isEmpty } from "lodash"; +import debounce from "lodash/debounce"; +import isEmpty from "lodash/isEmpty"; import { observer } from "mobx-react"; import { ExpandedIcon, GlobeIcon, PadlockIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/scenes/DocumentMove.tsx b/app/scenes/DocumentMove.tsx index 85f38c0077..abd05775a0 100644 --- a/app/scenes/DocumentMove.tsx +++ b/app/scenes/DocumentMove.tsx @@ -1,4 +1,4 @@ -import { flatten } from "lodash"; +import flatten from "lodash/flatten"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation, Trans } from "react-i18next"; diff --git a/app/scenes/DocumentPublish.tsx b/app/scenes/DocumentPublish.tsx index 90e19ff63e..36a2083d49 100644 --- a/app/scenes/DocumentPublish.tsx +++ b/app/scenes/DocumentPublish.tsx @@ -1,4 +1,4 @@ -import { flatten } from "lodash"; +import flatten from "lodash/flatten"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation, Trans } from "react-i18next"; diff --git a/app/scenes/GroupMembers/AddPeopleToGroup.tsx b/app/scenes/GroupMembers/AddPeopleToGroup.tsx index b6a3e15829..1b673678a4 100644 --- a/app/scenes/GroupMembers/AddPeopleToGroup.tsx +++ b/app/scenes/GroupMembers/AddPeopleToGroup.tsx @@ -1,4 +1,4 @@ -import { debounce } from "lodash"; +import debounce from "lodash/debounce"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/scenes/Login/index.tsx b/app/scenes/Login/index.tsx index e62cb6dfa9..ca9500614e 100644 --- a/app/scenes/Login/index.tsx +++ b/app/scenes/Login/index.tsx @@ -1,4 +1,4 @@ -import { find } from "lodash"; +import find from "lodash/find"; import { observer } from "mobx-react"; import { BackIcon, EmailIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/scenes/Search/Search.tsx b/app/scenes/Search/Search.tsx index 304e96175b..74965370e8 100644 --- a/app/scenes/Search/Search.tsx +++ b/app/scenes/Search/Search.tsx @@ -1,4 +1,4 @@ -import { isEqual } from "lodash"; +import isEqual from "lodash/isEqual"; import { observable, action } from "mobx"; import { observer } from "mobx-react"; import queryString from "query-string"; diff --git a/app/scenes/Settings/Details.tsx b/app/scenes/Settings/Details.tsx index 7ffa010d65..1caa6620ad 100644 --- a/app/scenes/Settings/Details.tsx +++ b/app/scenes/Settings/Details.tsx @@ -1,5 +1,5 @@ import { isHexColor } from "class-validator"; -import { pickBy } from "lodash"; +import pickBy from "lodash/pickBy"; import { observer } from "mobx-react"; import { TeamIcon } from "outline-icons"; import { useRef, useState } from "react"; diff --git a/app/scenes/Settings/GoogleAnalytics.tsx b/app/scenes/Settings/GoogleAnalytics.tsx index b1fc641224..22e6a3c318 100644 --- a/app/scenes/Settings/GoogleAnalytics.tsx +++ b/app/scenes/Settings/GoogleAnalytics.tsx @@ -1,4 +1,4 @@ -import { find } from "lodash"; +import find from "lodash/find"; import { observer } from "mobx-react"; import * as React from "react"; import { useForm } from "react-hook-form"; diff --git a/app/scenes/Settings/Members.tsx b/app/scenes/Settings/Members.tsx index 5697601c7f..da970d8be1 100644 --- a/app/scenes/Settings/Members.tsx +++ b/app/scenes/Settings/Members.tsx @@ -1,4 +1,4 @@ -import { sortBy } from "lodash"; +import sortBy from "lodash/sortBy"; import { observer } from "mobx-react"; import { PlusIcon, UserIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/scenes/Settings/Notifications.tsx b/app/scenes/Settings/Notifications.tsx index 91e1378984..76287e63de 100644 --- a/app/scenes/Settings/Notifications.tsx +++ b/app/scenes/Settings/Notifications.tsx @@ -1,4 +1,4 @@ -import { debounce } from "lodash"; +import debounce from "lodash/debounce"; import { observer } from "mobx-react"; import { AcademicCapIcon, diff --git a/app/scenes/Settings/Security.tsx b/app/scenes/Settings/Security.tsx index d8b242f567..78e0acc9fd 100644 --- a/app/scenes/Settings/Security.tsx +++ b/app/scenes/Settings/Security.tsx @@ -1,4 +1,4 @@ -import { debounce } from "lodash"; +import debounce from "lodash/debounce"; import { observer } from "mobx-react"; import { CheckboxIcon, EmailIcon, PadlockIcon } from "outline-icons"; import { useState } from "react"; diff --git a/app/scenes/Settings/SelfHosted.tsx b/app/scenes/Settings/SelfHosted.tsx index 41fd079262..45c8cb38f7 100644 --- a/app/scenes/Settings/SelfHosted.tsx +++ b/app/scenes/Settings/SelfHosted.tsx @@ -1,4 +1,4 @@ -import { find } from "lodash"; +import find from "lodash/find"; import { observer } from "mobx-react"; import { BuildingBlocksIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/scenes/Settings/Shares.tsx b/app/scenes/Settings/Shares.tsx index df29e09d01..63396ce110 100644 --- a/app/scenes/Settings/Shares.tsx +++ b/app/scenes/Settings/Shares.tsx @@ -1,4 +1,4 @@ -import { sortBy } from "lodash"; +import sortBy from "lodash/sortBy"; import { observer } from "mobx-react"; import { LinkIcon, WarningIcon } from "outline-icons"; import * as React from "react"; diff --git a/app/scenes/Settings/components/UserStatusFilter.tsx b/app/scenes/Settings/components/UserStatusFilter.tsx index 6aa89f5af0..53717073e4 100644 --- a/app/scenes/Settings/components/UserStatusFilter.tsx +++ b/app/scenes/Settings/components/UserStatusFilter.tsx @@ -1,4 +1,4 @@ -import { compact } from "lodash"; +import compact from "lodash/compact"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; diff --git a/app/stores/BaseStore.ts b/app/stores/BaseStore.ts index 70fd6ec5db..96c96f5a27 100644 --- a/app/stores/BaseStore.ts +++ b/app/stores/BaseStore.ts @@ -1,5 +1,6 @@ import invariant from "invariant"; -import { lowerFirst, orderBy } from "lodash"; +import lowerFirst from "lodash/lowerFirst"; +import orderBy from "lodash/orderBy"; import { observable, action, computed, runInAction } from "mobx"; import { Class } from "utility-types"; import RootStore from "~/stores/RootStore"; diff --git a/app/stores/CollectionsStore.ts b/app/stores/CollectionsStore.ts index 3b80d0b66a..908d633f24 100644 --- a/app/stores/CollectionsStore.ts +++ b/app/stores/CollectionsStore.ts @@ -1,5 +1,8 @@ import invariant from "invariant"; -import { concat, find, last, sortBy } from "lodash"; +import concat from "lodash/concat"; +import find from "lodash/find"; +import last from "lodash/last"; +import sortBy from "lodash/sortBy"; import { computed, action } from "mobx"; import { CollectionPermission, diff --git a/app/stores/CommentsStore.ts b/app/stores/CommentsStore.ts index 275ecb78a8..fd88d508b6 100644 --- a/app/stores/CommentsStore.ts +++ b/app/stores/CommentsStore.ts @@ -1,5 +1,6 @@ import invariant from "invariant"; -import { filter, orderBy } from "lodash"; +import filter from "lodash/filter"; +import orderBy from "lodash/orderBy"; import { action, runInAction, computed } from "mobx"; import Comment from "~/models/Comment"; import Document from "~/models/Document"; diff --git a/app/stores/DocumentsStore.ts b/app/stores/DocumentsStore.ts index e630bbf39e..fed26338d8 100644 --- a/app/stores/DocumentsStore.ts +++ b/app/stores/DocumentsStore.ts @@ -1,5 +1,9 @@ import invariant from "invariant"; -import { find, orderBy, filter, compact, omitBy } from "lodash"; +import compact from "lodash/compact"; +import filter from "lodash/filter"; +import find from "lodash/find"; +import omitBy from "lodash/omitBy"; +import orderBy from "lodash/orderBy"; import { observable, action, computed, runInAction } from "mobx"; import { DateFilter, NavigationNode, PublicTeam } from "@shared/types"; import { subtractDate } from "@shared/utils/date"; diff --git a/app/stores/EventsStore.ts b/app/stores/EventsStore.ts index d8c17c89d6..5c9f1c3565 100644 --- a/app/stores/EventsStore.ts +++ b/app/stores/EventsStore.ts @@ -1,4 +1,5 @@ -import { sortBy, filter } from "lodash"; +import filter from "lodash/filter"; +import sortBy from "lodash/sortBy"; import { computed } from "mobx"; import Event from "~/models/Event"; import BaseStore, { RPCAction } from "./BaseStore"; diff --git a/app/stores/FileOperationsStore.ts b/app/stores/FileOperationsStore.ts index 18133a9221..d4ec7feb3c 100644 --- a/app/stores/FileOperationsStore.ts +++ b/app/stores/FileOperationsStore.ts @@ -1,4 +1,4 @@ -import { orderBy } from "lodash"; +import orderBy from "lodash/orderBy"; import { computed } from "mobx"; import { FileOperationType } from "@shared/types"; import FileOperation from "~/models/FileOperation"; diff --git a/app/stores/GroupMembershipsStore.ts b/app/stores/GroupMembershipsStore.ts index 8681ac907a..992e3163ae 100644 --- a/app/stores/GroupMembershipsStore.ts +++ b/app/stores/GroupMembershipsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { filter } from "lodash"; +import filter from "lodash/filter"; import { action, runInAction } from "mobx"; import GroupMembership from "~/models/GroupMembership"; import { PaginationParams } from "~/types"; diff --git a/app/stores/GroupsStore.ts b/app/stores/GroupsStore.ts index 8da97a1ba7..8dc9e7b28c 100644 --- a/app/stores/GroupsStore.ts +++ b/app/stores/GroupsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { filter } from "lodash"; +import filter from "lodash/filter"; import { action, runInAction, computed } from "mobx"; import naturalSort from "@shared/utils/naturalSort"; import Group from "~/models/Group"; diff --git a/app/stores/IntegrationsStore.ts b/app/stores/IntegrationsStore.ts index ceb36795f1..2460bcda59 100644 --- a/app/stores/IntegrationsStore.ts +++ b/app/stores/IntegrationsStore.ts @@ -1,4 +1,4 @@ -import { filter } from "lodash"; +import filter from "lodash/filter"; import { computed } from "mobx"; import { IntegrationService } from "@shared/types"; import naturalSort from "@shared/utils/naturalSort"; diff --git a/app/stores/NotificationsStore.ts b/app/stores/NotificationsStore.ts index 9eee1e542a..7470f0df09 100644 --- a/app/stores/NotificationsStore.ts +++ b/app/stores/NotificationsStore.ts @@ -1,5 +1,6 @@ import invariant from "invariant"; -import { orderBy, sortBy } from "lodash"; +import orderBy from "lodash/orderBy"; +import sortBy from "lodash/sortBy"; import { action, computed, runInAction } from "mobx"; import Notification from "~/models/Notification"; import { PaginationParams } from "~/types"; diff --git a/app/stores/RevisionsStore.ts b/app/stores/RevisionsStore.ts index 53ad62af05..dcac76b663 100644 --- a/app/stores/RevisionsStore.ts +++ b/app/stores/RevisionsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { filter } from "lodash"; +import filter from "lodash/filter"; import { action, runInAction } from "mobx"; import BaseStore, { RPCAction } from "~/stores/BaseStore"; import RootStore from "~/stores/RootStore"; diff --git a/app/stores/SearchesStore.ts b/app/stores/SearchesStore.ts index 3f41b31fe2..5498db2a34 100644 --- a/app/stores/SearchesStore.ts +++ b/app/stores/SearchesStore.ts @@ -1,4 +1,4 @@ -import { uniqBy } from "lodash"; +import uniqBy from "lodash/uniqBy"; import { computed } from "mobx"; import SearchQuery from "~/models/SearchQuery"; import BaseStore, { RPCAction } from "./BaseStore"; diff --git a/app/stores/SharesStore.ts b/app/stores/SharesStore.ts index c244ed2832..23ee81b8c4 100644 --- a/app/stores/SharesStore.ts +++ b/app/stores/SharesStore.ts @@ -1,5 +1,8 @@ import invariant from "invariant"; -import { sortBy, filter, find, isUndefined } from "lodash"; +import filter from "lodash/filter"; +import find from "lodash/find"; +import isUndefined from "lodash/isUndefined"; +import sortBy from "lodash/sortBy"; import { action, computed } from "mobx"; import Share from "~/models/Share"; import { client } from "~/utils/ApiClient"; diff --git a/app/stores/ToastsStore.ts b/app/stores/ToastsStore.ts index 81dc347a57..ce3d16a4aa 100644 --- a/app/stores/ToastsStore.ts +++ b/app/stores/ToastsStore.ts @@ -1,4 +1,4 @@ -import { orderBy } from "lodash"; +import orderBy from "lodash/orderBy"; import { observable, action, computed } from "mobx"; import { v4 as uuidv4 } from "uuid"; import { Toast, ToastOptions } from "~/types"; diff --git a/app/stores/UsersStore.ts b/app/stores/UsersStore.ts index 8d7ed923f3..727c9232b8 100644 --- a/app/stores/UsersStore.ts +++ b/app/stores/UsersStore.ts @@ -1,5 +1,6 @@ import invariant from "invariant"; -import { filter, orderBy } from "lodash"; +import filter from "lodash/filter"; +import orderBy from "lodash/orderBy"; import { observable, computed, action, runInAction } from "mobx"; import { Role } from "@shared/types"; import User from "~/models/User"; diff --git a/app/stores/ViewsStore.ts b/app/stores/ViewsStore.ts index 05a2d28559..7c098db198 100644 --- a/app/stores/ViewsStore.ts +++ b/app/stores/ViewsStore.ts @@ -1,4 +1,7 @@ -import { reduce, filter, find, orderBy } from "lodash"; +import filter from "lodash/filter"; +import find from "lodash/find"; +import orderBy from "lodash/orderBy"; +import reduce from "lodash/reduce"; import View from "~/models/View"; import BaseStore, { RPCAction } from "./BaseStore"; import RootStore from "./RootStore"; diff --git a/app/utils/ApiClient.ts b/app/utils/ApiClient.ts index 39a66d61f7..810869c520 100644 --- a/app/utils/ApiClient.ts +++ b/app/utils/ApiClient.ts @@ -1,5 +1,5 @@ import retry from "fetch-retry"; -import { trim } from "lodash"; +import trim from "lodash/trim"; import queryString from "query-string"; import EDITOR_VERSION from "@shared/editor/version"; import stores from "~/stores"; diff --git a/app/utils/date.ts b/app/utils/date.ts index dd1a01023a..e94357146f 100644 --- a/app/utils/date.ts +++ b/app/utils/date.ts @@ -7,7 +7,7 @@ import { format as formatDate, } from "date-fns"; import { TFunction } from "i18next"; -import { startCase } from "lodash"; +import startCase from "lodash/startCase"; import { getCurrentDateAsString, getCurrentDateTimeAsString, diff --git a/package.json b/package.json index e1c3840f22..5e1ea31dab 100644 --- a/package.json +++ b/package.json @@ -229,7 +229,6 @@ "@babel/cli": "^7.21.5", "@babel/preset-typescript": "^7.21.4", "@getoutline/jest-runner-serial": "^2.0.0", - "@optimize-lodash/rollup-plugin": "4.0.3", "@relative-ci/agent": "^4.1.3", "@types/addressparser": "^1.0.1", "@types/body-scroll-lock": "^3.1.0", @@ -308,6 +307,7 @@ "eslint-plugin-es": "^4.1.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsx-a11y": "^6.1.0", + "eslint-plugin-lodash": "^7.4.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "^7.20.0", diff --git a/plugins/google/server/auth/google.ts b/plugins/google/server/auth/google.ts index 040f188902..7bf8c2edcd 100644 --- a/plugins/google/server/auth/google.ts +++ b/plugins/google/server/auth/google.ts @@ -1,7 +1,7 @@ import passport from "@outlinewiki/koa-passport"; import type { Context } from "koa"; import Router from "koa-router"; -import { capitalize } from "lodash"; +import capitalize from "lodash/capitalize"; import { Profile } from "passport"; import { Strategy as GoogleStrategy } from "passport-google-oauth2"; import { slugifyDomain } from "@shared/utils/domains"; diff --git a/plugins/oidc/server/auth/oidc.ts b/plugins/oidc/server/auth/oidc.ts index cda07f4f5b..d9167216af 100644 --- a/plugins/oidc/server/auth/oidc.ts +++ b/plugins/oidc/server/auth/oidc.ts @@ -1,7 +1,7 @@ import passport from "@outlinewiki/koa-passport"; import type { Context } from "koa"; import Router from "koa-router"; -import { get } from "lodash"; +import get from "lodash/get"; import { Strategy } from "passport-oauth2"; import { slugifyDomain } from "@shared/utils/domains"; import accountProvisioner from "@server/commands/accountProvisioner"; diff --git a/plugins/slack/client/Settings.tsx b/plugins/slack/client/Settings.tsx index 11d3da8445..9476880644 100644 --- a/plugins/slack/client/Settings.tsx +++ b/plugins/slack/client/Settings.tsx @@ -1,4 +1,4 @@ -import { find } from "lodash"; +import find from "lodash/find"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation, Trans } from "react-i18next"; diff --git a/plugins/slack/client/components/SlackListItem.tsx b/plugins/slack/client/components/SlackListItem.tsx index dd93c4e545..096fcc7c67 100644 --- a/plugins/slack/client/components/SlackListItem.tsx +++ b/plugins/slack/client/components/SlackListItem.tsx @@ -1,4 +1,4 @@ -import { uniq } from "lodash"; +import uniq from "lodash/uniq"; import { observer } from "mobx-react"; import * as React from "react"; import { Trans, useTranslation } from "react-i18next"; diff --git a/plugins/slack/server/api/hooks.ts b/plugins/slack/server/api/hooks.ts index 30bb69f3d7..afa7865810 100644 --- a/plugins/slack/server/api/hooks.ts +++ b/plugins/slack/server/api/hooks.ts @@ -1,6 +1,6 @@ import { t } from "i18next"; import Router from "koa-router"; -import { escapeRegExp } from "lodash"; +import escapeRegExp from "lodash/escapeRegExp"; import { Op } from "sequelize"; import { IntegrationService } from "@shared/types"; import env from "@server/env"; diff --git a/plugins/webhooks/client/components/WebhookSubscriptionForm.tsx b/plugins/webhooks/client/components/WebhookSubscriptionForm.tsx index dfe4f98ce4..1bc0e5f2b3 100644 --- a/plugins/webhooks/client/components/WebhookSubscriptionForm.tsx +++ b/plugins/webhooks/client/components/WebhookSubscriptionForm.tsx @@ -1,4 +1,6 @@ -import { isEqual, filter, includes } from "lodash"; +import filter from "lodash/filter"; +import includes from "lodash/includes"; +import isEqual from "lodash/isEqual"; import randomstring from "randomstring"; import * as React from "react"; import { useEffect } from "react"; @@ -269,9 +271,7 @@ function WebhookSubscriptionForm({ handleSubmit, webhookSubscription }: Props) { needs to function. - -
{Object.entries(WEBHOOK_EVENTS) diff --git a/plugins/webhooks/server/api/webhookSubscriptions.ts b/plugins/webhooks/server/api/webhookSubscriptions.ts index 58dc2c86f0..47332ecc68 100644 --- a/plugins/webhooks/server/api/webhookSubscriptions.ts +++ b/plugins/webhooks/server/api/webhookSubscriptions.ts @@ -1,5 +1,6 @@ import Router from "koa-router"; -import { compact, isEmpty } from "lodash"; +import compact from "lodash/compact"; +import isEmpty from "lodash/isEmpty"; import { ValidationError } from "@server/errors"; import auth from "@server/middlewares/authentication"; import { WebhookSubscription, Event } from "@server/models"; diff --git a/server/commands/documentCollaborativeUpdater.ts b/server/commands/documentCollaborativeUpdater.ts index 8c1ae8141a..64df3c30b2 100644 --- a/server/commands/documentCollaborativeUpdater.ts +++ b/server/commands/documentCollaborativeUpdater.ts @@ -1,5 +1,5 @@ import { yDocToProsemirrorJSON } from "@getoutline/y-prosemirror"; -import { uniq } from "lodash"; +import uniq from "lodash/uniq"; import { Node } from "prosemirror-model"; import * as Y from "yjs"; import { sequelize } from "@server/database/sequelize"; diff --git a/server/commands/documentImporter.ts b/server/commands/documentImporter.ts index e12252f34b..7af02a1f15 100644 --- a/server/commands/documentImporter.ts +++ b/server/commands/documentImporter.ts @@ -1,6 +1,6 @@ import path from "path"; import emojiRegex from "emoji-regex"; -import { truncate } from "lodash"; +import truncate from "lodash/truncate"; import mammoth from "mammoth"; import quotedPrintable from "quoted-printable"; import { Transaction } from "sequelize"; diff --git a/server/commands/documentPermanentDeleter.ts b/server/commands/documentPermanentDeleter.ts index 15475a047c..5de4ab3f5f 100644 --- a/server/commands/documentPermanentDeleter.ts +++ b/server/commands/documentPermanentDeleter.ts @@ -1,4 +1,4 @@ -import { uniq } from "lodash"; +import uniq from "lodash/uniq"; import { QueryTypes } from "sequelize"; import { sequelize } from "@server/database/sequelize"; import Logger from "@server/logging/Logger"; diff --git a/server/commands/notificationUpdater.ts b/server/commands/notificationUpdater.ts index 367f4f2fab..2e00040931 100644 --- a/server/commands/notificationUpdater.ts +++ b/server/commands/notificationUpdater.ts @@ -1,4 +1,4 @@ -import { isUndefined } from "lodash"; +import isUndefined from "lodash/isUndefined"; import { Transaction } from "sequelize"; import { Event, Notification } from "@server/models"; diff --git a/server/commands/teamUpdater.ts b/server/commands/teamUpdater.ts index 73f41bd48a..3d9b30a4d7 100644 --- a/server/commands/teamUpdater.ts +++ b/server/commands/teamUpdater.ts @@ -1,4 +1,4 @@ -import { has } from "lodash"; +import has from "lodash/has"; import { Transaction } from "sequelize"; import { TeamPreference } from "@shared/types"; import env from "@server/env"; diff --git a/server/commands/userInviter.ts b/server/commands/userInviter.ts index 072e0f6a9e..d0ed86b1c8 100644 --- a/server/commands/userInviter.ts +++ b/server/commands/userInviter.ts @@ -1,4 +1,4 @@ -import { uniqBy } from "lodash"; +import uniqBy from "lodash/uniqBy"; import { Role } from "@shared/types"; import InviteEmail from "@server/emails/templates/InviteEmail"; import env from "@server/env"; diff --git a/server/index.ts b/server/index.ts index e6480af9f0..05ea9e80dc 100644 --- a/server/index.ts +++ b/server/index.ts @@ -10,7 +10,7 @@ import Koa from "koa"; import helmet from "koa-helmet"; import logger from "koa-logger"; import Router from "koa-router"; -import { uniq } from "lodash"; +import uniq from "lodash/uniq"; import { AddressInfo } from "net"; import stoppable from "stoppable"; import throng from "throng"; diff --git a/server/logging/Logger.ts b/server/logging/Logger.ts index d25b69d36a..e1150686b9 100644 --- a/server/logging/Logger.ts +++ b/server/logging/Logger.ts @@ -1,7 +1,10 @@ /* eslint-disable no-console */ import { IncomingMessage } from "http"; import chalk from "chalk"; -import { isEmpty, isArray, isObject, isString } from "lodash"; +import isArray from "lodash/isArray"; +import isEmpty from "lodash/isEmpty"; +import isObject from "lodash/isObject"; +import isString from "lodash/isString"; import winston from "winston"; import env from "@server/env"; import Metrics from "@server/logging/Metrics"; diff --git a/server/middlewares/rateLimiter.ts b/server/middlewares/rateLimiter.ts index d302e61432..3bc620a6de 100644 --- a/server/middlewares/rateLimiter.ts +++ b/server/middlewares/rateLimiter.ts @@ -1,5 +1,5 @@ import { Context, Next } from "koa"; -import { defaults } from "lodash"; +import defaults from "lodash/defaults"; import env from "@server/env"; import { RateLimitExceededError } from "@server/errors"; import Logger from "@server/logging/Logger"; diff --git a/server/models/Collection.ts b/server/models/Collection.ts index cfaa8441e1..7eca296242 100644 --- a/server/models/Collection.ts +++ b/server/models/Collection.ts @@ -1,4 +1,7 @@ -import { find, findIndex, remove, uniq } from "lodash"; +import find from "lodash/find"; +import findIndex from "lodash/findIndex"; +import remove from "lodash/remove"; +import uniq from "lodash/uniq"; import randomstring from "randomstring"; import { Identifier, Transaction, Op, FindOptions } from "sequelize"; import { diff --git a/server/models/Document.ts b/server/models/Document.ts index 6cb961a0ce..230ec4c1c6 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -1,4 +1,5 @@ -import { compact, uniq } from "lodash"; +import compact from "lodash/compact"; +import uniq from "lodash/uniq"; import randomstring from "randomstring"; import type { SaveOptions } from "sequelize"; import { diff --git a/server/models/WebhookSubscription.ts b/server/models/WebhookSubscription.ts index 744e40b7c2..acf94c1f19 100644 --- a/server/models/WebhookSubscription.ts +++ b/server/models/WebhookSubscription.ts @@ -1,5 +1,5 @@ import crypto from "crypto"; -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { SaveOptions } from "sequelize"; import { Column, diff --git a/server/models/decorators/Encrypted.ts b/server/models/decorators/Encrypted.ts index 3318d7b469..02ab7d382f 100644 --- a/server/models/decorators/Encrypted.ts +++ b/server/models/decorators/Encrypted.ts @@ -1,4 +1,4 @@ -import { isNil } from "lodash"; +import isNil from "lodash/isNil"; import vaults from "@server/database/vaults"; import Logger from "@server/logging/Logger"; diff --git a/server/models/helpers/AuthenticationHelper.ts b/server/models/helpers/AuthenticationHelper.ts index 9a56e61010..c20b5c281b 100644 --- a/server/models/helpers/AuthenticationHelper.ts +++ b/server/models/helpers/AuthenticationHelper.ts @@ -2,7 +2,8 @@ import path from "path"; import { glob } from "glob"; import Router from "koa-router"; -import { find, sortBy } from "lodash"; +import find from "lodash/find"; +import sortBy from "lodash/sortBy"; import env from "@server/env"; import Team from "@server/models/Team"; diff --git a/server/models/helpers/DocumentHelper.tsx b/server/models/helpers/DocumentHelper.tsx index ad734f94fa..358041a63a 100644 --- a/server/models/helpers/DocumentHelper.tsx +++ b/server/models/helpers/DocumentHelper.tsx @@ -3,7 +3,8 @@ import { yDocToProsemirrorJSON, } from "@getoutline/y-prosemirror"; import { JSDOM } from "jsdom"; -import { escapeRegExp, startCase } from "lodash"; +import escapeRegExp from "lodash/escapeRegExp"; +import startCase from "lodash/startCase"; import { Node } from "prosemirror-model"; import * as Y from "yjs"; import textBetween from "@shared/editor/lib/textBetween"; diff --git a/server/models/helpers/SearchHelper.ts b/server/models/helpers/SearchHelper.ts index 6ac8c2e763..5ecee4f743 100644 --- a/server/models/helpers/SearchHelper.ts +++ b/server/models/helpers/SearchHelper.ts @@ -1,6 +1,7 @@ import removeMarkdown from "@tommoor/remove-markdown"; import invariant from "invariant"; -import { find, map } from "lodash"; +import find from "lodash/find"; +import map from "lodash/map"; import queryParser from "pg-tsquery"; import { Op, QueryTypes, WhereOptions } from "sequelize"; import { DateFilter } from "@shared/types"; diff --git a/server/models/validators/Length.ts b/server/models/validators/Length.ts index a36ff66521..572fcd7a0d 100644 --- a/server/models/validators/Length.ts +++ b/server/models/validators/Length.ts @@ -1,4 +1,4 @@ -import { size } from "lodash"; +import size from "lodash/size"; import { addAttributeOptions } from "sequelize-typescript"; /** diff --git a/server/models/validators/TextLength.ts b/server/models/validators/TextLength.ts index a22d235b75..6dcc6eaacd 100644 --- a/server/models/validators/TextLength.ts +++ b/server/models/validators/TextLength.ts @@ -1,4 +1,4 @@ -import { size } from "lodash"; +import size from "lodash/size"; import { Node } from "prosemirror-model"; import { addAttributeOptions } from "sequelize-typescript"; import { ProsemirrorData } from "@shared/types"; diff --git a/server/onerror.ts b/server/onerror.ts index c167b2b1d2..97f0f2972e 100644 --- a/server/onerror.ts +++ b/server/onerror.ts @@ -2,7 +2,9 @@ import fs from "fs"; import http from "http"; import path from "path"; import Koa, { Context } from "koa"; -import { isNil, escape, snakeCase } from "lodash"; +import escape from "lodash/escape"; +import isNil from "lodash/isNil"; +import snakeCase from "lodash/snakeCase"; import { ValidationError, EmptyResultError } from "sequelize"; import env from "@server/env"; import { InternalError } from "@server/errors"; diff --git a/server/policies/collection.ts b/server/policies/collection.ts index 70420ab447..42cac6fc64 100644 --- a/server/policies/collection.ts +++ b/server/policies/collection.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { some } from "lodash"; +import some from "lodash/some"; import { CollectionPermission } from "@shared/types"; import { Collection, User, Team } from "@server/models"; import { AdminRequiredError } from "../errors"; diff --git a/server/presenters/policy.ts b/server/presenters/policy.ts index 472b7975cb..e120ec6613 100644 --- a/server/presenters/policy.ts +++ b/server/presenters/policy.ts @@ -1,4 +1,4 @@ -import { compact } from "lodash"; +import compact from "lodash/compact"; import { traceFunction } from "@server/logging/tracing"; import { User } from "@server/models"; diff --git a/server/queues/tasks/ExportJSONTask.ts b/server/queues/tasks/ExportJSONTask.ts index 8ee6e64d5c..53be310922 100644 --- a/server/queues/tasks/ExportJSONTask.ts +++ b/server/queues/tasks/ExportJSONTask.ts @@ -1,5 +1,5 @@ import JSZip from "jszip"; -import { omit } from "lodash"; +import omit from "lodash/omit"; import { NavigationNode } from "@shared/types"; import { parser } from "@server/editor"; import env from "@server/env"; diff --git a/server/queues/tasks/ExportTask.ts b/server/queues/tasks/ExportTask.ts index 906b2d15b7..c24ffed598 100644 --- a/server/queues/tasks/ExportTask.ts +++ b/server/queues/tasks/ExportTask.ts @@ -1,5 +1,5 @@ import fs from "fs"; -import { truncate } from "lodash"; +import truncate from "lodash/truncate"; import { FileOperationState, NotificationEventType } from "@shared/types"; import ExportFailureEmail from "@server/emails/templates/ExportFailureEmail"; import ExportSuccessEmail from "@server/emails/templates/ExportSuccessEmail"; diff --git a/server/queues/tasks/ImportJSONTask.ts b/server/queues/tasks/ImportJSONTask.ts index e6d8b82ba4..fb4c6869e9 100644 --- a/server/queues/tasks/ImportJSONTask.ts +++ b/server/queues/tasks/ImportJSONTask.ts @@ -1,5 +1,6 @@ import JSZip from "jszip"; -import { escapeRegExp, find } from "lodash"; +import escapeRegExp from "lodash/escapeRegExp"; +import find from "lodash/find"; import mime from "mime-types"; import { Node } from "prosemirror-model"; import { v4 as uuidv4 } from "uuid"; diff --git a/server/queues/tasks/ImportMarkdownZipTask.ts b/server/queues/tasks/ImportMarkdownZipTask.ts index 112a723f89..dfa725bd22 100644 --- a/server/queues/tasks/ImportMarkdownZipTask.ts +++ b/server/queues/tasks/ImportMarkdownZipTask.ts @@ -1,5 +1,5 @@ import JSZip from "jszip"; -import { escapeRegExp } from "lodash"; +import escapeRegExp from "lodash/escapeRegExp"; import mime from "mime-types"; import { v4 as uuidv4 } from "uuid"; import documentImporter from "@server/commands/documentImporter"; diff --git a/server/queues/tasks/ImportNotionTask.ts b/server/queues/tasks/ImportNotionTask.ts index ada3e2d659..d90f668afd 100644 --- a/server/queues/tasks/ImportNotionTask.ts +++ b/server/queues/tasks/ImportNotionTask.ts @@ -1,6 +1,7 @@ import path from "path"; import JSZip from "jszip"; -import { compact, escapeRegExp } from "lodash"; +import compact from "lodash/compact"; +import escapeRegExp from "lodash/escapeRegExp"; import mime from "mime-types"; import { v4 as uuidv4 } from "uuid"; import documentImporter from "@server/commands/documentImporter"; diff --git a/server/queues/tasks/ImportTask.ts b/server/queues/tasks/ImportTask.ts index c92d7446a5..6b818f837d 100644 --- a/server/queues/tasks/ImportTask.ts +++ b/server/queues/tasks/ImportTask.ts @@ -1,5 +1,5 @@ import { S3 } from "aws-sdk"; -import { truncate } from "lodash"; +import truncate from "lodash/truncate"; import { CollectionPermission, CollectionSort, diff --git a/server/queues/tasks/RevisionCreatedNotificationsTask.ts b/server/queues/tasks/RevisionCreatedNotificationsTask.ts index f4f44ac3e4..354e59833f 100644 --- a/server/queues/tasks/RevisionCreatedNotificationsTask.ts +++ b/server/queues/tasks/RevisionCreatedNotificationsTask.ts @@ -1,5 +1,5 @@ import { subHours } from "date-fns"; -import { differenceBy } from "lodash"; +import differenceBy from "lodash/differenceBy"; import { Op } from "sequelize"; import { NotificationEventType } from "@shared/types"; import { createSubscriptionsForDocument } from "@server/commands/subscriptionCreator"; diff --git a/server/redis.ts b/server/redis.ts index ef8027a3ef..1a7536db0a 100644 --- a/server/redis.ts +++ b/server/redis.ts @@ -1,5 +1,5 @@ import Redis, { RedisOptions } from "ioredis"; -import { defaults } from "lodash"; +import defaults from "lodash/defaults"; import env from "@server/env"; import Logger from "@server/logging/Logger"; diff --git a/server/routes/api/attachments/schema.ts b/server/routes/api/attachments/schema.ts index 8604f0ad20..6bc3edcd56 100644 --- a/server/routes/api/attachments/schema.ts +++ b/server/routes/api/attachments/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { z } from "zod"; import { AttachmentPreset } from "@shared/types"; import BaseSchema from "@server/routes/api/BaseSchema"; diff --git a/server/routes/api/auth/auth.ts b/server/routes/api/auth/auth.ts index 4244d3b802..5467260d91 100644 --- a/server/routes/api/auth/auth.ts +++ b/server/routes/api/auth/auth.ts @@ -1,6 +1,6 @@ import { subHours, subMinutes } from "date-fns"; import Router from "koa-router"; -import { uniqBy } from "lodash"; +import uniqBy from "lodash/uniqBy"; import { TeamPreference } from "@shared/types"; import { getCookieDomain, parseDomain } from "@shared/utils/domains"; import env from "@server/env"; diff --git a/server/routes/api/collections/schema.ts b/server/routes/api/collections/schema.ts index 37e4d6ee56..0084371ae7 100644 --- a/server/routes/api/collections/schema.ts +++ b/server/routes/api/collections/schema.ts @@ -1,4 +1,4 @@ -import { isUndefined } from "lodash"; +import isUndefined from "lodash/isUndefined"; import { z } from "zod"; import { randomElement } from "@shared/random"; import { CollectionPermission, FileOperationFormat } from "@shared/types"; diff --git a/server/routes/api/cron/schema.ts b/server/routes/api/cron/schema.ts index 7f61253853..7c79893591 100644 --- a/server/routes/api/cron/schema.ts +++ b/server/routes/api/cron/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { z } from "zod"; import BaseSchema from "../BaseSchema"; diff --git a/server/routes/api/documents/schema.ts b/server/routes/api/documents/schema.ts index ef3411eab9..5932682d5b 100644 --- a/server/routes/api/documents/schema.ts +++ b/server/routes/api/documents/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import isUUID from "validator/lib/isUUID"; import { z } from "zod"; import { SHARE_URL_SLUG_REGEX } from "@shared/utils/urlHelpers"; diff --git a/server/routes/api/fileOperations/schema.ts b/server/routes/api/fileOperations/schema.ts index 08ae41dcdf..36299df003 100644 --- a/server/routes/api/fileOperations/schema.ts +++ b/server/routes/api/fileOperations/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import z from "zod"; import { FileOperationType } from "@shared/types"; import { FileOperation } from "@server/models"; diff --git a/server/routes/api/notifications/notifications.ts b/server/routes/api/notifications/notifications.ts index f65c617f26..0ae25c3e4d 100644 --- a/server/routes/api/notifications/notifications.ts +++ b/server/routes/api/notifications/notifications.ts @@ -1,5 +1,6 @@ import Router from "koa-router"; -import { isNull, isUndefined } from "lodash"; +import isNull from "lodash/isNull"; +import isUndefined from "lodash/isUndefined"; import { WhereOptions, Op } from "sequelize"; import { NotificationEventType } from "@shared/types"; import notificationUpdater from "@server/commands/notificationUpdater"; diff --git a/server/routes/api/notifications/schema.ts b/server/routes/api/notifications/schema.ts index 726816bd48..ac0cfa636b 100644 --- a/server/routes/api/notifications/schema.ts +++ b/server/routes/api/notifications/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { z } from "zod"; import { NotificationEventType } from "@shared/types"; import BaseSchema from "../BaseSchema"; diff --git a/server/routes/api/revisions/schema.ts b/server/routes/api/revisions/schema.ts index 5d3df7fe36..76b874d9af 100644 --- a/server/routes/api/revisions/schema.ts +++ b/server/routes/api/revisions/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { z } from "zod"; import { Revision } from "@server/models"; import BaseSchema from "@server/routes/api/BaseSchema"; diff --git a/server/routes/api/searches/schema.ts b/server/routes/api/searches/schema.ts index c99fc49736..a8e184e336 100644 --- a/server/routes/api/searches/schema.ts +++ b/server/routes/api/searches/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { z } from "zod"; import BaseSchema from "../BaseSchema"; diff --git a/server/routes/api/shares/schema.ts b/server/routes/api/shares/schema.ts index a865d9b4fb..6b4076176e 100644 --- a/server/routes/api/shares/schema.ts +++ b/server/routes/api/shares/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import isUUID from "validator/lib/isUUID"; import { z } from "zod"; import { SHARE_URL_SLUG_REGEX, SLUG_URL_REGEX } from "@shared/utils/urlHelpers"; diff --git a/server/routes/api/shares/shares.ts b/server/routes/api/shares/shares.ts index ba7df7816a..f2c883a7c3 100644 --- a/server/routes/api/shares/shares.ts +++ b/server/routes/api/shares/shares.ts @@ -1,5 +1,5 @@ import Router from "koa-router"; -import { isUndefined } from "lodash"; +import isUndefined from "lodash/isUndefined"; import { Op, WhereOptions } from "sequelize"; import { NotFoundError } from "@server/errors"; import auth from "@server/middlewares/authentication"; diff --git a/server/routes/api/stars/schema.ts b/server/routes/api/stars/schema.ts index 0cd460c8d6..42573081f1 100644 --- a/server/routes/api/stars/schema.ts +++ b/server/routes/api/stars/schema.ts @@ -1,4 +1,4 @@ -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { z } from "zod"; import { ValidateDocumentId, ValidateIndex } from "@server/validation"; import BaseSchema from "../BaseSchema"; diff --git a/server/routes/api/urls/schema.ts b/server/routes/api/urls/schema.ts index ce7857c1bd..d531e427b7 100644 --- a/server/routes/api/urls/schema.ts +++ b/server/routes/api/urls/schema.ts @@ -1,4 +1,4 @@ -import { isNil } from "lodash"; +import isNil from "lodash/isNil"; import { z } from "zod"; import { isUrl } from "@shared/utils/urls"; import { ValidateURL } from "@server/validation"; diff --git a/server/routes/app.ts b/server/routes/app.ts index e3f3e2e92d..01a91429e0 100644 --- a/server/routes/app.ts +++ b/server/routes/app.ts @@ -2,7 +2,7 @@ import fs from "fs"; import path from "path"; import util from "util"; import { Context, Next } from "koa"; -import { escape } from "lodash"; +import escape from "lodash/escape"; import { Sequelize } from "sequelize"; import isUUID from "validator/lib/isUUID"; import { IntegrationType, TeamPreference } from "@shared/types"; diff --git a/server/test/factories.ts b/server/test/factories.ts index 5cafc31adb..42f1cc7efc 100644 --- a/server/test/factories.ts +++ b/server/test/factories.ts @@ -1,4 +1,5 @@ -import { isNil, isNull } from "lodash"; +import isNil from "lodash/isNil"; +import isNull from "lodash/isNull"; import { v4 as uuidv4 } from "uuid"; import { CollectionPermission, diff --git a/server/utils/ShutdownHelper.ts b/server/utils/ShutdownHelper.ts index a8b553d3fe..67befd21e0 100644 --- a/server/utils/ShutdownHelper.ts +++ b/server/utils/ShutdownHelper.ts @@ -1,4 +1,4 @@ -import { groupBy } from "lodash"; +import groupBy from "lodash/groupBy"; import Logger from "@server/logging/Logger"; import { timeout } from "./timers"; diff --git a/server/utils/ZipHelper.ts b/server/utils/ZipHelper.ts index fac62b246c..20666269ad 100644 --- a/server/utils/ZipHelper.ts +++ b/server/utils/ZipHelper.ts @@ -1,7 +1,7 @@ import fs from "fs"; import path from "path"; import JSZip from "jszip"; -import { find } from "lodash"; +import find from "lodash/find"; import tmp from "tmp"; import { bytesToHumanReadable } from "@shared/utils/files"; import { ValidationError } from "@server/errors"; diff --git a/server/utils/authentication.ts b/server/utils/authentication.ts index ad3b4a0a76..39c09b6da9 100644 --- a/server/utils/authentication.ts +++ b/server/utils/authentication.ts @@ -1,7 +1,7 @@ import querystring from "querystring"; import { addMonths } from "date-fns"; import { Context } from "koa"; -import { pick } from "lodash"; +import pick from "lodash/pick"; import { Client } from "@shared/types"; import { getCookieDomain } from "@shared/utils/domains"; import env from "@server/env"; diff --git a/server/utils/koa.ts b/server/utils/koa.ts index 14a48bb9bc..1f71d8547e 100644 --- a/server/utils/koa.ts +++ b/server/utils/koa.ts @@ -1,6 +1,6 @@ import formidable from "formidable"; import { Request } from "koa"; -import { isArray } from "lodash"; +import isArray from "lodash/isArray"; /** * Get the first file from an incoming koa request diff --git a/server/utils/parseAttachmentIds.ts b/server/utils/parseAttachmentIds.ts index a97871d006..832cdfb54c 100644 --- a/server/utils/parseAttachmentIds.ts +++ b/server/utils/parseAttachmentIds.ts @@ -1,4 +1,5 @@ -import { uniq, compact } from "lodash"; +import compact from "lodash/compact"; +import uniq from "lodash/uniq"; const attachmentRedirectRegex = /\/api\/attachments\.redirect\?id=(?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/gi; diff --git a/server/utils/queue.ts b/server/utils/queue.ts index 1f96de8228..f325e30870 100644 --- a/server/utils/queue.ts +++ b/server/utils/queue.ts @@ -1,5 +1,5 @@ import Queue from "bull"; -import { snakeCase } from "lodash"; +import snakeCase from "lodash/snakeCase"; import { Second } from "@shared/utils/time"; import env from "@server/env"; import Metrics from "@server/logging/Metrics"; diff --git a/server/utils/s3.ts b/server/utils/s3.ts index c106fd438c..3dbcb3b39d 100644 --- a/server/utils/s3.ts +++ b/server/utils/s3.ts @@ -1,7 +1,7 @@ import util from "util"; import AWS, { S3 } from "aws-sdk"; import fetch from "fetch-with-proxy"; -import { compact } from "lodash"; +import compact from "lodash/compact"; import { useAgent } from "request-filtering-agent"; import { v4 as uuidv4 } from "uuid"; import Logger from "@server/logging/Logger"; diff --git a/server/utils/startup.ts b/server/utils/startup.ts index c8a6093479..1dacb54f43 100644 --- a/server/utils/startup.ts +++ b/server/utils/startup.ts @@ -1,5 +1,5 @@ import chalk from "chalk"; -import { isEmpty } from "lodash"; +import isEmpty from "lodash/isEmpty"; import { migrations } from "@server/database/sequelize"; import env from "@server/env"; import Logger from "@server/logging/Logger"; diff --git a/server/utils/turndown/confluence-code-block.ts b/server/utils/turndown/confluence-code-block.ts index 50f295178d..986a5df517 100644 --- a/server/utils/turndown/confluence-code-block.ts +++ b/server/utils/turndown/confluence-code-block.ts @@ -1,4 +1,4 @@ -import { repeat } from "lodash"; +import repeat from "lodash/repeat"; import TurndownService from "turndown"; const highlightRegExp = /brush: ([a-z0-9]+);/; diff --git a/server/utils/unfurl.ts b/server/utils/unfurl.ts index b17f3b9954..dd3684dea6 100644 --- a/server/utils/unfurl.ts +++ b/server/utils/unfurl.ts @@ -1,7 +1,7 @@ import { existsSync } from "fs"; import path from "path"; import glob from "glob"; -import { startCase } from "lodash"; +import startCase from "lodash/startCase"; import env from "@server/env"; import Logger from "@server/logging/Logger"; import { UnfurlResolver } from "@server/types"; diff --git a/server/validation.ts b/server/validation.ts index 59932e9a47..a05f09e7ec 100644 --- a/server/validation.ts +++ b/server/validation.ts @@ -1,4 +1,4 @@ -import { isArrayLike } from "lodash"; +import isArrayLike from "lodash/isArrayLike"; import { Primitive } from "utility-types"; import validator from "validator"; import isUUID from "validator/lib/isUUID"; diff --git a/shared/editor/extensions/FindAndReplace.ts b/shared/editor/extensions/FindAndReplace.ts index df0e7cedc4..f702159894 100644 --- a/shared/editor/extensions/FindAndReplace.ts +++ b/shared/editor/extensions/FindAndReplace.ts @@ -1,4 +1,4 @@ -import { escapeRegExp } from "lodash"; +import escapeRegExp from "lodash/escapeRegExp"; import { Node } from "prosemirror-model"; import { Command, Plugin, PluginKey } from "prosemirror-state"; import { Decoration, DecorationSet } from "prosemirror-view"; diff --git a/shared/editor/extensions/Prism.ts b/shared/editor/extensions/Prism.ts index 39f1c32be7..b7b32046d7 100644 --- a/shared/editor/extensions/Prism.ts +++ b/shared/editor/extensions/Prism.ts @@ -1,4 +1,5 @@ -import { flattenDeep, padStart } from "lodash"; +import flattenDeep from "lodash/flattenDeep"; +import padStart from "lodash/padStart"; import { Node } from "prosemirror-model"; import { Plugin, PluginKey, Transaction } from "prosemirror-state"; import { Decoration, DecorationSet } from "prosemirror-view"; diff --git a/shared/editor/lib/headingToSlug.ts b/shared/editor/lib/headingToSlug.ts index 9cfc42fdfd..1a5a53a43d 100644 --- a/shared/editor/lib/headingToSlug.ts +++ b/shared/editor/lib/headingToSlug.ts @@ -1,4 +1,4 @@ -import { escape } from "lodash"; +import escape from "lodash/escape"; import { Node } from "prosemirror-model"; import slugify from "slugify"; diff --git a/shared/editor/rules/attachments.ts b/shared/editor/rules/attachments.ts index 59f3d0f19e..5ceb92228d 100644 --- a/shared/editor/rules/attachments.ts +++ b/shared/editor/rules/attachments.ts @@ -26,8 +26,8 @@ function isAttachment(token: Token) { return ( // internal - href?.startsWith("/api/attachments.redirect") || // external (public share are pre-signed and this is a reasonable way of detecting them) + href?.startsWith("/api/attachments.redirect") || ((href?.startsWith(env.AWS_S3_UPLOAD_BUCKET_URL) || href?.startsWith(env.AWS_S3_ACCELERATE_URL)) && href?.includes("X-Amz-Signature")) diff --git a/shared/utils/domains.ts b/shared/utils/domains.ts index 0dc96c5fd7..69a2a5a492 100644 --- a/shared/utils/domains.ts +++ b/shared/utils/domains.ts @@ -1,4 +1,4 @@ -import { trim } from "lodash"; +import trim from "lodash/trim"; import env from "../env"; type Domain = { diff --git a/shared/utils/naturalSort.ts b/shared/utils/naturalSort.ts index 8cb7ad11b2..110e901f9c 100644 --- a/shared/utils/naturalSort.ts +++ b/shared/utils/naturalSort.ts @@ -1,5 +1,5 @@ import emojiRegex from "emoji-regex"; -import { deburr } from "lodash"; +import deburr from "lodash/deburr"; import naturalSort from "natural-sort"; type NaturalSortOptions = { diff --git a/shared/utils/urls.ts b/shared/utils/urls.ts index 14f80c0fbc..d8a280ee02 100644 --- a/shared/utils/urls.ts +++ b/shared/utils/urls.ts @@ -1,4 +1,4 @@ -import { escapeRegExp } from "lodash"; +import escapeRegExp from "lodash/escapeRegExp"; import env from "../env"; import { parseDomain } from "./domains"; diff --git a/vite.config.ts b/vite.config.ts index 50664d9e59..60600d4fde 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,5 @@ import fs from "fs"; import path from "path"; -// eslint-disable-next-line import/no-unresolved -import { optimizeLodashImports } from "@optimize-lodash/rollup-plugin"; import react from "@vitejs/plugin-react"; import browserslistToEsbuild from "browserslist-to-esbuild"; import dotenv from "dotenv"; @@ -124,8 +122,6 @@ export default () => ], }, }), - // Convert lodash imports to single imports - optimizeLodashImports(), // Generate a stats.json file for webpack that will be consumed by RelativeCI webpackStats(), ], diff --git a/yarn.lock b/yarn.lock index 122d2b20f8..123ddf71b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2089,22 +2089,6 @@ resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-1.15.1.tgz#3d745996b2bd11095b515515fd3d68d46092a02d" integrity sha512-n8Kur1/CZlYG32YCEj30CoUqA8R7UyDVZzoEU6SDP+13+kXDT2kFVu6MpcnEUTyGP3i058ID6Qjp5h6IJxdPPQ== -"@optimize-lodash/rollup-plugin@4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@optimize-lodash/rollup-plugin/-/rollup-plugin-4.0.3.tgz#dbee2c7294802a833fc5c52432614e2b7d3f2bea" - integrity sha512-zp9Yj8LL0QlUBXFmSI2EUI0phg9KvW9x1ZdsEhYuyxhNC1KiEUQR8ZEdH/GF8ZRPiKAL1fUJ8195wYlzhFsspA== - dependencies: - "@optimize-lodash/transform" "3.0.2" - "@rollup/pluginutils" "~5.0.2" - -"@optimize-lodash/transform@3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@optimize-lodash/transform/-/transform-3.0.2.tgz#90d2db478b0a68e285d0dbdeaf0654f5ae8282c3" - integrity sha512-wkRhFMnzY9BQDc6mK1ORw+NN+v2DYY8HRI1P5n9Lvh7iwXzGeef5XKHQYIMFggGLPkGjlX14tjlXiEzb4SqJPg== - dependencies: - estree-walker "2.x" - magic-string "0.27.x" - "@outlinewiki/koa-passport@^4.2.1": version "4.2.1" resolved "https://registry.yarnpkg.com/@outlinewiki/koa-passport/-/koa-passport-4.2.1.tgz#4798f9f67cddc1b52ce4201f1032d455b493025c" @@ -2516,7 +2500,7 @@ estree-walker "^1.0.1" picomatch "^2.2.2" -"@rollup/pluginutils@^5.0.1", "@rollup/pluginutils@~5.0.2": +"@rollup/pluginutils@^5.0.1": version "5.0.2" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33" integrity sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA== @@ -6390,6 +6374,13 @@ eslint-plugin-jsx-a11y@^6.1.0: jsx-ast-utils "^3.1.0" language-tags "^1.0.5" +eslint-plugin-lodash@^7.4.0: + version "7.4.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-7.4.0.tgz#14a761547f126c92ff56789662a20a44f8bb6290" + integrity sha512-Tl83UwVXqe1OVeBRKUeWcfg6/pCW1GTRObbdnbEJgYwjxp5Q92MEWQaH9+dmzbRt6kvYU1Mp893E79nJiCSM8A== + dependencies: + lodash "^4.17.21" + eslint-plugin-node@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d" @@ -6545,16 +6536,16 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== -estree-walker@2.x, estree-walker@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" - integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== - estree-walker@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== +estree-walker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -9396,13 +9387,6 @@ luxon@^3.0.1: resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.2.1.tgz#14f1af209188ad61212578ea7e3d518d18cee45f" integrity sha512-QrwPArQCNLAKGO/C+ZIilgIuDnEnKx5QYODdDtbFaxzsbZcc/a7WFq7MhsVYgRlwawLtvOUESTlfJ+hc/USqPg== -magic-string@0.27.x, magic-string@^0.27.0: - version "0.27.0" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3" - integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA== - dependencies: - "@jridgewell/sourcemap-codec" "^1.4.13" - magic-string@^0.25.0, magic-string@^0.25.7: version "0.25.9" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" @@ -9410,6 +9394,13 @@ magic-string@^0.25.0, magic-string@^0.25.7: dependencies: sourcemap-codec "^1.4.8" +magic-string@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3" + integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA== + dependencies: + "@jridgewell/sourcemap-codec" "^1.4.13" + make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"