@bundle-stats/ui 4.13.0-rc.0 → 4.13.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/bundle-assets/bundle-assets.js +24 -22
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/index.js +3 -1
- package/lib/components/bundle-assets/index.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +11 -6
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.utils.js +2 -13
- package/lib/components/bundle-modules/bundle-modules.utils.js.map +1 -1
- package/lib/components/bundle-modules/index.js +2 -1
- package/lib/components/bundle-modules/index.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +12 -6
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.constants.js +7 -0
- package/lib/components/metrics-treemap/metrics-treemap.constants.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.js +69 -71
- package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.module.css +58 -26
- package/lib/components/metrics-treemap/metrics-treemap.utils.js +60 -1
- package/lib/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib/utils/colors.js +22 -0
- package/lib/utils/colors.js.map +1 -0
- package/lib/{utils.js → utils/components.js} +2 -17
- package/lib/utils/components.js.map +1 -0
- package/lib/utils/index.js +20 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/jobs.js +18 -0
- package/lib/utils/jobs.js.map +1 -0
- package/lib-esm/components/bundle-assets/bundle-assets.js +24 -23
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/index.js +3 -1
- package/lib-esm/components/bundle-assets/index.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +11 -6
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +1 -11
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js.map +1 -1
- package/lib-esm/components/bundle-modules/index.js +3 -2
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +12 -6
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js +6 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.js +65 -68
- package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +58 -26
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js +57 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib-esm/utils/colors.js +15 -0
- package/lib-esm/utils/colors.js.map +1 -0
- package/lib-esm/utils/components.js +16 -0
- package/lib-esm/utils/components.js.map +1 -0
- package/lib-esm/utils/index.js +4 -0
- package/lib-esm/utils/index.js.map +1 -0
- package/lib-esm/utils/jobs.js +11 -0
- package/lib-esm/utils/jobs.js.map +1 -0
- package/package.json +3 -3
- package/src/components/bundle-assets/bundle-assets.jsx +74 -48
- package/src/components/bundle-assets/index.jsx +4 -0
- package/src/components/bundle-modules/bundle-modules.tsx +33 -11
- package/src/components/bundle-modules/bundle-modules.types.d.ts +2 -17
- package/src/components/bundle-modules/bundle-modules.utils.ts +7 -18
- package/src/components/bundle-modules/index.tsx +4 -3
- package/src/components/bundle-packages/bundle-packages.jsx +21 -7
- package/src/components/metrics-treemap/metrics-treemap.constants.ts +11 -0
- package/src/components/metrics-treemap/metrics-treemap.module.css +58 -26
- package/src/components/metrics-treemap/metrics-treemap.tsx +173 -110
- package/src/components/metrics-treemap/metrics-treemap.utils.ts +107 -1
- package/src/utils/colors.ts +19 -0
- package/src/utils/components.tsx +19 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/jobs.ts +22 -0
- package/types/components/bundle-assets/bundle-assets.d.ts +1 -5
- package/types/components/bundle-modules/bundle-modules.d.ts +4 -2
- package/types/components/bundle-modules/bundle-modules.utils.d.ts +3 -7
- package/types/components/bundle-modules/index.d.ts +2 -2
- package/types/components/metrics-treemap/metrics-treemap.constants.d.ts +8 -0
- package/types/components/metrics-treemap/metrics-treemap.d.ts +1 -1
- package/types/components/metrics-treemap/metrics-treemap.utils.d.ts +11 -1
- package/types/utils/colors.d.ts +1 -0
- package/types/utils/components.d.ts +2 -0
- package/types/utils/index.d.ts +3 -0
- package/types/utils/jobs.d.ts +7 -0
- package/lib/utils.js.map +0 -1
- package/lib-esm/utils.js +0 -30
- package/lib-esm/utils.js.map +0 -1
- package/src/utils.jsx +0 -38
- package/types/utils.d.ts +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import uniqBy from 'lodash/uniqBy';
|
|
2
|
+
|
|
3
|
+
import type { Job, WebpackChunk } from '@bundle-stats/utils';
|
|
4
|
+
|
|
5
|
+
interface GetJobsChunksData {
|
|
6
|
+
chunks: Array<WebpackChunk>;
|
|
7
|
+
chunkIds: Array<string>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get chunks data from all jobs
|
|
12
|
+
*/
|
|
13
|
+
export function getJobsChunksData(jobs: Array<Job>): GetJobsChunksData {
|
|
14
|
+
const jobChunks = jobs.map((job) => job?.meta?.webpack?.chunks || []);
|
|
15
|
+
const chunks = uniqBy(jobChunks.flat(), ({ id }) => id);
|
|
16
|
+
const chunkIds = chunks?.map(({ id }) => id);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
chunks,
|
|
20
|
+
chunkIds,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -13,12 +13,8 @@ export namespace BundleAssets {
|
|
|
13
13
|
export let jobs: PropTypes.Validator<(PropTypes.InferProps<{
|
|
14
14
|
internalBuildNumber: PropTypes.Requireable<number>;
|
|
15
15
|
label: PropTypes.Requireable<string>;
|
|
16
|
-
meta: PropTypes.Requireable<PropTypes.InferProps<{
|
|
17
|
-
webpack: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
|
-
chunks: PropTypes.Requireable<any[]>;
|
|
19
|
-
}>>;
|
|
20
|
-
}>>;
|
|
21
16
|
}> | null | undefined)[]>;
|
|
17
|
+
export let chunks: PropTypes.Validator<any[]>;
|
|
22
18
|
export let items: PropTypes.Validator<(PropTypes.InferProps<{
|
|
23
19
|
key: PropTypes.Requireable<string>;
|
|
24
20
|
label: PropTypes.Requireable<string>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type Job } from '@bundle-stats/utils';
|
|
3
|
+
import { WebpackChunk } from '@bundle-stats/utils';
|
|
2
4
|
import { SortAction } from '../../types';
|
|
3
5
|
import { ModuleMetric } from './bundle-modules.constants';
|
|
4
|
-
import type {
|
|
6
|
+
import type { ReportMetricModuleRow } from './bundle-modules.types';
|
|
5
7
|
interface BundleModulesProps extends React.ComponentProps<'div'> {
|
|
6
8
|
jobs?: Array<Job>;
|
|
7
9
|
items?: Array<ReportMetricModuleRow>;
|
|
8
10
|
allItems?: Array<ReportMetricModuleRow>;
|
|
9
|
-
chunks?: Array<
|
|
11
|
+
chunks?: Array<WebpackChunk>;
|
|
10
12
|
totalRowCount: number;
|
|
11
13
|
updateFilters: () => void;
|
|
12
14
|
resetFilters: () => void;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WebpackChunk, type ReportMetricRow } from '@bundle-stats/utils';
|
|
2
2
|
import { type Module } from '@bundle-stats/utils/lib-esm/webpack';
|
|
3
3
|
import type { FilterFieldsData } from '../../types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ReportMetricModuleRow } from './bundle-modules.types';
|
|
5
5
|
export declare const addRowFlags: (row: Module & ReportMetricRow) => ReportMetricModuleRow;
|
|
6
6
|
export declare const getCustomSort: (item: ReportMetricRow) => (string | boolean)[];
|
|
7
7
|
export declare const generateGetRowFilter: ({ chunkIds }: {
|
|
8
8
|
chunkIds: Array<string>;
|
|
9
9
|
}) => (filters: Record<string, unknown>) => (row: ReportMetricModuleRow) => boolean;
|
|
10
|
-
export declare const extractChunkData: (jobs: Array<Job>) => {
|
|
11
|
-
chunks: Chunk[];
|
|
12
|
-
chunkIds: string[];
|
|
13
|
-
};
|
|
14
10
|
export declare const generateFilters: (chunkIds: Array<string>, multipleJobs: boolean) => {
|
|
15
11
|
defaultFilters: {
|
|
16
12
|
[x: string]: boolean;
|
|
@@ -21,7 +17,7 @@ export declare const generateFilters: (chunkIds: Array<string>, multipleJobs: bo
|
|
|
21
17
|
};
|
|
22
18
|
interface GetFiltersFormDataParams {
|
|
23
19
|
filters: Record<string, boolean>;
|
|
24
|
-
chunks: Array<
|
|
20
|
+
chunks: Array<WebpackChunk>;
|
|
25
21
|
compareMode: boolean;
|
|
26
22
|
}
|
|
27
23
|
export declare const generateFilterFieldsData: (params: GetFiltersFormDataParams) => FilterFieldsData;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Job } from '@bundle-stats/utils';
|
|
2
3
|
import type { SortAction } from '../../types';
|
|
3
4
|
import { BundleModules as BaseComponent } from './bundle-modules';
|
|
4
|
-
import * as types from './bundle-modules.types';
|
|
5
5
|
interface BundleModulesProps extends Omit<React.ComponentProps<typeof BaseComponent>, 'jobs' | 'items' | 'chunks' | 'updateFilters' | 'resetFilters' | 'resetAllFilters' | 'filters' | 'sort' | 'updateSort' | 'search' | 'updateSearch' | 'allItems' | 'totalRowCount' | 'hideEntryInfo' | 'showEntryInfo'> {
|
|
6
|
-
jobs: Array<
|
|
6
|
+
jobs: Array<Job>;
|
|
7
7
|
filters: Record<string, boolean>;
|
|
8
8
|
search?: string;
|
|
9
9
|
metric?: string;
|
|
@@ -18,3 +18,11 @@ export interface Tree {
|
|
|
18
18
|
}
|
|
19
19
|
export type TreeNode = Tree | TreeLeaf;
|
|
20
20
|
export type TreeNodeChildren = Array<TreeNode>;
|
|
21
|
+
export type TileGroupSizeDisplay = 'minimal' | 'small' | 'default';
|
|
22
|
+
export type TileSizeDisplay = 'minimal' | 'small' | 'default';
|
|
23
|
+
export declare const SQUARIFY_RATIO = 1.66;
|
|
24
|
+
export declare const PADDING_OUTER = 1;
|
|
25
|
+
export declare const PADDING_INNER = 2;
|
|
26
|
+
export declare const NESTED_PADDING = 4;
|
|
27
|
+
export declare const NESTED_PADDING_TOP: number;
|
|
28
|
+
export declare const NESTED_PADDING_LEFT = 8;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
1
2
|
import { DeltaType, type MetricRunInfoBaseline, type MetricRunInfo, type ReportMetricRow } from '@bundle-stats/utils';
|
|
2
|
-
import type
|
|
3
|
+
import { type Tree, type TileSizeDisplay, type TileGroupSizeDisplay } from './metrics-treemap.constants';
|
|
3
4
|
export declare function getTreemapNodes(items: Array<ReportMetricRow>): Tree;
|
|
4
5
|
export declare function getTreemapNodesGroupedByPath(items: Array<ReportMetricRow>): Tree;
|
|
5
6
|
export declare function resolveGroupDeltaType(metricRunInfo?: MetricRunInfo | MetricRunInfoBaseline): DeltaType.NO_CHANGE | DeltaType.NEGATIVE | DeltaType.POSITIVE;
|
|
7
|
+
export declare function resolveTileGroupSizeDisplay(width: number, height: number): TileGroupSizeDisplay;
|
|
8
|
+
export declare function resolveTileSizeDisplay(width: number, height: number): TileSizeDisplay;
|
|
9
|
+
interface UseTooltipStateWithMouseFollowOptions {
|
|
10
|
+
parentRef: RefObject<Element>;
|
|
11
|
+
gutter?: number;
|
|
12
|
+
timeout?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function useTooltipStateWithMouseFollow(options: UseTooltipStateWithMouseFollowOptions): import("ariakit/tooltip").TooltipState;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getColors(count?: number): string[];
|
package/lib/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.jsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yDAAiC;AACjC,4DAA4B;AAE5B,4EAAyC;AAElC,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,EAAE;IACrC,MAAM,MAAM,GAAG,IAAA,eAAK,EAAC,2BAAM,EAAE,IAAI,CAAC,KAAK,CAAC,2BAAM,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;IAEhE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;QACvC,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;SACvB;QAED,IAAI,KAAK,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/B,OAAO,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC5C;QAED,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,SAAS,aAcpB;AAEK,MAAM,2BAA2B,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE;IAClE,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAExB,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,uCAAK,SAAS,EAAE,SAAS,IAAG,KAAK,CAAO,CAAC;KACjD;IAED,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE;QAC/B,GAAG,KAAK;QACR,SAAS,EAAE,IAAA,oBAAE,EAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,2BAA2B,+BAetC"}
|
package/lib-esm/utils.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import chunk from 'lodash/chunk';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import COLORS from './chart-colors.json';
|
|
5
|
-
export const getColors = (count = 2) => {
|
|
6
|
-
const chunks = chunk(COLORS, Math.round(COLORS.length / count));
|
|
7
|
-
return chunks.map((chunkColors, index) => {
|
|
8
|
-
if (index === 0) {
|
|
9
|
-
return chunkColors[0];
|
|
10
|
-
}
|
|
11
|
-
if (index === chunks.length - 1) {
|
|
12
|
-
return chunkColors[chunkColors.length - 1];
|
|
13
|
-
}
|
|
14
|
-
return chunkColors[Math.floor(chunkColors.length / 2)];
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
export const getRenderChildWithClassName = (className) => (child) => {
|
|
18
|
-
if (child === null || child === '') {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
const { props } = child;
|
|
22
|
-
if (!props) {
|
|
23
|
-
return React.createElement("div", { className: className }, child);
|
|
24
|
-
}
|
|
25
|
-
return React.cloneElement(child, {
|
|
26
|
-
...props,
|
|
27
|
-
className: cx(className, props.className),
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=utils.js.map
|
package/lib-esm/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC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|
|
4
|
-
|
|
5
|
-
import COLORS from './chart-colors.json';
|
|
6
|
-
|
|
7
|
-
export const getColors = (count = 2) => {
|
|
8
|
-
const chunks = chunk(COLORS, Math.round(COLORS.length / count));
|
|
9
|
-
|
|
10
|
-
return chunks.map((chunkColors, index) => {
|
|
11
|
-
if (index === 0) {
|
|
12
|
-
return chunkColors[0];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (index === chunks.length - 1) {
|
|
16
|
-
return chunkColors[chunkColors.length - 1];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return chunkColors[Math.floor(chunkColors.length / 2)];
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const getRenderChildWithClassName = (className) => (child) => {
|
|
24
|
-
if (child === null || child === '') {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const { props } = child;
|
|
29
|
-
|
|
30
|
-
if (!props) {
|
|
31
|
-
return <div className={className}>{child}</div>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return React.cloneElement(child, {
|
|
35
|
-
...props,
|
|
36
|
-
className: cx(className, props.className), // eslint-disable-line react/prop-types
|
|
37
|
-
});
|
|
38
|
-
};
|
package/types/utils.d.ts
DELETED