@bundle-stats/ui 4.16.0-beta.9 → 4.17.0-beta.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.
- package/lib/components/asset-info/asset-info.js +4 -4
- package/lib/components/asset-info/asset-info.js.map +1 -1
- package/lib/components/asset-meta-tag/asset-meta-tag.js +17 -0
- package/lib/components/asset-meta-tag/asset-meta-tag.js.map +1 -0
- package/lib/components/asset-meta-tag/asset-meta-tag.module.css +55 -0
- package/lib/components/asset-meta-tag/index.js +18 -0
- package/lib/components/asset-meta-tag/index.js.map +1 -0
- package/lib/components/asset-name/asset-name.js +32 -0
- package/lib/components/asset-name/asset-name.js.map +1 -0
- package/lib/components/asset-name/asset-name.module.css +32 -0
- package/lib/components/asset-name/index.js +18 -0
- package/lib/components/asset-name/index.js.map +1 -0
- package/lib/components/asset-not-predictive/asset-not-predictive.js +4 -2
- package/lib/components/asset-not-predictive/asset-not-predictive.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.js +7 -40
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.module.css +0 -64
- package/lib/components/bundle-assets/bundle-assets.utils.js +56 -28
- package/lib/components/bundle-assets/bundle-assets.utils.js.map +1 -1
- package/lib/components/bundle-assets/index.js +1 -1
- package/lib/components/bundle-assets/index.js.map +1 -1
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +4 -2
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +4 -2
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/entry-info/entry-info.js +1 -1
- package/lib/components/entry-info/entry-info.js.map +1 -1
- package/lib/components/metrics-table-export/metrics-table-export.js +12 -10
- package/lib/components/metrics-table-export/metrics-table-export.js.map +1 -1
- package/lib/components/metrics-table-options/metrics-table-options.js +7 -5
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-options/metrics-table-options.module.css +5 -0
- package/lib/components/metrics-treemap/metrics-treemap.utils.js +0 -1
- package/lib/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib/components/preview-source/preview-source.js +1 -1
- package/lib/components/preview-source/preview-source.js.map +1 -1
- package/lib/i18n.js +2 -0
- package/lib/i18n.js.map +1 -1
- package/lib/stories/wrapper.js +5 -2
- package/lib/stories/wrapper.js.map +1 -1
- package/lib/ui/tabs/index.js +15 -3
- package/lib/ui/tabs/index.js.map +1 -1
- package/lib/ui/tabs/tabs.js +9 -20
- package/lib/ui/tabs/tabs.js.map +1 -1
- package/lib/ui/tabs/tabs.module.css +6 -6
- package/lib/ui/tag/tag.js.map +1 -1
- package/lib-esm/components/asset-info/asset-info.js +4 -4
- package/lib-esm/components/asset-info/asset-info.js.map +1 -1
- package/lib-esm/components/asset-meta-tag/asset-meta-tag.js +10 -0
- package/lib-esm/components/asset-meta-tag/asset-meta-tag.js.map +1 -0
- package/lib-esm/components/asset-meta-tag/asset-meta-tag.module.css +55 -0
- package/lib-esm/components/asset-meta-tag/index.js +2 -0
- package/lib-esm/components/asset-meta-tag/index.js.map +1 -0
- package/lib-esm/components/asset-name/asset-name.js +25 -0
- package/lib-esm/components/asset-name/asset-name.js.map +1 -0
- package/lib-esm/components/asset-name/asset-name.module.css +32 -0
- package/lib-esm/components/asset-name/index.js +2 -0
- package/lib-esm/components/asset-name/index.js.map +1 -0
- package/lib-esm/components/asset-not-predictive/asset-not-predictive.js +4 -2
- package/lib-esm/components/asset-not-predictive/asset-not-predictive.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.js +8 -41
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -64
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js +52 -24
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js.map +1 -1
- package/lib-esm/components/bundle-assets/index.js +2 -2
- package/lib-esm/components/bundle-assets/index.js.map +1 -1
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +5 -3
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +5 -3
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +5 -3
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/entry-info/entry-info.js +1 -1
- package/lib-esm/components/entry-info/entry-info.js.map +1 -1
- package/lib-esm/components/metrics-table-export/metrics-table-export.js +13 -11
- package/lib-esm/components/metrics-table-export/metrics-table-export.js.map +1 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +7 -5
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.module.css +5 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js +0 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib-esm/components/preview-source/preview-source.js +1 -1
- package/lib-esm/components/preview-source/preview-source.js.map +1 -1
- package/lib-esm/i18n.js +2 -0
- package/lib-esm/i18n.js.map +1 -1
- package/lib-esm/stories/wrapper.js +5 -2
- package/lib-esm/stories/wrapper.js.map +1 -1
- package/lib-esm/ui/tabs/index.js +1 -1
- package/lib-esm/ui/tabs/index.js.map +1 -1
- package/lib-esm/ui/tabs/tabs.js +7 -19
- package/lib-esm/ui/tabs/tabs.js.map +1 -1
- package/lib-esm/ui/tabs/tabs.module.css +6 -6
- package/lib-esm/ui/tag/tag.js.map +1 -1
- package/package.json +12 -12
- package/src/app/app-gladys.stories.tsx +41 -0
- package/src/app/app-home-assistant.stories.tsx +41 -0
- package/src/app/app-outline.stories.tsx +41 -0
- package/src/app/app.stories.tsx +127 -0
- package/src/components/asset-info/asset-info.tsx +14 -7
- package/src/components/asset-meta-tag/asset-meta-tag.module.css +55 -0
- package/src/components/asset-meta-tag/asset-meta-tag.tsx +34 -0
- package/src/components/asset-meta-tag/index.ts +1 -0
- package/src/components/asset-name/asset-name.module.css +32 -0
- package/src/components/asset-name/asset-name.stories.tsx +85 -0
- package/src/components/asset-name/asset-name.tsx +60 -0
- package/src/components/asset-name/index.ts +1 -0
- package/src/components/asset-not-predictive/asset-not-predictive.tsx +10 -8
- package/src/components/bundle-assets/__tests__/add-metric-report-asset-row-data.ts +181 -0
- package/src/components/bundle-assets/__tests__/get-asset-meta-status.ts +21 -0
- package/src/components/bundle-assets/__tests__/get-is-not-predictive.ts +119 -0
- package/src/components/bundle-assets/bundle-assets.jsx +26 -87
- package/src/components/bundle-assets/bundle-assets.module.css +0 -64
- package/src/components/bundle-assets/bundle-assets.utils.js +87 -26
- package/src/components/bundle-assets/index.jsx +2 -7
- package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +11 -3
- package/src/components/bundle-modules/bundle-modules.tsx +11 -3
- package/src/components/bundle-packages/bundle-packages.jsx +11 -3
- package/src/components/entry-info/entry-info.tsx +1 -6
- package/src/components/metrics-table-export/metrics-table-export.tsx +28 -19
- package/src/components/metrics-table-options/metrics-table-options.module.css +5 -0
- package/src/components/metrics-table-options/metrics-table-options.tsx +14 -6
- package/src/components/metrics-treemap/metrics-treemap.utils.ts +0 -1
- package/src/components/preview-source/preview-source.stories.tsx +13 -1
- package/src/components/preview-source/preview-source.tsx +1 -1
- package/src/i18n.js +2 -0
- package/src/stories/wrapper.jsx +21 -15
- package/src/types.d.ts +30 -1
- package/src/ui/tabs/index.ts +1 -0
- package/src/ui/tabs/tabs.module.css +6 -6
- package/src/ui/tabs/tabs.stories.tsx +25 -0
- package/src/ui/tabs/tabs.tsx +32 -0
- package/src/ui/tag/tag.tsx +4 -3
- package/types/components/asset-meta-tag/asset-meta-tag.d.ts +8 -0
- package/types/components/asset-meta-tag/index.d.ts +1 -0
- package/types/components/asset-name/asset-name.d.ts +8 -0
- package/types/components/asset-name/index.d.ts +1 -0
- package/types/components/asset-not-predictive/asset-not-predictive.d.ts +4 -4
- package/types/components/bundle-assets/bundle-assets.utils.d.ts +3 -3
- package/types/components/metrics-table-export/metrics-table-export.d.ts +1 -0
- package/types/components/metrics-table-options/metrics-table-options.d.ts +1 -1
- package/types/i18n.d.ts +2 -0
- package/types/stories/wrapper.d.ts +1 -1
- package/types/ui/tabs/index.d.ts +1 -1
- package/types/ui/tabs/tabs.d.ts +11 -41
- package/types/ui/tag/tag.d.ts +4 -4
- package/src/ui/tabs/index.js +0 -1
- package/src/ui/tabs/tabs.jsx +0 -39
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { createJobs } from '@bundle-stats/utils';
|
|
4
|
+
|
|
5
|
+
/* eslint-disable import/no-unresolved, import/no-relative-packages */
|
|
6
|
+
import currentData from '../../../../fixtures/home-assistant/current.json';
|
|
7
|
+
import baselineData from '../../../../fixtures/home-assistant/baseline.json';
|
|
8
|
+
import { metaBaseline, metaCurrent } from '../../../../fixtures/meta';
|
|
9
|
+
/* eslint-enable import/no-unresolved, import/no-relative-packages */
|
|
10
|
+
import { App } from '.';
|
|
11
|
+
|
|
12
|
+
const CURRENT_SOURCE = {
|
|
13
|
+
...metaCurrent,
|
|
14
|
+
webpack: currentData,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const BASELINE_SOURCE = {
|
|
18
|
+
...metaBaseline,
|
|
19
|
+
webpack: baselineData,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const JOBS = createJobs([CURRENT_SOURCE, BASELINE_SOURCE]);
|
|
23
|
+
|
|
24
|
+
const meta: Meta<typeof App> = {
|
|
25
|
+
title: 'App/HomeAssistant',
|
|
26
|
+
component: App,
|
|
27
|
+
parameters: {
|
|
28
|
+
layout: 'fullscreen',
|
|
29
|
+
},
|
|
30
|
+
args: {
|
|
31
|
+
version: '1.0',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
render: (args) => <App jobs={JOBS} {...args} />,
|
|
41
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { createJobs } from '@bundle-stats/utils';
|
|
4
|
+
|
|
5
|
+
/* eslint-disable import/no-unresolved, import/no-relative-packages */
|
|
6
|
+
import currentData from '../../../../fixtures/outline/current.json';
|
|
7
|
+
import baselineData from '../../../../fixtures/outline/baseline.json';
|
|
8
|
+
import { metaBaseline, metaCurrent } from '../../../../fixtures/meta';
|
|
9
|
+
/* eslint-enable import/no-unresolved, import/no-relative-packages */
|
|
10
|
+
import { App } from '.';
|
|
11
|
+
|
|
12
|
+
const CURRENT_SOURCE = {
|
|
13
|
+
...metaCurrent,
|
|
14
|
+
webpack: currentData,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const BASELINE_SOURCE = {
|
|
18
|
+
...metaBaseline,
|
|
19
|
+
webpack: baselineData,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const JOBS = createJobs([CURRENT_SOURCE, BASELINE_SOURCE]);
|
|
23
|
+
|
|
24
|
+
const meta: Meta<typeof App> = {
|
|
25
|
+
title: 'App/Outline',
|
|
26
|
+
component: App,
|
|
27
|
+
parameters: {
|
|
28
|
+
layout: 'fullscreen',
|
|
29
|
+
},
|
|
30
|
+
args: {
|
|
31
|
+
version: '1.0',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
render: (args) => <App jobs={JOBS} {...args} />,
|
|
41
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { createJobs } from '@bundle-stats/utils';
|
|
4
|
+
import merge from 'lodash/merge';
|
|
5
|
+
|
|
6
|
+
/* eslint-disable import/no-unresolved, import/no-relative-packages */
|
|
7
|
+
import currentData from '../../../../fixtures/job.current';
|
|
8
|
+
import baselineData from '../../../../fixtures/job.baseline';
|
|
9
|
+
/* eslint-enable import/no-unresolved, import/no-relative-packages */
|
|
10
|
+
import { App } from '.';
|
|
11
|
+
|
|
12
|
+
const CURRENT_SOURCE = {
|
|
13
|
+
webpack: {
|
|
14
|
+
...currentData.rawData.webpack,
|
|
15
|
+
builtAt: currentData.createdAt,
|
|
16
|
+
hash: currentData.commit,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const BASELINE_SOURCE = {
|
|
21
|
+
webpack: {
|
|
22
|
+
...baselineData.rawData.webpack,
|
|
23
|
+
builtAt: baselineData.createdAt,
|
|
24
|
+
hash: baselineData.commit,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const JOBS = createJobs([CURRENT_SOURCE, BASELINE_SOURCE]);
|
|
29
|
+
|
|
30
|
+
const MULTIPLE_JOBS = createJobs([
|
|
31
|
+
CURRENT_SOURCE,
|
|
32
|
+
BASELINE_SOURCE,
|
|
33
|
+
{
|
|
34
|
+
webpack: {
|
|
35
|
+
...baselineData.rawData.webpack,
|
|
36
|
+
builtAt: baselineData.createdAt,
|
|
37
|
+
hash: 'aaaa1111',
|
|
38
|
+
assets: baselineData.rawData.webpack.assets.filter((asset) => asset.name.match(/.(css|js)$/)),
|
|
39
|
+
modules: baselineData.rawData.webpack.modules.slice(0, 100),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
const [CURRENT_JOB, BASELINE_JOB] = JOBS;
|
|
45
|
+
|
|
46
|
+
const meta: Meta<typeof App> = {
|
|
47
|
+
title: 'App',
|
|
48
|
+
component: App,
|
|
49
|
+
parameters: {
|
|
50
|
+
layout: 'fullscreen',
|
|
51
|
+
},
|
|
52
|
+
args: {
|
|
53
|
+
version: '1.0',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default meta;
|
|
58
|
+
|
|
59
|
+
type Story = StoryObj<typeof meta>;
|
|
60
|
+
|
|
61
|
+
export const Default: Story = {
|
|
62
|
+
render: (args) => <App jobs={JOBS} {...args} />,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const NoInsights: Story = {
|
|
66
|
+
render: (args) => (
|
|
67
|
+
<App
|
|
68
|
+
jobs={[
|
|
69
|
+
{
|
|
70
|
+
...CURRENT_JOB,
|
|
71
|
+
insights: undefined,
|
|
72
|
+
},
|
|
73
|
+
BASELINE_JOB,
|
|
74
|
+
]}
|
|
75
|
+
{...args}
|
|
76
|
+
/>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const AssetMetaChanges: Story = {
|
|
81
|
+
render: (args) => {
|
|
82
|
+
const current = merge({}, CURRENT_SOURCE);
|
|
83
|
+
const baseline = merge({}, CURRENT_SOURCE);
|
|
84
|
+
|
|
85
|
+
current.webpack.assets.push({
|
|
86
|
+
name: 'assets/js/vendors-auth.1a278dc.js',
|
|
87
|
+
size: 26364,
|
|
88
|
+
});
|
|
89
|
+
current.webpack.chunks.push({
|
|
90
|
+
id: 100,
|
|
91
|
+
entry: false,
|
|
92
|
+
initial: false,
|
|
93
|
+
files: ['assets/js/vendors-auth.1a278dc.js'],
|
|
94
|
+
names: ['vendors-auth'],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
baseline.webpack.assets.push({
|
|
98
|
+
name: 'assets/js/vendors-auth.1a278dc.js',
|
|
99
|
+
size: 26364,
|
|
100
|
+
});
|
|
101
|
+
baseline.webpack.chunks.push({
|
|
102
|
+
id: 100,
|
|
103
|
+
entry: false,
|
|
104
|
+
initial: true,
|
|
105
|
+
files: ['assets/js/vendors-auth.1a278dc.js'],
|
|
106
|
+
names: ['vendors-auth'],
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return <App jobs={createJobs([current, baseline])} {...args} />;
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const NoBaseline: Story = {
|
|
114
|
+
render: (args) => <App jobs={createJobs[CURRENT_SOURCE]} {...args} />,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const EmptyBaseline: Story = {
|
|
118
|
+
render: (args) => <App jobs={createJobs([CURRENT_SOURCE, { webpack: null }])} {...args} />,
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const MultipleBaselines: Story = {
|
|
122
|
+
render: (args) => <App jobs={MULTIPLE_JOBS} {...args} />,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const Empty: Story = {
|
|
126
|
+
render: (args) => <App {...args} />,
|
|
127
|
+
};
|
|
@@ -13,6 +13,7 @@ import { Asset, MetaChunk } from '@bundle-stats/utils/types/webpack';
|
|
|
13
13
|
|
|
14
14
|
import { FlexStack } from '../../layout/flex-stack';
|
|
15
15
|
import { Tag } from '../../ui/tag';
|
|
16
|
+
import { AssetMetaTag } from '../asset-meta-tag';
|
|
16
17
|
import { ComponentLink } from '../component-link';
|
|
17
18
|
import { EntryInfo, EntryInfoMetaLink } from '../entry-info';
|
|
18
19
|
import css from './asset-info.module.css';
|
|
@@ -89,34 +90,40 @@ export const AssetInfo = (props: AssetInfoProps & React.ComponentProps<'div'>) =
|
|
|
89
90
|
return (
|
|
90
91
|
<FlexStack space="xxxsmall" alignItems="center" className={css.tags}>
|
|
91
92
|
{item.isEntry && (
|
|
92
|
-
<
|
|
93
|
+
<AssetMetaTag
|
|
93
94
|
as={CustomComponentLink}
|
|
94
95
|
{...getBundleAssetsByEntryType('entry')}
|
|
95
96
|
onClick={onClick}
|
|
96
|
-
|
|
97
|
+
tag="entry"
|
|
98
|
+
status={item.isEntry}
|
|
99
|
+
className={css.assetNameTag}
|
|
97
100
|
>
|
|
98
101
|
Entrypoint
|
|
99
|
-
</
|
|
102
|
+
</AssetMetaTag>
|
|
100
103
|
)}
|
|
101
104
|
{item.isInitial && (
|
|
102
|
-
<
|
|
105
|
+
<AssetMetaTag
|
|
103
106
|
as={CustomComponentLink}
|
|
104
107
|
{...getBundleAssetsByEntryType('initial')}
|
|
105
108
|
onClick={onClick}
|
|
109
|
+
tag="initial"
|
|
110
|
+
status={item.isInitial}
|
|
106
111
|
className={cx(css.assetNameTag, css.assetNameTagInitial)}
|
|
107
112
|
>
|
|
108
113
|
Initial
|
|
109
|
-
</
|
|
114
|
+
</AssetMetaTag>
|
|
110
115
|
)}
|
|
111
116
|
{item.isChunk && (
|
|
112
|
-
<
|
|
117
|
+
<AssetMetaTag
|
|
113
118
|
as={CustomComponentLink}
|
|
114
119
|
{...getBundleAssetsByEntryType('chunk')}
|
|
115
120
|
onClick={onClick}
|
|
121
|
+
tag="chunk"
|
|
122
|
+
status={item.isChunk}
|
|
116
123
|
className={cx(css.assetNameTag, css.assetNameTagChunk)}
|
|
117
124
|
>
|
|
118
125
|
Chunk
|
|
119
|
-
</
|
|
126
|
+
</AssetMetaTag>
|
|
120
127
|
)}
|
|
121
128
|
</FlexStack>
|
|
122
129
|
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
--background-color: var(--color-info);
|
|
3
|
+
background: var(--background-color);
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
position: relative;
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.root::before {
|
|
10
|
+
display: block;
|
|
11
|
+
content: ' ';
|
|
12
|
+
padding: 2px;
|
|
13
|
+
position: absolute;
|
|
14
|
+
left: 0;
|
|
15
|
+
top: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
font-size: 8px;
|
|
19
|
+
line-height: 1;
|
|
20
|
+
vertical-align: middle;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.added {
|
|
24
|
+
background: linear-gradient(-45deg, var(--color-danger) 50%, var(--background-color) 50%);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.removed {
|
|
28
|
+
background: linear-gradient(135deg, var(--color-danger) 50%, var(--background-color) 50%);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* tag */
|
|
32
|
+
.entry {
|
|
33
|
+
--background-color: var(--color-info-dark);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.entry:empty::before {
|
|
37
|
+
content: 'e';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.initial {
|
|
41
|
+
--background-color: var(--color-info);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.initial:empty::before {
|
|
45
|
+
content: 'i';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.chunk {
|
|
49
|
+
--background-color: var(--color-info-light);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.chunk:empty::before {
|
|
53
|
+
content: 'c';
|
|
54
|
+
}
|
|
55
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
import type { TagProps } from '../../ui/tag';
|
|
5
|
+
import { Tag } from '../../ui/tag';
|
|
6
|
+
import css from './asset-meta-tag.module.css';
|
|
7
|
+
import type { ReportMetricAssetRowMetaStatus } from '../../types';
|
|
8
|
+
|
|
9
|
+
export type AssetMetaTagProps = {
|
|
10
|
+
tag: 'entry' | 'initial' | 'chunk';
|
|
11
|
+
status: ReportMetricAssetRowMetaStatus | boolean;
|
|
12
|
+
} & TagProps;
|
|
13
|
+
|
|
14
|
+
export const AssetMetaTag = (props: AssetMetaTagProps) => {
|
|
15
|
+
const { className = '', title, tag, status, ...restProps } = props;
|
|
16
|
+
|
|
17
|
+
const rootClassName = cx(
|
|
18
|
+
css.root,
|
|
19
|
+
status === 'added' && css.added,
|
|
20
|
+
status === 'removed' && css.removed,
|
|
21
|
+
css[tag],
|
|
22
|
+
className,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Tag
|
|
27
|
+
className={rootClassName}
|
|
28
|
+
title={title}
|
|
29
|
+
size={Tag.SIZES.SMALL}
|
|
30
|
+
kind={Tag.KINDS.INFO}
|
|
31
|
+
{...restProps}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './asset-meta-tag';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.root {}
|
|
2
|
+
|
|
3
|
+
.notPredictive {
|
|
4
|
+
margin-right: var(--space-xxsmall);
|
|
5
|
+
display: inline-block;
|
|
6
|
+
width: var(--space-small);
|
|
7
|
+
height: var(--space-small);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.notPredictiveAnchor {}
|
|
11
|
+
|
|
12
|
+
.notPredictiveIcon {
|
|
13
|
+
color: var(--color-warning-dark);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.metaTags {
|
|
17
|
+
display: inline;
|
|
18
|
+
margin-right: var(--space-xxxsmall);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.metaTag + .metaTag {
|
|
22
|
+
margin-left: calc(var(--space-xxxsmall) / 2);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.metaTags:empty {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.nameText {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
vertical-align: middle;
|
|
32
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { AssetName } from '.';
|
|
4
|
+
|
|
5
|
+
const ROW = {
|
|
6
|
+
key: 'asset/main.js',
|
|
7
|
+
label: 'asset/main.js',
|
|
8
|
+
changed: true,
|
|
9
|
+
isEntry: false,
|
|
10
|
+
isChunk: false,
|
|
11
|
+
isInitial: false,
|
|
12
|
+
isAsset: true,
|
|
13
|
+
isNotPredictive: false,
|
|
14
|
+
fileType: 'JS',
|
|
15
|
+
biggerIsBetter: false,
|
|
16
|
+
runs: [
|
|
17
|
+
{ name: 'asset/main.abcd1234.js', value: 1024 * 10 },
|
|
18
|
+
{ name: 'asset/main.abcd1234.js', value: 1024 * 11 },
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const meta = {
|
|
23
|
+
title: 'Components/AssetName',
|
|
24
|
+
component: AssetName,
|
|
25
|
+
args: {
|
|
26
|
+
customComponentLink: 'span',
|
|
27
|
+
filters: {},
|
|
28
|
+
search: '',
|
|
29
|
+
},
|
|
30
|
+
} as Meta<typeof AssetName>;
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
row: ROW,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const MetaDefault: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
row: {
|
|
45
|
+
...ROW,
|
|
46
|
+
isEntry: true,
|
|
47
|
+
isChunk: true,
|
|
48
|
+
isInitial: true,
|
|
49
|
+
isAsset: false,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const MetaAdded: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
row: {
|
|
57
|
+
...ROW,
|
|
58
|
+
isEntry: 'added',
|
|
59
|
+
isChunk: 'added',
|
|
60
|
+
isInitial: 'added',
|
|
61
|
+
isAsset: false,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const MetaRemoved: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
row: {
|
|
69
|
+
...ROW,
|
|
70
|
+
isEntry: 'removed',
|
|
71
|
+
isChunk: 'removed',
|
|
72
|
+
isInitial: 'removed',
|
|
73
|
+
isAsset: false,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const NotPredictive: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
row: {
|
|
81
|
+
...ROW,
|
|
82
|
+
isNotPredictive: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Icon } from '../../ui/icon';
|
|
5
|
+
import { FileName } from '../../ui/file-name';
|
|
6
|
+
import { HoverCard } from '../../ui/hover-card';
|
|
7
|
+
import { AssetNotPredictive } from '../asset-not-predictive';
|
|
8
|
+
|
|
9
|
+
import { ReportMetricAssetRow } from '../../types';
|
|
10
|
+
import { AssetMetaTag } from '../asset-meta-tag';
|
|
11
|
+
import css from './asset-name.module.css';
|
|
12
|
+
|
|
13
|
+
const RUN_TITLE_CURRENT = 'Current';
|
|
14
|
+
const RUN_TITLE_BASELINE = 'Baseline';
|
|
15
|
+
const RUNS_LABELS = [RUN_TITLE_CURRENT, RUN_TITLE_BASELINE];
|
|
16
|
+
|
|
17
|
+
export type AssetNameProps = {
|
|
18
|
+
className?: string;
|
|
19
|
+
row: ReportMetricAssetRow;
|
|
20
|
+
customComponentLink: ElementType;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const AssetName = (props: AssetNameProps) => {
|
|
24
|
+
const { className = '', customComponentLink: CustomComponentLink, row } = props;
|
|
25
|
+
const { label, isNotPredictive, runs, isChunk, isEntry, isInitial } = row;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<span className={cx(css.root, className)}>
|
|
29
|
+
{isNotPredictive && (
|
|
30
|
+
<HoverCard
|
|
31
|
+
label={<Icon className={css.notPredictiveIcon} glyph={Icon.ICONS.WARNING} />}
|
|
32
|
+
className={css.notPredictive}
|
|
33
|
+
anchorClassName={css.notPredictiveAnchor}
|
|
34
|
+
>
|
|
35
|
+
<AssetNotPredictive runs={runs} labels={RUNS_LABELS} />
|
|
36
|
+
</HoverCard>
|
|
37
|
+
)}
|
|
38
|
+
|
|
39
|
+
<CustomComponentLink entryId={row.key} className={css.name}>
|
|
40
|
+
<span className={css.metaTags}>
|
|
41
|
+
{isEntry && (
|
|
42
|
+
<AssetMetaTag className={css.metaTag} title="Entrypoint" tag="entry" status={isEntry} />
|
|
43
|
+
)}
|
|
44
|
+
{isInitial && (
|
|
45
|
+
<AssetMetaTag
|
|
46
|
+
className={css.metaTag}
|
|
47
|
+
title="Initial"
|
|
48
|
+
tag="initial"
|
|
49
|
+
status={isInitial}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
{isChunk && (
|
|
53
|
+
<AssetMetaTag className={css.metaTag} title="Chunk" tag="chunk" status={isChunk} />
|
|
54
|
+
)}
|
|
55
|
+
</span>
|
|
56
|
+
<FileName className={css.nameText} name={label} />
|
|
57
|
+
</CustomComponentLink>
|
|
58
|
+
</span>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './asset-name';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import cx from 'classnames';
|
|
3
4
|
import type { Asset } from '@bundle-stats/utils/types/webpack';
|
|
@@ -6,19 +7,20 @@ import { Stack } from '../../layout/stack';
|
|
|
6
7
|
import { Table } from '../../ui/table';
|
|
7
8
|
import css from './asset-not-predictive.module.css';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export type AssetNotPredictiveProps = {
|
|
10
11
|
runs?: Array<Asset>;
|
|
11
|
-
labels?: Array<string
|
|
12
|
-
}
|
|
12
|
+
labels?: Array<string>;
|
|
13
|
+
} & ComponentProps<'div'>;
|
|
13
14
|
|
|
14
|
-
export const AssetNotPredictive = (props: AssetNotPredictiveProps
|
|
15
|
+
export const AssetNotPredictive = (props: AssetNotPredictiveProps) => {
|
|
15
16
|
const { className = '', runs = null, labels = null, ...restProps } = props;
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
|
-
<Stack space="
|
|
19
|
-
<
|
|
20
|
-
Asset
|
|
21
|
-
|
|
19
|
+
<Stack space="small" {...restProps} className={cx(css.root, className)}>
|
|
20
|
+
<Stack space="xxxsmall">
|
|
21
|
+
<h3>Asset hash is not predictive</h3>
|
|
22
|
+
<p className={css.text}>File names are equal, but the size is different.</p>
|
|
23
|
+
</Stack>
|
|
22
24
|
{runs && (
|
|
23
25
|
<Table outline compact>
|
|
24
26
|
<Table.THead>
|