From de69310d94f766ac6c6aeae357173fefbf54f83f Mon Sep 17 00:00:00 2001 From: liuzhide <44251801+ch-liuzhide@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:21:51 +0800 Subject: [PATCH] refactor(esm): replace require json file with import json file (#574) * refactor(esm): replace require json file with import json file * refactor(package.json): upgrade @petercatai/assistant --- assistant/package.json | 2 +- .../GitInsight/components/GitInsightIcon.tsx | 6 +- assistant/src/style.css | 62 +++++++++---------- assistant/tsconfig.json | 3 +- client/package.json | 2 +- client/yarn.lock | 8 +-- 6 files changed, 42 insertions(+), 41 deletions(-) diff --git a/assistant/package.json b/assistant/package.json index 9f7871a1..86c23827 100644 --- a/assistant/package.json +++ b/assistant/package.json @@ -1,6 +1,6 @@ { "name": "@petercatai/assistant", - "version": "1.0.18", + "version": "1.0.20", "description": "PeterCat Assistant Application", "module": "dist/esm/index.js", "types": "dist/esm/index.d.ts", diff --git a/assistant/src/GitInsight/components/GitInsightIcon.tsx b/assistant/src/GitInsight/components/GitInsightIcon.tsx index 2cb9cee8..24367b6c 100644 --- a/assistant/src/GitInsight/components/GitInsightIcon.tsx +++ b/assistant/src/GitInsight/components/GitInsightIcon.tsx @@ -1,9 +1,9 @@ import Lottie from 'lottie-react'; import React, { useMemo } from 'react'; -const Fork = require('../../assets/fork.json'); -const Commit = require('../../assets/commit.json'); -const Star = require('../../assets/star.json'); +import * as Commit from '../../assets/commit.json'; +import * as Fork from '../../assets/fork.json'; +import * as Star from '../../assets/star.json'; interface GitInsightIconProps { type?: 'fork' | 'commit' | 'star'; diff --git a/assistant/src/style.css b/assistant/src/style.css index ed6ba836..fb35752c 100644 --- a/assistant/src/style.css +++ b/assistant/src/style.css @@ -112,8 +112,8 @@ */ *:where(.petercat-lui,.petercat-lui *), -::before:where(.petercat-lui,.petercat-lui *), -::after:where(.petercat-lui,.petercat-lui *) { +:where(.petercat-lui,.petercat-lui *)::before, +:where(.petercat-lui,.petercat-lui *)::after { box-sizing: border-box; /* 1 */ border-width: 0; @@ -124,8 +124,8 @@ /* 2 */ } -::before:where(.petercat-lui,.petercat-lui *), -::after:where(.petercat-lui,.petercat-lui *) { +:where(.petercat-lui,.petercat-lui *)::before, +:where(.petercat-lui,.petercat-lui *)::after { --tw-content: ''; } @@ -378,8 +378,8 @@ progress:where(.petercat-lui,.petercat-lui *) { Correct the cursor style of increment and decrement buttons in Safari. */ -::-webkit-inner-spin-button:where(.petercat-lui,.petercat-lui *), -::-webkit-outer-spin-button:where(.petercat-lui,.petercat-lui *) { +:where(.petercat-lui,.petercat-lui *) ::-webkit-inner-spin-button, +:where(.petercat-lui,.petercat-lui *) ::-webkit-outer-spin-button { height: auto; } @@ -399,7 +399,7 @@ Correct the cursor style of increment and decrement buttons in Safari. Remove the inner padding in Chrome and Safari on macOS. */ -::-webkit-search-decoration:where(.petercat-lui,.petercat-lui *) { +:where(.petercat-lui,.petercat-lui *) ::-webkit-search-decoration { -webkit-appearance: none; } @@ -408,7 +408,7 @@ Remove the inner padding in Chrome and Safari on macOS. 2. Change font properties to `inherit` in Safari. */ -::-webkit-file-upload-button:where(.petercat-lui,.petercat-lui *) { +:where(.petercat-lui,.petercat-lui *) ::-webkit-file-upload-button { -webkit-appearance: button; /* 1 */ font: inherit; @@ -481,15 +481,15 @@ textarea:where(.petercat-lui,.petercat-lui *) { 2. Set the default placeholder color to the user's configured gray 400 color. */ -input::-moz-placeholder:where(.petercat-lui,.petercat-lui *), textarea::-moz-placeholder:where(.petercat-lui,.petercat-lui *) { +:where(.petercat-lui,.petercat-lui *) input::-moz-placeholder, :where(.petercat-lui,.petercat-lui *) textarea::-moz-placeholder { opacity: 1; /* 1 */ color: #9ca3af; /* 2 */ } -input::placeholder:where(.petercat-lui,.petercat-lui *), -textarea::placeholder:where(.petercat-lui,.petercat-lui *) { +:where(.petercat-lui,.petercat-lui *) input::placeholder, +:where(.petercat-lui,.petercat-lui *) textarea::placeholder { opacity: 1; /* 1 */ color: #9ca3af; @@ -545,7 +545,7 @@ video:where(.petercat-lui,.petercat-lui *) { /* Make elements with the HTML hidden attribute stay hidden by default */ -[hidden]:where(.petercat-lui,.petercat-lui *) { +[hidden]:where(:not([hidden="until-found"])):where(.petercat-lui,.petercat-lui *) { display: none; } @@ -944,42 +944,42 @@ video:where(.petercat-lui,.petercat-lui *) { .border-\[\#e4e4e7\] { --tw-border-opacity: 1; - border-color: rgb(228 228 231 / var(--tw-border-opacity)); + border-color: rgb(228 228 231 / var(--tw-border-opacity, 1)); } .bg-\[\#3F3F46\] { --tw-bg-opacity: 1; - background-color: rgb(63 63 70 / var(--tw-bg-opacity)); + background-color: rgb(63 63 70 / var(--tw-bg-opacity, 1)); } .bg-\[\#F1F1F1\] { --tw-bg-opacity: 1; - background-color: rgb(241 241 241 / var(--tw-bg-opacity)); + background-color: rgb(241 241 241 / var(--tw-bg-opacity, 1)); } .bg-\[\#FCFCFC\] { --tw-bg-opacity: 1; - background-color: rgb(252 252 252 / var(--tw-bg-opacity)); + background-color: rgb(252 252 252 / var(--tw-bg-opacity, 1)); } .bg-\[\#f1f1f1\] { --tw-bg-opacity: 1; - background-color: rgb(241 241 241 / var(--tw-bg-opacity)); + background-color: rgb(241 241 241 / var(--tw-bg-opacity, 1)); } .bg-gray-700 { --tw-bg-opacity: 1; - background-color: rgb(55 65 81 / var(--tw-bg-opacity)); + background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1)); } .bg-gray-800 { --tw-bg-opacity: 1; - background-color: rgb(31 41 55 / var(--tw-bg-opacity)); + background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1)); } .bg-white { --tw-bg-opacity: 1; - background-color: rgb(255 255 255 / var(--tw-bg-opacity)); + background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)); } .object-cover { @@ -1072,47 +1072,47 @@ video:where(.petercat-lui,.petercat-lui *) { .text-black { --tw-text-opacity: 1; - color: rgb(0 0 0 / var(--tw-text-opacity)); + color: rgb(0 0 0 / var(--tw-text-opacity, 1)); } .text-blue-600 { --tw-text-opacity: 1; - color: rgb(37 99 235 / var(--tw-text-opacity)); + color: rgb(37 99 235 / var(--tw-text-opacity, 1)); } .text-gray-400 { --tw-text-opacity: 1; - color: rgb(156 163 175 / var(--tw-text-opacity)); + color: rgb(156 163 175 / var(--tw-text-opacity, 1)); } .text-gray-500 { --tw-text-opacity: 1; - color: rgb(107 114 128 / var(--tw-text-opacity)); + color: rgb(107 114 128 / var(--tw-text-opacity, 1)); } .text-gray-900 { --tw-text-opacity: 1; - color: rgb(17 24 39 / var(--tw-text-opacity)); + color: rgb(17 24 39 / var(--tw-text-opacity, 1)); } .text-green-600 { --tw-text-opacity: 1; - color: rgb(22 163 74 / var(--tw-text-opacity)); + color: rgb(22 163 74 / var(--tw-text-opacity, 1)); } .text-red-600 { --tw-text-opacity: 1; - color: rgb(220 38 38 / var(--tw-text-opacity)); + color: rgb(220 38 38 / var(--tw-text-opacity, 1)); } .text-red-700 { --tw-text-opacity: 1; - color: rgb(185 28 28 / var(--tw-text-opacity)); + color: rgb(185 28 28 / var(--tw-text-opacity, 1)); } .text-white { --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); + color: rgb(255 255 255 / var(--tw-text-opacity, 1)); } .opacity-0 { @@ -1252,12 +1252,12 @@ video:where(.petercat-lui,.petercat-lui *) { .hover\:\!bg-gray-700:hover { --tw-bg-opacity: 1 !important; - background-color: rgb(55 65 81 / var(--tw-bg-opacity)) !important; + background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1)) !important; } .hover\:\!bg-white:hover { --tw-bg-opacity: 1 !important; - background-color: rgb(255 255 255 / var(--tw-bg-opacity)) !important; + background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)) !important; } .hover\:shadow-lg:hover { diff --git a/assistant/tsconfig.json b/assistant/tsconfig.json index 9e4a7815..cd559556 100644 --- a/assistant/tsconfig.json +++ b/assistant/tsconfig.json @@ -10,7 +10,8 @@ "@@/*": [".dumi/tmp/*"], "lui": ["src"], "lui/*": ["src/*", "*"] - } + }, + "resolveJsonModule": true }, "include": [".dumirc.ts", "src/**/*"] } diff --git a/client/package.json b/client/package.json index a8ba844c..9aeb5350 100644 --- a/client/package.json +++ b/client/package.json @@ -22,7 +22,7 @@ "@fullpage/react-fullpage": "^0.1.42", "@next/bundle-analyzer": "^13.4.19", "@nextui-org/react": "^2.2.9", - "@petercatai/assistant": "^1.0.18", + "@petercatai/assistant": "1.0.20", "@sentry/nextjs": "^8.28.0", "@supabase/supabase-js": "^2.32.0", "@tanstack/react-query": "^5.17.19", diff --git a/client/yarn.lock b/client/yarn.lock index 41cf0017..7278dc7b 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -2842,10 +2842,10 @@ resolved "https://registry.yarnpkg.com/@panva/hkdf/-/hkdf-1.2.1.tgz#cb0d111ef700136f4580349ff0226bf25c853f23" integrity sha512-6oclG6Y3PiDFcoyk8srjLfVKyMfVCKJ27JwNPViuXziFpmdz+MZnZN/aKY0JGXgYuO/VghU0jcOAZgWXZ1Dmrw== -"@petercatai/assistant@^1.0.17": - version "1.0.17" - resolved "https://registry.yarnpkg.com/@petercatai/assistant/-/assistant-1.0.17.tgz#c6499ee8908f116664e448b54a076d564414a965" - integrity sha512-9IGCO+BlVRvXM1OZegclofOYb57tXnOlxVvOt+rltLqzre7TDnDNFl1lb9SFjmCjBQOVCm/IXZCG6KifIb4l4Q== +"@petercatai/assistant@1.0.20": + version "1.0.20" + resolved "https://registry.yarnpkg.com/@petercatai/assistant/-/assistant-1.0.20.tgz#2d2dc1beb296c8524219a6de7eee1575cb3b4c92" + integrity sha512-csfRRsKB9FbBM+cMcCTQQowsuuFRVerSrxfMRTWoI1XHhBW3ormbt1XTeYKiubmwz4iKznR+2UCrZrCl75ckmA== dependencies: "@ant-design/icons" "^5.3.5" "@ant-design/pro-chat" "^1.9.0"