@rsdoctor/components 0.3.10-beta.1 → 0.3.11
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.
|
@@ -53,7 +53,7 @@ const tagStyle = {
|
|
|
53
53
|
const ModuleCodeViewer = ({
|
|
54
54
|
data
|
|
55
55
|
}) => {
|
|
56
|
-
const [tab, setTab] = useState("
|
|
56
|
+
const [tab, setTab] = useState("");
|
|
57
57
|
const { t } = useI18n();
|
|
58
58
|
const TAB_LAB_MAP = {
|
|
59
59
|
source: "Source Code",
|
|
@@ -93,6 +93,7 @@ const ModuleCodeViewer = ({
|
|
|
93
93
|
tab: TAB_LAB_MAP[e.tab],
|
|
94
94
|
key: e.tab
|
|
95
95
|
})),
|
|
96
|
+
defaultActiveTabKey: source["parsedSource"] ? "parsedSource" : "source",
|
|
96
97
|
onTabChange: (v) => setTab(v),
|
|
97
98
|
tabBarExtraContent: /* @__PURE__ */ jsx(
|
|
98
99
|
Popover,
|
|
@@ -142,7 +143,7 @@ const ModuleCodeViewer = ({
|
|
|
142
143
|
theme: "vs-dark",
|
|
143
144
|
language: getOriginalLanguage(path),
|
|
144
145
|
height: window.innerHeight / 1.5,
|
|
145
|
-
value: source[tab],
|
|
146
|
+
value: tab ? source[tab] : source["parsedSource"] ? source["parsedSource"] : source["source"],
|
|
146
147
|
options: {
|
|
147
148
|
readOnly: true,
|
|
148
149
|
domReadOnly: true,
|
package/dist/utils/hooks.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { Manifest, Rule, SDK } from '@rsdoctor/types';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import './i18n';
|
|
5
|
-
export declare function decompressText(input: string): string;
|
|
6
5
|
export declare const useI18n: typeof useTranslation;
|
|
7
6
|
export declare function useRuleIndexNavigate(code: string, link?: string | undefined): () => void;
|
|
8
7
|
export declare function useUrlQuery(): Record<string, string | undefined>;
|
package/dist/utils/hooks.js
CHANGED
|
@@ -8,20 +8,6 @@ import parse from "url-parse";
|
|
|
8
8
|
import "./i18n";
|
|
9
9
|
import { setLocaleToStorage } from "./storage";
|
|
10
10
|
const route = Client.RsdoctorClientRoutes.RuleIndex;
|
|
11
|
-
function decompressText(input) {
|
|
12
|
-
try {
|
|
13
|
-
if (!window.lz4)
|
|
14
|
-
return "";
|
|
15
|
-
const compressedBlock = Buffer.from(input);
|
|
16
|
-
let uncompressedBlock = Buffer.alloc(input.length * 10);
|
|
17
|
-
const n = window.lz4.decodeBlock(compressedBlock, uncompressedBlock);
|
|
18
|
-
uncompressedBlock = uncompressedBlock.slice(0, n);
|
|
19
|
-
return uncompressedBlock.toString("utf-8");
|
|
20
|
-
} catch (e) {
|
|
21
|
-
console.log(e);
|
|
22
|
-
return "";
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
11
|
const useI18n = () => {
|
|
26
12
|
const { i18n, ...rest } = useTranslation();
|
|
27
13
|
return {
|
|
@@ -45,9 +31,7 @@ function useRuleIndexNavigate(code, link) {
|
|
|
45
31
|
return () => window.open(link, "__blank");
|
|
46
32
|
}
|
|
47
33
|
return () => {
|
|
48
|
-
navigate(
|
|
49
|
-
`${route}?${Rule.RsdoctorRuleClientConstant.UrlQueryForErrorCode}=${code}`
|
|
50
|
-
);
|
|
34
|
+
navigate(`${route}?${Rule.RsdoctorRuleClientConstant.UrlQueryForErrorCode}=${code}`);
|
|
51
35
|
};
|
|
52
36
|
}
|
|
53
37
|
function useUrlQuery() {
|
|
@@ -92,15 +76,9 @@ function ensurePlainObject(value, dfts) {
|
|
|
92
76
|
function useChunkGraphByManifest(manifest) {
|
|
93
77
|
const prev = manifest.data.chunkGraph;
|
|
94
78
|
if (typeof prev === "string") {
|
|
95
|
-
manifest.data.chunkGraph = JSON.parse(
|
|
96
|
-
Algorithm.decompressText(prev)
|
|
97
|
-
);
|
|
79
|
+
manifest.data.chunkGraph = JSON.parse(Algorithm.decompressText(prev));
|
|
98
80
|
}
|
|
99
|
-
return ensurePlainObject(manifest.data.chunkGraph, {
|
|
100
|
-
assets: [],
|
|
101
|
-
chunks: [],
|
|
102
|
-
entrypoints: []
|
|
103
|
-
});
|
|
81
|
+
return ensurePlainObject(manifest.data.chunkGraph, { assets: [], chunks: [], entrypoints: [] });
|
|
104
82
|
}
|
|
105
83
|
function useConfigOutputFileNameByManifest(manifest) {
|
|
106
84
|
if (typeof manifest.data.configs?.[0]?.config?.output?.filename === "string") {
|
|
@@ -111,9 +89,7 @@ function useConfigOutputFileNameByManifest(manifest) {
|
|
|
111
89
|
function useModuleGraphByManifest(manifest) {
|
|
112
90
|
const prev = manifest.data.moduleGraph;
|
|
113
91
|
if (typeof prev === "string") {
|
|
114
|
-
manifest.data.moduleGraph = JSON.parse(
|
|
115
|
-
Algorithm.decompressText(prev)
|
|
116
|
-
);
|
|
92
|
+
manifest.data.moduleGraph = JSON.parse(Algorithm.decompressText(prev));
|
|
117
93
|
}
|
|
118
94
|
return ensurePlainObject(manifest.data.moduleGraph, {
|
|
119
95
|
dependencies: [],
|
|
@@ -141,9 +117,7 @@ function useModuleGraph(moduleGraph) {
|
|
|
141
117
|
function usePackageGraphByManifest(manifest) {
|
|
142
118
|
const prev = manifest.data.packageGraph;
|
|
143
119
|
if (typeof prev === "string") {
|
|
144
|
-
manifest.data.packageGraph = JSON.parse(
|
|
145
|
-
Algorithm.decompressText(prev)
|
|
146
|
-
);
|
|
120
|
+
manifest.data.packageGraph = JSON.parse(Algorithm.decompressText(prev));
|
|
147
121
|
}
|
|
148
122
|
return ensurePlainObject(manifest.data.packageGraph, {
|
|
149
123
|
packages: [],
|
|
@@ -216,7 +190,6 @@ function useWindowWidth() {
|
|
|
216
190
|
return windowWidth;
|
|
217
191
|
}
|
|
218
192
|
export {
|
|
219
|
-
decompressText,
|
|
220
193
|
useBundleAlertsByErrors,
|
|
221
194
|
useBundleAlertsByManifest,
|
|
222
195
|
useChunkGraphByManifest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"dist/"
|
|
45
45
|
],
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@ant-design/icons": "4.8.
|
|
47
|
+
"@ant-design/icons": "4.8.3",
|
|
48
48
|
"@monaco-editor/react": "4.6.0",
|
|
49
|
-
"@types/lodash-es": "4.17.
|
|
49
|
+
"@types/lodash-es": "4.17.12",
|
|
50
50
|
"@types/node": "^16",
|
|
51
|
-
"@types/path-browserify": "1.0.
|
|
51
|
+
"@types/path-browserify": "1.0.2",
|
|
52
52
|
"@types/react": "^18",
|
|
53
|
-
"@types/react-highlight-words": "^0.
|
|
54
|
-
"@types/url-parse": "1.4.
|
|
53
|
+
"@types/react-highlight-words": "^0.20.0",
|
|
54
|
+
"@types/url-parse": "1.4.11",
|
|
55
55
|
"ansi-to-react": "6.1.6",
|
|
56
56
|
"antd": "5.15.3",
|
|
57
57
|
"axios": "^1.7.2",
|
|
58
|
-
"dayjs": "1.11.
|
|
59
|
-
"echarts": "^5.5.
|
|
58
|
+
"dayjs": "1.11.12",
|
|
59
|
+
"echarts": "^5.5.1",
|
|
60
60
|
"echarts-for-react": "^3.0.2",
|
|
61
61
|
"i18next": "22.0.4",
|
|
62
62
|
"lodash-es": "4.17.21",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"react-markdown": "^9.0.1",
|
|
73
73
|
"react-router-dom": "6.4.3",
|
|
74
74
|
"socket.io-client": "4.6.1",
|
|
75
|
-
"terser": "^5.
|
|
75
|
+
"terser": "^5.31.3",
|
|
76
76
|
"typescript": "^5.2.2",
|
|
77
77
|
"url-parse": "1.5.10",
|
|
78
|
-
"@rsdoctor/graph": "0.3.
|
|
79
|
-
"@rsdoctor/types": "0.3.
|
|
80
|
-
"@rsdoctor/utils": "0.3.
|
|
78
|
+
"@rsdoctor/graph": "0.3.11",
|
|
79
|
+
"@rsdoctor/types": "0.3.11",
|
|
80
|
+
"@rsdoctor/utils": "0.3.11"
|
|
81
81
|
},
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public",
|