@rsdoctor/components 0.4.13 → 1.0.0-alpha.1

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.
Files changed (197) hide show
  1. package/README.md +1 -1
  2. package/dist/common/imgs/connection-point.js +11 -0
  3. package/dist/common/imgs/webpack.js +11 -0
  4. package/dist/common/svg/bundle-size.js +11 -0
  5. package/dist/common/svg/error.js +10 -0
  6. package/dist/common/svg/file-css.js +11 -0
  7. package/dist/common/svg/file-html.js +11 -0
  8. package/dist/common/svg/file-image.js +11 -0
  9. package/dist/common/svg/file-js.js +11 -0
  10. package/dist/common/svg/file-unknown.js +11 -0
  11. package/dist/common/svg/file.js +10 -0
  12. package/dist/common/svg/files/css.js +11 -0
  13. package/dist/common/svg/files/html.js +11 -0
  14. package/dist/common/svg/files/image.js +11 -0
  15. package/dist/common/svg/files/js.js +11 -0
  16. package/dist/common/svg/files/unkown-file.js +11 -0
  17. package/dist/common/svg/loader/input.js +11 -0
  18. package/dist/common/svg/loader/output.js +12 -0
  19. package/dist/common/svg/loader/step.js +7 -0
  20. package/dist/common/svg/navbar/bundle-size-active.js +10 -0
  21. package/dist/common/svg/navbar/bundle-size-inactive.js +10 -0
  22. package/dist/common/svg/navbar/compile-analysis-active.js +11 -0
  23. package/dist/common/svg/navbar/compile-analysis-inactive.js +11 -0
  24. package/dist/common/svg/navbar/overall-active.js +11 -0
  25. package/dist/common/svg/navbar/overall-inactive.js +11 -0
  26. package/dist/common/svg/output.js +12 -0
  27. package/dist/common/svg/source-size.js +12 -0
  28. package/dist/common/svg/source.js +10 -0
  29. package/dist/common/svg/total-size.js +11 -0
  30. package/dist/common/svg/version.js +11 -0
  31. package/dist/components/Alert/ecma-version-check.d.ts +2 -0
  32. package/dist/components/Alert/ecma-version-check.js +69 -0
  33. package/dist/components/Alert/ecma-version-check.module.js +5 -0
  34. package/dist/components/Alert/ecma-version-check_module.css +23 -0
  35. package/dist/components/Alert/package-relation.d.ts +1 -2
  36. package/dist/components/Alert/package-relation.js +29 -59
  37. package/dist/components/Alert/package-relation.module.js +5 -0
  38. package/dist/components/Alert/package-relation_module.css +23 -0
  39. package/dist/components/Alert/types.d.ts +6 -1
  40. package/dist/components/Alerts/{common.d.ts → bundle-alert.d.ts} +3 -4
  41. package/dist/components/Alerts/bundle-alert.js +156 -0
  42. package/dist/components/Alerts/bundle-alert.module.js +5 -0
  43. package/dist/components/Alerts/bundle-alert_module.css +46 -0
  44. package/dist/components/Alerts/bundle.js +25 -6
  45. package/dist/components/Alerts/collapse.d.ts +6 -0
  46. package/dist/components/Alerts/collapse.js +209 -0
  47. package/dist/components/Alerts/collapse.module.js +5 -0
  48. package/dist/components/Alerts/collapse_module.css +71 -0
  49. package/dist/components/Alerts/compile.js +18 -5
  50. package/dist/components/Alerts/list.d.ts +4 -0
  51. package/dist/components/Alerts/list.js +25 -0
  52. package/dist/components/Alerts/list.module.js +5 -0
  53. package/dist/components/Alerts/list_module.css +5 -0
  54. package/dist/components/Alerts/overlay.js +67 -28
  55. package/dist/components/Alerts/overlay.module.js +5 -0
  56. package/dist/components/Alerts/overlay_module.css +11 -0
  57. package/dist/components/Card/index.d.ts +1 -1
  58. package/dist/components/Card/index.js +8 -18
  59. package/dist/components/Card/size.d.ts +1 -0
  60. package/dist/components/Card/size.js +99 -65
  61. package/dist/components/Card/size.module.js +5 -0
  62. package/dist/components/Card/size_module.css +34 -0
  63. package/dist/components/Card/statistic.d.ts +0 -2
  64. package/dist/components/Card/statistic.js +7 -5
  65. package/dist/components/Charts/TimelineCharts/index.d.ts +6 -1
  66. package/dist/components/Charts/TimelineCharts/index.js +208 -192
  67. package/dist/components/Charts/bootstrap.js +15 -10
  68. package/dist/components/Charts/common.d.ts +2 -0
  69. package/dist/components/Charts/common.js +18 -5
  70. package/dist/components/Charts/constants.d.ts +8 -1
  71. package/dist/components/Charts/constants.js +37 -41
  72. package/dist/components/Charts/done.js +14 -9
  73. package/dist/components/Charts/index.js +1 -1
  74. package/dist/components/Charts/loader.js +12 -2
  75. package/dist/components/Charts/minify.js +14 -9
  76. package/dist/components/Charts/utils.js +2 -2
  77. package/dist/components/CodeViewer/diff.js +8 -2
  78. package/dist/components/CodeViewer/viewer.js +0 -7
  79. package/dist/components/Configuration/builder.js +50 -36
  80. package/dist/components/Configuration/builder.module.js +5 -0
  81. package/dist/components/Configuration/builder_module.css +6 -0
  82. package/dist/components/FileTree/css.js +11 -0
  83. package/dist/components/FileTree/html.js +11 -0
  84. package/dist/components/FileTree/image.js +11 -0
  85. package/dist/components/FileTree/index.css +8 -0
  86. package/dist/components/FileTree/index.d.ts +1 -0
  87. package/dist/components/FileTree/index.js +65 -5
  88. package/dist/components/FileTree/js.js +11 -0
  89. package/dist/components/FileTree/unkown-file.js +11 -0
  90. package/dist/components/Form/keyword.js +3 -2
  91. package/dist/components/Keyword/index.js +38 -14
  92. package/dist/components/Keyword/style.module.js +5 -0
  93. package/dist/components/Keyword/style_module.css +5 -0
  94. package/dist/components/Layout/builder-select.js +37 -24
  95. package/dist/components/Layout/bundle-size-icon.js +10 -0
  96. package/dist/components/Layout/compile-icon.js +11 -0
  97. package/dist/components/Layout/header.css +7 -0
  98. package/dist/components/Layout/header.js +10 -17
  99. package/dist/components/Layout/menus.js +59 -64
  100. package/dist/components/Layout/overall-icon.js +10 -0
  101. package/dist/components/Layout/progress.js +2 -1
  102. package/dist/components/Loader/Analysis/files.js +187 -101
  103. package/dist/components/Loader/Analysis/index.js +34 -17
  104. package/dist/components/Loader/Analysis/input.js +11 -0
  105. package/dist/components/Loader/Analysis/output.js +12 -0
  106. package/dist/components/Loader/Analysis/style.module.js +5 -0
  107. package/dist/components/Loader/Analysis/style_module.css +73 -0
  108. package/dist/components/Loader/executions.js +95 -114
  109. package/dist/components/Loader/step.js +7 -0
  110. package/dist/components/Opener/code.js +2 -1
  111. package/dist/components/Overall/DataSummary.d.ts +8 -0
  112. package/dist/components/Overall/DataSummary.js +25 -0
  113. package/dist/components/Overall/DataSummary.module.js +5 -0
  114. package/dist/components/Overall/DataSummary_module.css +95 -0
  115. package/dist/components/Overall/bundle.d.ts +6 -1
  116. package/dist/components/Overall/bundle.js +208 -112
  117. package/dist/components/Overall/bundle.module.js +5 -0
  118. package/dist/components/Overall/bundle_module.css +67 -0
  119. package/dist/components/Overall/card_module.css +1 -4
  120. package/dist/components/Overall/compile.js +47 -41
  121. package/dist/components/Overall/compile.module.js +1 -1
  122. package/dist/components/Overall/compile_module.css +6 -0
  123. package/dist/components/Overall/help-center.d.ts +1 -0
  124. package/dist/components/Overall/help-center.js +86 -0
  125. package/dist/components/Overall/help-center.module.js +5 -0
  126. package/dist/components/Overall/help-center_module.css +35 -0
  127. package/dist/components/Overall/list.module.js +1 -1
  128. package/dist/components/Overall/list_module.css +14 -4
  129. package/dist/components/Overall/overview.d.ts +8 -0
  130. package/dist/components/Overall/overview.js +17 -0
  131. package/dist/components/Overall/overview.module.js +5 -0
  132. package/dist/components/Overall/overview_module.css +25 -0
  133. package/dist/components/Overall/project.d.ts +0 -1
  134. package/dist/components/Overall/project.js +101 -36
  135. package/dist/components/Overall/project.module.js +5 -0
  136. package/dist/components/Overall/project_module.css +19 -0
  137. package/dist/components/Select/index.css +6 -0
  138. package/dist/components/Select/index.d.ts +1 -0
  139. package/dist/components/Select/index.js +7 -4
  140. package/dist/components/TextDrawer/index.d.ts +2 -1
  141. package/dist/components/TextDrawer/index.js +38 -27
  142. package/dist/components/index.d.ts +0 -1
  143. package/dist/components/index.js +0 -1
  144. package/dist/constants.d.ts +1 -1
  145. package/dist/constants.js +1 -1
  146. package/dist/pages/BundleSize/components/asset.js +106 -124
  147. package/dist/pages/BundleSize/components/card.module.js +5 -0
  148. package/dist/pages/BundleSize/components/card_module.css +54 -0
  149. package/dist/pages/BundleSize/components/cards.js +157 -47
  150. package/dist/pages/BundleSize/components/index.js +129 -121
  151. package/dist/pages/BundleSize/components/index.module.js +5 -0
  152. package/dist/pages/BundleSize/components/index_module.css +82 -0
  153. package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +13 -0
  154. package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +1 -1
  155. package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +40 -63
  156. package/dist/pages/ModuleAnalyze/fileTree.d.ts +1 -0
  157. package/dist/pages/ModuleAnalyze/fileTree.js +36 -164
  158. package/dist/pages/ModuleAnalyze/index.css +7 -3
  159. package/dist/pages/ModuleAnalyze/index.d.ts +7 -1
  160. package/dist/pages/ModuleAnalyze/index.js +122 -45
  161. package/dist/pages/Overall/index.js +14 -9
  162. package/dist/pages/Overall/index.module.js +5 -0
  163. package/dist/pages/Overall/index_module.css +26 -0
  164. package/dist/pages/Overall/responsiveLayout.d.ts +6 -0
  165. package/dist/pages/Overall/responsiveLayout.js +9 -0
  166. package/dist/pages/Resources/BundleDiff/DiffContainer/modules.js +4 -4
  167. package/dist/pages/TreeShaking/editor.d.ts +3 -4
  168. package/dist/pages/TreeShaking/table.d.ts +3 -3
  169. package/dist/pages/TreeShaking/types.d.ts +2 -2
  170. package/dist/pages/TreeShaking/utils.d.ts +4 -5
  171. package/dist/pages/WebpackLoaders/Analysis/index.js +4 -1
  172. package/dist/pages/WebpackLoaders/Overall/index.js +8 -1
  173. package/dist/pages/WebpackPlugins/index.css +3 -0
  174. package/dist/pages/WebpackPlugins/index.d.ts +1 -0
  175. package/dist/pages/WebpackPlugins/index.js +61 -51
  176. package/dist/utils/data/brief.js +0 -2
  177. package/dist/utils/file.d.ts +4 -2
  178. package/dist/utils/file.js +40 -5
  179. package/dist/utils/i18n/cn.js +5 -0
  180. package/dist/utils/i18n/en.d.ts +5 -0
  181. package/dist/utils/i18n/en.js +5 -0
  182. package/package.json +8 -7
  183. package/dist/assets/connection-point.3b3c78ca.svg +0 -1
  184. package/dist/assets/webpack.98604d64.svg +0 -1
  185. package/dist/components/Alert/index.d.ts +0 -4
  186. package/dist/components/Alert/index.js +0 -34
  187. package/dist/components/Alert/link.d.ts +0 -3
  188. package/dist/components/Alert/link.js +0 -27
  189. package/dist/components/Alerts/common.js +0 -123
  190. package/dist/components/Card/statistic.css +0 -17
  191. package/dist/components/Overall/NumberButton.d.ts +0 -8
  192. package/dist/components/Overall/NumberButton.js +0 -29
  193. package/dist/components/Overall/NumberButton.module.js +0 -5
  194. package/dist/components/Overall/NumberButton_module.css +0 -70
  195. package/dist/components/Overall/bundle.module.css +0 -0
  196. package/dist/pages/Overall/responsiveGridList.d.ts +0 -6
  197. package/dist/pages/Overall/responsiveGridList.js +0 -28
