From ddac2e969aa756d72938d4c148a09d366c3c094e Mon Sep 17 00:00:00 2001 From: Marcel Mraz Date: Wed, 19 Mar 2025 21:59:42 +0100 Subject: [PATCH] Fix build --- packages/common/src/utils.ts | 4 -- packages/common/yarn.lock | 56 ------------------- packages/element/src/newElement.ts | 2 +- packages/element/src/renderElement.ts | 1 - .../element/tests/fractionalIndex.test.ts | 4 +- packages/element/tests/textElement.test.ts | 2 +- packages/excalidraw/charts.ts | 4 +- packages/excalidraw/data/reconcile.ts | 4 +- packages/excalidraw/scene/Scene.ts | 4 +- .../excalidraw/tests/data/restore.test.ts | 21 ++++--- packages/excalidraw/tests/helpers/api.ts | 2 +- packages/excalidraw/tests/test-utils.ts | 3 +- packages/utils/export.test.ts | 2 +- packages/utils/withinBounds.test.ts | 2 +- 14 files changed, 29 insertions(+), 82 deletions(-) delete mode 100644 packages/common/yarn.lock diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index 292b026fe..be530c480 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -2,17 +2,13 @@ import { average } from "@excalidraw/math"; import type { ExcalidrawBindableElement, - ExcalidrawElement, FontFamilyValues, FontString, - GroupId, - NonDeletedExcalidrawElement, } from "@excalidraw/element/types"; import type { ActiveTool, AppState, - NullableGridSize, ToolType, UnsubscribeCallback, Zoom, diff --git a/packages/common/yarn.lock b/packages/common/yarn.lock deleted file mode 100644 index 8bb349d38..000000000 --- a/packages/common/yarn.lock +++ /dev/null @@ -1,56 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -es6-promise-pool@2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/es6-promise-pool/-/es6-promise-pool-2.5.0.tgz#147c612b36b47f105027f9d2bf54a598a99d9ccb" - integrity sha512-VHErXfzR/6r/+yyzPKeBvO0lgjfC5cbDCQWjWwMZWSb6YU39TGIl51OUmCfWCq4ylMdJSB8zkz2vIuIeIxXApA== - -hachure-fill@^0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/hachure-fill/-/hachure-fill-0.5.2.tgz#d19bc4cc8750a5962b47fb1300557a85fcf934cc" - integrity sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg== - -nanoid@3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" - integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== - -open-color@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/open-color/-/open-color-1.9.1.tgz#a6e6328f60eff7aa60e3e8fcfa50f53ff3eece35" - integrity sha512-vCseG/EQ6/RcvxhUcGJiHViOgrtz4x0XbZepXvKik66TMGkvbmjeJrKFyBEx6daG5rNyyd14zYXhz0hZVwQFOw== - -path-data-parser@0.1.0, path-data-parser@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/path-data-parser/-/path-data-parser-0.1.0.tgz#8f5ba5cc70fc7becb3dcefaea08e2659aba60b8c" - integrity sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w== - -points-on-curve@0.2.0, points-on-curve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/points-on-curve/-/points-on-curve-0.2.0.tgz#7dbb98c43791859434284761330fa893cb81b4d1" - integrity sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A== - -points-on-path@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/points-on-path/-/points-on-path-0.2.1.tgz#553202b5424c53bed37135b318858eacff85dd52" - integrity sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g== - dependencies: - path-data-parser "0.1.0" - points-on-curve "0.2.0" - -roughjs@4.6.4: - version "4.6.4" - resolved "https://registry.yarnpkg.com/roughjs/-/roughjs-4.6.4.tgz#b6f39b44645854a6e0a4a28b078368701eb7f939" - integrity sha512-s6EZ0BntezkFYMf/9mGn7M8XGIoaav9QQBCnJROWB3brUWQ683Q2LbRD/hq0Z3bAJ/9NVpU/5LpiTWvQMyLDhw== - dependencies: - hachure-fill "^0.5.2" - path-data-parser "^0.1.0" - points-on-curve "^0.2.0" - points-on-path "^0.2.1" - -typescript@4.9.4: - version "4.9.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78" - integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg== diff --git a/packages/element/src/newElement.ts b/packages/element/src/newElement.ts index f0972cf2d..db5a8126f 100644 --- a/packages/element/src/newElement.ts +++ b/packages/element/src/newElement.ts @@ -12,7 +12,7 @@ import { getFontString, getUpdatedTimestamp, isTestEnv, - getLineHeight + getLineHeight, } from "@excalidraw/common"; import type { Radians } from "@excalidraw/math"; diff --git a/packages/element/src/renderElement.ts b/packages/element/src/renderElement.ts index 5c21f0735..b52e0a29b 100644 --- a/packages/element/src/renderElement.ts +++ b/packages/element/src/renderElement.ts @@ -39,7 +39,6 @@ import { import { getContainingFrame } from "@excalidraw/element/frame"; import { getCornerRadius } from "@excalidraw/element/shapes"; - import type { ExcalidrawElement, ExcalidrawTextElement, diff --git a/packages/element/tests/fractionalIndex.test.ts b/packages/element/tests/fractionalIndex.test.ts index a82f49479..b2c667693 100644 --- a/packages/element/tests/fractionalIndex.test.ts +++ b/packages/element/tests/fractionalIndex.test.ts @@ -11,8 +11,6 @@ import { import { deepCopyElement } from "@excalidraw/element/newElement"; -import { InvalidFractionalIndexError } from "@excalidraw/excalidraw/errors"; - import { API } from "@excalidraw/excalidraw/tests/helpers/api"; import type { @@ -20,6 +18,8 @@ import type { FractionalIndex, } from "@excalidraw/element/types"; +import { InvalidFractionalIndexError } from "../src/fractionalIndex"; + describe("sync invalid indices with array order", () => { describe("should NOT sync empty array", () => { testMovedIndicesSync({ diff --git a/packages/element/tests/textElement.test.ts b/packages/element/tests/textElement.test.ts index 65b9b0cf9..08ff1a367 100644 --- a/packages/element/tests/textElement.test.ts +++ b/packages/element/tests/textElement.test.ts @@ -1,4 +1,4 @@ -import { getLineHeight } from "@excalidraw/excalidraw/fonts/FontMetadata"; +import { getLineHeight } from "@excalidraw/common/font-metadata"; import { API } from "@excalidraw/excalidraw/tests/helpers/api"; import { FONT_FAMILY } from "@excalidraw/common"; diff --git a/packages/excalidraw/charts.ts b/packages/excalidraw/charts.ts index d1a0b71d8..467c8136e 100644 --- a/packages/excalidraw/charts.ts +++ b/packages/excalidraw/charts.ts @@ -375,7 +375,7 @@ const chartTypeBar = ( y, groupId, backgroundColor, - import.meta.env.DEV, + !!import.meta.env.DEV, ), ]; }; @@ -457,7 +457,7 @@ const chartTypeLine = ( y, groupId, backgroundColor, - import.meta.env.DEV, + !!import.meta.env.DEV, ), line, ...lines, diff --git a/packages/excalidraw/data/reconcile.ts b/packages/excalidraw/data/reconcile.ts index dd0501995..e907ce4ae 100644 --- a/packages/excalidraw/data/reconcile.ts +++ b/packages/excalidraw/data/reconcile.ts @@ -61,7 +61,9 @@ const validateIndicesThrottled = throttle( validateFractionalIndices(elements, { // throw in dev & test only, to remain functional on `DEBUG_FRACTIONAL_INDICES` - shouldThrow: import.meta.env.DEV || import.meta.env.MODE === ENV.TEST, + shouldThrow: Boolean( + import.meta.env.DEV || import.meta.env.MODE === ENV.TEST, + ), includeBoundTextValidation: true, reconciliationContext: { localElements, diff --git a/packages/excalidraw/scene/Scene.ts b/packages/excalidraw/scene/Scene.ts index 3e4235ab3..d95663870 100644 --- a/packages/excalidraw/scene/Scene.ts +++ b/packages/excalidraw/scene/Scene.ts @@ -69,7 +69,9 @@ const validateIndicesThrottled = throttle( ) { validateFractionalIndices(elements, { // throw only in dev & test, to remain functional on `DEBUG_FRACTIONAL_INDICES` - shouldThrow: import.meta.env.DEV || import.meta.env.MODE === ENV.TEST, + shouldThrow: Boolean( + import.meta.env.DEV || import.meta.env.MODE === ENV.TEST, + ), includeBoundTextValidation: true, }); } diff --git a/packages/excalidraw/tests/data/restore.test.ts b/packages/excalidraw/tests/data/restore.test.ts index 529284358..4b414bbf1 100644 --- a/packages/excalidraw/tests/data/restore.test.ts +++ b/packages/excalidraw/tests/data/restore.test.ts @@ -1,21 +1,24 @@ import { pointFrom } from "@excalidraw/math"; import { vi } from "vitest"; -import { getDefaultAppState } from "../../appState"; -import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "../../constants"; -import * as restore from "../../data/restore"; -import { newElementWith } from "../../element/mutateElement"; -import * as sizeHelpers from "../../element/sizeHelpers"; -import { API } from "../helpers/api"; +import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "@excalidraw/common"; + +import { newElementWith } from "@excalidraw/element/mutateElement"; +import * as sizeHelpers from "@excalidraw/element/sizeHelpers"; -import type { ImportedDataState } from "../../data/types"; import type { ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, ExcalidrawTextElement, -} from "../../element/types"; -import type { NormalizedZoomValue } from "../../types"; +} from "@excalidraw/element/types"; +import type { NormalizedZoomValue } from "@excalidraw/excalidraw/types"; + +import { API } from "../helpers/api"; +import * as restore from "../../data/restore"; +import { getDefaultAppState } from "../../appState"; + +import type { ImportedDataState } from "../../data/types"; describe("restoreElements", () => { const mockSizeHelper = vi.spyOn(sizeHelpers, "isInvisiblySmallElement"); diff --git a/packages/excalidraw/tests/helpers/api.ts b/packages/excalidraw/tests/helpers/api.ts index 9118ce37b..00f3fc638 100644 --- a/packages/excalidraw/tests/helpers/api.ts +++ b/packages/excalidraw/tests/helpers/api.ts @@ -19,7 +19,7 @@ import { } from "@excalidraw/element/newElement"; import { isLinearElementType } from "@excalidraw/element/typeChecks"; -import { getSelectedElements } from "@excalidraw/excalidraw/scene/selection"; +import { getSelectedElements } from "@excalidraw/element/selection"; import { assertNever } from "@excalidraw/common"; import { selectGroupsForSelectedElements } from "@excalidraw/element/groups"; diff --git a/packages/excalidraw/tests/test-utils.ts b/packages/excalidraw/tests/test-utils.ts index e2f3229ae..b2b8aff9c 100644 --- a/packages/excalidraw/tests/test-utils.ts +++ b/packages/excalidraw/tests/test-utils.ts @@ -11,12 +11,13 @@ import ansi from "ansicolor"; import { ORIG_ID, arrayToMap } from "@excalidraw/common"; +import { getSelectedElements } from "@excalidraw/element/selection"; + import type { ExcalidrawElement } from "@excalidraw/element/types"; import type { AllPossibleKeys } from "@excalidraw/common/utility-types"; import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants"; -import { getSelectedElements } from "../scene/selection"; import { UI } from "./helpers/ui"; import * as toolQueries from "./queries/toolQueries"; diff --git a/packages/utils/export.test.ts b/packages/utils/export.test.ts index 86bbe80b7..8566315b6 100644 --- a/packages/utils/export.test.ts +++ b/packages/utils/export.test.ts @@ -1,4 +1,4 @@ -import { MIME_TYPES } from "@excalidraw/excalidraw/constants"; +import { MIME_TYPES } from "@excalidraw/common"; import * as mockedSceneExportUtils from "@excalidraw/excalidraw/scene/export"; import { diagramFactory } from "@excalidraw/excalidraw/tests/fixtures/diagramFixture"; import { vi } from "vitest"; diff --git a/packages/utils/withinBounds.test.ts b/packages/utils/withinBounds.test.ts index b07d0bc33..bbc0aa62a 100644 --- a/packages/utils/withinBounds.test.ts +++ b/packages/utils/withinBounds.test.ts @@ -1,6 +1,6 @@ import { API } from "@excalidraw/excalidraw/tests/helpers/api"; -import type { Bounds } from "@excalidraw/excalidraw/element/bounds"; +import type { Bounds } from "@excalidraw/element/bounds"; import { elementPartiallyOverlapsWithOrContainsBBox,