@rsdoctor/components 1.2.0-beta.2 → 1.2.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.
Files changed (163) hide show
  1. package/dist/components/Alert/change.d.ts +3 -0
  2. package/dist/components/Alert/ecma-version-check.d.ts +2 -0
  3. package/dist/components/Alert/file-relation.d.ts +3 -0
  4. package/dist/components/Alert/package-relation.d.ts +16 -0
  5. package/dist/components/Alert/types.d.ts +33 -0
  6. package/dist/components/Alert/view.d.ts +4 -0
  7. package/dist/components/Alerts/bundle-alert.d.ts +14 -0
  8. package/dist/components/Alerts/bundle.d.ts +11 -0
  9. package/dist/components/Alerts/collapse-cross-chunks.d.ts +6 -0
  10. package/dist/components/Alerts/collapse.d.ts +6 -0
  11. package/dist/components/Alerts/compile.d.ts +10 -0
  12. package/dist/components/Alerts/index.d.ts +3 -0
  13. package/dist/components/Alerts/list.d.ts +4 -0
  14. package/dist/components/Alerts/overlay.d.ts +26 -0
  15. package/dist/components/Badge/index.d.ts +21 -0
  16. package/dist/components/Card/diff.d.ts +24 -0
  17. package/dist/components/Card/index.d.ts +9 -0
  18. package/dist/components/Card/size.d.ts +22 -0
  19. package/dist/components/Card/statistic.d.ts +10 -0
  20. package/dist/components/Charts/TimelineCharts/index.d.ts +13 -0
  21. package/dist/components/Charts/TreeMap.d.ts +23 -0
  22. package/dist/components/Charts/TreeMap.mjs +1 -1
  23. package/dist/components/Charts/TreeMap.mjs.map +1 -1
  24. package/dist/components/Charts/bootstrap.d.ts +5 -0
  25. package/dist/components/Charts/common.d.ts +15 -0
  26. package/dist/components/Charts/constants.d.ts +19 -0
  27. package/dist/components/Charts/done.d.ts +5 -0
  28. package/dist/components/Charts/index.d.ts +10 -0
  29. package/dist/components/Charts/loader.d.ts +4 -0
  30. package/dist/components/Charts/minify.d.ts +5 -0
  31. package/dist/components/Charts/treemap_module.css +1 -1
  32. package/dist/components/Charts/treemap_module.css.map +1 -1
  33. package/dist/components/Charts/types.d.ts +61 -0
  34. package/dist/components/Charts/utils.d.ts +13 -0
  35. package/dist/components/Configuration/builder.d.ts +13 -0
  36. package/dist/components/Configuration/index.d.ts +1 -0
  37. package/dist/components/FileTree/index.d.ts +5 -0
  38. package/dist/components/Form/keyword.d.ts +14 -0
  39. package/dist/components/Keyword/index.d.ts +6 -0
  40. package/dist/components/Layout/builder-select.d.ts +2 -0
  41. package/dist/components/Layout/constants.d.ts +1 -0
  42. package/dist/components/Layout/header.d.ts +3 -0
  43. package/dist/components/Layout/index.d.ts +5 -0
  44. package/dist/components/Layout/menus.d.ts +8 -0
  45. package/dist/components/Layout/progress.d.ts +8 -0
  46. package/dist/components/Loader/Analysis/files.d.ts +9 -0
  47. package/dist/components/Loader/Analysis/index.d.ts +11 -0
  48. package/dist/components/Loader/executions.d.ts +9 -0
  49. package/dist/components/Manifest/api.d.ts +34 -0
  50. package/dist/components/Manifest/data.d.ts +8 -0
  51. package/dist/components/Manifest/index.d.ts +2 -0
  52. package/dist/components/Opener/code.d.ts +20 -0
  53. package/dist/components/Opener/index.d.ts +2 -0
  54. package/dist/components/Opener/vscode.d.ts +11 -0
  55. package/dist/components/Overall/DataSummary.d.ts +8 -0
  56. package/dist/components/Overall/bundle.d.ts +11 -0
  57. package/dist/components/Overall/compile.d.ts +5 -0
  58. package/dist/components/Overall/help-center.d.ts +1 -0
  59. package/dist/components/Overall/index.d.ts +3 -0
  60. package/dist/components/Overall/overview.d.ts +8 -0
  61. package/dist/components/Overall/project.d.ts +7 -0
  62. package/dist/components/Plugins/webpack.d.ts +18 -0
  63. package/dist/components/Resolver/analysis.d.ts +15 -0
  64. package/dist/components/Select/index.d.ts +18 -0
  65. package/dist/components/Status/failed.d.ts +9 -0
  66. package/dist/components/Status/index.d.ts +1 -0
  67. package/dist/components/TextDrawer/duplicate.d.ts +17 -0
  68. package/dist/components/TextDrawer/index.d.ts +12 -0
  69. package/dist/components/Title/index.d.ts +15 -0
  70. package/dist/components/base/CodeViewer/index.d.ts +5 -0
  71. package/dist/components/base/CodeViewer/interface.d.ts +45 -0
  72. package/dist/components/base/CodeViewer/useCodeDrawer.d.ts +9 -0
  73. package/dist/components/base/CodeViewer/utils.d.ts +18 -0
  74. package/dist/components/base/DiffViewer/index.d.ts +5 -0
  75. package/dist/components/base/DiffViewer/interface.d.ts +47 -0
  76. package/dist/components/base/DiffViewer/useDiffDrawer.d.ts +9 -0
  77. package/dist/components/base/DiffViewer/utils.d.ts +7 -0
  78. package/dist/components/base/index.d.ts +5 -0
  79. package/dist/components/index.d.ts +10 -0
  80. package/dist/config.d.ts +19 -0
  81. package/dist/constants.d.ts +50 -0
  82. package/dist/index.d.ts +3 -0
  83. package/dist/pages/BundleSize/components/asset.d.ts +26 -0
  84. package/dist/pages/BundleSize/components/cards.d.ts +7 -0
  85. package/dist/pages/BundleSize/components/index.d.ts +16 -0
  86. package/dist/pages/BundleSize/components/search-modal.d.ts +8 -0
  87. package/dist/pages/BundleSize/config.d.ts +6 -0
  88. package/dist/pages/BundleSize/constants.d.ts +5 -0
  89. package/dist/pages/BundleSize/index.d.ts +3 -0
  90. package/dist/pages/ModuleAnalyze/chunks.d.ts +6 -0
  91. package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +15 -0
  92. package/dist/pages/ModuleAnalyze/constants.d.ts +7 -0
  93. package/dist/pages/ModuleAnalyze/dependency.d.ts +9 -0
  94. package/dist/pages/ModuleAnalyze/fileTree.d.ts +10 -0
  95. package/dist/pages/ModuleAnalyze/index.d.ts +15 -0
  96. package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +21 -0
  97. package/dist/pages/ModuleAnalyze/utils/index.d.ts +3 -0
  98. package/dist/pages/ModuleResolve/constants.d.ts +3 -0
  99. package/dist/pages/ModuleResolve/index.d.ts +3 -0
  100. package/dist/pages/Overall/constants.d.ts +3 -0
  101. package/dist/pages/Overall/index.d.ts +9 -0
  102. package/dist/pages/Overall/responsiveLayout.d.ts +6 -0
  103. package/dist/pages/Resources/BundleDiff/DiffContainer/assets.d.ts +7 -0
  104. package/dist/pages/Resources/BundleDiff/DiffContainer/cards.d.ts +3 -0
  105. package/dist/pages/Resources/BundleDiff/DiffContainer/changes.d.ts +15 -0
  106. package/dist/pages/Resources/BundleDiff/DiffContainer/constants.d.ts +11 -0
  107. package/dist/pages/Resources/BundleDiff/DiffContainer/index.d.ts +3 -0
  108. package/dist/pages/Resources/BundleDiff/DiffContainer/modules.d.ts +8 -0
  109. package/dist/pages/Resources/BundleDiff/DiffContainer/overview.d.ts +5 -0
  110. package/dist/pages/Resources/BundleDiff/DiffContainer/packages.d.ts +19 -0
  111. package/dist/pages/Resources/BundleDiff/DiffContainer/row.d.ts +9 -0
  112. package/dist/pages/Resources/BundleDiff/DiffContainer/types.d.ts +44 -0
  113. package/dist/pages/Resources/BundleDiff/DiffContainer/utils.d.ts +2 -0
  114. package/dist/pages/Resources/BundleDiff/DiffServerAPIProvider/index.d.ts +3 -0
  115. package/dist/pages/Resources/BundleDiff/constants.d.ts +11 -0
  116. package/dist/pages/Resources/BundleDiff/index.d.ts +4 -0
  117. package/dist/pages/Resources/RuleIndex/constants.d.ts +3 -0
  118. package/dist/pages/Resources/RuleIndex/index.d.ts +3 -0
  119. package/dist/pages/TreeShaking/constants.d.ts +3 -0
  120. package/dist/pages/TreeShaking/editor.d.ts +11 -0
  121. package/dist/pages/TreeShaking/index.d.ts +8 -0
  122. package/dist/pages/TreeShaking/open-tag.d.ts +11 -0
  123. package/dist/pages/TreeShaking/range.d.ts +282 -0
  124. package/dist/pages/TreeShaking/space.d.ts +1 -0
  125. package/dist/pages/TreeShaking/table.d.ts +13 -0
  126. package/dist/pages/TreeShaking/types.d.ts +3 -0
  127. package/dist/pages/TreeShaking/utils.d.ts +7 -0
  128. package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +3 -0
  129. package/dist/pages/WebpackLoaders/Analysis/index.d.ts +3 -0
  130. package/dist/pages/WebpackLoaders/Overall/constants.d.ts +3 -0
  131. package/dist/pages/WebpackLoaders/Overall/index.d.ts +3 -0
  132. package/dist/pages/WebpackLoaders/constants.d.ts +2 -0
  133. package/dist/pages/WebpackPlugins/constants.d.ts +3 -0
  134. package/dist/pages/WebpackPlugins/index.d.ts +4 -0
  135. package/dist/pages/index.d.ts +10 -0
  136. package/dist/utils/data/base.d.ts +24 -0
  137. package/dist/utils/data/brief.d.ts +11 -0
  138. package/dist/utils/data/index.d.ts +5 -0
  139. package/dist/utils/data/local.d.ts +14 -0
  140. package/dist/utils/data/remote.d.ts +10 -0
  141. package/dist/utils/file.d.ts +47 -0
  142. package/dist/utils/hooks.d.ts +30 -0
  143. package/dist/utils/i18n/cn.d.ts +3 -0
  144. package/dist/utils/i18n/en.d.ts +40 -0
  145. package/dist/utils/i18n/index.d.ts +2 -0
  146. package/dist/utils/index.d.ts +15 -0
  147. package/dist/utils/loader.d.ts +7 -0
  148. package/dist/utils/locale.d.ts +4 -0
  149. package/dist/utils/manifest.d.ts +24 -0
  150. package/dist/utils/request.d.ts +29 -0
  151. package/dist/utils/routes.d.ts +3 -0
  152. package/dist/utils/size.d.ts +2 -0
  153. package/dist/utils/socket.d.ts +7 -0
  154. package/dist/utils/storage.d.ts +15 -0
  155. package/dist/utils/string.d.ts +2 -0
  156. package/dist/utils/time.d.ts +3 -0
  157. package/dist/utils/url.d.ts +7 -0
  158. package/dist/utils/worker/index.d.ts +4 -0
  159. package/dist/utils/worker/master.d.ts +8 -0
  160. package/dist/utils/worker/types.d.ts +9 -0
  161. package/dist/utils/worker/utils.d.ts +7 -0
  162. package/dist/utils/worker/worker.d.ts +13 -0
  163. package/package.json +4 -4
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { CodeChangeAlertProps } from './types';
3
+ export declare const CodeChangeAlert: React.FC<CodeChangeAlertProps>;
@@ -0,0 +1,2 @@
1
+ import { LinkAlertProps } from './types';
2
+ export declare const ECMAVersionCheck: React.FC<LinkAlertProps>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { FileRelationAlertProps } from './types';
3
+ export declare const FileRelationAlert: React.FC<FileRelationAlertProps>;
@@ -0,0 +1,16 @@
1
+ import { Rule, SDK } from '@rsdoctor/types';
2
+ import { PackageRelationAlertProps } from './types';
3
+ export declare const PackageRelationReasons: React.FC<{
4
+ data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>;
5
+ cwd: string;
6
+ }>;
7
+ export declare const PackageRelationReasonsWithServer: import("react").FC<Omit<{
8
+ data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>;
9
+ cwd: string;
10
+ }, "data"> & Partial<{
11
+ body: {
12
+ id: Rule.RuleStoreDataItem["id"];
13
+ target: SDK.PackageBasicData;
14
+ };
15
+ }>>;
16
+ export declare const PackageRelationAlert: React.FC<PackageRelationAlertProps>;
@@ -0,0 +1,33 @@
1
+ import { Rule } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ import type { CheckSyntax } from '@rsbuild/plugin-check-syntax';
4
+ export interface AlertProps extends Omit<PackageRelationAlertProps, 'data'> {
5
+ data: Rule.RuleStoreDataItem;
6
+ cwd: string;
7
+ }
8
+ export interface PackageRelationAlertProps {
9
+ data: Rule.PackageRelationDiffRuleStoreData;
10
+ getPackageRelationContentComponent: React.FC<{
11
+ data: Rule.PackageRelationDiffRuleStoreData;
12
+ package: Rule.PackageRelationData;
13
+ }>;
14
+ cwd: string;
15
+ }
16
+ export interface FileRelationAlertProps {
17
+ data: Rule.FileRelationRuleStoreData;
18
+ }
19
+ export interface CodeChangeAlertProps {
20
+ data: Rule.CodeChangeRuleStoreData;
21
+ cwd: string;
22
+ }
23
+ export interface CodeViewAlertProps {
24
+ data: Rule.CodeViewRuleStoreData;
25
+ cwd: string;
26
+ }
27
+ type CheckSyntaxError = CheckSyntax['errors'] extends Array<infer T> ? T : false;
28
+ export interface LinkAlertProps {
29
+ data: (Rule.RuleStoreDataItem & {
30
+ error?: CheckSyntaxError;
31
+ })[];
32
+ }
33
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CodeViewAlertProps } from './types';
3
+ export declare const CodeViewDrawerContent: React.FC<CodeViewAlertProps>;
4
+ export declare const CodeViewAlert: React.FC<CodeViewAlertProps>;
@@ -0,0 +1,14 @@
1
+ import { ViewMode } from '../../constants';
2
+ import { AlertProps } from '../Alert/types';
3
+ import type { Rule } from '@rsdoctor/types';
4
+ interface BundleAlertProps {
5
+ title: string;
6
+ cwd: string;
7
+ dataSource: Rule.RuleStoreDataItem[];
8
+ extraData: Omit<AlertProps, 'data'>;
9
+ viewMode: ViewMode;
10
+ setViewMode(mode: ViewMode): void;
11
+ extraCom?: JSX.Element | undefined;
12
+ }
13
+ export declare const BundleAlert: React.FC<BundleAlertProps>;
14
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Rule, SDK } from '@rsdoctor/types';
3
+ interface BundleAlertsProps {
4
+ filter?(alert: Rule.RuleStoreDataItem): boolean;
5
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
6
+ }
7
+ export declare const BundleAlertsBase: React.FC<BundleAlertsProps>;
8
+ export declare const BundleAlerts: React.FC<Omit<BundleAlertsProps, "project"> & Partial<{
9
+ body?: any;
10
+ }>>;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Rule } from '@rsdoctor/types';
2
+ import type { AlertProps } from '../Alert/types';
3
+ export declare const CrossChunksAlertCollapse: (props: {
4
+ data: Array<Rule.RuleStoreDataItem>;
5
+ extraData: Omit<AlertProps, "data">;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Rule } from '@rsdoctor/types';
2
+ import type { AlertProps } from '../Alert/types';
3
+ export declare const AlertCollapse: (props: {
4
+ data: Array<Rule.RuleStoreDataItem>;
5
+ extraData: Omit<AlertProps, "data">;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Rule, SDK } from '@rsdoctor/types';
3
+ interface CompileAlertsProps {
4
+ filter?(alert: Rule.RuleStoreDataItem): boolean;
5
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
6
+ }
7
+ export declare const CompileAlerts: React.FC<Omit<CompileAlertsProps, "project"> & Partial<{
8
+ body?: any;
9
+ }>>;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './bundle';
2
+ export * from './compile';
3
+ export * from './overlay';
@@ -0,0 +1,4 @@
1
+ import type { Rule } from '@rsdoctor/types';
2
+ export declare const CommonList: (props: {
3
+ data: Array<Rule.RuleStoreDataItem>;
4
+ }) => import("react/jsx-runtime").JSX.Element[];
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ import 'rc-dialog/assets/index.css';
4
+ export declare const OverlayAlertsModal: React.FC<{
5
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
6
+ open: boolean;
7
+ onClose(): void;
8
+ }>;
9
+ export declare const OverlayAlertsTips: React.FC<{
10
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
11
+ defaultOpen?: boolean;
12
+ }>;
13
+ export declare const OverlayAlertsButton: React.FC<{
14
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
15
+ }>;
16
+ export declare const OverlayAlertsWithButton: React.FC<Omit<{
17
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
18
+ }, "alerts"> & Partial<{
19
+ body?: any;
20
+ }>>;
21
+ export declare const OverlayAlertsWithTips: React.FC<Omit<{
22
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
23
+ defaultOpen?: boolean;
24
+ }, "alerts"> & Partial<{
25
+ body?: any;
26
+ }>>;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare enum BadgeType {
3
+ Default = "default",
4
+ Success = "success",
5
+ Warn = "warn",
6
+ Error = "error"
7
+ }
8
+ export declare const BadgeColorMap: {
9
+ default: string;
10
+ success: string;
11
+ warn: string;
12
+ error: string;
13
+ };
14
+ interface BadgeProps {
15
+ label: string | number | React.ReactNode;
16
+ value: string | number | React.ReactNode;
17
+ type?: BadgeType | `${BadgeType}`;
18
+ tooltip?: true | string | React.ReactNode;
19
+ }
20
+ export declare const Badge: React.FC<BadgeProps>;
21
+ export {};
@@ -0,0 +1,24 @@
1
+ import { Client } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ export { StatisticCard } from './statistic';
4
+ export interface DiffCardProps extends Pick<DiffCardContentProps, 'formatter'> {
5
+ titles: Array<string> | [string | React.ReactNode];
6
+ datas: Array<DiffCardContentProps['data']>;
7
+ showPercentInTitle?: boolean;
8
+ }
9
+ export interface DiffCardContentProps {
10
+ data: Client.RsdoctorClientAssetsDiffItem;
11
+ formatter?(v: number, target: 'baseline' | 'current'): number | string | React.ReactNode;
12
+ }
13
+ export interface PercentProps {
14
+ percent: number;
15
+ state: Client.RsdoctorClientDiffState;
16
+ fontSize?: React.CSSProperties['fontSize'];
17
+ }
18
+ export declare const SizePercent: React.FC<{
19
+ baseline: number;
20
+ current: number;
21
+ } & Omit<PercentProps, 'percent' | 'state'>>;
22
+ export declare const Percent: React.FC<PercentProps>;
23
+ export declare const DiffCardContent: React.FC<DiffCardContentProps>;
24
+ export declare const DiffCard: React.FC<DiffCardProps>;
@@ -0,0 +1,9 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import { CardProps as CProps } from 'antd';
3
+ export * from './diff';
4
+ export interface CardProps extends CProps {
5
+ collapsable?: boolean;
6
+ dividerStyle?: CSSProperties;
7
+ defaultCollapsed?: boolean;
8
+ }
9
+ export declare const Card: React.FC<CardProps>;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export interface SizeCardProps {
3
+ files: {
4
+ path: string;
5
+ size: number;
6
+ }[];
7
+ /**
8
+ * total size for origin files
9
+ */
10
+ total: number;
11
+ /**
12
+ * @default false
13
+ */
14
+ showProgress?: boolean;
15
+ tagBgColor: string;
16
+ type: string;
17
+ }
18
+ export interface bgColorType {
19
+ bgColor: string;
20
+ tagBgColor: string;
21
+ }
22
+ export declare const SizeCard: React.FC<SizeCardProps>;
@@ -0,0 +1,10 @@
1
+ import { StatisticProps } from 'antd';
2
+ export interface StatisticCardProps {
3
+ title: string | React.ReactNode;
4
+ value: string | React.ReactNode;
5
+ statisticProps?: StatisticProps;
6
+ boxProps?: {
7
+ style?: React.CSSProperties;
8
+ };
9
+ }
10
+ export declare const StatisticCard: React.FC<StatisticCardProps>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { DurationMetric, ITraceEventData } from '../types';
3
+ import { ChartTypes } from '../constants';
4
+ export declare const TimelineCom: React.FC<{
5
+ loaderData?: DurationMetric[];
6
+ pluginsData?: ITraceEventData[];
7
+ formatterFn: Function;
8
+ chartType?: ChartTypes;
9
+ exts?: {
10
+ endTimestamp: number;
11
+ startTimestamp: number;
12
+ };
13
+ }>;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ export type TreeNode = {
3
+ name: string;
4
+ value?: number;
5
+ children?: TreeNode[];
6
+ path?: string;
7
+ sourceSize?: number;
8
+ bundledSize?: number;
9
+ gzipSize?: number;
10
+ };
11
+ interface TreeMapProps {
12
+ treeData: TreeNode[];
13
+ valueKey?: 'sourceSize' | 'bundledSize';
14
+ style?: React.CSSProperties;
15
+ onChartClick?: (params: any) => void;
16
+ }
17
+ export declare const TreeMap: React.ForwardRefExoticComponent<TreeMapProps & React.RefAttributes<any>>;
18
+ export declare const AssetTreemapWithFilter: React.FC<{
19
+ treeData: TreeNode[];
20
+ onChartClick?: (params: any) => void;
21
+ bundledSize?: boolean;
22
+ }>;
23
+ export {};
@@ -294,7 +294,7 @@ const AssetTreemapWithFilter = ({ treeData, onChartClick, bundledSize = false })
294
294
  options: assetNames,
295
295
  value: checkedAssets,
296
296
  onChange: setCheckedAssets,
297
- className: treemap_module["asset-checkbox-group"]
297
+ className: `checkbox-container ${collapsed ? 'collapsed' : ''} ${treemap_module["asset-checkbox-group"]}`
298
298
  }, "asset-checkbox-group")
