@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,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
import { DiffEditor } from "@monaco-editor/react";
|
|
22
|
+
import { Size } from "../../constants";
|
|
23
|
+
import { getModifiedLanguage, getOriginalLanguage } from "../../utils";
|
|
24
|
+
const DiffViewer = ({ before, after, filepath, className, editorProps }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
DiffEditor,
|
|
27
|
+
__spreadProps(__spreadValues({
|
|
28
|
+
className,
|
|
29
|
+
originalLanguage: getOriginalLanguage(filepath),
|
|
30
|
+
modifiedLanguage: getModifiedLanguage(filepath),
|
|
31
|
+
theme: "vs-dark",
|
|
32
|
+
original: before,
|
|
33
|
+
modified: after,
|
|
34
|
+
width: "100%"
|
|
35
|
+
}, editorProps), {
|
|
36
|
+
options: __spreadValues({
|
|
37
|
+
readOnly: true,
|
|
38
|
+
originalEditable: false,
|
|
39
|
+
renderSideBySide: true,
|
|
40
|
+
renderIndicators: true,
|
|
41
|
+
lineDecorationsWidth: Size.BasePadding,
|
|
42
|
+
definitionLinkOpensInPeek: false,
|
|
43
|
+
domReadOnly: true,
|
|
44
|
+
fontSize: 14,
|
|
45
|
+
minimap: { enabled: false },
|
|
46
|
+
diffWordWrap: "on"
|
|
47
|
+
}, editorProps == null ? void 0 : editorProps.options)
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
DiffViewer
|
|
53
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SDK } from '@rsdoctor/types';
|
|
3
|
+
interface FileHightLightViewerProps {
|
|
4
|
+
cwd: string;
|
|
5
|
+
module: SDK.ModuleData;
|
|
6
|
+
dependency: SDK.DependencyData;
|
|
7
|
+
moduleCode: SDK.ModuleSource;
|
|
8
|
+
}
|
|
9
|
+
export declare const FileHightLightViewer: React.FC<FileHightLightViewerProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { Space, Card, Tooltip } from "antd";
|
|
4
|
+
import { InfoCircleOutlined } from "@ant-design/icons";
|
|
5
|
+
import Editor from "@monaco-editor/react";
|
|
6
|
+
import { getOriginalLanguage, beautifyModulePath, getSelectionRange, getRevealPositionForViewer } from "../../utils";
|
|
7
|
+
import { CodeOpener } from "../Opener";
|
|
8
|
+
const FileHightLightViewer = ({ dependency, module, cwd, moduleCode }) => {
|
|
9
|
+
const editorRef = useRef(null);
|
|
10
|
+
if (!dependency)
|
|
11
|
+
return null;
|
|
12
|
+
const { statements } = dependency;
|
|
13
|
+
const hasSourceRange = Boolean(statements[0].position.source);
|
|
14
|
+
const { start, end } = hasSourceRange ? statements[0].position.source : statements[0].position.transformed;
|
|
15
|
+
const content = hasSourceRange ? moduleCode == null ? void 0 : moduleCode.source : moduleCode == null ? void 0 : moduleCode.transformed;
|
|
16
|
+
const modulePath = module.path;
|
|
17
|
+
const handleEditorDidMount = (editor2, monaco) => {
|
|
18
|
+
editorRef.current = editor2;
|
|
19
|
+
const range = getSelectionRange({ start, end }, monaco.Range);
|
|
20
|
+
const position = getRevealPositionForViewer(range.startLineNumber, range.startColumn);
|
|
21
|
+
editor2.revealPositionInCenter(position);
|
|
22
|
+
editor2.deltaDecorations(
|
|
23
|
+
[],
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
range,
|
|
27
|
+
options: {
|
|
28
|
+
inlineClassName: "file-inline-decoration"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
Card,
|
|
36
|
+
{
|
|
37
|
+
title: /* @__PURE__ */ jsxs(Space, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(Tooltip, { title: modulePath, zIndex: 99999, children: /* @__PURE__ */ jsx(InfoCircleOutlined, {}) }),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
CodeOpener,
|
|
41
|
+
{
|
|
42
|
+
cwd,
|
|
43
|
+
url: modulePath,
|
|
44
|
+
label: beautifyModulePath(modulePath, cwd).alias,
|
|
45
|
+
loc: `${start.line}:${start.column || 1}`,
|
|
46
|
+
code: true,
|
|
47
|
+
disabled: true
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }),
|
|
51
|
+
style: { height: "100%" },
|
|
52
|
+
children: /* @__PURE__ */ jsx(
|
|
53
|
+
Editor,
|
|
54
|
+
{
|
|
55
|
+
theme: "vs-dark",
|
|
56
|
+
language: getOriginalLanguage(modulePath),
|
|
57
|
+
value: content,
|
|
58
|
+
width: "100%",
|
|
59
|
+
height: window.innerHeight / 1.5,
|
|
60
|
+
options: {
|
|
61
|
+
readOnly: true,
|
|
62
|
+
domReadOnly: true,
|
|
63
|
+
fontSize: 14,
|
|
64
|
+
minimap: {
|
|
65
|
+
enabled: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
onMount: handleEditorDidMount
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
FileHightLightViewer
|
|
76
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SDK } from '@rsdoctor/types';
|
|
3
|
+
import type { editor } from 'monaco-editor';
|
|
4
|
+
interface CodeViewerProps {
|
|
5
|
+
path: string;
|
|
6
|
+
content: string;
|
|
7
|
+
defaultLine?: number;
|
|
8
|
+
ranges?: SDK.SourceRange[];
|
|
9
|
+
editorConfig?: editor.IStandaloneEditorConstructionOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare const CodeViewer: React.FC<CodeViewerProps>;
|
|
12
|
+
export declare const CodeViewerWithDrawer: React.FC<CodeViewerProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
import Editor from "@monaco-editor/react";
|
|
19
|
+
import { isNumber } from "lodash-es";
|
|
20
|
+
import { CodepenOutlined } from "@ant-design/icons";
|
|
21
|
+
import { getOriginalLanguage, getSelectionRange } from "../../utils";
|
|
22
|
+
import { DefaultEditorConfig } from "./config";
|
|
23
|
+
import { TextDrawer } from "../TextDrawer";
|
|
24
|
+
const CodeViewer = ({ content, ranges, path, defaultLine, editorConfig = {} }) => {
|
|
25
|
+
const handleEditorDidMount = (editor, monaco) => {
|
|
26
|
+
if (isNumber(defaultLine)) {
|
|
27
|
+
editor.revealLine(defaultLine);
|
|
28
|
+
}
|
|
29
|
+
if (ranges && ranges.length > 0) {
|
|
30
|
+
editor.deltaDecorations(
|
|
31
|
+
[],
|
|
32
|
+
ranges.map((range) => ({
|
|
33
|
+
range: getSelectionRange(range, monaco.Range),
|
|
34
|
+
options: {
|
|
35
|
+
inlineClassName: "file-inline-decoration"
|
|
36
|
+
}
|
|
37
|
+
}))
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
Editor,
|
|
43
|
+
{
|
|
44
|
+
theme: "vs-dark",
|
|
45
|
+
language: getOriginalLanguage(path),
|
|
46
|
+
value: content,
|
|
47
|
+
width: "100%",
|
|
48
|
+
height: window.innerHeight / 1.5,
|
|
49
|
+
options: __spreadValues(__spreadValues({}, DefaultEditorConfig), editorConfig),
|
|
50
|
+
onMount: handleEditorDidMount
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
const CodeViewerWithDrawer = (props) => {
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
TextDrawer,
|
|
57
|
+
{
|
|
58
|
+
text: "",
|
|
59
|
+
buttonProps: {
|
|
60
|
+
size: "small",
|
|
61
|
+
icon: /* @__PURE__ */ jsx(CodepenOutlined, {}),
|
|
62
|
+
type: "default"
|
|
63
|
+
},
|
|
64
|
+
buttonStyle: { padding: `0 4px` },
|
|
65
|
+
drawerProps: {
|
|
66
|
+
destroyOnClose: true,
|
|
67
|
+
title: `Code of "${props.path}"`
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ jsx(CodeViewer, __spreadValues({}, props))
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
CodeViewer,
|
|
75
|
+
CodeViewerWithDrawer
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './webpack';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./webpack";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface WebpackConfigurationViewerBaseProps {
|
|
4
|
+
defaultKeys?: string[];
|
|
5
|
+
configs: SDK.ConfigData;
|
|
6
|
+
}
|
|
7
|
+
export declare const WebpackConfigurationViewerBase: React.FC<WebpackConfigurationViewerBaseProps>;
|
|
8
|
+
export declare const WebpackConfigurationViewer: React.FC<Omit<WebpackConfigurationViewerBaseProps, "configs"> & Partial<{
|
|
9
|
+
body: {
|
|
10
|
+
key: import("@rsdoctor/types/dist/manifest").DoctorManifestMappingKeys;
|
|
11
|
+
};
|
|
12
|
+
}>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SDK } from "@rsdoctor/types";
|
|
3
|
+
import { Divider, Row, Select, Space, Typography } from "antd";
|
|
4
|
+
import { pick } from "lodash-es";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import ReactJson from "react-json-view";
|
|
7
|
+
import { useWebpackConfigurationByConfigs } from "../../utils";
|
|
8
|
+
import { withServerAPI } from "../Manifest";
|
|
9
|
+
import { TextDrawer } from "../TextDrawer";
|
|
10
|
+
import { Title } from "../Title";
|
|
11
|
+
const WebpackConfigurationViewerBase = ({
|
|
12
|
+
defaultKeys,
|
|
13
|
+
configs
|
|
14
|
+
}) => {
|
|
15
|
+
const webpackData = useWebpackConfigurationByConfigs(configs || []);
|
|
16
|
+
if (!webpackData)
|
|
17
|
+
return null;
|
|
18
|
+
const { config: webpack, version } = webpackData;
|
|
19
|
+
const keys = Object.keys(webpack);
|
|
20
|
+
const [selectKeys, setSelectKeys] = useState(defaultKeys || keys);
|
|
21
|
+
return /* @__PURE__ */ jsx(TextDrawer, { text: "View Builder Config", children: /* @__PURE__ */ jsxs(Row, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Title, { text: `Builder Config Viewer` }),
|
|
23
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
24
|
+
/* @__PURE__ */ jsxs(Space, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: "Properties: " }),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
Select,
|
|
28
|
+
{
|
|
29
|
+
dropdownStyle: { zIndex: 999 },
|
|
30
|
+
mode: "multiple",
|
|
31
|
+
allowClear: true,
|
|
32
|
+
value: selectKeys.length === keys.length ? [] : selectKeys,
|
|
33
|
+
style: { width: 350 },
|
|
34
|
+
dropdownMatchSelectWidth: true,
|
|
35
|
+
placeholder: "Show Selected Properties Only.",
|
|
36
|
+
onChange: (e) => {
|
|
37
|
+
setSelectKeys(e);
|
|
38
|
+
},
|
|
39
|
+
children: keys.map((e) => {
|
|
40
|
+
return /* @__PURE__ */ jsx(Select.Option, { label: e, value: e, children: e }, e);
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
ReactJson,
|
|
48
|
+
{
|
|
49
|
+
name: version && version !== "unknown" ? `webpack@${version}` : `webpack.config`,
|
|
50
|
+
theme: "monokai",
|
|
51
|
+
src: selectKeys.length === 0 ? webpack : pick(webpack, selectKeys),
|
|
52
|
+
displayDataTypes: false,
|
|
53
|
+
displayObjectSize: false
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] }) });
|
|
57
|
+
};
|
|
58
|
+
const WebpackConfigurationViewer = withServerAPI({
|
|
59
|
+
Component: WebpackConfigurationViewerBase,
|
|
60
|
+
api: SDK.ServerAPI.API.LoadDataByKey,
|
|
61
|
+
responsePropName: "configs",
|
|
62
|
+
body: {
|
|
63
|
+
key: "configs"
|
|
64
|
+
},
|
|
65
|
+
showSkeleton: false
|
|
66
|
+
});
|
|
67
|
+
export {
|
|
68
|
+
WebpackConfigurationViewer,
|
|
69
|
+
WebpackConfigurationViewerBase
|
|
70
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.rc-tree {
|
|
2
|
+
margin: 0;
|
|
3
|
+
border: 1px solid transparent;
|
|
4
|
+
}
|
|
5
|
+
.rc-tree .rc-tree-treenode {
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
line-height: 24px;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
list-style: none;
|
|
11
|
+
outline: 0;
|
|
12
|
+
}
|
|
13
|
+
.rc-tree .rc-tree-treenode .rc-tree-node-content-wrapper {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: inline-block;
|
|
16
|
+
height: 24px;
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0 4px;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
vertical-align: top;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
.rc-tree .rc-tree-treenode-child-tree {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
.rc-tree .rc-tree-treenode-child-tree-open {
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
.rc-tree .rc-tree-treenode-treenode-disabled > span:not(.rc-tree-switcher),
|
|
31
|
+
.rc-tree .rc-tree-treenode > a,
|
|
32
|
+
.rc-tree .rc-tree-treenode > a span {
|
|
33
|
+
color: #767676;
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
}
|
|
36
|
+
.rc-tree .rc-tree-treenode-treenode-selected {
|
|
37
|
+
background: rgba(5, 145, 255, 0.3);
|
|
38
|
+
border-radius: 4px;
|
|
39
|
+
}
|
|
40
|
+
.rc-tree .rc-tree-treenode-title {
|
|
41
|
+
display: inline-block;
|
|
42
|
+
}
|
|
43
|
+
.rc-tree .rc-tree-treenode-indent {
|
|
44
|
+
display: inline-block;
|
|
45
|
+
height: 0;
|
|
46
|
+
vertical-align: bottom;
|
|
47
|
+
}
|
|
48
|
+
.rc-tree .rc-tree-treenode-indent-unit {
|
|
49
|
+
display: inline-block;
|
|
50
|
+
width: 14px;
|
|
51
|
+
}
|
|
52
|
+
.file-tree-switcher-arrow {
|
|
53
|
+
transform: rotate(0deg);
|
|
54
|
+
transition: transform 0.3s ease;
|
|
55
|
+
}
|
|
56
|
+
.file-tree-switcher-arrow-expand {
|
|
57
|
+
transform: rotate(90deg);
|
|
58
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { Space } from "antd";
|
|
19
|
+
import { FileOutlined, FolderOpenOutlined, FolderOutlined, RightOutlined } from "@ant-design/icons";
|
|
20
|
+
import Tree from "rc-tree";
|
|
21
|
+
import { Size } from "../../constants";
|
|
22
|
+
import "./index.css";
|
|
23
|
+
import { useTheme } from "../../utils";
|
|
24
|
+
const FileTree = (props) => {
|
|
25
|
+
const { isDark } = useTheme();
|
|
26
|
+
const color = isDark ? "#fff" : "#000";
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Tree,
|
|
29
|
+
__spreadValues({
|
|
30
|
+
checkable: false,
|
|
31
|
+
selectable: true,
|
|
32
|
+
switcherIcon: ({ data, expanded }) => {
|
|
33
|
+
if (data == null ? void 0 : data.children) {
|
|
34
|
+
return /* @__PURE__ */ jsxs(Space, { style: { color }, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
RightOutlined,
|
|
37
|
+
{
|
|
38
|
+
className: `file-tree-switcher-arrow ${expanded ? "file-tree-switcher-arrow-expand" : ""}`,
|
|
39
|
+
style: { fontSize: 10, color }
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
expanded ? /* @__PURE__ */ jsx(FolderOpenOutlined, { style: { fontSize: 14, color } }) : /* @__PURE__ */ jsx(FolderOutlined, { style: { fontSize: 14, color } })
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ jsx(FileOutlined, { style: { marginLeft: Size.BasePadding - 6, color } });
|
|
46
|
+
},
|
|
47
|
+
expandAction: "click"
|
|
48
|
+
}, props)
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
FileTree
|
|
53
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface KeywordProps {
|
|
3
|
+
style?: React.CSSProperties;
|
|
4
|
+
labelStyle?: React.CSSProperties;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
label?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
delay?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
onChange: (keyword: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const KeywordInput: React.FC<KeywordProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { useEffect, useRef, useState } from "react";
|
|
19
|
+
import { Button, Input, Typography } from "antd";
|
|
20
|
+
const KeywordInput = ({
|
|
21
|
+
icon: Icon,
|
|
22
|
+
label,
|
|
23
|
+
labelStyle: ls = {},
|
|
24
|
+
placeholder,
|
|
25
|
+
onChange,
|
|
26
|
+
style,
|
|
27
|
+
className,
|
|
28
|
+
width,
|
|
29
|
+
delay = 300
|
|
30
|
+
}) => {
|
|
31
|
+
const labelWidth = 120;
|
|
32
|
+
const [filename, setFilename] = useState("");
|
|
33
|
+
const labelStyle = __spreadValues({ width: labelWidth }, ls);
|
|
34
|
+
const ref = useRef(null);
|
|
35
|
+
let timer;
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
onChange(filename);
|
|
38
|
+
}, [filename]);
|
|
39
|
+
return /* @__PURE__ */ jsxs(Input.Group, { compact: true, style, className, children: [
|
|
40
|
+
label || Icon ? /* @__PURE__ */ jsxs(
|
|
41
|
+
Button,
|
|
42
|
+
{
|
|
43
|
+
style: labelStyle,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
if (ref && ref.current) {
|
|
46
|
+
ref.current.focus();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
Icon || null,
|
|
51
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: label })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
) : null,
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
Input,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
allowClear: true,
|
|
60
|
+
defaultValue: filename,
|
|
61
|
+
style: { width: width ? width - labelWidth : 250 },
|
|
62
|
+
placeholder,
|
|
63
|
+
onChange: (e) => {
|
|
64
|
+
clearTimeout(timer);
|
|
65
|
+
const v = e.target.value.trim();
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
setFilename(v);
|
|
68
|
+
}, delay);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
KeywordInput
|
|
76
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { jsx } from "react/jsx-runtime";
|
|
33
|
+
import { Typography } from "antd";
|
|
34
|
+
const Keyword = (_a) => {
|
|
35
|
+
var _b = _a, { text, keyword } = _b, rest = __objRest(_b, ["text", "keyword"]);
|
|
36
|
+
if (!keyword) {
|
|
37
|
+
return /* @__PURE__ */ jsx(Typography.Text, __spreadProps(__spreadValues({}, rest), { children: text }));
|
|
38
|
+
}
|
|
39
|
+
const idx = text.indexOf(keyword);
|
|
40
|
+
if (idx === -1) {
|
|
41
|
+
return /* @__PURE__ */ jsx(Typography.Text, __spreadProps(__spreadValues({}, rest), { children: text }));
|
|
42
|
+
}
|
|
43
|
+
const els = [];
|
|
44
|
+
let str = text;
|
|
45
|
+
while (str.length > 0) {
|
|
46
|
+
const idx2 = str.indexOf(keyword);
|
|
47
|
+
if (idx2 > -1) {
|
|
48
|
+
if (idx2 !== 0) {
|
|
49
|
+
els.push(
|
|
50
|
+
/* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: "inherit" }, children: str.slice(0, idx2) }, els.length)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
els.push(
|
|
54
|
+
/* @__PURE__ */ jsx(Typography.Text, { mark: true, style: { fontSize: "inherit" }, children: keyword }, els.length)
|
|
55
|
+
);
|
|
56
|
+
str = str.slice(idx2 + keyword.length);
|
|
57
|
+
} else {
|
|
58
|
+
els.push(
|
|
59
|
+
/* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: "inherit" }, children: str }, els.length)
|
|
60
|
+
);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return /* @__PURE__ */ jsx(Typography.Text, __spreadProps(__spreadValues({}, rest), { children: els }));
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
Keyword
|
|
68
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select, Divider, Typography } from "antd";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import Icon from "../../assets/connection-point.3b3c78ca.svg";
|
|
5
|
+
import { fetchManifest, changeOrigin } from "../../utils";
|
|
6
|
+
const BuilderSelect = () => {
|
|
7
|
+
const [buildName, setBuildName] = useState("");
|
|
8
|
+
const [series, setSeries] = useState([]);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
fetchManifest().then(({ name, series: series2 }) => {
|
|
11
|
+
if (name) {
|
|
12
|
+
setBuildName(name);
|
|
13
|
+
}
|
|
14
|
+
if (series2 && series2.length > 0) {
|
|
15
|
+
setSeries(series2);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}, []);
|
|
19
|
+
if (buildName.length <= 0 || series.length <= 0) {
|
|
20
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical", style: { margin: "0 24px" } }),
|
|
24
|
+
/* @__PURE__ */ jsx("img", { src: Icon, style: { marginRight: 6, height: 16 } }),
|
|
25
|
+
/* @__PURE__ */ jsx(Typography, { children: "Compiler" }),
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
Select,
|
|
28
|
+
{
|
|
29
|
+
className: "builder-selector",
|
|
30
|
+
defaultValue: buildName,
|
|
31
|
+
bordered: false,
|
|
32
|
+
style: { minWidth: 100 },
|
|
33
|
+
onChange: (val) => {
|
|
34
|
+
const item = series.find((item2) => item2.name === val);
|
|
35
|
+
if (item) {
|
|
36
|
+
if (item.origin) {
|
|
37
|
+
location.href = changeOrigin(item.origin);
|
|
38
|
+
} else {
|
|
39
|
+
console.error("No DoctorManifestSeriesData.origin");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
children: series.map((item, i) => /* @__PURE__ */ jsx(Select.Option, { value: item.name, className: "builder-selector-option-item", children: item.name }, i))
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] });
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
BuilderSelect
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CompileName = "Compile Analysis";
|