@rsdoctor/components 0.0.2-beta.0
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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/assets/connection-point.3b3c78ca.svg +1 -0
- package/dist/assets/icon.7509d763.svg +21 -0
- package/dist/assets/webpack.98604d64.svg +1 -0
- package/dist/components/Alert/change.d.ts +8 -0
- package/dist/components/Alert/change.js +94 -0
- package/dist/components/Alert/file-relation.d.ts +3 -0
- package/dist/components/Alert/file-relation.js +9 -0
- package/dist/components/Alert/index.css +29 -0
- package/dist/components/Alert/index.d.ts +4 -0
- package/dist/components/Alert/index.js +37 -0
- package/dist/components/Alert/link.d.ts +3 -0
- package/dist/components/Alert/link.js +27 -0
- package/dist/components/Alert/package-relation.d.ts +17 -0
- package/dist/components/Alert/package-relation.js +206 -0
- package/dist/components/Alert/types.d.ts +31 -0
- package/dist/components/Alert/types.js +0 -0
- package/dist/components/Alert/view.d.ts +4 -0
- package/dist/components/Alert/view.js +59 -0
- package/dist/components/Alerts/bundle.d.ts +11 -0
- package/dist/components/Alerts/bundle.js +47 -0
- package/dist/components/Alerts/common.d.ts +15 -0
- package/dist/components/Alerts/common.js +106 -0
- package/dist/components/Alerts/compile.d.ts +10 -0
- package/dist/components/Alerts/compile.js +46 -0
- package/dist/components/Alerts/index.d.ts +3 -0
- package/dist/components/Alerts/index.js +3 -0
- package/dist/components/Alerts/overlay.d.ts +26 -0
- package/dist/components/Alerts/overlay.js +154 -0
- package/dist/components/Badge/index.d.ts +21 -0
- package/dist/components/Badge/index.js +105 -0
- package/dist/components/Card/diff.d.ts +23 -0
- package/dist/components/Card/diff.js +131 -0
- package/dist/components/Card/index.d.ts +7 -0
- package/dist/components/Card/index.js +62 -0
- package/dist/components/Card/size.d.ts +16 -0
- package/dist/components/Card/size.js +71 -0
- package/dist/components/Card/statistic.css +16 -0
- package/dist/components/Card/statistic.d.ts +9 -0
- package/dist/components/Card/statistic.js +34 -0
- package/dist/components/Charts/TimelineCharts/index.d.ts +8 -0
- package/dist/components/Charts/TimelineCharts/index.js +197 -0
- package/dist/components/Charts/bootstrap.d.ts +5 -0
- package/dist/components/Charts/bootstrap.js +44 -0
- package/dist/components/Charts/common.d.ts +13 -0
- package/dist/components/Charts/common.js +56 -0
- package/dist/components/Charts/done.d.ts +5 -0
- package/dist/components/Charts/done.js +45 -0
- package/dist/components/Charts/index.d.ts +10 -0
- package/dist/components/Charts/index.js +37 -0
- package/dist/components/Charts/loader.css +31 -0
- package/dist/components/Charts/loader.d.ts +4 -0
- package/dist/components/Charts/loader.js +68 -0
- package/dist/components/Charts/minify.d.ts +5 -0
- package/dist/components/Charts/minify.js +37 -0
- package/dist/components/Charts/tooltips.css +62 -0
- package/dist/components/Charts/types.d.ts +61 -0
- package/dist/components/Charts/types.js +11 -0
- package/dist/components/Charts/utils.d.ts +13 -0
- package/dist/components/Charts/utils.js +203 -0
- package/dist/components/CodeViewer/config.d.ts +2 -0
- package/dist/components/CodeViewer/config.js +18 -0
- package/dist/components/CodeViewer/diff.d.ts +11 -0
- package/dist/components/CodeViewer/diff.js +53 -0
- package/dist/components/CodeViewer/hightlight.d.ts +10 -0
- package/dist/components/CodeViewer/hightlight.js +76 -0
- package/dist/components/CodeViewer/index.d.ts +4 -0
- package/dist/components/CodeViewer/index.js +4 -0
- package/dist/components/CodeViewer/viewer.d.ts +13 -0
- package/dist/components/CodeViewer/viewer.js +76 -0
- package/dist/components/Configuration/index.d.ts +1 -0
- package/dist/components/Configuration/index.js +1 -0
- package/dist/components/Configuration/webpack.d.ts +13 -0
- package/dist/components/Configuration/webpack.js +70 -0
- package/dist/components/FileTree/index.css +58 -0
- package/dist/components/FileTree/index.d.ts +4 -0
- package/dist/components/FileTree/index.js +53 -0
- package/dist/components/Form/keyword.d.ts +14 -0
- package/dist/components/Form/keyword.js +76 -0
- package/dist/components/Keyword/index.d.ts +6 -0
- package/dist/components/Keyword/index.js +68 -0
- package/dist/components/Layout/builder-select.d.ts +2 -0
- package/dist/components/Layout/builder-select.js +50 -0
- package/dist/components/Layout/constants.d.ts +1 -0
- package/dist/components/Layout/constants.js +4 -0
- package/dist/components/Layout/header.css +12 -0
- package/dist/components/Layout/header.d.ts +3 -0
- package/dist/components/Layout/header.js +87 -0
- package/dist/components/Layout/index.d.ts +5 -0
- package/dist/components/Layout/index.js +34 -0
- package/dist/components/Layout/menus.d.ts +8 -0
- package/dist/components/Layout/menus.js +155 -0
- package/dist/components/Layout/progress.d.ts +8 -0
- package/dist/components/Layout/progress.js +44 -0
- package/dist/components/Loader/Analysis/files.d.ts +8 -0
- package/dist/components/Loader/Analysis/files.js +187 -0
- package/dist/components/Loader/Analysis/index.d.ts +11 -0
- package/dist/components/Loader/Analysis/index.js +23 -0
- package/dist/components/Loader/executions.d.ts +13 -0
- package/dist/components/Loader/executions.js +221 -0
- package/dist/components/Manifest/api.d.ts +41 -0
- package/dist/components/Manifest/api.js +157 -0
- package/dist/components/Manifest/data.d.ts +8 -0
- package/dist/components/Manifest/data.js +81 -0
- package/dist/components/Manifest/index.d.ts +2 -0
- package/dist/components/Manifest/index.js +2 -0
- package/dist/components/Opener/code.d.ts +28 -0
- package/dist/components/Opener/code.js +69 -0
- package/dist/components/Opener/index.d.ts +2 -0
- package/dist/components/Opener/index.js +2 -0
- package/dist/components/Opener/vscode.d.ts +16 -0
- package/dist/components/Opener/vscode.js +57 -0
- package/dist/components/Overall/NumberButton.d.ts +14 -0
- package/dist/components/Overall/NumberButton.js +29 -0
- package/dist/components/Overall/NumberButton.module.js +5 -0
- package/dist/components/Overall/NumberButton_module.css +70 -0
- package/dist/components/Overall/bundle.d.ts +6 -0
- package/dist/components/Overall/bundle.js +167 -0
- package/dist/components/Overall/bundle.module.css +0 -0
- package/dist/components/Overall/card.module.js +5 -0
- package/dist/components/Overall/card_module.css +6 -0
- package/dist/components/Overall/compile.d.ts +5 -0
- package/dist/components/Overall/compile.js +68 -0
- package/dist/components/Overall/compile.module.js +5 -0
- package/dist/components/Overall/compile_module.css +4 -0
- package/dist/components/Overall/index.d.ts +3 -0
- package/dist/components/Overall/index.js +3 -0
- package/dist/components/Overall/list.module.js +5 -0
- package/dist/components/Overall/list_module.css +7 -0
- package/dist/components/Overall/project.d.ts +8 -0
- package/dist/components/Overall/project.js +73 -0
- package/dist/components/Plugins/webpack.d.ts +18 -0
- package/dist/components/Plugins/webpack.js +76 -0
- package/dist/components/Resolver/analysis.d.ts +15 -0
- package/dist/components/Resolver/analysis.js +160 -0
- package/dist/components/Select/index.d.ts +15 -0
- package/dist/components/Select/index.js +68 -0
- package/dist/components/Status/failed.d.ts +9 -0
- package/dist/components/Status/failed.js +33 -0
- package/dist/components/Status/index.d.ts +1 -0
- package/dist/components/Status/index.js +1 -0
- package/dist/components/TextDrawer/duplicate.d.ts +17 -0
- package/dist/components/TextDrawer/duplicate.js +107 -0
- package/dist/components/TextDrawer/index.d.ts +11 -0
- package/dist/components/TextDrawer/index.js +55 -0
- package/dist/components/Title/index.d.ts +15 -0
- package/dist/components/Title/index.js +10 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +11 -0
- package/dist/components/worker/ecmaversion/client.d.ts +10 -0
- package/dist/components/worker/ecmaversion/client.js +61 -0
- package/dist/components/worker/ecmaversion/worker.d.ts +1 -0
- package/dist/components/worker/ecmaversion/worker.js +13 -0
- package/dist/components/worker/jsequal/client.d.ts +11 -0
- package/dist/components/worker/jsequal/client.js +39 -0
- package/dist/components/worker/jsequal/worker.d.ts +1 -0
- package/dist/components/worker/jsequal/worker.js +52 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +39 -0
- package/dist/constants.d.ts +48 -0
- package/dist/constants.js +71 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/pages/BundleSize/components/asset.d.ts +26 -0
- package/dist/pages/BundleSize/components/asset.js +405 -0
- package/dist/pages/BundleSize/components/cards.d.ts +7 -0
- package/dist/pages/BundleSize/components/cards.js +154 -0
- package/dist/pages/BundleSize/components/editor.d.ts +5 -0
- package/dist/pages/BundleSize/components/editor.js +38 -0
- package/dist/pages/BundleSize/components/index.css +20 -0
- package/dist/pages/BundleSize/components/index.d.ts +16 -0
- package/dist/pages/BundleSize/components/index.js +314 -0
- package/dist/pages/BundleSize/config.d.ts +7 -0
- package/dist/pages/BundleSize/config.js +9 -0
- package/dist/pages/BundleSize/constants.d.ts +5 -0
- package/dist/pages/BundleSize/constants.js +9 -0
- package/dist/pages/BundleSize/index.d.ts +3 -0
- package/dist/pages/BundleSize/index.js +11 -0
- package/dist/pages/ModuleAnalyze/chunks.d.ts +6 -0
- package/dist/pages/ModuleAnalyze/chunks.js +48 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +88 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +15 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +138 -0
- package/dist/pages/ModuleAnalyze/constants.d.ts +7 -0
- package/dist/pages/ModuleAnalyze/constants.js +14 -0
- package/dist/pages/ModuleAnalyze/dependncy.d.ts +9 -0
- package/dist/pages/ModuleAnalyze/dependncy.js +31 -0
- package/dist/pages/ModuleAnalyze/fileTree.d.ts +9 -0
- package/dist/pages/ModuleAnalyze/fileTree.js +125 -0
- package/dist/pages/ModuleAnalyze/index.css +10 -0
- package/dist/pages/ModuleAnalyze/index.d.ts +8 -0
- package/dist/pages/ModuleAnalyze/index.js +64 -0
- package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +21 -0
- package/dist/pages/ModuleAnalyze/utils/hooks.js +65 -0
- package/dist/pages/ModuleAnalyze/utils/index.d.ts +3 -0
- package/dist/pages/ModuleAnalyze/utils/index.js +36 -0
- package/dist/pages/ModuleResolve/constants.d.ts +3 -0
- package/dist/pages/ModuleResolve/constants.js +7 -0
- package/dist/pages/ModuleResolve/index.d.ts +3 -0
- package/dist/pages/ModuleResolve/index.js +19 -0
- package/dist/pages/Overall/constants.d.ts +3 -0
- package/dist/pages/Overall/constants.js +7 -0
- package/dist/pages/Overall/index.d.ts +9 -0
- package/dist/pages/Overall/index.js +28 -0
- package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Analysis/constants.js +7 -0
- package/dist/pages/WebpackLoaders/Analysis/index.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Analysis/index.js +19 -0
- package/dist/pages/WebpackLoaders/Overall/constants.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Overall/constants.js +7 -0
- package/dist/pages/WebpackLoaders/Overall/index.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Overall/index.js +11 -0
- package/dist/pages/WebpackLoaders/constants.d.ts +2 -0
- package/dist/pages/WebpackLoaders/constants.js +6 -0
- package/dist/pages/WebpackPlugins/constants.d.ts +3 -0
- package/dist/pages/WebpackPlugins/constants.js +7 -0
- package/dist/pages/WebpackPlugins/index.d.ts +3 -0
- package/dist/pages/WebpackPlugins/index.js +79 -0
- package/dist/pages/index.d.ts +7 -0
- package/dist/pages/index.js +16 -0
- package/dist/utils/data/base.d.ts +24 -0
- package/dist/utils/data/base.js +70 -0
- package/dist/utils/data/index.d.ts +5 -0
- package/dist/utils/data/index.js +66 -0
- package/dist/utils/data/local.d.ts +14 -0
- package/dist/utils/data/local.js +106 -0
- package/dist/utils/data/remote.d.ts +10 -0
- package/dist/utils/data/remote.js +70 -0
- package/dist/utils/file.d.ts +39 -0
- package/dist/utils/file.js +154 -0
- package/dist/utils/hooks.d.ts +30 -0
- package/dist/utils/hooks.js +256 -0
- package/dist/utils/i18n/cn.d.ts +3 -0
- package/dist/utils/i18n/cn.js +33 -0
- package/dist/utils/i18n/en.d.ts +30 -0
- package/dist/utils/i18n/en.js +33 -0
- package/dist/utils/i18n/index.d.ts +2 -0
- package/dist/utils/i18n/index.js +34 -0
- package/dist/utils/index.d.ts +16 -0
- package/dist/utils/index.js +16 -0
- package/dist/utils/loader.d.ts +7 -0
- package/dist/utils/loader.js +29 -0
- package/dist/utils/locale.d.ts +2 -0
- package/dist/utils/locale.js +9 -0
- package/dist/utils/manifest.d.ts +27 -0
- package/dist/utils/manifest.js +54 -0
- package/dist/utils/monaco.d.ts +9 -0
- package/dist/utils/monaco.js +48 -0
- package/dist/utils/request.d.ts +23 -0
- package/dist/utils/request.js +162 -0
- package/dist/utils/routes.d.ts +3 -0
- package/dist/utils/routes.js +14 -0
- package/dist/utils/size.d.ts +2 -0
- package/dist/utils/size.js +24 -0
- package/dist/utils/socket.d.ts +2 -0
- package/dist/utils/socket.js +20 -0
- package/dist/utils/storage.d.ts +13 -0
- package/dist/utils/storage.js +70 -0
- package/dist/utils/string.d.ts +2 -0
- package/dist/utils/string.js +14 -0
- package/dist/utils/time.d.ts +3 -0
- package/dist/utils/time.js +7 -0
- package/dist/utils/url.d.ts +6 -0
- package/dist/utils/url.js +89 -0
- package/dist/utils/worker/index.d.ts +4 -0
- package/dist/utils/worker/index.js +4 -0
- package/dist/utils/worker/master.d.ts +8 -0
- package/dist/utils/worker/master.js +18 -0
- package/dist/utils/worker/types.d.ts +9 -0
- package/dist/utils/worker/types.js +0 -0
- package/dist/utils/worker/utils.d.ts +9 -0
- package/dist/utils/worker/utils.js +29 -0
- package/dist/utils/worker/worker.d.ts +13 -0
- package/dist/utils/worker/worker.js +38 -0
- package/package.json +87 -0
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { InfoCircleOutlined, MinusCircleOutlined, PlusCircleOutlined, RightSquareTwoTone } from "@ant-design/icons";
|
|
22
|
+
import { SDK } from "@rsdoctor/types";
|
|
23
|
+
import { Popover, Space, Tag, Typography } from "antd";
|
|
24
|
+
import { useCallback } from "react";
|
|
25
|
+
import Tree, { useTreeState } from "react-hyper-tree";
|
|
26
|
+
import { ServerAPIProvider } from "../../../components/Manifest";
|
|
27
|
+
import { TAG_PALLETE } from "../../../constants";
|
|
28
|
+
import { ModuleGraphListContext } from "../../BundleSize/config";
|
|
29
|
+
import "./fileTreeCom.css";
|
|
30
|
+
const prefix = "file-tree-com";
|
|
31
|
+
const FileTree = (props) => {
|
|
32
|
+
const { treeData, needJumpto = false, defaultOpened = false, defaultOpenFather = 0 } = props;
|
|
33
|
+
const { required, handlers } = useTreeState({
|
|
34
|
+
id: `${prefix}-tree`,
|
|
35
|
+
data: treeData || [],
|
|
36
|
+
defaultOpened,
|
|
37
|
+
multipleSelect: false,
|
|
38
|
+
refreshAsyncNodes: true
|
|
39
|
+
});
|
|
40
|
+
const renderNode = useCallback(({ node, onToggle }) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
defaultOpenFather && node.data.level < defaultOpenFather && node.setOpened(true);
|
|
43
|
+
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
|
+
/* @__PURE__ */ jsxs("div", { onClick: onToggle, children: [
|
|
45
|
+
!node.options.opened && ((_a = node.data.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(PlusCircleOutlined, { style: { color: "lightblue" } }) : /* @__PURE__ */ jsx(MinusCircleOutlined, { style: { color: "lightblue" } }),
|
|
46
|
+
/* @__PURE__ */ jsxs(Typography.Text, { code: true, children: [
|
|
47
|
+
node.data.name,
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Popover,
|
|
50
|
+
{
|
|
51
|
+
content: /* @__PURE__ */ jsx(Fragment, { children: node.data.__RESOURCEPATH__ ? /* @__PURE__ */ jsx(Typography.Text, { code: true, children: node.data.__RESOURCEPATH__ }, `${node.data.name}-popover-path`) : /* @__PURE__ */ jsx(Fragment, {}) }),
|
|
52
|
+
title: "INFO",
|
|
53
|
+
trigger: "hover",
|
|
54
|
+
children: /* @__PURE__ */ jsx(InfoCircleOutlined, { style: { marginLeft: 4 } })
|
|
55
|
+
},
|
|
56
|
+
`${node.data.name}popover`
|
|
57
|
+
)
|
|
58
|
+
] })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ jsxs(Space, { children: [
|
|
61
|
+
((_b = node.data.concatModules) == null ? void 0 : _b.length) ? /* @__PURE__ */ jsx(
|
|
62
|
+
Popover,
|
|
63
|
+
{
|
|
64
|
+
content: /* @__PURE__ */ jsx(
|
|
65
|
+
ServerAPIProvider,
|
|
66
|
+
{
|
|
67
|
+
api: SDK.ServerAPI.API.GetModulesByModuleIds,
|
|
68
|
+
body: { moduleIds: node.data.concatModules || [] },
|
|
69
|
+
children: (res) => {
|
|
70
|
+
return /* @__PURE__ */ jsx("div", { children: res.map(({ path }, index) => /* @__PURE__ */ jsx("p", { children: path }, `${path}-${index}`)) });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
title: "Concatenated Module Name",
|
|
75
|
+
trigger: "hover",
|
|
76
|
+
children: /* @__PURE__ */ jsx(
|
|
77
|
+
Tag,
|
|
78
|
+
{
|
|
79
|
+
className: `${prefix}-node-title-tag`,
|
|
80
|
+
color: TAG_PALLETE.DARK_BLUE,
|
|
81
|
+
children: "Concatenated"
|
|
82
|
+
},
|
|
83
|
+
`${node.data.name}-size-tag`
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
) : node.data.size && node.data.size !== "0 bytes" ? /* @__PURE__ */ jsx(
|
|
87
|
+
Tag,
|
|
88
|
+
{
|
|
89
|
+
className: `${prefix}-node-title-tag`,
|
|
90
|
+
color: TAG_PALLETE.COLOR_B,
|
|
91
|
+
children: `Parsed: ${node.data.size}`
|
|
92
|
+
},
|
|
93
|
+
`${node.data.name}-size-tag`
|
|
94
|
+
) : /* @__PURE__ */ jsx(Fragment, {}),
|
|
95
|
+
needJumpto && /* @__PURE__ */ jsx(ModuleGraphListContext.Consumer, { children: ({ moduleJumpList, setModuleJumpList }) => {
|
|
96
|
+
return /* @__PURE__ */ jsx(
|
|
97
|
+
RightSquareTwoTone,
|
|
98
|
+
{
|
|
99
|
+
onClick: () => {
|
|
100
|
+
const _list = [...moduleJumpList];
|
|
101
|
+
_list.push(+node.id);
|
|
102
|
+
setModuleJumpList(_list);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
} })
|
|
107
|
+
] })
|
|
108
|
+
] }) }) }) }) }, node.data.name);
|
|
109
|
+
}, []);
|
|
110
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
111
|
+
Tree,
|
|
112
|
+
__spreadProps(__spreadValues(__spreadValues({}, required), handlers), {
|
|
113
|
+
horizontalLineStyles: {
|
|
114
|
+
stroke: "#c4c4c4",
|
|
115
|
+
strokeWidth: 2,
|
|
116
|
+
strokeDasharray: "1 1"
|
|
117
|
+
},
|
|
118
|
+
verticalLineStyles: {
|
|
119
|
+
stroke: "#c4c4c4",
|
|
120
|
+
strokeWidth: 2,
|
|
121
|
+
strokeDasharray: "1 1"
|
|
122
|
+
},
|
|
123
|
+
draggable: false,
|
|
124
|
+
depthGap: 14,
|
|
125
|
+
gapMode: "padding",
|
|
126
|
+
disableLines: false,
|
|
127
|
+
disableTransitions: true,
|
|
128
|
+
disableHorizontalLines: false,
|
|
129
|
+
disableVerticalLines: false,
|
|
130
|
+
verticalLineTopOffset: 0,
|
|
131
|
+
verticalLineOffset: 5,
|
|
132
|
+
renderNode
|
|
133
|
+
})
|
|
134
|
+
) });
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
FileTree
|
|
138
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Client } from '@rsdoctor/types';
|
|
2
|
+
export declare const name = "Module Analyze";
|
|
3
|
+
export declare const route = Client.DoctorClientRoutes.ModuleAnalyze;
|
|
4
|
+
export declare enum DevtoolsRuleClientConstant {
|
|
5
|
+
UrlQueryForModuleAnalyze = "curModuleId",
|
|
6
|
+
}
|
|
7
|
+
export declare const clsNamePrefix = "module-analyze";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client } from "@rsdoctor/types";
|
|
2
|
+
const name = "Module Analyze";
|
|
3
|
+
const route = Client.DoctorClientRoutes.ModuleAnalyze;
|
|
4
|
+
var DevtoolsRuleClientConstant = /* @__PURE__ */ ((DevtoolsRuleClientConstant2) => {
|
|
5
|
+
DevtoolsRuleClientConstant2["UrlQueryForModuleAnalyze"] = "curModuleId";
|
|
6
|
+
return DevtoolsRuleClientConstant2;
|
|
7
|
+
})(DevtoolsRuleClientConstant || {});
|
|
8
|
+
const clsNamePrefix = "module-analyze";
|
|
9
|
+
export {
|
|
10
|
+
DevtoolsRuleClientConstant,
|
|
11
|
+
clsNamePrefix,
|
|
12
|
+
name,
|
|
13
|
+
route
|
|
14
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Col, Empty, Row } from "antd";
|
|
3
|
+
import { compact, find } from "lodash-es";
|
|
4
|
+
import { memo, useMemo } from "react";
|
|
5
|
+
import { getShortPath } from "../../utils";
|
|
6
|
+
import { FileTree } from "./components/fileTreeCom";
|
|
7
|
+
import "./index.css";
|
|
8
|
+
const DependencyTree = ({ dependencies, cwd, module }) => {
|
|
9
|
+
const treedata = useMemo(() => {
|
|
10
|
+
const dpTreeData = module.dependencies.map((dpId) => {
|
|
11
|
+
const dp = find(dependencies, (_dp) => _dp.id === dpId);
|
|
12
|
+
if (!dp)
|
|
13
|
+
return;
|
|
14
|
+
return {
|
|
15
|
+
__RESOURCEPATH__: dp.resolvedRequest || "",
|
|
16
|
+
id: dp.dependency,
|
|
17
|
+
key: dp.resolvedRequest,
|
|
18
|
+
name: getShortPath(dp.resolvedRequest) || "",
|
|
19
|
+
level: 1,
|
|
20
|
+
kind: dp.kind,
|
|
21
|
+
concatModules: void 0
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
return compact(dpTreeData);
|
|
25
|
+
}, [module]);
|
|
26
|
+
return /* @__PURE__ */ jsx(Row, { justify: "start", align: "middle", children: /* @__PURE__ */ jsx(Col, { span: 24, children: treedata.length ? /* @__PURE__ */ jsx(FileTree, { treeData: treedata, needJumpto: true, cwd }) : /* @__PURE__ */ jsx(Empty, {}) }) });
|
|
27
|
+
};
|
|
28
|
+
var dependncy_default = memo(DependencyTree);
|
|
29
|
+
export {
|
|
30
|
+
dependncy_default as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
ExpandOutlined,
|
|
4
|
+
InfoCircleOutlined,
|
|
5
|
+
MenuFoldOutlined,
|
|
6
|
+
MenuUnfoldOutlined,
|
|
7
|
+
RightSquareTwoTone
|
|
8
|
+
} from "@ant-design/icons";
|
|
9
|
+
import { SDK } from "@rsdoctor/types";
|
|
10
|
+
import { Badge, Button, Col, Empty, Popover, Radio, Row, Tag, Typography } from "antd";
|
|
11
|
+
import { useEffect, useState } from "react";
|
|
12
|
+
import { ServerAPIProvider } from "../../components/Manifest";
|
|
13
|
+
import { Title } from "../../components/Title";
|
|
14
|
+
import { Size, TAG_PALLETE } from "../../constants";
|
|
15
|
+
import { useI18n } from "../../utils/hooks";
|
|
16
|
+
import { ChunksTable } from "./chunks";
|
|
17
|
+
import { FileTree } from "./components/fileTreeCom";
|
|
18
|
+
import { clsNamePrefix } from "./constants";
|
|
19
|
+
import DependencyTree from "./dependncy";
|
|
20
|
+
import { getImporteds, getModuleReasonsTree } from "./utils";
|
|
21
|
+
import { useCreatFileTreeData } from "./utils/hooks";
|
|
22
|
+
var ChartDimension = /* @__PURE__ */ ((ChartDimension2) => {
|
|
23
|
+
ChartDimension2[ChartDimension2["Dependencies"] = 0] = "Dependencies";
|
|
24
|
+
ChartDimension2[ChartDimension2["Chunks"] = 1] = "Chunks";
|
|
25
|
+
return ChartDimension2;
|
|
26
|
+
})(ChartDimension || {});
|
|
27
|
+
const ModuleFilesTree = (props) => {
|
|
28
|
+
const { curModule, modules, dependencies, cwd, selectedChunk = "" } = props;
|
|
29
|
+
const { t } = useI18n();
|
|
30
|
+
const [importedModules, setImportedModules] = useState([]);
|
|
31
|
+
const [dimension, setDimension] = useState(0 /* Dependencies */);
|
|
32
|
+
const [fold, setFold] = useState(true);
|
|
33
|
+
const { data: fileStructures } = useCreatFileTreeData(modules, importedModules, curModule);
|
|
34
|
+
const [reasonsTree, setReasonsTree] = useState({});
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const importeds = getImporteds(curModule, modules);
|
|
37
|
+
setImportedModules(importeds);
|
|
38
|
+
}, [curModule, modules]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const _reasonsTree = {};
|
|
41
|
+
importedModules.forEach((_curModule) => {
|
|
42
|
+
const treeList = [];
|
|
43
|
+
const visited = /* @__PURE__ */ new Map();
|
|
44
|
+
getModuleReasonsTree(_curModule, modules, treeList, visited);
|
|
45
|
+
_reasonsTree[_curModule.id] = treeList;
|
|
46
|
+
});
|
|
47
|
+
setReasonsTree(_reasonsTree);
|
|
48
|
+
}, [importedModules]);
|
|
49
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(
|
|
51
|
+
Popover,
|
|
52
|
+
{
|
|
53
|
+
content: /* @__PURE__ */ jsxs("div", { children: [
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Badge, { status: "success", text: " " }),
|
|
56
|
+
/* @__PURE__ */ jsxs(Typography.Text, { code: true, children: [
|
|
57
|
+
/* @__PURE__ */ jsx(ExpandOutlined, {}),
|
|
58
|
+
" Expand the node_modules's modules that was omitted... "
|
|
59
|
+
] }),
|
|
60
|
+
" ",
|
|
61
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: `: ${t("Expand Omitted")}` })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Badge, { status: "success", text: " " }),
|
|
65
|
+
/* @__PURE__ */ jsx(Popover, { content: "xxxx", title: "Concatenated Module Name", trigger: "hover", children: /* @__PURE__ */ jsx(Tag, { color: TAG_PALLETE.DARK_BLUE, children: "Concatenated" }) }),
|
|
66
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: `: ${t("Concatenated Tag")}` })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Badge, { status: "success", text: " " }),
|
|
70
|
+
/* @__PURE__ */ jsx(RightSquareTwoTone, {}),
|
|
71
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: ": Jump button, click to jump to the Module dependency analysis page of this module." })
|
|
72
|
+
] })
|
|
73
|
+
] }),
|
|
74
|
+
title: "Usage",
|
|
75
|
+
children: /* @__PURE__ */ jsx(Button, { type: "primary", icon: /* @__PURE__ */ jsx(InfoCircleOutlined, {}), children: "Usage" })
|
|
76
|
+
}
|
|
77
|
+
) }),
|
|
78
|
+
/* @__PURE__ */ jsxs(Row, { gutter: 4, style: { marginTop: Size.BasePadding }, children: [
|
|
79
|
+
/* @__PURE__ */ jsx(Col, { span: fold ? 18 : 12, children: /* @__PURE__ */ jsx(Row, { className: `${clsNamePrefix}-file-tree`, justify: "center", children: /* @__PURE__ */ jsxs(Col, { span: 24, style: { padding: Size.BasePadding / 2 }, children: [
|
|
80
|
+
/* @__PURE__ */ jsx(Title, { text: "Current Module Imported Reasons Tree:" }),
|
|
81
|
+
importedModules ? /* @__PURE__ */ jsx(
|
|
82
|
+
FileTree,
|
|
83
|
+
{
|
|
84
|
+
cwd,
|
|
85
|
+
treeData: selectedChunk ? fileStructures.filter((_parent) => reasonsTree[_parent.id].indexOf(selectedChunk) >= 0) : fileStructures,
|
|
86
|
+
needCode: true,
|
|
87
|
+
needShowAllTree: true,
|
|
88
|
+
needJumpto: true,
|
|
89
|
+
selectedChunk
|
|
90
|
+
}
|
|
91
|
+
) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` })
|
|
92
|
+
] }) }) }),
|
|
93
|
+
/* @__PURE__ */ jsx(Col, { span: fold ? 6 : 12, children: /* @__PURE__ */ jsxs("div", { className: `${clsNamePrefix}-file-tree`, style: { padding: Size.BasePadding / 2 }, children: [
|
|
94
|
+
fold ? /* @__PURE__ */ jsx(Popover, { content: "Unfold [Dependencies & Chunks] Box.", children: /* @__PURE__ */ jsx(MenuFoldOutlined, { onClick: () => setFold(!fold), style: { marginRight: 8 } }) }) : /* @__PURE__ */ jsx(Popover, { content: "Fold [Dependencies & Chunks] Box.", children: /* @__PURE__ */ jsx(MenuUnfoldOutlined, { onClick: () => setFold(!fold), style: { marginRight: 8 } }) }),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
Radio.Group,
|
|
97
|
+
{
|
|
98
|
+
options: [
|
|
99
|
+
{
|
|
100
|
+
label: "Dependencies",
|
|
101
|
+
value: 0 /* Dependencies */
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: "Chunks",
|
|
105
|
+
value: 1 /* Chunks */
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
onChange: (e) => setDimension(e.target.value),
|
|
109
|
+
value: dimension,
|
|
110
|
+
optionType: "button",
|
|
111
|
+
buttonStyle: "solid",
|
|
112
|
+
size: "middle"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
!fold ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
dimension === 0 /* Dependencies */ && /* @__PURE__ */ jsx(Col, { span: 24, style: { marginTop: Size.BasePadding / 2 }, children: curModule ? /* @__PURE__ */ jsx(DependencyTree, { module: curModule, dependencies, cwd }) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` }) }),
|
|
117
|
+
dimension === 1 /* Chunks */ && /* @__PURE__ */ jsx(Col, { span: 18, style: { marginTop: Size.BasePadding / 2 }, children: curModule ? /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetChunksByModuleId, body: { moduleId: curModule.id }, children: (res) => /* @__PURE__ */ jsx(ChunksTable, { chunks: res }) }) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` }) })
|
|
118
|
+
] }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
119
|
+
] }) })
|
|
120
|
+
] })
|
|
121
|
+
] });
|
|
122
|
+
};
|
|
123
|
+
export {
|
|
124
|
+
ModuleFilesTree
|
|
125
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LeftSquareOutlined } from "@ant-design/icons";
|
|
3
|
+
import { SDK } from "@rsdoctor/types";
|
|
4
|
+
import { Card, Col, Row, Select, Space, Typography } from "antd";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { ServerAPIProvider } from "../../components/Manifest";
|
|
7
|
+
import { getShortPath } from "../../utils";
|
|
8
|
+
import { values } from "lodash-es";
|
|
9
|
+
import { ModuleGraphListContext } from "../BundleSize/config";
|
|
10
|
+
import { ModuleFilesTree } from "./fileTree";
|
|
11
|
+
import "./index.css";
|
|
12
|
+
const ModuleAnalyzeComponent = ({ modules, cwd, moduleId }) => {
|
|
13
|
+
const [selectedChunk, setSelectedChunk] = useState("");
|
|
14
|
+
return /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetModuleDetails, body: { moduleId: +moduleId }, children: ({ module, dependencies }) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetAllChunkGraph, body: {}, children: (chunks) => {
|
|
16
|
+
return /* @__PURE__ */ jsx(ModuleGraphListContext.Consumer, { children: ({ moduleJumpList, setModuleJumpList }) => {
|
|
17
|
+
return /* @__PURE__ */ jsxs(
|
|
18
|
+
Card,
|
|
19
|
+
{
|
|
20
|
+
title: /* @__PURE__ */ jsxs(Space, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
LeftSquareOutlined,
|
|
23
|
+
{
|
|
24
|
+
onClick: () => {
|
|
25
|
+
const _list = [...moduleJumpList.slice(0, -1)];
|
|
26
|
+
setModuleJumpList(_list);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ jsx(Typography.Title, { code: true, level: 5, style: { marginBottom: "revert" }, children: `Current Module: ${getShortPath(module.path)}` })
|
|
31
|
+
] }),
|
|
32
|
+
style: { height: "100%" },
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Row, { justify: "start", style: { marginBottom: 20 }, children: /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(
|
|
35
|
+
Select,
|
|
36
|
+
{
|
|
37
|
+
allowClear: true,
|
|
38
|
+
placeholder: "Select Chunk To Filter Modules Links",
|
|
39
|
+
showSearch: true,
|
|
40
|
+
style: { width: 300 },
|
|
41
|
+
options: values(chunks).map((e) => ({ label: e.name, value: e.id })),
|
|
42
|
+
onChange: (e) => setSelectedChunk(e)
|
|
43
|
+
}
|
|
44
|
+
) }) }),
|
|
45
|
+
/* @__PURE__ */ jsx(Row, { justify: "start", align: "middle", children: /* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsx(
|
|
46
|
+
ModuleFilesTree,
|
|
47
|
+
{
|
|
48
|
+
curModule: module,
|
|
49
|
+
modules,
|
|
50
|
+
dependencies,
|
|
51
|
+
cwd,
|
|
52
|
+
selectedChunk
|
|
53
|
+
}
|
|
54
|
+
) }) })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
} });
|
|
59
|
+
} });
|
|
60
|
+
} });
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
ModuleAnalyzeComponent
|
|
64
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
export type NewTreeNodeType = {
|
|
3
|
+
__RESOURCEPATH__: string;
|
|
4
|
+
id: number;
|
|
5
|
+
key: string;
|
|
6
|
+
name: string;
|
|
7
|
+
level: number;
|
|
8
|
+
kind: number;
|
|
9
|
+
size?: string;
|
|
10
|
+
concatModules: number[] | undefined;
|
|
11
|
+
chunks?: string[];
|
|
12
|
+
getChildren?: () => NewTreeNodeType[];
|
|
13
|
+
dependencies?: number[];
|
|
14
|
+
fatherPath?: string;
|
|
15
|
+
children?: number[];
|
|
16
|
+
needExpand?: boolean | string;
|
|
17
|
+
};
|
|
18
|
+
export declare function useCreatFileTreeData(modules: SDK.ModuleData[], importedModules: SDK.ModuleData[], curModule: SDK.ModuleData): {
|
|
19
|
+
data: NewTreeNodeType[];
|
|
20
|
+
};
|
|
21
|
+
export declare function getContactMainModulePath(concatModules: number[], modules: SDK.ModuleData[]): string[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { compact } from "lodash-es";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { formatSize, getShortPath } from "../../../utils";
|
|
4
|
+
import { getImporteds } from ".";
|
|
5
|
+
function useCreatFileTreeData(modules, importedModules, curModule) {
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
if (!importedModules || !(importedModules == null ? void 0 : importedModules.length)) {
|
|
8
|
+
return { filterData: [], data: [] };
|
|
9
|
+
}
|
|
10
|
+
const root = compact(
|
|
11
|
+
importedModules == null ? void 0 : importedModules.map((imported, index) => {
|
|
12
|
+
return {
|
|
13
|
+
key: `0-${index}`,
|
|
14
|
+
name: getShortPath(imported.path),
|
|
15
|
+
__RESOURCEPATH__: imported.path,
|
|
16
|
+
id: imported.id,
|
|
17
|
+
level: 1,
|
|
18
|
+
chunks: imported.chunks,
|
|
19
|
+
size: formatSize(imported.size.parsedSize),
|
|
20
|
+
kind: imported.kind,
|
|
21
|
+
concatModules: imported.concatenationModules,
|
|
22
|
+
fatherPath: getShortPath(curModule.path),
|
|
23
|
+
dependencies: imported.dependencies,
|
|
24
|
+
getChildren: () => getLeafs(imported, modules, curModule),
|
|
25
|
+
children: imported.imported
|
|
26
|
+
};
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
return {
|
|
30
|
+
data: root
|
|
31
|
+
};
|
|
32
|
+
}, [importedModules, curModule]);
|
|
33
|
+
}
|
|
34
|
+
function getLeafs(imported, modules, fatherModule) {
|
|
35
|
+
const leafModules = getImporteds(imported, modules);
|
|
36
|
+
const leafs = leafModules == null ? void 0 : leafModules.map((_imported, index) => {
|
|
37
|
+
return {
|
|
38
|
+
key: `0-${index}`,
|
|
39
|
+
name: getShortPath(_imported.path),
|
|
40
|
+
__RESOURCEPATH__: _imported.path,
|
|
41
|
+
id: _imported.id,
|
|
42
|
+
level: 1,
|
|
43
|
+
size: formatSize(_imported.size.parsedSize),
|
|
44
|
+
kind: _imported.kind,
|
|
45
|
+
chunks: _imported.chunks,
|
|
46
|
+
concatModules: _imported.concatenationModules,
|
|
47
|
+
fatherPath: getShortPath(fatherModule.path),
|
|
48
|
+
dependencies: _imported.dependencies,
|
|
49
|
+
getChildren: () => getLeafs(_imported, modules, imported),
|
|
50
|
+
children: _imported.imported
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return leafs;
|
|
54
|
+
}
|
|
55
|
+
function getContactMainModulePath(concatModules, modules) {
|
|
56
|
+
const concatModulesPath = concatModules == null ? void 0 : concatModules.map((cm) => {
|
|
57
|
+
var _a;
|
|
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);
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
getContactMainModulePath,
|
|
64
|
+
useCreatFileTreeData
|
|
65
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
export declare const getImporteds: (curModule: SDK.ModuleData, modules: SDK.ModuleData[]) => SDK.ModuleData[];
|
|
3
|
+
export declare const getModuleReasonsTree: (curModule: SDK.ModuleData, modules: SDK.ModuleData[], reasonsTree: string[], visited: Map<number, boolean>) => void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { compact, find } from "lodash-es";
|
|
2
|
+
const getImporteds = (curModule, modules) => {
|
|
3
|
+
var _a;
|
|
4
|
+
if ((_a = curModule == null ? void 0 : curModule.imported) == null ? void 0 : _a.length) {
|
|
5
|
+
const _importeds = curModule.imported.map(
|
|
6
|
+
(_importedModule) => find(modules, (m) => m.id === Number(_importedModule))
|
|
7
|
+
);
|
|
8
|
+
const importeds = compact(_importeds);
|
|
9
|
+
return importeds;
|
|
10
|
+
}
|
|
11
|
+
return [];
|
|
12
|
+
};
|
|
13
|
+
const getModuleReasonsTree = (curModule, modules, reasonsTree, visited) => {
|
|
14
|
+
if (!visited.has(curModule.id)) {
|
|
15
|
+
visited.set(curModule.id, true);
|
|
16
|
+
} else if (visited.get(curModule.id)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const importeds = getImporteds(curModule, modules);
|
|
20
|
+
if (!importeds.length) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
importeds.forEach((_curModule) => {
|
|
24
|
+
var _a;
|
|
25
|
+
(_a = _curModule == null ? void 0 : _curModule.chunks) == null ? void 0 : _a.forEach((_chunk) => {
|
|
26
|
+
if (reasonsTree.indexOf(_chunk) < 0) {
|
|
27
|
+
reasonsTree.push(_chunk);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
getModuleReasonsTree(_curModule, modules, reasonsTree, visited);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
getImporteds,
|
|
35
|
+
getModuleReasonsTree
|
|
36
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from "antd";
|
|
3
|
+
import { ResolverAnalysis } from "../../components/Resolver/analysis";
|
|
4
|
+
import { WebpackConfigurationViewer } from "../../components/Configuration";
|
|
5
|
+
const Page = () => {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
7
|
+
Card,
|
|
8
|
+
{
|
|
9
|
+
title: "Webpack Resolver Analysis",
|
|
10
|
+
extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["resolve", "resolveLoader"] }),
|
|
11
|
+
bodyStyle: { paddingTop: 0 },
|
|
12
|
+
children: /* @__PURE__ */ jsx(ResolverAnalysis, {})
|
|
13
|
+
}
|
|
14
|
+
) });
|
|
15
|
+
};
|
|
16
|
+
export * from "./constants";
|
|
17
|
+
export {
|
|
18
|
+
Page
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SDK } from '@rsdoctor/types';
|
|
3
|
+
interface Props {
|
|
4
|
+
project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
|
|
5
|
+
}
|
|
6
|
+
export declare const Page: React.FC<Omit<Props, "project"> & Partial<{
|
|
7
|
+
body?: any;
|
|
8
|
+
}>>;
|
|
9
|
+
export * from './constants';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Col, Row } from "antd";
|
|
3
|
+
import { SDK } from "@rsdoctor/types";
|
|
4
|
+
import { Size } from "../../constants";
|
|
5
|
+
import { BundleOverall, ProjectOverall, CompileOverall } from "../../components/Overall";
|
|
6
|
+
import { CompileAlerts, BundleAlerts } from "../../components/Alerts";
|
|
7
|
+
import { withServerAPI } from "../../components/Manifest";
|
|
8
|
+
const Component = ({ project }) => {
|
|
9
|
+
const { summary, configs, root: cwd, envinfo, errors } = project;
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
11
|
+
/* @__PURE__ */ jsxs(Row, { gutter: Size.BasePadding, children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Col, { span: 8, children: /* @__PURE__ */ jsx(ProjectOverall, { configs, cwd, envinfo, alerts: errors }) }),
|
|
13
|
+
/* @__PURE__ */ jsx(Col, { span: 8, children: /* @__PURE__ */ jsx(BundleOverall, { errors, cwd }) }),
|
|
14
|
+
/* @__PURE__ */ jsx(Col, { span: 8, children: /* @__PURE__ */ jsx(CompileOverall, { summary }) })
|
|
15
|
+
] }),
|
|
16
|
+
/* @__PURE__ */ jsx(CompileAlerts, {}),
|
|
17
|
+
/* @__PURE__ */ jsx(BundleAlerts, {})
|
|
18
|
+
] });
|
|
19
|
+
};
|
|
20
|
+
const Page = withServerAPI({
|
|
21
|
+
api: SDK.ServerAPI.API.GetProjectInfo,
|
|
22
|
+
responsePropName: "project",
|
|
23
|
+
Component
|
|
24
|
+
});
|
|
25
|
+
export * from "./constants";
|
|
26
|
+
export {
|
|
27
|
+
Page
|
|
28
|
+
};
|