Common imports dedup

This commit is contained in:
Marcel Mraz 2025-03-24 10:04:34 +01:00
parent 49ee6fbc14
commit ba0a9e0cb4
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
9 changed files with 32 additions and 29 deletions

View file

@ -22,13 +22,6 @@ import {
THEME, THEME,
TITLE_TIMEOUT, TITLE_TIMEOUT,
VERSION_TIMEOUT, VERSION_TIMEOUT,
} from "@excalidraw/common";
import polyfill from "@excalidraw/excalidraw/polyfill";
import { useCallback, useEffect, useRef, useState } from "react";
import { loadFromBlob } from "@excalidraw/excalidraw/data/blob";
import { useCallbackRefState } from "@excalidraw/excalidraw/hooks/useCallbackRefState";
import { t } from "@excalidraw/excalidraw/i18n";
import {
debounce, debounce,
getVersion, getVersion,
getFrame, getFrame,
@ -37,6 +30,12 @@ import {
resolvablePromise, resolvablePromise,
isRunningInIframe, isRunningInIframe,
} from "@excalidraw/common"; } from "@excalidraw/common";
import polyfill from "@excalidraw/excalidraw/polyfill";
import { useCallback, useEffect, useRef, useState } from "react";
import { loadFromBlob } from "@excalidraw/excalidraw/data/blob";
import { useCallbackRefState } from "@excalidraw/excalidraw/hooks/useCallbackRefState";
import { t } from "@excalidraw/excalidraw/i18n";
import { import {
GithubIcon, GithubIcon,
XBrandIcon, XBrandIcon,
@ -72,7 +71,7 @@ import type {
UIAppState, UIAppState,
} from "@excalidraw/excalidraw/types"; } from "@excalidraw/excalidraw/types";
import type { ResolutionType } from "@excalidraw/common/utility-types"; import type { ResolutionType } from "@excalidraw/common/utility-types";
import type { ResolvablePromise } from "@excalidraw/common"; import type { ResolvablePromise } from "@excalidraw/common/utils";
import CustomStats from "./CustomStats"; import CustomStats from "./CustomStats";
import { import {

View file

@ -1,8 +1,12 @@
import { Stats } from "@excalidraw/excalidraw"; import { Stats } from "@excalidraw/excalidraw";
import { copyTextToSystemClipboard } from "@excalidraw/excalidraw/clipboard"; import { copyTextToSystemClipboard } from "@excalidraw/excalidraw/clipboard";
import { DEFAULT_VERSION } from "@excalidraw/common"; import {
DEFAULT_VERSION,
debounce,
getVersion,
nFormatter,
} from "@excalidraw/common";
import { t } from "@excalidraw/excalidraw/i18n"; import { t } from "@excalidraw/excalidraw/i18n";
import { debounce, getVersion, nFormatter } from "@excalidraw/common";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types"; import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";

View file

@ -11,6 +11,10 @@ import {
IDLE_THRESHOLD, IDLE_THRESHOLD,
ACTIVE_THRESHOLD, ACTIVE_THRESHOLD,
UserIdleState, UserIdleState,
assertNever,
preventUnload,
resolvablePromise,
throttleRAF,
} from "@excalidraw/common"; } from "@excalidraw/common";
import { decryptData } from "@excalidraw/excalidraw/data/encryption"; import { decryptData } from "@excalidraw/excalidraw/data/encryption";
import { getVisibleSceneBounds } from "@excalidraw/element/bounds"; import { getVisibleSceneBounds } from "@excalidraw/element/bounds";
@ -22,12 +26,7 @@ import {
import { AbortError } from "@excalidraw/excalidraw/errors"; import { AbortError } from "@excalidraw/excalidraw/errors";
import { t } from "@excalidraw/excalidraw/i18n"; import { t } from "@excalidraw/excalidraw/i18n";
import { withBatchedUpdates } from "@excalidraw/excalidraw/reactUtils"; import { withBatchedUpdates } from "@excalidraw/excalidraw/reactUtils";
import {
assertNever,
preventUnload,
resolvablePromise,
throttleRAF,
} from "@excalidraw/common";
import throttle from "lodash.throttle"; import throttle from "lodash.throttle";
import { PureComponent } from "react"; import { PureComponent } from "react";

View file

@ -1,8 +1,12 @@
import React from "react";
import { uploadBytes, ref } from "firebase/storage";
import { nanoid } from "nanoid";
import { trackEvent } from "@excalidraw/excalidraw/analytics"; import { trackEvent } from "@excalidraw/excalidraw/analytics";
import { Card } from "@excalidraw/excalidraw/components/Card"; import { Card } from "@excalidraw/excalidraw/components/Card";
import { ExcalidrawLogo } from "@excalidraw/excalidraw/components/ExcalidrawLogo"; import { ExcalidrawLogo } from "@excalidraw/excalidraw/components/ExcalidrawLogo";
import { ToolButton } from "@excalidraw/excalidraw/components/ToolButton"; import { ToolButton } from "@excalidraw/excalidraw/components/ToolButton";
import { MIME_TYPES } from "@excalidraw/common"; import { MIME_TYPES, getFrame } from "@excalidraw/common";
import { import {
encryptData, encryptData,
generateEncryptionKey, generateEncryptionKey,
@ -10,10 +14,6 @@ import {
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json"; import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
import { isInitializedImageElement } from "@excalidraw/element/typeChecks"; import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
import { useI18n } from "@excalidraw/excalidraw/i18n"; import { useI18n } from "@excalidraw/excalidraw/i18n";
import { getFrame } from "@excalidraw/common";
import { uploadBytes, ref } from "firebase/storage";
import { nanoid } from "nanoid";
import React from "react";
import type { import type {
FileId, FileId,

View file

@ -11,9 +11,12 @@
*/ */
import { clearAppStateForLocalStorage } from "@excalidraw/excalidraw/appState"; import { clearAppStateForLocalStorage } from "@excalidraw/excalidraw/appState";
import { CANVAS_SEARCH_TAB, DEFAULT_SIDEBAR } from "@excalidraw/common"; import {
CANVAS_SEARCH_TAB,
DEFAULT_SIDEBAR,
debounce,
} from "@excalidraw/common";
import { clearElementsForLocalStorage } from "@excalidraw/element"; import { clearElementsForLocalStorage } from "@excalidraw/element";
import { debounce } from "@excalidraw/common";
import { import {
createStore, createStore,
entries, entries,

View file

@ -15,8 +15,7 @@ import {
import { useUIAppState } from "@excalidraw/excalidraw/context/ui-appState"; import { useUIAppState } from "@excalidraw/excalidraw/context/ui-appState";
import { useCopyStatus } from "@excalidraw/excalidraw/hooks/useCopiedIndicator"; import { useCopyStatus } from "@excalidraw/excalidraw/hooks/useCopiedIndicator";
import { useI18n } from "@excalidraw/excalidraw/i18n"; import { useI18n } from "@excalidraw/excalidraw/i18n";
import { KEYS } from "@excalidraw/common"; import { KEYS, getFrame } from "@excalidraw/common";
import { getFrame } from "@excalidraw/common";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { atom, useAtom, useAtomValue } from "../app-jotai"; import { atom, useAtom, useAtomValue } from "../app-jotai";

View file

@ -1,6 +1,5 @@
import { THEME } from "@excalidraw/excalidraw"; import { THEME } from "@excalidraw/excalidraw";
import { EVENT } from "@excalidraw/common"; import { EVENT, CODES, KEYS } from "@excalidraw/common";
import { CODES, KEYS } from "@excalidraw/common";
import { useEffect, useLayoutEffect, useState } from "react"; import { useEffect, useLayoutEffect, useState } from "react";
import type { Theme } from "@excalidraw/element/types"; import type { Theme } from "@excalidraw/element/types";

View file

@ -31,8 +31,8 @@ const getConfig = (outdir) => ({
"@excalidraw/common": path.resolve(__dirname, "../packages/common/src"), "@excalidraw/common": path.resolve(__dirname, "../packages/common/src"),
"@excalidraw/element": path.resolve(__dirname, "../packages/element/src"), "@excalidraw/element": path.resolve(__dirname, "../packages/element/src"),
"@excalidraw/excalidraw": path.resolve(__dirname, "../packages/excalidraw"), "@excalidraw/excalidraw": path.resolve(__dirname, "../packages/excalidraw"),
"@excalidraw/utils": path.resolve(__dirname, "../packages/utils"),
"@excalidraw/math": path.resolve(__dirname, "../packages/math/src"), "@excalidraw/math": path.resolve(__dirname, "../packages/math/src"),
"@excalidraw/utils": path.resolve(__dirname, "../packages/utils"),
}, },
loader: { loader: {
".woff2": "file", ".woff2": "file",

View file

@ -17,8 +17,8 @@ const getConfig = (outdir) => ({
"@excalidraw/common": path.resolve(__dirname, "../packages/common/src"), "@excalidraw/common": path.resolve(__dirname, "../packages/common/src"),
"@excalidraw/element": path.resolve(__dirname, "../packages/element/src"), "@excalidraw/element": path.resolve(__dirname, "../packages/element/src"),
"@excalidraw/excalidraw": path.resolve(__dirname, "../packages/excalidraw"), "@excalidraw/excalidraw": path.resolve(__dirname, "../packages/excalidraw"),
"@excalidraw/utils": path.resolve(__dirname, "../packages/utils"),
"@excalidraw/math": path.resolve(__dirname, "../packages/math/src"), "@excalidraw/math": path.resolve(__dirname, "../packages/math/src"),
"@excalidraw/utils": path.resolve(__dirname, "../packages/utils"),
}, },
}); });