299
299
  ]
300
300
  })
@@ -1 +1 @@
1
- {"version":3,"file":"components/Charts/TreeMap.mjs","sources":["webpack://@rsdoctor/components/./src/components/Charts/TreeMap.tsx"],"sourcesContent":["import React, { useEffect, useState, memo, useMemo } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { TreemapChart } from 'echarts/charts';\nimport { TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { BUNDLE_ANALYZER_COLORS, COLOR_GROUPS } from './constants';\nimport { Checkbox, Card, Typography, Space, Tooltip, Tag } from 'antd';\nimport {\n VerticalAlignBottomOutlined,\n VerticalAlignTopOutlined,\n InfoCircleOutlined,\n} from '@ant-design/icons';\nimport { formatSize, useI18n } from 'src/utils';\nimport { SearchModal } from 'src/pages/BundleSize/components/search-modal';\nimport Styles from './treemap.module.scss';\n\n// TreeNode type should match the output of flattenTreemapData\nexport type TreeNode = {\n name: string;\n value?: number;\n children?: TreeNode[];\n path?: string;\n sourceSize?: number;\n bundledSize?: number;\n gzipSize?: number;\n};\n\ninterface TreeMapProps {\n treeData: TreeNode[];\n valueKey?: 'sourceSize' | 'bundledSize'; // which value to show as area\n style?: React.CSSProperties;\n onChartClick?: (params: any) => void;\n}\n\n// Simple hash function for string (djb2)\nfunction hashString(str: string): number {\n let hash = 5381;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) + hash + str.charCodeAt(i); /* hash * 33 + c */\n }\n return hash >>> 0; // Ensure unsigned\n}\n\nfunction getLevelOption() {\n return [\n {\n itemStyle: {\n color: 'white',\n borderColor: '#eee',\n borderWidth: 5,\n gapWidth: 5,\n },\n emphasis: {\n itemStyle: {\n borderColor: '#a29f9f',\n },\n },\n },\n {\n colorSaturation: [0.25, 0.5],\n itemStyle: {\n borderWidth: 5,\n gapWidth: 5,\n borderColorSaturation: 0.5,\n borderColor: '#eee',\n },\n },\n ];\n}\n\nconst TreeMapInner: React.FC<TreeMapProps & { forwardedRef?: React.Ref<any> }> =\n memo(\n ({\n treeData,\n valueKey = 'sourceSize',\n style,\n onChartClick,\n forwardedRef,\n }) => {\n const [option, setOption] = useState<any>(null);\n const chartRef = React.useRef<any>(null);\n\n // Expose chartRef to parent if forwardedRef is provided\n useEffect(() => {\n if (forwardedRef && chartRef.current) {\n if (typeof forwardedRef === 'function') {\n forwardedRef(chartRef.current);\n } else {\n (forwardedRef as React.MutableRefObject<any>).current =\n chartRef.current;\n }\n }\n }, [forwardedRef, chartRef.current]);\n\n // Register ECharts components\n useEffect(() => {\n echarts.use([TreemapChart, TooltipComponent, CanvasRenderer]);\n }, []);\n\n useEffect(() => {\n if (!treeData) return;\n // Helper to recursively add value field for ECharts\n function convert(\n node: TreeNode,\n colorGroup: keyof typeof BUNDLE_ANALYZER_COLORS,\n level = 0,\n ): any {\n const groupColors = BUNDLE_ANALYZER_COLORS[colorGroup];\n const children = node.children?.map((c, _i) =>\n convert(c, colorGroup, level + 1),\n );\n\n return {\n id: node.path ? hashString(node.path) : undefined,\n name: node.name,\n value: node[valueKey] ?? node.value ?? 0,\n path: node.path,\n sourceSize: node.sourceSize ?? node.value,\n bundledSize: node.bundledSize,\n gzipSize: node.gzipSize,\n children: children && children.length > 0 ? children : undefined,\n itemStyle: {\n borderWidth: 2,\n gapWidth: 2,\n borderColorSaturation: 0.2,\n colorSaturation: 0.2,\n color: groupColors[level % groupColors.length],\n borderColor: groupColors[level % groupColors.length],\n },\n level,\n };\n }\n const data = treeData.map((item, index) => {\n const group = COLOR_GROUPS[index % COLOR_GROUPS.length];\n return convert(item, group, 0);\n });\n\n setOption({\n title: {\n text: 'Bundle Tree Map',\n left: 'center',\n },\n tooltip: {\n position: 'top',\n formatter: function (info: any) {\n var treePathInfo = info.treePathInfo;\n var treePath = [];\n for (var i = 1; i < treePathInfo.length; i++) {\n treePath.push(treePathInfo[i].name);\n }\n // Get extra info from node data\n var node = info.data || {};\n var path = node.path || treePath.join('/');\n var sourceSize = node.sourceSize;\n var bundledSize = node.bundledSize;\n var gzipSize = node.gzipSize;\n var level = node.level;\n\n function makeRow(\n label: string,\n value: string,\n valueColor?: string,\n ) {\n return (\n `<div class=\"${Styles['tooltip-row']}\">` +\n `<span class=\"${Styles['tooltip-label']}\">${label}</span>` +\n `<span${valueColor ? ` style=\"color: ${valueColor}\"` : ''}>${value}</span>` +\n '</div>'\n );\n }\n return [\n `<div class=\"${Styles['tooltip-path']}\">` +\n echarts.format.encodeHTML(path) +\n '</div>',\n makeRow(\n level === 0 ? 'Asset' : 'Source',\n sourceSize !== undefined ? formatSize(sourceSize) : '-',\n ),\n !bundledSize\n ? ''\n : makeRow('Bundled', formatSize(bundledSize), '#1890ff'),\n !gzipSize\n ? ''\n : makeRow('Gzipped', formatSize(gzipSize), '#52c41a'),\n ].join('');\n },\n },\n series: [\n {\n name: 'Bundle Tree Map',\n id: 'bundle-treemap',\n type: 'treemap',\n visibleMin: 300,\n left: 10,\n right: 10,\n top: 10,\n bottom: 10,\n label: {\n show: true,\n formatter: '{b}',\n color: '#000',\n },\n upperLabel: {\n show: true,\n height: 30,\n },\n\n levels: getLevelOption(),\n data: data,\n },\n ],\n });\n }, [treeData, valueKey]);\n\n return option ? (\n <div>\n <ReactEChartsCore\n ref={chartRef}\n option={option}\n echarts={echarts}\n onEvents={onChartClick ? { click: onChartClick } : undefined}\n style={{\n width: '100%',\n minHeight: '500px',\n maxHeight: '1000px',\n border: '5px solid white',\n borderRadius: '10px',\n ...style,\n }}\n className={Styles['chart-container']}\n />\n </div>\n ) : null;\n },\n );\n\nexport const TreeMap = React.forwardRef<any, TreeMapProps>((props, ref) => (\n <TreeMapInner {...props} forwardedRef={ref} />\n));\n\nexport const AssetTreemapWithFilter: React.FC<{\n treeData: TreeNode[];\n onChartClick?: (params: any) => void;\n bundledSize?: boolean;\n}> = ({ treeData, onChartClick, bundledSize = false }) => {\n const assetNames = useMemo(\n () => treeData.map((item) => item.name),\n [treeData],\n );\n const [checkedAssets, setCheckedAssets] = useState<string[]>(assetNames);\n const [collapsed, setCollapsed] = useState(false);\n const [searchModalOpen, setSearchModalOpen] = useState(false);\n const chartRef = React.useRef<any>(null);\n const { t } = useI18n();\n\n const filteredTreeData = useMemo(\n () => treeData.filter((item) => checkedAssets.includes(item.name)),\n [treeData, checkedAssets],\n );\n\n // Handler for search modal click\n const handleModuleClick = (module: any) => {\n if (!module?.path) return;\n const nodeId = hashString(module.path);\n if (chartRef.current) {\n const echartsInstance = chartRef.current.getEchartsInstance();\n echartsInstance.dispatchAction({\n type: 'treemapZoomToNode',\n seriesId: 'bundle-treemap',\n targetNodeId: nodeId.toString(),\n });\n }\n setSearchModalOpen(false);\n };\n\n return (\n <div\n style={{ display: 'flex', flexDirection: 'column', gap: 16 }}\n className={Styles.treemap}\n >\n <Space direction=\"vertical\" style={{ width: '100%' }}>\n <Card\n title={\n <Space>\n <Typography.Text>{t('Output Assets List')}</Typography.Text>\n <SearchModal\n onModuleClick={handleModuleClick}\n open={searchModalOpen}\n setOpen={setSearchModalOpen}\n isIcon={true}\n />\n <Tooltip\n color={'white'}\n title={\n <span>\n ✨ In Rspack, TreeMap proportions are always based on\n Bundled Size by default.\n <br />\n ✨ In Webpack, TreeMap proportions are based on Bundled Size\n only when SourceMap is enabled.\n <br />✨ <b>Bundled Size</b>: The size of a module after\n bundling and minification.\n <br />✨ <b>Source Size</b>: The size of a module after\n compilation (e.g., TypeScript/JSX to JS), but before\n bundling and minification.\n <br />✨ <b>Gzipped Size</b>: The compressed file size that\n users actually download, as most web servers use gzip\n compression.\n <br />\n </span>\n }\n overlayInnerStyle={{ width: 620, color: 'black' }}\n >\n <InfoCircleOutlined\n style={{ color: '#1890ff', marginLeft: 8 }}\n />\n </Tooltip>\n <Tag color=\"blue\">\n TreeMap area based on{' '}\n {bundledSize ? 'Bundled Size' : 'Source Size'}\n </Tag>\n </Space>\n }\n extra={\n <span\n className={Styles['collapse-icon']}\n onClick={() => setCollapsed((c) => !c)}\n aria-label={collapsed ? t('Expand') : t('Collapse')}\n >\n {collapsed ? (\n <VerticalAlignBottomOutlined />\n ) : (\n <VerticalAlignTopOutlined />\n )}\n </span>\n }\n size=\"small\"\n className={`card-body ${collapsed ? 'collapsed' : ''}`}\n >\n <div className={`checkbox-container ${collapsed ? 'collapsed' : ''}`}>\n <Checkbox\n key=\"all-none-checkbox\"\n indeterminate={\n checkedAssets.length > 0 &&\n checkedAssets.length < assetNames.length\n }\n checked={checkedAssets.length === assetNames.length}\n onChange={(e) =>\n setCheckedAssets(e.target.checked ? assetNames : [])\n }\n className={Styles['all-none-checkbox']}\n >\n {'ALL / NONE'}\n </Checkbox>\n <Checkbox.Group\n key=\"asset-checkbox-group\"\n options={assetNames}\n value={checkedAssets}\n onChange={setCheckedAssets}\n className={Styles['asset-checkbox-group']}\n />\n </div>\n </Card>\n <div style={{ flex: 1 }}>\n <TreeMap\n ref={chartRef}\n treeData={filteredTreeData}\n valueKey={bundledSize ? 'bundledSize' : 'sourceSize'}\n onChartClick={onChartClick}\n />\n </div>\n </Space>\n </div>\n );\n};\n"],"names":["hashString","str","hash","i","getLevelOption","TreeMapInner","memo","treeData","valueKey","style","onChartClick","forwardedRef","option","setOption","useState","chartRef","React","useEffect","echarts","TreemapChart","TooltipComponent","CanvasRenderer","convert","node","colorGroup","level","_node_children","groupColors","BUNDLE_ANALYZER_COLORS","children","c","_i","undefined","data","item","index","group","COLOR_GROUPS","info","treePathInfo","treePath","path","sourceSize","bundledSize","gzipSize","makeRow","label","value","valueColor","Styles","formatSize","ReactEChartsCore","TreeMap","props","ref","AssetTreemapWithFilter","assetNames","useMemo","checkedAssets","setCheckedAssets","collapsed","setCollapsed","searchModalOpen","setSearchModalOpen","t","useI18n","filteredTreeData","handleModuleClick","module","nodeId","echartsInstance","Space","Card","Typography","SearchModal","Tooltip","InfoCircleOutlined","Tag","VerticalAlignBottomOutlined","VerticalAlignTopOutlined","Checkbox","e"],"mappings":";;;;;;;;;;;;;AAoCA,SAASA,WAAWC,GAAW;IAC7B,IAAIC,OAAO;IACX,IAAK,IAAIC,IAAI,GAAGA,IAAIF,IAAI,MAAM,EAAEE,IAC9BD,OAAQA,AAAAA,CAAAA,QAAQ,KAAKA,OAAOD,IAAI,UAAU,CAACE;IAE7C,OAAOD,SAAS;AAClB;AAEA,SAASE;IACP,OAAO;QACL;YACE,WAAW;gBACT,OAAO;gBACP,aAAa;gBACb,aAAa;gBACb,UAAU;YACZ;YACA,UAAU;gBACR,WAAW;oBACT,aAAa;gBACf;YACF;QACF;QACA;YACE,iBAAiB;gBAAC;gBAAM;aAAI;YAC5B,WAAW;gBACT,aAAa;gBACb,UAAU;gBACV,uBAAuB;gBACvB,aAAa;YACf;QACF;KACD;AACH;AAEA,MAAMC,eAAAA,WAAAA,GACJC,KACE,CAAC,EACCC,QAAQ,EACRC,WAAW,YAAY,EACvBC,KAAK,EACLC,YAAY,EACZC,YAAY,EACb;IACC,MAAM,CAACC,QAAQC,UAAU,GAAGC,SAAc;IAC1C,MAAMC,WAAWC,MAAAA,MAAY,CAAM;IAGnCC,UAAU;QACR,IAAIN,gBAAgBI,SAAS,OAAO,EAClC,IAAI,AAAwB,cAAxB,OAAOJ,cACTA,aAAaI,SAAS,OAAO;aAE5BJ,aAA6C,OAAO,GACnDI,SAAS,OAAO;IAGxB,GAAG;QAACJ;QAAcI,SAAS,OAAO;KAAC;IAGnCE,UAAU;QACRC,kDAAAA,GAAW,CAAC;YAACC;YAAcC;YAAkBC;SAAe;IAC9D,GAAG,EAAE;IAELJ,UAAU;QACR,IAAI,CAACV,UAAU;QAEf,SAASe,QACPC,IAAc,EACdC,UAA+C,EAC/CC,QAAQ,CAAC;gBAGQC;YADjB,MAAMC,cAAcC,sBAAsB,CAAC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cAAc,MAAM,KAAKF,WAAW,MAAM;gCACnD,UAAU,CAACyB,IACTtB,iBAAiBsB,EAAE,MAAM,CAAC,OAAO,GAAGzB,aAAa,EAAE;gCAErD,WAAWP,cAAAA,CAAAA,oBAA2B;0CAErC;+BAXG;0CAaN,IAAC+B,SAAS,KAAK;gCAEb,SAASxB;gCACT,OAAOE;gCACP,UAAUC;gCACV,WAAWV,cAAAA,CAAAA,uBAA8B;+BAJrC;;;;8BAQV,IAAC;oBAAI,OAAO;wBAAE,MAAM;oBAAE;8BACpB,kBAACG,SAAAA;wBACC,KAAKrC;wBACL,UAAUmD;wBACV,UAAUvB,cAAc,gBAAgB;wBACxC,cAAcjC;;;;;;AAM1B"}
1
+ {"version":3,"file":"components/Charts/TreeMap.mjs","sources":["webpack://@rsdoctor/components/./src/components/Charts/TreeMap.tsx"],"sourcesContent":["import React, { useEffect, useState, memo, useMemo } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { TreemapChart } from 'echarts/charts';\nimport { TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { BUNDLE_ANALYZER_COLORS, COLOR_GROUPS } from './constants';\nimport { Checkbox, Card, Typography, Space, Tooltip, Tag } from 'antd';\nimport {\n VerticalAlignBottomOutlined,\n VerticalAlignTopOutlined,\n InfoCircleOutlined,\n} from '@ant-design/icons';\nimport { formatSize, useI18n } from 'src/utils';\nimport { SearchModal } from 'src/pages/BundleSize/components/search-modal';\nimport Styles from './treemap.module.scss';\n\n// TreeNode type should match the output of flattenTreemapData\nexport type TreeNode = {\n name: string;\n value?: number;\n children?: TreeNode[];\n path?: string;\n sourceSize?: number;\n bundledSize?: number;\n gzipSize?: number;\n};\n\ninterface TreeMapProps {\n treeData: TreeNode[];\n valueKey?: 'sourceSize' | 'bundledSize'; // which value to show as area\n style?: React.CSSProperties;\n onChartClick?: (params: any) => void;\n}\n\n// Simple hash function for string (djb2)\nfunction hashString(str: string): number {\n let hash = 5381;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) + hash + str.charCodeAt(i); /* hash * 33 + c */\n }\n return hash >>> 0; // Ensure unsigned\n}\n\nfunction getLevelOption() {\n return [\n {\n itemStyle: {\n color: 'white',\n borderColor: '#eee',\n borderWidth: 5,\n gapWidth: 5,\n },\n emphasis: {\n itemStyle: {\n borderColor: '#a29f9f',\n },\n },\n },\n {\n colorSaturation: [0.25, 0.5],\n itemStyle: {\n borderWidth: 5,\n gapWidth: 5,\n borderColorSaturation: 0.5,\n borderColor: '#eee',\n },\n },\n ];\n}\n\nconst TreeMapInner: React.FC<TreeMapProps & { forwardedRef?: React.Ref<any> }> =\n memo(\n ({\n treeData,\n valueKey = 'sourceSize',\n style,\n onChartClick,\n forwardedRef,\n }) => {\n const [option, setOption] = useState<any>(null);\n const chartRef = React.useRef<any>(null);\n\n // Expose chartRef to parent if forwardedRef is provided\n useEffect(() => {\n if (forwardedRef && chartRef.current) {\n if (typeof forwardedRef === 'function') {\n forwardedRef(chartRef.current);\n } else {\n (forwardedRef as React.MutableRefObject<any>).current =\n chartRef.current;\n }\n }\n }, [forwardedRef, chartRef.current]);\n\n // Register ECharts components\n useEffect(() => {\n echarts.use([TreemapChart, TooltipComponent, CanvasRenderer]);\n }, []);\n\n useEffect(() => {\n if (!treeData) return;\n // Helper to recursively add value field for ECharts\n function convert(\n node: TreeNode,\n colorGroup: keyof typeof BUNDLE_ANALYZER_COLORS,\n level = 0,\n ): any {\n const groupColors = BUNDLE_ANALYZER_COLORS[colorGroup];\n const children = node.children?.map((c, _i) =>\n convert(c, colorGroup, level + 1),\n );\n\n return {\n id: node.path ? hashString(node.path) : undefined,\n name: node.name,\n value: node[valueKey] ?? node.value ?? 0,\n path: node.path,\n sourceSize: node.sourceSize ?? node.value,\n bundledSize: node.bundledSize,\n gzipSize: node.gzipSize,\n children: children && children.length > 0 ? children : undefined,\n itemStyle: {\n borderWidth: 2,\n gapWidth: 2,\n borderColorSaturation: 0.2,\n colorSaturation: 0.2,\n color: groupColors[level % groupColors.length],\n borderColor: groupColors[level % groupColors.length],\n },\n level,\n };\n }\n const data = treeData.map((item, index) => {\n const group = COLOR_GROUPS[index % COLOR_GROUPS.length];\n return convert(item, group, 0);\n });\n\n setOption({\n title: {\n text: 'Bundle Tree Map',\n left: 'center',\n },\n tooltip: {\n position: 'top',\n formatter: function (info: any) {\n var treePathInfo = info.treePathInfo;\n var treePath = [];\n for (var i = 1; i < treePathInfo.length; i++) {\n treePath.push(treePathInfo[i].name);\n }\n // Get extra info from node data\n var node = info.data || {};\n var path = node.path || treePath.join('/');\n var sourceSize = node.sourceSize;\n var bundledSize = node.bundledSize;\n var gzipSize = node.gzipSize;\n var level = node.level;\n\n function makeRow(\n label: string,\n value: string,\n valueColor?: string,\n ) {\n return (\n `<div class=\"${Styles['tooltip-row']}\">` +\n `<span class=\"${Styles['tooltip-label']}\">${label}</span>` +\n `<span${valueColor ? ` style=\"color: ${valueColor}\"` : ''}>${value}</span>` +\n '</div>'\n );\n }\n return [\n `<div class=\"${Styles['tooltip-path']}\">` +\n echarts.format.encodeHTML(path) +\n '</div>',\n makeRow(\n level === 0 ? 'Asset' : 'Source',\n sourceSize !== undefined ? formatSize(sourceSize) : '-',\n ),\n !bundledSize\n ? ''\n : makeRow('Bundled', formatSize(bundledSize), '#1890ff'),\n !gzipSize\n ? ''\n : makeRow('Gzipped', formatSize(gzipSize), '#52c41a'),\n ].join('');\n },\n },\n series: [\n {\n name: 'Bundle Tree Map',\n id: 'bundle-treemap',\n type: 'treemap',\n visibleMin: 300,\n left: 10,\n right: 10,\n top: 10,\n bottom: 10,\n label: {\n show: true,\n formatter: '{b}',\n color: '#000',\n },\n upperLabel: {\n show: true,\n height: 30,\n },\n\n levels: getLevelOption(),\n data: data,\n },\n ],\n });\n }, [treeData, valueKey]);\n\n return option ? (\n <div>\n <ReactEChartsCore\n ref={chartRef}\n option={option}\n echarts={echarts}\n onEvents={onChartClick ? { click: onChartClick } : undefined}\n style={{\n width: '100%',\n minHeight: '500px',\n maxHeight: '1000px',\n border: '5px solid white',\n borderRadius: '10px',\n ...style,\n }}\n className={Styles['chart-container']}\n />\n </div>\n ) : null;\n },\n );\n\nexport const TreeMap = React.forwardRef<any, TreeMapProps>((props, ref) => (\n <TreeMapInner {...props} forwardedRef={ref} />\n));\n\nexport const AssetTreemapWithFilter: React.FC<{\n treeData: TreeNode[];\n onChartClick?: (params: any) => void;\n bundledSize?: boolean;\n}> = ({ treeData, onChartClick, bundledSize = false }) => {\n const assetNames = useMemo(\n () => treeData.map((item) => item.name),\n [treeData],\n );\n const [checkedAssets, setCheckedAssets] = useState<string[]>(assetNames);\n const [collapsed, setCollapsed] = useState(false);\n const [searchModalOpen, setSearchModalOpen] = useState(false);\n const chartRef = React.useRef<any>(null);\n const { t } = useI18n();\n\n const filteredTreeData = useMemo(\n () => treeData.filter((item) => checkedAssets.includes(item.name)),\n [treeData, checkedAssets],\n );\n\n // Handler for search modal click\n const handleModuleClick = (module: any) => {\n if (!module?.path) return;\n const nodeId = hashString(module.path);\n if (chartRef.current) {\n const echartsInstance = chartRef.current.getEchartsInstance();\n echartsInstance.dispatchAction({\n type: 'treemapZoomToNode',\n seriesId: 'bundle-treemap',\n targetNodeId: nodeId.toString(),\n });\n }\n setSearchModalOpen(false);\n };\n\n return (\n <div\n style={{ display: 'flex', flexDirection: 'column', gap: 16 }}\n className={Styles.treemap}\n >\n <Space direction=\"vertical\" style={{ width: '100%' }}>\n <Card\n title={\n <Space>\n <Typography.Text>{t('Output Assets List')}</Typography.Text>\n <SearchModal\n onModuleClick={handleModuleClick}\n open={searchModalOpen}\n setOpen={setSearchModalOpen}\n isIcon={true}\n />\n <Tooltip\n color={'white'}\n title={\n <span>\n ✨ In Rspack, TreeMap proportions are always based on\n Bundled Size by default.\n <br />\n ✨ In Webpack, TreeMap proportions are based on Bundled Size\n only when SourceMap is enabled.\n <br />✨ <b>Bundled Size</b>: The size of a module after\n bundling and minification.\n <br />✨ <b>Source Size</b>: The size of a module after\n compilation (e.g., TypeScript/JSX to JS), but before\n bundling and minification.\n <br />✨ <b>Gzipped Size</b>: The compressed file size that\n users actually download, as most web servers use gzip\n compression.\n <br />\n </span>\n }\n overlayInnerStyle={{ width: 620, color: 'black' }}\n >\n <InfoCircleOutlined\n style={{ color: '#1890ff', marginLeft: 8 }}\n />\n </Tooltip>\n <Tag color=\"blue\">\n TreeMap area based on{' '}\n {bundledSize ? 'Bundled Size' : 'Source Size'}\n </Tag>\n </Space>\n }\n extra={\n <span\n className={Styles['collapse-icon']}\n onClick={() => setCollapsed((c) => !c)}\n aria-label={collapsed ? t('Expand') : t('Collapse')}\n >\n {collapsed ? (\n <VerticalAlignBottomOutlined />\n ) : (\n <VerticalAlignTopOutlined />\n )}\n </span>\n }\n size=\"small\"\n className={`card-body ${collapsed ? 'collapsed' : ''}`}\n >\n <div className={`checkbox-container ${collapsed ? 'collapsed' : ''}`}>\n <Checkbox\n key=\"all-none-checkbox\"\n indeterminate={\n checkedAssets.length > 0 &&\n checkedAssets.length < assetNames.length\n }\n checked={checkedAssets.length === assetNames.length}\n onChange={(e) =>\n setCheckedAssets(e.target.checked ? assetNames : [])\n }\n className={Styles['all-none-checkbox']}\n >\n {'ALL / NONE'}\n </Checkbox>\n <Checkbox.Group\n key=\"asset-checkbox-group\"\n options={assetNames}\n value={checkedAssets}\n onChange={setCheckedAssets}\n className={`checkbox-container ${collapsed ? 'collapsed' : ''} ${Styles['asset-checkbox-group']}`}\n />\n </div>\n </Card>\n <div style={{ flex: 1 }}>\n <TreeMap\n ref={chartRef}\n treeData={filteredTreeData}\n valueKey={bundledSize ? 'bundledSize' : 'sourceSize'}\n onChartClick={onChartClick}\n />\n </div>\n </Space>\n </div>\n );\n};\n"],"names":["hashString","str","hash","i","getLevelOption","TreeMapInner","memo","treeData","valueKey","style","onChartClick","forwardedRef","option","setOption","useState","chartRef","React","useEffect","echarts","TreemapChart","TooltipComponent","CanvasRenderer","convert","node","colorGroup","level","_node_children","groupColors","BUNDLE_ANALYZER_COLORS","children","c","_i","undefined","data","item","index","group","COLOR_GROUPS","info","treePathInfo","treePath","path","sourceSize","bundledSize","gzipSize","makeRow","label","value","valueColor","Styles","formatSize","ReactEChartsCore","TreeMap","props","ref","AssetTreemapWithFilter","assetNames","useMemo","checkedAssets","setCheckedAssets","collapsed","setCollapsed","searchModalOpen","setSearchModalOpen","t","useI18n","filteredTreeData","handleModuleClick","module","nodeId","echartsInstance","Space","Card","Typography","SearchModal","Tooltip","InfoCircleOutlined","Tag","VerticalAlignBottomOutlined","VerticalAlignTopOutlined","Checkbox","e"],"mappings":";;;;;;;;;;;;;AAoCA,SAASA,WAAWC,GAAW;IAC7B,IAAIC,OAAO;IACX,IAAK,IAAIC,IAAI,GAAGA,IAAIF,IAAI,MAAM,EAAEE,IAC9BD,OAAQA,AAAAA,CAAAA,QAAQ,KAAKA,OAAOD,IAAI,UAAU,CAACE;IAE7C,OAAOD,SAAS;AAClB;AAEA,SAASE;IACP,OAAO;QACL;YACE,WAAW;gBACT,OAAO;gBACP,aAAa;gBACb,aAAa;gBACb,UAAU;YACZ;YACA,UAAU;gBACR,WAAW;oBACT,aAAa;gBACf;YACF;QACF;QACA;YACE,iBAAiB;gBAAC;gBAAM;aAAI;YAC5B,WAAW;gBACT,aAAa;gBACb,UAAU;gBACV,uBAAuB;gBACvB,aAAa;YACf;QACF;KACD;AACH;AAEA,MAAMC,eAAAA,WAAAA,GACJC,KACE,CAAC,EACCC,QAAQ,EACRC,WAAW,YAAY,EACvBC,KAAK,EACLC,YAAY,EACZC,YAAY,EACb;IACC,MAAM,CAACC,QAAQC,UAAU,GAAGC,SAAc;IAC1C,MAAMC,WAAWC,MAAAA,MAAY,CAAM;IAGnCC,UAAU;QACR,IAAIN,gBAAgBI,SAAS,OAAO,EAClC,IAAI,AAAwB,cAAxB,OAAOJ,cACTA,aAAaI,SAAS,OAAO;aAE5BJ,aAA6C,OAAO,GACnDI,SAAS,OAAO;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5B,IAACC,0BAAwBA,CAAAA;;oBAI/B,MAAK;oBACL,WAAW,CAAC,UAAU,EAAEnB,YAAY,cAAc,IAAI;8BAEtD,mBAAC;wBAAI,WAAW,CAAC,mBAAmB,EAAEA,YAAY,cAAc,IAAI;;0CAClE,IAACoB,UAAQA;gCAEP,eACEtB,cAAc,MAAM,GAAG,KACvBA,cAAc,MAAM,GAAGF,WAAW,MAAM;gCAE1C,SAASE,cAAc,MAAM,KAAKF,WAAW,MAAM;gCACnD,UAAU,CAACyB,IACTtB,iBAAiBsB,EAAE,MAAM,CAAC,OAAO,GAAGzB,aAAa,EAAE;gCAErD,WAAWP,cAAAA,CAAAA,oBAA2B;0CAErC;+BAXG;0CAaN,IAAC+B,SAAS,KAAK;gCAEb,SAASxB;gCACT,OAAOE;gCACP,UAAUC;gCACV,WAAW,CAAC,mBAAmB,EAAEC,YAAY,cAAc,GAAG,CAAC,EAAEX,cAAAA,CAAAA,uBAA8B,EAAE;+BAJ7F;;;;8BAQV,IAAC;oBAAI,OAAO;wBAAE,MAAM;oBAAE;8BACpB,kBAACG,SAAAA;wBACC,KAAKrC;wBACL,UAAUmD;wBACV,UAAUvB,cAAc,gBAAgB;wBACxC,cAAcjC;;;;;;AAM1B"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './loader.scss';
3
+ import './tooltips.scss';
4
+ import { CommonChartProps } from './common';
5
+ export declare const BootstrapChartContainer: React.FC<CommonChartProps>;
@@ -0,0 +1,15 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ import './loader.scss';
4
+ import './tooltips.scss';
5
+ import { Metric } from './types';
6
+ import { ChartTypes } from './constants';
7
+ export interface CommonChartProps {
8
+ summary: SDK.SummaryData;
9
+ }
10
+ export declare const CommonExecutionsChart: React.FC<{
11
+ plugins: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
12
+ defaultDatas?: Metric[];
13
+ type?: ChartTypes;
14
+ }>;
15
+ export declare const CommonExecutionEmptyTips: React.FC;
@@ -0,0 +1,19 @@
1
+ export declare const PALETTE_COLORS: string[];
2
+ export declare enum ChartTypes {
3
+ Bootstrap = 0,
4
+ Compile = 1,
5
+ Done = 2,
6
+ Minify = 3,
7
+ Loader = 4,
8
+ Normal = 5
9
+ }
10
+ export declare const BUNDLE_ANALYZER_COLORS: {
11
+ readonly green: readonly [string, string, string, string, string, string, string];
12
+ readonly blue: readonly [string, string, string, string, string, string, string];
13
+ readonly purple: readonly [string, string, string, string, string, string, string];
14
+ readonly yellow: readonly [string, string, string, string, string, string, string];
15
+ readonly grey: readonly [string, string, string, string, string, string, string];
16
+ };
17
+ type ColorGroup = keyof typeof BUNDLE_ANALYZER_COLORS;
18
+ export declare const COLOR_GROUPS: ColorGroup[];
19
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CommonChartProps } from './common';
3
+ import './loader.scss';
4
+ import './tooltips.scss';
5
+ export declare const DoneChartContainer: React.FC<CommonChartProps>;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ export declare const LoaderChartBase: React.FC<{
4
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
5
+ }>;
6
+ export declare const LoaderChart: React.FC<Omit<{
7
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
8
+ }, "project"> & Partial<{
9
+ body?: any;
10
+ }>>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './loader.scss';
3
+ import { ChartProps } from './types';
4
+ export declare const LoaderExecutionsChart: React.FC<ChartProps>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CommonChartProps } from './common';
3
+ import './loader.scss';
4
+ import './tooltips.scss';
5
+ export declare const MinifyChartContainer: React.FC<CommonChartProps>;
@@ -34,7 +34,7 @@
34
34
  overflow: hidden;
