Fix vite app

This commit is contained in:
Marcel Mraz 2025-03-18 12:53:51 +01:00
parent fc225c5353
commit 0027f08cad
19 changed files with 67 additions and 72 deletions

View file

@ -22,7 +22,7 @@ import {
THEME, THEME,
TITLE_TIMEOUT, TITLE_TIMEOUT,
VERSION_TIMEOUT, VERSION_TIMEOUT,
} from "@excalidraw/excalidraw/constants"; } from "@excalidraw/common";
import polyfill from "@excalidraw/excalidraw/polyfill"; import polyfill from "@excalidraw/excalidraw/polyfill";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import { loadFromBlob } from "@excalidraw/excalidraw/data/blob"; import { loadFromBlob } from "@excalidraw/excalidraw/data/blob";
@ -36,7 +36,7 @@ import {
preventUnload, preventUnload,
resolvablePromise, resolvablePromise,
isRunningInIframe, isRunningInIframe,
} from "@excalidraw/excalidraw/utils"; } from "@excalidraw/common";
import { import {
GithubIcon, GithubIcon,
XBrandIcon, XBrandIcon,
@ -47,10 +47,10 @@ import {
share, share,
youtubeIcon, youtubeIcon,
} from "@excalidraw/excalidraw/components/icons"; } from "@excalidraw/excalidraw/components/icons";
import { isElementLink } from "@excalidraw/excalidraw/element/elementLink"; import { isElementLink } from "@excalidraw/element/elementLink";
import { restore, restoreAppState } from "@excalidraw/excalidraw/data/restore"; import { restore, restoreAppState } from "@excalidraw/excalidraw/data/restore";
import { newElementWith } from "@excalidraw/excalidraw/element/mutateElement"; import { newElementWith } from "@excalidraw/element/mutateElement";
import { isInitializedImageElement } from "@excalidraw/excalidraw/element/typeChecks"; import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
import clsx from "clsx"; import clsx from "clsx";
import { import {
parseLibraryTokensFromUrl, parseLibraryTokensFromUrl,
@ -63,7 +63,7 @@ import type {
FileId, FileId,
NonDeletedExcalidrawElement, NonDeletedExcalidrawElement,
OrderedExcalidrawElement, OrderedExcalidrawElement,
} from "@excalidraw/excalidraw/element/types"; } from "@excalidraw/element/types";
import type { import type {
AppState, AppState,
ExcalidrawImperativeAPI, ExcalidrawImperativeAPI,
@ -72,7 +72,7 @@ import type {
UIAppState, UIAppState,
} from "@excalidraw/excalidraw/types"; } from "@excalidraw/excalidraw/types";
import type { ResolutionType } from "@excalidraw/excalidraw/utility-types"; import type { ResolutionType } from "@excalidraw/excalidraw/utility-types";
import type { ResolvablePromise } from "@excalidraw/excalidraw/utils"; import type { ResolvablePromise } from "@excalidraw/common";
import CustomStats from "./CustomStats"; import CustomStats from "./CustomStats";
import { import {

View file

@ -1,11 +1,11 @@
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/excalidraw/constants"; import { DEFAULT_VERSION } from "@excalidraw/common";
import { t } from "@excalidraw/excalidraw/i18n"; import { t } from "@excalidraw/excalidraw/i18n";
import { debounce, getVersion, nFormatter } from "@excalidraw/excalidraw/utils"; import { debounce, getVersion, nFormatter } from "@excalidraw/common";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import type { NonDeletedExcalidrawElement } from "@excalidraw/excalidraw/element/types"; import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
import type { UIAppState } from "@excalidraw/excalidraw/types"; import type { UIAppState } from "@excalidraw/excalidraw/types";
import { import {

View file

@ -5,7 +5,7 @@ import { useLayoutEffect, useRef } from "react";
import type { import type {
FileId, FileId,
OrderedExcalidrawElement, OrderedExcalidrawElement,
} from "@excalidraw/excalidraw/element/types"; } from "@excalidraw/element/types";
import type { AppState, BinaryFileData } from "@excalidraw/excalidraw/types"; import type { AppState, BinaryFileData } from "@excalidraw/excalidraw/types";
import { STORAGE_KEYS } from "./app_constants"; import { STORAGE_KEYS } from "./app_constants";

View file

@ -6,19 +6,19 @@ import {
reconcileElements, reconcileElements,
} from "@excalidraw/excalidraw"; } from "@excalidraw/excalidraw";
import { ErrorDialog } from "@excalidraw/excalidraw/components/ErrorDialog"; import { ErrorDialog } from "@excalidraw/excalidraw/components/ErrorDialog";
import { APP_NAME, ENV, EVENT } from "@excalidraw/excalidraw/constants"; import { APP_NAME, ENV, EVENT } from "@excalidraw/common";
import { import {
IDLE_THRESHOLD, IDLE_THRESHOLD,
ACTIVE_THRESHOLD, ACTIVE_THRESHOLD,
UserIdleState, UserIdleState,
} from "@excalidraw/excalidraw/constants"; } from "@excalidraw/common";
import { decryptData } from "@excalidraw/excalidraw/data/encryption"; import { decryptData } from "@excalidraw/excalidraw/data/encryption";
import { getVisibleSceneBounds } from "@excalidraw/excalidraw/element/bounds"; import { getVisibleSceneBounds } from "@excalidraw/element/bounds";
import { newElementWith } from "@excalidraw/excalidraw/element/mutateElement"; import { newElementWith } from "@excalidraw/element/mutateElement";
import { import {
isImageElement, isImageElement,
isInitializedImageElement, isInitializedImageElement,
} from "@excalidraw/excalidraw/element/typeChecks"; } from "@excalidraw/element/typeChecks";
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";
@ -27,7 +27,7 @@ import {
preventUnload, preventUnload,
resolvablePromise, resolvablePromise,
throttleRAF, throttleRAF,
} from "@excalidraw/excalidraw/utils"; } from "@excalidraw/common";
import throttle from "lodash.throttle"; import throttle from "lodash.throttle";
import { PureComponent } from "react"; import { PureComponent } from "react";
@ -41,7 +41,7 @@ import type {
FileId, FileId,
InitializedExcalidrawImageElement, InitializedExcalidrawImageElement,
OrderedExcalidrawElement, OrderedExcalidrawElement,
} from "@excalidraw/excalidraw/element/types"; } from "@excalidraw/element/types";
import type { import type {
BinaryFileData, BinaryFileData,
ExcalidrawImperativeAPI, ExcalidrawImperativeAPI,

View file

@ -1,11 +1,11 @@
import { CaptureUpdateAction } from "@excalidraw/excalidraw"; import { CaptureUpdateAction } from "@excalidraw/excalidraw";
import { trackEvent } from "@excalidraw/excalidraw/analytics"; import { trackEvent } from "@excalidraw/excalidraw/analytics";
import { encryptData } from "@excalidraw/excalidraw/data/encryption"; import { encryptData } from "@excalidraw/excalidraw/data/encryption";
import { newElementWith } from "@excalidraw/excalidraw/element/mutateElement"; import { newElementWith } from "@excalidraw/element/mutateElement";
import throttle from "lodash.throttle"; import throttle from "lodash.throttle";
import type { UserIdleState } from "@excalidraw/excalidraw/constants"; import type { UserIdleState } from "@excalidraw/common";
import type { OrderedExcalidrawElement } from "@excalidraw/excalidraw/element/types"; import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
import type { import type {
OnUserFollowedPayload, OnUserFollowedPayload,
SocketId, SocketId,

View file

@ -6,7 +6,7 @@ import {
TTDDialog, TTDDialog,
} from "@excalidraw/excalidraw"; } from "@excalidraw/excalidraw";
import { getDataURL } from "@excalidraw/excalidraw/data/blob"; import { getDataURL } from "@excalidraw/excalidraw/data/blob";
import { safelyParseJSON } from "@excalidraw/excalidraw/utils"; import { safelyParseJSON } from "@excalidraw/common";
import type { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types"; import type { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types";

View file

@ -6,7 +6,7 @@ import {
import { MainMenu } from "@excalidraw/excalidraw/index"; import { MainMenu } from "@excalidraw/excalidraw/index";
import React from "react"; import React from "react";
import type { Theme } from "@excalidraw/excalidraw/element/types"; import type { Theme } from "@excalidraw/element/types";
import { LanguageList } from "../app-language/LanguageList"; import { LanguageList } from "../app-language/LanguageList";
import { isExcalidrawPlusSignedUser } from "../app_constants"; import { isExcalidrawPlusSignedUser } from "../app_constants";

View file

@ -1,5 +1,5 @@
import { loginIcon } from "@excalidraw/excalidraw/components/icons"; import { loginIcon } from "@excalidraw/excalidraw/components/icons";
import { POINTER_EVENTS } from "@excalidraw/excalidraw/constants"; import { POINTER_EVENTS } from "@excalidraw/common";
import { useI18n } from "@excalidraw/excalidraw/i18n"; import { useI18n } from "@excalidraw/excalidraw/i18n";
import { WelcomeScreen } from "@excalidraw/excalidraw/index"; import { WelcomeScreen } from "@excalidraw/excalidraw/index";
import React from "react"; import React from "react";

View file

@ -8,20 +8,21 @@ import {
getNormalizedCanvasDimensions, getNormalizedCanvasDimensions,
} from "@excalidraw/excalidraw/renderer/helpers"; } from "@excalidraw/excalidraw/renderer/helpers";
import { type AppState } from "@excalidraw/excalidraw/types"; import { type AppState } from "@excalidraw/excalidraw/types";
import { throttleRAF } from "@excalidraw/excalidraw/utils"; import { throttleRAF } from "@excalidraw/common";
import { useCallback, useImperativeHandle, useRef } from "react"; import { useCallback, useImperativeHandle, useRef } from "react";
import type { DebugElement } from "@excalidraw/excalidraw/visualdebug";
import { import {
isLineSegment, isLineSegment,
type GlobalPoint, type GlobalPoint,
type LineSegment, type LineSegment,
} from "../../packages/math"; } from "@excalidraw/math";
import { isCurve } from "../../packages/math/curve"; import { isCurve } from "@excalidraw/math/curve";
import { STORAGE_KEYS } from "../app_constants";
import type { Curve } from "../../packages/math"; import type { DebugElement } from "@excalidraw/excalidraw/visualdebug";
import type { Curve } from "@excalidraw/math";
import { STORAGE_KEYS } from "../app_constants";
const renderLine = ( const renderLine = (
context: CanvasRenderingContext2D, context: CanvasRenderingContext2D,

View file

@ -2,15 +2,15 @@ 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/excalidraw/constants"; import { MIME_TYPES } from "@excalidraw/common";
import { import {
encryptData, encryptData,
generateEncryptionKey, generateEncryptionKey,
} from "@excalidraw/excalidraw/data/encryption"; } from "@excalidraw/excalidraw/data/encryption";
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json"; import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
import { isInitializedImageElement } from "@excalidraw/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/excalidraw/utils"; import { getFrame } from "@excalidraw/common";
import { uploadBytes, ref } from "firebase/storage"; import { uploadBytes, ref } from "firebase/storage";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
import React from "react"; import React from "react";
@ -18,7 +18,7 @@ import React from "react";
import type { import type {
FileId, FileId,
NonDeletedExcalidrawElement, NonDeletedExcalidrawElement,
} from "@excalidraw/excalidraw/element/types"; } from "@excalidraw/element/types";
import type { import type {
AppState, AppState,
BinaryFileData, BinaryFileData,

View file

@ -1,8 +1,8 @@
import { THEME } from "@excalidraw/excalidraw/constants"; import { THEME } from "@excalidraw/common";
import oc from "open-color"; import oc from "open-color";
import React from "react"; import React from "react";
import type { Theme } from "@excalidraw/excalidraw/element/types"; import type { Theme } from "@excalidraw/element/types";
// https://github.com/tholman/github-corners // https://github.com/tholman/github-corners
export const GitHubCorner = React.memo( export const GitHubCorner = React.memo(

View file

@ -1,7 +1,7 @@
import { CaptureUpdateAction } from "@excalidraw/excalidraw"; import { CaptureUpdateAction } from "@excalidraw/excalidraw";
import { compressData } from "@excalidraw/excalidraw/data/encode"; import { compressData } from "@excalidraw/excalidraw/data/encode";
import { newElementWith } from "@excalidraw/excalidraw/element/mutateElement"; import { newElementWith } from "@excalidraw/element/mutateElement";
import { isInitializedImageElement } from "@excalidraw/excalidraw/element/typeChecks"; import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
import { t } from "@excalidraw/excalidraw/i18n"; import { t } from "@excalidraw/excalidraw/i18n";
import type { import type {
@ -9,7 +9,7 @@ import type {
ExcalidrawImageElement, ExcalidrawImageElement,
FileId, FileId,
InitializedExcalidrawImageElement, InitializedExcalidrawImageElement,
} from "@excalidraw/excalidraw/element/types"; } from "@excalidraw/element/types";
import type { import type {
BinaryFileData, BinaryFileData,
BinaryFileMetadata, BinaryFileMetadata,

View file

@ -11,12 +11,9 @@
*/ */
import { clearAppStateForLocalStorage } from "@excalidraw/excalidraw/appState"; import { clearAppStateForLocalStorage } from "@excalidraw/excalidraw/appState";
import { import { CANVAS_SEARCH_TAB, DEFAULT_SIDEBAR } from "@excalidraw/common";
CANVAS_SEARCH_TAB, import { clearElementsForLocalStorage } from "@excalidraw/element";
DEFAULT_SIDEBAR, import { debounce } from "@excalidraw/common";
} from "@excalidraw/excalidraw/constants";
import { clearElementsForLocalStorage } from "@excalidraw/excalidraw/element";
import { debounce } from "@excalidraw/excalidraw/utils";
import { import {
createStore, createStore,
entries, entries,
@ -29,10 +26,7 @@ import {
import type { LibraryPersistedData } from "@excalidraw/excalidraw/data/library"; import type { LibraryPersistedData } from "@excalidraw/excalidraw/data/library";
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types"; import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
import type { import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
ExcalidrawElement,
FileId,
} from "@excalidraw/excalidraw/element/types";
import type { import type {
AppState, AppState,
BinaryFileData, BinaryFileData,

View file

@ -1,12 +1,12 @@
import { reconcileElements } from "@excalidraw/excalidraw"; import { reconcileElements } from "@excalidraw/excalidraw";
import { MIME_TYPES } from "@excalidraw/excalidraw/constants"; import { MIME_TYPES } from "@excalidraw/common";
import { decompressData } from "@excalidraw/excalidraw/data/encode"; import { decompressData } from "@excalidraw/excalidraw/data/encode";
import { import {
encryptData, encryptData,
decryptData, decryptData,
} from "@excalidraw/excalidraw/data/encryption"; } from "@excalidraw/excalidraw/data/encryption";
import { restoreElements } from "@excalidraw/excalidraw/data/restore"; import { restoreElements } from "@excalidraw/excalidraw/data/restore";
import { getSceneVersion } from "@excalidraw/excalidraw/element"; import { getSceneVersion } from "@excalidraw/element";
import { initializeApp } from "firebase/app"; import { initializeApp } from "firebase/app";
import { import {
getFirestore, getFirestore,
@ -22,7 +22,7 @@ import type {
ExcalidrawElement, ExcalidrawElement,
FileId, FileId,
OrderedExcalidrawElement, OrderedExcalidrawElement,
} from "@excalidraw/excalidraw/element/types"; } from "@excalidraw/element/types";
import type { import type {
AppState, AppState,
BinaryFileData, BinaryFileData,

View file

@ -9,19 +9,19 @@ import {
} from "@excalidraw/excalidraw/data/encryption"; } from "@excalidraw/excalidraw/data/encryption";
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json"; import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
import { restore } from "@excalidraw/excalidraw/data/restore"; import { restore } from "@excalidraw/excalidraw/data/restore";
import { isInvisiblySmallElement } from "@excalidraw/excalidraw/element/sizeHelpers"; import { isInvisiblySmallElement } from "@excalidraw/element/sizeHelpers";
import { isInitializedImageElement } from "@excalidraw/excalidraw/element/typeChecks"; import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
import { t } from "@excalidraw/excalidraw/i18n"; import { t } from "@excalidraw/excalidraw/i18n";
import { bytesToHexString } from "@excalidraw/excalidraw/utils"; import { bytesToHexString } from "@excalidraw/common";
import type { UserIdleState } from "@excalidraw/excalidraw/constants"; import type { UserIdleState } from "@excalidraw/common";
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types"; import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
import type { SceneBounds } from "@excalidraw/excalidraw/element/bounds"; import type { SceneBounds } from "@excalidraw/element/bounds";
import type { import type {
ExcalidrawElement, ExcalidrawElement,
FileId, FileId,
OrderedExcalidrawElement, OrderedExcalidrawElement,
} from "@excalidraw/excalidraw/element/types"; } from "@excalidraw/element/types";
import type { import type {
AppState, AppState,
BinaryFileData, BinaryFileData,

View file

@ -2,9 +2,9 @@ import {
clearAppStateForLocalStorage, clearAppStateForLocalStorage,
getDefaultAppState, getDefaultAppState,
} from "@excalidraw/excalidraw/appState"; } from "@excalidraw/excalidraw/appState";
import { clearElementsForLocalStorage } from "@excalidraw/excalidraw/element"; import { clearElementsForLocalStorage } from "@excalidraw/element";
import type { ExcalidrawElement } from "@excalidraw/excalidraw/element/types"; import type { ExcalidrawElement } from "@excalidraw/element/types";
import type { AppState } from "@excalidraw/excalidraw/types"; import type { AppState } from "@excalidraw/excalidraw/types";
import { STORAGE_KEYS } from "../app_constants"; import { STORAGE_KEYS } from "../app_constants";

View file

@ -15,8 +15,8 @@ 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/excalidraw/keys"; import { KEYS } from "@excalidraw/common";
import { getFrame } from "@excalidraw/excalidraw/utils"; 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,9 +1,9 @@
import { THEME } from "@excalidraw/excalidraw"; import { THEME } from "@excalidraw/excalidraw";
import { EVENT } from "@excalidraw/excalidraw/constants"; import { EVENT } from "@excalidraw/common";
import { CODES, KEYS } from "@excalidraw/excalidraw/keys"; import { CODES, KEYS } from "@excalidraw/common";
import { useEffect, useLayoutEffect, useState } from "react"; import { useEffect, useLayoutEffect, useState } from "react";
import type { Theme } from "@excalidraw/excalidraw/element/types"; import type { Theme } from "@excalidraw/element/types";
import { STORAGE_KEYS } from "./app_constants"; import { STORAGE_KEYS } from "./app_constants";

View file

@ -25,19 +25,19 @@ export default defineConfig(({ mode }) => {
alias: [ alias: [
{ {
find: /^@excalidraw\/common$/, find: /^@excalidraw\/common$/,
replacement: path.resolve(__dirname, "../packages/common/index.ts"), replacement: path.resolve(__dirname, "../packages/common/src/index.ts"),
}, },
{ {
find: /^@excalidraw\/common\/(.*?)/, find: /^@excalidraw\/common\/(.*?)/,
replacement: path.resolve(__dirname, "../packages/common/$1"), replacement: path.resolve(__dirname, "../packages/common/src/$1"),
}, },
{ {
find: /^@excalidraw\/element$/, find: /^@excalidraw\/element$/,
replacement: path.resolve(__dirname, "../packages/element/index.ts"), replacement: path.resolve(__dirname, "../packages/element/src/index.ts"),
}, },
{ {
find: /^@excalidraw\/element\/(.*?)/, find: /^@excalidraw\/element\/(.*?)/,
replacement: path.resolve(__dirname, "../packages/element/$1"), replacement: path.resolve(__dirname, "../packages/element/src/$1"),
}, },
{ {
find: /^@excalidraw\/excalidraw$/, find: /^@excalidraw\/excalidraw$/,
@ -57,11 +57,11 @@ export default defineConfig(({ mode }) => {
}, },
{ {
find: /^@excalidraw\/math$/, find: /^@excalidraw\/math$/,
replacement: path.resolve(__dirname, "../packages/math/index.ts"), replacement: path.resolve(__dirname, "../packages/math/src/index.ts"),
}, },
{ {
find: /^@excalidraw\/math\/(.*?)/, find: /^@excalidraw\/math\/(.*?)/,
replacement: path.resolve(__dirname, "../packages/math/$1"), replacement: path.resolve(__dirname, "../packages/math/src/$1"),
}, },
], ],
}, },