@rsdoctor/components 1.3.13-beta.0 → 1.3.13

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.
@@ -1,6 +1,6 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import { Col, Empty, Popover, Tag } from "antd";
3
- import { useEffect, useState } from "react";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Card, Col, Empty, Popover, Typography } from "antd";
3
+ import { useEffect, useMemo, useState } from "react";
4
4
  import { Size } from "../../constants.mjs";
5
5
  import { FileTree } from "./components/fileTreeCom.mjs";
6
6
  import { clsNamePrefix } from "./constants.mjs";
@@ -8,6 +8,57 @@ import dependency from "./dependency.mjs";
8
8
  import { getImporteds } from "./utils/index.mjs";
9
9
  import { useCreateFileTreeData } from "./utils/hooks.mjs";
10
10
  import { TabList } from "./index.mjs";
11
+ const BailoutReasonCard = ({ reasons })=>{
12
+ if (!reasons || !reasons.length) return null;
13
+ return /*#__PURE__*/ jsxs(Card, {
14
+ className: `${clsNamePrefix}-bailout-card`,
15
+ bordered: false,
16
+ bodyStyle: {
17
+ padding: 20
18
+ },
19
+ children: [
20
+ /*#__PURE__*/ jsx(Typography.Text, {
21
+ strong: true,
22
+ className: `${clsNamePrefix}-bailout-card-title`,
23
+ children: "Bailout Reasons"
24
+ }),
25
+ /*#__PURE__*/ jsx("div", {
26
+ className: `${clsNamePrefix}-bailout-card-list`,
27
+ style: {
28
+ maxHeight: 156,
29
+ overflowY: 'auto'
30
+ },
31
+ children: reasons.map((reason, index)=>/*#__PURE__*/ jsxs("div", {
32
+ className: `${clsNamePrefix}-bailout-card-item`,
33
+ children: [
34
+ /*#__PURE__*/ jsx(Popover, {
35
+ content: reason,
36
+ trigger: "hover",
37
+ children: /*#__PURE__*/ jsx(Typography.Paragraph, {
38
+ ellipsis: {
39
+ rows: 1
40
+ },
41
+ className: `${clsNamePrefix}-bailout-card-text`,
42
+ style: {
43
+ marginBottom: 0
44
+ },
45
+ children: reason
46
+ })
47
+ }),
48
+ /*#__PURE__*/ jsxs(Typography.Text, {
49
+ type: "secondary",
50
+ className: `${clsNamePrefix}-bailout-card-meta`,
51
+ children: [
52
+ "#",
53
+ String(index + 1).padStart(2, '0')
54
+ ]
55
+ })
56
+ ]
57
+ }, `${reason}-${index}`))
58
+ })
59
+ ]
60
+ });
61
+ };
11
62
  const ModuleFilesTree = (props)=>{
12
63
  const { curModule, modules, dependencies, cwd, activeTabKey, selectedChunk = '' } = props;
13
64
  const [importedModules, setImportedModules] = useState([]);
@@ -19,19 +70,19 @@ const ModuleFilesTree = (props)=>{
19
70
  curModule,
20
71
  modules
21
72
  ]);
22
- return /*#__PURE__*/ jsx(Fragment, {
23
- children: activeTabKey === TabList[TabList.Reasons] ? /*#__PURE__*/ jsx(Fragment, {
24
- children: importedModules ? /*#__PURE__*/ jsx(FileTree, {
25
- cwd: cwd,
26
- treeData: fileStructures,
27
- needCode: true,
28
- needShowAllTree: true,
29
- needJumpto: true,
30
- selectedChunk: selectedChunk
31
- }) : /*#__PURE__*/ jsx(Empty, {
32
- className: `${clsNamePrefix}-empty`
33
- })
34
- }) : activeTabKey === TabList[TabList.Dependencies] ? /*#__PURE__*/ jsx("div", {
73
+ const mainContent = useMemo(()=>{
74
+ if (activeTabKey === TabList[TabList.Reasons]) return importedModules ? /*#__PURE__*/ jsx(FileTree, {
75
+ cwd: cwd,
76
+ treeData: fileStructures,
77
+ needCode: true,
78
+ needShowAllTree: true,
79
+ needJumpto: true,
80
+ selectedChunk: selectedChunk,
81
+ defaultOpenFather: 1
82
+ }) : /*#__PURE__*/ jsx(Empty, {
83
+ className: `${clsNamePrefix}-empty`
84
+ });
85
+ return /*#__PURE__*/ jsx("div", {
35
86
  className: `${clsNamePrefix}-file-tree`,
36
87
  style: {
37
88
  padding: Size.BasePadding / 2
@@ -49,26 +100,20 @@ const ModuleFilesTree = (props)=>{
49
100
  className: `${clsNamePrefix}-empty`
50
101
  })
51
102
  })
52
- }) : /*#__PURE__*/ jsx("div", {
53
- children: curModule.bailoutReason?.map((reason)=>/*#__PURE__*/ jsx("div", {
54
- style: {
55
- marginBottom: 10
56
- },
57
- children: /*#__PURE__*/ jsx(Tag, {
58
- children: /*#__PURE__*/ jsx(Popover, {
59
- content: reason,
60
- children: /*#__PURE__*/ jsx("span", {
61
- style: {
62
- display: 'inline-block'
63
- },
64
- children: reason.length > 120 ? `${reason.slice(0, 120)}...` : reason
65
- })
66
- })
67
- }, reason)
68
- }))
69
- })
103
+ });
104
+ }, [
105
+ activeTabKey,
106
+ curModule,
107
+ dependencies,
108
+ fileStructures,
109
+ importedModules,
110
+ cwd,
111
+ selectedChunk
112
+ ]);
113
+ return /*#__PURE__*/ jsx(Fragment, {
114
+ children: mainContent
70
115
  });
71
116
  };
72
- export { ModuleFilesTree };
117
+ export { BailoutReasonCard, ModuleFilesTree };
73
118
 
74
119
  //# sourceMappingURL=fileTree.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"pages/ModuleAnalyze/fileTree.mjs","sources":["../../../src/pages/ModuleAnalyze/fileTree.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Col, Empty, Tag, Popover } from 'antd';\nimport React, { useEffect, useState } from 'react';\nimport { Size } from 'src/constants';\nimport { FileTree } from './components/fileTreeCom';\nimport { clsNamePrefix } from './constants';\nimport DependencyTree from './dependency';\nimport { getImporteds } from './utils';\nimport { useCreateFileTreeData } from './utils/hooks';\nimport { TabList } from './index';\n\nexport const ModuleFilesTree: React.FC<{\n modules: SDK.ModuleData[];\n dependencies: SDK.DependencyData[];\n curModule: SDK.ModuleData;\n cwd: string;\n selectedChunk: string;\n activeTabKey: string;\n}> = (props) => {\n const {\n curModule,\n modules,\n dependencies,\n cwd,\n activeTabKey,\n selectedChunk = '',\n } = props;\n const [importedModules, setImportedModules] = useState(\n [] as SDK.ModuleData[],\n );\n\n const { data: fileStructures } = useCreateFileTreeData(\n modules,\n importedModules,\n curModule,\n );\n\n useEffect(() => {\n const importeds = getImporteds(curModule, modules);\n setImportedModules(importeds);\n }, [curModule, modules]);\n\n return (\n <>\n {activeTabKey === TabList[TabList.Reasons] ? (\n <>\n {importedModules ? (\n <FileTree\n cwd={cwd}\n treeData={fileStructures}\n needCode={true}\n needShowAllTree={true}\n needJumpto={true}\n selectedChunk={selectedChunk}\n />\n ) : (\n <Empty className={`${clsNamePrefix}-empty`} />\n )}\n </>\n ) : activeTabKey === TabList[TabList.Dependencies] ? (\n <div\n className={`${clsNamePrefix}-file-tree`}\n style={{ padding: Size.BasePadding / 2 }}\n >\n <Col span={24} style={{ marginTop: Size.BasePadding / 2 }}>\n {curModule ? (\n <DependencyTree\n module={curModule}\n dependencies={dependencies}\n cwd={cwd}\n />\n ) : (\n <Empty className={`${clsNamePrefix}-empty`} />\n )}\n </Col>\n </div>\n ) : (\n <div>\n {curModule.bailoutReason?.map((reason) => (\n <div style={{ marginBottom: 10 }}>\n <Tag key={reason}>\n <Popover content={reason}>\n <span style={{ display: 'inline-block' }}>\n {reason.length > 120\n ? `${reason.slice(0, 120)}...`\n : reason}\n </span>\n </Popover>\n </Tag>\n </div>\n ))}\n </div>\n )}\n </>\n );\n};\n"],"names":["ModuleFilesTree","props","curModule","modules","dependencies","cwd","activeTabKey","selectedChunk","importedModules","setImportedModules","useState","fileStructures","useCreateFileTreeData","useEffect","importeds","getImporteds","TabList","FileTree","Empty","clsNamePrefix","Size","Col","DependencyTree","reason","Tag","Popover"],"mappings":";;;;;;;;;;AAWO,MAAMA,kBAOR,CAACC;IACJ,MAAM,EACJC,SAAS,EACTC,OAAO,EACPC,YAAY,EACZC,GAAG,EACHC,YAAY,EACZC,gBAAgB,EAAE,EACnB,GAAGN;IACJ,MAAM,CAACO,iBAAiBC,mBAAmB,GAAGC,SAC5C,EAAE;IAGJ,MAAM,EAAE,MAAMC,cAAc,EAAE,GAAGC,sBAC/BT,SACAK,iBACAN;IAGFW,UAAU;QACR,MAAMC,YAAYC,aAAab,WAAWC;QAC1CM,mBAAmBK;IACrB,GAAG;QAACZ;QAAWC;KAAQ;IAEvB,OAAO,WAAP,GACE;kBACGG,iBAAiBU,OAAO,CAACA,QAAQ,OAAO,CAAC,GAAG,WAAH,GACxC;sBACGR,kBAAkB,WAAlBA,GACC,IAACS,UAAQA;gBACP,KAAKZ;gBACL,UAAUM;gBACV,UAAU;gBACV,iBAAiB;gBACjB,YAAY;gBACZ,eAAeJ;+BAGjB,IAACW,OAAKA;gBAAC,WAAW,GAAGC,cAAc,MAAM,CAAC;;aAG5Cb,iBAAiBU,OAAO,CAACA,QAAQ,YAAY,CAAC,GAAG,WAAH,GAChD,IAAC;YACC,WAAW,GAAGG,cAAc,UAAU,CAAC;YACvC,OAAO;gBAAE,SAASC,KAAK,WAAW,GAAG;YAAE;sBAEvC,kBAACC,KAAGA;gBAAC,MAAM;gBAAI,OAAO;oBAAE,WAAWD,KAAK,WAAW,GAAG;gBAAE;0BACrDlB,YAAY,WAAZA,GACC,IAACoB,YAAcA;oBACb,QAAQpB;oBACR,cAAcE;oBACd,KAAKC;mCAGP,IAACa,OAAKA;oBAAC,WAAW,GAAGC,cAAc,MAAM,CAAC;;;2BAKhD,IAAC;sBACEjB,UAAU,aAAa,EAAE,IAAI,CAACqB,SAAAA,WAAAA,GAC7B,IAAC;oBAAI,OAAO;wBAAE,cAAc;oBAAG;8BAC7B,kBAACC,KAAGA;kCACF,kBAACC,SAAOA;4BAAC,SAASF;sCAChB,kBAAC;gCAAK,OAAO;oCAAE,SAAS;gCAAe;0CACpCA,OAAO,MAAM,GAAG,MACb,GAAGA,OAAO,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,GAC5BA;;;uBALAA;;;;AAexB"}
