From 8612062be3c902d1c9674cdb74165ee79439df7a Mon Sep 17 00:00:00 2001 From: zbeyens Date: Mon, 2 Oct 2023 20:54:25 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/tsup.config.ts | 39 +++++++---------- package.json | 3 +- packages/autoformat/package.json | 2 +- .../src/transforms/autoformatBlock.ts | 2 +- .../src/transforms/autoformatMark.ts | 2 +- .../src/transforms/autoformatText.ts | 2 +- .../autoformat/src/utils/getMatchRange.ts | 2 +- packages/comments/package.json | 2 +- .../src/queries/getCommentPosition.ts | 2 +- packages/core/package.json | 2 +- packages/core/src/components/Editor.spec.tsx | 2 +- packages/core/src/hooks/useEditableProps.ts | 2 +- packages/core/src/hooks/usePlateEffects.ts | 2 +- .../utils/pluginDeserializeHtml.ts | 2 +- packages/core/src/utils/createPlugins.tsx | 2 +- packages/core/src/utils/flattenDeepPlugins.ts | 2 +- packages/core/src/utils/getKeysByTypes.ts | 2 +- packages/core/src/utils/mergeDeepPlugins.ts | 5 +-- packages/core/src/utils/mergeDeepToNodes.ts | 2 +- .../core/src/utils/normalizeInitialValue.ts | 3 +- .../core/src/utils/overridePluginsByKey.ts | 2 +- packages/dnd/package.json | 2 +- .../src/components/Scroller/ScrollArea.tsx | 2 +- packages/font/package.json | 2 +- packages/font/src/hooks/useColorsCustom.ts | 2 +- packages/list/package.json | 2 +- packages/list/src/onKeyDownList.ts | 2 +- packages/node-id/package.json | 2 +- packages/node-id/src/withNodeId.ts | 3 +- packages/normalizers/package.json | 2 +- .../normalizers/src/withRemoveEmptyNodes.ts | 2 +- packages/plate-utils/package.json | 2 +- .../src/plate/onKeyDownToggleElement.ts | 2 +- packages/plate-utils/src/queries/isType.ts | 2 +- .../plate-utils/src/utils/createNodesHOC.tsx | 3 +- .../src/utils/defaultsDeepToNodes.ts | 2 +- packages/slate-utils/package.json | 2 +- .../src/queries/getPointBeforeLocation.ts | 3 +- .../src/queries/getPreviousSiblingNode.ts | 2 +- .../slate-utils/src/queries/queryEditor.ts | 2 +- .../slate-utils/src/transforms/removeMark.ts | 2 +- .../slate-utils/src/transforms/setMarks.ts | 2 +- .../slate-utils/src/transforms/toggleMark.ts | 2 +- packages/table/package.json | 2 +- packages/table/src/withInsertFragmentTable.ts | 2 +- yarn.lock | 43 +++++++++++++------ 46 files changed, 91 insertions(+), 87 deletions(-) diff --git a/config/tsup.config.ts b/config/tsup.config.ts index 57357ecc6c..315d83d962 100644 --- a/config/tsup.config.ts +++ b/config/tsup.config.ts @@ -1,9 +1,10 @@ /* eslint-disable unicorn/prefer-module,@typescript-eslint/no-shadow */ import fs from 'node:fs'; import path from 'node:path'; -import { esbuildPluginImport } from '@linjiajian999/esbuild-plugin-import'; import { defineConfig } from 'tsup'; +const silent = false; + const PACKAGE_ROOT_PATH = process.cwd(); const INPUT_FILE_PATH = path.join(PACKAGE_ROOT_PATH, 'src/index.ts'); const INPUT_FILE = fs.existsSync(INPUT_FILE_PATH) @@ -15,30 +16,22 @@ export default defineConfig((opts) => { ...opts, entry: [INPUT_FILE], format: ['cjs', 'esm'], - skipNodeModulesBundle: true, - dts: { - resolve: false, - }, + dts: { resolve: false }, sourcemap: true, clean: true, - esbuildPlugins: [ - esbuildPluginImport([ - { - libraryName: 'lodash', - libraryDirectory: '', - camel2DashComponentName: false, - }, - ]) as any, - ], - onSuccess: async () => { - if (opts.watch) { - console.info('Watching for changes...'); - return; - } - console.info('Build succeeded!'); - }, - silent: true, - plugins: [], + ...(silent + ? { + silent: true, + onSuccess: async () => { + if (opts.watch) { + console.info('Watching for changes...'); + return; + } + + console.info('Build succeeded!'); + }, + } + : {}), }; }); diff --git a/package.json b/package.json index 488731bf22..fba490423a 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "p:brl": "cd $INIT_CWD && barrelsby -d $INIT_CWD/src -D -l all -q -e '.*(fixture|template|spec|__tests__).*'", "p:brl:below": "cd $INIT_CWD && barrelsby -d $INIT_CWD/src -D -l below -q -e '.*(fixture|template|spec|__tests__).*'", "p:build": "cd $INIT_CWD && yarn p:tsup", + "p:build:watch": "cd $INIT_CWD && yarn p:tsup --watch", "p:clean": "cd $INIT_CWD && rimraf dist && jest --clear-cache", "p:lint": "eslint $INIT_CWD/src --color", "p:lint:fix": "eslint $INIT_CWD/src --color --fix", @@ -87,7 +88,6 @@ "@changesets/types": "^5.2.1", "@dword-design/eslint-plugin-import-alias": "^4.0.8", "@ianvs/prettier-plugin-sort-imports": "^4.0.2", - "@linjiajian999/esbuild-plugin-import": "1.0.2", "@playwright/test": "1.36.0", "@swc/core": "1.3.90", "@swc/jest": "0.2.29", @@ -99,6 +99,7 @@ "@types/is-hotkey": "^0.1.7", "@types/jest": "^29.5.3", "@types/lodash": "^4.14.195", + "@types/lodash-es": "^4.17.9", "@types/marked": "^4.3.1", "@types/node": "^20.4.2", "@types/prismjs": "^1.26.0", diff --git a/packages/autoformat/package.json b/packages/autoformat/package.json index a7fe68d5c8..85feb92902 100644 --- a/packages/autoformat/package.json +++ b/packages/autoformat/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@udecode/plate-common": "24.3.2", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/autoformat/src/transforms/autoformatBlock.ts b/packages/autoformat/src/transforms/autoformatBlock.ts index 237a0de23c..587e5a726a 100644 --- a/packages/autoformat/src/transforms/autoformatBlock.ts +++ b/packages/autoformat/src/transforms/autoformatBlock.ts @@ -11,7 +11,7 @@ import { someNode, Value, } from '@udecode/plate-common'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { Range } from 'slate'; import { AutoformatBlockRule } from '../types'; diff --git a/packages/autoformat/src/transforms/autoformatMark.ts b/packages/autoformat/src/transforms/autoformatMark.ts index 31cda9c79f..c44f50c8e6 100644 --- a/packages/autoformat/src/transforms/autoformatMark.ts +++ b/packages/autoformat/src/transforms/autoformatMark.ts @@ -7,7 +7,7 @@ import { TEditor, Value, } from '@udecode/plate-common'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { Point, Range } from 'slate'; import { AutoformatMarkRule } from '../types'; diff --git a/packages/autoformat/src/transforms/autoformatText.ts b/packages/autoformat/src/transforms/autoformatText.ts index f9748f7ed8..33a017b683 100644 --- a/packages/autoformat/src/transforms/autoformatText.ts +++ b/packages/autoformat/src/transforms/autoformatText.ts @@ -4,7 +4,7 @@ import { PlateEditor, Value, } from '@udecode/plate-common'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { Point, Range } from 'slate'; import { AutoformatTextRule } from '../types'; diff --git a/packages/autoformat/src/utils/getMatchRange.ts b/packages/autoformat/src/utils/getMatchRange.ts index 9b3cc3f8fe..0ba62e1102 100644 --- a/packages/autoformat/src/utils/getMatchRange.ts +++ b/packages/autoformat/src/utils/getMatchRange.ts @@ -1,4 +1,4 @@ -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { AutoformatRule, MatchRange } from '../types'; diff --git a/packages/comments/package.json b/packages/comments/package.json index c3614a13c5..037f10be26 100644 --- a/packages/comments/package.json +++ b/packages/comments/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@udecode/plate-common": "24.3.2", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/comments/src/queries/getCommentPosition.ts b/packages/comments/src/queries/getCommentPosition.ts index 0fb499f794..2012960e89 100644 --- a/packages/comments/src/queries/getCommentPosition.ts +++ b/packages/comments/src/queries/getCommentPosition.ts @@ -1,5 +1,5 @@ import { PlateEditor, toDOMNode, Value } from '@udecode/plate-common'; -import { clamp } from 'lodash'; +import { clamp } from 'lodash-es'; import { TCommentText } from '../types'; import { getElementAbsolutePosition } from '../utils/getElementAbsolutePosition'; diff --git a/packages/core/package.json b/packages/core/package.json index fe8ad1e46d..009205e190 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -47,7 +47,7 @@ "clsx": "^1.2.1", "is-hotkey": "^0.2.0", "jotai": "1.7.2", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "nanoid": "^3.3.6", "react-hotkeys-hook": "^4.4.1", "use-deep-compare": "^1.1.0", diff --git a/packages/core/src/components/Editor.spec.tsx b/packages/core/src/components/Editor.spec.tsx index 73e62fdc0f..73def8b087 100644 --- a/packages/core/src/components/Editor.spec.tsx +++ b/packages/core/src/components/Editor.spec.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { isBlock, setNodes } from '@udecode/slate'; -import { isEqual, memoize } from 'lodash'; +import { isEqual, memoize } from 'lodash-es'; import { PlatePlugin } from '../types/index'; import { createPlateEditor } from '../utils/index'; diff --git a/packages/core/src/hooks/useEditableProps.ts b/packages/core/src/hooks/useEditableProps.ts index 6d75b7cd08..8595e34173 100644 --- a/packages/core/src/hooks/useEditableProps.ts +++ b/packages/core/src/hooks/useEditableProps.ts @@ -1,6 +1,6 @@ import { useMemo } from 'react'; import { isDefined } from '@udecode/utils'; -import omit from 'lodash/omit'; +import { omit } from 'lodash-es'; import { useDeepCompareMemo } from 'use-deep-compare'; import { usePlateSelectors } from '../stores'; diff --git a/packages/core/src/hooks/usePlateEffects.ts b/packages/core/src/hooks/usePlateEffects.ts index 184cd87299..3b7287cca5 100644 --- a/packages/core/src/hooks/usePlateEffects.ts +++ b/packages/core/src/hooks/usePlateEffects.ts @@ -1,6 +1,6 @@ import { ForwardedRef, useEffect } from 'react'; import { Value } from '@udecode/slate'; -import { isUndefined } from 'lodash'; +import { isUndefined } from 'lodash-es'; import { useEditorRef, usePlateStates } from '../stores'; import { diff --git a/packages/core/src/plugins/html-deserializer/utils/pluginDeserializeHtml.ts b/packages/core/src/plugins/html-deserializer/utils/pluginDeserializeHtml.ts index a7914885bb..68614c1d76 100644 --- a/packages/core/src/plugins/html-deserializer/utils/pluginDeserializeHtml.ts +++ b/packages/core/src/plugins/html-deserializer/utils/pluginDeserializeHtml.ts @@ -1,6 +1,6 @@ import { Value } from '@udecode/slate'; import { AnyObject, isDefined } from '@udecode/utils'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { Nullable } from '../../../types'; import { PlateEditor } from '../../../types/PlateEditor'; diff --git a/packages/core/src/utils/createPlugins.tsx b/packages/core/src/utils/createPlugins.tsx index 27e3720e6f..b1b8e17f1e 100644 --- a/packages/core/src/utils/createPlugins.tsx +++ b/packages/core/src/utils/createPlugins.tsx @@ -1,5 +1,5 @@ import { Value } from '@udecode/slate'; -import { cloneDeep } from 'lodash'; +import { cloneDeep } from 'lodash-es'; import { OverrideByKey } from '../types/OverrideByKey'; import { PlateEditor } from '../types/PlateEditor'; diff --git a/packages/core/src/utils/flattenDeepPlugins.ts b/packages/core/src/utils/flattenDeepPlugins.ts index 1c90e95fb1..af86a28968 100644 --- a/packages/core/src/utils/flattenDeepPlugins.ts +++ b/packages/core/src/utils/flattenDeepPlugins.ts @@ -1,5 +1,5 @@ import { Value } from '@udecode/slate'; -import defaultsDeep from 'lodash/defaultsDeep'; +import { defaultsDeep } from 'lodash-es'; import { PlateEditor } from '../types/PlateEditor'; import { PlatePlugin } from '../types/plugin/PlatePlugin'; diff --git a/packages/core/src/utils/getKeysByTypes.ts b/packages/core/src/utils/getKeysByTypes.ts index a278ea5257..69682ea7bc 100644 --- a/packages/core/src/utils/getKeysByTypes.ts +++ b/packages/core/src/utils/getKeysByTypes.ts @@ -1,5 +1,5 @@ import { Value } from '@udecode/slate'; -import { castArray } from 'lodash'; +import { castArray } from 'lodash-es'; import { PlateEditor } from '../types/PlateEditor'; diff --git a/packages/core/src/utils/mergeDeepPlugins.ts b/packages/core/src/utils/mergeDeepPlugins.ts index 751dbf9dc8..6be34c390c 100644 --- a/packages/core/src/utils/mergeDeepPlugins.ts +++ b/packages/core/src/utils/mergeDeepPlugins.ts @@ -1,8 +1,5 @@ import { Value } from '@udecode/slate'; -import defaultsDeep from 'lodash/defaultsDeep'; -import keyBy from 'lodash/keyBy'; -import merge from 'lodash/merge'; -import values from 'lodash/values'; +import { defaultsDeep, keyBy, merge, values } from 'lodash-es'; import { PlateEditor } from '../types/PlateEditor'; import { WithPlatePlugin } from '../types/plugin/PlatePlugin'; diff --git a/packages/core/src/utils/mergeDeepToNodes.ts b/packages/core/src/utils/mergeDeepToNodes.ts index ea7e018ac0..0c195655ea 100644 --- a/packages/core/src/utils/mergeDeepToNodes.ts +++ b/packages/core/src/utils/mergeDeepToNodes.ts @@ -1,5 +1,5 @@ import { TNode } from '@udecode/slate'; -import merge from 'lodash/merge'; +import { merge } from 'lodash-es'; import { applyDeepToNodes, ApplyDeepToNodesOptions } from './applyDeepToNodes'; diff --git a/packages/core/src/utils/normalizeInitialValue.ts b/packages/core/src/utils/normalizeInitialValue.ts index 1a8320ca0d..8067b178a0 100644 --- a/packages/core/src/utils/normalizeInitialValue.ts +++ b/packages/core/src/utils/normalizeInitialValue.ts @@ -1,6 +1,5 @@ import { Value } from '@udecode/slate'; -import { cloneDeep } from 'lodash'; -import isEqual from 'lodash/isEqual'; +import { cloneDeep, isEqual } from 'lodash-es'; import { PlateEditor } from '../types'; diff --git a/packages/core/src/utils/overridePluginsByKey.ts b/packages/core/src/utils/overridePluginsByKey.ts index d782c4de5d..7c21267b27 100644 --- a/packages/core/src/utils/overridePluginsByKey.ts +++ b/packages/core/src/utils/overridePluginsByKey.ts @@ -1,5 +1,5 @@ import { Value } from '@udecode/slate'; -import defaultsDeep from 'lodash/defaultsDeep'; +import { defaultsDeep } from 'lodash-es'; import { NoInfer } from '../types/misc/NoInfer'; import { OverrideByKey } from '../types/OverrideByKey'; diff --git a/packages/dnd/package.json b/packages/dnd/package.json index 8406b4b9a5..ceb6834a3f 100644 --- a/packages/dnd/package.json +++ b/packages/dnd/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@udecode/plate-common": "24.3.2", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "raf": "^3.4.1" }, "peerDependencies": { diff --git a/packages/dnd/src/components/Scroller/ScrollArea.tsx b/packages/dnd/src/components/Scroller/ScrollArea.tsx index b3f2416d3a..c8f98442a0 100644 --- a/packages/dnd/src/components/Scroller/ScrollArea.tsx +++ b/packages/dnd/src/components/Scroller/ScrollArea.tsx @@ -5,7 +5,7 @@ import React, { useEffect, useRef, } from 'react'; -import { throttle } from 'lodash'; +import { throttle } from 'lodash-es'; import raf from 'raf'; const getCoords = (e: any) => { diff --git a/packages/font/package.json b/packages/font/package.json index a7a32fa8b8..43bcd8ae19 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@udecode/plate-common": "24.3.2", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/font/src/hooks/useColorsCustom.ts b/packages/font/src/hooks/useColorsCustom.ts index c75f78d2d2..138d9a29bc 100644 --- a/packages/font/src/hooks/useColorsCustom.ts +++ b/packages/font/src/hooks/useColorsCustom.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash-es'; export const useColorsCustomState = ({ color, diff --git a/packages/list/package.json b/packages/list/package.json index 74204f0e03..ca760285d0 100644 --- a/packages/list/package.json +++ b/packages/list/package.json @@ -41,7 +41,7 @@ "dependencies": { "@udecode/plate-common": "24.3.2", "@udecode/plate-reset-node": "24.3.2", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/list/src/onKeyDownList.ts b/packages/list/src/onKeyDownList.ts index b52d54665c..4240c6c25c 100644 --- a/packages/list/src/onKeyDownList.ts +++ b/packages/list/src/onKeyDownList.ts @@ -11,7 +11,7 @@ import { Value, WithPlatePlugin, } from '@udecode/plate-common'; -import { castArray } from 'lodash'; +import { castArray } from 'lodash-es'; import { Range } from 'slate'; import { ELEMENT_LI } from './createListPlugin'; diff --git a/packages/node-id/package.json b/packages/node-id/package.json index 33e7e90d9a..046f3baccd 100644 --- a/packages/node-id/package.json +++ b/packages/node-id/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@udecode/plate-common": "24.3.2", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/node-id/src/withNodeId.ts b/packages/node-id/src/withNodeId.ts index 1ab5dbb52f..0ea3703c60 100644 --- a/packages/node-id/src/withNodeId.ts +++ b/packages/node-id/src/withNodeId.ts @@ -11,8 +11,7 @@ import { Value, WithPlatePlugin, } from '@udecode/plate-common'; -import { castArray } from 'lodash'; -import cloneDeep from 'lodash/cloneDeep'; +import { castArray, cloneDeep } from 'lodash-es'; import { NodeIdPlugin } from './createNodeIdPlugin'; diff --git a/packages/normalizers/package.json b/packages/normalizers/package.json index 866b6b9636..f3c4579841 100644 --- a/packages/normalizers/package.json +++ b/packages/normalizers/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@udecode/plate-common": "24.3.2", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/normalizers/src/withRemoveEmptyNodes.ts b/packages/normalizers/src/withRemoveEmptyNodes.ts index ec23379650..65eb269b12 100644 --- a/packages/normalizers/src/withRemoveEmptyNodes.ts +++ b/packages/normalizers/src/withRemoveEmptyNodes.ts @@ -6,7 +6,7 @@ import { Value, WithPlatePlugin, } from '@udecode/plate-common'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { RemoveEmptyNodesPlugin } from './createRemoveEmptyNodesPlugin'; diff --git a/packages/plate-utils/package.json b/packages/plate-utils/package.json index d905da5abd..7c56503a7a 100644 --- a/packages/plate-utils/package.json +++ b/packages/plate-utils/package.json @@ -46,7 +46,7 @@ "@udecode/slate-utils": "24.3.2", "@udecode/utils": "24.3.0", "clsx": "^1.2.1", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/plate-utils/src/plate/onKeyDownToggleElement.ts b/packages/plate-utils/src/plate/onKeyDownToggleElement.ts index 5f31245c33..1f8c9133a2 100644 --- a/packages/plate-utils/src/plate/onKeyDownToggleElement.ts +++ b/packages/plate-utils/src/plate/onKeyDownToggleElement.ts @@ -9,7 +9,7 @@ import { WithPlatePlugin, } from '@udecode/plate-core'; import { Value } from '@udecode/slate'; -import { castArray } from 'lodash'; +import { castArray } from 'lodash-es'; export const onKeyDownToggleElement = = PlateEditor>( diff --git a/packages/plate-utils/src/queries/isType.ts b/packages/plate-utils/src/queries/isType.ts index 6d94c00763..2b04925db7 100644 --- a/packages/plate-utils/src/queries/isType.ts +++ b/packages/plate-utils/src/queries/isType.ts @@ -1,6 +1,6 @@ import { getPluginType, PlateEditor } from '@udecode/plate-core'; import { Value } from '@udecode/slate'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; /** * Does the node match the type provided. diff --git a/packages/plate-utils/src/utils/createNodesHOC.tsx b/packages/plate-utils/src/utils/createNodesHOC.tsx index ed41c9ef92..8f993df4dc 100644 --- a/packages/plate-utils/src/utils/createNodesHOC.tsx +++ b/packages/plate-utils/src/utils/createNodesHOC.tsx @@ -1,7 +1,6 @@ import { FunctionComponent } from 'react'; import { AnyObject } from '@udecode/utils'; -import { castArray } from 'lodash'; -import merge from 'lodash/merge'; +import { castArray, merge } from 'lodash-es'; import { createNodeHOC } from './createNodeHOC'; diff --git a/packages/plate-utils/src/utils/defaultsDeepToNodes.ts b/packages/plate-utils/src/utils/defaultsDeepToNodes.ts index ab233ca74d..06ad7aa956 100644 --- a/packages/plate-utils/src/utils/defaultsDeepToNodes.ts +++ b/packages/plate-utils/src/utils/defaultsDeepToNodes.ts @@ -1,6 +1,6 @@ import { applyDeepToNodes, ApplyDeepToNodesOptions } from '@udecode/plate-core'; import { TNode } from '@udecode/slate'; -import defaults from 'lodash/defaults'; +import { defaults } from 'lodash-es'; /** * Recursively merge a source object to children nodes with a query. diff --git a/packages/slate-utils/package.json b/packages/slate-utils/package.json index 42bf1eef2e..721edd10c4 100644 --- a/packages/slate-utils/package.json +++ b/packages/slate-utils/package.json @@ -41,7 +41,7 @@ "dependencies": { "@udecode/slate": "24.3.2", "@udecode/utils": "24.3.0", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "slate": ">=0.94.0", diff --git a/packages/slate-utils/src/queries/getPointBeforeLocation.ts b/packages/slate-utils/src/queries/getPointBeforeLocation.ts index ab348482c9..0b46cbfdbd 100644 --- a/packages/slate-utils/src/queries/getPointBeforeLocation.ts +++ b/packages/slate-utils/src/queries/getPointBeforeLocation.ts @@ -6,8 +6,7 @@ import { TEditor, Value, } from '@udecode/slate'; -import castArray from 'lodash/castArray'; -import map from 'lodash/map'; +import { castArray, map } from 'lodash-es'; import { Location, Point } from 'slate'; import { isRangeAcrossBlocks } from './isRangeAcrossBlocks'; diff --git a/packages/slate-utils/src/queries/getPreviousSiblingNode.ts b/packages/slate-utils/src/queries/getPreviousSiblingNode.ts index eed8ef9dd6..5c78319209 100644 --- a/packages/slate-utils/src/queries/getPreviousSiblingNode.ts +++ b/packages/slate-utils/src/queries/getPreviousSiblingNode.ts @@ -1,5 +1,5 @@ import { getNode, TEditor, Value } from '@udecode/slate'; -import { last } from 'lodash'; +import { last } from 'lodash-es'; import { Path } from 'slate'; export const getPreviousSiblingNode = ( diff --git a/packages/slate-utils/src/queries/queryEditor.ts b/packages/slate-utils/src/queries/queryEditor.ts index d9ce8246b0..487e910cf2 100644 --- a/packages/slate-utils/src/queries/queryEditor.ts +++ b/packages/slate-utils/src/queries/queryEditor.ts @@ -1,5 +1,5 @@ import { QueryEditorOptions, someNode, TEditor, Value } from '@udecode/slate'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { isSelectionAtBlockEnd } from './isSelectionAtBlockEnd'; import { isSelectionAtBlockStart } from './isSelectionAtBlockStart'; diff --git a/packages/slate-utils/src/transforms/removeMark.ts b/packages/slate-utils/src/transforms/removeMark.ts index affa1b61c4..652733bcb1 100644 --- a/packages/slate-utils/src/transforms/removeMark.ts +++ b/packages/slate-utils/src/transforms/removeMark.ts @@ -6,7 +6,7 @@ import { unsetNodes, Value, } from '@udecode/slate'; -import { castArray } from 'lodash'; +import { castArray } from 'lodash-es'; import { Range } from 'slate'; export interface RemoveMarkOptions diff --git a/packages/slate-utils/src/transforms/setMarks.ts b/packages/slate-utils/src/transforms/setMarks.ts index 222b86b938..0aa0aa9fd2 100644 --- a/packages/slate-utils/src/transforms/setMarks.ts +++ b/packages/slate-utils/src/transforms/setMarks.ts @@ -1,5 +1,5 @@ import { EMarks, TEditor, Value, withoutNormalizing } from '@udecode/slate'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { removeMark } from './removeMark'; diff --git a/packages/slate-utils/src/transforms/toggleMark.ts b/packages/slate-utils/src/transforms/toggleMark.ts index e8dd3babd9..bd001a0e99 100644 --- a/packages/slate-utils/src/transforms/toggleMark.ts +++ b/packages/slate-utils/src/transforms/toggleMark.ts @@ -1,5 +1,5 @@ import { TEditor, Value, withoutNormalizing } from '@udecode/slate'; -import castArray from 'lodash/castArray'; +import { castArray } from 'lodash-es'; import { isMarkActive } from '../queries'; import { removeMark } from './removeMark'; diff --git a/packages/table/package.json b/packages/table/package.json index 46310ceb74..70661b9c78 100644 --- a/packages/table/package.json +++ b/packages/table/package.json @@ -41,7 +41,7 @@ "dependencies": { "@udecode/plate-common": "24.3.2", "@udecode/plate-resizable": "24.3.2", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/packages/table/src/withInsertFragmentTable.ts b/packages/table/src/withInsertFragmentTable.ts index aaf9f27dd9..5def285d1a 100644 --- a/packages/table/src/withInsertFragmentTable.ts +++ b/packages/table/src/withInsertFragmentTable.ts @@ -12,7 +12,7 @@ import { withoutNormalizing, WithPlatePlugin, } from '@udecode/plate-common'; -import { cloneDeep } from 'lodash'; +import { cloneDeep } from 'lodash-es'; import { Path } from 'slate'; import { ELEMENT_TABLE } from './createTablePlugin'; diff --git a/yarn.lock b/yarn.lock index 0eaf05766a..8de6f45f6b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6460,6 +6460,15 @@ __metadata: languageName: node linkType: hard +"@types/lodash-es@npm:^4.17.9": + version: 4.17.9 + resolution: "@types/lodash-es@npm:4.17.9" + dependencies: + "@types/lodash": "npm:*" + checksum: fabbfa08ed21452c976385354660dd3d5277d172960b858ff375e07ccc6c4f69a551c9a99e6d67465305973a57f17e2234d3302722ebd4e7903147bb09a2d633 + languageName: node + linkType: hard + "@types/lodash.template@npm:^4.5.1": version: 4.5.1 resolution: "@types/lodash.template@npm:4.5.1" @@ -7101,7 +7110,7 @@ __metadata: resolution: "@udecode/plate-autoformat@workspace:packages/autoformat" dependencies: "@udecode/plate-common": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7247,7 +7256,7 @@ __metadata: resolution: "@udecode/plate-comments@workspace:packages/comments" dependencies: "@udecode/plate-common": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7290,7 +7299,7 @@ __metadata: clsx: "npm:^1.2.1" is-hotkey: "npm:^0.2.0" jotai: "npm:1.7.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" nanoid: "npm:^3.3.6" react-hotkeys-hook: "npm:^4.4.1" use-deep-compare: "npm:^1.1.0" @@ -7325,7 +7334,7 @@ __metadata: resolution: "@udecode/plate-dnd@workspace:packages/dnd" dependencies: "@udecode/plate-common": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" raf: "npm:^3.4.1" peerDependencies: react: ">=16.8.0" @@ -7410,7 +7419,7 @@ __metadata: resolution: "@udecode/plate-font@workspace:packages/font" dependencies: "@udecode/plate-common": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7568,7 +7577,7 @@ __metadata: dependencies: "@udecode/plate-common": "npm:24.3.2" "@udecode/plate-reset-node": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7616,7 +7625,7 @@ __metadata: resolution: "@udecode/plate-node-id@workspace:packages/node-id" dependencies: "@udecode/plate-common": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7632,7 +7641,7 @@ __metadata: resolution: "@udecode/plate-normalizers@workspace:packages/normalizers" dependencies: "@udecode/plate-common": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7818,7 +7827,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-tabbable@npm:24.3.2, @udecode/plate-tabbable@workspace:^, @udecode/plate-tabbable@workspace:packages/tabbable": +"@udecode/plate-tabbable@npm:24.3.4, @udecode/plate-tabbable@workspace:^, @udecode/plate-tabbable@workspace:packages/tabbable": version: 0.0.0-use.local resolution: "@udecode/plate-tabbable@workspace:packages/tabbable" dependencies: @@ -7840,7 +7849,7 @@ __metadata: dependencies: "@udecode/plate-common": "npm:24.3.2" "@udecode/plate-resizable": "npm:24.3.2" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7914,7 +7923,7 @@ __metadata: "@udecode/slate-utils": "npm:24.3.2" "@udecode/utils": "npm:24.3.0" clsx: "npm:^1.2.1" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" @@ -7982,7 +7991,7 @@ __metadata: "@udecode/plate-serializer-html": "npm:24.3.2" "@udecode/plate-serializer-md": "npm:24.3.3" "@udecode/plate-suggestion": "npm:24.3.2" - "@udecode/plate-tabbable": "npm:24.3.2" + "@udecode/plate-tabbable": "npm:24.3.4" "@udecode/plate-table": "npm:24.3.2" "@udecode/plate-trailing-block": "npm:24.3.2" peerDependencies: @@ -8016,7 +8025,7 @@ __metadata: dependencies: "@udecode/slate": "npm:24.3.2" "@udecode/utils": "npm:24.3.0" - lodash: "npm:^4.17.21" + lodash-es: "npm:^4.17.21" peerDependencies: slate: ">=0.94.0" slate-history: ">=0.93.0" @@ -16081,6 +16090,13 @@ __metadata: languageName: node linkType: hard +"lodash-es@npm:^4.17.21": + version: 4.17.21 + resolution: "lodash-es@npm:4.17.21" + checksum: d1c3ee94118daeeee47c630ab5f91e94cc4e41ebe2452d837edbe599e853eb2d4be7edf82b4fe62f9fc74f27a8ed7f82fdbd9d301d0acef88f00941db64c4843 + languageName: node + linkType: hard + "lodash._reinterpolate@npm:^3.0.0": version: 3.0.0 resolution: "lodash._reinterpolate@npm:3.0.0" @@ -21143,6 +21159,7 @@ __metadata: "@types/is-hotkey": "npm:^0.1.7" "@types/jest": "npm:^29.5.3" "@types/lodash": "npm:^4.14.195" + "@types/lodash-es": "npm:^4.17.9" "@types/marked": "npm:^4.3.1" "@types/node": "npm:^20.4.2" "@types/prismjs": "npm:^1.26.0" From 2ef0a50e6697a42ccfa48c60e315b3bd7f76336b Mon Sep 17 00:00:00 2001 From: zbeyens Date: Mon, 2 Oct 2023 20:55:17 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yarn.lock | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8de6f45f6b..bc3c8d798b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3612,16 +3612,6 @@ __metadata: languageName: node linkType: hard -"@linjiajian999/esbuild-plugin-import@npm:1.0.2": - version: 1.0.2 - resolution: "@linjiajian999/esbuild-plugin-import@npm:1.0.2" - dependencies: - esbuild: "npm:^0.12.15" - fs-extra: "npm:^10.0.0" - checksum: accec9ae58f7661fa83c44b227234ba4fa6813050d5b7fdddeda4a81a6fbc589583f74c9d264be01f7ad728dd0037ba10d4cfcee9fde70f45ff8b8e331fbce39 - languageName: node - linkType: hard - "@manypkg/find-root@npm:^1.1.0": version: 1.1.0 resolution: "@manypkg/find-root@npm:1.1.0" @@ -11295,15 +11285,6 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.12.15": - version: 0.12.29 - resolution: "esbuild@npm:0.12.29" - bin: - esbuild: bin/esbuild - checksum: f1a0c7ae6220b3eacba341b28c1a65e8f82ff2f1017a80b42fe10536e66be6162e1fd9271e35314116126bf8e848ef6ecfcc194d12ee35568812c38adb19079c - languageName: node - linkType: hard - "esbuild@npm:^0.17.5, esbuild@npm:^0.17.6": version: 0.17.19 resolution: "esbuild@npm:0.17.19" @@ -21147,7 +21128,6 @@ __metadata: "@changesets/types": "npm:^5.2.1" "@dword-design/eslint-plugin-import-alias": "npm:^4.0.8" "@ianvs/prettier-plugin-sort-imports": "npm:^4.0.2" - "@linjiajian999/esbuild-plugin-import": "npm:1.0.2" "@playwright/test": "npm:1.36.0" "@swc/core": "npm:1.3.90" "@swc/jest": "npm:0.2.29" From c36773c99d282a18e84c06f1327eee90ae591ec4 Mon Sep 17 00:00:00 2001 From: zbeyens Date: Mon, 2 Oct 2023 20:56:30 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/silly-terms-type.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/silly-terms-type.md diff --git a/.changeset/silly-terms-type.md b/.changeset/silly-terms-type.md new file mode 100644 index 0000000000..84a737686d --- /dev/null +++ b/.changeset/silly-terms-type.md @@ -0,0 +1,5 @@ +--- +'@udecode/slate': patch +--- + +Replace lodash by lodash-es From 8a9172b5db2e01cf8c7ad2bba32133b9cd913146 Mon Sep 17 00:00:00 2001 From: zbeyens Date: Tue, 3 Oct 2023 00:02:49 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=91=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jest.config.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.cjs b/jest.config.cjs index 46bca47f17..df5bab3c28 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -45,6 +45,7 @@ module.exports = { moduleFileExtensions: ['js', 'json', 'ts', 'tsx'], moduleNameMapper: { '\\.(css|less|sass|scss)$': '/scripts/styleMock.cjs', + '^lodash-es$': 'lodash', ...getTsConfigBasePaths(), // '^@udecode/plate-core$': '/packages/core/src', ...modules,