@rsdoctor/components 1.3.8 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { Algorithm } from "@rsdoctor/utils/common";
2
2
  import { Client, Rule } from "@rsdoctor/types";
3
3
  import { defaults, uniqBy } from "es-toolkit/compat";
4
- import { useEffect, useState } from "react";
4
+ import { useEffect, useMemo, useState } from "react";
5
5
  import { useTranslation } from "react-i18next";
6
6
  import { useLocation, useNavigate } from "react-router-dom";
7
7
  import url_parse from "url-parse";
@@ -32,8 +32,9 @@ function useRuleIndexNavigate(code, link) {
32
32
  }
33
33
  function useUrlQuery() {
34
34
  const search = useLocation().search || location.search;
35
- const { query } = url_parse(search, true);
36
- return query;
35
+ return useMemo(()=>url_parse(search, true).query, [
36
+ search
37
+ ]);
37
38
  }
38
39
  function useLoading(defaultLoading = false) {
39
40
  const [loading, setLoading] = useState(defaultLoading);
@@ -1 +1 @@
1
- {"version":3,"file":"utils/hooks.mjs","sources":["../../src/utils/hooks.ts"],"sourcesContent":["import { Algorithm } from '@rsdoctor/utils/common';\nimport { Client, Manifest, Rule, SDK } from '@rsdoctor/types';\nimport { uniqBy, defaults } from 'es-toolkit/compat';\nimport { useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport parse from 'url-parse';\n\nimport './i18n';\nimport { Language } from '../constants';\nimport { setLocaleToStorage } from './storage';\n\nconst route = Client.RsdoctorClientRoutes.RuleIndex;\n\nexport const useI18n: typeof useTranslation = () => {\n const { i18n, ...rest } = useTranslation();\n\n return {\n ...rest,\n i18n: {\n ...i18n,\n changeLanguage(lng, callback) {\n return i18n.changeLanguage(lng, (error, t) => {\n if (!error) {\n setLocaleToStorage(lng as Language);\n }\n callback && callback(error, t);\n });\n },\n },\n };\n};\n\nexport function useRuleIndexNavigate(code: string, link?: string | undefined) {\n const navigate = useNavigate();\n\n if (link) {\n return () => window.open(link, '__blank');\n }\n\n return () => {\n navigate(\n `${route}?${Rule.RsdoctorRuleClientConstant.UrlQueryForErrorCode}=${code}`,\n );\n };\n}\n\nexport function useUrlQuery() {\n const search = useLocation().search || location.search;\n const { query } = parse(search, true);\n return query;\n}\n\nexport function useLoading(defaultLoading = false) {\n const [loading, setLoading] = useState<boolean>(defaultLoading);\n\n return {\n loading,\n setLoading,\n async withLoading(\n func: (...args: unknown[]) => Promise<unknown> | unknown,\n ) {\n try {\n setLoading(true);\n await func();\n } finally {\n setLoading(false);\n }\n },\n };\n}\n\nexport function useProjectRootByManifest(manifest: Manifest.RsdoctorManifest) {\n return manifest.data.root;\n}\n\nexport function useHashByManifest(manifest: Manifest.RsdoctorManifest) {\n return manifest.data.hash;\n}\n\nexport function useCloudManifestUrlByManifest(\n manifest:\n | Manifest.RsdoctorManifest\n | Manifest.RsdoctorManifestWithShardingFiles\n | void,\n) {\n if (!manifest) return;\n}\n\nfunction ensurePlainObject<T extends object>(value: T, dfts: T): T {\n if (value && typeof value === 'object') {\n if (Array.isArray(value)) {\n return dfts;\n }\n return defaults(value, dfts);\n }\n\n return dfts;\n}\n\nexport function useChunkGraphByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.chunkGraph;\n if (typeof prev === 'string') {\n manifest.data.chunkGraph = JSON.parse(\n Algorithm.decompressText(prev as string),\n );\n }\n\n return ensurePlainObject(manifest.data.chunkGraph, {\n assets: [],\n chunks: [],\n entrypoints: [],\n });\n}\n\nexport function useConfigOutputFileNameByManifest(\n manifest: Manifest.RsdoctorManifest,\n) {\n if (\n typeof manifest.data.configs?.[0]?.config?.output?.filename === 'string'\n ) {\n return manifest.data.configs?.[0]?.config?.output?.filename;\n }\n return '';\n}\n\nexport function useModuleGraphByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.moduleGraph;\n if (typeof prev === 'string') {\n manifest.data.moduleGraph = JSON.parse(\n Algorithm.decompressText(prev as string),\n );\n }\n\n return ensurePlainObject(manifest.data.moduleGraph, {\n dependencies: [],\n modules: [],\n moduleGraphModules: [],\n exports: [],\n sideEffects: [],\n variables: [],\n });\n}\n\nexport function useModuleGraph(moduleGraph: SDK.ModuleGraphData) {\n const prev = moduleGraph;\n if (typeof prev === 'string') {\n moduleGraph = JSON.parse(Algorithm.decompressText(prev as string));\n }\n\n return ensurePlainObject(moduleGraph, {\n dependencies: [],\n modules: [],\n moduleGraphModules: [],\n exports: [],\n sideEffects: [],\n variables: [],\n });\n}\n\nexport function usePackageGraphByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.packageGraph;\n if (typeof prev === 'string') {\n manifest.data.packageGraph = JSON.parse(\n Algorithm.decompressText(prev as string),\n );\n }\n return ensurePlainObject(manifest.data.packageGraph, {\n packages: [],\n dependencies: [],\n });\n}\n\nexport function useUniqModulesByManifest(manifest: Manifest.RsdoctorManifest) {\n return uniqBy(useModuleGraphByManifest(manifest).modules, (e) => e.path);\n}\n\nexport function useUniqModules(modules: SDK.ModuleData[]) {\n return uniqBy(modules, (e) => e.path);\n}\n\nexport function useErrorsByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.errors;\n if (typeof prev === 'string') {\n manifest.data.errors = JSON.parse(Algorithm.decompressText(prev as string));\n }\n return manifest.data.errors || [];\n}\n\nexport function useBundleAlertsByManifest(manifest: Manifest.RsdoctorManifest) {\n const errors = useErrorsByManifest(manifest);\n return useBundleAlertsByErrors(errors);\n}\n\nexport function useDuplicatePackagesByManifest(\n manifest: Manifest.RsdoctorManifest,\n): Rule.PackageRelationDiffRuleStoreData[] {\n const alerts = useBundleAlertsByManifest(manifest);\n return useDuplicatePackagesByErrors(alerts);\n}\n\nexport function useCompileAlertsByErrors(\n errors: Manifest.RsdoctorManifestData['errors'],\n) {\n if (Array.isArray(errors)) {\n return errors.filter(\n (e) =>\n e.category === Rule.RuleMessageCategory.Compile &&\n e.code !== Rule.RuleMessageCodeEnumerated.Overlay,\n );\n }\n return [];\n}\n\nexport function useBundleAlertsByErrors(\n errors: Manifest.RsdoctorManifestData['errors'],\n) {\n if (Array.isArray(errors)) {\n return errors.filter(\n (e) =>\n e.category === Rule.RuleMessageCategory.Bundle &&\n e.code !== Rule.RuleMessageCodeEnumerated.Overlay,\n );\n }\n return [];\n}\n\nexport function useDuplicatePackagesByErrors(\n errors: Manifest.RsdoctorManifestData['errors'],\n) {\n return useBundleAlertsByErrors(errors).filter(\n (e) => e.code === Rule.RuleErrorMap.E1001.code,\n ) as Rule.PackageRelationDiffRuleStoreData[];\n}\n\nexport function useWebpackConfigurationByConfigs(configs: SDK.ConfigData = []) {\n if (Array.isArray(configs)) {\n return configs.find((e) => e.name === 'webpack' || e.name === 'rspack');\n }\n return null;\n}\n\nexport function useDetectIfCloudIdeEnv() {\n if (\n window.location.protocol === 'https:' &&\n window.location.href.indexOf('ide-proxy') > 0\n ) {\n return true;\n }\n return false;\n}\n\nexport function useWindowWidth() {\n const [windowWidth, setWindowWidth] = useState(window.innerWidth);\n\n useEffect(() => {\n const handleResize = () => setWindowWidth(window.innerWidth);\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, []);\n\n return windowWidth;\n}\n"],"names":["route","Client","useI18n","i18n","rest","useTranslation","lng","callback","error","t","setLocaleToStorage","useRuleIndexNavigate","code","link","navigate","useNavigate","window","Rule","useUrlQuery","search","useLocation","location","query","parse","useLoading","defaultLoading","loading","setLoading","useState","func","useProjectRootByManifest","manifest","useHashByManifest","useCloudManifestUrlByManifest","ensurePlainObject","value","dfts","Array","defaults","useChunkGraphByManifest","prev","JSON","Algorithm","useConfigOutputFileNameByManifest","useModuleGraphByManifest","useModuleGraph","moduleGraph","usePackageGraphByManifest","useUniqModulesByManifest","uniqBy","e","useUniqModules","modules","useErrorsByManifest","useBundleAlertsByManifest","errors","useBundleAlertsByErrors","useDuplicatePackagesByManifest","alerts","useDuplicatePackagesByErrors","useCompileAlertsByErrors","useWebpackConfigurationByConfigs","configs","useDetectIfCloudIdeEnv","useWindowWidth","windowWidth","setWindowWidth","useEffect","handleResize"],"mappings":";;;;;;;;;AAYA,MAAMA,QAAQC,OAAO,oBAAoB,CAAC,SAAS;AAE5C,MAAMC,UAAiC;IAC5C,MAAM,EAAEC,IAAI,EAAE,GAAGC,MAAM,GAAGC;IAE1B,OAAO;QACL,GAAGD,IAAI;QACP,MAAM;YACJ,GAAGD,IAAI;YACP,gBAAeG,GAAG,EAAEC,QAAQ;gBAC1B,OAAOJ,KAAK,cAAc,CAACG,KAAK,CAACE,OAAOC;oBACtC,IAAI,CAACD,OACHE,mBAAmBJ;oBAErBC,YAAYA,SAASC,OAAOC;gBAC9B;YACF;QACF;IACF;AACF;AAEO,SAASE,qBAAqBC,IAAY,EAAEC,IAAyB;IAC1E,MAAMC,WAAWC;IAEjB,IAAIF,MACF,OAAO,IAAMG,OAAO,IAAI,CAACH,MAAM;IAGjC,OAAO;QACLC,SACE,GAAGd,MAAM,CAAC,EAAEiB,KAAK,0BAA0B,CAAC,oBAAoB,CAAC,CAAC,EAAEL,MAAM;IAE9E;AACF;AAEO,SAASM;IACd,MAAMC,SAASC,cAAc,MAAM,IAAIC,SAAS,MAAM;IACtD,MAAM,EAAEC,KAAK,EAAE,GAAGC,UAAMJ,QAAQ;IAChC,OAAOG;AACT;AAEO,SAASE,WAAWC,iBAAiB,KAAK;IAC/C,MAAM,CAACC,SAASC,WAAW,GAAGC,SAAkBH;IAEhD,OAAO;QACLC;QACAC;QACA,MAAM,aACJE,IAAwD;YAExD,IAAI;gBACFF,WAAW;gBACX,MAAME;YACR,SAAU;gBACRF,WAAW;YACb;QACF;IACF;AACF;AAEO,SAASG,yBAAyBC,QAAmC;IAC1E,OAAOA,SAAS,IAAI,CAAC,IAAI;AAC3B;AAEO,SAASC,kBAAkBD,QAAmC;IACnE,OAAOA,SAAS,IAAI,CAAC,IAAI;AAC3B;AAEO,SAASE,8BACdF,QAGQ;IAER,IAAI,CAACA,UAAU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EAAE;AACX;AAEO,SAASuC,wBACdD,MAA+C;IAE/C,IAAIlB,MAAM,OAAO,CAACkB,SAChB,OAAOA,OAAO,MAAM,CAClB,CAACL,IACCA,EAAE,QAAQ,KAAKjC,KAAK,mBAAmB,CAAC,MAAM,IAC9CiC,EAAE,IAAI,KAAKjC,KAAK,yBAAyB,CAAC,OAAO;IAGvD,OAAO,EAAE;AACX;AAEO,SAAS0C,6BACdJ,MAA+C;IAE/C,OAAOC,wBAAwBD,QAAQ,MAAM,CAC3C,CAACL,IAAMA,EAAE,IAAI,KAAKjC,KAAK,YAAY,CAAC,KAAK,CAAC,IAAI;AAElD;AAEO,SAAS4C,iCAAiCC,UAA0B,EAAE;IAC3E,IAAIzB,MAAM,OAAO,CAACyB,UAChB,OAAOA,QAAQ,IAAI,CAAC,CAACZ,IAAMA,AAAW,cAAXA,EAAE,IAAI,IAAkBA,AAAW,aAAXA,EAAE,IAAI;IAE3D,OAAO;AACT;AAEO,SAASa;IACd,IACE/C,AAA6B,aAA7BA,OAAO,QAAQ,CAAC,QAAQ,IACxBA,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,GAE5C,OAAO;IAET,OAAO;AACT;AAEO,SAASgD;IACd,MAAM,CAACC,aAAaC,eAAe,GAAGtC,SAASZ,OAAO,UAAU;IAEhEmD,UAAU;QACR,MAAMC,eAAe,IAAMF,eAAelD,OAAO,UAAU;QAC3DA,OAAO,gBAAgB,CAAC,UAAUoD;QAClC,OAAO;YACLpD,OAAO,mBAAmB,CAAC,UAAUoD;QACvC;IACF,GAAG,EAAE;IAEL,OAAOH;AACT"}
1
+ {"version":3,"file":"utils/hooks.mjs","sources":["../../src/utils/hooks.ts"],"sourcesContent":["import { Algorithm } from '@rsdoctor/utils/common';\nimport { Client, Manifest, Rule, SDK } from '@rsdoctor/types';\nimport { uniqBy, defaults } from 'es-toolkit/compat';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport parse from 'url-parse';\n\nimport './i18n';\nimport { Language } from '../constants';\nimport { setLocaleToStorage } from './storage';\n\nconst route = Client.RsdoctorClientRoutes.RuleIndex;\n\nexport const useI18n: typeof useTranslation = () => {\n const { i18n, ...rest } = useTranslation();\n\n return {\n ...rest,\n i18n: {\n ...i18n,\n changeLanguage(lng, callback) {\n return i18n.changeLanguage(lng, (error, t) => {\n if (!error) {\n setLocaleToStorage(lng as Language);\n }\n callback && callback(error, t);\n });\n },\n },\n };\n};\n\nexport function useRuleIndexNavigate(code: string, link?: string | undefined) {\n const navigate = useNavigate();\n\n if (link) {\n return () => window.open(link, '__blank');\n }\n\n return () => {\n navigate(\n `${route}?${Rule.RsdoctorRuleClientConstant.UrlQueryForErrorCode}=${code}`,\n );\n };\n}\n\nexport function useUrlQuery() {\n const search = useLocation().search || location.search;\n\n return useMemo(() => parse(search, true).query, [search]);\n}\n\nexport function useLoading(defaultLoading = false) {\n const [loading, setLoading] = useState<boolean>(defaultLoading);\n\n return {\n loading,\n setLoading,\n async withLoading(\n func: (...args: unknown[]) => Promise<unknown> | unknown,\n ) {\n try {\n setLoading(true);\n await func();\n } finally {\n setLoading(false);\n }\n },\n };\n}\n\nexport function useProjectRootByManifest(manifest: Manifest.RsdoctorManifest) {\n return manifest.data.root;\n}\n\nexport function useHashByManifest(manifest: Manifest.RsdoctorManifest) {\n return manifest.data.hash;\n}\n\nexport function useCloudManifestUrlByManifest(\n manifest:\n | Manifest.RsdoctorManifest\n | Manifest.RsdoctorManifestWithShardingFiles\n | void,\n) {\n if (!manifest) return;\n}\n\nfunction ensurePlainObject<T extends object>(value: T, dfts: T): T {\n if (value && typeof value === 'object') {\n if (Array.isArray(value)) {\n return dfts;\n }\n return defaults(value, dfts);\n }\n\n return dfts;\n}\n\nexport function useChunkGraphByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.chunkGraph;\n if (typeof prev === 'string') {\n manifest.data.chunkGraph = JSON.parse(\n Algorithm.decompressText(prev as string),\n );\n }\n\n return ensurePlainObject(manifest.data.chunkGraph, {\n assets: [],\n chunks: [],\n entrypoints: [],\n });\n}\n\nexport function useConfigOutputFileNameByManifest(\n manifest: Manifest.RsdoctorManifest,\n) {\n if (\n typeof manifest.data.configs?.[0]?.config?.output?.filename === 'string'\n ) {\n return manifest.data.configs?.[0]?.config?.output?.filename;\n }\n return '';\n}\n\nexport function useModuleGraphByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.moduleGraph;\n if (typeof prev === 'string') {\n manifest.data.moduleGraph = JSON.parse(\n Algorithm.decompressText(prev as string),\n );\n }\n\n return ensurePlainObject(manifest.data.moduleGraph, {\n dependencies: [],\n modules: [],\n moduleGraphModules: [],\n exports: [],\n sideEffects: [],\n variables: [],\n });\n}\n\nexport function useModuleGraph(moduleGraph: SDK.ModuleGraphData) {\n const prev = moduleGraph;\n if (typeof prev === 'string') {\n moduleGraph = JSON.parse(Algorithm.decompressText(prev as string));\n }\n\n return ensurePlainObject(moduleGraph, {\n dependencies: [],\n modules: [],\n moduleGraphModules: [],\n exports: [],\n sideEffects: [],\n variables: [],\n });\n}\n\nexport function usePackageGraphByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.packageGraph;\n if (typeof prev === 'string') {\n manifest.data.packageGraph = JSON.parse(\n Algorithm.decompressText(prev as string),\n );\n }\n return ensurePlainObject(manifest.data.packageGraph, {\n packages: [],\n dependencies: [],\n });\n}\n\nexport function useUniqModulesByManifest(manifest: Manifest.RsdoctorManifest) {\n return uniqBy(useModuleGraphByManifest(manifest).modules, (e) => e.path);\n}\n\nexport function useUniqModules(modules: SDK.ModuleData[]) {\n return uniqBy(modules, (e) => e.path);\n}\n\nexport function useErrorsByManifest(manifest: Manifest.RsdoctorManifest) {\n const prev = manifest.data.errors;\n if (typeof prev === 'string') {\n manifest.data.errors = JSON.parse(Algorithm.decompressText(prev as string));\n }\n return manifest.data.errors || [];\n}\n\nexport function useBundleAlertsByManifest(manifest: Manifest.RsdoctorManifest) {\n const errors = useErrorsByManifest(manifest);\n return useBundleAlertsByErrors(errors);\n}\n\nexport function useDuplicatePackagesByManifest(\n manifest: Manifest.RsdoctorManifest,\n): Rule.PackageRelationDiffRuleStoreData[] {\n const alerts = useBundleAlertsByManifest(manifest);\n return useDuplicatePackagesByErrors(alerts);\n}\n\nexport function useCompileAlertsByErrors(\n errors: Manifest.RsdoctorManifestData['errors'],\n) {\n if (Array.isArray(errors)) {\n return errors.filter(\n (e) =>\n e.category === Rule.RuleMessageCategory.Compile &&\n e.code !== Rule.RuleMessageCodeEnumerated.Overlay,\n );\n }\n return [];\n}\n\nexport function useBundleAlertsByErrors(\n errors: Manifest.RsdoctorManifestData['errors'],\n) {\n if (Array.isArray(errors)) {\n return errors.filter(\n (e) =>\n e.category === Rule.RuleMessageCategory.Bundle &&\n e.code !== Rule.RuleMessageCodeEnumerated.Overlay,\n );\n }\n return [];\n}\n\nexport function useDuplicatePackagesByErrors(\n errors: Manifest.RsdoctorManifestData['errors'],\n) {\n return useBundleAlertsByErrors(errors).filter(\n (e) => e.code === Rule.RuleErrorMap.E1001.code,\n ) as Rule.PackageRelationDiffRuleStoreData[];\n}\n\nexport function useWebpackConfigurationByConfigs(configs: SDK.ConfigData = []) {\n if (Array.isArray(configs)) {\n return configs.find((e) => e.name === 'webpack' || e.name === 'rspack');\n }\n return null;\n}\n\nexport function useDetectIfCloudIdeEnv() {\n if (\n window.location.protocol === 'https:' &&\n window.location.href.indexOf('ide-proxy') > 0\n ) {\n return true;\n }\n return false;\n}\n\nexport function useWindowWidth() {\n const [windowWidth, setWindowWidth] = useState(window.innerWidth);\n\n useEffect(() => {\n const handleResize = () => setWindowWidth(window.innerWidth);\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, []);\n\n return windowWidth;\n}\n"],"names":["route","Client","useI18n","i18n","rest","useTranslation","lng","callback","error","t","setLocaleToStorage","useRuleIndexNavigate","code","link","navigate","useNavigate","window","Rule","useUrlQuery","search","useLocation","location","useMemo","parse","useLoading","defaultLoading","loading","setLoading","useState","func","useProjectRootByManifest","manifest","useHashByManifest","useCloudManifestUrlByManifest","ensurePlainObject","value","dfts","Array","defaults","useChunkGraphByManifest","prev","JSON","Algorithm","useConfigOutputFileNameByManifest","useModuleGraphByManifest","useModuleGraph","moduleGraph","usePackageGraphByManifest","useUniqModulesByManifest","uniqBy","e","useUniqModules","modules","useErrorsByManifest","useBundleAlertsByManifest","errors","useBundleAlertsByErrors","useDuplicatePackagesByManifest","alerts","useDuplicatePackagesByErrors","useCompileAlertsByErrors","useWebpackConfigurationByConfigs","configs","useDetectIfCloudIdeEnv","useWindowWidth","windowWidth","setWindowWidth","useEffect","handleResize"],"mappings":";;;;;;;;;AAYA,MAAMA,QAAQC,OAAO,oBAAoB,CAAC,SAAS;AAE5C,MAAMC,UAAiC;IAC5C,MAAM,EAAEC,IAAI,EAAE,GAAGC,MAAM,GAAGC;IAE1B,OAAO;QACL,GAAGD,IAAI;QACP,MAAM;YACJ,GAAGD,IAAI;YACP,gBAAeG,GAAG,EAAEC,QAAQ;gBAC1B,OAAOJ,KAAK,cAAc,CAACG,KAAK,CAACE,OAAOC;oBACtC,IAAI,CAACD,OACHE,mBAAmBJ;oBAErBC,YAAYA,SAASC,OAAOC;gBAC9B;YACF;QACF;IACF;AACF;AAEO,SAASE,qBAAqBC,IAAY,EAAEC,IAAyB;IAC1E,MAAMC,WAAWC;IAEjB,IAAIF,MACF,OAAO,IAAMG,OAAO,IAAI,CAACH,MAAM;IAGjC,OAAO;QACLC,SACE,GAAGd,MAAM,CAAC,EAAEiB,KAAK,0BAA0B,CAAC,oBAAoB,CAAC,CAAC,EAAEL,MAAM;IAE9E;AACF;AAEO,SAASM;IACd,MAAMC,SAASC,cAAc,MAAM,IAAIC,SAAS,MAAM;IAEtD,OAAOC,QAAQ,IAAMC,UAAMJ,QAAQ,MAAM,KAAK,EAAE;QAACA;KAAO;AAC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D,UAAU;QACR,MAAMC,eAAe,IAAMF,eAAelD,OAAO,UAAU;QAC3DA,OAAO,gBAAgB,CAAC,UAAUoD;QAClC,OAAO;YACLpD,OAAO,mBAAmB,CAAC,UAAUoD;QACvC;IACF,GAAG,EAAE;IAEL,OAAOH;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/components",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "license": "MIT",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@rsbuild/plugin-check-syntax": "1.5.0",
42
- "@rsbuild/plugin-react": "^1.4.1",
42
+ "@rsbuild/plugin-react": "^1.4.2",
43
43
  "@rsbuild/plugin-sass": "^1.4.0",
44
44
  "@rsbuild/plugin-svgr": "^1.2.2",
45
45
  "@types/node": "^22.8.1",
@@ -59,7 +59,7 @@
59
59
  "clsx": "^2.1.1",
60
60
  "dayjs": "1.11.19",
61
61
  "echarts": "^5.6.0",
62
- "echarts-for-react": "^3.0.3",
62
+ "echarts-for-react": "^3.0.5",
63
63
  "es-toolkit": "^1.41.0",
64
64
  "i18next": "22.0.4",
65
65
  "monaco-editor": "0.49.0",
@@ -74,9 +74,9 @@
74
74
  "react-router-dom": "6.4.3",
75
75
  "socket.io-client": "4.8.1",
76
76
  "url-parse": "1.5.10",
77
- "@rsdoctor/types": "1.3.8",
78
- "@rsdoctor/utils": "1.3.8",
79
- "@rsdoctor/graph": "1.3.8"
77
+ "@rsdoctor/graph": "1.3.10",
78
+ "@rsdoctor/utils": "1.3.10",
79
+ "@rsdoctor/types": "1.3.10"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "react": ">=18.3.1",