35
35
  }
36
36
 
37
- .treemap-DOrYiA .card-body.collapsed {
37
+ .treemap-DOrYiA .card-body.collapsed .ant-card-body {
38
38
  height: 0;
39
39
  padding: 0;
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://./src/components/Charts/treemap.module.scss"],"names":[],"mappings":"AADA;EAEE,sBAAsB;EACtB,SAAS;EACT,aAAa;AACf;;AAEA;EACE,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,QAAQ;EACR,gBAAgB;EAChB,aAAa;AACf;;AAEA;EACE,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;EACX,iBAAiB;EACjB,kBAAkB;AACpB;;AAEA;EACE,8DAA8D;EAC9D,gBAAgB;AAClB;;AAEA;EACE,SAAS;EACT,UAAU;AACZ;;AAEA;EACE,UAAU;EACV,QAAQ;EACR,uBAAuB;AACzB;;AAEA;EACE,UAAU;AACZ;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,8BAA8B;EAC9B,eAAe;EACf,aAAa;AACf;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,qBAAqB;EACrB,yBAAyB;EACzB,YAAY;EACZ,kBAAkB;EAClB,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,eAAe;EACf,gBAAgB;AAClB","sourcesContent":[".treemap{display:flex;flex-direction:column;gap:16px}.treemap :global .ant-checkbox-wrapper{font-weight:200;font-size:12px}.treemap :global .all-none-checkbox{margin-bottom:4px;font-weight:500;font-size:12px}.treemap :global .asset-checkbox-group{display:flex;gap:8px;font-weight:200}.treemap :global .chart-container{width:100%;min-height:500px;max-height:1000px;border:5px solid #fff;border-radius:10px}.treemap :global .card-body{overflow:hidden;transition:height .3s cubic-bezier(0.4, 0, 0.2, 1),padding .3s}.treemap :global .card-body.collapsed{height:0;padding:0}.treemap :global .checkbox-container{opacity:1;transition:opacity .3s;gap:8px}.treemap :global .checkbox-container.collapsed{opacity:0}.treemap :global .statistics-space{width:100%}.tooltip-row{font-size:12px;display:flex;justify-content:space-between}.tooltip-label{color:#999}.tooltip-path{font-size:12px;margin-bottom:8px;width:280px;word-wrap:break-word;white-space:normal;word-break:break-all;line-height:1.4;overflow-wrap:break-word}.collapse-icon{cursor:pointer;margin-left:8px}"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://./src/components/Charts/treemap.module.scss"],"names":[],"mappings":"AADA;EAEE,sBAAsB;EACtB,SAAS;EACT,aAAa;AACf;;AAEA;EACE,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,QAAQ;EACR,gBAAgB;EAChB,aAAa;AACf;;AAEA;EACE,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;EACX,iBAAiB;EACjB,kBAAkB;AACpB;;AAEA;EACE,8DAA8D;EAC9D,gBAAgB;AAClB;;AAEA;EACE,SAAS;EACT,UAAU;AACZ;;AAEA;EACE,UAAU;EACV,QAAQ;EACR,uBAAuB;AACzB;;AAEA;EACE,UAAU;AACZ;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,8BAA8B;EAC9B,eAAe;EACf,aAAa;AACf;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,qBAAqB;EACrB,yBAAyB;EACzB,YAAY;EACZ,kBAAkB;EAClB,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,eAAe;EACf,gBAAgB;AAClB","sourcesContent":[".treemap{display:flex;flex-direction:column;gap:16px}.treemap :global .ant-checkbox-wrapper{font-weight:200;font-size:12px}.treemap :global .all-none-checkbox{margin-bottom:4px;font-weight:500;font-size:12px}.treemap :global .asset-checkbox-group{display:flex;gap:8px;font-weight:200}.treemap :global .chart-container{width:100%;min-height:500px;max-height:1000px;border:5px solid #fff;border-radius:10px}.treemap :global .card-body{overflow:hidden;transition:height .3s cubic-bezier(0.4, 0, 0.2, 1),padding .3s}.treemap :global .card-body.collapsed .ant-card-body{height:0;padding:0}.treemap :global .checkbox-container{opacity:1;transition:opacity .3s;gap:8px}.treemap :global .checkbox-container.collapsed{opacity:0}.treemap :global .statistics-space{width:100%}.tooltip-row{font-size:12px;display:flex;justify-content:space-between}.tooltip-label{color:#999}.tooltip-path{font-size:12px;margin-bottom:8px;width:280px;word-wrap:break-word;white-space:normal;word-break:break-all;line-height:1.4;overflow-wrap:break-word}.collapse-icon{cursor:pointer;margin-left:8px}"],"sourceRoot":""}
@@ -0,0 +1,61 @@
1
+ import { SDK } from "@rsdoctor/types";
2
+ export interface ChartProps {
3
+ loaders: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>;
4
+ cwd: string;
5
+ }
6
+ export interface CommonMetricPart<T extends string = string> {
7
+ _n?: boolean;
8
+ _c?: string;
9
+ p: string;
10
+ n: T;
11
+ ext?: unknown;
12
+ }
13
+ export declare type Metric = DurationMetric;
14
+ export interface DurationMetric extends CommonMetricPart {
15
+ _r?: [start: string, end: string];
16
+ s: number;
17
+ e: number;
18
+ c?: DurationMetric[];
19
+ }
20
+ export declare enum ETraceEventPhase {
21
+ BEGIN = "B",
22
+ END = "E",
23
+ COMPLETE = "X",
24
+ INSTANT = "I",
25
+ MARK = "R"
26
+ }
27
+ type MicroSeconds = number;
28
+ type ProcessID = number | string;
29
+ type ArgsType = {
30
+ p: string;
31
+ n: string;
32
+ s: number;
33
+ e: number;
34
+ };
35
+ export interface ITraceEventData {
36
+ /**
37
+ *Any arguments provided for the event. Some of the event types have required argument fields, otherwise, you can put any information you wish in here. The arguments are displayed in Trace Viewer when you view an event in the analysis section.
38
+ */
39
+ args: ArgsType;
40
+ /**
41
+ * The name of the event, as displayed in Chart.
42
+ */
43
+ name: string;
44
+ /**
45
+ * The event type. This is a single character which changes depending on the type of event being output.
46
+ */
47
+ ph: ETraceEventPhase;
48
+ /**
49
+ * The process ID for the process that output this event.
50
+ */
51
+ pid: ProcessID;
52
+ /**
53
+ * The tracing clock timestamp of the event. The timestamps are provided at microsecond granularity.
54
+ */
55
+ ts: MicroSeconds;
56
+ /**
57
+ * specify the tracing clock duration of complete events in microseconds.
58
+ */
59
+ dur?: MicroSeconds;
60
+ }
61
+ export {};
@@ -0,0 +1,13 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import './tooltips.scss';
3
+ import { DurationMetric, ITraceEventData } from './types';
4
+ export declare function getTooltipHtmlForLoader(loader: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>[0]): string;
5
+ export declare function renderTotalLoadersTooltip(loaderName: string, loaders: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>, cwd: string): string;
6
+ export declare function transformDurationMetric(rawData: DurationMetric[]): ITraceEventData[];
7
+ export declare function processTrans(rawData: DurationMetric[]): ITraceEventData[];
8
+ export declare function formatterForPlugins(raw: {
9
+ data: {
10
+ ext: ITraceEventData;
11
+ };
12
+ }): string;
13
+ export declare function useDebounceHook(value: DurationMetric[], delay: number): DurationMetric[] | undefined;
@@ -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").RsdoctorManifestMappingKeys;
11
+ };
12
+ }>>;
13
+ export {};
@@ -0,0 +1 @@
1
+ export * from './builder';
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { TreeProps } from 'rc-tree';
3
+ import './index.sass';
4
+ export declare function getFileCom(filename: string): import("react/jsx-runtime").JSX.Element;
5
+ export declare const FileTree: React.FC<Partial<TreeProps>>;
@@ -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,6 @@
1
+ import React from 'react';
2
+ import { TextProps } from 'antd/es/typography/Text';
3
+ export declare const Keyword: React.FC<TextProps & {
4
+ text: string;
5
+ keyword: string;
6
+ }>;