@bundle-stats/utils 4.3.0-beta.3 → 4.3.0-rc.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.
Files changed (56) hide show
  1. package/lib/config/metrics.js.map +1 -1
  2. package/lib/i18n.js +3 -0
  3. package/lib/i18n.js.map +1 -1
  4. package/lib/utils/component-links.js +30 -3
  5. package/lib/utils/component-links.js.map +1 -1
  6. package/lib/utils/index.js +1 -0
  7. package/lib/utils/index.js.map +1 -1
  8. package/lib/utils/insights.js +54 -0
  9. package/lib/utils/insights.js.map +1 -0
  10. package/lib/webpack/extract/modules-packages-duplicate.js +21 -9
  11. package/lib/webpack/extract/modules-packages-duplicate.js.map +1 -1
  12. package/lib/webpack/extract/modules.js +45 -20
  13. package/lib/webpack/extract/modules.js.map +1 -1
  14. package/lib/webpack/metrics.js +5 -5
  15. package/lib/webpack/metrics.js.map +1 -1
  16. package/lib-esm/config/metrics.js +1 -1
  17. package/lib-esm/config/metrics.js.map +1 -1
  18. package/lib-esm/i18n.js +3 -0
  19. package/lib-esm/i18n.js.map +1 -1
  20. package/lib-esm/utils/component-links.js +28 -2
  21. package/lib-esm/utils/component-links.js.map +1 -1
  22. package/lib-esm/utils/index.js +1 -0
  23. package/lib-esm/utils/index.js.map +1 -1
  24. package/lib-esm/utils/insights.js +47 -0
  25. package/lib-esm/utils/insights.js.map +1 -0
  26. package/lib-esm/webpack/extract/modules-packages-duplicate.js +21 -9
  27. package/lib-esm/webpack/extract/modules-packages-duplicate.js.map +1 -1
  28. package/lib-esm/webpack/extract/modules.js +45 -20
  29. package/lib-esm/webpack/extract/modules.js.map +1 -1
  30. package/lib-esm/webpack/metrics.js +5 -5
  31. package/lib-esm/webpack/metrics.js.map +1 -1
  32. package/package.json +13 -13
  33. package/src/config/metrics.js +2 -6
  34. package/src/constants.ts +5 -0
  35. package/src/i18n.js +3 -0
  36. package/src/utils/component-links.ts +33 -2
  37. package/src/utils/index.js +1 -0
  38. package/src/utils/insights.ts +82 -0
  39. package/src/webpack/extract/modules-packages-duplicate.ts +31 -16
  40. package/src/webpack/extract/modules.ts +61 -31
  41. package/src/webpack/metrics.js +5 -5
  42. package/src/webpack/types.ts +2 -2
  43. package/types/browsertime/metrics.d.ts +1 -1
  44. package/types/config/metrics.d.ts +1 -30
  45. package/types/constants.d.ts +4 -0
  46. package/types/i18n.d.ts +3 -0
  47. package/types/lighthouse/metrics.d.ts +4 -4
  48. package/types/utils/component-links.d.ts +3 -1
  49. package/types/utils/index.d.ts +1 -0
  50. package/types/utils/insights.d.ts +9 -0
  51. package/types/webpack/constants.d.ts +1 -1
  52. package/types/webpack/extract/assets-size-total-insight.d.ts +1 -1
  53. package/types/webpack/extract/modules-packages-duplicate.d.ts +3 -3
  54. package/types/webpack/metrics.d.ts +3 -3
  55. package/types/webpack/types.d.ts +2 -2
  56. package/tsconfig.lib.json +0 -7
@@ -1,3 +1,4 @@
1
+ import isEmpty from 'lodash/isEmpty';
1
2
  import map from 'lodash/map';
2
3
  import orderBy from 'lodash/orderBy';
3
4
  import sum from 'lodash/sum';
@@ -25,9 +26,9 @@ interface DuplicatePackageGroup {
25
26
  }
26
27
 
