refactor(core): Refactor some imports to reduce baseline memory usage (#15916)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-06-03 11:23:44 +02:00
committed by GitHub
parent 8abd556597
commit 7c806ff532
133 changed files with 237 additions and 238 deletions

View File

@@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event';
import Assignment from './Assignment.vue';
import { defaultSettings } from '@/__tests__/defaults';
import { STORES } from '@n8n/stores';
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import { cleanupAppModals, createAppModals } from '@/__tests__/utils';
const DEFAULT_SETUP = {

View File

@@ -1,4 +1,4 @@
import { isObject } from 'lodash-es';
import isObject from 'lodash/isObject';
import type { AssignmentValue, IDataObject } from 'n8n-workflow';
import { resolveParameter } from '@/composables/useWorkflowHelpers';
import { v4 as uuid } from 'uuid';

View File

@@ -1,4 +1,4 @@
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import userEvent from '@testing-library/user-event';
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';

View File

@@ -2,7 +2,7 @@
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import { N8nButton, N8nIcon, N8nIconButton, N8nText } from '@n8n/design-system';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { upperFirst } from 'lodash-es';
import upperFirst from 'lodash/upperFirst';
import { useI18n } from '@n8n/i18n';
import LogsViewConsumedTokenCountText from '@/components/CanvasChat/future/components/LogsViewConsumedTokenCountText.vue';
import { I18nT } from 'vue-i18n';

View File

@@ -4,7 +4,7 @@ import { useI18n } from '@n8n/i18n';
import { type LlmTokenUsageData } from '@/Interface';
import { N8nText } from '@n8n/design-system';
import { useTimestamp } from '@vueuse/core';
import { upperFirst } from 'lodash-es';
import upperFirst from 'lodash/upperFirst';
import { type ExecutionStatus } from 'n8n-workflow';
import { computed } from 'vue';

View File

@@ -1,7 +1,8 @@
import { CHAT_TRIGGER_NODE_TYPE, MANUAL_CHAT_TRIGGER_NODE_TYPE } from '@/constants';
import { type IExecutionResponse, type INodeUi, type IWorkflowDb } from '@/Interface';
import { type ChatMessage } from '@n8n/chat/types';
import { get, isEmpty } from 'lodash-es';
import get from 'lodash/get';
import isEmpty from 'lodash/isEmpty';
import { NodeConnectionTypes, type IDataObject, type IRunExecutionData } from 'n8n-workflow';
import { v4 as uuid } from 'uuid';

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { snakeCase } from 'lodash-es';
import snakeCase from 'lodash/snakeCase';
import { useSessionStorage } from '@vueuse/core';
import { N8nButton, N8nInput, N8nTooltip } from '@n8n/design-system/components';

View File

@@ -10,7 +10,7 @@ import type {
} from 'n8n-workflow';
import { deepCopy } from 'n8n-workflow';
import { get } from 'lodash-es';
import get from 'lodash/get';
import { useNDVStore } from '@/stores/ndv.store';
import { useNodeHelpers } from '@/composables/useNodeHelpers';

View File

@@ -1,4 +1,4 @@
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
import { STORES } from '@n8n/stores';

View File

@@ -2,7 +2,7 @@
import { N8nIcon, N8nTooltip } from '@n8n/design-system';
import type { TableInstance } from 'element-plus';
import { ElTable, ElTableColumn } from 'element-plus';
import { isEqual } from 'lodash-es';
import isEqual from 'lodash/isEqual';
import { nextTick, ref, watch } from 'vue';
import type { RouteLocationRaw } from 'vue-router';
/**

View File

@@ -7,7 +7,7 @@ import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import { within, waitFor } from '@testing-library/vue';
import { getFilterOperator } from './utils';
import { get } from 'lodash-es';
import get from 'lodash/get';
const DEFAULT_SETUP = {
pinia: createTestingPinia({

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { isEmpty, isEqual } from 'lodash-es';
import isEmpty from 'lodash/isEmpty';
import isEqual from 'lodash/isEqual';
import {
type FilterConditionValue,

View File

@@ -4,7 +4,7 @@ import type { IUpdateInformation } from '@/Interface';
import type { INodeParameters, INodeProperties, NodeParameterValueType } from 'n8n-workflow';
import { deepCopy, isINodePropertyCollectionList } from 'n8n-workflow';
import { get } from 'lodash-es';
import get from 'lodash/get';
import { computed, ref, watch, onBeforeMount } from 'vue';
import { useI18n } from '@n8n/i18n';

View File

@@ -11,7 +11,7 @@ import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useNDVStore } from '@/stores/ndv.store';
import { waitingNodeTooltip } from '@/utils/executionUtils';
import { uniqBy } from 'lodash-es';
import uniqBy from 'lodash/uniqBy';
import { N8nIcon, N8nRadioButtons, N8nText, N8nTooltip } from '@n8n/design-system';
import {
type INodeInputConfiguration,

View File

@@ -2,7 +2,7 @@ import { describe, it, expect, vi } from 'vitest';
import { waitFor } from '@testing-library/vue';
import userEvent from '@testing-library/user-event';
import { createTestingPinia } from '@pinia/testing';
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import { SOURCE_CONTROL_PULL_MODAL_KEY, SOURCE_CONTROL_PUSH_MODAL_KEY } from '@/constants';
import { STORES } from '@n8n/stores';
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref, watch, computed } from 'vue';
import { get } from 'lodash-es';
import get from 'lodash/get';
import type { INodeParameters, INodeProperties } from 'n8n-workflow';
import { deepCopy } from 'n8n-workflow';

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { SubcategoryItemProps } from '@/Interface';
import { camelCase } from 'lodash-es';
import camelCase from 'lodash/camelCase';
import { computed } from 'vue';
import { useI18n } from '@n8n/i18n';
import type { BaseTextKey } from '@n8n/i18n';

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { camelCase } from 'lodash-es';
import camelCase from 'lodash/camelCase';
import { computed } from 'vue';
import type {
ActionTypeDescription,

View File

@@ -6,7 +6,8 @@ import {
CUSTOM_API_CALL_KEY,
HTTP_REQUEST_NODE_TYPE,
} from '@/constants';
import { memoize, startCase } from 'lodash-es';
import memoize from 'lodash/memoize';
import startCase from 'lodash/startCase';
import type {
ICredentialType,
INodeProperties,

View File

@@ -19,7 +19,7 @@ import {
import { defineStore } from 'pinia';
import { v4 as uuid } from 'uuid';
import { computed, nextTick, ref } from 'vue';
import difference from 'lodash-es/difference';
import difference from 'lodash/difference';
import { useNodeCreatorStore } from '@/stores/nodeCreator.store';

View File

@@ -22,7 +22,7 @@ import { v4 as uuidv4 } from 'uuid';
import { sublimeSearch } from '@n8n/utils/search/sublimeSearch';
import type { NodeViewItemSection } from './viewsData';
import { i18n } from '@n8n/i18n';
import { sortBy } from 'lodash-es';
import sortBy from 'lodash/sortBy';
import * as changeCase from 'change-case';
import { useSettingsStore } from '@/stores/settings.store';

View File

@@ -65,7 +65,7 @@ import type { INodeTypeDescription, NodeConnectionType, Themed } from 'n8n-workf
import { EVALUATION_TRIGGER_NODE_TYPE, NodeConnectionTypes } from 'n8n-workflow';
import { useTemplatesStore } from '@/stores/templates.store';
import type { BaseTextKey } from '@n8n/i18n';
import { camelCase } from 'lodash-es';
import camelCase from 'lodash/camelCase';
import { useSettingsStore } from '@/stores/settings.store';
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
export interface NodeViewItemSection {

View File

@@ -32,7 +32,9 @@ import NodeCredentials from '@/components/NodeCredentials.vue';
import NodeSettingsTabs from '@/components/NodeSettingsTabs.vue';
import NodeWebhooks from '@/components/NodeWebhooks.vue';
import NDVSubConnections from '@/components/NDVSubConnections.vue';
import { get, set, unset } from 'lodash-es';
import get from 'lodash/get';
import set from 'lodash/set';
import unset from 'lodash/unset';
import NodeExecuteButton from './NodeExecuteButton.vue';
import { isCommunityPackageName } from '@/utils/nodeTypesUtils';

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref, watch } from 'vue';
import { get } from 'lodash-es';
import get from 'lodash/get';
import type {
INodeUi,

View File

@@ -36,7 +36,8 @@ import {
} from '@/utils/nodeTypesUtils';
import { captureException } from '@sentry/vue';
import { computedWithControl } from '@vueuse/core';
import { get, set } from 'lodash-es';
import get from 'lodash/get';
import set from 'lodash/set';
import { N8nIcon, N8nIconButton, N8nInputLabel, N8nNotice, N8nText } from '@n8n/design-system';
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia';

View File

@@ -29,7 +29,7 @@ import { useNDVStore } from '@/stores/ndv.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useDocumentVisibility } from '@/composables/useDocumentVisibility';
import { N8nButton, N8nCallout, N8nNotice } from '@n8n/design-system';
import { isEqual } from 'lodash-es';
import isEqual from 'lodash/isEqual';
type Props = {
parameter: INodeProperties;

View File

@@ -68,7 +68,8 @@ import { executionDataToJson } from '@/utils/nodeTypesUtils';
import { getGenericHints } from '@/utils/nodeViewUtils';
import { searchInObject } from '@/utils/objectUtils';
import { clearJsonKey, isEmpty, isPresent } from '@/utils/typesUtils';
import { isEqual, isObject } from 'lodash-es';
import isEqual from 'lodash/isEqual';
import isObject from 'lodash/isObject';
import {
N8nBlockUi,
N8nButton,

View File

@@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { IAiDataContent } from '@/Interface';
import { capitalize } from 'lodash-es';
import capitalize from 'lodash/capitalize';
import { computed, ref } from 'vue';
import { NodeConnectionTypes } from 'n8n-workflow';
import type { NodeConnectionType, NodeError } from 'n8n-workflow';

View File

@@ -1,5 +1,5 @@
import { createTestingPinia } from '@pinia/testing';
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import SSOLogin from '@/components/SSOLogin.vue';
import { STORES } from '@n8n/stores';
import { useSSOStore } from '@/stores/sso.store';

View File

@@ -1,6 +1,8 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { get, set, unset } from 'lodash-es';
import get from 'lodash/get';
import set from 'lodash/set';
import unset from 'lodash/unset';
import type {
IDataObject,
NodeParameterValue,

View File

@@ -9,7 +9,8 @@ import { useSourceControlStore } from '@/stores/sourceControl.store';
import { useUIStore } from '@/stores/ui.store';
import { computed } from 'vue';
import { sourceControlEventBus } from '@/event-bus/source-control';
import { orderBy, groupBy } from 'lodash-es';
import groupBy from 'lodash/groupBy';
import orderBy from 'lodash/orderBy';
import { N8nBadge, N8nText, N8nLink, N8nButton } from '@n8n/design-system';
import { RouterLink } from 'vue-router';
import {

View File

@@ -35,7 +35,8 @@ import {
SOURCE_CONTROL_FILE_TYPE,
SOURCE_CONTROL_FILE_LOCATION,
} from '@n8n/api-types';
import { orderBy, groupBy } from 'lodash-es';
import groupBy from 'lodash/groupBy';
import orderBy from 'lodash/orderBy';
import { getStatusText, getStatusTheme, getPushPriorityByStatus } from '@/utils/sourceControlUtils';
import { useTelemetry } from '@/composables/useTelemetry';

View File

@@ -5,7 +5,7 @@ import type { ITag } from '@/Interface';
import IntersectionObserver from './IntersectionObserver.vue';
import IntersectionObserved from './IntersectionObserved.vue';
import { createEventBus } from '@n8n/utils/event-bus';
import { debounce } from 'lodash-es';
import debounce from 'lodash/debounce';
interface TagsContainerProps {
tagIds: string[];

View File

@@ -42,7 +42,7 @@ import { useSettingsStore } from '@/stores/settings.store';
import { isEmpty } from '@/utils/typesUtils';
import { asyncComputed } from '@vueuse/core';
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
import { pick } from 'lodash-es';
import pick from 'lodash/pick';
import { DateTime } from 'luxon';
import NodeExecuteButton from './NodeExecuteButton.vue';

View File

@@ -3,7 +3,7 @@ import WorkflowExtractionNameModal from '@/components/WorkflowExtractionNameModa
import { WORKFLOW_EXTRACTION_NAME_MODAL_KEY } from '@/constants';
import type { INodeUi } from '@/Interface';
import type { ExtractableSubgraphData } from 'n8n-workflow';
import { cloneDeep } from 'lodash-es';
import cloneDeep from 'lodash/cloneDeep';
import userEvent from '@testing-library/user-event';
import { createTestingPinia } from '@pinia/testing';
import { createComponentRenderer } from '@/__tests__/render';

View File

@@ -1,6 +1,6 @@
import { ref, computed } from 'vue';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { sortBy } from 'lodash-es';
import sortBy from 'lodash/sortBy';
import type { Router } from 'vue-router';
import { VIEWS } from '@/constants';

View File

@@ -1,7 +1,7 @@
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
import { STORES } from '@n8n/stores';
import { createTestingPinia } from '@pinia/testing';
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import type { ResourceMapperFields, ResourceMapperValue } from 'n8n-workflow';
export const NODE_PARAMETER_VALUES = {

View File

@@ -32,7 +32,7 @@ import {
} from '@/utils/canvasUtils';
import type { EventBus } from '@n8n/utils/event-bus';
import { createEventBus } from '@n8n/utils/event-bus';
import { isEqual } from 'lodash-es';
import isEqual from 'lodash/isEqual';
import CanvasNodeTrigger from '@/components/canvas/elements/nodes/render-types/parts/CanvasNodeTrigger.vue';
type Props = NodeProps<CanvasNodeData> & {

View File

@@ -8,7 +8,7 @@ import type { IWorkflowShortResponse, ExecutionFilterType } from '@/Interface';
import { createComponentRenderer } from '@/__tests__/render';
import * as telemetryModule from '@/composables/useTelemetry';
import type { Telemetry } from '@/plugins/telemetry';
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
const defaultFilterState: ExecutionFilterType = {
status: 'all',

View File

@@ -1,5 +1,5 @@
import { vi, describe, it, expect } from 'vitest';
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import { faker } from '@faker-js/faker';

View File

@@ -5,7 +5,7 @@ import WorkflowExecutionsSidebar from '@/components/executions/workflow/Workflow
import { useSettingsStore } from '@/stores/settings.store';
import { mockedStore, SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
import { STORES } from '@n8n/stores';
import { merge } from 'lodash-es';
import merge from 'lodash/merge';
import { expect, it } from 'vitest';
vi.mock('vue-router', () => {