@rsdoctor/components 0.0.2-beta.0 → 0.0.2-beta.2
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.
- package/dist/components/Alert/change.js +2 -3
- package/dist/components/Alert/file-relation.js +1 -1
- package/dist/components/Alert/index.css +3 -0
- package/dist/components/Alert/link.js +1 -1
- package/dist/components/Alert/package-relation.js +8 -27
- package/dist/components/Alert/view.js +3 -4
- package/dist/components/Alerts/bundle.js +23 -9
- package/dist/components/Alerts/common.js +3 -20
- package/dist/components/Badge/index.js +11 -29
- package/dist/components/Card/diff.d.ts +2 -2
- package/dist/components/Card/diff.js +4 -33
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +6 -37
- package/dist/components/Card/size.d.ts +5 -0
- package/dist/components/Card/size.js +17 -9
- package/dist/components/Card/statistic.css +2 -1
- package/dist/components/Card/statistic.d.ts +3 -0
- package/dist/components/Card/statistic.js +6 -21
- package/dist/components/Charts/TimelineCharts/index.js +120 -127
- package/dist/components/Charts/common.js +1 -1
- package/dist/components/Charts/loader.js +9 -18
- package/dist/components/CodeViewer/diff.js +8 -26
- package/dist/components/CodeViewer/hightlight.js +3 -3
- package/dist/components/CodeViewer/viewer.js +4 -20
- package/dist/components/Configuration/{webpack.d.ts → builder.d.ts} +1 -1
- package/dist/components/Configuration/{webpack.js → builder.js} +6 -6
- package/dist/components/Configuration/index.d.ts +1 -1
- package/dist/components/Configuration/index.js +1 -1
- package/dist/components/FileTree/index.js +13 -24
- package/dist/components/Form/keyword.js +1 -17
- package/dist/components/Keyword/index.js +4 -36
- package/dist/components/Layout/builder-select.js +1 -1
- package/dist/components/Layout/header.js +2 -3
- package/dist/components/Layout/index.js +2 -2
- package/dist/components/Layout/menus.d.ts +1 -1
- package/dist/components/Layout/menus.js +11 -35
- package/dist/components/Loader/Analysis/files.js +8 -2
- package/dist/components/Loader/Analysis/index.d.ts +1 -1
- package/dist/components/Loader/executions.d.ts +1 -1
- package/dist/components/Loader/executions.js +62 -84
- package/dist/components/Manifest/api.d.ts +1 -1
- package/dist/components/Manifest/api.js +5 -35
- package/dist/components/Manifest/data.d.ts +1 -1
- package/dist/components/Manifest/data.js +1 -17
- package/dist/components/Opener/vscode.js +4 -19
- package/dist/components/Overall/bundle.js +2 -2
- package/dist/components/Overall/compile.js +1 -2
- package/dist/components/Resolver/analysis.js +1 -17
- package/dist/components/TextDrawer/duplicate.js +18 -56
- package/dist/components/TextDrawer/index.js +9 -28
- package/dist/components/worker/ecmaversion/client.js +1 -2
- package/dist/components/worker/ecmaversion/worker.js +3 -3
- package/dist/components/worker/jsequal/client.js +1 -2
- package/dist/components/worker/jsequal/worker.js +21 -50
- package/dist/config.d.ts +2 -2
- package/dist/config.js +3 -17
- package/dist/constants.d.ts +4 -2
- package/dist/constants.js +5 -1
- package/dist/pages/BundleSize/components/asset.js +74 -101
- package/dist/pages/BundleSize/components/cards.js +16 -27
- package/dist/pages/BundleSize/components/index.d.ts +1 -1
- package/dist/pages/BundleSize/components/index.js +57 -5
- package/dist/pages/BundleSize/constants.d.ts +1 -1
- package/dist/pages/BundleSize/constants.js +1 -1
- package/dist/pages/ModuleAnalyze/chunks.js +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +16 -7
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +6 -24
- package/dist/pages/ModuleAnalyze/constants.d.ts +1 -1
- package/dist/pages/ModuleAnalyze/constants.js +1 -1
- package/dist/pages/ModuleAnalyze/utils/hooks.js +5 -8
- package/dist/pages/ModuleAnalyze/utils/index.js +2 -4
- package/dist/pages/ModuleResolve/constants.d.ts +1 -1
- package/dist/pages/ModuleResolve/constants.js +1 -1
- package/dist/pages/Overall/constants.d.ts +1 -1
- package/dist/pages/Overall/constants.js +1 -1
- package/dist/pages/Resources/RuleIndex/constants.d.ts +3 -0
- package/dist/pages/Resources/RuleIndex/constants.js +7 -0
- package/dist/pages/Resources/RuleIndex/index.d.ts +3 -0
- package/dist/pages/Resources/RuleIndex/index.js +53 -0
- package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +1 -1
- package/dist/pages/WebpackLoaders/Analysis/constants.js +1 -1
- package/dist/pages/WebpackLoaders/Overall/constants.d.ts +2 -2
- package/dist/pages/WebpackLoaders/Overall/constants.js +2 -2
- package/dist/pages/WebpackLoaders/Overall/index.js +1 -1
- package/dist/pages/WebpackPlugins/constants.d.ts +2 -2
- package/dist/pages/WebpackPlugins/constants.js +2 -2
- package/dist/pages/index.d.ts +2 -1
- package/dist/pages/index.js +3 -1
- package/dist/utils/data/base.d.ts +7 -7
- package/dist/utils/data/base.js +2 -24
- package/dist/utils/data/index.d.ts +1 -1
- package/dist/utils/data/index.js +14 -36
- package/dist/utils/data/local.d.ts +1 -1
- package/dist/utils/data/local.js +32 -56
- package/dist/utils/data/remote.d.ts +1 -1
- package/dist/utils/data/remote.js +22 -46
- package/dist/utils/file.js +4 -4
- package/dist/utils/hooks.d.ts +16 -15
- package/dist/utils/hooks.js +33 -73
- package/dist/utils/i18n/cn.js +1 -1
- package/dist/utils/i18n/en.d.ts +1 -1
- package/dist/utils/i18n/en.js +1 -1
- package/dist/utils/manifest.d.ts +2 -2
- package/dist/utils/monaco.d.ts +4 -1
- package/dist/utils/monaco.js +26 -3
- package/dist/utils/request.d.ts +10 -10
- package/dist/utils/request.js +52 -101
- package/dist/utils/routes.d.ts +2 -2
- package/dist/utils/routes.js +2 -2
- package/dist/utils/storage.js +3 -3
- package/dist/utils/url.js +10 -28
- package/package.json +7 -4
- package/dist/assets/icon.7509d763.svg +0 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ColumnHeightOutlined, InfoCircleOutlined, VerticalAlignMiddleOutlined } from "@ant-design/icons";
|
|
2
|
+
import { CodepenCircleOutlined, ColumnHeightOutlined, DeploymentUnitOutlined, InfoCircleOutlined, VerticalAlignMiddleOutlined } from "@ant-design/icons";
|
|
3
3
|
import { SDK } from "@rsdoctor/types";
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
@@ -51,7 +51,6 @@ const WebpackModulesOverallBase = ({
|
|
|
51
51
|
const [graphType, setGraphType] = useState("tree");
|
|
52
52
|
const { t } = useI18n();
|
|
53
53
|
const assets = summary.all.total.files;
|
|
54
|
-
const avgAssetSize = summary.all.total.size / assets.length;
|
|
55
54
|
const handleChange = useCallback(
|
|
56
55
|
(type) => (value) => {
|
|
57
56
|
if (type === "module") {
|
|
@@ -116,8 +115,8 @@ const WebpackModulesOverallBase = ({
|
|
|
116
115
|
},
|
|
117
116
|
children: [
|
|
118
117
|
/* @__PURE__ */ jsx(Keyword, { text: basename, keyword: inputAssetName }),
|
|
119
|
-
/* @__PURE__ */ jsx(
|
|
120
|
-
initial ? /* @__PURE__ */ jsx(Tag, { color: "cyan", style: {
|
|
118
|
+
/* @__PURE__ */ jsx(Tag, { color: "success", style: { margin: 0 }, children: formatSize(size) }),
|
|
119
|
+
initial ? /* @__PURE__ */ jsx(Tag, { color: "cyan", style: { margin: 0 }, children: "initial" }) : null,
|
|
121
120
|
/* @__PURE__ */ jsx(
|
|
122
121
|
CodeViewerWithDrawer,
|
|
123
122
|
{
|
|
@@ -170,7 +169,60 @@ const WebpackModulesOverallBase = ({
|
|
|
170
169
|
Card,
|
|
171
170
|
{
|
|
172
171
|
hidden: graphType === "tile",
|
|
173
|
-
title: /* @__PURE__ */
|
|
172
|
+
title: /* @__PURE__ */ jsxs(Space, { children: [
|
|
173
|
+
/* @__PURE__ */ jsx(Title, { text: "Bundle Analysis" }),
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
175
|
+
Tooltip,
|
|
176
|
+
{
|
|
177
|
+
color: "white",
|
|
178
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", color: "white", children: [
|
|
179
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsxs(Col, { children: [
|
|
180
|
+
/* @__PURE__ */ jsx(Tag, { color: "cyan", style: { margin: 0 }, children: "initial" }),
|
|
181
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: ": Indignify whether the chunk is the initial chunk." })
|
|
182
|
+
] }) }),
|
|
183
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsxs(Col, { children: [
|
|
184
|
+
/* @__PURE__ */ jsx(Tag, { color: "green", children: "concatenated" }),
|
|
185
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: ": Indignify whether the module is the concatenated module. " }),
|
|
186
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
187
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "Concatenated Module:" }),
|
|
188
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "A series module is to lift or series multiple modules into a closure when packaging. " })
|
|
189
|
+
] }) }),
|
|
190
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsxs(Col, { children: [
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
Button,
|
|
193
|
+
{
|
|
194
|
+
size: "small",
|
|
195
|
+
icon: /* @__PURE__ */ jsx(CodepenCircleOutlined, {})
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: ": Open the code." })
|
|
199
|
+
] }) }),
|
|
200
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsxs(Col, { children: [
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
Button,
|
|
203
|
+
{
|
|
204
|
+
size: "small",
|
|
205
|
+
icon: /* @__PURE__ */ jsx(DeploymentUnitOutlined, {})
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: ": View the module dependency, that is, module reasons in stats.json." })
|
|
209
|
+
] }) }),
|
|
210
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsxs(Col, { children: [
|
|
211
|
+
/* @__PURE__ */ jsx(Tag, { color: "purple", children: "Parsed: 15.77 KB" }),
|
|
212
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "Parsed Size" }),
|
|
213
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "The size of the code which bundled. That is, after bundle and tree-shaking." })
|
|
214
|
+
] }) }),
|
|
215
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsxs(Col, { children: [
|
|
216
|
+
/* @__PURE__ */ jsx(Tag, { color: "orange", children: "Source: 15.77 KB" }),
|
|
217
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "Source Size" }),
|
|
218
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "The size of the code which before bundle and transform." })
|
|
219
|
+
] }) })
|
|
220
|
+
] }),
|
|
221
|
+
style: { marginLeft: 3 },
|
|
222
|
+
children: /* @__PURE__ */ jsx(InfoCircleOutlined, { style: { color: "rgba(0,0,0,.45)" } })
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] }),
|
|
174
226
|
extra: fold ? /* @__PURE__ */ jsx(Button, { onClick: () => setFold(false), children: /* @__PURE__ */ jsxs(Typography.Text, { children: [
|
|
175
227
|
"Expand ",
|
|
176
228
|
/* @__PURE__ */ jsx(ColumnHeightOutlined, {})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from '@rsdoctor/types';
|
|
2
2
|
export declare const maxModuleSize = 5000;
|
|
3
3
|
export declare const name = "BundleSize";
|
|
4
|
-
export declare const route = Client.
|
|
4
|
+
export declare const route = Client.RsdoctorClientRoutes.BundleSize;
|
|
5
5
|
export type GraphType = 'tile' | 'tree';
|
|
@@ -41,7 +41,7 @@ const ChunksTable = ({ chunks }) => {
|
|
|
41
41
|
});
|
|
42
42
|
return orderBy(compact(_chunksData), ["size"], ["desc"]);
|
|
43
43
|
}, [chunks]);
|
|
44
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
44
|
+
return /* @__PURE__ */ jsx(Fragment, { children: chunksData?.length ? /* @__PURE__ */ jsx(Table, { bordered: true, pagination: false, dataSource: chunksData, columns }) : /* @__PURE__ */ jsx(Empty, {}) });
|
|
45
45
|
};
|
|
46
46
|
export {
|
|
47
47
|
ChunksTable
|
|
@@ -62,27 +62,36 @@
|
|
|
62
62
|
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) {
|
|
63
63
|
border-left: 1px solid #eee;
|
|
64
64
|
}
|
|
65
|
-
.
|
|
65
|
+
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles {
|
|
66
66
|
display: flex;
|
|
67
67
|
flex-direction: column;
|
|
68
68
|
}
|
|
69
|
-
.
|
|
69
|
+
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title {
|
|
70
70
|
display: flex;
|
|
71
71
|
cursor: pointer;
|
|
72
72
|
}
|
|
73
|
-
.
|
|
73
|
+
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img {
|
|
74
74
|
cursor: pointer;
|
|
75
75
|
}
|
|
76
|
-
.
|
|
76
|
+
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-titles .file-tree-com-node-title img-tag {
|
|
77
77
|
cursor: pointer;
|
|
78
78
|
}
|
|
79
|
-
.
|
|
79
|
+
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-selected {
|
|
80
80
|
background-color: yellow;
|
|
81
81
|
}
|
|
82
|
-
.
|
|
82
|
+
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-tag {
|
|
83
83
|
margin-inline-end: 0;
|
|
84
84
|
}
|
|
85
|
-
.
|
|
85
|
+
.rc-tree.rc-tree-show-line .rc-tree-treenode:not(:last-child) .file-tree-com-node-title-code-tag {
|
|
86
86
|
cursor: pointer;
|
|
87
87
|
padding: 0 2px;
|
|
88
88
|
}
|
|
89
|
+
.rc-tree-indent {
|
|
90
|
+
display: inline-block;
|
|
91
|
+
height: 0;
|
|
92
|
+
vertical-align: bottom;
|
|
93
|
+
}
|
|
94
|
+
.rc-tree-indent-unit {
|
|
95
|
+
display: inline-block;
|
|
96
|
+
width: 14px;
|
|
97
|
+
}
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
2
|
import { InfoCircleOutlined, MinusCircleOutlined, PlusCircleOutlined, RightSquareTwoTone } from "@ant-design/icons";
|
|
22
3
|
import { SDK } from "@rsdoctor/types";
|
|
@@ -38,11 +19,10 @@ const FileTree = (props) => {
|
|
|
38
19
|
refreshAsyncNodes: true
|
|
39
20
|
});
|
|
40
21
|
const renderNode = useCallback(({ node, onToggle }) => {
|
|
41
|
-
var _a, _b;
|
|
42
22
|
defaultOpenFather && node.data.level < defaultOpenFather && node.setOpened(true);
|
|
43
23
|
return /* @__PURE__ */ jsx("div", { className: `${prefix}-titles-box`, children: /* @__PURE__ */ jsx("div", { className: `${prefix}-titles`, children: /* @__PURE__ */ jsx(Space, { direction: "vertical", children: /* @__PURE__ */ jsx("div", { className: `${prefix}-node-title`, children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
44
24
|
/* @__PURE__ */ jsxs("div", { onClick: onToggle, children: [
|
|
45
|
-
!node.options.opened &&
|
|
25
|
+
!node.options.opened && node.data.children?.length ? /* @__PURE__ */ jsx(PlusCircleOutlined, { style: { color: "lightblue" } }) : /* @__PURE__ */ jsx(MinusCircleOutlined, { style: { color: "lightblue" } }),
|
|
46
26
|
/* @__PURE__ */ jsxs(Typography.Text, { code: true, children: [
|
|
47
27
|
node.data.name,
|
|
48
28
|
/* @__PURE__ */ jsx(
|
|
@@ -58,7 +38,7 @@ const FileTree = (props) => {
|
|
|
58
38
|
] })
|
|
59
39
|
] }),
|
|
60
40
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
61
|
-
|
|
41
|
+
node.data.concatModules?.length ? /* @__PURE__ */ jsx(
|
|
62
42
|
Popover,
|
|
63
43
|
{
|
|
64
44
|
content: /* @__PURE__ */ jsx(
|
|
@@ -109,7 +89,9 @@ const FileTree = (props) => {
|
|
|
109
89
|
}, []);
|
|
110
90
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
111
91
|
Tree,
|
|
112
|
-
|
|
92
|
+
{
|
|
93
|
+
...required,
|
|
94
|
+
...handlers,
|
|
113
95
|
horizontalLineStyles: {
|
|
114
96
|
stroke: "#c4c4c4",
|
|
115
97
|
strokeWidth: 2,
|
|
@@ -130,7 +112,7 @@ const FileTree = (props) => {
|
|
|
130
112
|
verticalLineTopOffset: 0,
|
|
131
113
|
verticalLineOffset: 5,
|
|
132
114
|
renderNode
|
|
133
|
-
}
|
|
115
|
+
}
|
|
134
116
|
) });
|
|
135
117
|
};
|
|
136
118
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from '@rsdoctor/types';
|
|
2
2
|
export declare const name = "Module Analyze";
|
|
3
|
-
export declare const route = Client.
|
|
3
|
+
export declare const route = Client.RsdoctorClientRoutes.ModuleAnalyze;
|
|
4
4
|
export declare enum DevtoolsRuleClientConstant {
|
|
5
5
|
UrlQueryForModuleAnalyze = "curModuleId",
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from "@rsdoctor/types";
|
|
2
2
|
const name = "Module Analyze";
|
|
3
|
-
const route = Client.
|
|
3
|
+
const route = Client.RsdoctorClientRoutes.ModuleAnalyze;
|
|
4
4
|
var DevtoolsRuleClientConstant = /* @__PURE__ */ ((DevtoolsRuleClientConstant2) => {
|
|
5
5
|
DevtoolsRuleClientConstant2["UrlQueryForModuleAnalyze"] = "curModuleId";
|
|
6
6
|
return DevtoolsRuleClientConstant2;
|
|
@@ -4,11 +4,11 @@ import { formatSize, getShortPath } from "../../../utils";
|
|
|
4
4
|
import { getImporteds } from ".";
|
|
5
5
|
function useCreatFileTreeData(modules, importedModules, curModule) {
|
|
6
6
|
return useMemo(() => {
|
|
7
|
-
if (!importedModules || !
|
|
7
|
+
if (!importedModules || !importedModules?.length) {
|
|
8
8
|
return { filterData: [], data: [] };
|
|
9
9
|
}
|
|
10
10
|
const root = compact(
|
|
11
|
-
importedModules
|
|
11
|
+
importedModules?.map((imported, index) => {
|
|
12
12
|
return {
|
|
13
13
|
key: `0-${index}`,
|
|
14
14
|
name: getShortPath(imported.path),
|
|
@@ -33,7 +33,7 @@ function useCreatFileTreeData(modules, importedModules, curModule) {
|
|
|
33
33
|
}
|
|
34
34
|
function getLeafs(imported, modules, fatherModule) {
|
|
35
35
|
const leafModules = getImporteds(imported, modules);
|
|
36
|
-
const leafs = leafModules
|
|
36
|
+
const leafs = leafModules?.map((_imported, index) => {
|
|
37
37
|
return {
|
|
38
38
|
key: `0-${index}`,
|
|
39
39
|
name: getShortPath(_imported.path),
|
|
@@ -53,11 +53,8 @@ function getLeafs(imported, modules, fatherModule) {
|
|
|
53
53
|
return leafs;
|
|
54
54
|
}
|
|
55
55
|
function getContactMainModulePath(concatModules, modules) {
|
|
56
|
-
const concatModulesPath = concatModules
|
|
57
|
-
|
|
58
|
-
return (_a = modules.filter((m) => m.id === cm)) == null ? void 0 : _a[0];
|
|
59
|
-
});
|
|
60
|
-
return concatModulesPath == null ? void 0 : concatModulesPath.map((m) => m.path);
|
|
56
|
+
const concatModulesPath = concatModules?.map((cm) => modules.filter((m) => m.id === cm)?.[0]);
|
|
57
|
+
return concatModulesPath?.map((m) => m.path);
|
|
61
58
|
}
|
|
62
59
|
export {
|
|
63
60
|
getContactMainModulePath,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { compact, find } from "lodash-es";
|
|
2
2
|
const getImporteds = (curModule, modules) => {
|
|
3
|
-
|
|
4
|
-
if ((_a = curModule == null ? void 0 : curModule.imported) == null ? void 0 : _a.length) {
|
|
3
|
+
if (curModule?.imported?.length) {
|
|
5
4
|
const _importeds = curModule.imported.map(
|
|
6
5
|
(_importedModule) => find(modules, (m) => m.id === Number(_importedModule))
|
|
7
6
|
);
|
|
@@ -21,8 +20,7 @@ const getModuleReasonsTree = (curModule, modules, reasonsTree, visited) => {
|
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
23
22
|
importeds.forEach((_curModule) => {
|
|
24
|
-
|
|
25
|
-
(_a = _curModule == null ? void 0 : _curModule.chunks) == null ? void 0 : _a.forEach((_chunk) => {
|
|
23
|
+
_curModule?.chunks?.forEach((_chunk) => {
|
|
26
24
|
if (reasonsTree.indexOf(_chunk) < 0) {
|
|
27
25
|
reasonsTree.push(_chunk);
|
|
28
26
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Rule } from "@rsdoctor/types";
|
|
4
|
+
import { Badge, Card, Space, Typography, Col, Row, Tag } from "antd";
|
|
5
|
+
import ReactMarkdown from "react-markdown";
|
|
6
|
+
import { values } from "lodash-es";
|
|
7
|
+
import { Title } from "../../../components/Title";
|
|
8
|
+
import { Size } from "../../../constants";
|
|
9
|
+
import { useUrlQuery } from "../../../utils";
|
|
10
|
+
const Page = () => {
|
|
11
|
+
const query = useUrlQuery();
|
|
12
|
+
const defaultErrorCode = query[Rule.RsdoctorRuleClientConstant.UrlQueryForErrorCode] || "";
|
|
13
|
+
const [ruleMessage, setRuleMessage] = useState(Rule.RuleErrorMap[defaultErrorCode]);
|
|
14
|
+
const dataSource = values(Rule.RuleErrorMap);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
window.scrollTo({ top: 0 });
|
|
17
|
+
}, []);
|
|
18
|
+
return /* @__PURE__ */ jsxs(Row, { gutter: Size.BasePadding / 2, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Col, { span: 8, children: /* @__PURE__ */ jsx(Card, { title: /* @__PURE__ */ jsx(Title, { text: "list of the error codes." }), bordered: true, children: /* @__PURE__ */ jsx(Space, { direction: "vertical", children: dataSource.map((e, i) => /* @__PURE__ */ jsxs(
|
|
20
|
+
Space,
|
|
21
|
+
{
|
|
22
|
+
style: { marginTop: i === 0 ? 0 : Size.BasePadding / 2, cursor: "pointer" },
|
|
23
|
+
onClick: () => setRuleMessage(e),
|
|
24
|
+
align: "center",
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Badge, { status: "default" }),
|
|
27
|
+
/* @__PURE__ */ jsx(Typography.Text, { code: true, children: /* @__PURE__ */ jsx("a", { children: e.code }) }),
|
|
28
|
+
/* @__PURE__ */ jsx(Typography.Text, { style: { color: ruleMessage && ruleMessage.code === e.code ? "#1890ff" : void 0 }, children: e.title })
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
e.code
|
|
32
|
+
)) }) }) }),
|
|
33
|
+
/* @__PURE__ */ jsx(Col, { span: 16, children: ruleMessage ? /* @__PURE__ */ jsx(
|
|
34
|
+
Card,
|
|
35
|
+
{
|
|
36
|
+
title: /* @__PURE__ */ jsxs(Row, { justify: "space-between", children: [
|
|
37
|
+
/* @__PURE__ */ jsxs(Space, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(Typography.Text, { code: true, children: ruleMessage.code }),
|
|
39
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: ruleMessage.title })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Tag, { children: ruleMessage.category }) })
|
|
42
|
+
] }),
|
|
43
|
+
bodyStyle: { paddingTop: 0 },
|
|
44
|
+
bordered: true,
|
|
45
|
+
children: /* @__PURE__ */ jsx(Typography.Paragraph, { children: ruleMessage.type === "markdown" ? /* @__PURE__ */ jsx(ReactMarkdown, { children: ruleMessage.description }) : /* @__PURE__ */ jsx(Typography.Text, { children: ruleMessage.description }) })
|
|
46
|
+
}
|
|
47
|
+
) : /* @__PURE__ */ jsx(Card, { title: "This page lists all the error codes emitted by the Rsdoctor.", bordered: true, children: /* @__PURE__ */ jsx(Typography.Text, { children: "click the error code in left bar to show more details." }) }) })
|
|
48
|
+
] });
|
|
49
|
+
};
|
|
50
|
+
export * from "./constants";
|
|
51
|
+
export {
|
|
52
|
+
Page
|
|
53
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Client } from '@rsdoctor/types';
|
|
2
|
-
export declare const name = "Loaders
|
|
3
|
-
export declare const route = Client.
|
|
2
|
+
export declare const name = "Loaders Timeline";
|
|
3
|
+
export declare const route = Client.RsdoctorClientRoutes.WebpackLoaderOverall;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from "@rsdoctor/types";
|
|
2
|
-
const name = "Loaders
|
|
3
|
-
const route = Client.
|
|
2
|
+
const name = "Loaders Timeline";
|
|
3
|
+
const route = Client.RsdoctorClientRoutes.WebpackLoaderOverall;
|
|
4
4
|
export {
|
|
5
5
|
name,
|
|
6
6
|
route
|
|
@@ -3,7 +3,7 @@ import { WebpackConfigurationViewer } from "../../../components/Configuration";
|
|
|
3
3
|
import { Card } from "../../../components/Card";
|
|
4
4
|
import { LoaderChart } from "../../../components/Charts";
|
|
5
5
|
const Page = () => {
|
|
6
|
-
return /* @__PURE__ */ jsx(Card, { title: "Loader
|
|
6
|
+
return /* @__PURE__ */ jsx(Card, { title: "Loader Timeline", extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["module"] }), collapsable: true, children: /* @__PURE__ */ jsx(LoaderChart, {}) });
|
|
7
7
|
};
|
|
8
8
|
export * from "./constants";
|
|
9
9
|
export {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Client } from '@rsdoctor/types';
|
|
2
|
-
export declare const name = "
|
|
3
|
-
export declare const route = Client.
|
|
2
|
+
export declare const name = "Plugins Analysis";
|
|
3
|
+
export declare const route = Client.RsdoctorClientRoutes.WebpackPlugins;
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export * as ModuleAnalyze from './ModuleAnalyze';
|
|
|
4
4
|
export * as LoaderTimeline from './WebpackLoaders/Overall';
|
|
5
5
|
export * as LoaderFiles from './WebpackLoaders/Analysis';
|
|
6
6
|
export * as PluginsAnalyze from './WebpackPlugins';
|
|
7
|
-
export * as ModuleResolve from './ModuleResolve';
|
|
7
|
+
export * as ModuleResolve from './ModuleResolve';
|
|
8
|
+
export * as RuleIndex from './Resources/RuleIndex';
|
package/dist/pages/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as LoaderTimeline from "./WebpackLoaders/Overall";
|
|
|
5
5
|
import * as LoaderFiles from "./WebpackLoaders/Analysis";
|
|
6
6
|
import * as PluginsAnalyze from "./WebpackPlugins";
|
|
7
7
|
import * as ModuleResolve from "./ModuleResolve";
|
|
8
|
+
import * as RuleIndex from "./Resources/RuleIndex";
|
|
8
9
|
export {
|
|
9
10
|
BundleSize,
|
|
10
11
|
LoaderFiles,
|
|
@@ -12,5 +13,6 @@ export {
|
|
|
12
13
|
ModuleAnalyze,
|
|
13
14
|
ModuleResolve,
|
|
14
15
|
Overall,
|
|
15
|
-
PluginsAnalyze
|
|
16
|
+
PluginsAnalyze,
|
|
17
|
+
RuleIndex
|
|
16
18
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Common, Manifest, SDK } from '@rsdoctor/types';
|
|
2
2
|
import { Data } from '@rsdoctor/utils/common';
|
|
3
3
|
export declare abstract class BaseDataLoader implements Manifest.ManifestDataLoader {
|
|
4
|
-
protected manifest: Manifest.
|
|
4
|
+
protected manifest: Manifest.RsdoctorManifestWithShardingFiles;
|
|
5
5
|
protected pool: Map<string, Promise<unknown>>;
|
|
6
6
|
protected loader: Data.APIDataLoader;
|
|
7
7
|
protected disposed: boolean;
|
|
8
|
-
protected shardingDataMap: Map<keyof Manifest.
|
|
9
|
-
constructor(manifest: Manifest.
|
|
10
|
-
protected get<T extends keyof Manifest.
|
|
11
|
-
protected getData<T extends keyof Manifest.
|
|
8
|
+
protected shardingDataMap: Map<keyof Manifest.RsdoctorManifestData, Promise<any>>;
|
|
9
|
+
constructor(manifest: Manifest.RsdoctorManifestWithShardingFiles);
|
|
10
|
+
protected get<T extends keyof Manifest.RsdoctorManifestWithShardingFiles>(key: T): void | Manifest.RsdoctorManifestWithShardingFiles[T];
|
|
11
|
+
protected getData<T extends keyof Manifest.RsdoctorManifestData>(key: T, scope?: 'data'): void | Manifest.RsdoctorManifestWithShardingFiles['data'][T];
|
|
12
12
|
protected getKeys(key: string): string[];
|
|
13
13
|
protected joinKeys(keys: string[]): string;
|
|
14
14
|
dispose(): void;
|
|
15
15
|
limit<T>(key: string, fn: Common.Function<unknown[], Promise<T>>): Promise<T>;
|
|
16
16
|
log(...args: unknown[]): void;
|
|
17
|
-
loadManifest(): Promise<Manifest.
|
|
17
|
+
loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
|
|
18
18
|
abstract loadData<T extends string, P>(key: T): Promise<void | P>;
|
|
19
|
-
abstract loadData<T extends Manifest.
|
|
19
|
+
abstract loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<void | Manifest.InferManifestDataValue<T>>;
|
|
20
20
|
abstract isLocal(): boolean;
|
|
21
21
|
abstract loadAPI<T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = SDK.ServerAPI.InferRequestBodyType<T>, R extends SDK.ServerAPI.InferResponseType<T> = SDK.ServerAPI.InferResponseType<T>>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R>;
|
|
22
22
|
abstract onDataUpdate<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, fn: (response: SDK.ServerAPI.SocketResponseType<T>) => void): void;
|
package/dist/utils/data/base.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import { Data } from "@rsdoctor/utils/common";
|
|
22
2
|
class BaseDataLoader {
|
|
23
3
|
constructor(manifest) {
|
|
@@ -59,10 +39,8 @@ class BaseDataLoader {
|
|
|
59
39
|
log(...args) {
|
|
60
40
|
console.log(`[${this.constructor.name}]`, ...args);
|
|
61
41
|
}
|
|
62
|
-
loadManifest() {
|
|
63
|
-
return
|
|
64
|
-
return this.manifest;
|
|
65
|
-
});
|
|
42
|
+
async loadManifest() {
|
|
43
|
+
return this.manifest;
|
|
66
44
|
}
|
|
67
45
|
}
|
|
68
46
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Manifest } from '@rsdoctor/types';
|
|
2
2
|
import { BaseDataLoader } from './base';
|
|
3
|
-
export declare function useDataLoader(manifest: Manifest.
|
|
3
|
+
export declare function useDataLoader(manifest: Manifest.RsdoctorManifestWithShardingFiles | void): {
|
|
4
4
|
loader: void | BaseDataLoader;
|
|
5
5
|
};
|
package/dist/utils/data/index.js
CHANGED
|
@@ -1,47 +1,25 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import { useEffect, useState } from "react";
|
|
22
2
|
import { LocalServerDataLoader } from "./local";
|
|
23
3
|
import { RemoteDataLoader } from "./remote";
|
|
24
4
|
import { getAPILoaderModeFromStorage } from "../storage";
|
|
25
5
|
import { APILoaderMode4Dev } from "../../constants";
|
|
26
6
|
const loaderTask = /* @__PURE__ */ new WeakMap();
|
|
27
|
-
function createDataLoader(manifest) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (mode === APILoaderMode4Dev.Local)
|
|
33
|
-
return new LocalServerDataLoader(manifest);
|
|
34
|
-
if (mode === APILoaderMode4Dev.Remote)
|
|
35
|
-
return new RemoteDataLoader(manifest);
|
|
36
|
-
}
|
|
37
|
-
if (manifest.__LOCAL__SERVER__) {
|
|
7
|
+
async function createDataLoader(manifest) {
|
|
8
|
+
try {
|
|
9
|
+
if (process.env.NODE_ENV === "development") {
|
|
10
|
+
const mode = getAPILoaderModeFromStorage();
|
|
11
|
+
if (mode === APILoaderMode4Dev.Local)
|
|
38
12
|
return new LocalServerDataLoader(manifest);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
if (mode === APILoaderMode4Dev.Remote)
|
|
14
|
+
return new RemoteDataLoader(manifest);
|
|
15
|
+
}
|
|
16
|
+
if (manifest.__LOCAL__SERVER__) {
|
|
17
|
+
return new LocalServerDataLoader(manifest);
|
|
42
18
|
}
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.log("[DataLoader] fallback to RemoteDataLoader");
|
|
21
|
+
}
|
|
22
|
+
return new RemoteDataLoader(manifest);
|
|
45
23
|
}
|
|
46
24
|
function useDataLoader(manifest) {
|
|
47
25
|
const [loader, setLoader] = useState(void 0);
|