@@ -1,187 +1,59 @@
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 {
11
- Badge,
12
- Button,
13
- Col,
14
- Empty,
15
- Popover,
16
- Radio,
17
- Row,
18
- Tag,
19
- Typography
20
- } from "antd";
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { Col, Empty } from "antd";
21
3
  import { useEffect, useState } from "react";
22
- import { ServerAPIProvider } from "../../components/Manifest";
23
- import { Title } from "../../components/Title";
24
- import { Size, TAG_PALLETE } from "../../constants";
25
- import { useI18n } from "../../utils/hooks";
26
- import { ChunksTable } from "./chunks";
4
+ import { Size } from "../../constants";
27
5
  import { FileTree } from "./components/fileTreeCom";
28
6
  import { clsNamePrefix } from "./constants";
29
7
  import DependencyTree from "./dependency";
30
- import { getImporteds, getModuleReasonsTree } from "./utils";
8
+ import { getImporteds } from "./utils";
31
9
  import { useCreateFileTreeData } from "./utils/hooks";
32
- var ChartDimension = /* @__PURE__ */ ((ChartDimension2) => {
33
- ChartDimension2[ChartDimension2["Dependencies"] = 0] = "Dependencies";
34
- ChartDimension2[ChartDimension2["Chunks"] = 1] = "Chunks";
35
- return ChartDimension2;
36
- })(ChartDimension || {});
10
+ import { TabList } from "./index";
37
11
  const ModuleFilesTree = (props) => {
38
- const { curModule, modules, dependencies, cwd, selectedChunk = "" } = props;
39
- const { t } = useI18n();
12
+ const {
13
+ curModule,
14
+ modules,
15
+ dependencies,
16
+ cwd,
17
+ activeTabKey,
18
+ selectedChunk = ""
19
+ } = props;
40
20
  const [importedModules, setImportedModules] = useState(
41
21
  []
42
22
  );
43
- const [dimension, setDimension] = useState(
44
- 0 /* Dependencies */
45
- );
46
- const [fold, setFold] = useState(true);
47
23
  const { data: fileStructures } = useCreateFileTreeData(
48
24
  modules,
49
25
  importedModules,
50
26
  curModule
51
27
  );
52
- const [reasonsTree, setReasonsTree] = useState(
53
- {}
54
- );
55
28
  useEffect(() => {
56
29
  const importeds = getImporteds(curModule, modules);
57
30
  setImportedModules(importeds);
58
31
  }, [curModule, modules]);
59
- useEffect(() => {
60
- const _reasonsTree = {};
61
- importedModules.forEach((_curModule) => {
62
- const treeList = [];
63
- const visited = /* @__PURE__ */ new Map();
64
- getModuleReasonsTree(_curModule, modules, treeList, visited);
65
- _reasonsTree[_curModule.id] = treeList;
66
- });
67
- setReasonsTree(_reasonsTree);
68
- }, [importedModules]);
69
- return /* @__PURE__ */ jsxs(Fragment, { children: [
70
- /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(
71
- Popover,
72
- {
73
- content: /* @__PURE__ */ jsxs("div", { children: [
74
- /* @__PURE__ */ jsxs("div", { children: [
75
- /* @__PURE__ */ jsx(Badge, { status: "success", text: " " }),
76
- /* @__PURE__ */ jsxs(Typography.Text, { code: true, children: [
77
- /* @__PURE__ */ jsx(ExpandOutlined, {}),
78
- " Expand the node_modules's modules that was omitted... "
79
- ] }),
80
- " ",
81
- /* @__PURE__ */ jsx(Typography.Text, { children: `: ${t("Expand Omitted")}` })
82
- ] }),
83
- /* @__PURE__ */ jsxs("div", { children: [
84
- /* @__PURE__ */ jsx(Badge, { status: "success", text: " " }),
85
- /* @__PURE__ */ jsx(
86
- Popover,
87
- {
88
- content: "*",
89
- title: "Concatenated Module Name",
90
- trigger: "hover",
91
- children: /* @__PURE__ */ jsx(Tag, { color: TAG_PALLETE.DARK_BLUE, children: "Concatenated" })
92
- }
93
- ),
94
- /* @__PURE__ */ jsx(Typography.Text, { children: `: ${t("Concatenated Tag")}` })
95
- ] }),
96
- /* @__PURE__ */ jsxs("div", { children: [
97
- /* @__PURE__ */ jsx(Badge, { status: "success", text: " " }),
98
- /* @__PURE__ */ jsx(RightSquareTwoTone, {}),
99
- /* @__PURE__ */ jsx(Typography.Text, { children: ": Jump button, click to jump to the Module dependency analysis page of this module." })
100
- ] })
101
- ] }),
102
- title: "Usage",
103
- children: /* @__PURE__ */ jsx(Button, { type: "primary", icon: /* @__PURE__ */ jsx(InfoCircleOutlined, {}), children: "Usage" })
104
- }
105
- ) }),
106
- /* @__PURE__ */ jsxs(Row, { gutter: 4, style: { marginTop: Size.BasePadding }, children: [
107
- /* @__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: [
108
- /* @__PURE__ */ jsx(Title, { text: "Current Module Imported Reasons Tree:" }),
109
- importedModules ? /* @__PURE__ */ jsx(
110
- FileTree,
111
- {
112
- cwd,
113
- treeData: selectedChunk ? fileStructures.filter(
114
- (_parent) => reasonsTree[_parent.id].indexOf(selectedChunk) >= 0
115
- ) : fileStructures,
116
- needCode: true,
117
- needShowAllTree: true,
118
- needJumpto: true,
119
- selectedChunk
120
- }
121
- ) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` })
122
- ] }) }) }),
123
- /* @__PURE__ */ jsx(Col, { span: fold ? 6 : 12, children: /* @__PURE__ */ jsxs(
124
- "div",
32
+ return /* @__PURE__ */ jsx(Fragment, { children: activeTabKey === TabList[TabList.Reasons] ? /* @__PURE__ */ jsx(Fragment, { children: importedModules ? /* @__PURE__ */ jsx(
33
+ FileTree,
34
+ {
35
+ cwd,
36
+ treeData: fileStructures,
37
+ needCode: true,
38
+ needShowAllTree: true,
39
+ needJumpto: true,
40
+ selectedChunk
41
+ }
42
+ ) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` }) }) : /* @__PURE__ */ jsx(
43
+ "div",
44
+ {
45
+ className: `${clsNamePrefix}-file-tree`,
46
+ style: { padding: Size.BasePadding / 2 },
47
+ children: /* @__PURE__ */ jsx(Col, { span: 24, style: { marginTop: Size.BasePadding / 2 }, children: curModule ? /* @__PURE__ */ jsx(
48
+ DependencyTree,
125
49
  {
126
- className: `${clsNamePrefix}-file-tree`,
127
- style: { padding: Size.BasePadding / 2 },
128
- children: [
129
- fold ? /* @__PURE__ */ jsx(Popover, { content: "Unfold [Dependencies & Chunks] Box.", children: /* @__PURE__ */ jsx(
130
- MenuFoldOutlined,
131
- {
132
- onClick: () => setFold(!fold),
133
- style: { marginRight: 8 }
134
- }
135
- ) }) : /* @__PURE__ */ jsx(Popover, { content: "Fold [Dependencies & Chunks] Box.", children: /* @__PURE__ */ jsx(
136
- MenuUnfoldOutlined,
137
- {
138
- onClick: () => setFold(!fold),
139
- style: { marginRight: 8 }
140
- }
141
- ) }),
142
- /* @__PURE__ */ jsx(
143
- Radio.Group,
144
- {
145
- options: [
146
- {
147
- label: "Dependencies",
148
- value: 0 /* Dependencies */
149
- },
150
- {
151
- label: "Chunks",
152
- value: 1 /* Chunks */
153
- }
154
- ],
155
- onChange: (e) => setDimension(e.target.value),
156
- value: dimension,
157
- optionType: "button",
158
- buttonStyle: "solid",
159
- size: "middle"
160
- }
161
- ),
162
- !fold ? /* @__PURE__ */ jsxs(Fragment, { children: [
163
- dimension === 0 /* Dependencies */ && /* @__PURE__ */ jsx(Col, { span: 24, style: { marginTop: Size.BasePadding / 2 }, children: curModule ? /* @__PURE__ */ jsx(
164
- DependencyTree,
165
- {
166
- module: curModule,
167
- dependencies,
168
- cwd
169
- }
170
- ) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` }) }),
171
- dimension === 1 /* Chunks */ && /* @__PURE__ */ jsx(Col, { span: 18, style: { marginTop: Size.BasePadding / 2 }, children: curModule ? /* @__PURE__ */ jsx(
172
- ServerAPIProvider,
173
- {
174
- api: SDK.ServerAPI.API.GetChunksByModuleId,
175
- body: { moduleId: curModule.id },
176
- children: (res) => /* @__PURE__ */ jsx(ChunksTable, { chunks: res })
177
- }
178
- ) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` }) })
179
- ] }) : /* @__PURE__ */ jsx(Fragment, {})
180
- ]
50
+ module: curModule,
51
+ dependencies,
52
+ cwd
181
53
  }
182
- ) })
183
- ] })
184
- ] });
54
+ ) : /* @__PURE__ */ jsx(Empty, { className: `${clsNamePrefix}-empty` }) })
55
+ }
56
+ ) });
185
57
  };
