@rsdoctor/components 1.3.12 → 1.3.13-beta.1

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.
@@ -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,MAA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ACE,KAAOrB,QAAQ,MAAM,CAAC,CAACsB,IAAMA,EAAE,EAAE,KAAKD,KAAK,CAAC,EAAE;IAEjD,OAAOD,mBAAmB,IAAI,CAACE,IAAMA,EAAE,IAAI;AAC7C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/components",
3
- "version": "1.3.12",
3
+ "version": "1.3.13-beta.1",
4
4
  "license": "MIT",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -74,9 +74,9 @@
74
74
  "react-router-dom": "6.4.3",
75
75
  "socket.io-client": "4.8.1",
76
76
  "url-parse": "1.5.10",
77
- "@rsdoctor/graph": "1.3.12",
78
- "@rsdoctor/types": "1.3.12",
79
- "@rsdoctor/utils": "1.3.12"
77
+ "@rsdoctor/utils": "1.3.13-beta.1",
78
+ "@rsdoctor/graph": "1.3.13-beta.1",
79
+ "@rsdoctor/types": "1.3.13-beta.1"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "react": ">=18.3.1",