diff --git a/package.json b/package.json index 55f9a8ea..1467e897 100644 --- a/package.json +++ b/package.json @@ -52,9 +52,9 @@ "cli-cursor": "^4.0.0", "cli-truncate": "^4.0.0", "code-excerpt": "^4.0.0", + "es-toolkit": "^1.22.0", "indent-string": "^5.0.0", "is-in-ci": "^0.1.0", - "lodash": "^4.17.21", "patch-console": "^2.0.0", "react-reconciler": "^0.29.0", "scheduler": "^0.23.0", @@ -72,7 +72,6 @@ "@faker-js/faker": "^8.3.1", "@sindresorhus/tsconfig": "^5.0.0", "@types/benchmark": "^2.1.2", - "@types/lodash": "^4.14.202", "@types/ms": "^0.7.31", "@types/node": "^20.10.4", "@types/react": "^18.2.43", diff --git a/src/ink.tsx b/src/ink.tsx index 8f816112..7b88589c 100644 --- a/src/ink.tsx +++ b/src/ink.tsx @@ -1,7 +1,6 @@ import process from 'node:process'; import React, {type ReactNode} from 'react'; -import throttle from 'lodash/throttle.js'; -import {type DebouncedFunc} from 'lodash'; +import {throttle} from 'es-toolkit/compat'; import ansiEscapes from 'ansi-escapes'; import isInCi from 'is-in-ci'; import autoBind from 'auto-bind'; @@ -31,7 +30,7 @@ export type Options = { export default class Ink { private readonly options: Options; private readonly log: LogUpdate; - private readonly throttledLog: LogUpdate | DebouncedFunc; + private readonly throttledLog: LogUpdate; // Ignore last render after unmounting a tree to prevent empty output before exit private isUnmounted: boolean; private lastOutput: string; @@ -62,10 +61,10 @@ export default class Ink { this.log = logUpdate.create(options.stdout); this.throttledLog = options.debug ? this.log - : throttle(this.log, undefined, { + : (throttle(this.log, undefined, { leading: true, trailing: true, - }); + }) as unknown as LogUpdate); // Ignore last render after unmounting a tree to prevent empty output before exit this.isUnmounted = false;