@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,330 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as Bdg, SizePercent } from "@rsdoctor/components/elements";
|
|
3
|
+
import { formatSize } from "@rsdoctor/components/utils";
|
|
4
|
+
import {
|
|
5
|
+
Col,
|
|
6
|
+
Divider,
|
|
7
|
+
Empty,
|
|
8
|
+
Row,
|
|
9
|
+
Select,
|
|
10
|
+
Space,
|
|
11
|
+
Table,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Typography
|
|
14
|
+
} from "antd";
|
|
15
|
+
import { sumBy, uniq, values } from "lodash-es";
|
|
16
|
+
import { useMemo, useState } from "react";
|
|
17
|
+
import { UpdateType } from "./constants";
|
|
18
|
+
import { FileUpdateTypeTag } from "./modules";
|
|
19
|
+
import { Size } from "../../../constants";
|
|
20
|
+
const getChangedType = (data) => {
|
|
21
|
+
if (data.baseline && data.current) {
|
|
22
|
+
const bvs = data.baseline.map((e) => e.version).sort().join();
|
|
23
|
+
const dcs = data.current.map((e) => e.version).sort().join();
|
|
24
|
+
return bvs === dcs ? UpdateType.NotChanged : UpdateType.Changed;
|
|
25
|
+
}
|
|
26
|
+
if (!data.baseline && !data.current) {
|
|
27
|
+
return UpdateType.NotChanged;
|
|
28
|
+
}
|
|
29
|
+
if (data.baseline && !data.current) {
|
|
30
|
+
return UpdateType.Deleted;
|
|
31
|
+
}
|
|
32
|
+
return UpdateType.New;
|
|
33
|
+
};
|
|
34
|
+
const isChanged = (data) => {
|
|
35
|
+
return getChangedType(data) !== UpdateType.NotChanged;
|
|
36
|
+
};
|
|
37
|
+
const PackagesStatistic = ({ dataSource }) => {
|
|
38
|
+
const { newCount, deleteCount, changedCount } = useMemo(() => {
|
|
39
|
+
return {
|
|
40
|
+
newCount: dataSource.filter((e) => e.updateType === UpdateType.New).length,
|
|
41
|
+
deleteCount: dataSource.filter((e) => e.updateType === UpdateType.Deleted).length,
|
|
42
|
+
changedCount: dataSource.filter(
|
|
43
|
+
(e) => e.updateType === UpdateType.Changed
|
|
44
|
+
).length
|
|
45
|
+
};
|
|
46
|
+
}, [dataSource]);
|
|
47
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Bdg,
|
|
50
|
+
{
|
|
51
|
+
label: "New",
|
|
52
|
+
value: newCount,
|
|
53
|
+
type: newCount > 0 ? "error" : "default",
|
|
54
|
+
tooltip: `Current has ${newCount} packages which not found in Baseline`
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Bdg,
|
|
59
|
+
{
|
|
60
|
+
label: "Deleted",
|
|
61
|
+
value: deleteCount,
|
|
62
|
+
type: deleteCount > 0 ? "error" : "default",
|
|
63
|
+
tooltip: `Current delete ${deleteCount} packages than Baseline`
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
Bdg,
|
|
68
|
+
{
|
|
69
|
+
label: "Changed",
|
|
70
|
+
value: changedCount,
|
|
71
|
+
type: changedCount > 0 ? "error" : "default",
|
|
72
|
+
tooltip: `Current has ${changedCount} changed packages than Baseline`
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] });
|
|
76
|
+
};
|
|
77
|
+
const getPackagesTableDataSource = ({
|
|
78
|
+
baseline,
|
|
79
|
+
current
|
|
80
|
+
}) => {
|
|
81
|
+
const { packages: bPkgs = [] } = baseline || {};
|
|
82
|
+
const { packages: cPkgs = [] } = current || {};
|
|
83
|
+
const res = {};
|
|
84
|
+
const setter = (pkg, type) => {
|
|
85
|
+
if (!res[pkg.name]) {
|
|
86
|
+
res[pkg.name] = { name: pkg.name, updateType: UpdateType.NotChanged };
|
|
87
|
+
}
|
|
88
|
+
if (!res[pkg.name][type]) {
|
|
89
|
+
res[pkg.name][type] = [];
|
|
90
|
+
}
|
|
91
|
+
res[pkg.name][type].push(pkg);
|
|
92
|
+
};
|
|
93
|
+
bPkgs.forEach((e) => setter(e, "baseline"));
|
|
94
|
+
cPkgs.forEach((e) => setter(e, "current"));
|
|
95
|
+
const pre = [];
|
|
96
|
+
const post = [];
|
|
97
|
+
values(res).forEach((a) => {
|
|
98
|
+
if (isChanged(a)) {
|
|
99
|
+
pre.push(a);
|
|
100
|
+
} else {
|
|
101
|
+
post.push(a);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return pre.concat(post).map((e) => {
|
|
105
|
+
return {
|
|
106
|
+
...e,
|
|
107
|
+
updateType: getChangedType(e)
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const Packages = ({ baseline, current }) => {
|
|
112
|
+
const { packages: bPkgs = [] } = baseline || {};
|
|
113
|
+
const { packages: cPkgs = [] } = current || {};
|
|
114
|
+
if (!bPkgs.length && !cPkgs.length) {
|
|
115
|
+
return /* @__PURE__ */ jsx(Empty, {});
|
|
116
|
+
}
|
|
117
|
+
const pkgNames = useMemo(() => {
|
|
118
|
+
return uniq(bPkgs.concat(cPkgs).map((e) => e.name));
|
|
119
|
+
}, [bPkgs, cPkgs]);
|
|
120
|
+
const [selectedPkgNames, setSelectedPkgNames] = useState([]);
|
|
121
|
+
const [selectedUpdateTypes, setSelectedUpdateTypes] = useState(
|
|
122
|
+
[]
|
|
123
|
+
);
|
|
124
|
+
const dataSource = useMemo(() => {
|
|
125
|
+
return getPackagesTableDataSource({ baseline, current });
|
|
126
|
+
}, [baseline, current]);
|
|
127
|
+
const filteredDataSource = useMemo(() => {
|
|
128
|
+
return dataSource.filter((e) => {
|
|
129
|
+
if (selectedUpdateTypes.length) {
|
|
130
|
+
return selectedUpdateTypes.indexOf(e.updateType) > -1;
|
|
131
|
+
}
|
|
132
|
+
if (selectedPkgNames.length) {
|
|
133
|
+
return selectedPkgNames.indexOf(e.name) > -1;
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
});
|
|
137
|
+
}, [dataSource, selectedPkgNames, selectedUpdateTypes]);
|
|
138
|
+
return /* @__PURE__ */ jsxs(Row, { gutter: [Size.BasePadding, Size.BasePadding], children: [
|
|
139
|
+
/* @__PURE__ */ jsx(Col, { span: 24, style: { marginTop: 16 }, children: /* @__PURE__ */ jsxs(Space, { wrap: true, children: [
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
Select,
|
|
142
|
+
{
|
|
143
|
+
mode: "multiple",
|
|
144
|
+
placeholder: "Filter by package names",
|
|
145
|
+
style: { width: 400 },
|
|
146
|
+
options: pkgNames.map((e) => {
|
|
147
|
+
const r = dataSource.find((el) => el.name === e);
|
|
148
|
+
if (r && isChanged(r)) {
|
|
149
|
+
return {
|
|
150
|
+
label: /* @__PURE__ */ jsxs(Space, { children: [
|
|
151
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: e }),
|
|
152
|
+
/* @__PURE__ */ jsx(FileUpdateTypeTag, { type: getChangedType(r) })
|
|
153
|
+
] }),
|
|
154
|
+
value: e
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
label: e,
|
|
159
|
+
value: e
|
|
160
|
+
};
|
|
161
|
+
}),
|
|
162
|
+
allowClear: true,
|
|
163
|
+
onChange: (e) => {
|
|
164
|
+
setSelectedPkgNames(e);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
Select,
|
|
170
|
+
{
|
|
171
|
+
mode: "multiple",
|
|
172
|
+
placeholder: "Filter by changed type",
|
|
173
|
+
style: { width: 200 },
|
|
174
|
+
options: values(UpdateType).map((e) => ({ label: e, value: e })),
|
|
175
|
+
allowClear: true,
|
|
176
|
+
onChange: (e) => {
|
|
177
|
+
setSelectedUpdateTypes(e);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] }) }),
|
|
182
|
+
/* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsx(
|
|
183
|
+
Table,
|
|
184
|
+
{
|
|
185
|
+
bordered: true,
|
|
186
|
+
sticky: { offsetHeader: 54 },
|
|
187
|
+
pagination: {
|
|
188
|
+
pageSize: 20,
|
|
189
|
+
size: "small"
|
|
190
|
+
},
|
|
191
|
+
dataSource: filteredDataSource,
|
|
192
|
+
rowKey: (e) => e.name,
|
|
193
|
+
columns: [
|
|
194
|
+
{
|
|
195
|
+
title: () => /* @__PURE__ */ jsxs(Space, { children: [
|
|
196
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "Package Name" }),
|
|
197
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
Tooltip,
|
|
200
|
+
{
|
|
201
|
+
title: `Filtered Package Count is ${filteredDataSource.length}, Total Package Count is ${dataSource.length}`,
|
|
202
|
+
children: /* @__PURE__ */ jsxs(
|
|
203
|
+
Typography.Text,
|
|
204
|
+
{
|
|
205
|
+
type: "secondary",
|
|
206
|
+
style: { fontSize: 10, fontWeight: 400 },
|
|
207
|
+
children: [
|
|
208
|
+
filteredDataSource.length,
|
|
209
|
+
" / ",
|
|
210
|
+
dataSource.length
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] }),
|
|
217
|
+
render: (_v, r) => {
|
|
218
|
+
if (r.updateType !== UpdateType.NotChanged) {
|
|
219
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
220
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: r.name }),
|
|
221
|
+
/* @__PURE__ */ jsx(FileUpdateTypeTag, { type: r.updateType })
|
|
222
|
+
] });
|
|
223
|
+
}
|
|
224
|
+
return r.name;
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
title: () => {
|
|
229
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
230
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "Current" }),
|
|
231
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
232
|
+
/* @__PURE__ */ jsx(PackagesStatistic, { dataSource })
|
|
233
|
+
] });
|
|
234
|
+
},
|
|
235
|
+
children: [
|
|
236
|
+
{
|
|
237
|
+
title: "Version",
|
|
238
|
+
render: (_v, r) => {
|
|
239
|
+
if (r.current) {
|
|
240
|
+
return /* @__PURE__ */ jsx(Space, { direction: "vertical", children: r.current.map((e) => /* @__PURE__ */ jsx(
|
|
241
|
+
Bdg,
|
|
242
|
+
{
|
|
243
|
+
label: "version",
|
|
244
|
+
value: e.version,
|
|
245
|
+
tooltip: e.root,
|
|
246
|
+
type: r.updateType === UpdateType.Deleted ? "error" : r.updateType === UpdateType.Changed ? "warn" : "default"
|
|
247
|
+
},
|
|
248
|
+
e.version
|
|
249
|
+
)) });
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
title: "Parsed Size",
|
|
256
|
+
render: (_v, r) => {
|
|
257
|
+
const parsedSize = sumBy(
|
|
258
|
+
r.current,
|
|
259
|
+
(e) => e.size.parsedSize
|
|
260
|
+
);
|
|
261
|
+
const DiffComponent = () => /* @__PURE__ */ jsx(
|
|
262
|
+
SizePercent,
|
|
263
|
+
{
|
|
264
|
+
baseline: sumBy(r.baseline, (e) => e.size.parsedSize),
|
|
265
|
+
current: parsedSize
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
if (r.current) {
|
|
269
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
Typography.Text,
|
|
272
|
+
{
|
|
273
|
+
strong: r.updateType !== UpdateType.NotChanged,
|
|
274
|
+
children: formatSize(parsedSize)
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
/* @__PURE__ */ jsx(DiffComponent, {})
|
|
278
|
+
] });
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ jsx(DiffComponent, {});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
title: "Baseline",
|
|
287
|
+
children: [
|
|
288
|
+
{
|
|
289
|
+
title: "Version",
|
|
290
|
+
render: (_v, r) => {
|
|
291
|
+
if (r.baseline) {
|
|
292
|
+
return /* @__PURE__ */ jsx(Space, { direction: "vertical", children: r.baseline.map((e) => /* @__PURE__ */ jsx(
|
|
293
|
+
Bdg,
|
|
294
|
+
{
|
|
295
|
+
label: "version",
|
|
296
|
+
value: e.version,
|
|
297
|
+
tooltip: e.root,
|
|
298
|
+
type: r.updateType === UpdateType.Deleted ? "error" : r.updateType === UpdateType.Changed ? "warn" : "default"
|
|
299
|
+
},
|
|
300
|
+
e.version
|
|
301
|
+
)) });
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
title: "Parsed Size",
|
|
308
|
+
render: (_v, r) => {
|
|
309
|
+
if (r.baseline) {
|
|
310
|
+
const parsedSize = sumBy(
|
|
311
|
+
r.baseline,
|
|
312
|
+
(e) => e.size.parsedSize
|
|
313
|
+
);
|
|
314
|
+
return /* @__PURE__ */ jsx(Typography.Text, { children: formatSize(parsedSize) });
|
|
315
|
+
}
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
) })
|
|
324
|
+
] });
|
|
325
|
+
};
|
|
326
|
+
export {
|
|
327
|
+
Packages,
|
|
328
|
+
PackagesStatistic,
|
|
329
|
+
getPackagesTableDataSource
|
|
330
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColumnGroupType, ColumnType } from 'antd/es/table/interface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BundleDiffComponentCardProps, BundleDiffTableAssetsData, BundleDiffTableModulesData } from './types';
|
|
4
|
+
export declare const ModuleHashPattern: RegExp;
|
|
5
|
+
export declare const getSizeColumnPropsForModuleRow: (key: 'baseline' | 'current', sizeKey: 'parsedSize' | 'sourceSize') => ColumnType<BundleDiffTableModulesData>;
|
|
6
|
+
export declare const getTargetColumnPropsForModuleRow: (key: 'baseline' | 'current', bMoudlesCount: number, cMoudlesCount: number) => ColumnGroupType<BundleDiffTableModulesData>;
|
|
7
|
+
export declare const ModuleRowForAsset: React.FC<{
|
|
8
|
+
data: BundleDiffTableAssetsData;
|
|
9
|
+
} & Pick<BundleDiffComponentCardProps, 'baseline' | 'current'>>;
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InfoCircleOutlined, SearchOutlined } from "@ant-design/icons";
|
|
3
|
+
import {
|
|
4
|
+
beautifyModulePath,
|
|
5
|
+
formatPercent,
|
|
6
|
+
formatSize
|
|
7
|
+
} from "@rsdoctor/components/utils";
|
|
8
|
+
import { Client } from "@rsdoctor/types";
|
|
9
|
+
import { Graph } from "@rsdoctor/utils/common";
|
|
10
|
+
import {
|
|
11
|
+
Button,
|
|
12
|
+
Divider,
|
|
13
|
+
Input,
|
|
14
|
+
Space,
|
|
15
|
+
Table,
|
|
16
|
+
Tag,
|
|
17
|
+
Tooltip,
|
|
18
|
+
Typography
|
|
19
|
+
} from "antd";
|
|
20
|
+
import { upperFirst } from "lodash-es";
|
|
21
|
+
import { useMemo, useRef, useState } from "react";
|
|
22
|
+
import { ViewChanges } from "./changes";
|
|
23
|
+
import { UpdateType } from "./constants";
|
|
24
|
+
import { FileUpdateTypeTag, getUpdateType } from "./modules";
|
|
25
|
+
import { formatDiffSize } from "./utils";
|
|
26
|
+
import { Color } from "../../../constants";
|
|
27
|
+
const ModuleHashPattern = /[a-fA-F0-9]{20,}/;
|
|
28
|
+
const getSizeColumnPropsForModuleRow = (key, sizeKey) => {
|
|
29
|
+
return {
|
|
30
|
+
width: 200,
|
|
31
|
+
sorter: (a, b) => (a[key]?.size[sizeKey] || 0) - (b[key]?.size[sizeKey] || 0),
|
|
32
|
+
render: (_v, r) => {
|
|
33
|
+
if (!r[key])
|
|
34
|
+
return "-";
|
|
35
|
+
const size = r[key].size[sizeKey];
|
|
36
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
37
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: formatSize(size) }),
|
|
38
|
+
key === "current" ? formatDiffSize(
|
|
39
|
+
r.baseline?.size[sizeKey] || 0,
|
|
40
|
+
size,
|
|
41
|
+
(r.baseline?.size[sizeKey] || 0) > size ? Client.RsdoctorClientDiffState.Down : Client.RsdoctorClientDiffState.Up
|
|
42
|
+
) : null
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const getTargetColumnPropsForModuleRow = (key, bMoudlesCount, cMoudlesCount) => {
|
|
48
|
+
const isB = key === "baseline";
|
|
49
|
+
return {
|
|
50
|
+
title: () => {
|
|
51
|
+
const count = isB ? bMoudlesCount : cMoudlesCount;
|
|
52
|
+
const title = upperFirst(key);
|
|
53
|
+
const diff = Graph.diffSize(bMoudlesCount, cMoudlesCount);
|
|
54
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: title }),
|
|
56
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Tooltip,
|
|
59
|
+
{
|
|
60
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
61
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
62
|
+
title,
|
|
63
|
+
" modules is ",
|
|
64
|
+
count
|
|
65
|
+
] }),
|
|
66
|
+
isB ? null : /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
67
|
+
"Percent is ",
|
|
68
|
+
formatPercent(diff.percent)
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Typography.Text,
|
|
74
|
+
{
|
|
75
|
+
type: "secondary",
|
|
76
|
+
style: { fontSize: 10, fontWeight: 400 },
|
|
77
|
+
children: count
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
81
|
+
] })
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] });
|
|
85
|
+
},
|
|
86
|
+
children: [
|
|
87
|
+
{
|
|
88
|
+
title: "Source Size",
|
|
89
|
+
...getSizeColumnPropsForModuleRow(key, "sourceSize")
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: "Parsed Size",
|
|
93
|
+
defaultSortOrder: isB ? void 0 : "descend",
|
|
94
|
+
...getSizeColumnPropsForModuleRow(key, "parsedSize")
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
filterSearch: true,
|
|
98
|
+
filters: [
|
|
99
|
+
{
|
|
100
|
+
text: "Show Changed",
|
|
101
|
+
value: UpdateType.NotChanged
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
text: "Show All",
|
|
105
|
+
value: "All"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
onFilter(v, r) {
|
|
109
|
+
return v === UpdateType.NotChanged ? getUpdateType(r) !== v : true;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const ModuleRowForAsset = ({ data, baseline, current }) => {
|
|
114
|
+
const { modules: bTotalModules } = baseline.moduleGraph;
|
|
115
|
+
const { modules: cTotalModules } = current.moduleGraph;
|
|
116
|
+
const { chunks: bToTalChunks } = baseline.chunkGraph;
|
|
117
|
+
const { chunks: cToTalChunks } = current.chunkGraph;
|
|
118
|
+
const bRoot = baseline.root;
|
|
119
|
+
const cRoot = current.root;
|
|
120
|
+
const [searchText, setSearchText] = useState("");
|
|
121
|
+
const searchInput = useRef(null);
|
|
122
|
+
const handleSearch = (selectedKeys, confirm) => {
|
|
123
|
+
confirm();
|
|
124
|
+
setSearchText(selectedKeys[0]);
|
|
125
|
+
};
|
|
126
|
+
const handleReset = (clearFilters) => {
|
|
127
|
+
clearFilters();
|
|
128
|
+
setSearchText("");
|
|
129
|
+
};
|
|
130
|
+
const isBaseline = "__is_baseline__";
|
|
131
|
+
const bModules = useMemo(
|
|
132
|
+
() => data.baseline ? Graph.getModulesByAsset(data.baseline, bToTalChunks, bTotalModules).map((e) => ({
|
|
133
|
+
...e,
|
|
134
|
+
[isBaseline]: true
|
|
135
|
+
})).filter((cModule) => !cModule.concatenationModules?.length) : [],
|
|
136
|
+
[data, baseline]
|
|
137
|
+
);
|
|
138
|
+
const cModules = useMemo(
|
|
139
|
+
() => data.current ? Graph.getModulesByAsset(data.current, cToTalChunks, cTotalModules).map((e) => ({
|
|
140
|
+
...e,
|
|
141
|
+
[isBaseline]: false
|
|
142
|
+
})).filter((cModule) => !cModule.concatenationModules?.length) : [],
|
|
143
|
+
[data, current]
|
|
144
|
+
);
|
|
145
|
+
const getPathInfo = (r) => beautifyModulePath(r.path, r[isBaseline] ? bRoot : cRoot);
|
|
146
|
+
const dataSource = useMemo(() => {
|
|
147
|
+
const mods = [...bModules, ...cModules];
|
|
148
|
+
const map = /* @__PURE__ */ new Map();
|
|
149
|
+
mods.forEach((mod) => {
|
|
150
|
+
const modPath = mod.webpackId?.replace(ModuleHashPattern, "") || mod.path?.replace(ModuleHashPattern, "");
|
|
151
|
+
let t = map.get(modPath);
|
|
152
|
+
if (!t) {
|
|
153
|
+
t = { path: modPath };
|
|
154
|
+
}
|
|
155
|
+
if (mod[isBaseline]) {
|
|
156
|
+
t.baseline = mod;
|
|
157
|
+
} else {
|
|
158
|
+
t.current = mod;
|
|
159
|
+
}
|
|
160
|
+
map.set(modPath, t);
|
|
161
|
+
});
|
|
162
|
+
return [...map.values()];
|
|
163
|
+
}, [bModules, cModules, searchText]);
|
|
164
|
+
const { bMoudlesCount, cMoudlesCount, totalCount } = useMemo(() => {
|
|
165
|
+
const fileNameFilter = (e) => getPathInfo(e).alias.indexOf(searchText) > -1;
|
|
166
|
+
let b = dataSource.filter((e) => e.baseline);
|
|
167
|
+
let c = dataSource.filter((e) => e.current);
|
|
168
|
+
let totalCount2 = dataSource.length;
|
|
169
|
+
if (searchText) {
|
|
170
|
+
b = b.filter(fileNameFilter);
|
|
171
|
+
c = c.filter(fileNameFilter);
|
|
172
|
+
totalCount2 = dataSource.filter(fileNameFilter).length;
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
bMoudlesCount: b.length,
|
|
176
|
+
cMoudlesCount: c.length,
|
|
177
|
+
totalCount: totalCount2
|
|
178
|
+
};
|
|
179
|
+
}, [dataSource, searchText]);
|
|
180
|
+
return /* @__PURE__ */ jsx(
|
|
181
|
+
Table,
|
|
182
|
+
{
|
|
183
|
+
dataSource,
|
|
184
|
+
rowKey: (e) => e.path,
|
|
185
|
+
size: "small",
|
|
186
|
+
pagination: {
|
|
187
|
+
size: "small"
|
|
188
|
+
},
|
|
189
|
+
bordered: true,
|
|
190
|
+
scroll: { x: 1500 },
|
|
191
|
+
columns: [
|
|
192
|
+
{
|
|
193
|
+
fixed: "left",
|
|
194
|
+
title: () => {
|
|
195
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
196
|
+
/* @__PURE__ */ jsxs(Typography.Text, { children: [
|
|
197
|
+
"Modules of ",
|
|
198
|
+
`"${data.alias}"`
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
201
|
+
/* @__PURE__ */ jsxs(
|
|
202
|
+
Tooltip,
|
|
203
|
+
{
|
|
204
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
205
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
206
|
+
"filtered modules: ",
|
|
207
|
+
totalCount
|
|
208
|
+
] }),
|
|
209
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
210
|
+
"total modules: ",
|
|
211
|
+
dataSource.length
|
|
212
|
+
] })
|
|
213
|
+
] }),
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ jsxs(
|
|
216
|
+
Typography.Text,
|
|
217
|
+
{
|
|
218
|
+
type: "secondary",
|
|
219
|
+
style: { fontSize: 10, fontWeight: 400, marginRight: 4 },
|
|
220
|
+
children: [
|
|
221
|
+
totalCount,
|
|
222
|
+
"/",
|
|
223
|
+
dataSource.length
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] });
|
|
232
|
+
},
|
|
233
|
+
filterDropdown({
|
|
234
|
+
setSelectedKeys,
|
|
235
|
+
selectedKeys,
|
|
236
|
+
confirm,
|
|
237
|
+
clearFilters
|
|
238
|
+
}) {
|
|
239
|
+
return /* @__PURE__ */ jsxs(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
style: { padding: 8 },
|
|
243
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
244
|
+
children: [
|
|
245
|
+
/* @__PURE__ */ jsx(
|
|
246
|
+
Input,
|
|
247
|
+
{
|
|
248
|
+
ref: searchInput,
|
|
249
|
+
placeholder: `Search by file name`,
|
|
250
|
+
value: selectedKeys[0],
|
|
251
|
+
onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
|
|
252
|
+
onPressEnter: () => handleSearch(selectedKeys, confirm),
|
|
253
|
+
style: { marginBottom: 8, display: "block" }
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ jsxs(Space, { children: [
|
|
257
|
+
/* @__PURE__ */ jsx(
|
|
258
|
+
Button,
|
|
259
|
+
{
|
|
260
|
+
type: "primary",
|
|
261
|
+
onClick: () => handleSearch(selectedKeys, confirm),
|
|
262
|
+
icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
|
|
263
|
+
size: "small",
|
|
264
|
+
style: { width: 90 },
|
|
265
|
+
children: "Search"
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
/* @__PURE__ */ jsx(
|
|
269
|
+
Button,
|
|
270
|
+
{
|
|
271
|
+
onClick: () => {
|
|
272
|
+
clearFilters && handleReset(clearFilters);
|
|
273
|
+
setSelectedKeys([]);
|
|
274
|
+
handleSearch([], confirm);
|
|
275
|
+
},
|
|
276
|
+
size: "small",
|
|
277
|
+
style: { width: 90 },
|
|
278
|
+
children: "Reset"
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
] })
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
},
|
|
286
|
+
filterSearch: true,
|
|
287
|
+
filterIcon: (filtered) => /* @__PURE__ */ jsxs(Space, { children: [
|
|
288
|
+
/* @__PURE__ */ jsx(
|
|
289
|
+
Typography.Text,
|
|
290
|
+
{
|
|
291
|
+
type: searchText ? void 0 : "secondary",
|
|
292
|
+
style: { fontWeight: 400 },
|
|
293
|
+
children: searchText || "Search by file name"
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
/* @__PURE__ */ jsx(
|
|
297
|
+
SearchOutlined,
|
|
298
|
+
{
|
|
299
|
+
style: { color: filtered ? Color.Blue : void 0 }
|
|
300
|
+
}
|
|
301
|
+
)
|
|
302
|
+
] }),
|
|
303
|
+
onFilterDropdownOpenChange: (visible) => {
|
|
304
|
+
if (visible) {
|
|
305
|
+
setTimeout(() => searchInput.current?.focus(), 100);
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
onFilter(v, r) {
|
|
309
|
+
return getPathInfo(r).alias.indexOf(v) > -1;
|
|
310
|
+
},
|
|
311
|
+
render: (_v, r) => {
|
|
312
|
+
const { alias, inNodeModules } = getPathInfo(r);
|
|
313
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
314
|
+
/* @__PURE__ */ jsx(Tooltip, { title: r.path, children: /* @__PURE__ */ jsx(Typography.Text, { copyable: { text: r.path }, children: alias }) }),
|
|
315
|
+
inNodeModules ? /* @__PURE__ */ jsx(Tag, { color: "warning", children: "node_modules" }) : null,
|
|
316
|
+
/* @__PURE__ */ jsx(FileUpdateTypeTag, { type: getUpdateType(r) })
|
|
317
|
+
] });
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
getTargetColumnPropsForModuleRow(
|
|
321
|
+
"current",
|
|
322
|
+
bMoudlesCount,
|
|
323
|
+
cMoudlesCount
|
|
324
|
+
),
|
|
325
|
+
getTargetColumnPropsForModuleRow(
|
|
326
|
+
"baseline",
|
|
327
|
+
bMoudlesCount,
|
|
328
|
+
cMoudlesCount
|
|
329
|
+
),
|
|
330
|
+
{
|
|
331
|
+
title: "Actions",
|
|
332
|
+
width: 200,
|
|
333
|
+
render: (_v, r) => {
|
|
334
|
+
return /* @__PURE__ */ jsx(Space, { direction: "vertical", style: { maxWidth: 170 }, children: /* @__PURE__ */ jsx(
|
|
335
|
+
ViewChanges,
|
|
336
|
+
{
|
|
337
|
+
text: "View Changes",
|
|
338
|
+
file: r.path,
|
|
339
|
+
data: [
|
|
340
|
+
{
|
|
341
|
+
baseline: baseline.moduleCodeMap[r.baseline?.id]?.source,
|
|
342
|
+
current: current.moduleCodeMap[r.current?.id]?.source,
|
|
343
|
+
group: "Source"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
baseline: baseline.moduleCodeMap[r.baseline?.id]?.transformed,
|
|
347
|
+
current: current.moduleCodeMap[r.current?.id]?.transformed,
|
|
348
|
+
group: "Transformed Source"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
baseline: baseline.moduleCodeMap[r.baseline?.id]?.parsedSource,
|
|
352
|
+
current: current.moduleCodeMap[r.current?.id]?.parsedSource,
|
|
353
|
+
group: "Parsed Source"
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
) });
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
};
|
|
364
|
+
export {
|
|
365
|
+
ModuleHashPattern,
|
|
366
|
+
ModuleRowForAsset,
|
|
367
|
+
getSizeColumnPropsForModuleRow,
|
|
368
|
+
getTargetColumnPropsForModuleRow
|
|
369
|
+
};
|