27
28
  interface ModulesPackagesDuplicateData {
28
- insights: {
29
+ insights?: {
29
30
  duplicatePackages?: JobInsights['webpack']['duplicatePackages'];
30
- duplicatePackagesV3: JobInsights['webpack']['duplicatePackagesV3'];
31
+ duplicatePackagesV3?: JobInsights['webpack']['duplicatePackagesV3'];
31
32
  };
32
33
  metrics: {
33
34
  duplicatePackagesCount: MetricRun;
@@ -37,7 +38,7 @@ interface ModulesPackagesDuplicateData {
37
38
  export const getDuplicatePackagesInsight = (
38
39
  duplicatePackagesMap: Record<string, Array<string>>,
39
40
  baselineDuplicatePackagesMap?: Record<string, Array<string>>,
40
- ): JobInsight<JobInsightDuplicatePackagesV3Data> => {
41
+ ): JobInsight<JobInsightDuplicatePackagesV3Data> | null => {
41
42
  const duplicateInstances: Array<string> = [];
42
43
  const baselineDuplicateInstances: Array<string> = [];
43
44
  const newDuplicateInstances: Array<string> = [];
@@ -81,8 +82,8 @@ export const getDuplicatePackagesInsight = (
81
82
  const newDuplicateInstancesCount = newDuplicateInstances.length;
82
83
  const removedDuplicateInstancesCount = removedDuplicateInstances.length;
83
84
 
84
- let text: string;
85
- let insightType: InsightType;
85
+ let text = '';
86
+ let insightType: InsightType | null = null;
86
87
 
87
88
  if (newDuplicateInstancesCount > 0 && removedDuplicateInstancesCount > 0) {
88
89
  // New duplicate packages and removed duplicates
@@ -90,7 +91,7 @@ export const getDuplicatePackagesInsight = (
90
91
  newDuplicateInstancesCount > 1 || removedDuplicateInstancesCount > 1 ? 'packages' : 'package';
91
92
  text = `Bundle introduced ${newDuplicateInstancesCount} and removed ${removedDuplicateInstancesCount} duplicate ${item}`;
92
93
  insightType = InsightType.ERROR;
93
- } else if (newDuplicateInstancesCount > 0 && baselineDuplicatePackagesMap) {
94
+ } else if (newDuplicateInstancesCount > 0 && !isEmpty(baselineDuplicatePackagesMap)) {
94
95
  // New duplicate packages and baseline comparison
95
96
  const item = newDuplicateInstancesCount > 1 ? 'packages' : 'package';
96
97
  text = `Bundle introduced ${newDuplicateInstancesCount} duplicate ${item}`;
@@ -100,6 +101,12 @@ export const getDuplicatePackagesInsight = (
100
101
  const item = newDuplicateInstancesCount > 1 ? 'packages' : 'package';
101
102
  text = `Bundle contains ${newDuplicateInstancesCount} duplicate ${item}`;
102
103
  insightType = InsightType.WARNING;
104
+ } else if (removedDuplicateInstancesCount > 0 && duplicateInstancesCount > 0) {
105
+ // Removed duplicate packages, but there are duplicate packages remaining
106
+ const itemRemoved = removedDuplicateInstancesCount > 1 ? 'packages' : 'package';
107
+ const itemRemaining = duplicateInstancesCount > 1 ? 'packages' : 'package';
108
+ text = `Bundle removed ${removedDuplicateInstancesCount} duplicate ${itemRemoved}, ${duplicateInstancesCount} duplicate ${itemRemaining} remaining`;
109
+ insightType = InsightType.WARNING;
103
110
  } else if (removedDuplicateInstancesCount > 0) {
104
111
  // Removed duplicate packages
105
112
  const item = removedDuplicateInstancesCount > 1 ? 'packages' : 'package';
@@ -115,9 +122,11 @@ export const getDuplicatePackagesInsight = (
115
122
  text = `Bundle contains ${duplicateInstancesCount} duplicate ${item}`;
116
123
  insightType = InsightType.WARNING;
117
124
  } else {
118
- // No change
119
- text = 'Bundle does not contain duplicate packages';
120
- insightType = InsightType.INFO;
125
+ // No change - noop
126
+ }
127
+
128
+ if (!text || !insightType) {
129
+ return null;
121
130
  }
122
131
 
123
132
  return {
@@ -180,11 +189,15 @@ export const extractModulesPackagesDuplicate = (
180
189
  baselineJob?.insights?.webpack?.duplicatePackages?.data ||
181
190
  {};
182
191
 
192
+ const noDuplicatesDuplicatePackagesV3 = getDuplicatePackagesInsight({}, baselineDuplicatePackages);
193
+
183
194
  if (!count) {
184
195
  return {
185
- insights: {
186
- duplicatePackagesV3: getDuplicatePackagesInsight({}, baselineDuplicatePackages),
187
- },
196
+ ...(noDuplicatesDuplicatePackagesV3 && {
197
+ insights: {
198
+ duplicatePackagesV3: noDuplicatesDuplicatePackagesV3,
199
+ },
200
+ }),
188
201
  metrics: {
189
202
  duplicatePackagesCount: {
190
203
  value: count,
@@ -221,16 +234,18 @@ export const extractModulesPackagesDuplicate = (
221
234
  duplicatePackagesData[packageName] = packageData.children.map(({ id }) => id);
222
235
  });
223
236
 
237
+ const duplicatePackagesV3 = getDuplicatePackagesInsight(
238
+ duplicatePackagesData,
239
+ baselineDuplicatePackages,
240
+ );
241
+
224
242
  return {
225
243
  insights: {
226
244
  duplicatePackages: {
227
245
  type: InsightType.WARNING,
228
246
  data: duplicatePackagesData,
229
247
  },
230
- duplicatePackagesV3: getDuplicatePackagesInsight(
231
- duplicatePackagesData,
232
- baselineDuplicatePackages,
233
- ),
248
+ ...(duplicatePackagesV3 && { duplicatePackagesV3 }),
234
249
  },
235
250
  metrics: {
236
251
  duplicatePackagesCount: {
@@ -1,11 +1,12 @@
1
1
  import round from 'lodash/round';
2
- import { WebpackStatsFiltered, WebpackStatsFilteredRootModule } from '@bundle-stats/plugin-webpack-filter';
2
+ import union from 'lodash/union';
3
+ import { WebpackStatsFiltered, WebpackStatsFilteredModule } from '@bundle-stats/plugin-webpack-filter';
3
4
 
4
5
  import { Module, MetricsModules } from '../types';
5
6
  import { getModuleName, normalizeChunkId } from '../utils';
6
7
 
7
8
  /*
8
- * Extract webpack modules array to an object with metrics
9
+ * Extract webpack modules metrics and stats
9
10
  */
10
11
  export const extractModules = (webpackStats?: WebpackStatsFiltered): MetricsModules => {
11
12
  const modulesSource = webpackStats?.modules;
@@ -22,57 +23,86 @@ export const extractModules = (webpackStats?: WebpackStatsFiltered): MetricsModu
22
23
  }
23
24
 
24
25
  // Flatten concatenated modules
25
- const allModules = modulesSource.reduce((agg, moduleEntry) => {
26
- if (!moduleEntry.modules) {
27
- agg.push(moduleEntry);
26
+ const modulesByName: Map<string, WebpackStatsFilteredModule> = new Map();
28
27
 
29
- return agg;
28
+ modulesSource.forEach((rootModule) => {
29
+ // skip modules that do not belong to any chunk
30
+ if (!rootModule.chunks || rootModule.chunks.length === 0) {
31
+ return;
32
+ }
33
+
34
+ // flatten concatenated modules
35
+ if (rootModule.modules) {
36
+ rootModule.modules.forEach((concatenatedModule) => {
37
+ const concatenatedModuleName = getModuleName(concatenatedModule.name);
38
+ const existingModule = modulesByName.get(concatenatedModuleName);
39
+
40
+ // Merge if the module is already available
41
+ // webpack adds a module entry for every concatenated module
42
+ if (existingModule) {
43
+ modulesByName.set(concatenatedModuleName, {
44
+ ...existingModule,
45
+ chunks: union(existingModule.chunks, rootModule.chunks),
46
+ });
47
+ } else {
48
+ modulesByName.set(concatenatedModuleName, {
49
+ ...concatenatedModule,
50
+ chunks: rootModule.chunks,
51
+ });
52
+ }
53
+ });
54
+
55
+ return;
56
+ }
57
+
58
+ const normalizedName = getModuleName(rootModule.name);
59
+ const savedRootModule = modulesByName.get(normalizedName);
60
+
61
+ // Merge module data
62
+ // @NOTE some webpack plugins (mini-css-extract-plugin) might add a root module entry
63
+ // even if thee module was already concantenated in another module
64
+ if (savedRootModule) {
65
+ modulesByName.set(normalizedName, {
66
+ ...savedRootModule,
67
+ chunks: union(savedRootModule.chunks, rootModule.chunks),
68
+ size: rootModule.size,
69
+ });
70
+
71
+ return;
30
72
  }
31
73
 
32
- // eslint-disable-next-line no-param-reassign
33
- agg = agg.concat(
34
- moduleEntry.modules.map((concatenatedModule) => ({
35
- ...concatenatedModule,
36
- // Add parent chunks
37
- chunks: moduleEntry.chunks,
38
- })),
39
- );
74
+ modulesByName.set(normalizedName, rootModule);
75
+ });
40
76
 
41
- return agg;
42
- }, [] as Array<WebpackStatsFilteredRootModule>);
77
+ // Normalize module entries and extract metrics
78
+ const modules: Record<string, Module> = {};
43
79
 
44
80
  let moduleCount = 0;
45
81
  let totalCodeSize = 0;
46
82
  let duplicateCodeSize = 0;
47
83
  let duplicateModulesCount = 0;
48
84
 
49
- // Normalize module entries
50
- const modules = allModules.reduce((agg, moduleEntry) => {
85
+ modulesByName.forEach((moduleEntry, normalizedName) => {
51
86
  const { name, size = 0, chunks } = moduleEntry;
52
- const normalizedName = getModuleName(name);
53
-
54
- // skip modules that do not belong to any chunk
55
- if (!chunks || chunks?.length === 0) {
56
- return agg;
57
- }
58
87
 
59
88
  const instances = chunks.length;
60
89
  const duplicateInstances = instances - 1;
90
+ const duplicated = duplicateInstances > 0;
61
91
 
62
92
  moduleCount += instances;
63
- duplicateModulesCount += duplicateInstances;
64
- duplicateCodeSize += duplicateInstances * size;
65
93
  totalCodeSize += instances * size;
66
94
 
67
- // eslint-disable-next-line no-param-reassign
68
- agg[normalizedName] = {
95
+ if (duplicated) {
96
+ duplicateModulesCount += duplicateInstances;
97
+ duplicateCodeSize += duplicateInstances * size;
98
+ }
99
+
100
+ modules[normalizedName] = {
69
101
  name,
70
102
  value: size,
71
103
  chunkIds: chunks.map(normalizeChunkId),
72
- duplicated: Boolean(duplicateInstances),
104
+ ...(duplicated && { duplicated }),
73
105
  };
74
-
75
- return agg;
76
106
  }, {} as Record<string, Module>);
77
107
 
78
108
  const duplicateCode = totalCodeSize ? round((duplicateCodeSize / totalCodeSize) * 100, 2) : 0;
@@ -9,7 +9,7 @@ import { Metric } from './types';
9
9
  export const metrics = {
10
10
  [Metric.BUNDLE_SIZE]: {
11
11
  label: 'Bundle Size',
12
- description: 'The total size of the assets produced by webpack',
12
+ description: 'The total size of the assets processed by the bundler',
13
13
  url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
14
14
  type: METRIC_TYPE_FILE_SIZE,
15
15
  },
@@ -48,14 +48,14 @@ export const metrics = {
48
48
  },
49
49
  [Metric.MODULE_COUNT]: {
50
50
  label: 'Modules',
51
- description: 'The total number of modules bundled by webpack',
51
+ description: 'The total number of bundled modules',
52
52
  url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
53
53
  type: METRIC_TYPE_NUMERIC,
54
54
  biggerIsBetter: false,
55
55
  },
56
56
  [Metric.DUPLICATE_MODULES_COUNT]: {
57
57
  label: 'Duplicate Modules',
58
- description: 'The total number of modules that belong to more than one chunk',
58
+ description: 'The total number of module instances bundled into multiple chunks',
59
59
  url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
60
60
  type: METRIC_TYPE_NUMERIC,
61
61
  biggerIsBetter: false,
@@ -69,14 +69,14 @@ export const metrics = {
69
69
  },
70
70
  [Metric.PACKAGE_COUNT]: {
71
71
  label: 'Packages',
72
- description: 'The total number of packages bundled by webpack',
72
+ description: 'The total number of bundled packages',
73
73
  url: 'https://relative-ci.com/documentation/metrics-and-data#packages',
74
74
  type: METRIC_TYPE_NUMERIC,
75
75
  biggerIsBetter: false,
76
76
  },
77
77
  [Metric.DUPLICATE_PACKAGES_COUNT]: {
78
78
  label: 'Duplicate Packages',
79
- description: 'The total number of duplicate packages',
79
+ description: 'The total number of bundled duplicate package instances',
80
80
  url: 'https://relative-ci.com/documentation/metrics-and-data#packages',
81
81
  type: METRIC_TYPE_NUMERIC,
82
82
  biggerIsBetter: false,
@@ -50,8 +50,8 @@ export interface MetricsAssets {
50
50
 
51
51
  export interface Module extends MetricRun {
52
52
  name: string;
53
- chunkIds: Array<String>;
54
- duplicated: boolean;
53
+ chunkIds: Array<string>;
54
+ duplicated?: boolean;
55
55
  }
56
56
 
57
57
  export type Modules = Record<string, Module>;
@@ -104,4 +104,4 @@ export namespace metrics {
104
104
  export { METRIC_TYPE_DURATION as type };
105
105
  }
106
106
  }
107
- import { METRIC_TYPE_DURATION } from "../config/metrics";
107
+ import { METRIC_TYPE_DURATION } from '../config/metrics';
@@ -3,33 +3,4 @@ export const METRIC_TYPE_DURATION: "METRIC_TYPE_DURATION";
3
3
  export const METRIC_TYPE_NUMERIC: "METRIC_TYPE_NUMERIC";
4
4
  export const METRIC_TYPE_SCORE: "METRIC_TYPE_SCORE";
5
5
  export const METRIC_TYPE_PERCENTAGE: "METRIC_TYPE_PERCENTAGE";
6
- export namespace METRIC_TYPES {
7
- namespace METRIC_TYPE_NUMERIC {
8
- export const biggerIsBetter: boolean;
9
- export { formatNumber as formatter };
10
- }
11
- namespace METRIC_TYPE_SCORE {
12
- const biggerIsBetter_1: boolean;
13
- export { biggerIsBetter_1 as biggerIsBetter };
14
- export { formatNumber as formatter };
15
- }
16
- namespace METRIC_TYPE_DURATION {
17
- const biggerIsBetter_2: boolean;
18
- export { biggerIsBetter_2 as biggerIsBetter };
19
- export { formatDuration as formatter };
20
- }
21
- namespace METRIC_TYPE_FILE_SIZE {
22
- const biggerIsBetter_3: boolean;
23
- export { biggerIsBetter_3 as biggerIsBetter };
24
- export { formatFileSize as formatter };
25
- }
26
- namespace METRIC_TYPE_PERCENTAGE {
27
- const biggerIsBetter_4: boolean;
28
- export { biggerIsBetter_4 as biggerIsBetter };
29
- export { formatPercentage as formatter };
30
- }
31
- }
32
- import { formatNumber } from "../utils/format";
33
- import { formatDuration } from "../utils/format";
34
- import { formatFileSize } from "../utils/format";
35
- import { formatPercentage } from "../utils/format";
6
+ export const METRIC_TYPES: Record<string, import('../constants').MetricType>;
@@ -85,6 +85,10 @@ export interface JobInsights {
85
85
  newPackages?: JobInsight<JobInsightNewPackagesData>;
86
86
  };
87
87
  }
88
+ export interface JobInsightsInfo {
89
+ duplicatePackages?: JobInsights['webpack']['duplicatePackagesV3'];
90
+ newPackages?: JobInsights['webpack']['newPackages'];
91
+ }
88
92
  export type JobMetricsSource = Record<string, MetricRun | Record<string, MetricRun>>;
89
93
  export type JobMetrics = JobSection<JobMetricsSource>;
90
94
  export interface JobData {
package/types/i18n.d.ts CHANGED
@@ -9,10 +9,13 @@ declare namespace _default {
9
9
  const COMPONENT_LINK_MODULES_DUPLICATE: string;
10
10
  const COMPONENT_LINK_CHUNK_MODULES: string;
11
11
  const COMPONENT_LINK_PACKAGES_COUNT: string;
12
+ const COMPONENT_LINK_PACKAGES_CHANGED: string;
12
13
  const COMPONENT_LINK_PACKAGES_DUPLICATE: string;
14
+ const COMPONENT_LINK_PACKAGES_DUPLICATE_CHANGED: string;
13
15
  const COMPONENT_LINK_VIEW_PACKAGE: string;
14
16
  function COMPONENT_LINK_BUNDLE_ASSETS_BY_FILE_TYPE({ label }: {
15
17
  label: any;
16
18
  }): string;
19
+ function COMPONENT_LINK_BUNDLE_ASSETS_BY_ENTRY_TYPE(assetType: any): string;
17
20
  }
18
21
  export default _default;
@@ -59,7 +59,7 @@ export namespace metrics {
59
59
  export { METRIC_TYPE_NUMERIC as type };
60
60
  }
61
61
  }
62
- import { METRIC_TYPE_SCORE } from "../config/metrics";
63
- import { METRIC_TYPE_DURATION } from "../config/metrics";
64
- import { METRIC_TYPE_FILE_SIZE } from "../config/metrics";
65
- import { METRIC_TYPE_NUMERIC } from "../config/metrics";
62
+ import { METRIC_TYPE_SCORE } from '../config/metrics';
63
+ import { METRIC_TYPE_DURATION } from '../config/metrics';
64
+ import { METRIC_TYPE_FILE_SIZE } from '../config/metrics';
65
+ import { METRIC_TYPE_NUMERIC } from '../config/metrics';
@@ -23,11 +23,13 @@ export declare const BUNDLE_ASSETS_COUNT: ComponentLink;
23
23
  export declare const BUNDLE_ASSETS_CHUNK_COUNT: ComponentLink;
24
24
  export declare const BUNDLE_MODULES: ComponentLink;
25
25
  export declare const BUNDLE_MODULES_DUPLICATE: ComponentLink;
26
+ export declare const getBundleAssetsByEntryType: (assetType: 'entry' | 'initial' | 'chunk') => ComponentLink;
26
27
  export declare const getBundleModulesBySearch: (search: string) => ComponentLink;
27
28
  export declare const getBundleModulesByChunk: (chunkIds: Array<string>, chunkId: string, fileType?: string) => ComponentLink;
28
29
  export declare const BUNDLE_PACKAGES_COUNT: ComponentLink;
30
+ export declare const BUNDLE_PACKAGES_CHANGED: ComponentLink;
29
31
  export declare const BUNDLE_PACKAGES_DUPLICATE: ComponentLink;
30
- export declare const BUNDLE_PACKAGES_DUPLICATE_NEW: ComponentLink;
32
+ export declare const BUNDLE_PACKAGES_DUPLICATE_CHANGED: ComponentLink;
31
33
  export declare const getBundleAssetsFileTypeComponentLink: (fileType: string, label: string) => ComponentLink;
32
34
  export declare const getBundlePackagesByNameComponentLink: (search: string) => ComponentLink;
33
35
  export declare const getComponentStateQueryString: (params?: {}) => string;
@@ -1,6 +1,7 @@
1
1
  export * from "./component-links";
2
2
  export * from "./delta";
3
3
  export * from "./date";
4
+ export * from "./insights";
4
5
  export * from "./file-types";
5
6
  export * from "./format";
6
7
  export * from "./metrics";
@@ -0,0 +1,9 @@
1
+ import { JobInsight, JobInsightsInfo } from '../constants';
2
+ interface InsightListItem {
3
+ name: string;
4
+ insight: JobInsight;
5
+ link: any;
6
+ }
7
+ export declare const getInsightList: (insights: JobInsightsInfo) => Array<InsightListItem>;
8
+ export declare const getChangedInsights: (normalizedInsights: JobInsightsInfo) => JobInsightsInfo | null;
9
+ export {};
@@ -7,4 +7,4 @@ export const SECTIONS: string[];
7
7
  export const SUMMARY_METRIC_PATHS: Metric[];
8
8
  export const MODULE_PATH_PACKAGES: RegExp;
9
9
  export const PACKAGE_PATH_NAME: RegExp;
10
- import { Metric } from "./types";
10
+ import { Metric } from './types';
@@ -10,4 +10,4 @@ export function extractAssetsSizeTotalInsight(_: any, currentExtractedData: any,
10
10
  };
11
11
  };
12
12
  };
13
- import { InsightType } from "../../constants";
13
+ import { InsightType } from '../../constants';
@@ -1,13 +1,13 @@
1
1
  import { Job, JobInsight, JobInsightDuplicatePackagesV3Data, JobInsights, MetricRun } from '../../constants';
2
2
  interface ModulesPackagesDuplicateData {
3
- insights: {
3
+ insights?: {
4
4
  duplicatePackages?: JobInsights['webpack']['duplicatePackages'];
5
- duplicatePackagesV3: JobInsights['webpack']['duplicatePackagesV3'];
5
+ duplicatePackagesV3?: JobInsights['webpack']['duplicatePackagesV3'];
6
6
  };
7
7
  metrics: {
8
8
  duplicatePackagesCount: MetricRun;
9
9
  };
10
10
  }
11
- export declare const getDuplicatePackagesInsight: (duplicatePackagesMap: Record<string, Array<string>>, baselineDuplicatePackagesMap?: Record<string, Array<string>>) => JobInsight<JobInsightDuplicatePackagesV3Data>;
11
+ export declare const getDuplicatePackagesInsight: (duplicatePackagesMap: Record<string, Array<string>>, baselineDuplicatePackagesMap?: Record<string, Array<string>>) => JobInsight<JobInsightDuplicatePackagesV3Data> | null;
12
12
  export declare const extractModulesPackagesDuplicate: (_: any, currentExtractedData: any, baselineJob?: Job) => ModulesPackagesDuplicateData;
13
13
  export {};
@@ -148,6 +148,6 @@ export namespace metrics {
148
148
  }
149
149
  }
150
150
  }
151
- import { METRIC_TYPE_FILE_SIZE } from "../config/metrics";
152
- import { METRIC_TYPE_PERCENTAGE } from "../config/metrics";
153
- import { METRIC_TYPE_NUMERIC } from "../config/metrics";
151
+ import { METRIC_TYPE_FILE_SIZE } from '../config/metrics';
152
+ import { METRIC_TYPE_PERCENTAGE } from '../config/metrics';
153
+ import { METRIC_TYPE_NUMERIC } from '../config/metrics';
@@ -43,8 +43,8 @@ export interface MetricsAssets {
43
43
  }
44
44
  export interface Module extends MetricRun {
45
45
  name: string;
46
- chunkIds: Array<String>;
47
- duplicated: boolean;
46
+ chunkIds: Array<string>;
47
+ duplicated?: boolean;
48
48
  }
49
49
  export type Modules = Record<string, Module>;
50
50
  export interface MetricsModules {
package/tsconfig.lib.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "noEmit": false
5
- },
6
- "exclude": ["**/__tests__/*"]
7
- }