186
58
  export {
187
59
  ModuleFilesTree
@@ -1,10 +1,14 @@
1
1
  .module-analyze-file-tree {
2
2
  width: "100%";
3
- border: 1px solid #eee;
4
3
  min-height: 50em;
5
- margin: 4;
6
- padding: 4;
7
4
  }
8
5
  .module-analyze-file-tree .module-analyze-empty {
9
6
  margin-top: 20%;
10
7
  }
8
+ .module-analyze-box {
9
+ display: flex;
10
+ flex-direction: column;
11
+ }
12
+ .file-tree-com-titles-box {
13
+ line-height: 30px;
14
+ }
@@ -1,8 +1,14 @@
1
1
  import { SDK } from '@rsdoctor/types';
2
2
  import React from 'react';
3
- import './index.sass';
3
+ import './index.scss';
4
+ export declare enum TabList {
5
+ Reasons = 0,
6
+ Dependencies = 1
7
+ }
4
8
  export declare const ModuleAnalyzeComponent: React.FC<{
5
9
  modules: SDK.ModuleData[];
6
10
  cwd: string;
7
11
  moduleId: string | number;
12
+ show: boolean;
13
+ setShow: (arg: boolean) => void;
8
14
  }>;
@@ -1,64 +1,141 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { LeftSquareOutlined } from "@ant-design/icons";
3
2
  import { SDK } from "@rsdoctor/types";
4
- import { Card, Col, Row, Select, Space, Typography } from "antd";
3
+ import {
4
+ Badge,
5
+ Card,
6
+ Col,
7
+ Drawer,
8
+ Popover,
9
+ Row,
10
+ Space,
11
+ Typography
12
+ } from "antd";
5
13
  import { useState } from "react";
6
14
  import { ServerAPIProvider } from "../../components/Manifest";
7
15
  import { getShortPath } from "../../utils";
8
- import { values } from "lodash-es";
9
16
  import { ModuleGraphListContext } from "../BundleSize/config";
10
17
  import { ModuleFilesTree } from "./fileTree";
11
18
  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
+ import { drawerWidth } from "../../constants";
20
+ import {
21
+ LeftSquareOutlined,
22
+ QuestionCircleOutlined,
23
+ RightSquareTwoTone
24
+ } from "@ant-design/icons";
25
+ var TabList = /* @__PURE__ */ ((TabList2) => {
26
+ TabList2[TabList2["Reasons"] = 0] = "Reasons";
27
+ TabList2[TabList2["Dependencies"] = 1] = "Dependencies";
28
+ return TabList2;
29
+ })(TabList || {});
30
+ const tabslist = [
31
+ {
32
+ key: TabList[0 /* Reasons */],
33
+ label: TabList[0 /* Reasons */]
34
+ },
35
+ {
36
+ key: TabList[1 /* Dependencies */],
37
+ label: TabList[1 /* Dependencies */]
38
+ }
39
+ ];
40
+ const ModuleAnalyzeComponent = ({ modules, cwd, moduleId, show, setShow }) => {
41
+ const [selectedChunk, _setSelectedChunk] = useState("");
42
+ const [activeTabKey, setActiveTabKey] = useState(TabList[0 /* Reasons */]);
43
+ return /* @__PURE__ */ jsx(
44
+ ServerAPIProvider,
45
+ {
46
+ api: SDK.ServerAPI.API.GetModuleDetails,
47
+ body: { moduleId: +moduleId },
48
+ children: ({ module, dependencies }) => {
49
+ return /* @__PURE__ */ jsx(
50
+ Drawer,
19
51
  {
20
- title: /* @__PURE__ */ jsxs(Space, { children: [
52
+ title: /* @__PURE__ */ jsxs("div", { className: "module-analyze-box", children: [
53
+ /* @__PURE__ */ jsx(Typography.Text, { children: getShortPath(module.path) }),
21
54
  /* @__PURE__ */ jsx(
22
- LeftSquareOutlined,
55
+ Typography.Text,
23
56
  {
24
- onClick: () => {
25
- const _list = [...moduleJumpList.slice(0, -1)];
26
- setModuleJumpList(_list);
27
- }
57
+ style: { fontSize: 12, color: "rgba(0, 0, 0, 0.45)" },
58
+ children: `Current Module: ${module.path}`
28
59
  }
29
- ),
30
- /* @__PURE__ */ jsx(Typography.Title, { code: true, level: 5, style: { marginBottom: "revert" }, children: `Current Module: ${getShortPath(module.path)}` })
60
+ )
31
61
  ] }),
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
62
+ open: show,
63
+ maskClosable: true,
64
+ width: drawerWidth * 0.8,
65
+ onClose: () => setShow(false),
66
+ children: /* @__PURE__ */ jsx(
67
+ ServerAPIProvider,
68
+ {
69
+ api: SDK.ServerAPI.API.GetAllChunkGraph,
70
+ body: {},
71
+ children: (_chunks) => {
72
+ return /* @__PURE__ */ jsx(ModuleGraphListContext.Consumer, { children: ({ moduleJumpList, setModuleJumpList }) => {
73
+ return /* @__PURE__ */ jsx(
74
+ Card,
75
+ {
76
+ style: { minHeight: 400 },
77
+ tabList: tabslist,
78
+ activeTabKey,
79
+ tabProps: {
80
+ size: "small",
81
+ style: {
82
+ fontSize: 12
83
+ }
84
+ },
85
+ onTabChange: (k) => setActiveTabKey(k),
86
+ styles: {
87
+ title: { paddingTop: 0 }
88
+ },
89
+ title: /* @__PURE__ */ jsxs(Space, { style: { padding: "10px 0px" }, children: [
90
+ /* @__PURE__ */ jsx(
91
+ LeftSquareOutlined,
92
+ {
93
+ onClick: () => {
94
+ const _list = [
95
+ ...moduleJumpList.slice(0, -1)
96
+ ];
97
+ setModuleJumpList(_list);
98
+ }
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsx(Typography.Text, { children: "Current Module Imported Reasons Tree" }),
102
+ /* @__PURE__ */ jsx(
103
+ Popover,
104
+ {
105
+ content: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { children: [
106
+ /* @__PURE__ */ jsx(Badge, { status: "success", text: " " }),
107
+ /* @__PURE__ */ jsx(RightSquareTwoTone, {}),
108
+ /* @__PURE__ */ jsx(Typography.Text, { children: ": Jump button, click to jump to the Module dependency analysis page of this module." })
109
+ ] }) }),
110
+ title: "Usage",
111
+ children: /* @__PURE__ */ jsx(QuestionCircleOutlined, {})
112
+ }
113
+ )
114
+ ] }),
115
+ children: /* @__PURE__ */ jsx(Row, { justify: "start", align: "middle", children: /* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsx(
116
+ ModuleFilesTree,
117
+ {
118
+ curModule: module,
119
+ modules,
120
+ dependencies,
121
+ cwd,
122
+ selectedChunk,
123
+ activeTabKey
124
+ }
125
+ ) }) })
126
+ }
127
+ );
128
+ } });
53
129
  }
54
- ) }) })
55
- ]
130
+ }
131
+ )
56
132
  }
57
133
  );
58
- } });
59
- } });
60
- } });
134
+ }
135
+ }
136
+ );
61
137
  };
62
138
  export {
63
- ModuleAnalyzeComponent
139
+ ModuleAnalyzeComponent,
140
+ TabList
64
141
  };
@@ -1,17 +1,20 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { SDK } from "@rsdoctor/types";
3
- import { BundleAlerts, CompileAlerts } from "../../components/Alerts";
3
+ import { Flex } from "antd";
4
+ import { HelpCenter } from "../../components/Overall/help-center";
5
+ import { BundleAlerts } from "../../components/Alerts";
4
6
  import { withServerAPI } from "../../components/Manifest";
5
7
  import {
6
8
  BundleOverall,
7
9
  CompileOverall,
8
10
  ProjectOverall
9
11
  } from "../../components/Overall";
10
- import { ResponsiveGridLayout } from "./responsiveGridList";
12
+ import { ResponsiveLayout } from "./responsiveLayout";
13
+ import style from "./index.module";
11
14
  const Component = ({ project }) => {
12
15
  const { summary, configs, root: cwd, envinfo, errors } = project;
13
- return /* @__PURE__ */ jsxs("div", { children: [
14
- /* @__PURE__ */ jsxs(ResponsiveGridLayout, { children: [
16
+ return /* @__PURE__ */ jsx("div", { className: style.overall, children: /* @__PURE__ */ jsxs(Flex, { style: { width: "100%" }, children: [
17
+ /* @__PURE__ */ jsx("div", { style: { flex: 3, marginRight: "16px" }, children: /* @__PURE__ */ jsxs(ResponsiveLayout, { children: [
15
18
  /* @__PURE__ */ jsx(
16
19
  ProjectOverall,
17
20
  {
@@ -21,12 +24,14 @@ const Component = ({ project }) => {
21
24
  alerts: errors
22
25
  }
23
26
  ),
27
+ /* @__PURE__ */ jsx(BundleAlerts, {})
28
+ ] }) }),
29
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsxs(ResponsiveLayout, { children: [
24
30
  /* @__PURE__ */ jsx(BundleOverall, { errors, cwd }),
25
- /* @__PURE__ */ jsx(CompileOverall, { summary })
26
- ] }),
27
- /* @__PURE__ */ jsx(CompileAlerts, {}),
28
- /* @__PURE__ */ jsx(BundleAlerts, {})
29
- ] });
31
+ /* @__PURE__ */ jsx(CompileOverall, { summary }),
32
+ /* @__PURE__ */ jsx(HelpCenter, {})
33
+ ] }) })
34
+ ] }) });
30
35
  };
31
36
  const Page = withServerAPI({
32
37
  api: SDK.ServerAPI.API.GetProjectInfo,
@@ -0,0 +1,5 @@
1
+ import "./index_module.css";
2
+ var index_module_default = { "overall": "overall_43377", "layout": "layout_43377", "row": "row_43377" };
3
+ export {
4
+ index_module_default as default
5
+ };
@@ -0,0 +1,26 @@
1
+ :root {
2
+ --font-family-code: Roboto, Roboto Mono, -apple-system, BlinkMacSystemFont,
3
+ "Segoe UI", Menlo, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
4
+ "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
5
+ }
6
+ :root .ant-layout-content {
7
+ padding: 16px 32px !important;
8
+ }
9
+ :root .rc-tree .rc-tree-treenode .rc-tree-node-content-wrapper {
10
+ cursor: default;
11
+ }
12
+ :root .ant-tree-title {
13
+ flex: 1 1;
14
+ }
15
+ :root .ant-tree-node-content-wrapper-normal {
16
+ display: flex;
17
+ }
18
+
19
+ .overall_43377 {
20
+ display: flex;
21
+ justify-content: space-between;
22
+ }
23
+
24
+ .layout_43377 .row_43377 {
25
+ margin-bottom: 16px;
26
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ children: React.ReactNode[];
4
+ }
5
+ export declare const ResponsiveLayout: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Flex } from "antd";
3
+ import style from "./index.module";
4
+ const ResponsiveLayout = ({ children }) => {
5
+ return /* @__PURE__ */ jsx(Flex, { vertical: true, className: style.layout, children: children.map((e) => /* @__PURE__ */ jsx("div", { className: style.row, children: e })) });
6
+ };
7
+ export {
8
+ ResponsiveLayout
9
+ };
@@ -272,15 +272,15 @@ const Modules = ({
272
272
  file: r.path,
273
273
  data: [
274
274
  {
275
- baseline: current.moduleCodeMap[r.current?.id]?.source,
276
- current: current.moduleCodeMap[r.current?.id]?.transformed,
275
+ baseline: current.moduleCodeMap[r.current.id]?.source,
276
+ current: current.moduleCodeMap[r.current.id]?.transformed,
277
277
  baselineTitle: "Current Source",
278
278
  currentTitle: "Current Transformed Source",
279
279
  group: "Transformed Source"
280
280
  },
281
281
  {
282
- baseline: current.moduleCodeMap[r.current?.id]?.source,
283
- current: current.moduleCodeMap[r.current?.id]?.parsedSource,
282
+ baseline: current.moduleCodeMap[r.current.id]?.source,
283
+ current: current.moduleCodeMap[r.current.id]?.parsedSource,
284
284
  baselineTitle: "Current Source",
285
285
  currentTitle: "Current Parsed Source",
286
286
  group: "Parsed Source"
@@ -1,10 +1,9 @@
1
- import type { Module, ModuleGraph, SourceRange } from '@rsdoctor/graph';
2
1
  import { SDK } from '@rsdoctor/types';
3
2
  import { SetEditorStatus } from './types';
4
3
  export interface CodeEditorProps {
5
- module: Module;
6
- moduleGraph: ModuleGraph;
7
- ranges: SourceRange[];
4
+ module: SDK.ModuleInstance;
5
+ moduleGraph: SDK.ModuleGraphInstance;
6
+ ranges: SDK.SourceRange[];
8
7
  setEditorData: SetEditorStatus;
9
8
  source: SDK.ModuleSource;
10
9
  toLine?: number;
@@ -1,9 +1,9 @@
1
- import type { Module, ModuleGraph } from '@rsdoctor/graph';
1
+ import { SDK } from '@rsdoctor/types';
2
2
  import React from 'react';
3
3
  import type { TableKind, SetEditorStatus } from './types';
4
4
  interface TableProps {
5
- module: Module;
6
- moduleGraph: ModuleGraph;
5
+ module: SDK.ModuleInstance;
6
+ moduleGraph: SDK.ModuleGraphInstance;
7
7
  setEditorData: SetEditorStatus;
8
8
  kind: TableKind;
9
9
  }
@@ -1,3 +1,3 @@
1
- import type { Module, SourceRange } from '@rsdoctor/graph';
1
+ import { SDK } from '@rsdoctor/types';
2
2
  export type TableKind = 'side-effect' | 'export';
3
- export type SetEditorStatus = (module: Module, ranges: SourceRange[], line?: number) => void;
3
+ export type SetEditorStatus = (module: SDK.ModuleInstance, ranges: SDK.SourceRange[], line?: number) => void;
@@ -1,8 +1,7 @@
1
- import type { ModuleGraph, Statement } from '@rsdoctor/graph';
2
- import { Module } from '@rsdoctor/graph';
3
1
  import type { editor } from 'monaco-editor';
4
- export declare function useFileStructures(modules: Module[], moduleGraph: ModuleGraph, searchInput: string, selectedModule: Module, onItemClick: (file: string) => void, cwd: string): import("../../utils").DataNode[];
2
+ import { SDK } from '@rsdoctor/types';
3
+ export declare function useFileStructures(modules: SDK.ModuleInstance[], moduleGraph: SDK.ModuleGraphInstance, searchInput: string, selectedModule: SDK.ModuleInstance, onItemClick: (file: string) => void, cwd: string): import("../..").DataNode[];
5
4
  export declare function getTreeFilesDefaultExpandedKeys(files: any[]): (string | number)[];
6
5
  export declare function ellipsisPath(full: string): string;
7
- export declare function getModulePositionString(statement: Statement, module: Module): string;
8
- export declare function getHoverMessageInModule(module: Module, moduleGraph: ModuleGraph): editor.IModelDecoration[];
6
+ export declare function getModulePositionString(statement: SDK.StatementInstance, module: SDK.ModuleInstance): string;
7
+ export declare function getHoverMessageInModule(module: SDK.ModuleInstance, moduleGraph: SDK.ModuleGraphInstance): editor.IModelDecoration[];
@@ -2,13 +2,16 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { LoaderAnalysis } from "../../../components/Loader/Analysis";
3
3
  import { WebpackConfigurationViewer } from "../../../components/Configuration";
4
4
  import { Card } from "../../../components/Card";
5
+ import { theme } from "antd";
6
+ const { useToken } = theme;
5
7
  const Page = () => {
8
+ const { token } = useToken();
6
9
  return /* @__PURE__ */ jsx(
7
10
  Card,
8
11
  {
9
12
  title: "Loader Analysis",
10
13
  extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["module", "resolve"] }),
11
- bodyStyle: { paddingTop: 0, height: 800 },
14
+ bodyStyle: { paddingTop: token.padding, height: 800 },
12
15
  children: /* @__PURE__ */ jsx(LoaderAnalysis, {})
13
16
  }
14
17
  );
@@ -3,7 +3,14 @@ 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 Timeline", extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["module"] }), collapsable: true, children: /* @__PURE__ */ jsx(LoaderChart, {}) });
6
+ return /* @__PURE__ */ jsx(
7
+ Card,
8
+ {
9
+ title: "Loader Timeline",
10
+ extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["module"] }),
11
+ children: /* @__PURE__ */ jsx(LoaderChart, {})
12
+ }
13
+ );
7
14
  };
8
15
  export * from "./constants";
9
16
  export {
@@ -0,0 +1,3 @@
1
+ .plugin-select .ant-select-selector {
2
+ width: 300px;
3
+ }