@rsdoctor/components 0.0.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/assets/connection-point.3b3c78ca.svg +1 -0
- package/dist/assets/icon.7509d763.svg +21 -0
- package/dist/assets/webpack.98604d64.svg +1 -0
- package/dist/components/Alert/change.d.ts +8 -0
- package/dist/components/Alert/change.js +94 -0
- package/dist/components/Alert/file-relation.d.ts +3 -0
- package/dist/components/Alert/file-relation.js +9 -0
- package/dist/components/Alert/index.css +29 -0
- package/dist/components/Alert/index.d.ts +4 -0
- package/dist/components/Alert/index.js +37 -0
- package/dist/components/Alert/link.d.ts +3 -0
- package/dist/components/Alert/link.js +27 -0
- package/dist/components/Alert/package-relation.d.ts +17 -0
- package/dist/components/Alert/package-relation.js +206 -0
- package/dist/components/Alert/types.d.ts +31 -0
- package/dist/components/Alert/types.js +0 -0
- package/dist/components/Alert/view.d.ts +4 -0
- package/dist/components/Alert/view.js +59 -0
- package/dist/components/Alerts/bundle.d.ts +11 -0
- package/dist/components/Alerts/bundle.js +47 -0
- package/dist/components/Alerts/common.d.ts +15 -0
- package/dist/components/Alerts/common.js +106 -0
- package/dist/components/Alerts/compile.d.ts +10 -0
- package/dist/components/Alerts/compile.js +46 -0
- package/dist/components/Alerts/index.d.ts +3 -0
- package/dist/components/Alerts/index.js +3 -0
- package/dist/components/Alerts/overlay.d.ts +26 -0
- package/dist/components/Alerts/overlay.js +154 -0
- package/dist/components/Badge/index.d.ts +21 -0
- package/dist/components/Badge/index.js +105 -0
- package/dist/components/Card/diff.d.ts +23 -0
- package/dist/components/Card/diff.js +131 -0
- package/dist/components/Card/index.d.ts +7 -0
- package/dist/components/Card/index.js +62 -0
- package/dist/components/Card/size.d.ts +16 -0
- package/dist/components/Card/size.js +71 -0
- package/dist/components/Card/statistic.css +16 -0
- package/dist/components/Card/statistic.d.ts +9 -0
- package/dist/components/Card/statistic.js +34 -0
- package/dist/components/Charts/TimelineCharts/index.d.ts +8 -0
- package/dist/components/Charts/TimelineCharts/index.js +197 -0
- package/dist/components/Charts/bootstrap.d.ts +5 -0
- package/dist/components/Charts/bootstrap.js +44 -0
- package/dist/components/Charts/common.d.ts +13 -0
- package/dist/components/Charts/common.js +56 -0
- package/dist/components/Charts/done.d.ts +5 -0
- package/dist/components/Charts/done.js +45 -0
- package/dist/components/Charts/index.d.ts +10 -0
- package/dist/components/Charts/index.js +37 -0
- package/dist/components/Charts/loader.css +31 -0
- package/dist/components/Charts/loader.d.ts +4 -0
- package/dist/components/Charts/loader.js +68 -0
- package/dist/components/Charts/minify.d.ts +5 -0
- package/dist/components/Charts/minify.js +37 -0
- package/dist/components/Charts/tooltips.css +62 -0
- package/dist/components/Charts/types.d.ts +61 -0
- package/dist/components/Charts/types.js +11 -0
- package/dist/components/Charts/utils.d.ts +13 -0
- package/dist/components/Charts/utils.js +203 -0
- package/dist/components/CodeViewer/config.d.ts +2 -0
- package/dist/components/CodeViewer/config.js +18 -0
- package/dist/components/CodeViewer/diff.d.ts +11 -0
- package/dist/components/CodeViewer/diff.js +53 -0
- package/dist/components/CodeViewer/hightlight.d.ts +10 -0
- package/dist/components/CodeViewer/hightlight.js +76 -0
- package/dist/components/CodeViewer/index.d.ts +4 -0
- package/dist/components/CodeViewer/index.js +4 -0
- package/dist/components/CodeViewer/viewer.d.ts +13 -0
- package/dist/components/CodeViewer/viewer.js +76 -0
- package/dist/components/Configuration/index.d.ts +1 -0
- package/dist/components/Configuration/index.js +1 -0
- package/dist/components/Configuration/webpack.d.ts +13 -0
- package/dist/components/Configuration/webpack.js +70 -0
- package/dist/components/FileTree/index.css +58 -0
- package/dist/components/FileTree/index.d.ts +4 -0
- package/dist/components/FileTree/index.js +53 -0
- package/dist/components/Form/keyword.d.ts +14 -0
- package/dist/components/Form/keyword.js +76 -0
- package/dist/components/Keyword/index.d.ts +6 -0
- package/dist/components/Keyword/index.js +68 -0
- package/dist/components/Layout/builder-select.d.ts +2 -0
- package/dist/components/Layout/builder-select.js +50 -0
- package/dist/components/Layout/constants.d.ts +1 -0
- package/dist/components/Layout/constants.js +4 -0
- package/dist/components/Layout/header.css +12 -0
- package/dist/components/Layout/header.d.ts +3 -0
- package/dist/components/Layout/header.js +87 -0
- package/dist/components/Layout/index.d.ts +5 -0
- package/dist/components/Layout/index.js +34 -0
- package/dist/components/Layout/menus.d.ts +8 -0
- package/dist/components/Layout/menus.js +155 -0
- package/dist/components/Layout/progress.d.ts +8 -0
- package/dist/components/Layout/progress.js +44 -0
- package/dist/components/Loader/Analysis/files.d.ts +8 -0
- package/dist/components/Loader/Analysis/files.js +187 -0
- package/dist/components/Loader/Analysis/index.d.ts +11 -0
- package/dist/components/Loader/Analysis/index.js +23 -0
- package/dist/components/Loader/executions.d.ts +13 -0
- package/dist/components/Loader/executions.js +221 -0
- package/dist/components/Manifest/api.d.ts +41 -0
- package/dist/components/Manifest/api.js +157 -0
- package/dist/components/Manifest/data.d.ts +8 -0
- package/dist/components/Manifest/data.js +81 -0
- package/dist/components/Manifest/index.d.ts +2 -0
- package/dist/components/Manifest/index.js +2 -0
- package/dist/components/Opener/code.d.ts +28 -0
- package/dist/components/Opener/code.js +69 -0
- package/dist/components/Opener/index.d.ts +2 -0
- package/dist/components/Opener/index.js +2 -0
- package/dist/components/Opener/vscode.d.ts +16 -0
- package/dist/components/Opener/vscode.js +57 -0
- package/dist/components/Overall/NumberButton.d.ts +14 -0
- package/dist/components/Overall/NumberButton.js +29 -0
- package/dist/components/Overall/NumberButton.module.js +5 -0
- package/dist/components/Overall/NumberButton_module.css +70 -0
- package/dist/components/Overall/bundle.d.ts +6 -0
- package/dist/components/Overall/bundle.js +167 -0
- package/dist/components/Overall/bundle.module.css +0 -0
- package/dist/components/Overall/card.module.js +5 -0
- package/dist/components/Overall/card_module.css +6 -0
- package/dist/components/Overall/compile.d.ts +5 -0
- package/dist/components/Overall/compile.js +68 -0
- package/dist/components/Overall/compile.module.js +5 -0
- package/dist/components/Overall/compile_module.css +4 -0
- package/dist/components/Overall/index.d.ts +3 -0
- package/dist/components/Overall/index.js +3 -0
- package/dist/components/Overall/list.module.js +5 -0
- package/dist/components/Overall/list_module.css +7 -0
- package/dist/components/Overall/project.d.ts +8 -0
- package/dist/components/Overall/project.js +73 -0
- package/dist/components/Plugins/webpack.d.ts +18 -0
- package/dist/components/Plugins/webpack.js +76 -0
- package/dist/components/Resolver/analysis.d.ts +15 -0
- package/dist/components/Resolver/analysis.js +160 -0
- package/dist/components/Select/index.d.ts +15 -0
- package/dist/components/Select/index.js +68 -0
- package/dist/components/Status/failed.d.ts +9 -0
- package/dist/components/Status/failed.js +33 -0
- package/dist/components/Status/index.d.ts +1 -0
- package/dist/components/Status/index.js +1 -0
- package/dist/components/TextDrawer/duplicate.d.ts +17 -0
- package/dist/components/TextDrawer/duplicate.js +107 -0
- package/dist/components/TextDrawer/index.d.ts +11 -0
- package/dist/components/TextDrawer/index.js +55 -0
- package/dist/components/Title/index.d.ts +15 -0
- package/dist/components/Title/index.js +10 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +11 -0
- package/dist/components/worker/ecmaversion/client.d.ts +10 -0
- package/dist/components/worker/ecmaversion/client.js +61 -0
- package/dist/components/worker/ecmaversion/worker.d.ts +1 -0
- package/dist/components/worker/ecmaversion/worker.js +13 -0
- package/dist/components/worker/jsequal/client.d.ts +11 -0
- package/dist/components/worker/jsequal/client.js +39 -0
- package/dist/components/worker/jsequal/worker.d.ts +1 -0
- package/dist/components/worker/jsequal/worker.js +52 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +39 -0
- package/dist/constants.d.ts +48 -0
- package/dist/constants.js +71 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/pages/BundleSize/components/asset.d.ts +26 -0
- package/dist/pages/BundleSize/components/asset.js +405 -0
- package/dist/pages/BundleSize/components/cards.d.ts +7 -0
- package/dist/pages/BundleSize/components/cards.js +154 -0
- package/dist/pages/BundleSize/components/editor.d.ts +5 -0
- package/dist/pages/BundleSize/components/editor.js +38 -0
- package/dist/pages/BundleSize/components/index.css +20 -0
- package/dist/pages/BundleSize/components/index.d.ts +16 -0
- package/dist/pages/BundleSize/components/index.js +314 -0
- package/dist/pages/BundleSize/config.d.ts +7 -0
- package/dist/pages/BundleSize/config.js +9 -0
- package/dist/pages/BundleSize/constants.d.ts +5 -0
- package/dist/pages/BundleSize/constants.js +9 -0
- package/dist/pages/BundleSize/index.d.ts +3 -0
- package/dist/pages/BundleSize/index.js +11 -0
- package/dist/pages/ModuleAnalyze/chunks.d.ts +6 -0
- package/dist/pages/ModuleAnalyze/chunks.js +48 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +88 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +15 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +138 -0
- package/dist/pages/ModuleAnalyze/constants.d.ts +7 -0
- package/dist/pages/ModuleAnalyze/constants.js +14 -0
- package/dist/pages/ModuleAnalyze/dependncy.d.ts +9 -0
- package/dist/pages/ModuleAnalyze/dependncy.js +31 -0
- package/dist/pages/ModuleAnalyze/fileTree.d.ts +9 -0
- package/dist/pages/ModuleAnalyze/fileTree.js +125 -0
- package/dist/pages/ModuleAnalyze/index.css +10 -0
- package/dist/pages/ModuleAnalyze/index.d.ts +8 -0
- package/dist/pages/ModuleAnalyze/index.js +64 -0
- package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +21 -0
- package/dist/pages/ModuleAnalyze/utils/hooks.js +65 -0
- package/dist/pages/ModuleAnalyze/utils/index.d.ts +3 -0
- package/dist/pages/ModuleAnalyze/utils/index.js +36 -0
- package/dist/pages/ModuleResolve/constants.d.ts +3 -0
- package/dist/pages/ModuleResolve/constants.js +7 -0
- package/dist/pages/ModuleResolve/index.d.ts +3 -0
- package/dist/pages/ModuleResolve/index.js +19 -0
- package/dist/pages/Overall/constants.d.ts +3 -0
- package/dist/pages/Overall/constants.js +7 -0
- package/dist/pages/Overall/index.d.ts +9 -0
- package/dist/pages/Overall/index.js +28 -0
- package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Analysis/constants.js +7 -0
- package/dist/pages/WebpackLoaders/Analysis/index.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Analysis/index.js +19 -0
- package/dist/pages/WebpackLoaders/Overall/constants.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Overall/constants.js +7 -0
- package/dist/pages/WebpackLoaders/Overall/index.d.ts +3 -0
- package/dist/pages/WebpackLoaders/Overall/index.js +11 -0
- package/dist/pages/WebpackLoaders/constants.d.ts +2 -0
- package/dist/pages/WebpackLoaders/constants.js +6 -0
- package/dist/pages/WebpackPlugins/constants.d.ts +3 -0
- package/dist/pages/WebpackPlugins/constants.js +7 -0
- package/dist/pages/WebpackPlugins/index.d.ts +3 -0
- package/dist/pages/WebpackPlugins/index.js +79 -0
- package/dist/pages/index.d.ts +7 -0
- package/dist/pages/index.js +16 -0
- package/dist/utils/data/base.d.ts +24 -0
- package/dist/utils/data/base.js +70 -0
- package/dist/utils/data/index.d.ts +5 -0
- package/dist/utils/data/index.js +66 -0
- package/dist/utils/data/local.d.ts +14 -0
- package/dist/utils/data/local.js +106 -0
- package/dist/utils/data/remote.d.ts +10 -0
- package/dist/utils/data/remote.js +70 -0
- package/dist/utils/file.d.ts +39 -0
- package/dist/utils/file.js +154 -0
- package/dist/utils/hooks.d.ts +30 -0
- package/dist/utils/hooks.js +256 -0
- package/dist/utils/i18n/cn.d.ts +3 -0
- package/dist/utils/i18n/cn.js +33 -0
- package/dist/utils/i18n/en.d.ts +30 -0
- package/dist/utils/i18n/en.js +33 -0
- package/dist/utils/i18n/index.d.ts +2 -0
- package/dist/utils/i18n/index.js +34 -0
- package/dist/utils/index.d.ts +16 -0
- package/dist/utils/index.js +16 -0
- package/dist/utils/loader.d.ts +7 -0
- package/dist/utils/loader.js +29 -0
- package/dist/utils/locale.d.ts +2 -0
- package/dist/utils/locale.js +9 -0
- package/dist/utils/manifest.d.ts +27 -0
- package/dist/utils/manifest.js +54 -0
- package/dist/utils/monaco.d.ts +9 -0
- package/dist/utils/monaco.js +48 -0
- package/dist/utils/request.d.ts +23 -0
- package/dist/utils/request.js +162 -0
- package/dist/utils/routes.d.ts +3 -0
- package/dist/utils/routes.js +14 -0
- package/dist/utils/size.d.ts +2 -0
- package/dist/utils/size.js +24 -0
- package/dist/utils/socket.d.ts +2 -0
- package/dist/utils/socket.js +20 -0
- package/dist/utils/storage.d.ts +13 -0
- package/dist/utils/storage.js +70 -0
- package/dist/utils/string.d.ts +2 -0
- package/dist/utils/string.js +14 -0
- package/dist/utils/time.d.ts +3 -0
- package/dist/utils/time.js +7 -0
- package/dist/utils/url.d.ts +6 -0
- package/dist/utils/url.js +89 -0
- package/dist/utils/worker/index.d.ts +4 -0
- package/dist/utils/worker/index.js +4 -0
- package/dist/utils/worker/master.d.ts +8 -0
- package/dist/utils/worker/master.js +18 -0
- package/dist/utils/worker/types.d.ts +9 -0
- package/dist/utils/worker/types.js +0 -0
- package/dist/utils/worker/utils.d.ts +9 -0
- package/dist/utils/worker/utils.js +29 -0
- package/dist/utils/worker/worker.d.ts +13 -0
- package/dist/utils/worker/worker.js +38 -0
- package/package.json +87 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LoaderAnalysis } from "../../../components/Loader/Analysis";
|
|
3
|
+
import { WebpackConfigurationViewer } from "../../../components/Configuration";
|
|
4
|
+
import { Card } from "../../../components/Card";
|
|
5
|
+
const Page = () => {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
Card,
|
|
8
|
+
{
|
|
9
|
+
title: "Webpack Loader Analysis",
|
|
10
|
+
extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["module", "resolve"] }),
|
|
11
|
+
bodyStyle: { paddingTop: 0 },
|
|
12
|
+
children: /* @__PURE__ */ jsx(LoaderAnalysis, {})
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
export * from "./constants";
|
|
17
|
+
export {
|
|
18
|
+
Page
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { WebpackConfigurationViewer } from "../../../components/Configuration";
|
|
3
|
+
import { Card } from "../../../components/Card";
|
|
4
|
+
import { LoaderChart } from "../../../components/Charts";
|
|
5
|
+
const Page = () => {
|
|
6
|
+
return /* @__PURE__ */ jsx(Card, { title: "Loader Overall", extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["module"] }), collapsable: true, children: /* @__PURE__ */ jsx(LoaderChart, {}) });
|
|
7
|
+
};
|
|
8
|
+
export * from "./constants";
|
|
9
|
+
export {
|
|
10
|
+
Page
|
|
11
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ApiOutlined, PartitionOutlined } from "@ant-design/icons";
|
|
3
|
+
import { SDK } from "@rsdoctor/types";
|
|
4
|
+
import { Button, Card, Input, Select, Space, Typography } from "antd";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { WebpackConfigurationViewer } from "../../components/Configuration";
|
|
7
|
+
import { ServerAPIProvider } from "../../components/Manifest";
|
|
8
|
+
import { WebpackPluginsDataTable } from "../../components/Plugins/webpack";
|
|
9
|
+
import { Size } from "../../constants";
|
|
10
|
+
const Page = () => {
|
|
11
|
+
const [selectedTapNames, setSelectedTapNames] = useState([]);
|
|
12
|
+
const [selectedHooks, setSelectedHooks] = useState([]);
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
14
|
+
Card,
|
|
15
|
+
{
|
|
16
|
+
title: "Webpack Plugins Overall",
|
|
17
|
+
bodyStyle: { paddingTop: Size.BasePadding / 3 },
|
|
18
|
+
extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, { defaultKeys: ["plugins"] }),
|
|
19
|
+
children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
20
|
+
/* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetPluginSummary, children: ({ hooks, tapNames }) => /* @__PURE__ */ jsxs(Space, { style: { marginBottom: Size.BasePadding / 2 }, children: [
|
|
21
|
+
/* @__PURE__ */ jsxs(Input.Group, { compact: true, children: [
|
|
22
|
+
/* @__PURE__ */ jsxs(Button, { children: [
|
|
23
|
+
/* @__PURE__ */ jsx(ApiOutlined, {}),
|
|
24
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "Plugin Tap Names" })
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
Select,
|
|
28
|
+
{
|
|
29
|
+
mode: "multiple",
|
|
30
|
+
allowClear: true,
|
|
31
|
+
style: { width: 350 },
|
|
32
|
+
dropdownMatchSelectWidth: true,
|
|
33
|
+
onChange: (e) => {
|
|
34
|
+
setSelectedTapNames(e);
|
|
35
|
+
},
|
|
36
|
+
children: tapNames.map((e) => {
|
|
37
|
+
return /* @__PURE__ */ jsx(Select.Option, { label: e, value: e, children: e }, e);
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ jsxs(Input.Group, { compact: true, children: [
|
|
43
|
+
/* @__PURE__ */ jsxs(Button, { children: [
|
|
44
|
+
/* @__PURE__ */ jsx(PartitionOutlined, {}),
|
|
45
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "Hooks" })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
Select,
|
|
49
|
+
{
|
|
50
|
+
mode: "multiple",
|
|
51
|
+
allowClear: true,
|
|
52
|
+
style: { width: 350 },
|
|
53
|
+
dropdownMatchSelectWidth: true,
|
|
54
|
+
onChange: (e) => {
|
|
55
|
+
setSelectedHooks(e);
|
|
56
|
+
},
|
|
57
|
+
children: hooks.map((e) => {
|
|
58
|
+
return /* @__PURE__ */ jsx(Select.Option, { label: e, value: e, children: e }, e);
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] })
|
|
63
|
+
] }) }),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
ServerAPIProvider,
|
|
66
|
+
{
|
|
67
|
+
api: SDK.ServerAPI.API.GetPluginData,
|
|
68
|
+
body: { hooks: selectedHooks, tapNames: selectedTapNames },
|
|
69
|
+
children: (res) => /* @__PURE__ */ jsx(WebpackPluginsDataTable, { dataSource: res })
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] })
|
|
73
|
+
}
|
|
74
|
+
) });
|
|
75
|
+
};
|
|
76
|
+
export * from "./constants";
|
|
77
|
+
export {
|
|
78
|
+
Page
|
|
79
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * as Overall from './Overall';
|
|
2
|
+
export * as BundleSize from './BundleSize';
|
|
3
|
+
export * as ModuleAnalyze from './ModuleAnalyze';
|
|
4
|
+
export * as LoaderTimeline from './WebpackLoaders/Overall';
|
|
5
|
+
export * as LoaderFiles from './WebpackLoaders/Analysis';
|
|
6
|
+
export * as PluginsAnalyze from './WebpackPlugins';
|
|
7
|
+
export * as ModuleResolve from './ModuleResolve';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Overall from "./Overall";
|
|
2
|
+
import * as BundleSize from "./BundleSize";
|
|
3
|
+
import * as ModuleAnalyze from "./ModuleAnalyze";
|
|
4
|
+
import * as LoaderTimeline from "./WebpackLoaders/Overall";
|
|
5
|
+
import * as LoaderFiles from "./WebpackLoaders/Analysis";
|
|
6
|
+
import * as PluginsAnalyze from "./WebpackPlugins";
|
|
7
|
+
import * as ModuleResolve from "./ModuleResolve";
|
|
8
|
+
export {
|
|
9
|
+
BundleSize,
|
|
10
|
+
LoaderFiles,
|
|
11
|
+
LoaderTimeline,
|
|
12
|
+
ModuleAnalyze,
|
|
13
|
+
ModuleResolve,
|
|
14
|
+
Overall,
|
|
15
|
+
PluginsAnalyze
|
|
16
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Common, Manifest, SDK } from '@rsdoctor/types';
|
|
2
|
+
import { Data } from '@rsdoctor/utils/common';
|
|
3
|
+
export declare abstract class BaseDataLoader implements Manifest.ManifestDataLoader {
|
|
4
|
+
protected manifest: Manifest.DoctorManifestWithShardingFiles;
|
|
5
|
+
protected pool: Map<string, Promise<unknown>>;
|
|
6
|
+
protected loader: Data.APIDataLoader;
|
|
7
|
+
protected disposed: boolean;
|
|
8
|
+
protected shardingDataMap: Map<keyof Manifest.DoctorManifestData, Promise<any>>;
|
|
9
|
+
constructor(manifest: Manifest.DoctorManifestWithShardingFiles);
|
|
10
|
+
protected get<T extends keyof Manifest.DoctorManifestWithShardingFiles>(key: T): void | Manifest.DoctorManifestWithShardingFiles[T];
|
|
11
|
+
protected getData<T extends keyof Manifest.DoctorManifestData>(key: T, scope?: 'data'): void | Manifest.DoctorManifestWithShardingFiles['data'][T];
|
|
12
|
+
protected getKeys(key: string): string[];
|
|
13
|
+
protected joinKeys(keys: string[]): string;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
limit<T>(key: string, fn: Common.Function<unknown[], Promise<T>>): Promise<T>;
|
|
16
|
+
log(...args: unknown[]): void;
|
|
17
|
+
loadManifest(): Promise<Manifest.DoctorManifestWithShardingFiles>;
|
|
18
|
+
abstract loadData<T extends string, P>(key: T): Promise<void | P>;
|
|
19
|
+
abstract loadData<T extends Manifest.DoctorManifestMappingKeys>(key: T): Promise<void | Manifest.InferManifestDataValue<T>>;
|
|
20
|
+
abstract isLocal(): boolean;
|
|
21
|
+
abstract loadAPI<T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = SDK.ServerAPI.InferRequestBodyType<T>, R extends SDK.ServerAPI.InferResponseType<T> = SDK.ServerAPI.InferResponseType<T>>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R>;
|
|
22
|
+
abstract onDataUpdate<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, fn: (response: SDK.ServerAPI.SocketResponseType<T>) => void): void;
|
|
23
|
+
abstract removeOnDataUpdate<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, fn: (response: SDK.ServerAPI.SocketResponseType<T>) => void): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { Data } from "@rsdoctor/utils/common";
|
|
22
|
+
class BaseDataLoader {
|
|
23
|
+
constructor(manifest) {
|
|
24
|
+
this.manifest = manifest;
|
|
25
|
+
this.pool = /* @__PURE__ */ new Map();
|
|
26
|
+
this.disposed = false;
|
|
27
|
+
this.shardingDataMap = /* @__PURE__ */ new Map();
|
|
28
|
+
this.loader = new Data.APIDataLoader(this);
|
|
29
|
+
console.log("[DataLoader] isLocal: ", this.isLocal());
|
|
30
|
+
}
|
|
31
|
+
get(key) {
|
|
32
|
+
if (!this.manifest)
|
|
33
|
+
return;
|
|
34
|
+
return this.manifest[key];
|
|
35
|
+
}
|
|
36
|
+
getData(key, scope = "data") {
|
|
37
|
+
const data = this.get(scope);
|
|
38
|
+
if (!data)
|
|
39
|
+
return;
|
|
40
|
+
return data[key];
|
|
41
|
+
}
|
|
42
|
+
getKeys(key) {
|
|
43
|
+
return key.split(".");
|
|
44
|
+
}
|
|
45
|
+
joinKeys(keys) {
|
|
46
|
+
return keys.join(".");
|
|
47
|
+
}
|
|
48
|
+
dispose() {
|
|
49
|
+
this.disposed = true;
|
|
50
|
+
}
|
|
51
|
+
limit(key, fn) {
|
|
52
|
+
if (this.pool.has(key)) {
|
|
53
|
+
return this.pool.get(key);
|
|
54
|
+
}
|
|
55
|
+
const res = fn().finally(() => this.pool.delete(key));
|
|
56
|
+
this.pool.set(key, res);
|
|
57
|
+
return res;
|
|
58
|
+
}
|
|
59
|
+
log(...args) {
|
|
60
|
+
console.log(`[${this.constructor.name}]`, ...args);
|
|
61
|
+
}
|
|
62
|
+
loadManifest() {
|
|
63
|
+
return __async(this, null, function* () {
|
|
64
|
+
return this.manifest;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
BaseDataLoader
|
|
70
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { useEffect, useState } from "react";
|
|
22
|
+
import { LocalServerDataLoader } from "./local";
|
|
23
|
+
import { RemoteDataLoader } from "./remote";
|
|
24
|
+
import { getAPILoaderModeFromStorage } from "../storage";
|
|
25
|
+
import { APILoaderMode4Dev } from "../../constants";
|
|
26
|
+
const loaderTask = /* @__PURE__ */ new WeakMap();
|
|
27
|
+
function createDataLoader(manifest) {
|
|
28
|
+
return __async(this, null, function* () {
|
|
29
|
+
try {
|
|
30
|
+
if (process.env.NODE_ENV === "development") {
|
|
31
|
+
const mode = getAPILoaderModeFromStorage();
|
|
32
|
+
if (mode === APILoaderMode4Dev.Local)
|
|
33
|
+
return new LocalServerDataLoader(manifest);
|
|
34
|
+
if (mode === APILoaderMode4Dev.Remote)
|
|
35
|
+
return new RemoteDataLoader(manifest);
|
|
36
|
+
}
|
|
37
|
+
if (manifest.__LOCAL__SERVER__) {
|
|
38
|
+
return new LocalServerDataLoader(manifest);
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.log("[DataLoader] fallback to RemoteDataLoader");
|
|
42
|
+
}
|
|
43
|
+
return new RemoteDataLoader(manifest);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function useDataLoader(manifest) {
|
|
47
|
+
const [loader, setLoader] = useState(void 0);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!manifest)
|
|
50
|
+
return;
|
|
51
|
+
if (!loaderTask.has(manifest)) {
|
|
52
|
+
const promise = createDataLoader(manifest);
|
|
53
|
+
loaderTask.set(manifest, promise);
|
|
54
|
+
}
|
|
55
|
+
const task = loaderTask.get(manifest);
|
|
56
|
+
task.then((loader2) => {
|
|
57
|
+
setLoader(loader2);
|
|
58
|
+
});
|
|
59
|
+
}, [manifest]);
|
|
60
|
+
return {
|
|
61
|
+
loader
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
useDataLoader
|
|
66
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Common, Manifest, SDK } from '@rsdoctor/types';
|
|
2
|
+
import { BaseDataLoader } from './base';
|
|
3
|
+
export declare class LocalServerDataLoader extends BaseDataLoader {
|
|
4
|
+
protected events: Map<SDK.ServerAPI.API | SDK.ServerAPI.APIExtends, Set<Common.Function>>;
|
|
5
|
+
isLocal(): boolean;
|
|
6
|
+
loadData<T extends keyof Manifest.DoctorManifestData>(key: T): Promise<void | Manifest.DoctorManifestData[T]>;
|
|
7
|
+
loadAPI<T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = SDK.ServerAPI.InferRequestBodyType<T>, R extends SDK.ServerAPI.InferResponseType<T> = SDK.ServerAPI.InferResponseType<T>>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R>;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
/**
|
|
10
|
+
* add event listener when received data from server.
|
|
11
|
+
*/
|
|
12
|
+
onDataUpdate<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, fn: (response: SDK.ServerAPI.SocketResponseType<T>) => void): void;
|
|
13
|
+
removeOnDataUpdate<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, fn: (response: SDK.ServerAPI.SocketResponseType<T>) => void): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { Manifest as ManifestShared } from "@rsdoctor/utils/common";
|
|
22
|
+
import { SDK } from "@rsdoctor/types";
|
|
23
|
+
import { get } from "lodash-es";
|
|
24
|
+
import { BaseDataLoader } from "./base";
|
|
25
|
+
import { getSocket } from "../socket";
|
|
26
|
+
class LocalServerDataLoader extends BaseDataLoader {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.events = /* @__PURE__ */ new Map();
|
|
30
|
+
}
|
|
31
|
+
isLocal() {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
loadData(key) {
|
|
35
|
+
return __async(this, null, function* () {
|
|
36
|
+
return this.limit(key, () => __async(this, null, function* () {
|
|
37
|
+
const [scope, ...rest] = this.getKeys(key);
|
|
38
|
+
const data = this.getData(scope);
|
|
39
|
+
if (!data)
|
|
40
|
+
return;
|
|
41
|
+
let res = data;
|
|
42
|
+
if (ManifestShared.isShardingData(res)) {
|
|
43
|
+
if (!this.shardingDataMap.has(key)) {
|
|
44
|
+
const task = new Promise((resolve) => {
|
|
45
|
+
getSocket(this.manifest.__SOCKET__URL__).emit(
|
|
46
|
+
SDK.ServerAPI.API.LoadDataByKey,
|
|
47
|
+
{ key },
|
|
48
|
+
(res2) => {
|
|
49
|
+
resolve(res2.res);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
this.shardingDataMap.set(key, task);
|
|
54
|
+
}
|
|
55
|
+
res = yield this.shardingDataMap.get(key);
|
|
56
|
+
this.shardingDataMap.delete(key);
|
|
57
|
+
return res;
|
|
58
|
+
}
|
|
59
|
+
return rest.length > 0 ? get(res, this.joinKeys(rest)) : res;
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
loadAPI(...args) {
|
|
64
|
+
return __async(this, null, function* () {
|
|
65
|
+
const [api, body] = args;
|
|
66
|
+
const key = body ? `${api}_${JSON.stringify(body)}` : `${api}`;
|
|
67
|
+
return this.limit(key, () => __async(this, null, function* () {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
getSocket(this.manifest.__SOCKET__URL__).emit(api, body, (res) => {
|
|
70
|
+
resolve(res.res);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
dispose() {
|
|
77
|
+
super.dispose();
|
|
78
|
+
this.events.forEach((evs, api) => {
|
|
79
|
+
evs.forEach((ev) => {
|
|
80
|
+
this.removeOnDataUpdate(api, ev);
|
|
81
|
+
});
|
|
82
|
+
evs.clear();
|
|
83
|
+
});
|
|
84
|
+
this.events.clear();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* add event listener when received data from server.
|
|
88
|
+
*/
|
|
89
|
+
onDataUpdate(api, fn) {
|
|
90
|
+
if (!this.events.has(api)) {
|
|
91
|
+
this.events.set(api, /* @__PURE__ */ new Set());
|
|
92
|
+
}
|
|
93
|
+
if (this.events.get(api).has(fn)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.events.get(api).add(fn);
|
|
97
|
+
getSocket(this.manifest.__SOCKET__URL__).on(api, fn);
|
|
98
|
+
}
|
|
99
|
+
removeOnDataUpdate(api, fn) {
|
|
100
|
+
getSocket(this.manifest.__SOCKET__URL__).off(api, fn);
|
|
101
|
+
this.events.get(api).delete(fn);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
LocalServerDataLoader
|
|
106
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Manifest, SDK } from '@rsdoctor/types';
|
|
2
|
+
import { BaseDataLoader } from './base';
|
|
3
|
+
export declare class RemoteDataLoader extends BaseDataLoader {
|
|
4
|
+
isLocal(): boolean;
|
|
5
|
+
loadData<T extends Manifest.DoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
|
|
6
|
+
loadAPI<T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = SDK.ServerAPI.InferRequestBodyType<T>, R extends SDK.ServerAPI.InferResponseType<T> = SDK.ServerAPI.InferResponseType<T>>(...args: B extends void ? [api: T] : [api: T, body: B]): Promise<R>;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
onDataUpdate(): void;
|
|
9
|
+
removeOnDataUpdate(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { Manifest as ManifestShared } from "@rsdoctor/utils/common";
|
|
22
|
+
import { get } from "lodash-es";
|
|
23
|
+
import { BaseDataLoader } from "./base";
|
|
24
|
+
import { fetchShardingFile } from "../request";
|
|
25
|
+
class RemoteDataLoader extends BaseDataLoader {
|
|
26
|
+
isLocal() {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
loadData(key) {
|
|
30
|
+
return __async(this, null, function* () {
|
|
31
|
+
return this.limit(key, () => __async(this, null, function* () {
|
|
32
|
+
const [scope, ...rest] = this.getKeys(key);
|
|
33
|
+
const data = this.getData(scope);
|
|
34
|
+
if (!data)
|
|
35
|
+
return;
|
|
36
|
+
let res = data;
|
|
37
|
+
if (ManifestShared.isShardingData(res)) {
|
|
38
|
+
if (!this.shardingDataMap.has(scope)) {
|
|
39
|
+
const task = ManifestShared.fetchShardingData(res, fetchShardingFile).catch((err) => {
|
|
40
|
+
this.log(`loadData error: `, res, key);
|
|
41
|
+
throw err;
|
|
42
|
+
});
|
|
43
|
+
this.shardingDataMap.set(scope, task);
|
|
44
|
+
}
|
|
45
|
+
res = yield this.shardingDataMap.get(scope);
|
|
46
|
+
}
|
|
47
|
+
return rest.length > 0 ? get(res, this.joinKeys(rest)) : res;
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
loadAPI(...args) {
|
|
52
|
+
return __async(this, null, function* () {
|
|
53
|
+
const [api, body] = args;
|
|
54
|
+
const key = body ? `${api}_${JSON.stringify(body)}` : `${api}`;
|
|
55
|
+
return this.limit(key, () => __async(this, null, function* () {
|
|
56
|
+
return this.loader.loadAPI(...args);
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
dispose() {
|
|
61
|
+
super.dispose();
|
|
62
|
+
}
|
|
63
|
+
onDataUpdate() {
|
|
64
|
+
}
|
|
65
|
+
removeOnDataUpdate() {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
RemoteDataLoader
|
|
70
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Common } from '@rsdoctor/types';
|
|
3
|
+
import { UploadFile } from 'antd';
|
|
4
|
+
import { FieldDataNode } from 'rc-tree';
|
|
5
|
+
export type DataNode = FieldDataNode<{
|
|
6
|
+
key: string | number;
|
|
7
|
+
title?: React.ReactNode | ((data: DataNode) => React.ReactNode);
|
|
8
|
+
}> & {
|
|
9
|
+
__BASENAME__?: any;
|
|
10
|
+
__RESOURCEPATH__?: any;
|
|
11
|
+
children?: DataNode[];
|
|
12
|
+
};
|
|
13
|
+
export declare const rootDirname: (file: string, sep?: string) => string | null;
|
|
14
|
+
export declare function mapFileKey(arr: DataNode[], depth?: number, filter?: (node: DataNode) => boolean): DataNode['key'][];
|
|
15
|
+
export declare function flattenDirectory(n: DataNode, parent: DataNode, sep: string | undefined, inlinedResourcePathKey: keyof DataNode, dirTitle?: (_dir: DataNode, defaultTitle: string) => JSX.Element | string): void;
|
|
16
|
+
export declare function createFileStructures({
|
|
17
|
+
files,
|
|
18
|
+
sep,
|
|
19
|
+
inlinedResourcePathKey,
|
|
20
|
+
fileTitle,
|
|
21
|
+
dirTitle
|
|
22
|
+
}: {
|
|
23
|
+
files: string[];
|
|
24
|
+
cwd?: string;
|
|
25
|
+
sep?: string;
|
|
26
|
+
inlinedResourcePathKey?: keyof DataNode;
|
|
27
|
+
dirTitle?(dir: DataNode, defaultTitle: string): JSX.Element | string;
|
|
28
|
+
fileTitle?(file: string, basename: string): JSX.Element | string;
|
|
29
|
+
}): DataNode[];
|
|
30
|
+
export declare function beautifyPath(path: string, cwd: string): string;
|
|
31
|
+
export declare function readJSONByFileReader<T extends Common.PlainObject>(file: UploadFile): Promise<T>;
|
|
32
|
+
export declare function readJSONByFileReader<T extends Common.PlainObject>(file: Blob): Promise<T>;
|
|
33
|
+
/**
|
|
34
|
+
* beautify module path, will replace cwd & last 'node_modules'
|
|
35
|
+
*/
|
|
36
|
+
export declare function beautifyModulePath(modulePath: string, cwd: string): {
|
|
37
|
+
alias: string;
|
|
38
|
+
inNodeModules: boolean;
|
|
39
|
+
};
|