1
+ {"version":3,"file":"pages/ModuleAnalyze/fileTree.mjs","sources":["../../../src/pages/ModuleAnalyze/fileTree.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Card, Col, Empty, Popover, Typography } from 'antd';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport { Size } from 'src/constants';\nimport { FileTree } from './components/fileTreeCom';\nimport { clsNamePrefix } from './constants';\nimport DependencyTree from './dependency';\nimport { getImporteds } from './utils';\nimport { useCreateFileTreeData } from './utils/hooks';\nimport { TabList } from './index';\n\nexport const BailoutReasonCard: React.FC<{ reasons?: string[] }> = ({\n reasons,\n}) => {\n if (!reasons || !reasons.length) {\n return null;\n }\n return (\n <Card\n className={`${clsNamePrefix}-bailout-card`}\n bordered={false}\n bodyStyle={{ padding: 20 }}\n >\n <Typography.Text strong className={`${clsNamePrefix}-bailout-card-title`}>\n Bailout Reasons\n </Typography.Text>\n <div\n className={`${clsNamePrefix}-bailout-card-list`}\n style={{ maxHeight: 156, overflowY: 'auto' }}\n >\n {reasons.map((reason, index) => (\n <div\n className={`${clsNamePrefix}-bailout-card-item`}\n key={`${reason}-${index}`}\n >\n <Popover content={reason} trigger=\"hover\">\n <Typography.Paragraph\n ellipsis={{ rows: 1 }}\n className={`${clsNamePrefix}-bailout-card-text`}\n style={{ marginBottom: 0 }}\n >\n {reason}\n </Typography.Paragraph>\n </Popover>\n <Typography.Text\n type=\"secondary\"\n className={`${clsNamePrefix}-bailout-card-meta`}\n >\n #{String(index + 1).padStart(2, '0')}\n </Typography.Text>\n </div>\n ))}\n </div>\n </Card>\n );\n};\n\nexport const ModuleFilesTree: React.FC<{\n modules: SDK.ModuleData[];\n dependencies: SDK.DependencyData[];\n curModule: SDK.ModuleData;\n cwd: string;\n selectedChunk: string;\n activeTabKey: string;\n}> = (props) => {\n const {\n curModule,\n modules,\n dependencies,\n cwd,\n activeTabKey,\n selectedChunk = '',\n } = props;\n const [importedModules, setImportedModules] = useState(\n [] as SDK.ModuleData[],\n );\n\n const { data: fileStructures } = useCreateFileTreeData(\n modules,\n importedModules,\n curModule,\n );\n\n useEffect(() => {\n const importeds = getImporteds(curModule, modules);\n setImportedModules(importeds);\n }, [curModule, modules]);\n\n const mainContent = useMemo(() => {\n if (activeTabKey === TabList[TabList.Reasons]) {\n return importedModules ? (\n <FileTree\n cwd={cwd}\n treeData={fileStructures}\n needCode={true}\n needShowAllTree={true}\n needJumpto={true}\n selectedChunk={selectedChunk}\n defaultOpenFather={1}\n />\n ) : (\n <Empty className={`${clsNamePrefix}-empty`} />\n );\n }\n\n return (\n <div\n className={`${clsNamePrefix}-file-tree`}\n style={{ padding: Size.BasePadding / 2 }}\n >\n <Col span={24} style={{ marginTop: Size.BasePadding / 2 }}>\n {curModule ? (\n <DependencyTree\n module={curModule}\n dependencies={dependencies}\n cwd={cwd}\n />\n ) : (\n <Empty className={`${clsNamePrefix}-empty`} />\n )}\n </Col>\n </div>\n );\n }, [\n activeTabKey,\n curModule,\n dependencies,\n fileStructures,\n importedModules,\n cwd,\n selectedChunk,\n ]);\n\n return <>{mainContent}</>;\n};\n"],"names":["BailoutReasonCard","reasons","Card","clsNamePrefix","Typography","reason","index","Popover","String","ModuleFilesTree","props","curModule","modules","dependencies","cwd","activeTabKey","selectedChunk","importedModules","setImportedModules","useState","fileStructures","useCreateFileTreeData","useEffect","importeds","getImporteds","mainContent","useMemo","TabList","FileTree","Empty","Size","Col","DependencyTree"],"mappings":";;;;;;;;;;AAWO,MAAMA,oBAAsD,CAAC,EAClEC,OAAO,EACR;IACC,IAAI,CAACA,WAAW,CAACA,QAAQ,MAAM,EAC7B,OAAO;IAET,OAAO,WAAP,GACE,KAACC,MAAIA;QACH,WAAW,GAAGC,cAAc,aAAa,CAAC;QAC1C,UAAU;QACV,WAAW;YAAE,SAAS;QAAG;;0BAEzB,IAACC,WAAW,IAAI;gBAAC,QAAM;gBAAC,WAAW,GAAGD,cAAc,mBAAmB,CAAC;0BAAE;;0BAG1E,IAAC;gBACC,WAAW,GAAGA,cAAc,kBAAkB,CAAC;gBAC/C,OAAO;oBAAE,WAAW;oBAAK,WAAW;gBAAO;0BAE1CF,QAAQ,GAAG,CAAC,CAACI,QAAQC,QAAAA,WAAAA,GACpB,KAAC;wBACC,WAAW,GAAGH,cAAc,kBAAkB,CAAC;;0CAG/C,IAACI,SAAOA;gCAAC,SAASF;gCAAQ,SAAQ;0CAChC,kBAACD,WAAW,SAAS;oCACnB,UAAU;wCAAE,MAAM;oCAAE;oCACpB,WAAW,GAAGD,cAAc,kBAAkB,CAAC;oCAC/C,OAAO;wCAAE,cAAc;oCAAE;8CAExBE;;;0CAGL,KAACD,WAAW,IAAI;gCACd,MAAK;gCACL,WAAW,GAAGD,cAAc,kBAAkB,CAAC;;oCAChD;oCACGK,OAAOF,QAAQ,GAAG,QAAQ,CAAC,GAAG;;;;uBAf7B,GAAGD,OAAO,CAAC,EAAEC,OAAO;;;;AAsBrC;AAEO,MAAMG,kBAOR,CAACC;IACJ,MAAM,EACJC,SAAS,EACTC,OAAO,EACPC,YAAY,EACZC,GAAG,EACHC,YAAY,EACZC,gBAAgB,EAAE,EACnB,GAAGN;IACJ,MAAM,CAACO,iBAAiBC,mBAAmB,GAAGC,SAC5C,EAAE;IAGJ,MAAM,EAAE,MAAMC,cAAc,EAAE,GAAGC,sBAC/BT,SACAK,iBACAN;IAGFW,UAAU;QACR,MAAMC,YAAYC,aAAab,WAAWC;QAC1CM,mBAAmBK;IACrB,GAAG;QAACZ;QAAWC;KAAQ;IAEvB,MAAMa,cAAcC,QAAQ;QAC1B,IAAIX,iBAAiBY,OAAO,CAACA,QAAQ,OAAO,CAAC,EAC3C,OAAOV,kBAAkB,WAAlBA,GACL,IAACW,UAAQA;YACP,KAAKd;YACL,UAAUM;YACV,UAAU;YACV,iBAAiB;YACjB,YAAY;YACZ,eAAeJ;YACf,mBAAmB;2BAGrB,IAACa,OAAKA;YAAC,WAAW,GAAG1B,cAAc,MAAM,CAAC;;QAI9C,OAAO,WAAP,GACE,IAAC;YACC,WAAW,GAAGA,cAAc,UAAU,CAAC;YACvC,OAAO;gBAAE,SAAS2B,KAAK,WAAW,GAAG;YAAE;sBAEvC,kBAACC,KAAGA;gBAAC,MAAM;gBAAI,OAAO;oBAAE,WAAWD,KAAK,WAAW,GAAG;gBAAE;0BACrDnB,YAAY,WAAZA,GACC,IAACqB,YAAcA;oBACb,QAAQrB;oBACR,cAAcE;oBACd,KAAKC;mCAGP,IAACe,OAAKA;oBAAC,WAAW,GAAG1B,cAAc,MAAM,CAAC;;;;IAKpD,GAAG;QACDY;QACAJ;QACAE;QACAO;QACAH;QACAH;QACAE;KACD;IAED,OAAO,WAAP,GAAO;kBAAGS;;AACZ"}
@@ -16,5 +16,52 @@
16
16
  line-height: 30px;
