@rsdoctor/components 0.0.2-beta.0 → 0.0.2-beta.2
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/dist/components/Alert/change.js +2 -3
- package/dist/components/Alert/file-relation.js +1 -1
- package/dist/components/Alert/index.css +3 -0
- package/dist/components/Alert/link.js +1 -1
- package/dist/components/Alert/package-relation.js +8 -27
- package/dist/components/Alert/view.js +3 -4
- package/dist/components/Alerts/bundle.js +23 -9
- package/dist/components/Alerts/common.js +3 -20
- package/dist/components/Badge/index.js +11 -29
- package/dist/components/Card/diff.d.ts +2 -2
- package/dist/components/Card/diff.js +4 -33
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +6 -37
- package/dist/components/Card/size.d.ts +5 -0
- package/dist/components/Card/size.js +17 -9
- package/dist/components/Card/statistic.css +2 -1
- package/dist/components/Card/statistic.d.ts +3 -0
- package/dist/components/Card/statistic.js +6 -21
- package/dist/components/Charts/TimelineCharts/index.js +120 -127
- package/dist/components/Charts/common.js +1 -1
- package/dist/components/Charts/loader.js +9 -18
- package/dist/components/CodeViewer/diff.js +8 -26
- package/dist/components/CodeViewer/hightlight.js +3 -3
- package/dist/components/CodeViewer/viewer.js +4 -20
- package/dist/components/Configuration/{webpack.d.ts → builder.d.ts} +1 -1
- package/dist/components/Configuration/{webpack.js → builder.js} +6 -6
- package/dist/components/Configuration/index.d.ts +1 -1
- package/dist/components/Configuration/index.js +1 -1
- package/dist/components/FileTree/index.js +13 -24
- package/dist/components/Form/keyword.js +1 -17
- package/dist/components/Keyword/index.js +4 -36
- package/dist/components/Layout/builder-select.js +1 -1
- package/dist/components/Layout/header.js +2 -3
- package/dist/components/Layout/index.js +2 -2
- package/dist/components/Layout/menus.d.ts +1 -1
- package/dist/components/Layout/menus.js +11 -35
- package/dist/components/Loader/Analysis/files.js +8 -2
- package/dist/components/Loader/Analysis/index.d.ts +1 -1
- package/dist/components/Loader/executions.d.ts +1 -1
- package/dist/components/Loader/executions.js +62 -84
- package/dist/components/Manifest/api.d.ts +1 -1
- package/dist/components/Manifest/api.js +5 -35
- package/dist/components/Manifest/data.d.ts +1 -1
- package/dist/components/Manifest/data.js +1 -17
- package/dist/components/Opener/vscode.js +4 -19
- package/dist/components/Overall/bundle.js +2 -2
- package/dist/components/Overall/compile.js +1 -2
- package/dist/components/Resolver/analysis.js +1 -17
- package/dist/components/TextDrawer/duplicate.js +18 -56
- package/dist/components/TextDrawer/index.js +9 -28
- package/dist/components/worker/ecmaversion/client.js +1 -2
- package/dist/components/worker/ecmaversion/worker.js +3 -3
- package/dist/components/worker/jsequal/client.js +1 -2
- package/dist/components/worker/jsequal/worker.js +21 -50
- package/dist/config.d.ts +2 -2
- package/dist/config.js +3 -17
- package/dist/constants.d.ts +4 -2
- package/dist/constants.js +5 -1
- package/dist/pages/BundleSize/components/asset.js +74 -101
- package/dist/pages/BundleSize/components/cards.js +16 -27
- package/dist/pages/BundleSize/components/index.d.ts +1 -1
- package/dist/pages/BundleSize/components/index.js +57 -5
- package/dist/pages/BundleSize/constants.d.ts +1 -1
- package/dist/pages/BundleSize/constants.js +1 -1
- package/dist/pages/ModuleAnalyze/chunks.js +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +16 -7
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +6 -24
- package/dist/pages/ModuleAnalyze/constants.d.ts +1 -1
- package/dist/pages/ModuleAnalyze/constants.js +1 -1
- package/dist/pages/ModuleAnalyze/utils/hooks.js +5 -8
- package/dist/pages/ModuleAnalyze/utils/index.js +2 -4
- package/dist/pages/ModuleResolve/constants.d.ts +1 -1
- package/dist/pages/ModuleResolve/constants.js +1 -1
- package/dist/pages/Overall/constants.d.ts +1 -1
- package/dist/pages/Overall/constants.js +1 -1
- 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/WebpackLoaders/Analysis/constants.d.ts +1 -1
- package/dist/pages/WebpackLoaders/Analysis/constants.js +1 -1
- package/dist/pages/WebpackLoaders/Overall/constants.d.ts +2 -2
- package/dist/pages/WebpackLoaders/Overall/constants.js +2 -2
- package/dist/pages/WebpackLoaders/Overall/index.js +1 -1
- package/dist/pages/WebpackPlugins/constants.d.ts +2 -2
- package/dist/pages/WebpackPlugins/constants.js +2 -2
- package/dist/pages/index.d.ts +2 -1
- package/dist/pages/index.js +3 -1
- package/dist/utils/data/base.d.ts +7 -7
- package/dist/utils/data/base.js +2 -24
- package/dist/utils/data/index.d.ts +1 -1
- package/dist/utils/data/index.js +14 -36
- package/dist/utils/data/local.d.ts +1 -1
- package/dist/utils/data/local.js +32 -56
- package/dist/utils/data/remote.d.ts +1 -1
- package/dist/utils/data/remote.js +22 -46
- package/dist/utils/file.js +4 -4
- package/dist/utils/hooks.d.ts +16 -15
- package/dist/utils/hooks.js +33 -73
- package/dist/utils/i18n/cn.js +1 -1
- package/dist/utils/i18n/en.d.ts +1 -1
- package/dist/utils/i18n/en.js +1 -1
- package/dist/utils/manifest.d.ts +2 -2
- package/dist/utils/monaco.d.ts +4 -1
- package/dist/utils/monaco.js +26 -3
- package/dist/utils/request.d.ts +10 -10
- package/dist/utils/request.js +52 -101
- package/dist/utils/routes.d.ts +2 -2
- package/dist/utils/routes.js +2 -2
- package/dist/utils/storage.js +3 -3
- package/dist/utils/url.js +10 -28
- package/package.json +7 -4
- package/dist/assets/icon.7509d763.svg +0 -21
|
@@ -1,22 +1,3 @@
|
|
|
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
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
2
|
import { Button, Drawer } from "antd";
|
|
22
3
|
import React, { useState } from "react";
|
|
@@ -26,26 +7,26 @@ const TextDrawer = (props) => {
|
|
|
26
7
|
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
27
8
|
props.button ? /* @__PURE__ */ jsx("div", { onClick: () => setVisible(!visible), children: props.button }) : /* @__PURE__ */ jsx(
|
|
28
9
|
Button,
|
|
29
|
-
|
|
30
|
-
type: "link"
|
|
31
|
-
|
|
10
|
+
{
|
|
11
|
+
type: "link",
|
|
12
|
+
...props.buttonProps,
|
|
32
13
|
onClick: () => setVisible(!visible),
|
|
33
|
-
style:
|
|
14
|
+
style: { padding: 0, ...props.buttonStyle },
|
|
34
15
|
children: props.text
|
|
35
|
-
}
|
|
16
|
+
}
|
|
36
17
|
),
|
|
37
18
|
/* @__PURE__ */ jsx(
|
|
38
19
|
Drawer,
|
|
39
|
-
|
|
20
|
+
{
|
|
40
21
|
maskClosable: true,
|
|
41
22
|
width: drawerWidth,
|
|
42
|
-
zIndex: 999
|
|
43
|
-
|
|
23
|
+
zIndex: 999,
|
|
24
|
+
...props.drawerProps,
|
|
44
25
|
open: visible,
|
|
45
26
|
onClose: () => setVisible(false),
|
|
46
27
|
destroyOnClose: true,
|
|
47
28
|
children: props.children
|
|
48
|
-
}
|
|
29
|
+
}
|
|
49
30
|
)
|
|
50
31
|
] });
|
|
51
32
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const import_meta = {};
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
4
3
|
import { BadgeColorMap, BadgeType } from "../../Badge";
|
|
5
4
|
import { ECMAVersion } from "@rsdoctor/utils/ruleUtils";
|
|
6
5
|
import { master } from "../../../utils/worker";
|
|
7
|
-
const getECMAVersionDetectWorker = () => new Worker(new URL("./worker.
|
|
6
|
+
const getECMAVersionDetectWorker = () => new Worker(new URL("./worker.js", import.meta.url));
|
|
8
7
|
function useECMAVersionDetectWorker(props) {
|
|
9
8
|
const { code } = props;
|
|
10
9
|
const [version, setVersion] = useState();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const { parser, ECMAVersion } = require("@rsdoctor/utils/ruleUtils");
|
|
2
|
+
const { handleMessageInWorker } = require("../../../utils/worker");
|
|
3
3
|
const cache = /* @__PURE__ */ new Map();
|
|
4
4
|
handleMessageInWorker({
|
|
5
5
|
workerName: "ecmaversion",
|
|
6
6
|
handler: (code) => {
|
|
7
7
|
if (cache.has(code))
|
|
8
|
-
return cache.get(code);
|
|
8
|
+
return cache.get(code) || "";
|
|
9
9
|
const version = parser.utils.detectECMAVersion(code);
|
|
10
10
|
cache.set(code, version);
|
|
11
11
|
return version;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const import_meta = {};
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
4
3
|
import { Tag } from "antd";
|
|
5
4
|
import { master } from "../../../utils/worker";
|
|
6
5
|
import { useI18n } from "../../../utils";
|
|
7
|
-
const getJSEqualWorker = () => new Worker(new URL("./worker.
|
|
6
|
+
const getJSEqualWorker = () => new Worker(new URL("./worker.js", import.meta.url));
|
|
8
7
|
function useJSEqualWorker(props) {
|
|
9
8
|
const { input, output } = props;
|
|
10
9
|
const [isEqual, setIsEqual] = useState(false);
|
|
@@ -1,52 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
import { minify as terserMinify } from "terser";
|
|
26
|
-
import { handleMessageInWorker } from "../../../utils/worker";
|
|
27
|
-
var require_worker = __commonJS({
|
|
28
|
-
"src/components/worker/jsequal/worker.ts"(exports) {
|
|
29
|
-
const cache = /* @__PURE__ */ new Map();
|
|
30
|
-
function minify(code) {
|
|
31
|
-
return terserMinify(code, {
|
|
32
|
-
module: true,
|
|
33
|
-
compress: false,
|
|
34
|
-
mangle: false,
|
|
35
|
-
sourceMap: false
|
|
36
|
-
}).then((res) => res.code);
|
|
37
|
-
}
|
|
38
|
-
handleMessageInWorker({
|
|
39
|
-
workerName: "jsequal",
|
|
40
|
-
handler: (_0) => __async(exports, [_0], function* ({ input = "", output = "" }) {
|
|
41
|
-
const key = input + output;
|
|
42
|
-
if (cache.has(key))
|
|
43
|
-
return cache.get(key);
|
|
44
|
-
const [inputMinified, outputMinified] = yield Promise.all([minify(input), minify(output)]);
|
|
45
|
-
const isEqual = inputMinified === outputMinified;
|
|
46
|
-
cache.set(key, isEqual);
|
|
47
|
-
return isEqual;
|
|
48
|
-
})
|
|
49
|
-
});
|
|
1
|
+
const { minify: terserMinify } = require("terser");
|
|
2
|
+
const { handleMessageInWorker } = require("../../../utils/worker");
|
|
3
|
+
const cache = /* @__PURE__ */ new Map();
|
|
4
|
+
function minify(code) {
|
|
5
|
+
return terserMinify(code, {
|
|
6
|
+
module: true,
|
|
7
|
+
compress: false,
|
|
8
|
+
mangle: false,
|
|
9
|
+
sourceMap: false
|
|
10
|
+
}).then((res) => res.code);
|
|
11
|
+
}
|
|
12
|
+
handleMessageInWorker({
|
|
13
|
+
workerName: "jsequal",
|
|
14
|
+
handler: async ({ input = "", output = "" }) => {
|
|
15
|
+
const key = input + output;
|
|
16
|
+
if (cache.has(key))
|
|
17
|
+
return cache.get(key) || "";
|
|
18
|
+
const [inputMinified, outputMinified] = await Promise.all([minify(input), minify(output)]);
|
|
19
|
+
const isEqual = inputMinified === outputMinified;
|
|
20
|
+
cache.set(key, isEqual);
|
|
21
|
+
return isEqual;
|
|
50
22
|
}
|
|
51
23
|
});
|
|
52
|
-
export default require_worker();
|
package/dist/config.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ export interface Config {
|
|
|
9
9
|
bundleAlerts: ViewMode;
|
|
10
10
|
compileAlerts: ViewMode;
|
|
11
11
|
};
|
|
12
|
-
json: Manifest.
|
|
12
|
+
json: Manifest.RsdoctorManifest;
|
|
13
13
|
setTheme(theme: Config['theme']): void;
|
|
14
|
-
setManifest(json: Manifest.
|
|
14
|
+
setManifest(json: Manifest.RsdoctorManifest): void;
|
|
15
15
|
setPageState(state: PageState): void;
|
|
16
16
|
setViewMode(mode: Partial<Config['viewMode']>, saveStorage?: boolean): void;
|
|
17
17
|
}
|
package/dist/config.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
1
|
import { createContext } from "react";
|
|
18
2
|
import { getLocaleFromStorage, getThemeFromStorage, getViewModeFromStorage } from "./utils/storage";
|
|
19
3
|
import { PageState } from "./constants";
|
|
@@ -32,7 +16,9 @@ const defaultConfig = {
|
|
|
32
16
|
setViewMode() {
|
|
33
17
|
}
|
|
34
18
|
};
|
|
35
|
-
const ConfigContext = createContext(
|
|
19
|
+
const ConfigContext = createContext({
|
|
20
|
+
...defaultConfig
|
|
21
|
+
});
|
|
36
22
|
export {
|
|
37
23
|
ConfigContext,
|
|
38
24
|
defaultConfig
|
package/dist/constants.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare enum Size {
|
|
|
32
32
|
NavBarHeight = 54,
|
|
33
33
|
}
|
|
34
34
|
export declare enum Color {
|
|
35
|
-
Red = "
|
|
35
|
+
Red = "#e17055",
|
|
36
36
|
Green = "#52c41a",
|
|
37
37
|
Yellow = "#faad14",
|
|
38
38
|
Blue = "#1677ff",
|
|
@@ -45,4 +45,6 @@ export declare const TAG_PALLETE: {
|
|
|
45
45
|
COLOR_D: string;
|
|
46
46
|
COLOR_E: string;
|
|
47
47
|
DARK_BLUE: string;
|
|
48
|
-
};
|
|
48
|
+
};
|
|
49
|
+
export declare const MAIN_BG = "";
|
|
50
|
+
export declare const ROOT_BG_COLOR = "rgb(105, 177, 255)";
|
package/dist/constants.js
CHANGED
|
@@ -39,7 +39,7 @@ var Size = /* @__PURE__ */ ((Size2) => {
|
|
|
39
39
|
return Size2;
|
|
40
40
|
})(Size || {});
|
|
41
41
|
var Color = /* @__PURE__ */ ((Color2) => {
|
|
42
|
-
Color2["Red"] = "
|
|
42
|
+
Color2["Red"] = "#e17055";
|
|
43
43
|
Color2["Green"] = "#52c41a";
|
|
44
44
|
Color2["Yellow"] = "#faad14";
|
|
45
45
|
Color2["Blue"] = "#1677ff";
|
|
@@ -57,12 +57,16 @@ const TAG_PALLETE = {
|
|
|
57
57
|
COLOR_E: "#2E7CBE",
|
|
58
58
|
DARK_BLUE: "#1554ad"
|
|
59
59
|
};
|
|
60
|
+
const MAIN_BG = "";
|
|
61
|
+
const ROOT_BG_COLOR = "rgb(105, 177, 255)";
|
|
60
62
|
export {
|
|
61
63
|
APILoaderMode4Dev,
|
|
62
64
|
Color,
|
|
63
65
|
ComponentState,
|
|
64
66
|
Language,
|
|
67
|
+
MAIN_BG,
|
|
65
68
|
PageState,
|
|
69
|
+
ROOT_BG_COLOR,
|
|
66
70
|
Size,
|
|
67
71
|
TAG_PALLETE,
|
|
68
72
|
Theme,
|
|
@@ -1,28 +1,9 @@
|
|
|
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
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
import {
|
|
2
|
+
import { CodepenCircleOutlined, ColumnHeightOutlined, DeploymentUnitOutlined, InfoCircleOutlined } from "@ant-design/icons";
|
|
22
3
|
import Editor from "@monaco-editor/react";
|
|
23
4
|
import { SDK } from "@rsdoctor/types";
|
|
24
5
|
import { Button, Card, Col, Divider, Drawer, Empty, Popover, Row, Space, Tag, Tooltip, Typography } from "antd";
|
|
25
|
-
import { sumBy } from "lodash-es";
|
|
6
|
+
import { omitBy, sumBy } from "lodash-es";
|
|
26
7
|
import { dirname, relative } from "path";
|
|
27
8
|
import { useEffect, useMemo, useState } from "react";
|
|
28
9
|
import { ServerAPIProvider } from "../../../components/Manifest";
|
|
@@ -38,16 +19,20 @@ import { ModuleGraphListContext } from "../config";
|
|
|
38
19
|
let expanedModulesKeys = [];
|
|
39
20
|
const TAB_MAP = {
|
|
40
21
|
source: "source code",
|
|
41
|
-
transformed: "
|
|
42
|
-
parsedSource: "
|
|
22
|
+
transformed: "Transformed Code (After compile)",
|
|
23
|
+
parsedSource: "Bundled Code (After bundle and tree-shaking)"
|
|
24
|
+
};
|
|
25
|
+
const tagStyle = {
|
|
26
|
+
"margin": "none",
|
|
27
|
+
"marginInlineEnd": 0
|
|
43
28
|
};
|
|
44
29
|
const ModuleCodeViewer = ({ data }) => {
|
|
45
|
-
const [tab, setTab] = useState("
|
|
30
|
+
const [tab, setTab] = useState("source");
|
|
46
31
|
const { t } = useI18n();
|
|
47
32
|
const TAB_LAB_MAP = {
|
|
48
|
-
source: "
|
|
49
|
-
transformed: `
|
|
50
|
-
parsedSource: `
|
|
33
|
+
source: "Source Code",
|
|
34
|
+
transformed: `Transformed Code(${t("After Compile")})`,
|
|
35
|
+
parsedSource: `Bundled Code(${t("After Bundled")})`
|
|
51
36
|
};
|
|
52
37
|
if (!data)
|
|
53
38
|
return null;
|
|
@@ -58,7 +43,7 @@ const ModuleCodeViewer = ({ data }) => {
|
|
|
58
43
|
text: "",
|
|
59
44
|
buttonProps: {
|
|
60
45
|
size: "small",
|
|
61
|
-
icon: /* @__PURE__ */ jsx(
|
|
46
|
+
icon: /* @__PURE__ */ jsx(CodepenCircleOutlined, {}),
|
|
62
47
|
type: "default"
|
|
63
48
|
},
|
|
64
49
|
buttonStyle: { padding: `0 4px` },
|
|
@@ -66,45 +51,47 @@ const ModuleCodeViewer = ({ data }) => {
|
|
|
66
51
|
destroyOnClose: true,
|
|
67
52
|
title: `Code of "${path}"`
|
|
68
53
|
},
|
|
69
|
-
children: /* @__PURE__ */ jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
tab:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
54
|
+
children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetModuleCodeByModuleId, body: { moduleId: data.id }, children: (source) => {
|
|
55
|
+
return /* @__PURE__ */ jsx(Fragment, { children: !source["source"] && !source["parsedSource"] && !source["transformed"] ? /* @__PURE__ */ jsx(Empty, { description: "No Code. Rspack builder not support code yet. And if you upload the stats.json to analysis, it's also no code to show." }) : /* @__PURE__ */ jsx(
|
|
56
|
+
Card,
|
|
57
|
+
{
|
|
58
|
+
className: "code-size-card",
|
|
59
|
+
style: { width: "100%" },
|
|
60
|
+
tabList: Object.keys(omitBy(source, (s) => !s)).map((k) => ({ tab: k })).map(
|
|
61
|
+
(e) => ({
|
|
62
|
+
...e,
|
|
63
|
+
tab: TAB_LAB_MAP[e.tab],
|
|
64
|
+
key: e.tab
|
|
65
|
+
})
|
|
66
|
+
),
|
|
67
|
+
onTabChange: (v) => setTab(v),
|
|
68
|
+
tabBarExtraContent: /* @__PURE__ */ jsx(
|
|
69
|
+
Popover,
|
|
70
|
+
{
|
|
71
|
+
placement: "bottom",
|
|
72
|
+
title: /* @__PURE__ */ jsx(Typography.Title, { level: 5, children: "Explain" }),
|
|
73
|
+
content: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", marginBottom: 30 }, children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
75
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "source: " }),
|
|
76
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: TAB_MAP.source })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
79
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "transformed: " }),
|
|
80
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: TAB_MAP.transformed })
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
83
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "parsedSource: " }),
|
|
84
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: TAB_MAP.parsedSource })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
87
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "More" }),
|
|
88
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: t("CodeModeExplain") })
|
|
89
|
+
] }) }),
|
|
90
|
+
trigger: "hover",
|
|
91
|
+
children: /* @__PURE__ */ jsx("a", { href: "#", children: "Explain" })
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
children: /* @__PURE__ */ jsx(
|
|
108
95
|
Editor,
|
|
109
96
|
{
|
|
110
97
|
theme: "vs-dark",
|
|
@@ -121,10 +108,10 @@ const ModuleCodeViewer = ({ data }) => {
|
|
|
121
108
|
}
|
|
122
109
|
}
|
|
123
110
|
}
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
)
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
) });
|
|
114
|
+
} })
|
|
128
115
|
}
|
|
129
116
|
);
|
|
130
117
|
};
|
|
@@ -241,13 +228,11 @@ const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, mo
|
|
|
241
228
|
}
|
|
242
229
|
return res;
|
|
243
230
|
}, [includeModules, moduleKeyword, moduleSizeLimit]);
|
|
244
|
-
const avgSize = sumBy(includeModules, (e) => e.size.parsedSize || 0) / includeModules.length;
|
|
245
231
|
const fileStructures = useMemo(() => {
|
|
246
232
|
const res = createFileStructures({
|
|
247
233
|
files: filteredModules.map((e) => e.path).filter(Boolean),
|
|
248
234
|
inlinedResourcePathKey,
|
|
249
235
|
fileTitle(file, basename) {
|
|
250
|
-
var _a;
|
|
251
236
|
const mod = filteredModules.find((e) => e.path === file);
|
|
252
237
|
if (!mod)
|
|
253
238
|
return basename;
|
|
@@ -257,29 +242,28 @@ const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, mo
|
|
|
257
242
|
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
258
243
|
/* @__PURE__ */ jsx(Keyword, { ellipsis: true, style: { maxWidth: 500 }, text: basename, keyword: moduleKeyword }),
|
|
259
244
|
parsedSize !== 0 ? /* @__PURE__ */ jsx(
|
|
260
|
-
|
|
245
|
+
Tooltip,
|
|
261
246
|
{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
] })
|
|
247
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
248
|
+
/* @__PURE__ */ jsx(Tag, { color: "orange", children: "Parsed Size:" + formatSize(parsedSize) }),
|
|
249
|
+
/* @__PURE__ */ jsx(Tag, { color: "volcano", children: "Source Size:" + formatSize(sourceSize) })
|
|
250
|
+
] }),
|
|
251
|
+
color: "white",
|
|
252
|
+
children: /* @__PURE__ */ jsx(Tag, { color: "purple", style: tagStyle, children: "Parsed: " + formatSize(parsedSize) })
|
|
269
253
|
}
|
|
270
254
|
) : sourceSize !== 0 ? (
|
|
271
255
|
// fallback to display tag for source size
|
|
272
|
-
/* @__PURE__ */ jsx(
|
|
256
|
+
/* @__PURE__ */ jsx(Tag, { color: "geekblue", children: "Source Size:" + formatSize(sourceSize) })
|
|
273
257
|
) : null,
|
|
274
258
|
isConcatenation ? /* @__PURE__ */ jsx(
|
|
275
259
|
Tooltip,
|
|
276
260
|
{
|
|
277
261
|
title: /* @__PURE__ */ jsx(Space, { children: /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
278
262
|
"this is a concatenated module, it contains ",
|
|
279
|
-
|
|
263
|
+
mod.modules?.length,
|
|
280
264
|
" modules"
|
|
281
265
|
] }) }),
|
|
282
|
-
children: /* @__PURE__ */ jsx(Tag, { color: "
|
|
266
|
+
children: /* @__PURE__ */ jsx(Tag, { color: "green", style: tagStyle, children: "concatenated" })
|
|
283
267
|
}
|
|
284
268
|
) : null,
|
|
285
269
|
containedOtherModules && containedOtherModules.length ? /* @__PURE__ */ jsx(
|
|
@@ -307,7 +291,7 @@ const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, mo
|
|
|
307
291
|
return /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit" }, code: true, children: p[0] === "." ? p : `./${p}` }, id);
|
|
308
292
|
})
|
|
309
293
|
] }),
|
|
310
|
-
children: /* @__PURE__ */ jsx(Tag, { color: "
|
|
294
|
+
children: /* @__PURE__ */ jsx(Tag, { color: "green", children: "concatenated" })
|
|
311
295
|
}
|
|
312
296
|
) : null,
|
|
313
297
|
/* @__PURE__ */ jsx(
|
|
@@ -318,8 +302,7 @@ const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, mo
|
|
|
318
302
|
onClick: () => {
|
|
319
303
|
setModuleJumpList([mod.id]);
|
|
320
304
|
setShow(true);
|
|
321
|
-
}
|
|
322
|
-
children: "module explorer"
|
|
305
|
+
}
|
|
323
306
|
}
|
|
324
307
|
),
|
|
325
308
|
/* @__PURE__ */ jsx(ModuleCodeViewer, { data: mod })
|
|
@@ -329,20 +312,10 @@ const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, mo
|
|
|
329
312
|
const paths = getChildrenModule(dir);
|
|
330
313
|
if (paths.length) {
|
|
331
314
|
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
|
-
});
|
|
315
|
+
const parsedSize = sumBy(mods, (e) => e.size?.parsedSize || 0);
|
|
336
316
|
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
337
317
|
/* @__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
|
|
318
|
+
parsedSize > 0 ? /* @__PURE__ */ jsx(Tag, { style: tagStyle, color: "orange", children: "Parsed:" + formatSize(parsedSize) }) : null
|
|
346
319
|
] });
|
|
347
320
|
}
|
|
348
321
|
return defaultTitle;
|
|
@@ -374,7 +347,7 @@ const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, mo
|
|
|
374
347
|
treeData: fileStructures,
|
|
375
348
|
autoExpandParent: true,
|
|
376
349
|
defaultExpandParent: true,
|
|
377
|
-
defaultExpandedKeys:
|
|
350
|
+
defaultExpandedKeys: expanedModulesKeys?.length ? expanedModulesKeys : fileStructures.length === 1 ? [fileStructures[0].key] : [],
|
|
378
351
|
defaultExpandAll: defaultExpandAll || filteredModules.length <= 20
|
|
379
352
|
},
|
|
380
353
|
`tree_${moduleKeyword}_${defaultExpandAll}_${asset.path}`
|
|
@@ -388,7 +361,7 @@ const AssetDetail = ({ asset, chunks: includeChunks, modules: includeModules, mo
|
|
|
388
361
|
/* @__PURE__ */ jsx(
|
|
389
362
|
ModuleGraphViewer,
|
|
390
363
|
{
|
|
391
|
-
id:
|
|
364
|
+
id: moduleJumpList?.length ? moduleJumpList[moduleJumpList.length - 1] : "",
|
|
392
365
|
show,
|
|
393
366
|
setShow,
|
|
394
367
|
cwd: root
|
|
@@ -1,36 +1,20 @@
|
|
|
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
1
|
import { jsx } from "react/jsx-runtime";
|
|
21
2
|
import { createElement } from "react";
|
|
22
3
|
import { useState } from "react";
|
|
23
|
-
import { Col, Row, Segmented } from "antd";
|
|
24
|
-
import { useDuplicatePackagesByErrors } from "../../../utils";
|
|
4
|
+
import { Col, Row, Segmented, theme } from "antd";
|
|
5
|
+
import { useDuplicatePackagesByErrors, useWindowWidth } from "../../../utils";
|
|
25
6
|
import { Size } from "../../../constants";
|
|
26
7
|
import { StatisticCard } from "../../../components/Card/statistic";
|
|
27
8
|
import { DuplicatePackageDrawerWithServer } from "../../../components/TextDrawer";
|
|
28
9
|
import { SizeCard } from "../../../components/Card/size";
|
|
10
|
+
const { useToken } = theme;
|
|
29
11
|
const height = 100;
|
|
30
|
-
const AssetCard = ({ showProgress = false, data, total }) => {
|
|
31
|
-
|
|
12
|
+
const AssetCard = ({ showProgress = false, data, total, tagBgColor }) => {
|
|
13
|
+
const { token } = useToken();
|
|
14
|
+
const _tagBgColor = tagBgColor || token.colorPrimaryBorderHover;
|
|
15
|
+
return /* @__PURE__ */ jsx(SizeCard, { files: data.files, total, showProgress, tagBgColor: _tagBgColor });
|
|
32
16
|
};
|
|
33
|
-
const AssetCardContainer = ({ titles, datas }) => {
|
|
17
|
+
const AssetCardContainer = ({ titles, datas, bgColor }) => {
|
|
34
18
|
const [idx, setIdx] = useState(0);
|
|
35
19
|
return /* @__PURE__ */ jsx(
|
|
36
20
|
StatisticCard,
|
|
@@ -48,11 +32,15 @@ const AssetCardContainer = ({ titles, datas }) => {
|
|
|
48
32
|
value: titles[idx] || titles[0]
|
|
49
33
|
}
|
|
50
34
|
) : titles[idx],
|
|
51
|
-
value: datas.map((e, i) => /* @__PURE__ */ createElement(AssetCard,
|
|
35
|
+
value: datas.map((e, i) => /* @__PURE__ */ createElement(AssetCard, { ...e, key: i, tagBgColor: bgColor?.tagBgColor }))[idx],
|
|
36
|
+
boxProps: {
|
|
37
|
+
style: { background: bgColor?.bgColor }
|
|
38
|
+
}
|
|
52
39
|
}
|
|
53
40
|
);
|
|
54
41
|
};
|
|
55
42
|
const BundleCards = ({ cwd, errors, summary }) => {
|
|
43
|
+
const windowWith = useWindowWidth();
|
|
56
44
|
const duplicatePackages = useDuplicatePackagesByErrors(errors);
|
|
57
45
|
const arr = [
|
|
58
46
|
/* @__PURE__ */ jsx(
|
|
@@ -62,7 +50,8 @@ const BundleCards = ({ cwd, errors, summary }) => {
|
|
|
62
50
|
datas: [
|
|
63
51
|
{
|
|
64
52
|
data: summary.all.total,
|
|
65
|
-
total: summary.all.total.size
|
|
53
|
+
total: summary.all.total.size,
|
|
54
|
+
showProgress: true
|
|
66
55
|
}
|
|
67
56
|
]
|
|
68
57
|
}
|
|
@@ -147,7 +136,7 @@ const BundleCards = ({ cwd, errors, summary }) => {
|
|
|
147
136
|
}
|
|
148
137
|
)
|
|
149
138
|
];
|
|
150
|
-
return /* @__PURE__ */ jsx(Row, { gutter: [Size.BasePadding, Size.BasePadding], wrap: true, style: { marginBottom: Size.BasePadding }, children: arr.map((e, i) => /* @__PURE__ */ jsx(Col, {
|
|
139
|
+
return /* @__PURE__ */ jsx(Row, { gutter: windowWith > 1200 && windowWith < 1400 ? [Size.BasePadding * 2, Size.BasePadding] : [Size.BasePadding, Size.BasePadding], wrap: true, style: { marginBottom: Size.BasePadding }, children: arr.map((e, i) => /* @__PURE__ */ jsx(Col, { span: windowWith > 1500 ? 4 : windowWith > 1200 ? 8 : 8, children: e }, i)) });
|
|
151
140
|
};
|
|
152
141
|
export {
|
|
153
142
|
BundleCards
|
|
@@ -4,7 +4,7 @@ import './index.sass';
|
|
|
4
4
|
interface WebpackModulesOverallProps {
|
|
5
5
|
cwd: string;
|
|
6
6
|
errors: SDK.ErrorsData;
|
|
7
|
-
summary: Client.
|
|
7
|
+
summary: Client.RsdoctorClientAssetsSummary;
|
|
8
8
|
entryPoints: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetEntryPoints>;
|
|
9
9
|
}
|
|
10
10
|
export declare const WebpackModulesOverallBase: React.FC<WebpackModulesOverallProps>;
|