From 8078754a86e3535d62fc8fc7a4e3b83d76e8f889 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Sun, 28 Sep 2025 12:45:51 +0800 Subject: [PATCH] perf: uninstall classnames, install clsx --- .gitignore | 5 +++-- package.json | 16 ++++++++-------- src/Notice.tsx | 6 ++---- src/NoticeList.tsx | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 93e1cbd..d34b985 100644 --- a/.gitignore +++ b/.gitignore @@ -30,15 +30,16 @@ es coverage yarn.lock package-lock.json +pnpm-lock.yaml # umi .umi .umi-production .umi-test -.env.local +.env.local # dumi .dumi/tmp .dumi/tmp-production -bun.lockb \ No newline at end of file +bun.lockb diff --git a/package.json b/package.json index b839fa4..12fe8dd 100644 --- a/package.json +++ b/package.json @@ -47,26 +47,22 @@ "now-build": "npm run build", "prepare": "husky install" }, - "peerDependencies": { - "react": ">=16.9.0", - "react-dom": ">=16.9.0" - }, "dependencies": { "@rc-component/motion": "^1.1.4", "@rc-component/util": "^1.2.1", - "classnames": "2.x" + "clsx": "^2.1.1" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.59.7", - "@typescript-eslint/parser": "^5.59.7", "@rc-component/father-plugin": "^2.0.4", "@rc-component/np": "^1.0.3", "@testing-library/jest-dom": "^6.0.0", "@testing-library/react": "^15.0.7", - "@types/classnames": "^2.2.10", + "@types/node": "^24.5.2", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@types/testing-library__jest-dom": "^6.0.0", + "@typescript-eslint/eslint-plugin": "^5.59.7", + "@typescript-eslint/parser": "^5.59.7", "@umijs/fabric": "^2.0.0", "@vitest/coverage-v8": "^0.34.2", "cross-env": "^7.0.0", @@ -84,6 +80,10 @@ "typescript": "^5.4.5", "vitest": "^0.34.2" }, + "peerDependencies": { + "react": ">=16.9.0", + "react-dom": ">=16.9.0" + }, "lint-staged": { "**/*.{js,jsx,tsx,ts,md,json}": [ "prettier --write", diff --git a/src/Notice.tsx b/src/Notice.tsx index d191126..243e778 100644 --- a/src/Notice.tsx +++ b/src/Notice.tsx @@ -1,4 +1,4 @@ -import classNames from 'classnames'; +import { clsx } from 'clsx'; import KeyCode from '@rc-component/util/lib/KeyCode'; import * as React from 'react'; import type { NoticeConfig } from './interface'; @@ -120,9 +120,7 @@ const Notify = React.forwardRef { setHovering(true); diff --git a/src/NoticeList.tsx b/src/NoticeList.tsx index 1edb31a..3cc797e 100644 --- a/src/NoticeList.tsx +++ b/src/NoticeList.tsx @@ -1,6 +1,6 @@ import type { CSSProperties, FC } from 'react'; import React, { useContext, useEffect, useRef, useState } from 'react'; -import clsx from 'classnames'; +import { clsx } from 'clsx'; import type { CSSMotionProps } from '@rc-component/motion'; import { CSSMotionList } from '@rc-component/motion'; import type {