17
17
  }
18
18
 
19
+ .module-analyze-bailout-card {
20
+ box-shadow: none;
21
+ background: #fff;
22
+ border: 1px solid #0505050f;
23
+ border-radius: 8px;
24
+ margin-top: 16px;
25
+ margin-bottom: 24px;
26
+ }
27
+
28
+ .module-analyze-bailout-card-title {
29
+ color: #1c1f23cc;
30
+ margin-bottom: 12px;
31
+ font-size: 14px;
32
+ font-weight: 600;
33
+ display: inline-block;
34
+ }
35
+
36
+ .module-analyze-bailout-card-list {
37
+ flex-direction: column;
38
+ gap: 8px;
39
+ display: flex;
40
+ }
41
+
42
+ .module-analyze-bailout-card-item {
43
+ border-bottom: 1px solid #161a2314;
44
+ justify-content: space-between;
45
+ align-items: center;
46
+ padding: 6px 0;
47
+ display: flex;
48
+ }
49
+
50
+ .module-analyze-bailout-card-item:last-child {
51
+ border-bottom: none;
52
+ }
53
+
54
+ .module-analyze-bailout-card-text {
55
+ color: #1c1f23cc;
56
+ max-width: calc(100% - 70px);
57
+ font-size: 12px;
58
+ font-weight: 400;
59
+ }
60
+
61
+ .module-analyze-bailout-card-meta {
62
+ color: #1c1f2373;
63
+ font-size: 12px;
64
+ }
65
+
19
66
 
20
67
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://./src/pages/ModuleAnalyze/index.scss"],"names":[],"mappings":"AADA;EAEE,aAAa;EACb,gBAAgB;AAClB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,sBAAsB;EACtB,aAAa;AACf;;AAEA;EACE,iBAAiB;AACnB","sourcesContent":[".module-analyze-file-tree{width:\"100%\";min-height:50em}.module-analyze-file-tree .module-analyze-empty{margin-top:20%}.module-analyze-box{display:flex;flex-direction:column}.file-tree-com-titles-box{line-height:30px}"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://./src/pages/ModuleAnalyze/index.scss"],"names":[],"mappings":"AADA;EAEE,aAAa;EACb,gBAAgB;AAClB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,sBAAsB;EACtB,aAAa;AACf;;AAEA;EACE,iBAAiB;AACnB;;AAEA;EACE,gBAAgB;EAChB,gBAAgB;EAChB,2BAA2B;EAC3B,kBAAkB;EAClB,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,qBAAqB;AACvB;;AAEA;EACE,sBAAsB;EACtB,QAAQ;EACR,aAAa;AACf;;AAEA;EACE,kCAAkC;EAClC,8BAA8B;EAC9B,mBAAmB;EACnB,cAAc;EACd,aAAa;AACf;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,gBAAgB;EAChB,eAAe;AACjB","sourcesContent":[".module-analyze-file-tree{width:\"100%\";min-height:50em}.module-analyze-file-tree .module-analyze-empty{margin-top:20%}.module-analyze-box{display:flex;flex-direction:column}.file-tree-com-titles-box{line-height:30px}.module-analyze-bailout-card{margin-top:16px;border-radius:8px;border:1px solid rgba(5,5,5,.06);box-shadow:none;background:#fff;margin-bottom:24px}.module-analyze-bailout-card-title{display:inline-block;font-size:14px;margin-bottom:12px;color:rgba(28,31,35,.8);font-weight:600}.module-analyze-bailout-card-list{display:flex;flex-direction:column;gap:8px}.module-analyze-bailout-card-item{display:flex;align-items:center;justify-content:space-between;padding:6px 0;border-bottom:1px solid rgba(22,26,35,.08)}.module-analyze-bailout-card-item:last-child{border-bottom:none}.module-analyze-bailout-card-text{max-width:calc(100% - 70px);font-weight:400;font-size:12px;color:rgba(28,31,35,.8)}.module-analyze-bailout-card-meta{font-size:12px;color:rgba(28,31,35,.45)}"],"sourceRoot":""}
@@ -3,8 +3,7 @@ import React from 'react';
3
3
  import './index.scss';
4
4
  export declare enum TabList {
5
5
  Reasons = 0,
6
- Dependencies = 1,
7
- BailoutReason = 2
6
+ Dependencies = 1
8
7
  }
