@rsdoctor/components 0.0.0-next-20240620044732
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 +22 -0
- package/dist/assets/connection-point.3b3c78ca.svg +1 -0
- package/dist/assets/webpack.98604d64.svg +1 -0
- package/dist/components/Alert/change.d.ts +8 -0
- package/dist/components/Alert/change.js +93 -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 +32 -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 +281 -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 +58 -0
- package/dist/components/Alerts/bundle.d.ts +11 -0
- package/dist/components/Alerts/bundle.js +61 -0
- package/dist/components/Alerts/common.d.ts +15 -0
- package/dist/components/Alerts/common.js +112 -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 +87 -0
- package/dist/components/BundleDiff/DiffContainer/assets.d.ts +7 -0
- package/dist/components/BundleDiff/DiffContainer/assets.js +507 -0
- package/dist/components/BundleDiff/DiffContainer/cards.d.ts +3 -0
- package/dist/components/BundleDiff/DiffContainer/cards.js +156 -0
- package/dist/components/BundleDiff/DiffContainer/changes.d.ts +15 -0
- package/dist/components/BundleDiff/DiffContainer/changes.js +69 -0
- package/dist/components/BundleDiff/DiffContainer/constants.d.ts +11 -0
- package/dist/components/BundleDiff/DiffContainer/constants.js +17 -0
- package/dist/components/BundleDiff/DiffContainer/diff.d.ts +23 -0
- package/dist/components/BundleDiff/DiffContainer/diff.js +114 -0
- package/dist/components/BundleDiff/DiffContainer/index.d.ts +3 -0
- package/dist/components/BundleDiff/DiffContainer/index.js +180 -0
- package/dist/components/BundleDiff/DiffContainer/modules.d.ts +8 -0
- package/dist/components/BundleDiff/DiffContainer/modules.js +302 -0
- package/dist/components/BundleDiff/DiffContainer/overview.d.ts +5 -0
- package/dist/components/BundleDiff/DiffContainer/overview.js +178 -0
- package/dist/components/BundleDiff/DiffContainer/packages.d.ts +19 -0
- package/dist/components/BundleDiff/DiffContainer/packages.js +330 -0
- package/dist/components/BundleDiff/DiffContainer/row.d.ts +9 -0
- package/dist/components/BundleDiff/DiffContainer/row.js +369 -0
- package/dist/components/BundleDiff/DiffContainer/types.d.ts +45 -0
- package/dist/components/BundleDiff/DiffContainer/types.js +0 -0
- package/dist/components/BundleDiff/DiffContainer/utils.d.ts +2 -0
- package/dist/components/BundleDiff/DiffContainer/utils.js +24 -0
- package/dist/components/BundleDiff/DiffServerAPIProvider/index.d.ts +4 -0
- package/dist/components/BundleDiff/DiffServerAPIProvider/index.js +37 -0
- package/dist/components/BundleDiff/constants.d.ts +11 -0
- package/dist/components/BundleDiff/constants.js +19 -0
- package/dist/components/BundleDiff/index.d.ts +1 -0
- package/dist/components/BundleDiff/index.js +1 -0
- package/dist/components/Card/diff.d.ts +24 -0
- package/dist/components/Card/diff.js +116 -0
- package/dist/components/Card/index.d.ts +9 -0
- package/dist/components/Card/index.js +50 -0
- package/dist/components/Card/size.d.ts +21 -0
- package/dist/components/Card/size.js +79 -0
- package/dist/components/Card/statistic.css +17 -0
- package/dist/components/Card/statistic.d.ts +12 -0
- package/dist/components/Card/statistic.js +19 -0
- package/dist/components/Charts/TimelineCharts/index.d.ts +8 -0
- package/dist/components/Charts/TimelineCharts/index.js +212 -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/constants.d.ts +2 -0
- package/dist/components/Charts/constants.js +46 -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 +88 -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 +206 -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 +35 -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 +60 -0
- package/dist/components/Configuration/builder.d.ts +13 -0
- package/dist/components/Configuration/builder.js +67 -0
- package/dist/components/Configuration/index.d.ts +1 -0
- package/dist/components/Configuration/index.js +1 -0
- package/dist/components/FileTree/index.css +58 -0
- package/dist/components/FileTree/index.d.ts +4 -0
- package/dist/components/FileTree/index.js +42 -0
- package/dist/components/Form/keyword.d.ts +14 -0
- package/dist/components/Form/keyword.js +60 -0
- package/dist/components/Keyword/index.d.ts +6 -0
- package/dist/components/Keyword/index.js +36 -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 +86 -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 +167 -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 +193 -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 +9 -0
- package/dist/components/Loader/executions.js +199 -0
- package/dist/components/Manifest/api.d.ts +34 -0
- package/dist/components/Manifest/api.js +127 -0
- package/dist/components/Manifest/data.d.ts +8 -0
- package/dist/components/Manifest/data.js +65 -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 +20 -0
- package/dist/components/Opener/code.js +78 -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 +11 -0
- package/dist/components/Opener/vscode.js +42 -0
- package/dist/components/Overall/NumberButton.d.ts +8 -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 +67 -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 +144 -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 +69 -0
- package/dist/components/TextDrawer/index.d.ts +11 -0
- package/dist/components/TextDrawer/index.js +36 -0
- package/dist/components/Title/index.d.ts +15 -0
- package/dist/components/Title/index.js +10 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +15 -0
- package/dist/components/worker/ecmaversion/client.d.ts +10 -0
- package/dist/components/worker/ecmaversion/client.js +60 -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 +38 -0
- package/dist/components/worker/jsequal/worker.d.ts +1 -0
- package/dist/components/worker/jsequal/worker.js +23 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +25 -0
- package/dist/constants.d.ts +50 -0
- package/dist/constants.js +75 -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 +545 -0
- package/dist/pages/BundleSize/components/cards.d.ts +7 -0
- package/dist/pages/BundleSize/components/cards.js +143 -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 +366 -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 +97 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +15 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +120 -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 +62 -0
- package/dist/pages/ModuleAnalyze/utils/index.d.ts +3 -0
- package/dist/pages/ModuleAnalyze/utils/index.js +34 -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 +39 -0
- package/dist/pages/Overall/responsiveGridList.d.ts +6 -0
- package/dist/pages/Overall/responsiveGridList.js +28 -0
- package/dist/pages/Resources/RuleIndex/constants.d.ts +3 -0
- package/dist/pages/Resources/RuleIndex/constants.js +7 -0
- package/dist/pages/Resources/RuleIndex/index.d.ts +3 -0
- package/dist/pages/Resources/RuleIndex/index.js +53 -0
- package/dist/pages/TreeShaking/constants.d.ts +3 -0
- package/dist/pages/TreeShaking/constants.js +7 -0
- package/dist/pages/TreeShaking/editor.d.ts +12 -0
- package/dist/pages/TreeShaking/editor.js +110 -0
- package/dist/pages/TreeShaking/index.css +74 -0
- package/dist/pages/TreeShaking/index.d.ts +8 -0
- package/dist/pages/TreeShaking/index.js +177 -0
- package/dist/pages/TreeShaking/open-tag.d.ts +11 -0
- package/dist/pages/TreeShaking/open-tag.js +43 -0
- package/dist/pages/TreeShaking/space.d.ts +1 -0
- package/dist/pages/TreeShaking/space.js +16 -0
- package/dist/pages/TreeShaking/table.d.ts +13 -0
- package/dist/pages/TreeShaking/table.js +319 -0
- package/dist/pages/TreeShaking/types.d.ts +3 -0
- package/dist/pages/TreeShaking/types.js +0 -0
- package/dist/pages/TreeShaking/utils.d.ts +7 -0
- package/dist/pages/TreeShaking/utils.js +147 -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 +9 -0
- package/dist/pages/index.js +20 -0
- package/dist/utils/data/base.d.ts +24 -0
- package/dist/utils/data/base.js +48 -0
- package/dist/utils/data/index.d.ts +5 -0
- package/dist/utils/data/index.js +44 -0
- package/dist/utils/data/local.d.ts +14 -0
- package/dist/utils/data/local.js +86 -0
- package/dist/utils/data/remote.d.ts +10 -0
- package/dist/utils/data/remote.js +52 -0
- package/dist/utils/file.d.ts +33 -0
- package/dist/utils/file.js +154 -0
- package/dist/utils/hooks.d.ts +31 -0
- package/dist/utils/hooks.js +216 -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 +34 -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 +12 -0
- package/dist/utils/monaco.js +71 -0
- package/dist/utils/request.d.ts +27 -0
- package/dist/utils/request.js +130 -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 +21 -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 +7 -0
- package/dist/utils/url.js +75 -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 +7 -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 +92 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, memo } from "react";
|
|
3
|
+
import ReactECharts from "echarts-for-react";
|
|
4
|
+
import * as echarts from "echarts/core";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
import { groupBy } from "lodash-es";
|
|
7
|
+
import { LITTLE_PALETTE_COLORS, PALETTE_COLORS } from "../constants";
|
|
8
|
+
const LINE_HEIGHT = 60;
|
|
9
|
+
const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "normal" }) => {
|
|
10
|
+
const data = [];
|
|
11
|
+
let categories = [];
|
|
12
|
+
const [optionsData, setOptinsData] = useState({});
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!loaderData)
|
|
15
|
+
return;
|
|
16
|
+
const _categories = [];
|
|
17
|
+
loaderData.forEach((_l) => {
|
|
18
|
+
_categories.unshift(_l.n + " total");
|
|
19
|
+
_categories.unshift(_l.n);
|
|
20
|
+
});
|
|
21
|
+
loaderData.forEach(function(_loaderData, _i) {
|
|
22
|
+
data.push({
|
|
23
|
+
name: _loaderData.n + " total",
|
|
24
|
+
value: [
|
|
25
|
+
_categories.indexOf(_loaderData.n + " total"),
|
|
26
|
+
_loaderData.s,
|
|
27
|
+
_loaderData.e,
|
|
28
|
+
_loaderData.e - _loaderData.s
|
|
29
|
+
],
|
|
30
|
+
itemStyle: {
|
|
31
|
+
normal: {
|
|
32
|
+
color: LITTLE_PALETTE_COLORS[_i % 8]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (!_loaderData?.c)
|
|
37
|
+
return;
|
|
38
|
+
for (let l = 0; l < _loaderData?.c?.length; l++) {
|
|
39
|
+
data.push({
|
|
40
|
+
name: _loaderData.n,
|
|
41
|
+
value: [
|
|
42
|
+
_categories.indexOf(_loaderData.n),
|
|
43
|
+
_loaderData.c[l].s,
|
|
44
|
+
_loaderData.c[l].e,
|
|
45
|
+
_loaderData.c[l].e - _loaderData.c[l].s
|
|
46
|
+
],
|
|
47
|
+
itemStyle: {
|
|
48
|
+
normal: {
|
|
49
|
+
color: PALETTE_COLORS[(l + _i) % 30]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
ext: _loaderData.c[l].ext
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
categories = _categories.map((val, i) => {
|
|
57
|
+
if (i % 2 !== 0) {
|
|
58
|
+
return val.replace(" total", "");
|
|
59
|
+
} else {
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}, [loaderData]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!pluginsData)
|
|
66
|
+
return;
|
|
67
|
+
const _pluginsData = groupBy(pluginsData, (e) => e.pid);
|
|
68
|
+
Object.keys(_pluginsData).reverse().forEach(function(key, i) {
|
|
69
|
+
_pluginsData[key].forEach((_plugin, _i) => {
|
|
70
|
+
data.push({
|
|
71
|
+
name: String(_plugin.pid),
|
|
72
|
+
value: [
|
|
73
|
+
i,
|
|
74
|
+
_plugin.args.s,
|
|
75
|
+
_plugin.args.e,
|
|
76
|
+
_plugin.args.e - _plugin.args.s
|
|
77
|
+
],
|
|
78
|
+
itemStyle: {
|
|
79
|
+
normal: {
|
|
80
|
+
color: PALETTE_COLORS[(_i + i) % 30]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
ext: _plugin
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
categories.push(String(key.charAt(0).toUpperCase() + key.slice(1)));
|
|
87
|
+
});
|
|
88
|
+
}, [pluginsData]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
function renderItem(params, api) {
|
|
91
|
+
const categoryIndex = api.value(0);
|
|
92
|
+
const start = api.coord([api.value(1), categoryIndex]);
|
|
93
|
+
const end = api.coord([api.value(2), categoryIndex]);
|
|
94
|
+
const height = api.size([0, 1])[1] * 0.3;
|
|
95
|
+
const rectShape = echarts.graphic.clipRectByRect(
|
|
96
|
+
{
|
|
97
|
+
x: start[0],
|
|
98
|
+
y: chartType === "loader" ? start[1] - (categoryIndex % 2 !== 0 ? 0 : height * 2) : start[1],
|
|
99
|
+
width: end[0] - start[0] || 5,
|
|
100
|
+
height
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
x: params.coordSys.x,
|
|
104
|
+
y: params.coordSys.y,
|
|
105
|
+
width: params.coordSys.width,
|
|
106
|
+
height: params.coordSys.height
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
return rectShape && {
|
|
110
|
+
type: "rect",
|
|
111
|
+
transition: ["shape"],
|
|
112
|
+
shape: rectShape,
|
|
113
|
+
style: api.style(),
|
|
114
|
+
enterFrom: {
|
|
115
|
+
style: { opacity: 0 },
|
|
116
|
+
x: 0
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const option = {
|
|
121
|
+
tooltip: {
|
|
122
|
+
formatter: (raw) => {
|
|
123
|
+
return formatterFn(raw);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
dataZoom: [
|
|
127
|
+
{
|
|
128
|
+
type: "slider",
|
|
129
|
+
filterMode: "weakFilter",
|
|
130
|
+
showDataShadow: false,
|
|
131
|
+
top: -10,
|
|
132
|
+
labelFormatter: ""
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: "inside",
|
|
136
|
+
filterMode: "weakFilter"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
grid: {
|
|
140
|
+
top: 10,
|
|
141
|
+
left: 0,
|
|
142
|
+
bottom: 10,
|
|
143
|
+
right: 0,
|
|
144
|
+
height: categories.length > (chartType === "loader" ? 6 : 3) ? "auto" : categories.length * LINE_HEIGHT,
|
|
145
|
+
containLabel: true
|
|
146
|
+
},
|
|
147
|
+
xAxis: {
|
|
148
|
+
position: "top",
|
|
149
|
+
splitLine: {
|
|
150
|
+
show: false
|
|
151
|
+
},
|
|
152
|
+
scale: true,
|
|
153
|
+
axisLine: {
|
|
154
|
+
show: false
|
|
155
|
+
},
|
|
156
|
+
axisLabel: {
|
|
157
|
+
formatter(val) {
|
|
158
|
+
return dayjs(val).format("HH:mm:ss");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
yAxis: {
|
|
163
|
+
type: "category",
|
|
164
|
+
splitLine: {
|
|
165
|
+
interval: chartType === "loader" ? 1 : 0,
|
|
166
|
+
show: true
|
|
167
|
+
},
|
|
168
|
+
axisLabel: {
|
|
169
|
+
inside: true,
|
|
170
|
+
lineHeight: 20,
|
|
171
|
+
width: 100,
|
|
172
|
+
fontSize: 12,
|
|
173
|
+
color: "#000",
|
|
174
|
+
verticalAlign: "bottom"
|
|
175
|
+
},
|
|
176
|
+
axisLine: {
|
|
177
|
+
show: true
|
|
178
|
+
},
|
|
179
|
+
axisTick: {
|
|
180
|
+
show: false
|
|
181
|
+
},
|
|
182
|
+
data: categories
|
|
183
|
+
},
|
|
184
|
+
series: [
|
|
185
|
+
{
|
|
186
|
+
type: "custom",
|
|
187
|
+
renderItem,
|
|
188
|
+
itemStyle: {
|
|
189
|
+
opacity: 0.8
|
|
190
|
+
},
|
|
191
|
+
encode: {
|
|
192
|
+
x: [1, 2],
|
|
193
|
+
y: 0
|
|
194
|
+
},
|
|
195
|
+
data
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
};
|
|
199
|
+
setOptinsData(option);
|
|
200
|
+
}, [loaderData, pluginsData]);
|
|
201
|
+
return /* @__PURE__ */ jsx(
|
|
202
|
+
ReactECharts,
|
|
203
|
+
{
|
|
204
|
+
option: optionsData,
|
|
205
|
+
echarts,
|
|
206
|
+
style: { width: "100%", minHeight: "400px" }
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
});
|
|
210
|
+
export {
|
|
211
|
+
TimelineCom
|
|
212
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
import { BarChartOutlined } from "@ant-design/icons";
|
|
4
|
+
import { SDK } from "@rsdoctor/types";
|
|
5
|
+
import { TextDrawer } from "../TextDrawer";
|
|
6
|
+
import "./loader.css";
|
|
7
|
+
import "./tooltips.css";
|
|
8
|
+
import { CommonExecutionEmptyTips, CommonExecutionsChart } from "./common";
|
|
9
|
+
import { ServerAPIProvider } from "../Manifest";
|
|
10
|
+
import { Summary } from "@rsdoctor/utils/common";
|
|
11
|
+
const BootstrapChartContainer = ({ summary }) => {
|
|
12
|
+
const { costs = [] } = summary || {};
|
|
13
|
+
const target = costs.find((e) => e.name === Summary.SummaryCostsDataName.Bootstrap);
|
|
14
|
+
const hooks = [
|
|
15
|
+
"environment",
|
|
16
|
+
"afterEnvironment",
|
|
17
|
+
"entryOption",
|
|
18
|
+
"afterPlugins",
|
|
19
|
+
"afterResolvers",
|
|
20
|
+
"initialize",
|
|
21
|
+
"beforeRun",
|
|
22
|
+
"run",
|
|
23
|
+
"watchRun",
|
|
24
|
+
"normalModuleFactory",
|
|
25
|
+
"contextModuleFactory",
|
|
26
|
+
"beforeCompile"
|
|
27
|
+
];
|
|
28
|
+
if (!target)
|
|
29
|
+
return null;
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
TextDrawer,
|
|
32
|
+
{
|
|
33
|
+
drawerProps: { title: 'Chart of the "Bootstrap -> BeforeCompile" stage' },
|
|
34
|
+
text: /* @__PURE__ */ jsxs(Space, { children: [
|
|
35
|
+
"detail",
|
|
36
|
+
/* @__PURE__ */ jsx(BarChartOutlined, {})
|
|
37
|
+
] }),
|
|
38
|
+
children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetPluginData, body: { hooks }, children: (res) => res && res.length ? /* @__PURE__ */ jsx(CommonExecutionsChart, { plugins: res }) : /* @__PURE__ */ jsx(CommonExecutionEmptyTips, {}) })
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
BootstrapChartContainer
|
|
44
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './loader.scss';
|
|
4
|
+
import './tooltips.scss';
|
|
5
|
+
import { Metric } from './types';
|
|
6
|
+
export interface CommonChartProps {
|
|
7
|
+
summary: SDK.SummaryData;
|
|
8
|
+
}
|
|
9
|
+
export declare const CommonExecutionsChart: React.FC<{
|
|
10
|
+
plugins: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
|
|
11
|
+
defaultDatas?: Metric[];
|
|
12
|
+
}>;
|
|
13
|
+
export declare const CommonExecutionEmptyTips: React.FC;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Alert, Typography } from "antd";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useTheme } from "../../utils";
|
|
5
|
+
import { TimelineCom } from "./TimelineCharts";
|
|
6
|
+
import "./loader.css";
|
|
7
|
+
import "./tooltips.css";
|
|
8
|
+
import { formatterForPlugins, processTrans } from "./utils";
|
|
9
|
+
const CommonExecutionsChart = ({ plugins, defaultDatas = [] }) => {
|
|
10
|
+
const { isDark } = useTheme();
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const [data, setData] = useState([]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const arr = [];
|
|
15
|
+
plugins.forEach((item) => {
|
|
16
|
+
item.data.forEach((el) => {
|
|
17
|
+
arr.push({
|
|
18
|
+
p: item.hook,
|
|
19
|
+
n: `${item.tapName}`,
|
|
20
|
+
s: el.startAt,
|
|
21
|
+
e: el.endAt
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
setData([
|
|
26
|
+
...processTrans(defaultDatas),
|
|
27
|
+
...processTrans(arr)
|
|
28
|
+
]);
|
|
29
|
+
}, []);
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: ["loader-chart-container", isDark ? "loader-chart-container_dark" : ""].join(" ").trim(),
|
|
34
|
+
ref,
|
|
35
|
+
style: { width: "100%", height: "600px" },
|
|
36
|
+
children: /* @__PURE__ */ jsx(TimelineCom, { pluginsData: data, formatterFn: formatterForPlugins })
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
const CommonExecutionEmptyTips = () => {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
Alert,
|
|
43
|
+
{
|
|
44
|
+
message: /* @__PURE__ */ jsxs(Typography.Text, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "make sure that you have turn on " }),
|
|
46
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: " in configuration for the Rsdoctor plugin." })
|
|
47
|
+
] }),
|
|
48
|
+
type: "info",
|
|
49
|
+
showIcon: true
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
CommonExecutionEmptyTips,
|
|
55
|
+
CommonExecutionsChart
|
|
56
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const LITTLE_PALETTE_COLORS = [
|
|
2
|
+
"#a8071a",
|
|
3
|
+
"#ad6800",
|
|
4
|
+
"#237804",
|
|
5
|
+
"#006d75",
|
|
6
|
+
"#ad8b00",
|
|
7
|
+
"#ad4e00",
|
|
8
|
+
"#5b8c00",
|
|
9
|
+
"#003eb3"
|
|
10
|
+
];
|
|
11
|
+
const PALETTE_COLORS = [
|
|
12
|
+
"#4096ff",
|
|
13
|
+
"#69b1ff",
|
|
14
|
+
"#9e1068",
|
|
15
|
+
"#722ed1",
|
|
16
|
+
"#bae0ff",
|
|
17
|
+
"#d3adf7",
|
|
18
|
+
"#597ef7",
|
|
19
|
+
"#ffadd2",
|
|
20
|
+
"#c41d7f",
|
|
21
|
+
"#391085",
|
|
22
|
+
"#ffa940",
|
|
23
|
+
"#5c060b",
|
|
24
|
+
"#a81414",
|
|
25
|
+
"#ff7875",
|
|
26
|
+
"#ffd591",
|
|
27
|
+
"#ffe58f",
|
|
28
|
+
"#d3f261",
|
|
29
|
+
"#d4b106",
|
|
30
|
+
"#7cb305",
|
|
31
|
+
"#f4ffb8",
|
|
32
|
+
"#fa8c16",
|
|
33
|
+
"#0958d9",
|
|
34
|
+
"#fff3f0",
|
|
35
|
+
"#82090d",
|
|
36
|
+
"#ffbfb3",
|
|
37
|
+
"#f44336",
|
|
38
|
+
"#ff998a",
|
|
39
|
+
"#ff7161",
|
|
40
|
+
"#ffe2db",
|
|
41
|
+
"#cf2923"
|
|
42
|
+
];
|
|
43
|
+
export {
|
|
44
|
+
LITTLE_PALETTE_COLORS,
|
|
45
|
+
PALETTE_COLORS
|
|
46
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Divider, Space } from "antd";
|
|
3
|
+
import { BarChartOutlined } from "@ant-design/icons";
|
|
4
|
+
import { SDK } from "@rsdoctor/types";
|
|
5
|
+
import { Summary } from "@rsdoctor/utils/common";
|
|
6
|
+
import { TextDrawer } from "../TextDrawer";
|
|
7
|
+
import { Card } from "../Card";
|
|
8
|
+
import { CommonExecutionsChart, CommonExecutionEmptyTips } from "./common";
|
|
9
|
+
import { WebpackPluginsDataTable } from "../Plugins/webpack";
|
|
10
|
+
import { ServerAPIProvider } from "../Manifest";
|
|
11
|
+
import "./loader.css";
|
|
12
|
+
import "./tooltips.css";
|
|
13
|
+
const DoneChartContainer = ({ summary }) => {
|
|
14
|
+
const { costs = [] } = summary || {};
|
|
15
|
+
const target = costs.find((e) => e.name === Summary.SummaryCostsDataName.Done);
|
|
16
|
+
const hooks = [
|
|
17
|
+
"afterCompile",
|
|
18
|
+
"shouldEmit",
|
|
19
|
+
"emit",
|
|
20
|
+
"afterEmit",
|
|
21
|
+
"assetEmitted",
|
|
22
|
+
"done"
|
|
23
|
+
];
|
|
24
|
+
const suffix = 'of the "AfterCompile -> Done" stage';
|
|
25
|
+
if (!target)
|
|
26
|
+
return null;
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
TextDrawer,
|
|
29
|
+
{
|
|
30
|
+
drawerProps: { title: `Details ${suffix}` },
|
|
31
|
+
text: /* @__PURE__ */ jsxs(Space, { children: [
|
|
32
|
+
"detail",
|
|
33
|
+
/* @__PURE__ */ jsx(BarChartOutlined, {})
|
|
34
|
+
] }),
|
|
35
|
+
children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetPluginData, body: { hooks }, children: (res) => res && res.length ? /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Card, { title: `Plugin DataSource of ${suffix}`, collapsable: true, children: /* @__PURE__ */ jsx(WebpackPluginsDataTable, { dataSource: res }) }),
|
|
37
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
38
|
+
/* @__PURE__ */ jsx(Card, { title: `Chart ${suffix}`, children: /* @__PURE__ */ jsx(CommonExecutionsChart, { plugins: res }) })
|
|
39
|
+
] }) : /* @__PURE__ */ jsx(CommonExecutionEmptyTips, {}) })
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
DoneChartContainer
|
|
45
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SDK } from '@rsdoctor/types';
|
|
3
|
+
export declare const LoaderChartBase: React.FC<{
|
|
4
|
+
project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const LoaderChart: React.FC<Omit<{
|
|
7
|
+
project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
|
|
8
|
+
}, "project"> & Partial<{
|
|
9
|
+
body?: any;
|
|
10
|
+
}>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Space } from "antd";
|
|
4
|
+
import { SDK } from "@rsdoctor/types";
|
|
5
|
+
import { LoaderCommonSelect } from "../Select";
|
|
6
|
+
import { ServerAPIProvider, withServerAPI } from "../Manifest";
|
|
7
|
+
import { LoaderExecutionsChart } from "./loader";
|
|
8
|
+
import { filterLoader } from "../../utils/loader";
|
|
9
|
+
var ChartDimension = /* @__PURE__ */ ((ChartDimension2) => {
|
|
10
|
+
ChartDimension2[ChartDimension2["Loader"] = 0] = "Loader";
|
|
11
|
+
ChartDimension2[ChartDimension2["Process"] = 1] = "Process";
|
|
12
|
+
return ChartDimension2;
|
|
13
|
+
})(ChartDimension || {});
|
|
14
|
+
const LoaderChartBase = ({ project }) => {
|
|
15
|
+
const { root: cwd } = project;
|
|
16
|
+
const [store, setStore] = useState({ filename: "", loaders: [] });
|
|
17
|
+
const [dimension, setDimension] = useState(0 /* Loader */);
|
|
18
|
+
return /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderNames, children: (loaderNames) => /* @__PURE__ */ jsx(LoaderCommonSelect, { onChange: setStore, loaderNames }) }),
|
|
20
|
+
/* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderChartData, children: (res) => {
|
|
21
|
+
const loaders = res.filter((el) => filterLoader(el.resource, el.loader, store.filename, store.loaders));
|
|
22
|
+
return dimension === 0 /* Loader */ ? /* @__PURE__ */ jsx(LoaderExecutionsChart, { loaders, cwd }) : (
|
|
23
|
+
// <ProcessExecutionsChart loaders={loaders} cwd={cwd} pid={pid} />
|
|
24
|
+
/* @__PURE__ */ jsx(Fragment, {})
|
|
25
|
+
);
|
|
26
|
+
} })
|
|
27
|
+
] });
|
|
28
|
+
};
|
|
29
|
+
const LoaderChart = withServerAPI({
|
|
30
|
+
api: SDK.ServerAPI.API.GetProjectInfo,
|
|
31
|
+
responsePropName: "project",
|
|
32
|
+
Component: LoaderChartBase
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
LoaderChart,
|
|
36
|
+
LoaderChartBase
|
|
37
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.loader-chart-container .x-axis .tick text {
|
|
2
|
+
transform: translate(28px, 10px) rotate(0) !important;
|
|
3
|
+
font-size: 12px;
|
|
4
|
+
font-weight: 500;
|
|
5
|
+
}
|
|
6
|
+
.loader-chart-container:nth-child(2) text {
|
|
7
|
+
transform: translate(52px, 10px) rotate(0) !important;
|
|
8
|
+
}
|
|
9
|
+
.loader-chart-container:last-child text {
|
|
10
|
+
transform: translate(5px, 10px) rotate(0) !important;
|
|
11
|
+
}
|
|
12
|
+
.loader-chart-container .area .civ {
|
|
13
|
+
transform: translateY(5px);
|
|
14
|
+
}
|
|
15
|
+
.loader-chart-container .area .civ .label-text {
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
font-size: 12px !important;
|
|
18
|
+
transform: translate(8px, 0px);
|
|
19
|
+
}
|
|
20
|
+
.loader-chart-container .area .civ path[fill="#000000"] {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
.loader-chart-container .pia-metrics-y-label {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
.loader-chart-container .pia-metrics-y-label .triangle {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
.loader-chart-container_dark .area .civ .label-text {
|
|
30
|
+
fill: #fff !important;
|
|
31
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
useCallback,
|
|
4
|
+
useMemo,
|
|
5
|
+
useRef,
|
|
6
|
+
useEffect,
|
|
7
|
+
useState
|
|
8
|
+
} from "react";
|
|
9
|
+
import { groupBy } from "lodash-es";
|
|
10
|
+
import { Empty } from "antd";
|
|
11
|
+
import "./loader.css";
|
|
12
|
+
import { useTheme } from "../../utils/manifest";
|
|
13
|
+
import { findLoaderTotalTiming } from "../../utils/loader";
|
|
14
|
+
import { beautifyPath } from "../../utils/file";
|
|
15
|
+
import { TimelineCom } from "./TimelineCharts";
|
|
16
|
+
import {
|
|
17
|
+
renderTotalLoadersTooltip,
|
|
18
|
+
getTooltipHtmlForLoader,
|
|
19
|
+
useDebounceHook
|
|
20
|
+
} from "./utils";
|
|
21
|
+
const LoaderExecutionsChart = ({
|
|
22
|
+
loaders,
|
|
23
|
+
cwd
|
|
24
|
+
}) => {
|
|
25
|
+
const { isDark } = useTheme();
|
|
26
|
+
const ref = useRef(null);
|
|
27
|
+
const [data, setData] = useState([]);
|
|
28
|
+
const durationMetricData = useDebounceHook(data, 200);
|
|
29
|
+
const groupByLoader = useMemo(
|
|
30
|
+
() => groupBy(loaders, (e) => e.loader),
|
|
31
|
+
[loaders]
|
|
32
|
+
);
|
|
33
|
+
const formatterForLoader = useCallback((raw) => {
|
|
34
|
+
const { name, data: data2 } = raw;
|
|
35
|
+
const loaderName = name.replace(" total", "");
|
|
36
|
+
if (data2?.ext) {
|
|
37
|
+
return getTooltipHtmlForLoader(data2.ext);
|
|
38
|
+
}
|
|
39
|
+
return renderTotalLoadersTooltip(loaderName, loaders, cwd);
|
|
40
|
+
}, []);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const _data = Object.keys(groupByLoader).map(
|
|
43
|
+
(loaderName) => {
|
|
44
|
+
const list = groupByLoader[loaderName] || [];
|
|
45
|
+
const { start, end } = findLoaderTotalTiming(list);
|
|
46
|
+
return {
|
|
47
|
+
p: loaderName,
|
|
48
|
+
n: loaderName,
|
|
49
|
+
s: start,
|
|
50
|
+
e: end,
|
|
51
|
+
c: list.map((e) => {
|
|
52
|
+
return {
|
|
53
|
+
p: loaderName,
|
|
54
|
+
// n: loaderName,
|
|
55
|
+
n: beautifyPath(e.resource, cwd),
|
|
56
|
+
s: e.startAt,
|
|
57
|
+
e: e.endAt,
|
|
58
|
+
ext: e
|
|
59
|
+
};
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
setData(_data);
|
|
65
|
+
}, [groupByLoader]);
|
|
66
|
+
return /* @__PURE__ */ jsx(Fragment, { children: data?.length ? /* @__PURE__ */ jsx(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: [
|
|
70
|
+
"loader-chart-container",
|
|
71
|
+
isDark ? "loader-chart-container_dark" : ""
|
|
72
|
+
].join(" ").trim(),
|
|
73
|
+
ref,
|
|
74
|
+
style: { width: "100%", height: "600px" },
|
|
75
|
+
children: /* @__PURE__ */ jsx(
|
|
76
|
+
TimelineCom,
|
|
77
|
+
{
|
|
78
|
+
loaderData: durationMetricData,
|
|
79
|
+
formatterFn: formatterForLoader,
|
|
80
|
+
chartType: "loader"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
) : /* @__PURE__ */ jsx(Empty, {}) });
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
LoaderExecutionsChart
|
|
88
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BarChartOutlined } from "@ant-design/icons";
|
|
3
|
+
import { SDK } from "@rsdoctor/types";
|
|
4
|
+
import { Divider, Space } from "antd";
|
|
5
|
+
import { TextDrawer } from "../TextDrawer";
|
|
6
|
+
import { Summary } from "@rsdoctor/utils/common";
|
|
7
|
+
import { Card } from "../Card";
|
|
8
|
+
import { ServerAPIProvider } from "../Manifest";
|
|
9
|
+
import { WebpackPluginsDataTable } from "../Plugins/webpack";
|
|
10
|
+
import { CommonExecutionEmptyTips, CommonExecutionsChart } from "./common";
|
|
11
|
+
import "./loader.css";
|
|
12
|
+
import "./tooltips.css";
|
|
13
|
+
const MinifyChartContainer = ({ summary }) => {
|
|
14
|
+
const hooks = ["processAssets", "optimizeChunkAssets"];
|
|
15
|
+
const { costs = [] } = summary || {};
|
|
16
|
+
const target = costs.find((e) => e.name === Summary.SummaryCostsDataName.Minify);
|
|
17
|
+
if (!target)
|
|
18
|
+
return null;
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
TextDrawer,
|
|
21
|
+
{
|
|
22
|
+
drawerProps: { title: 'Details of the "Minify" stage' },
|
|
23
|
+
text: /* @__PURE__ */ jsxs(Space, { children: [
|
|
24
|
+
"detail",
|
|
25
|
+
/* @__PURE__ */ jsx(BarChartOutlined, {})
|
|
26
|
+
] }),
|
|
27
|
+
children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetPluginData, body: { hooks }, children: (res) => res && res.length ? /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
28
|
+
/* @__PURE__ */ jsx(Card, { title: 'Plugin DataSource of the "Minify"', collapsable: true, children: /* @__PURE__ */ jsx(WebpackPluginsDataTable, { dataSource: res }) }),
|
|
29
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
30
|
+
/* @__PURE__ */ jsx(Card, { title: 'Chart of the "Minify"', children: /* @__PURE__ */ jsx(CommonExecutionsChart, { plugins: res }) })
|
|
31
|
+
] }) : /* @__PURE__ */ jsx(CommonExecutionEmptyTips, {}) })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
MinifyChartContainer
|
|
37
|
+
};
|