@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,71 @@
|
|
|
1
|
+
var Theme = /* @__PURE__ */ ((Theme2) => {
|
|
2
|
+
Theme2["Light"] = "light";
|
|
3
|
+
Theme2["Dark"] = "dark";
|
|
4
|
+
return Theme2;
|
|
5
|
+
})(Theme || {});
|
|
6
|
+
var PageState = /* @__PURE__ */ ((PageState2) => {
|
|
7
|
+
PageState2[PageState2["Success"] = 0] = "Success";
|
|
8
|
+
PageState2[PageState2["Pending"] = 1] = "Pending";
|
|
9
|
+
PageState2[PageState2["Fail"] = 2] = "Fail";
|
|
10
|
+
return PageState2;
|
|
11
|
+
})(PageState || {});
|
|
12
|
+
var ComponentState = /* @__PURE__ */ ((ComponentState2) => {
|
|
13
|
+
ComponentState2[ComponentState2["Success"] = 0] = "Success";
|
|
14
|
+
ComponentState2[ComponentState2["Pending"] = 1] = "Pending";
|
|
15
|
+
ComponentState2[ComponentState2["Updating"] = 2] = "Updating";
|
|
16
|
+
ComponentState2[ComponentState2["Fail"] = 3] = "Fail";
|
|
17
|
+
return ComponentState2;
|
|
18
|
+
})(ComponentState || {});
|
|
19
|
+
var ViewMode = /* @__PURE__ */ ((ViewMode2) => {
|
|
20
|
+
ViewMode2["List"] = "list";
|
|
21
|
+
ViewMode2["Group"] = "group";
|
|
22
|
+
return ViewMode2;
|
|
23
|
+
})(ViewMode || {});
|
|
24
|
+
var Language = /* @__PURE__ */ ((Language2) => {
|
|
25
|
+
Language2["Cn"] = "cn";
|
|
26
|
+
Language2["En"] = "en";
|
|
27
|
+
return Language2;
|
|
28
|
+
})(Language || {});
|
|
29
|
+
var APILoaderMode4Dev = /* @__PURE__ */ ((APILoaderMode4Dev2) => {
|
|
30
|
+
APILoaderMode4Dev2["Local"] = "local";
|
|
31
|
+
APILoaderMode4Dev2["Remote"] = "remote";
|
|
32
|
+
APILoaderMode4Dev2["Default"] = "default";
|
|
33
|
+
return APILoaderMode4Dev2;
|
|
34
|
+
})(APILoaderMode4Dev || {});
|
|
35
|
+
var Size = /* @__PURE__ */ ((Size2) => {
|
|
36
|
+
Size2[Size2["BasePadding"] = 24] = "BasePadding";
|
|
37
|
+
Size2[Size2["BaseBorderRadius"] = 8] = "BaseBorderRadius";
|
|
38
|
+
Size2[Size2["NavBarHeight"] = 54] = "NavBarHeight";
|
|
39
|
+
return Size2;
|
|
40
|
+
})(Size || {});
|
|
41
|
+
var Color = /* @__PURE__ */ ((Color2) => {
|
|
42
|
+
Color2["Red"] = "rgb(207, 19, 34)";
|
|
43
|
+
Color2["Green"] = "#52c41a";
|
|
44
|
+
Color2["Yellow"] = "#faad14";
|
|
45
|
+
Color2["Blue"] = "#1677ff";
|
|
46
|
+
return Color2;
|
|
47
|
+
})(Color || {});
|
|
48
|
+
const drawerWidth = (
|
|
49
|
+
// eslint-disable-next-line financial/no-float-calculation
|
|
50
|
+
typeof window === "undefined" ? 0 : window.innerWidth * 0.85 >= 1100 ? window.innerWidth * 0.85 : 1100
|
|
51
|
+
);
|
|
52
|
+
const TAG_PALLETE = {
|
|
53
|
+
COLOR_A: "#90DCE9",
|
|
54
|
+
COLOR_B: "green",
|
|
55
|
+
COLOR_C: "#4EAAB9",
|
|
56
|
+
COLOR_D: "#B7E9F4",
|
|
57
|
+
COLOR_E: "#2E7CBE",
|
|
58
|
+
DARK_BLUE: "#1554ad"
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
APILoaderMode4Dev,
|
|
62
|
+
Color,
|
|
63
|
+
ComponentState,
|
|
64
|
+
Language,
|
|
65
|
+
PageState,
|
|
66
|
+
Size,
|
|
67
|
+
TAG_PALLETE,
|
|
68
|
+
Theme,
|
|
69
|
+
ViewMode,
|
|
70
|
+
drawerWidth
|
|
71
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DataNode } from '../../../utils';
|
|
4
|
+
export declare const ModuleCodeViewer: React.FC<{
|
|
5
|
+
data: SDK.ModuleData;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const ModuleGraphViewer: React.FC<{
|
|
8
|
+
id: number | string;
|
|
9
|
+
show: boolean;
|
|
10
|
+
setShow: (_show: boolean) => void;
|
|
11
|
+
cwd: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function getChildrenModule(node: DataNode): string[];
|
|
14
|
+
export declare const ModulesStatistics: React.FC<{
|
|
15
|
+
modules: SDK.ModuleData[];
|
|
16
|
+
chunks: SDK.ChunkData[];
|
|
17
|
+
filteredModules: SDK.ModuleData[];
|
|
18
|
+
}>;
|
|
19
|
+
export declare const AssetDetail: React.FC<{
|
|
20
|
+
asset: SDK.AssetData;
|
|
21
|
+
chunks: SDK.ChunkData[];
|
|
22
|
+
modules: SDK.ModuleData[];
|
|
23
|
+
moduleSizeLimit?: number;
|
|
24
|
+
height?: number;
|
|
25
|
+
root: string;
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,405 @@
|
|
|
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 { CodepenOutlined, ColumnHeightOutlined, DeploymentUnitOutlined, InfoCircleOutlined } from "@ant-design/icons";
|
|
22
|
+
import Editor from "@monaco-editor/react";
|
|
23
|
+
import { SDK } from "@rsdoctor/types";
|
|
24
|
+
import { Button, Card, Col, Divider, Drawer, Empty, Popover, Row, Space, Tag, Tooltip, Typography } from "antd";
|
|
25
|
+
import { sumBy } from "lodash-es";
|
|
26
|
+
import { dirname, relative } from "path";
|
|
27
|
+
import { useEffect, useMemo, useState } from "react";
|
|
28
|
+
import { ServerAPIProvider } from "../../../components/Manifest";
|
|
29
|
+
import { ModuleAnalyzeComponent } from "../../ModuleAnalyze";
|
|
30
|
+
import { Badge as Bdg } from "../../../components/Badge";
|
|
31
|
+
import { FileTree } from "../../../components/FileTree";
|
|
32
|
+
import { KeywordInput } from "../../../components/Form/keyword";
|
|
33
|
+
import { Keyword } from "../../../components/Keyword";
|
|
34
|
+
import { TextDrawer } from "../../../components/TextDrawer";
|
|
35
|
+
import { Size, drawerWidth } from "../../../constants";
|
|
36
|
+
import { createFileStructures, formatSize, getOriginalLanguage, isJsDataUrl, useI18n } from "../../../utils";
|
|
37
|
+
import { ModuleGraphListContext } from "../config";
|
|
38
|
+
let expanedModulesKeys = [];
|
|
39
|
+
const TAB_MAP = {
|
|
40
|
+
source: "source code",
|
|
41
|
+
transformed: "transformed code (After compile)",
|
|
42
|
+
parsedSource: "parsed code (After bundle and tree-shaking)"
|
|
43
|
+
};
|
|
44
|
+
const ModuleCodeViewer = ({ data }) => {
|
|
45
|
+
const [tab, setTab] = useState("parsedSource");
|
|
46
|
+
const { t } = useI18n();
|
|
47
|
+
const TAB_LAB_MAP = {
|
|
48
|
+
source: "source code",
|
|
49
|
+
transformed: `transformed(${t("After Compile")})`,
|
|
50
|
+
parsedSource: `parsedSource(${t("After Bundle")})`
|
|
51
|
+
};
|
|
52
|
+
if (!data)
|
|
53
|
+
return null;
|
|
54
|
+
const { path } = data;
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
TextDrawer,
|
|
57
|
+
{
|
|
58
|
+
text: "",
|
|
59
|
+
buttonProps: {
|
|
60
|
+
size: "small",
|
|
61
|
+
icon: /* @__PURE__ */ jsx(CodepenOutlined, {}),
|
|
62
|
+
type: "default"
|
|
63
|
+
},
|
|
64
|
+
buttonStyle: { padding: `0 4px` },
|
|
65
|
+
drawerProps: {
|
|
66
|
+
destroyOnClose: true,
|
|
67
|
+
title: `Code of "${path}"`
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ jsx(
|
|
70
|
+
Card,
|
|
71
|
+
{
|
|
72
|
+
className: "code-size-card",
|
|
73
|
+
style: { width: "100%" },
|
|
74
|
+
tabList: [{ tab: "source" }, { tab: "transformed" }, { tab: "parsedSource" }].map((e) => __spreadProps(__spreadValues({}, e), {
|
|
75
|
+
tab: TAB_LAB_MAP[e.tab],
|
|
76
|
+
key: e.tab
|
|
77
|
+
})),
|
|
78
|
+
activeTabKey: tab,
|
|
79
|
+
onTabChange: (v) => setTab(v),
|
|
80
|
+
tabBarExtraContent: /* @__PURE__ */ jsx(
|
|
81
|
+
Popover,
|
|
82
|
+
{
|
|
83
|
+
placement: "bottom",
|
|
84
|
+
title: /* @__PURE__ */ jsx(Typography.Title, { level: 5, children: "Explain" }),
|
|
85
|
+
content: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", marginBottom: 30 }, children: [
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "source: " }),
|
|
88
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: TAB_MAP.source })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "transformed: " }),
|
|
92
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: TAB_MAP.transformed })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
95
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "parsedSource: " }),
|
|
96
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: TAB_MAP.parsedSource })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
99
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "More" }),
|
|
100
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: t("CodeModeExplain") })
|
|
101
|
+
] }) }),
|
|
102
|
+
trigger: "hover",
|
|
103
|
+
children: /* @__PURE__ */ jsx("a", { href: "#", children: "Explain" })
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetModuleCodeByModuleId, body: { moduleId: data.id }, children: (source) => {
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
Editor,
|
|
109
|
+
{
|
|
110
|
+
theme: "vs-dark",
|
|
111
|
+
language: getOriginalLanguage(path),
|
|
112
|
+
height: window.innerHeight / 1.5,
|
|
113
|
+
value: source[tab],
|
|
114
|
+
options: {
|
|
115
|
+
readOnly: true,
|
|
116
|
+
domReadOnly: true,
|
|
117
|
+
fontSize: 14,
|
|
118
|
+
wordWrap: "bounded",
|
|
119
|
+
minimap: {
|
|
120
|
+
enabled: false
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
} })
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
const ModuleGraphViewer = ({ id, show, setShow, cwd }) => {
|
|
132
|
+
if (!id)
|
|
133
|
+
return null;
|
|
134
|
+
return /* @__PURE__ */ jsx(Drawer, { open: show, maskClosable: true, width: drawerWidth, onClose: () => setShow(false), children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetAllModuleGraph, body: {}, children: (modules) => /* @__PURE__ */ jsx(ModuleAnalyzeComponent, { cwd, moduleId: id, modules }) }) });
|
|
135
|
+
};
|
|
136
|
+
const inlinedResourcePathKey = "__RESOURCEPATH__";
|
|
137
|
+
function getChildrenModule(node) {
|
|
138
|
+
const mods = [];
|
|
139
|
+
node.children && node.children.forEach((n) => {
|
|
140
|
+
if (n.isLeaf) {
|
|
141
|
+
mods.push(n[inlinedResourcePathKey]);
|
|
142
|
+
} else {
|
|
143
|
+
getChildrenModule(n);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return mods;
|
|
147
|
+
}
|
|
148
|
+
const ModulesStatistics = ({ modules, chunks, filteredModules }) => {
|
|
149
|
+
const { sourceSize, parsedSize, filteredParsedSize, filteredSourceSize } = useMemo(() => {
|
|
150
|
+
return {
|
|
151
|
+
sourceSize: sumBy(modules, (e) => e.size.sourceSize),
|
|
152
|
+
parsedSize: sumBy(modules, (e) => e.size.parsedSize),
|
|
153
|
+
filteredSourceSize: sumBy(filteredModules, (e) => e.size.sourceSize),
|
|
154
|
+
filteredParsedSize: sumBy(filteredModules, (e) => e.size.parsedSize)
|
|
155
|
+
};
|
|
156
|
+
}, [modules, filteredModules]);
|
|
157
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
Tooltip,
|
|
160
|
+
{
|
|
161
|
+
title: `total modules count is ${modules.length}, the filtered modules count is ${filteredModules.length}`,
|
|
162
|
+
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
163
|
+
/* @__PURE__ */ jsxs(Typography.Text, { type: "secondary", style: { fontSize: 12, fontWeight: 400 }, children: [
|
|
164
|
+
"Modules: ",
|
|
165
|
+
filteredModules.length,
|
|
166
|
+
" / ",
|
|
167
|
+
modules.length
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
170
|
+
] })
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
175
|
+
Tooltip,
|
|
176
|
+
{
|
|
177
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
178
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
179
|
+
"Total modules parsed size: ",
|
|
180
|
+
formatSize(parsedSize)
|
|
181
|
+
] }),
|
|
182
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
183
|
+
"Total modules source size: ",
|
|
184
|
+
formatSize(sourceSize)
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
187
|
+
"Filtered modules parsed size: ",
|
|
188
|
+
formatSize(filteredParsedSize)
|
|
189
|
+
] }),
|
|
190
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
191
|
+
"Filtered modules source size: ",
|
|
192
|
+
formatSize(filteredSourceSize)
|
|
193
|
+
] })
|
|
194
|
+
] }),
|
|
195
|
+
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
196
|
+
/* @__PURE__ */ jsxs(Typography.Text, { type: "secondary", style: { fontSize: 12, fontWeight: 400 }, children: [
|
|
197
|
+
"Modules Size:",
|
|
198
|
+
" ",
|
|
199
|
+
filteredParsedSize === parsedSize ? formatSize(parsedSize) : `${formatSize(filteredParsedSize)} / ${formatSize(parsedSize)}`
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
202
|
+
] })
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
206
|
+
/* @__PURE__ */ jsx(
|
|
207
|
+
Tooltip,
|
|
208
|
+
{
|
|
209
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
210
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
211
|
+
"this asset includes ",
|
|
212
|
+
chunks.length,
|
|
213
|
+
" chunks: "
|
|
214
|
+
] }),
|
|
215
|
+
chunks.map((e) => /* @__PURE__ */ jsx(Bdg, { label: "chunk", value: e.name }, e.name))
|
|
216
|
+
] }),
|
|
217
|
+
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
218
|
+
/* @__PURE__ */ jsxs(Typography.Text, { type: "secondary", style: { fontSize: 12, fontWeight: 400 }, children: [
|
|
219
|
+
"Chunks: ",
|
|
220
|
+
chunks.length
|
|
221
|
+
] }),
|
|
222
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
223
|
+
] })
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
] });
|
|
227
|
+
};
|
|
228
|
+
const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, moduleSizeLimit, height, root }) => {
|
|
229
|
+
const [moduleKeyword, setModuleKeyword] = useState("");
|
|
230
|
+
const [defaultExpandAll, setDefaultExpandAll] = useState(false);
|
|
231
|
+
const [moduleJumpList, setModuleJumpList] = useState([]);
|
|
232
|
+
const [show, setShow] = useState(false);
|
|
233
|
+
const filteredModules = useMemo(() => {
|
|
234
|
+
let res = includeModules.slice();
|
|
235
|
+
if (moduleKeyword) {
|
|
236
|
+
const regexp = new RegExp(moduleKeyword, "i");
|
|
237
|
+
res = res.filter((e) => regexp.test(e.path));
|
|
238
|
+
}
|
|
239
|
+
if (moduleSizeLimit) {
|
|
240
|
+
res = res.filter((e) => e.size.parsedSize >= moduleSizeLimit);
|
|
241
|
+
}
|
|
242
|
+
return res;
|
|
243
|
+
}, [includeModules, moduleKeyword, moduleSizeLimit]);
|
|
244
|
+
const avgSize = sumBy(includeModules, (e) => e.size.parsedSize || 0) / includeModules.length;
|
|
245
|
+
const fileStructures = useMemo(() => {
|
|
246
|
+
const res = createFileStructures({
|
|
247
|
+
files: filteredModules.map((e) => e.path).filter(Boolean),
|
|
248
|
+
inlinedResourcePathKey,
|
|
249
|
+
fileTitle(file, basename) {
|
|
250
|
+
var _a;
|
|
251
|
+
const mod = filteredModules.find((e) => e.path === file);
|
|
252
|
+
if (!mod)
|
|
253
|
+
return basename;
|
|
254
|
+
const { parsedSize = 0, sourceSize = 0 } = mod.size;
|
|
255
|
+
const isConcatenation = mod.kind === SDK.ModuleKind.Concatenation;
|
|
256
|
+
const containedOtherModules = !isConcatenation && parsedSize === 0 && includeModules.filter((e) => e !== mod && e.modules && e.modules.indexOf(mod.id) > -1);
|
|
257
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
258
|
+
/* @__PURE__ */ jsx(Keyword, { ellipsis: true, style: { maxWidth: 500 }, text: basename, keyword: moduleKeyword }),
|
|
259
|
+
parsedSize !== 0 ? /* @__PURE__ */ jsx(
|
|
260
|
+
Bdg,
|
|
261
|
+
{
|
|
262
|
+
label: "parsed size",
|
|
263
|
+
value: formatSize(parsedSize),
|
|
264
|
+
type: parsedSize >= avgSize ? "error" : "default",
|
|
265
|
+
tooltip: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
266
|
+
/* @__PURE__ */ jsx(Bdg, { label: "parsed size", value: formatSize(parsedSize) }),
|
|
267
|
+
/* @__PURE__ */ jsx(Bdg, { label: "source size", value: formatSize(sourceSize) })
|
|
268
|
+
] })
|
|
269
|
+
}
|
|
270
|
+
) : sourceSize !== 0 ? (
|
|
271
|
+
// fallback to display tag for source size
|
|
272
|
+
/* @__PURE__ */ jsx(Bdg, { label: "source size", value: formatSize(sourceSize), type: "default" })
|
|
273
|
+
) : null,
|
|
274
|
+
isConcatenation ? /* @__PURE__ */ jsx(
|
|
275
|
+
Tooltip,
|
|
276
|
+
{
|
|
277
|
+
title: /* @__PURE__ */ jsx(Space, { children: /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
278
|
+
"this is a concatenated module, it contains ",
|
|
279
|
+
(_a = mod.modules) == null ? void 0 : _a.length,
|
|
280
|
+
" modules"
|
|
281
|
+
] }) }),
|
|
282
|
+
children: /* @__PURE__ */ jsx(Tag, { color: "#46b5c8", children: "concatenated" })
|
|
283
|
+
}
|
|
284
|
+
) : null,
|
|
285
|
+
containedOtherModules && containedOtherModules.length ? /* @__PURE__ */ jsx(
|
|
286
|
+
Tooltip,
|
|
287
|
+
{
|
|
288
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
289
|
+
/* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit" }, children: "this is a concatenated module, it is be contained in these modules below:" }),
|
|
290
|
+
containedOtherModules.map(({ id, path }) => {
|
|
291
|
+
if (isJsDataUrl(path)) {
|
|
292
|
+
return /* @__PURE__ */ jsx(
|
|
293
|
+
Typography.Paragraph,
|
|
294
|
+
{
|
|
295
|
+
ellipsis: { rows: 4 },
|
|
296
|
+
style: { color: "inherit", maxWidth: "100%" },
|
|
297
|
+
code: true,
|
|
298
|
+
children: path
|
|
299
|
+
},
|
|
300
|
+
id
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
const p = relative(dirname(mod.path), path);
|
|
304
|
+
if (p.startsWith("javascript;charset=utf-8;base64,")) {
|
|
305
|
+
return /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit", maxWidth: "100%" }, code: true, children: p[0] === "." ? p : `./${p}` }, id);
|
|
306
|
+
}
|
|
307
|
+
return /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit" }, code: true, children: p[0] === "." ? p : `./${p}` }, id);
|
|
308
|
+
})
|
|
309
|
+
] }),
|
|
310
|
+
children: /* @__PURE__ */ jsx(Tag, { color: "#46b5c8", children: "concatenated" })
|
|
311
|
+
}
|
|
312
|
+
) : null,
|
|
313
|
+
/* @__PURE__ */ jsx(
|
|
314
|
+
Button,
|
|
315
|
+
{
|
|
316
|
+
size: "small",
|
|
317
|
+
icon: /* @__PURE__ */ jsx(DeploymentUnitOutlined, {}),
|
|
318
|
+
onClick: () => {
|
|
319
|
+
setModuleJumpList([mod.id]);
|
|
320
|
+
setShow(true);
|
|
321
|
+
},
|
|
322
|
+
children: "module explorer"
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
/* @__PURE__ */ jsx(ModuleCodeViewer, { data: mod })
|
|
326
|
+
] });
|
|
327
|
+
},
|
|
328
|
+
dirTitle(dir, defaultTitle) {
|
|
329
|
+
const paths = getChildrenModule(dir);
|
|
330
|
+
if (paths.length) {
|
|
331
|
+
const mods = paths.map((e) => includeModules.find((m) => m.path === e));
|
|
332
|
+
const parsedSize = sumBy(mods, (e) => {
|
|
333
|
+
var _a;
|
|
334
|
+
return ((_a = e.size) == null ? void 0 : _a.parsedSize) || 0;
|
|
335
|
+
});
|
|
336
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
337
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: defaultTitle }),
|
|
338
|
+
parsedSize > 0 ? /* @__PURE__ */ jsx(
|
|
339
|
+
Bdg,
|
|
340
|
+
{
|
|
341
|
+
label: "parsed size",
|
|
342
|
+
value: formatSize(parsedSize),
|
|
343
|
+
type: parsedSize >= avgSize ? "error" : "default"
|
|
344
|
+
}
|
|
345
|
+
) : null
|
|
346
|
+
] });
|
|
347
|
+
}
|
|
348
|
+
return defaultTitle;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
return res;
|
|
352
|
+
}, [filteredModules]);
|
|
353
|
+
const onSearch = (value) => setModuleKeyword(value);
|
|
354
|
+
useEffect(() => {
|
|
355
|
+
setModuleKeyword("");
|
|
356
|
+
setDefaultExpandAll(false);
|
|
357
|
+
}, [asset]);
|
|
358
|
+
useEffect(() => {
|
|
359
|
+
setDefaultExpandAll(false);
|
|
360
|
+
}, [moduleKeyword]);
|
|
361
|
+
return /* @__PURE__ */ jsx(ModuleGraphListContext.Provider, { value: { moduleJumpList, setModuleJumpList }, children: /* @__PURE__ */ jsxs(Card, { title: `Modules of "${asset.path}"`, bodyStyle: { overflow: "scroll", height }, size: "small", children: [
|
|
362
|
+
includeModules.length ? /* @__PURE__ */ jsxs(Row, { children: [
|
|
363
|
+
/* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsx(ModulesStatistics, { modules: includeModules, chunks: includeChunks, filteredModules }) }),
|
|
364
|
+
/* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
365
|
+
/* @__PURE__ */ jsx(KeywordInput, { placeholder: "search module by keyword", onChange: onSearch }, asset.path),
|
|
366
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => setDefaultExpandAll(true), size: "small", icon: /* @__PURE__ */ jsx(ColumnHeightOutlined, {}), children: "expand all" })
|
|
367
|
+
] }) }),
|
|
368
|
+
/* @__PURE__ */ jsx(Col, { span: 24, style: { marginTop: Size.BasePadding }, children: filteredModules.length ? /* @__PURE__ */ jsx(
|
|
369
|
+
FileTree,
|
|
370
|
+
{
|
|
371
|
+
onExpand: (expandedKeys) => {
|
|
372
|
+
expanedModulesKeys = expandedKeys;
|
|
373
|
+
},
|
|
374
|
+
treeData: fileStructures,
|
|
375
|
+
autoExpandParent: true,
|
|
376
|
+
defaultExpandParent: true,
|
|
377
|
+
defaultExpandedKeys: (expanedModulesKeys == null ? void 0 : expanedModulesKeys.length) ? expanedModulesKeys : fileStructures.length === 1 ? [fileStructures[0].key] : [],
|
|
378
|
+
defaultExpandAll: defaultExpandAll || filteredModules.length <= 20
|
|
379
|
+
},
|
|
380
|
+
`tree_${moduleKeyword}_${defaultExpandAll}_${asset.path}`
|
|
381
|
+
) : /* @__PURE__ */ jsx(
|
|
382
|
+
Empty,
|
|
383
|
+
{
|
|
384
|
+
description: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: `"${moduleKeyword}" can't match any modules` })
|
|
385
|
+
}
|
|
386
|
+
) })
|
|
387
|
+
] }) : /* @__PURE__ */ jsx(Empty, { description: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: `"${asset.path}" don't has any modules` }) }),
|
|
388
|
+
/* @__PURE__ */ jsx(
|
|
389
|
+
ModuleGraphViewer,
|
|
390
|
+
{
|
|
391
|
+
id: (moduleJumpList == null ? void 0 : moduleJumpList.length) ? moduleJumpList[moduleJumpList.length - 1] : "",
|
|
392
|
+
show,
|
|
393
|
+
setShow,
|
|
394
|
+
cwd: root
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
] }) });
|
|
398
|
+
};
|
|
399
|
+
export {
|
|
400
|
+
AssetDetail,
|
|
401
|
+
ModuleCodeViewer,
|
|
402
|
+
ModuleGraphViewer,
|
|
403
|
+
ModulesStatistics,
|
|
404
|
+
getChildrenModule
|
|
405
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
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 { jsx } from "react/jsx-runtime";
|
|
21
|
+
import { createElement } from "react";
|
|
22
|
+
import { useState } from "react";
|
|
23
|
+
import { Col, Row, Segmented } from "antd";
|
|
24
|
+
import { useDuplicatePackagesByErrors } from "../../../utils";
|
|
25
|
+
import { Size } from "../../../constants";
|
|
26
|
+
import { StatisticCard } from "../../../components/Card/statistic";
|
|
27
|
+
import { DuplicatePackageDrawerWithServer } from "../../../components/TextDrawer";
|
|
28
|
+
import { SizeCard } from "../../../components/Card/size";
|
|
29
|
+
const height = 100;
|
|
30
|
+
const AssetCard = ({ showProgress = false, data, total }) => {
|
|
31
|
+
return /* @__PURE__ */ jsx(SizeCard, { files: data.files, total, showProgress });
|
|
32
|
+
};
|
|
33
|
+
const AssetCardContainer = ({ titles, datas }) => {
|
|
34
|
+
const [idx, setIdx] = useState(0);
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
StatisticCard,
|
|
37
|
+
{
|
|
38
|
+
title: titles.length > 1 ? /* @__PURE__ */ jsx(
|
|
39
|
+
Segmented,
|
|
40
|
+
{
|
|
41
|
+
defaultValue: titles[idx],
|
|
42
|
+
options: titles,
|
|
43
|
+
onChange: (e) => {
|
|
44
|
+
setIdx(titles.indexOf(e));
|
|
45
|
+
},
|
|
46
|
+
size: "small",
|
|
47
|
+
style: { transition: "transform 0.3s ease" },
|
|
48
|
+
value: titles[idx] || titles[0]
|
|
49
|
+
}
|
|
50
|
+
) : titles[idx],
|
|
51
|
+
value: datas.map((e, i) => /* @__PURE__ */ createElement(AssetCard, __spreadProps(__spreadValues({}, e), { key: i })))[idx]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
const BundleCards = ({ cwd, errors, summary }) => {
|
|
56
|
+
const duplicatePackages = useDuplicatePackagesByErrors(errors);
|
|
57
|
+
const arr = [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
AssetCardContainer,
|
|
60
|
+
{
|
|
61
|
+
titles: ["Total Files"],
|
|
62
|
+
datas: [
|
|
63
|
+
{
|
|
64
|
+
data: summary.all.total,
|
|
65
|
+
total: summary.all.total.size
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
AssetCardContainer,
|
|
72
|
+
{
|
|
73
|
+
titles: ["Total JS", "Initial JS"],
|
|
74
|
+
datas: [
|
|
75
|
+
{
|
|
76
|
+
data: summary.js.total,
|
|
77
|
+
total: summary.all.total.size,
|
|
78
|
+
showProgress: true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
data: summary.js.initial,
|
|
82
|
+
total: summary.all.total.size,
|
|
83
|
+
showProgress: true
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
AssetCardContainer,
|
|
90
|
+
{
|
|
91
|
+
titles: ["Total CSS", "Initial CSS"],
|
|
92
|
+
datas: [
|
|
93
|
+
{
|
|
94
|
+
data: summary.css.total,
|
|
95
|
+
total: summary.all.total.size,
|
|
96
|
+
showProgress: true
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
data: summary.css.initial,
|
|
100
|
+
total: summary.all.total.size,
|
|
101
|
+
showProgress: true
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
AssetCardContainer,
|
|
108
|
+
{
|
|
109
|
+
titles: ["Images", "Fonts", "Media"],
|
|
110
|
+
datas: [
|
|
111
|
+
{
|
|
112
|
+
data: summary.imgs.total,
|
|
113
|
+
total: summary.all.total.size,
|
|
114
|
+
showProgress: true
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
data: summary.fonts.total,
|
|
118
|
+
total: summary.all.total.size,
|
|
119
|
+
showProgress: true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
data: summary.media.total,
|
|
123
|
+
total: summary.all.total.size,
|
|
124
|
+
showProgress: true
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
AssetCardContainer,
|
|
131
|
+
{
|
|
132
|
+
titles: ["HTML Files"],
|
|
133
|
+
datas: [
|
|
134
|
+
{
|
|
135
|
+
data: summary.html.total,
|
|
136
|
+
total: summary.all.total.size,
|
|
137
|
+
showProgress: true
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
StatisticCard,
|
|
144
|
+
{
|
|
145
|
+
title: "Duplicate Packages",
|
|
146
|
+
value: /* @__PURE__ */ jsx(DuplicatePackageDrawerWithServer, { buttonStyle: { height }, duplicatePackages, cwd })
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
];
|
|
150
|
+
return /* @__PURE__ */ jsx(Row, { gutter: [Size.BasePadding, Size.BasePadding], wrap: true, style: { marginBottom: Size.BasePadding }, children: arr.map((e, i) => /* @__PURE__ */ jsx(Col, { style: { minWidth: 300 }, children: e }, i)) });
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
BundleCards
|
|
154
|
+
};
|