@rsdoctor/components 1.4.0 → 1.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"utils/file.mjs","sources":["../../src/utils/file.tsx"],"sourcesContent":["import { get } from 'es-toolkit/compat';\nimport { Common, SDK } from '@rsdoctor/types';\nimport { message, Space, TreeNodeProps, UploadFile } from 'antd';\nimport { FieldDataNode } from 'rc-tree';\nimport {\n FolderOpenTwoTone,\n FolderTwoTone,\n FileOutlined,\n RightOutlined,\n} from '@ant-design/icons';\nimport { getFileCom } from 'src/components/FileTree';\n\nexport type DataNode = FieldDataNode<{\n key: string | number;\n title?: React.ReactNode | ((data: DataNode) => React.ReactNode);\n}> & { __BASENAME__?: any; __RESOURCEPATH__?: any; children?: DataNode[] };\n\nexport const rootDirname = (file: string, sep = '/'): string | null => {\n const idx = file?.indexOf(sep);\n if (idx === -1) {\n return null;\n }\n if (idx === 0) {\n return sep + (rootDirname(file?.slice(1)) || '');\n }\n return file?.slice(0, idx);\n};\n\nexport function mapFileKey(\n arr: DataNode[],\n depth = 2,\n filter: (node: DataNode) => boolean = () => true,\n): DataNode['key'][] {\n let d = 0;\n const res: DataNode['key'][] = [];\n let parent: DataNode[] = arr;\n while (d < depth) {\n parent.filter(filter).forEach((e) => {\n if (!e.isLeaf) {\n res.push(e.key);\n }\n });\n parent = parent.reduce<DataNode[]>(\n (t, e) => t.concat(e.children || []),\n [],\n );\n if (!parent.length) break;\n d++;\n }\n return res;\n}\n\nconst basenameKey = '__BASENAME__';\n\nexport function flattenDirectory(\n n: DataNode,\n parent: DataNode,\n sep = '/',\n inlinedResourcePathKey: keyof DataNode,\n dirTitle = (_dir: DataNode, defaultTitle: string): JSX.Element | string =>\n defaultTitle,\n) {\n if (n.isLeaf) return;\n if (parent.children && parent.children.length === 1) {\n const defaultTitle = [parent[basenameKey], n[basenameKey]].join(sep);\n parent[inlinedResourcePathKey] = n[inlinedResourcePathKey];\n parent[basenameKey] = defaultTitle;\n parent.key = [parent.key, n.key].join('-');\n parent.children = n.children;\n parent.title = dirTitle(parent, defaultTitle);\n\n n.children &&\n n.children.forEach((c) => {\n flattenDirectory(c, parent, sep, inlinedResourcePathKey, dirTitle);\n });\n } else {\n // parent has more than 1 child.\n n.title = dirTitle(n, n[basenameKey]);\n\n n.children &&\n n.children.forEach((c) => {\n flattenDirectory(c, n, sep, inlinedResourcePathKey, dirTitle);\n });\n }\n}\n\nexport function createFileStructures({\n files,\n sep = '/',\n inlinedResourcePathKey = '__RESOURCEPATH__',\n fileTitle = (_file: string, basename: string) => basename,\n dirTitle = (_dir: DataNode, defaultTitle: string) => defaultTitle,\n page = 'other',\n}: {\n files: string[];\n cwd?: string;\n sep?: string;\n inlinedResourcePathKey?: keyof DataNode;\n dirTitle?(dir: DataNode, defaultTitle: string): JSX.Element | string;\n fileTitle?(file: string, basename: string): JSX.Element | string;\n page?: 'bundle' | 'other';\n}): DataNode[] {\n const sepRegexp = new RegExp(sep);\n\n const res = files.reduce<DataNode>(\n (t, file) => {\n let dir = rootDirname(file, sep);\n let basename = dir ? file?.slice(dir.length + 1) : file;\n let parent: DataNode = t;\n\n while (dir) {\n // find the match directory.\n let exist = parent.children!.find((e) => e.title === dir) as DataNode;\n if (!exist) {\n const p = [parent[inlinedResourcePathKey], dir]\n .filter(Boolean)\n .join(sep);\n exist = {\n title: dir,\n icon:\n page === 'bundle'\n ? (props) => getFileIcon(props as TreeNodeProps, false)\n : null,\n // key: [parent.key, parent.children!.length].join('-'),\n key: p,\n children: [],\n [inlinedResourcePathKey]: p,\n [basenameKey]: dir,\n };\n parent.children!.push(exist);\n }\n\n parent = exist;\n dir = rootDirname(basename);\n basename = dir\n ? basename.slice(dir.length).replace(sepRegexp, '')\n : basename;\n }\n\n // uniq\n if (parent.children!.some((e) => get(e, inlinedResourcePathKey) === file))\n return t;\n\n parent.children!.push({\n title() {\n return fileTitle(file, basename);\n },\n icon:\n page === 'bundle'\n ? (props) => getFileIcon(props as TreeNodeProps)\n : null,\n key: file,\n isLeaf: true,\n [inlinedResourcePathKey]: file,\n [basenameKey]: basename,\n });\n\n return t;\n },\n { key: '0', children: [] },\n ).children!;\n\n res.forEach((e) => {\n e.children &&\n e.children.forEach((item) =>\n flattenDirectory(item, e, sep, inlinedResourcePathKey, dirTitle),\n );\n });\n\n return res;\n}\n\nexport function beautifyPath(path: string, cwd: string) {\n if (path.startsWith(cwd)) {\n return path.replace(cwd, '.');\n }\n\n return path;\n}\n\nexport function readJSONByFileReader<T extends Common.PlainObject>(\n file: UploadFile,\n): Promise<T>;\nexport function readJSONByFileReader<T extends Common.PlainObject>(\n file: Blob,\n): Promise<T>;\nexport function readJSONByFileReader<T extends Common.PlainObject>(\n file: unknown,\n): Promise<T> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n const { result } = reader;\n console.log('reader result: ', result);\n try {\n const json = JSON.parse(result!.toString());\n resolve(json);\n } catch (err) {\n message.error('json parse error');\n reject(err);\n }\n };\n reader.onerror = () => {\n const msg = 'upload json file error, please try again.';\n message.error(msg);\n reject(new Error(msg));\n };\n reader.readAsText(((file as UploadFile).originFileObj || file) as Blob);\n });\n}\n\n/**\n * beautify module path, will replace cwd & last 'node_modules'\n */\nexport function beautifyModulePath(modulePath: string, cwd: string) {\n const res = beautifyPath(modulePath, cwd);\n\n const str = '/node_modules/';\n\n const idx = res.lastIndexOf(str);\n\n if (idx > -1) {\n return {\n alias: res.slice(idx + str.length),\n inNodeModules: true,\n };\n }\n\n return {\n alias: res,\n inNodeModules: false,\n };\n}\n\nexport function getFileIcon(props: TreeNodeProps, addRowIcon = true) {\n const { data } = props;\n const expanded = props.expanded;\n if (data?.children) {\n return (\n <Space>\n {addRowIcon ? (\n <RightOutlined\n className={`file-tree-switcher-arrow ${expanded ? 'file-tree-switcher-arrow-expand' : ''}`}\n />\n ) : (\n <></>\n )}\n {expanded ? <FolderOpenTwoTone /> : <FolderTwoTone />}\n </Space>\n );\n }\n if (props.eventKey && typeof props.eventKey === 'string') {\n return getFileCom(props.eventKey);\n }\n return <FileOutlined />;\n}\n\ntype TreeNode = {\n name: string;\n value?: number;\n children?: TreeNode[];\n path?: string;\n sourceSize?: number;\n bundledSize?: number;\n gzipSize?: number;\n id?: string | number;\n // Internal helper, not exported\n _map?: Map<string, TreeNode>;\n};\n\nexport function buildTreemapData(\n modules: SDK.ModuleData[],\n rootName = 'dist',\n): TreeNode {\n const root: TreeNode = { name: rootName, children: [], _map: new Map() };\n\n for (const mod of modules) {\n const parts = mod.path.split(/[\\\\/]/).filter(Boolean);\n let current = root;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (i === parts.length - 1) {\n // File node\n if (!current.children) current.children = [];\n current.children.push({\n name: part,\n path: mod.path,\n sourceSize: mod.size?.sourceSize ?? 0,\n bundledSize: mod.size?.parsedSize ?? 0,\n gzipSize: mod.size?.gzipSize ?? 0,\n id: mod.id,\n });\n } else {\n // Directory node\n if (!current._map) current._map = new Map();\n let child = current._map.get(part);\n if (!child) {\n child = { name: part, children: [], _map: new Map() };\n current.children!.push(child);\n current._map.set(part, child);\n }\n current = child;\n }\n }\n }\n\n // Clean up _map property\n function clean(node: TreeNode) {\n delete node._map;\n if (node.children) node.children.forEach(clean);\n }\n clean(root);\n\n return root;\n}\n\nfunction flattenSingleChildDirs(node: TreeNode): TreeNode {\n // Return directly if leaf node\n if (!node.children || node.children.length === 0) return node;\n\n let current = node;\n // As long as children has only one child and it's not a leaf, merge\n while (\n current.children &&\n current.children.length === 1 &&\n !current.children[0].sourceSize // Not a leaf\n ) {\n current = {\n name: current.name + '/' + current.children[0].name,\n children: current.children[0].children,\n };\n }\n\n // Recursively process all child nodes\n if (current.children) {\n current.children = current.children.map(flattenSingleChildDirs);\n }\n return current;\n}\n\nfunction sumDirValue(node: TreeNode): {\n sourceSize: number;\n bundledSize: number;\n gzipSize: number;\n} {\n if (!node.children || node.children.length === 0) {\n // Leaf node, just return value\n return {\n sourceSize: node.sourceSize ?? 0,\n bundledSize: node.bundledSize ?? 0,\n gzipSize: node.gzipSize ?? 0,\n };\n }\n // Recursively sum all child nodes\n let sourceSum = 0;\n let bundledSum = 0;\n let gzipSum = 0;\n for (const child of node.children) {\n const { sourceSize, bundledSize, gzipSize } = sumDirValue(child);\n sourceSum += sourceSize;\n bundledSum += bundledSize;\n gzipSum += gzipSize;\n }\n node.sourceSize = sourceSum;\n node.bundledSize = bundledSum;\n node.gzipSize = gzipSum;\n return { sourceSize: sourceSum, bundledSize: bundledSum, gzipSize: gzipSum };\n}\n\nexport function flattenTreemapData(\n modules: SDK.ModuleData[],\n rootName = 'dist',\n): TreeNode {\n const rawTree = buildTreemapData(modules, rootName);\n const flattenedTree = flattenSingleChildDirs(rawTree);\n sumDirValue(flattenedTree); // Recursive sum\n return flattenedTree;\n}\n"],"names":["rootDirname","file","sep","idx","mapFileKey","arr","depth","filter","d","res","parent","e","t","basenameKey","flattenDirectory","n","inlinedResourcePathKey","dirTitle","_dir","defaultTitle","c","createFileStructures","files","fileTitle","_file","basename","page","sepRegexp","RegExp","dir","exist","p","Boolean","props","getFileIcon","get","item","beautifyPath","path","cwd","readJSONByFileReader","Promise","resolve","reject","reader","FileReader","result","console","json","JSON","err","message","msg","Error","beautifyModulePath","modulePath","str","addRowIcon","data","expanded","Space","RightOutlined","FolderOpenTwoTone","FolderTwoTone","getFileCom","FileOutlined","buildTreemapData","modules","rootName","root","Map","mod","parts","current","i","part","child","clean","node","flattenSingleChildDirs","sumDirValue","sourceSum","bundledSum","gzipSum","sourceSize","bundledSize","gzipSize","flattenTreemapData","rawTree","flattenedTree"],"mappings":";;;;;AAiBO,MAAMA,cAAc,CAACC,MAAcC,MAAM,GAAG;IACjD,MAAMC,MAAMF,MAAM,QAAQC;IAC1B,IAAIC,AAAQ,OAARA,KACF,OAAO;IAET,IAAIA,AAAQ,MAARA,KACF,OAAOD,MAAOF,CAAAA,YAAYC,MAAM,MAA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,CAAC,GAAG,CAACM;IAE1C,OAAON;AACT;AAEA,SAASO,YAAYF,IAAc;IAKjC,IAAI,CAACA,KAAK,QAAQ,IAAIA,AAAyB,MAAzBA,KAAK,QAAQ,CAAC,MAAM,EAExC,OAAO;QACL,YAAYA,KAAK,UAAU,IAAI;QAC/B,aAAaA,KAAK,WAAW,IAAI;QACjC,UAAUA,KAAK,QAAQ,IAAI;IAC7B;IAGF,IAAIG,YAAY;IAChB,IAAIC,aAAa;IACjB,IAAIC,UAAU;IACd,KAAK,MAAMP,SAASE,KAAK,QAAQ,CAAE;QACjC,MAAM,EAAEM,UAAU,EAAEC,WAAW,EAAEC,QAAQ,EAAE,GAAGN,YAAYJ;QAC1DK,aAAaG;QACbF,cAAcG;QACdF,WAAWG;IACb;IACAR,KAAK,UAAU,GAAGG;IAClBH,KAAK,WAAW,GAAGI;IACnBJ,KAAK,QAAQ,GAAGK;IAChB,OAAO;QAAE,YAAYF;QAAW,aAAaC;QAAY,UAAUC;IAAQ;AAC7E;AAEO,SAASI,mBACdpB,OAAyB,EACzBC,WAAW,MAAM;IAEjB,MAAMoB,UAAUtB,iBAAiBC,SAASC;IAC1C,MAAMqB,gBAAgBV,uBAAuBS;IAC7CR,YAAYS;IACZ,OAAOA;AACT"}
1
+ {"version":3,"file":"utils/file.mjs","sources":["../../src/utils/file.tsx"],"sourcesContent":["import { get } from 'es-toolkit/compat';\nimport { Common, SDK } from '@rsdoctor/types';\nimport { message, Space, TreeNodeProps, UploadFile } from 'antd';\nimport { FieldDataNode } from 'rc-tree';\nimport {\n FolderOpenTwoTone,\n FolderTwoTone,\n FileOutlined,\n RightOutlined,\n} from '@ant-design/icons';\nimport { getFileCom } from 'src/components/FileTree';\n\nexport type DataNode = FieldDataNode<{\n key: string | number;\n title?: React.ReactNode | ((data: DataNode) => React.ReactNode);\n}> & { __BASENAME__?: any; __RESOURCEPATH__?: any; children?: DataNode[] };\n\nexport const rootDirname = (file: string, sep = '/'): string | null => {\n const idx = file?.indexOf(sep);\n if (idx === -1) {\n return null;\n }\n if (idx === 0) {\n return sep + (rootDirname(file?.slice(1), sep) || '');\n }\n return file?.slice(0, idx);\n};\n\nexport function mapFileKey(\n arr: DataNode[],\n depth = 2,\n filter: (node: DataNode) => boolean = () => true,\n): DataNode['key'][] {\n let d = 0;\n const res: DataNode['key'][] = [];\n let parent: DataNode[] = arr;\n while (d < depth) {\n parent.filter(filter).forEach((e) => {\n if (!e.isLeaf) {\n res.push(e.key);\n }\n });\n parent = parent.reduce<DataNode[]>(\n (t, e) => t.concat(e.children || []),\n [],\n );\n if (!parent.length) break;\n d++;\n }\n return res;\n}\n\nconst basenameKey = '__BASENAME__';\n\nexport function flattenDirectory(\n n: DataNode,\n parent: DataNode,\n sep = '/',\n inlinedResourcePathKey: keyof DataNode,\n dirTitle = (_dir: DataNode, defaultTitle: string): JSX.Element | string =>\n defaultTitle,\n) {\n if (n.isLeaf) return;\n if (parent.children && parent.children.length === 1) {\n const defaultTitle = [parent[basenameKey], n[basenameKey]].join(sep);\n parent[inlinedResourcePathKey] = n[inlinedResourcePathKey];\n parent[basenameKey] = defaultTitle;\n parent.key = [parent.key, n.key].join('-');\n parent.children = n.children;\n parent.title = dirTitle(parent, defaultTitle);\n\n n.children &&\n n.children.forEach((c) => {\n flattenDirectory(c, parent, sep, inlinedResourcePathKey, dirTitle);\n });\n } else {\n // parent has more than 1 child.\n n.title = dirTitle(n, n[basenameKey]);\n\n n.children &&\n n.children.forEach((c) => {\n flattenDirectory(c, n, sep, inlinedResourcePathKey, dirTitle);\n });\n }\n}\n\nexport function createFileStructures({\n files,\n inlinedResourcePathKey = '__RESOURCEPATH__',\n fileTitle = (_file: string, basename: string) => basename,\n dirTitle = (_dir: DataNode, defaultTitle: string) => defaultTitle,\n page = 'other',\n}: {\n files: string[];\n cwd?: string;\n inlinedResourcePathKey?: keyof DataNode;\n dirTitle?(dir: DataNode, defaultTitle: string): JSX.Element | string;\n fileTitle?(file: string, basename: string): JSX.Element | string;\n page?: 'bundle' | 'other';\n}): DataNode[] {\n // Normalize all paths to use forward slash as internal separator for consistency\n // This ensures Windows paths (using backslash) are properly converted to forward slashes\n const normalizedFiles = files.map((file) => {\n // Always convert backslashes to forward slashes for internal processing\n return file.replace(/\\\\/g, '/');\n });\n\n // Use forward slash as the internal separator for consistency\n const internalSep = '/';\n const sepRegexp = new RegExp(internalSep);\n\n const res = normalizedFiles.reduce<DataNode>(\n (t, file) => {\n let dir = rootDirname(file, internalSep);\n let basename = dir ? file?.slice(dir.length + 1) : file;\n let parent: DataNode = t;\n\n while (dir) {\n // find the match directory.\n let exist = parent.children!.find((e) => e.title === dir) as DataNode;\n if (!exist) {\n const p = [parent[inlinedResourcePathKey], dir]\n .filter(Boolean)\n .join(internalSep);\n exist = {\n title: dir,\n icon:\n page === 'bundle'\n ? (props) => getFileIcon(props as TreeNodeProps, false)\n : null,\n // key: [parent.key, parent.children!.length].join('-'),\n key: p,\n children: [],\n [inlinedResourcePathKey]: p,\n [basenameKey]: dir,\n };\n parent.children!.push(exist);\n }\n\n parent = exist;\n dir = rootDirname(basename, internalSep);\n basename = dir\n ? basename.slice(dir.length).replace(sepRegexp, '')\n : basename;\n }\n\n // uniq\n if (parent.children!.some((e) => get(e, inlinedResourcePathKey) === file))\n return t;\n\n parent.children!.push({\n title() {\n return fileTitle(file, basename);\n },\n icon:\n page === 'bundle'\n ? (props) => getFileIcon(props as TreeNodeProps)\n : null,\n key: file,\n isLeaf: true,\n [inlinedResourcePathKey]: file,\n [basenameKey]: basename,\n });\n\n return t;\n },\n { key: '0', children: [] },\n ).children!;\n\n res.forEach((e) => {\n e.children &&\n e.children.forEach((item) =>\n flattenDirectory(\n item,\n e,\n internalSep,\n inlinedResourcePathKey,\n dirTitle,\n ),\n );\n });\n\n return res;\n}\n\nexport function beautifyPath(path: string, cwd: string) {\n if (path.startsWith(cwd)) {\n return path.replace(cwd, '.');\n }\n\n return path;\n}\n\nexport function readJSONByFileReader<T extends Common.PlainObject>(\n file: UploadFile,\n): Promise<T>;\nexport function readJSONByFileReader<T extends Common.PlainObject>(\n file: Blob,\n): Promise<T>;\nexport function readJSONByFileReader<T extends Common.PlainObject>(\n file: unknown,\n): Promise<T> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n const { result } = reader;\n console.log('reader result: ', result);\n try {\n const json = JSON.parse(result!.toString());\n resolve(json);\n } catch (err) {\n message.error('json parse error');\n reject(err);\n }\n };\n reader.onerror = () => {\n const msg = 'upload json file error, please try again.';\n message.error(msg);\n reject(new Error(msg));\n };\n reader.readAsText(((file as UploadFile).originFileObj || file) as Blob);\n });\n}\n\n/**\n * beautify module path, will replace cwd & last 'node_modules'\n */\nexport function beautifyModulePath(modulePath: string, cwd: string) {\n const res = beautifyPath(modulePath, cwd);\n\n const str = '/node_modules/';\n\n const idx = res.lastIndexOf(str);\n\n if (idx > -1) {\n return {\n alias: res.slice(idx + str.length),\n inNodeModules: true,\n };\n }\n\n return {\n alias: res,\n inNodeModules: false,\n };\n}\n\nexport function getFileIcon(props: TreeNodeProps, addRowIcon = true) {\n const { data } = props;\n const expanded = props.expanded;\n if (data?.children) {\n return (\n <Space>\n {addRowIcon ? (\n <RightOutlined\n className={`file-tree-switcher-arrow ${expanded ? 'file-tree-switcher-arrow-expand' : ''}`}\n />\n ) : (\n <></>\n )}\n {expanded ? <FolderOpenTwoTone /> : <FolderTwoTone />}\n </Space>\n );\n }\n if (props.eventKey && typeof props.eventKey === 'string') {\n return getFileCom(props.eventKey);\n }\n return <FileOutlined />;\n}\n\ntype TreeNode = {\n name: string;\n value?: number;\n children?: TreeNode[];\n path?: string;\n sourceSize?: number;\n bundledSize?: number;\n gzipSize?: number;\n id?: string | number;\n // Internal helper, not exported\n _map?: Map<string, TreeNode>;\n};\n\nexport function buildTreemapData(\n modules: SDK.ModuleData[],\n rootName = 'dist',\n): TreeNode {\n const root: TreeNode = { name: rootName, children: [], _map: new Map() };\n\n for (const mod of modules) {\n const parts = mod.path.split(/[\\\\/]/).filter(Boolean);\n let current = root;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (i === parts.length - 1) {\n // File node\n if (!current.children) current.children = [];\n current.children.push({\n name: part,\n path: mod.path,\n sourceSize: mod.size?.sourceSize ?? 0,\n bundledSize: mod.size?.parsedSize ?? 0,\n gzipSize: mod.size?.gzipSize ?? 0,\n id: mod.id,\n });\n } else {\n // Directory node\n if (!current._map) current._map = new Map();\n let child = current._map.get(part);\n if (!child) {\n child = { name: part, children: [], _map: new Map() };\n current.children!.push(child);\n current._map.set(part, child);\n }\n current = child;\n }\n }\n }\n\n // Clean up _map property\n function clean(node: TreeNode) {\n delete node._map;\n if (node.children) node.children.forEach(clean);\n }\n clean(root);\n\n return root;\n}\n\nfunction flattenSingleChildDirs(node: TreeNode): TreeNode {\n // Return directly if leaf node\n if (!node.children || node.children.length === 0) return node;\n\n let current = node;\n // As long as children has only one child and it's not a leaf, merge\n while (\n current.children &&\n current.children.length === 1 &&\n !current.children[0].sourceSize // Not a leaf\n ) {\n current = {\n name: current.name + '/' + current.children[0].name,\n children: current.children[0].children,\n };\n }\n\n // Recursively process all child nodes\n if (current.children) {\n current.children = current.children.map(flattenSingleChildDirs);\n }\n return current;\n}\n\nfunction sumDirValue(node: TreeNode): {\n sourceSize: number;\n bundledSize: number;\n gzipSize: number;\n} {\n if (!node.children || node.children.length === 0) {\n // Leaf node, just return value\n return {\n sourceSize: node.sourceSize ?? 0,\n bundledSize: node.bundledSize ?? 0,\n gzipSize: node.gzipSize ?? 0,\n };\n }\n // Recursively sum all child nodes\n let sourceSum = 0;\n let bundledSum = 0;\n let gzipSum = 0;\n for (const child of node.children) {\n const { sourceSize, bundledSize, gzipSize } = sumDirValue(child);\n sourceSum += sourceSize;\n bundledSum += bundledSize;\n gzipSum += gzipSize;\n }\n node.sourceSize = sourceSum;\n node.bundledSize = bundledSum;\n node.gzipSize = gzipSum;\n return { sourceSize: sourceSum, bundledSize: bundledSum, gzipSize: gzipSum };\n}\n\nexport function flattenTreemapData(\n modules: SDK.ModuleData[],\n rootName = 'dist',\n): TreeNode {\n const rawTree = buildTreemapData(modules, rootName);\n const flattenedTree = flattenSingleChildDirs(rawTree);\n sumDirValue(flattenedTree); // Recursive sum\n return flattenedTree;\n}\n"],"names":["rootDirname","file","sep","idx","mapFileKey","arr","depth","filter","d","res","parent","e","t","basenameKey","flattenDirectory","n","inlinedResourcePathKey","dirTitle","_dir","defaultTitle","c","createFileStructures","files","fileTitle","_file","basename","page","normalizedFiles","internalSep","sepRegexp","RegExp","dir","exist","p","Boolean","props","getFileIcon","get","item","beautifyPath","path","cwd","readJSONByFileReader","Promise","resolve","reject","reader","FileReader","result","console","json","JSON","err","message","msg","Error","beautifyModulePath","modulePath","str","addRowIcon","data","expanded","Space","RightOutlined","FolderOpenTwoTone","FolderTwoTone","getFileCom","FileOutlined","buildTreemapData","modules","rootName","root","Map","mod","parts","current","i","part","child","clean","node","flattenSingleChildDirs","sumDirValue","sourceSum","bundledSum","gzipSum","sourceSize","bundledSize","gzipSize","flattenTreemapData","rawTree","flattenedTree"],"mappings":";;;;;AAiBO,MAAMA,cAAc,CAACC,MAAcC,MAAM,GAAG;IACjD,MAAMC,MAAMF,MAAM,QAAQC;IAC1B,IAAIC,AAAQ,OAARA,KACF,OAAO;IAET,IAAIA,AAAQ,MAARA,KACF,OAAOD,MAAOF,CAAAA,YAAYC,MAAM,MAAM,IAAIC,QAAQ,EAAC;IAErD,OAAOD,MAAM,MAAM,GAAGE;AACxB;AAEO,SAASC,WACdC,GAAe,EACfC,QAAQ,CAAC,EACTC,SAAsC,IAAM,IAAI;IAEhD,IAAIC,IAAI;IACR,MAAMC,MAAyB,EAAE;IACjC,IAAIC,SAAqBL;IACzB,MAAOG,IAAIF,MAAO;QAChBI,OAAO,MAAM,CAACH,QAAQ,OAAO,CAAC,CAACI;YAC7B,IAAI,CAACA,EAAE,MAAM,EACXF,IAAI,IAAI,CAACE,EAAE,GAAG;QAElB;QACAD,S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IAGF,IAAIG,YAAY;IAChB,IAAIC,aAAa;IACjB,IAAIC,UAAU;IACd,KAAK,MAAMP,SAASE,KAAK,QAAQ,CAAE;QACjC,MAAM,EAAEM,UAAU,EAAEC,WAAW,EAAEC,QAAQ,EAAE,GAAGN,YAAYJ;QAC1DK,aAAaG;QACbF,cAAcG;QACdF,WAAWG;IACb;IACAR,KAAK,UAAU,GAAGG;IAClBH,KAAK,WAAW,GAAGI;IACnBJ,KAAK,QAAQ,GAAGK;IAChB,OAAO;QAAE,YAAYF;QAAW,aAAaC;QAAY,UAAUC;IAAQ;AAC7E;AAEO,SAASI,mBACdpB,OAAyB,EACzBC,WAAW,MAAM;IAEjB,MAAMoB,UAAUtB,iBAAiBC,SAASC;IAC1C,MAAMqB,gBAAgBV,uBAAuBS;IAC7CR,YAAYS;IACZ,OAAOA;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/components",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "license": "MIT",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  }
39
39
  },
40
40
  "devDependencies": {
41
- "@rsbuild/plugin-check-syntax": "1.5.0",
41
+ "@rsbuild/plugin-check-syntax": "1.6.0",
42
42
  "@rsbuild/plugin-react": "^1.4.2",
43
43
  "@rsbuild/plugin-sass": "^1.4.0",
44
44
  "@rsbuild/plugin-svgr": "^1.2.3",
@@ -60,7 +60,7 @@
60
60
  "dayjs": "1.11.19",
61
61
  "echarts": "^5.6.0",
62
62
  "echarts-for-react": "^3.0.5",
63
- "es-toolkit": "^1.41.0",
63
+ "es-toolkit": "^1.43.0",
64
64
  "i18next": "22.0.4",
65
65
  "monaco-editor": "0.49.0",
66
66
  "path-browserify": "1.0.1",
@@ -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.4.0",
78
- "@rsdoctor/types": "1.4.0",
79
- "@rsdoctor/utils": "1.4.0"
77
+ "@rsdoctor/types": "1.5.0",
78
+ "@rsdoctor/graph": "1.5.0",
79
+ "@rsdoctor/utils": "1.5.0"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "react": ">=18.3.1",