9
8
  export declare const ModuleAnalyzeComponent: React.FC<{
10
9
  modules: SDK.ModuleData[];
@@ -1,18 +1,17 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { SDK } from "@rsdoctor/types";
3
- import { Badge, Card, Col, Drawer, Popover, Row, Space, Typography } from "antd";
3
+ import { Badge, Card, Drawer, Popover, Space, Typography } from "antd";
4
4
  import { useState } from "react";
5
5
  import { ServerAPIProvider } from "../../components/Manifest/index.mjs";
6
6
  import { getShortPath } from "../../utils/index.mjs";
7
7
  import { ModuleGraphListContext } from "../BundleSize/config.mjs";
8
- import { ModuleFilesTree } from "./fileTree.mjs";
8
+ import { BailoutReasonCard, ModuleFilesTree } from "./fileTree.mjs";
9
9
  import "./index.css";
10
10
  import { drawerWidth } from "../../constants.mjs";
11
11
  import { LeftSquareOutlined, QuestionCircleOutlined, RightSquareTwoTone } from "@ant-design/icons";
12
12
  var ModuleAnalyze_TabList = /*#__PURE__*/ function(TabList) {
13
13
  TabList[TabList["Reasons"] = 0] = "Reasons";
14
14
  TabList[TabList["Dependencies"] = 1] = "Dependencies";
15
- TabList[TabList["BailoutReason"] = 2] = "BailoutReason";
16
15
  return TabList;
17
16
  }({});
18
17
  const tabslist = [
@@ -23,10 +22,6 @@ const tabslist = [
23
22
  {
24
23
  key: ModuleAnalyze_TabList[1],
25
24
  label: ModuleAnalyze_TabList[1]
26
- },
27
- {
28
- key: ModuleAnalyze_TabList[2],
29
- label: ModuleAnalyze_TabList[2]
30
25
  }
31
26
  ];
32
27
  const ModuleAnalyzeComponent = ({ modules, cwd, moduleId, show, setShow })=>{
@@ -61,65 +56,74 @@ const ModuleAnalyzeComponent = ({ modules, cwd, moduleId, show, setShow })=>{
61
56
  api: SDK.ServerAPI.API.GetAllChunkGraph,
62
57
  body: {},
63
58
  children: (_chunks)=>/*#__PURE__*/ jsx(ModuleGraphListContext.Consumer, {
64
- children: ({ moduleJumpList, setModuleJumpList })=>/*#__PURE__*/ jsx(Card, {
65
- style: {
66
- minHeight: 400
67
- },
68
- tabList: tabslist,
69
- activeTabKey: activeTabKey,
70
- tabProps: {
71
- size: 'small',
72
- style: {
73
- fontSize: 12
74
- }
75
- },
76
- onTabChange: (k)=>setActiveTabKey(k),
77
- styles: {
78
- title: {
79
- paddingTop: 0
80
- }
81
- },
82
- title: /*#__PURE__*/ jsxs(Space, {
83
- style: {
84
- padding: '10px 0px'
85
- },
86
- children: [
87
- /*#__PURE__*/ jsx(LeftSquareOutlined, {
88
- onClick: ()=>{
89
- const _list = [
90
- ...moduleJumpList.slice(0, -1)
91
- ];
92
- setModuleJumpList(_list);
59
+ children: ({ moduleJumpList, setModuleJumpList })=>/*#__PURE__*/ jsxs(Fragment, {
60
+ children: [
61
+ /*#__PURE__*/ jsx("div", {
62
+ style: {
63
+ marginTop: 16
64
+ },
65
+ children: /*#__PURE__*/ jsx(BailoutReasonCard, {
66
+ reasons: module.bailoutReason
67
+ })
68
+ }),
69
+ /*#__PURE__*/ jsx(Card, {
70
+ style: {
71
+ minHeight: 400
72
+ },
73
+ tabList: tabslist,
74
+ activeTabKey: activeTabKey,
75
+ tabProps: {
76
+ size: 'small',
77
+ style: {
78
+ fontSize: 12
93
79
  }
94
- }),
95
- /*#__PURE__*/ jsx(Typography.Text, {
96
- children: "Current Module Imported Reasons Tree"
97
- }),
98
- /*#__PURE__*/ jsx(Popover, {
99
- content: /*#__PURE__*/ jsx("div", {
100
- children: /*#__PURE__*/ jsxs("div", {
101
- children: [
102
- /*#__PURE__*/ jsx(Badge, {
103
- status: "success",
104
- text: " "
105
- }),
106
- /*#__PURE__*/ jsx(RightSquareTwoTone, {}),
107
- /*#__PURE__*/ jsx(Typography.Text, {
108
- children: ': Jump button, click to jump to the Module dependency analysis page of this module.'
80
+ },
81
+ onTabChange: (k)=>setActiveTabKey(k),
82
+ styles: {
83
+ title: {
84
+ paddingTop: 0
85
+ }
86
+ },
87
+ title: /*#__PURE__*/ jsxs(Space, {
88
+ style: {
89
+ padding: '10px 0px'
90
+ },
91
+ children: [
92
+ /*#__PURE__*/ jsx(LeftSquareOutlined, {
93
+ onClick: ()=>{
94
+ const _list = [
95
+ ...moduleJumpList.slice(0, -1)
96
+ ];
97
+ setModuleJumpList(_list);
98
+ }
99
+ }),
100
+ /*#__PURE__*/ jsx(Typography.Text, {
101
+ style: {
102
+ fontSize: 14,
103
+ color: 'rgba(28, 31, 35, 0.8)'
104
+ },
105
+ children: "Current Module Imported Reasons Tree"
106
+ }),
107
+ /*#__PURE__*/ jsx(Popover, {
108
+ content: /*#__PURE__*/ jsx("div", {
109
+ children: /*#__PURE__*/ jsxs("div", {
110
+ children: [
111
+ /*#__PURE__*/ jsx(Badge, {
112
+ status: "success",
113
+ text: " "
114
+ }),
115
+ /*#__PURE__*/ jsx(RightSquareTwoTone, {}),
116
+ /*#__PURE__*/ jsx(Typography.Text, {
117
+ children: ': Jump button, click to jump to the Module dependency analysis page of this module.'
118
+ })
119
+ ]
109
120
  })
110
- ]
121
+ }),
122
+ title: "Usage",
123
+ children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {})
111
124
  })
112
- }),
113
- title: "Usage",
114
- children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {})
115
- })
116
- ]
117
- }),
118
- children: /*#__PURE__*/ jsx(Row, {
119
- justify: "start",
120
- align: "middle",
121
- children: /*#__PURE__*/ jsx(Col, {
122
- span: 24,
125
+ ]
126
+ }),
123
127
  children: /*#__PURE__*/ jsx(ModuleFilesTree, {
124
128
  curModule: module,
125
129
  modules: modules,
@@ -129,7 +133,7 @@ const ModuleAnalyzeComponent = ({ modules, cwd, moduleId, show, setShow })=>{
129
133
  activeTabKey: activeTabKey
130
134
  })
131
135
  })
132
- })
136
+ ]
133
137
  })
134
138
  })
135
139
  })
@@ -1 +1 @@
1
- {"version":3,"file":"pages/ModuleAnalyze/index.mjs","sources":["../../../src/pages/ModuleAnalyze/index.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport {\n Badge,\n Card,\n Col,\n Drawer,\n Popover,\n Row,\n Space,\n Typography,\n} from 'antd';\nimport React, { useState } from 'react';\nimport { ServerAPIProvider } from 'src/components/Manifest';\nimport { getShortPath } from 'src/utils';\nimport { ModuleGraphListContext } from '../BundleSize/config';\nimport { ModuleFilesTree } from './fileTree';\nimport './index.scss';\nimport { drawerWidth } from '../../constants';\nimport {\n LeftSquareOutlined,\n QuestionCircleOutlined,\n RightSquareTwoTone,\n} from '@ant-design/icons';\n\nexport enum TabList {\n Reasons,\n Dependencies,\n BailoutReason,\n}\n\nconst tabslist = [\n {\n key: TabList[TabList.Reasons],\n label: TabList[TabList.Reasons],\n },\n {\n key: TabList[TabList.Dependencies],\n label: TabList[TabList.Dependencies],\n },\n {\n key: TabList[TabList.BailoutReason],\n label: TabList[TabList.BailoutReason],\n },\n] as unknown as { key: string; label: string }[];\n\nexport const ModuleAnalyzeComponent: React.FC<{\n modules: SDK.ModuleData[];\n cwd: string;\n moduleId: string | number;\n show: boolean;\n setShow: (arg: boolean) => void;\n}> = ({ modules, cwd, moduleId, show, setShow }) => {\n const [selectedChunk, _setSelectedChunk] = useState('' as string);\n const [activeTabKey, setActiveTabKey] = useState(TabList[TabList.Reasons]);\n\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetModuleDetails}\n body={{ moduleId: +moduleId }}\n >\n {({ module, dependencies }) => {\n return (\n <Drawer\n title={\n <div className=\"module-analyze-box\">\n <Typography.Text>{getShortPath(module.path)}</Typography.Text>\n <Typography.Text\n style={{ fontSize: 12, color: 'rgba(0, 0, 0, 0.45)' }}\n >\n {`Current Module: ${module.path}`}\n </Typography.Text>\n </div>\n }\n open={show}\n maskClosable\n width={drawerWidth * 0.8}\n onClose={() => setShow(false)}\n >\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetAllChunkGraph}\n body={{}}\n >\n {(_chunks) => {\n return (\n <ModuleGraphListContext.Consumer>\n {({ moduleJumpList, setModuleJumpList }) => {\n return (\n <Card\n style={{ minHeight: 400 }}\n tabList={tabslist}\n activeTabKey={activeTabKey}\n tabProps={{\n size: 'small',\n style: {\n fontSize: 12,\n },\n }}\n onTabChange={(k) => setActiveTabKey(k)}\n styles={{\n title: { paddingTop: 0 },\n }}\n title={\n <Space style={{ padding: '10px 0px' }}>\n <LeftSquareOutlined\n onClick={() => {\n const _list = [\n ...moduleJumpList.slice(0, -1),\n ];\n setModuleJumpList(_list);\n }}\n />\n <Typography.Text>\n Current Module Imported Reasons Tree\n </Typography.Text>\n <Popover\n content={\n <div>\n <div>\n <Badge status=\"success\" text=\" \" />\n <RightSquareTwoTone />\n <Typography.Text>\n {\n ': Jump button, click to jump to the Module dependency analysis page of this module.'\n }\n </Typography.Text>\n </div>\n </div>\n }\n title=\"Usage\"\n >\n <QuestionCircleOutlined />\n </Popover>\n </Space>\n }\n >\n <Row justify=\"start\" align=\"middle\">\n <Col span={24}>\n <ModuleFilesTree\n curModule={module}\n modules={modules}\n dependencies={dependencies}\n cwd={cwd}\n selectedChunk={selectedChunk}\n activeTabKey={activeTabKey}\n />\n </Col>\n </Row>\n </Card>\n );\n }}\n </ModuleGraphListContext.Consumer>\n );\n }}\n </ServerAPIProvider>\n </Drawer>\n );\n }}\n </ServerAPIProvider>\n );\n};\n"],"names":["TabList","tabslist","ModuleAnalyzeComponent","modules","cwd","moduleId","show","setShow","selectedChunk","_setSelectedChunk","useState","activeTabKey","setActiveTabKey","ServerAPIProvider","SDK","module","dependencies","Drawer","Typography","getShortPath","drawerWidth","_chunks","ModuleGraphListContext","moduleJumpList","setModuleJumpList","Card","k","Space","LeftSquareOutlined","_list","Popover","Badge","RightSquareTwoTone","QuestionCircleOutlined","Row","Col","ModuleFilesTree"],"mappings":";;;;;;;;;;;AAwBO,IAAKA,wBAAOA,WAAAA,GAAAA,SAAPA,OAAO;;;;WAAPA;;AAMZ,MAAMC,WAAW;IACf;QACE,KAAKD,qBAAO,CAAC,EAAgB;QAC7B,OAAOA,qBAAO,CAAC,EAAgB;IACjC;IACA;QACE,KAAKA,qBAAO,CAAC,EAAqB;QAClC,OAAOA,qBAAO,CAAC,EAAqB;IACtC;IACA;QACE,KAAKA,qBAAO,CAAC,EAAsB;QACnC,OAAOA,qBAAO,CAAC,EAAsB;IACvC;CACD;AAEM,MAAME,yBAMR,CAAC,EAAEC,OAAO,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAE;IAC7C,MAAM,CAACC,eAAeC,kBAAkB,GAAGC,SAAS;IACpD,MAAM,CAACC,cAAcC,gBAAgB,GAAGF,SAASV,qBAAO,CAAC,EAAgB;IAEzE,OAAO,WAAP,GACE,IAACa,mBAAiBA;QAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,gBAAgB;QACvC,MAAM;YAAE,UAAU,CAACT;QAAS;kBAE3B,CAAC,EAAEU,MAAM,EAAEC,YAAY,EAAE,GACjB,WAAP,GACE,IAACC,QAAMA;gBACL,qBACE,KAAC;oBAAI,WAAU;;sCACb,IAACC,WAAW,IAAI;sCAAEC,aAAaJ,OAAO,IAAI;;sCAC1C,IAACG,WAAW,IAAI;4BACd,OAAO;gCAAE,UAAU;gCAAI,OAAO;4BAAsB;sCAEnD,CAAC,gBAAgB,EAAEH,OAAO,IAAI,EAAE;;;;gBAIvC,MAAMT;gBACN,cAAY;gBACZ,OAAOc,AAAc,MAAdA;gBACP,SAAS,IAAMb,QAAQ;0BAEvB,kBAACM,mBAAiBA;oBAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,gBAAgB;oBACvC,MAAM,CAAC;8BAEN,CAACO,UACO,WAAP,GACE,IAACC,uBAAuB,QAAQ;sCAC7B,CAAC,EAAEC,cAAc,EAAEC,iBAAiB,EAAE,GAC9B,WAAP,GACE,IAACC,MAAIA;oCACH,OAAO;wCAAE,WAAW;oCAAI;oCACxB,SAASxB;oCACT,cAAcU;oCACd,UAAU;wCACR,MAAM;wCACN,OAAO;4CACL,UAAU;wCACZ;oCACF;oCACA,aAAa,CAACe,IAAMd,gBAAgBc;oCACpC,QAAQ;wCACN,OAAO;4CAAE,YAAY;wCAAE;oCACzB;oCACA,qBACE,KAACC,OAAKA;wCAAC,OAAO;4CAAE,SAAS;wCAAW;;0DAClC,IAACC,oBAAkBA;gDACjB,SAAS;oDACP,MAAMC,QAAQ;2DACTN,eAAe,KAAK,CAAC,GAAG;qDAC5B;oDACDC,kBAAkBK;gDACpB;;0DAEF,IAACX,WAAW,IAAI;0DAAC;;0DAGjB,IAACY,SAAOA;gDACN,uBACE,IAAC;8DACC,mBAAC;;0EACC,IAACC,OAAKA;gEAAC,QAAO;gEAAU,MAAK;;0EAC7B,IAACC,oBAAkBA,CAAAA;0EACnB,IAACd,WAAW,IAAI;0EAEZ;;;;;gDAMV,OAAM;0DAEN,kBAACe,wBAAsBA,CAAAA;;;;8CAK7B,kBAACC,KAAGA;wCAAC,SAAQ;wCAAQ,OAAM;kDACzB,kBAACC,KAAGA;4CAAC,MAAM;sDACT,kBAACC,iBAAeA;gDACd,WAAWrB;gDACX,SAASZ;gDACT,cAAca;gDACd,KAAKZ;gDACL,eAAeI;gDACf,cAAcG;;;;;;;;;AAgB9C"}
1
+ {"version":3,"file":"pages/ModuleAnalyze/index.mjs","sources":["../../../src/pages/ModuleAnalyze/index.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Badge, Card, Drawer, Popover, Space, Typography } from 'antd';\nimport React, { useState } from 'react';\nimport { ServerAPIProvider } from 'src/components/Manifest';\nimport { getShortPath } from 'src/utils';\nimport { ModuleGraphListContext } from '../BundleSize/config';\nimport { ModuleFilesTree, BailoutReasonCard } from './fileTree';\nimport './index.scss';\nimport { drawerWidth } from '../../constants';\nimport {\n LeftSquareOutlined,\n QuestionCircleOutlined,\n RightSquareTwoTone,\n} from '@ant-design/icons';\n\nexport enum TabList {\n Reasons,\n Dependencies,\n}\n\nconst tabslist = [\n {\n key: TabList[TabList.Reasons],\n label: TabList[TabList.Reasons],\n },\n {\n key: TabList[TabList.Dependencies],\n label: TabList[TabList.Dependencies],\n },\n] as unknown as { key: string; label: string }[];\n\nexport const ModuleAnalyzeComponent: React.FC<{\n modules: SDK.ModuleData[];\n cwd: string;\n moduleId: string | number;\n show: boolean;\n setShow: (arg: boolean) => void;\n}> = ({ modules, cwd, moduleId, show, setShow }) => {\n const [selectedChunk, _setSelectedChunk] = useState('' as string);\n const [activeTabKey, setActiveTabKey] = useState(TabList[TabList.Reasons]);\n\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetModuleDetails}\n body={{ moduleId: +moduleId }}\n >\n {({ module, dependencies }) => {\n return (\n <Drawer\n title={\n <div className=\"module-analyze-box\">\n <Typography.Text>{getShortPath(module.path)}</Typography.Text>\n <Typography.Text\n style={{ fontSize: 12, color: 'rgba(0, 0, 0, 0.45)' }}\n >\n {`Current Module: ${module.path}`}\n </Typography.Text>\n </div>\n }\n open={show}\n maskClosable\n width={drawerWidth * 0.8}\n onClose={() => setShow(false)}\n >\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetAllChunkGraph}\n body={{}}\n >\n {(_chunks) => {\n return (\n <ModuleGraphListContext.Consumer>\n {({ moduleJumpList, setModuleJumpList }) => {\n return (\n <>\n <div style={{ marginTop: 16 }}>\n <BailoutReasonCard reasons={module.bailoutReason} />\n </div>\n <Card\n style={{ minHeight: 400 }}\n tabList={tabslist}\n activeTabKey={activeTabKey}\n tabProps={{\n size: 'small',\n style: {\n fontSize: 12,\n },\n }}\n onTabChange={(k) => setActiveTabKey(k)}\n styles={{\n title: { paddingTop: 0 },\n }}\n title={\n <Space style={{ padding: '10px 0px' }}>\n <LeftSquareOutlined\n onClick={() => {\n const _list = [\n ...moduleJumpList.slice(0, -1),\n ];\n setModuleJumpList(_list);\n }}\n />\n <Typography.Text\n style={{\n fontSize: 14,\n color: 'rgba(28, 31, 35, 0.8)',\n }}\n >\n Current Module Imported Reasons Tree\n </Typography.Text>\n <Popover\n content={\n <div>\n <div>\n <Badge status=\"success\" text=\" \" />\n <RightSquareTwoTone />\n <Typography.Text>\n {\n ': Jump button, click to jump to the Module dependency analysis page of this module.'\n }\n </Typography.Text>\n </div>\n </div>\n }\n title=\"Usage\"\n >\n <QuestionCircleOutlined />\n </Popover>\n </Space>\n }\n >\n <ModuleFilesTree\n curModule={module}\n modules={modules}\n dependencies={dependencies}\n cwd={cwd}\n selectedChunk={selectedChunk}\n activeTabKey={activeTabKey}\n />\n </Card>\n </>\n );\n }}\n </ModuleGraphListContext.Consumer>\n );\n }}\n </ServerAPIProvider>\n </Drawer>\n );\n }}\n </ServerAPIProvider>\n );\n};\n"],"names":["TabList","tabslist","ModuleAnalyzeComponent","modules","cwd","moduleId","show","setShow","selectedChunk","_setSelectedChunk","useState","activeTabKey","setActiveTabKey","ServerAPIProvider","SDK","module","dependencies","Drawer","Typography","getShortPath","drawerWidth","_chunks","ModuleGraphListContext","moduleJumpList","setModuleJumpList","BailoutReasonCard","Card","k","Space","LeftSquareOutlined","_list","Popover","Badge","RightSquareTwoTone","QuestionCircleOutlined","ModuleFilesTree"],"mappings":";;;;;;;;;;;AAeO,IAAKA,wBAAOA,WAAAA,GAAAA,SAAPA,OAAO;;;WAAPA;;AAKZ,MAAMC,WAAW;IACf;QACE,KAAKD,qBAAO,CAAC,EAAgB;QAC7B,OAAOA,qBAAO,CAAC,EAAgB;IACjC;IACA;QACE,KAAKA,qBAAO,CAAC,EAAqB;QAClC,OAAOA,qBAAO,CAAC,EAAqB;IACtC;CACD;AAEM,MAAME,yBAMR,CAAC,EAAEC,OAAO,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAE;IAC7C,MAAM,CAACC,eAAeC,kBAAkB,GAAGC,SAAS;IACpD,MAAM,CAACC,cAAcC,gBAAgB,GAAGF,SAASV,qBAAO,CAAC,EAAgB;IAEzE,OAAO,WAAP,GACE,IAACa,mBAAiBA;QAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,gBAAgB;QACvC,MAAM;YAAE,UAAU,CAACT;QAAS;kBAE3B,CAAC,EAAEU,MAAM,EAAEC,YAAY,EAAE,GACjB,WAAP,GACE,IAACC,QAAMA;gBACL,qBACE,KAAC;oBAAI,WAAU;;sCACb,IAACC,WAAW,IAAI;sCAAEC,aAAaJ,OAAO,IAAI;;sCAC1C,IAACG,WAAW,IAAI;4BACd,OAAO;gCAAE,UAAU;gCAAI,OAAO;4BAAsB;sCAEnD,CAAC,gBAAgB,EAAEH,OAAO,IAAI,EAAE;;;;gBAIvC,MAAMT;gBACN,cAAY;gBACZ,OAAOc,AAAc,MAAdA;gBACP,SAAS,IAAMb,QAAQ;0BAEvB,kBAACM,mBAAiBA;oBAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,gBAAgB;oBACvC,MAAM,CAAC;8BAEN,CAACO,UACO,WAAP,GACE,IAACC,uBAAuB,QAAQ;sCAC7B,CAAC,EAAEC,cAAc,EAAEC,iBAAiB,EAAE,GAC9B,WAAP,GACE;;sDACE,IAAC;4CAAI,OAAO;gDAAE,WAAW;4CAAG;sDAC1B,kBAACC,mBAAiBA;gDAAC,SAASV,OAAO,aAAa;;;sDAElD,IAACW,MAAIA;4CACH,OAAO;gDAAE,WAAW;4CAAI;4CACxB,SAASzB;4CACT,cAAcU;4CACd,UAAU;gDACR,MAAM;gDACN,OAAO;oDACL,UAAU;gDACZ;4CACF;4CACA,aAAa,CAACgB,IAAMf,gBAAgBe;4CACpC,QAAQ;gDACN,OAAO;oDAAE,YAAY;gDAAE;4CACzB;4CACA,qBACE,KAACC,OAAKA;gDAAC,OAAO;oDAAE,SAAS;gDAAW;;kEAClC,IAACC,oBAAkBA;wDACjB,SAAS;4DACP,MAAMC,QAAQ;mEACTP,eAAe,KAAK,CAAC,GAAG;6DAC5B;4DACDC,kBAAkBM;wDACpB;;kEAEF,IAACZ,WAAW,IAAI;wDACd,OAAO;4DACL,UAAU;4DACV,OAAO;wDACT;kEACD;;kEAGD,IAACa,SAAOA;wDACN,uBACE,IAAC;sEACC,mBAAC;;kFACC,IAACC,OAAKA;wEAAC,QAAO;wEAAU,MAAK;;kFAC7B,IAACC,oBAAkBA,CAAAA;kFACnB,IAACf,WAAW,IAAI;kFAEZ;;;;;wDAMV,OAAM;kEAEN,kBAACgB,wBAAsBA,CAAAA;;;;sDAK7B,kBAACC,iBAAeA;gDACd,WAAWpB;gDACX,SAASZ;gDACT,cAAca;gDACd,KAAKZ;gDACL,eAAeI;gDACf,cAAcG;;;;;;;;;AAe5C"}
@@ -13,14 +13,14 @@ function useCreateFileTreeData(modules, importedModules, curModule) {
13
13
  name: getShortPath(imported.path),
14
14
  __RESOURCEPATH__: imported.path,
15
15
  id: imported.id,
16
- level: 1,
16
+ level: 0,
17
17
  chunks: imported.chunks,
18
18
  size: formatSize(imported.size.parsedSize),
19
19
  kind: imported.kind,
20
20
  concatModules: imported.concatenationModules,
21
21
  fatherPath: getShortPath(curModule.path),
22
22
  dependencies: imported.dependencies,
23
- getChildren: ()=>getLeafs(imported, modules, curModule),
23
+ getChildren: ()=>getLeafs(imported, modules, curModule, 0),
24
24
  children: imported.imported
25
25
  })));
26
26
  return {
@@ -31,21 +31,22 @@ function useCreateFileTreeData(modules, importedModules, curModule) {
31
31
  curModule
32
32
  ]);
33
33
  }
34
- function getLeafs(imported, modules, fatherModule) {
34
+ function getLeafs(imported, modules, fatherModule, parentLevel) {
35
35
  const leafModules = getImporteds(imported, modules);
36
+ const currentLevel = parentLevel + 1;
36
37
  const leafs = leafModules?.map((_imported, index)=>({
37
38
  key: `0-${index}`,
38
39
  name: getShortPath(_imported.path),
39
40
  __RESOURCEPATH__: _imported.path,
40
41
  id: _imported.id,
41
- level: 1,
42
+ level: currentLevel,
42
43
  size: formatSize(_imported.size.parsedSize),
43
44
  kind: _imported.kind,
44
45
  chunks: _imported.chunks,
45
46
  concatModules: _imported.concatenationModules,
46
47
  fatherPath: getShortPath(fatherModule.path),
47
48
  dependencies: _imported.dependencies,
48
- getChildren: ()=>getLeafs(_imported, modules, imported),
49
+ getChildren: ()=>getLeafs(_imported, modules, imported, currentLevel),
49
50
  children: _imported.imported
50
51
  }));
51
52
  return leafs;
@@ -1 +1 @@
1
- {"version":3,"file":"pages/ModuleAnalyze/utils/hooks.mjs","sources":["../../../../src/pages/ModuleAnalyze/utils/hooks.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { useMemo } from 'react';\nimport { formatSize, getShortPath } from 'src/utils';\nimport { getImporteds } from '.';\nimport { Lodash } from '@rsdoctor/utils/common';\n\nexport type NewTreeNodeType = {\n __RESOURCEPATH__: string;\n id: number;\n key: string;\n name: string;\n level: number;\n kind: number;\n size?: string;\n concatModules: number[] | undefined;\n chunks?: string[];\n getChildren?: () => NewTreeNodeType[];\n dependencies?: number[];\n fatherPath?: string;\n children?: number[];\n needExpand?: boolean | string;\n};\n\nexport function useCreateFileTreeData(\n modules: SDK.ModuleData[],\n importedModules: SDK.ModuleData[],\n curModule: SDK.ModuleData,\n): { data: NewTreeNodeType[] } {\n return useMemo(() => {\n if (!importedModules || !importedModules?.length) {\n return { filterData: [], data: [] };\n }\n const root = Lodash.compact(\n importedModules?.map((imported, index) => {\n return {\n key: `0-${index}`,\n name: getShortPath(imported.path),\n __RESOURCEPATH__: imported.path,\n id: imported.id,\n level: 1,\n chunks: imported.chunks,\n size: formatSize(imported.size.parsedSize),\n kind: imported.kind,\n concatModules: imported.concatenationModules,\n fatherPath: getShortPath(curModule.path),\n dependencies: imported.dependencies,\n getChildren: () => getLeafs(imported, modules, curModule),\n children: imported.imported,\n };\n }),\n );\n // getAllTreeData(root, modules, 2, importedModules);\n return {\n data: root,\n };\n }, [importedModules, curModule]);\n}\n\nfunction getLeafs(\n imported: SDK.ModuleData,\n modules: SDK.ModuleData[],\n fatherModule: SDK.ModuleData,\n) {\n const leafModules = getImporteds(imported, modules);\n\n const leafs = leafModules?.map((_imported, index) => {\n return {\n key: `0-${index}`,\n name: getShortPath(_imported.path),\n __RESOURCEPATH__: _imported.path,\n id: _imported.id,\n level: 1,\n size: formatSize(_imported.size.parsedSize),\n kind: _imported.kind,\n chunks: _imported.chunks,\n concatModules: _imported.concatenationModules,\n fatherPath: getShortPath(fatherModule.path),\n dependencies: _imported.dependencies,\n getChildren: () => getLeafs(_imported, modules, imported),\n children: _imported.imported,\n };\n });\n return leafs;\n}\n\nexport function getContactMainModulePath(\n concatModules: number[],\n modules: SDK.ModuleData[],\n): string[] {\n const concatModulesPath = concatModules?.map(\n (cm) => modules.filter((m) => m.id === cm)?.[0],\n );\n return concatModulesPath?.map((m) => m.path);\n}\n"],"names":["useCreateFileTreeData","modules","importedModules","curModule","useMemo","root","Lodash","imported","index","getShortPath","formatSize","getLeafs","fatherModule","leafModules","getImporteds","leafs","_imported","getContactMainModulePath","concatModules","concatModulesPath","cm","m"],"mappings":";;;;AAuBO,SAASA,sBACdC,OAAyB,EACzBC,eAAiC,EACjCC,SAAyB;IAEzB,OAAOC,QAAQ;QACb,IAAI,CAACF,mBAAmB,CAACA,iBAAiB,QACxC,OAAO;YAAE,YAAY,EAAE;YAAE,MAAM,EAAE;QAAC;QAEpC,MAAMG,OAAOC,OAAO,OAAO,CACzBJ,iBAAiB,IAAI,CAACK,UAAUC,QACvB;gBACL,KAAK,CAAC,EAAE,EAAEA,OAAO;gBACjB,MAAMC,aAAaF,SAAS,IAAI;gBAChC,kBAAkBA,SAAS,IAAI;gBAC/B,IAAIA,SAAS,EAAE;gBACf,OAAO;gBACP,QAAQA,SAAS,MAAM;gBACvB,MAAMG,WAAWH,SAAS,IAAI,CAAC,UAAU;gBACzC,MAAMA,SAAS,IAAI;gBACnB,eAAeA,SAAS,oBAAoB;gBAC5C,YAAYE,aAAaN,UAAU,IAAI;gBACvC,cAAcI,SAAS,YAAY;gBACnC,aAAa,IAAMI,SAASJ,UAAUN,SAASE;gBAC/C,UAAUI,SAAS,QAAQ;YAC7B;QAIJ,OAAO;YACL,MAAMF;QACR;IACF,GAAG;QAACH;QAAiBC;KAAU;AACjC;AAEA,SAASQ,SACPJ,QAAwB,EACxBN,OAAyB,EACzBW,YAA4B;IAE5B,MAAMC,cAAcC,aAAaP,UAAUN;IAE3C,MAAMc,QAAQF,aAAa,IAAI,CAACG,WAAWR,QAClC;YACL,KAAK,CAAC,EAAE,EAAEA,OAAO;YACjB,MAAMC,aAAaO,UAAU,IAAI;YACjC,kBAAkBA,UAAU,IAAI;YAChC,IAAIA,UAAU,EAAE;YAChB,OAAO;YACP,MAAMN,WAAWM,UAAU,IAAI,CAAC,UAAU;YAC1C,MAAMA,UAAU,IAAI;YACpB,QAAQA,UAAU,MAAM;YACxB,eAAeA,UAAU,oBAAoB;YAC7C,YAAYP,aAAaG,aAAa,IAAI;YAC1C,cAAcI,UAAU,YAAY;YACpC,aAAa,IAAML,SAASK,WAAWf,SAASM;YAChD,UAAUS,UAAU,QAAQ;QAC9B;IAEF,OAAOD;AACT;AAEO,SAASE,yBACdC,aAAuB,EACvBjB,OAAyB;IAEzB,MAAMkB,oBAAoBD,eAAe,IACvC,CAACE,KAAOnB,QAAQ,MAAM,CAAC,CAACoB,IAAMA,EAAE,EAAE,KAAKD,KAAK,CAAC,EAAE;IAEjD,OAAOD,mBAAmB,IAAI,CAACE,IAAMA,EAAE,IAAI;AAC7C"}
1
+ {"version":3,"file":"pages/ModuleAnalyze/utils/hooks.mjs","sources":["../../../../src/pages/ModuleAnalyze/utils/hooks.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { useMemo } from 'react';\nimport { formatSize, getShortPath } from 'src/utils';\nimport { getImporteds } from '.';\nimport { Lodash } from '@rsdoctor/utils/common';\n\nexport type NewTreeNodeType = {\n __RESOURCEPATH__: string;\n id: number;\n key: string;\n name: string;\n level: number;\n kind: number;\n size?: string;\n concatModules: number[] | undefined;\n chunks?: string[];\n getChildren?: () => NewTreeNodeType[];\n dependencies?: number[];\n fatherPath?: string;\n children?: number[];\n needExpand?: boolean | string;\n};\n\nexport function useCreateFileTreeData(\n modules: SDK.ModuleData[],\n importedModules: SDK.ModuleData[],\n curModule: SDK.ModuleData,\n): { data: NewTreeNodeType[] } {\n return useMemo(() => {\n if (!importedModules || !importedModules?.length) {\n return { filterData: [], data: [] };\n }\n const root = Lodash.compact(\n importedModules?.map((imported, index) => {\n return {\n key: `0-${index}`,\n name: getShortPath(imported.path),\n __RESOURCEPATH__: imported.path,\n id: imported.id,\n level: 0,\n chunks: imported.chunks,\n size: formatSize(imported.size.parsedSize),\n kind: imported.kind,\n concatModules: imported.concatenationModules,\n fatherPath: getShortPath(curModule.path),\n dependencies: imported.dependencies,\n getChildren: () => getLeafs(imported, modules, curModule, 0),\n children: imported.imported,\n };\n }),\n );\n // getAllTreeData(root, modules, 2, importedModules);\n return {\n data: root,\n };\n }, [importedModules, curModule]);\n}\n\nfunction getLeafs(\n imported: SDK.ModuleData,\n modules: SDK.ModuleData[],\n fatherModule: SDK.ModuleData,\n parentLevel: number,\n) {\n const leafModules = getImporteds(imported, modules);\n const currentLevel = parentLevel + 1;\n\n const leafs = leafModules?.map((_imported, index) => {\n return {\n key: `0-${index}`,\n name: getShortPath(_imported.path),\n __RESOURCEPATH__: _imported.path,\n id: _imported.id,\n level: currentLevel,\n size: formatSize(_imported.size.parsedSize),\n kind: _imported.kind,\n chunks: _imported.chunks,\n concatModules: _imported.concatenationModules,\n fatherPath: getShortPath(fatherModule.path),\n dependencies: _imported.dependencies,\n getChildren: () => getLeafs(_imported, modules, imported, currentLevel),\n children: _imported.imported,\n };\n });\n return leafs;\n}\n\nexport function getContactMainModulePath(\n concatModules: number[],\n modules: SDK.ModuleData[],\n): string[] {\n const concatModulesPath = concatModules?.map(\n (cm) => modules.filter((m) => m.id === cm)?.[0],\n );\n return concatModulesPath?.map((m) => m.path);\n}\n"],"names":["useCreateFileTreeData","modules","importedModules","curModule","useMemo","root","Lodash","imported","index","getShortPath","formatSize","getLeafs","fatherModule","parentLevel","leafModules","getImporteds","currentLevel","leafs","_imported","getContactMainModulePath","concatModules","concatModulesPath","cm","m"],"mappings":";;;;AAuBO,SAASA,sBACdC,OAAyB,EACzBC,eAAiC,EACjCC,SAAyB;IAEzB,OAAOC,QAAQ;QACb,IAAI,CAACF,mBAAmB,CAACA,iBAAiB,QACxC,OAAO;YAAE,YAAY,EAAE;YAAE,MAAM,EAAE;QAAC;QAEpC,MAAMG,OAAOC,OAAO,OAAO,CACzBJ,iBAAiB,IAAI,CAACK,UAAUC,QACvB;gBACL,KAAK,CAAC,EAAE,EAAEA,OAAO;gBACjB,MAAMC,aAAaF,SAAS,IAAI;gBAChC,kBAAkBA,SAAS,IAAI;gBAC/B,IAAIA,SAAS,EAAE;gBACf,OAAO;gBACP,QAAQA,SAAS,MAAM;gBACvB,MAAMG,WAAWH,SAAS,IAAI,CAAC,UAAU;gBACzC,MAAMA,SAAS,IAAI;gBACnB,eAAeA,SAAS,oBAAoB;gBAC5C,YAAYE,aAAaN,UAAU,IAAI;gBACvC,cAAcI,SAAS,YAAY;gBACnC,aAAa,IAAMI,SAASJ,UAAUN,SAASE,WAAW;gBAC1D,UAAUI,SAAS,QAAQ;YAC7B;QAIJ,OAAO;YACL,MAAMF;QACR;IACF,GAAG;QAACH;QAAiBC;KAAU;AACjC;AAEA,SAASQ,SACPJ,QAAwB,EACxBN,OAAyB,EACzBW,YAA4B,EAC5BC,WAAmB;IAEnB,MAAMC,cAAcC,aAAaR,UAAUN;IAC3C,MAAMe,eAAeH,cAAc;IAEnC,MAAMI,QAAQH,aAAa,IAAI,CAACI,WAAWV,QAClC;YACL,KAAK,CAAC,EAAE,EAAEA,OAAO;YACjB,MAAMC,aAAaS,UAAU,IAAI;YACjC,kBAAkBA,UAAU,IAAI;YAChC,IAAIA,UAAU,EAAE;YAChB,OAAOF;YACP,MAAMN,WAAWQ,UAAU,IAAI,CAAC,UAAU;YAC1C,MAAMA,UAAU,IAAI;YACpB,QAAQA,UAAU,MAAM;YACxB,eAAeA,UAAU,oBAAoB;YAC7C,YAAYT,aAAaG,aAAa,IAAI;YAC1C,cAAcM,UAAU,YAAY;YACpC,aAAa,IAAMP,SAASO,WAAWjB,SAASM,UAAUS;YAC1D,UAAUE,UAAU,QAAQ;QAC9B;IAEF,OAAOD;AACT;AAEO,SAASE,yBACdC,aAAuB,EACvBnB,OAAyB;IAEzB,MAAMoB,oBAAoBD,eAAe,IACvC,CAACE,KAAOrB,QAAQ,MAAM,CAAC,CAACsB,IAAMA,EAAE,EAAE,KAAKD,KAAK,CAAC,EAAE;IAEjD,OAAOD,mBAAmB,IAAI,CAACE,IAAMA,EAAE,IAAI;AAC7C"}
@@ -1,12 +1,12 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__Overall_index_mjs_0ded43f9__ from "./Overall/index.mjs";
2
- import * as __WEBPACK_EXTERNAL_MODULE__BundleSize_index_mjs_d0a2fb23__ from "./BundleSize/index.mjs";
3
- import * as __WEBPACK_EXTERNAL_MODULE__ModuleAnalyze_index_mjs_4385c65f__ from "./ModuleAnalyze/index.mjs";
4
- import * as __WEBPACK_EXTERNAL_MODULE__WebpackLoaders_Overall_index_mjs_7fb4d495__ from "./WebpackLoaders/Overall/index.mjs";
5
- import * as __WEBPACK_EXTERNAL_MODULE__WebpackLoaders_Analysis_index_mjs_a1d3659a__ from "./WebpackLoaders/Analysis/index.mjs";
6
- import * as __WEBPACK_EXTERNAL_MODULE__WebpackPlugins_index_mjs_a5b22b8e__ from "./WebpackPlugins/index.mjs";
7
- import * as __WEBPACK_EXTERNAL_MODULE__ModuleResolve_index_mjs_2463b148__ from "./ModuleResolve/index.mjs";
8
- import * as __WEBPACK_EXTERNAL_MODULE__Resources_RuleIndex_index_mjs_458631cc__ from "./Resources/RuleIndex/index.mjs";
9
- import * as __WEBPACK_EXTERNAL_MODULE__TreeShaking_index_mjs_1daf5cdb__ from "./TreeShaking/index.mjs";
10
- import * as __WEBPACK_EXTERNAL_MODULE__Resources_BundleDiff_index_mjs_3b739fff__ from "./Resources/BundleDiff/index.mjs";
11
- import * as __WEBPACK_EXTERNAL_MODULE__Uploader_index_mjs_e3f3ea84__ from "./Uploader/index.mjs";
12
- export { __WEBPACK_EXTERNAL_MODULE__Resources_BundleDiff_index_mjs_3b739fff__ as BundleDiff, __WEBPACK_EXTERNAL_MODULE__BundleSize_index_mjs_d0a2fb23__ as BundleSize, __WEBPACK_EXTERNAL_MODULE__WebpackLoaders_Analysis_index_mjs_a1d3659a__ as LoaderFiles, __WEBPACK_EXTERNAL_MODULE__WebpackLoaders_Overall_index_mjs_7fb4d495__ as LoaderTimeline, __WEBPACK_EXTERNAL_MODULE__ModuleAnalyze_index_mjs_4385c65f__ as ModuleAnalyze, __WEBPACK_EXTERNAL_MODULE__ModuleResolve_index_mjs_2463b148__ as ModuleResolve, __WEBPACK_EXTERNAL_MODULE__Overall_index_mjs_0ded43f9__ as Overall, __WEBPACK_EXTERNAL_MODULE__WebpackPlugins_index_mjs_a5b22b8e__ as PluginsAnalyze, __WEBPACK_EXTERNAL_MODULE__Resources_RuleIndex_index_mjs_458631cc__ as RuleIndex, __WEBPACK_EXTERNAL_MODULE__TreeShaking_index_mjs_1daf5cdb__ as TreeShaking, __WEBPACK_EXTERNAL_MODULE__Uploader_index_mjs_e3f3ea84__ as Uploader };
1
+ import * as __rspack_external__Overall_index_mjs_0ded43f9 from "./Overall/index.mjs";
2
+ import * as __rspack_external__BundleSize_index_mjs_d0a2fb23 from "./BundleSize/index.mjs";
3
+ import * as __rspack_external__ModuleAnalyze_index_mjs_4385c65f from "./ModuleAnalyze/index.mjs";
4
+ import * as __rspack_external__WebpackLoaders_Overall_index_mjs_7fb4d495 from "./WebpackLoaders/Overall/index.mjs";
5
+ import * as __rspack_external__WebpackLoaders_Analysis_index_mjs_a1d3659a from "./WebpackLoaders/Analysis/index.mjs";
6
+ import * as __rspack_external__WebpackPlugins_index_mjs_a5b22b8e from "./WebpackPlugins/index.mjs";
7
+ import * as __rspack_external__ModuleResolve_index_mjs_2463b148 from "./ModuleResolve/index.mjs";
8
+ import * as __rspack_external__Resources_RuleIndex_index_mjs_458631cc from "./Resources/RuleIndex/index.mjs";
9
+ import * as __rspack_external__TreeShaking_index_mjs_1daf5cdb from "./TreeShaking/index.mjs";
10
+ import * as __rspack_external__Resources_BundleDiff_index_mjs_3b739fff from "./Resources/BundleDiff/index.mjs";
11
+ import * as __rspack_external__Uploader_index_mjs_e3f3ea84 from "./Uploader/index.mjs";
12
+ export { __rspack_external__Resources_BundleDiff_index_mjs_3b739fff as BundleDiff, __rspack_external__BundleSize_index_mjs_d0a2fb23 as BundleSize, __rspack_external__WebpackLoaders_Analysis_index_mjs_a1d3659a as LoaderFiles, __rspack_external__WebpackLoaders_Overall_index_mjs_7fb4d495 as LoaderTimeline, __rspack_external__ModuleAnalyze_index_mjs_4385c65f as ModuleAnalyze, __rspack_external__ModuleResolve_index_mjs_2463b148 as ModuleResolve, __rspack_external__Overall_index_mjs_0ded43f9 as Overall, __rspack_external__WebpackPlugins_index_mjs_a5b22b8e as PluginsAnalyze, __rspack_external__Resources_RuleIndex_index_mjs_458631cc as RuleIndex, __rspack_external__TreeShaking_index_mjs_1daf5cdb as TreeShaking, __rspack_external__Uploader_index_mjs_e3f3ea84 as Uploader };
@@ -40,6 +40,7 @@ type TreeNode = {
40
40
  sourceSize?: number;
41
41
  bundledSize?: number;
42
42
  gzipSize?: number;
43
+ id?: string | number;
43
44
  _map?: Map<string, TreeNode>;
44
45
  };
45
46
  export declare function buildTreemapData(modules: SDK.ModuleData[], rootName?: string): TreeNode;
@@ -168,7 +168,8 @@ function buildTreemapData(modules, rootName = 'dist') {
168
168
  path: mod.path,
169
169
  sourceSize: mod.size?.sourceSize ?? 0,
170
170
  bundledSize: mod.size?.parsedSize ?? 0,
171
- gzipSize: mod.size?.gzipSize ?? 0
171
+ gzipSize: mod.size?.gzipSize ?? 0,
172
+ id: mod.id
172
173
  });
173
174
  } else {
174
175
  if (!current._map) current._map = new Map();