react-native-bundle-discovery-ui 2.8.0 → 2.9.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.
- package/CHANGELOG.md +34 -0
- package/README.md +12 -255
- package/assets/global.css +1606 -105
- package/dist/bin.js +63 -20
- package/dist/client/fonts.js +45 -0
- package/dist/client/issues.js +5 -0
- package/dist/client/pages/_common.js +279 -98
- package/dist/client/pages/_module.js +347 -0
- package/dist/client/pages/default.js +144 -63
- package/dist/client/pages/module.js +2 -309
- package/dist/client/pages/moduleDiff.js +76 -0
- package/dist/client/pages/package.js +172 -154
- package/dist/client/prepare.js +15 -0
- package/dist/client/queryHelpers.js +487 -91
- package/dist/client/sizeHeat.js +7 -0
- package/dist/client/views/{_theme.js → _colorScheme.js} +2 -9
- package/dist/client/views/_html.js +52 -0
- package/dist/client/views/codeDiff.js +66 -0
- package/dist/client/views/compare.js +237 -0
- package/dist/client/views/importGraph.js +255 -0
- package/dist/client/views/insights.js +81 -0
- package/dist/client/views/moduleOverview.js +122 -0
- package/dist/client/views/packageOverview.js +116 -0
- package/dist/client/views/persistedFilterInput.js +27 -0
- package/dist/client/views/reportBar.js +89 -0
- package/dist/client/views/treemap.js +598 -0
- package/dist/discoveryrc.js +27 -7
- package/dist/rsdoctor.js +19 -99
- package/dist/src-DV3VzcQY.js +1548 -0
- package/package.json +9 -5
- package/assets/highcharts.css +0 -1
- package/dist/client/_virtual/_rolldown/runtime.js +0 -37
- package/dist/client/views/foamtree.js +0 -103
- package/dist/client/views/highcharts.js +0 -33
- package/dist/src-DPAqywOJ.js +0 -201
- package/vendors/foamtree.js +0 -9008
- package/vendors/high-contrast-dark.js +0 -1
- package/vendors/highcharts-exporting.js +0 -13
- package/vendors/highcharts-networkgraph.js +0 -1
- package/vendors/highcharts.js +0 -10
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/client/pages/_common.ts
|
|
3
|
-
const platformColor = `transformOptions.platform = 'android' ? 'rgba(194, 239, 116, .4)' : 'rgba(119, 31, 218, .4)'`;
|
|
4
3
|
function getPackage(entry) {
|
|
5
4
|
return `
|
|
6
5
|
$packages: $.packages;
|
|
@@ -30,12 +29,91 @@ function getPackage(entry) {
|
|
|
30
29
|
}),
|
|
31
30
|
}))`;
|
|
32
31
|
}
|
|
32
|
+
function renderSortToggleGroup(el, config, options) {
|
|
33
|
+
let current = null;
|
|
34
|
+
const label = document.createElement("div");
|
|
35
|
+
label.className = "view-toggle-group-before";
|
|
36
|
+
label.textContent = "Sort by:";
|
|
37
|
+
el.classList.add("view-toggle-group", "sort-toggle-group");
|
|
38
|
+
el.append(label);
|
|
39
|
+
const toggles = options.map(({ value, text }) => {
|
|
40
|
+
const toggle = document.createElement("div");
|
|
41
|
+
toggle.className = "view-toggle onclick";
|
|
42
|
+
toggle.textContent = text;
|
|
43
|
+
toggle.addEventListener("click", () => {
|
|
44
|
+
current = current === value ? null : value;
|
|
45
|
+
toggles.forEach((t, i) => {
|
|
46
|
+
t.classList.toggle("checked", options[i].value === current);
|
|
47
|
+
});
|
|
48
|
+
config.onChange?.(current, config.name);
|
|
49
|
+
});
|
|
50
|
+
return el.appendChild(toggle);
|
|
51
|
+
});
|
|
52
|
+
config.onInit?.(current, config.name);
|
|
53
|
+
}
|
|
54
|
+
function getSortableContentFilter({
|
|
55
|
+
data,
|
|
56
|
+
className,
|
|
57
|
+
nameField,
|
|
58
|
+
sizeField,
|
|
59
|
+
duplicatesCount,
|
|
60
|
+
defaultSort,
|
|
61
|
+
content,
|
|
62
|
+
}) {
|
|
63
|
+
const filtered = `.[${nameField} ~= #.filterByPathStr]`;
|
|
64
|
+
return {
|
|
65
|
+
view: "block",
|
|
66
|
+
data,
|
|
67
|
+
className: `view-content-filter sortable-content-filter ${className ?? ""}`,
|
|
68
|
+
content: {
|
|
69
|
+
view: "context",
|
|
70
|
+
modifiers: [
|
|
71
|
+
{
|
|
72
|
+
view: renderSortToggleGroup,
|
|
73
|
+
name: "sortBy",
|
|
74
|
+
data: `
|
|
75
|
+
$hasDuplicates: .[${duplicatesCount} > 0];
|
|
76
|
+
[
|
|
77
|
+
{ value: 'size', text: 'Size' },
|
|
78
|
+
{ value: 'name', text: 'Name' },
|
|
79
|
+
{ value: 'duplicates', text: 'Duplicates' },
|
|
80
|
+
].[value != 'duplicates' or $hasDuplicates]
|
|
81
|
+
`,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
view: "persisted-filter-input",
|
|
85
|
+
persistKey: `${className}:${nameField}`,
|
|
86
|
+
name: "filterByPathStr",
|
|
87
|
+
placeholder: "Filter",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
content: [
|
|
91
|
+
{
|
|
92
|
+
view: "badge",
|
|
93
|
+
when: `#.filterByPathStr and ${filtered}`,
|
|
94
|
+
className: "filtered-size",
|
|
95
|
+
data: `{ text: 'Filtered size: ' + ${filtered}.sum(=> ${sizeField}).formatBytes(), color: 'rgba(120, 177, 9, 0.35)' }`,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
view: "block",
|
|
99
|
+
className: "content",
|
|
100
|
+
content: content(`
|
|
101
|
+
$filtered: ${filtered};
|
|
102
|
+
#.sortBy = 'name' ? $filtered.sort(${nameField} asc)
|
|
103
|
+
: #.sortBy = 'duplicates' ? $filtered.sort(${duplicatesCount} desc, ${sizeField} desc)
|
|
104
|
+
: #.sortBy = 'size' ? $filtered.sort(${sizeField} desc)
|
|
105
|
+
: ${defaultSort ? `$filtered.sort(${defaultSort})` : "$filtered"}
|
|
106
|
+
`),
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
33
112
|
const metadataTooltip = {
|
|
34
113
|
view: "text",
|
|
35
114
|
when: "metadata.createdAt",
|
|
36
115
|
data: "'Published ' + metadata.createdAt.formatDate() + ' (' + metadata.createdAt.timeAgo() + ')'",
|
|
37
116
|
};
|
|
38
|
-
const outdatedColor = "rgba(255, 165, 0, 0.35)";
|
|
39
117
|
function getMetadataBadges({
|
|
40
118
|
deprecated,
|
|
41
119
|
outdated,
|
|
@@ -46,24 +124,22 @@ function getMetadataBadges({
|
|
|
46
124
|
{
|
|
47
125
|
view: "pill-badge",
|
|
48
126
|
when: deprecated,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
textColor: "white",
|
|
52
|
-
darkColor: "#f85149",
|
|
53
|
-
darkTextColor: "white",
|
|
127
|
+
className: "badge-deprecated",
|
|
128
|
+
data: `{ text: 'deprecated', message: ${deprecated} }`,
|
|
54
129
|
tooltip: "text: message",
|
|
55
130
|
},
|
|
56
131
|
renderLatestVersion
|
|
57
132
|
? {
|
|
58
133
|
view: "pill-badge",
|
|
59
134
|
when: outdated,
|
|
135
|
+
className: "badge-warn",
|
|
60
136
|
data: `{ text: '↑ v' + ${latestVersion} }`,
|
|
61
|
-
color: outdatedColor,
|
|
62
137
|
tooltip: "text: 'Latest version on npm'",
|
|
63
138
|
}
|
|
64
139
|
: null,
|
|
65
140
|
].filter(Boolean);
|
|
66
141
|
}
|
|
142
|
+
const SIZE_HEAT_CLASS = "=sizeHeat ? 'size-heat size-heat-' + sizeHeat : ''";
|
|
67
143
|
function getPackageList({
|
|
68
144
|
data,
|
|
69
145
|
itemPkgName,
|
|
@@ -75,7 +151,7 @@ function getPackageList({
|
|
|
75
151
|
return {
|
|
76
152
|
view: "list",
|
|
77
153
|
data,
|
|
78
|
-
emptyText: "
|
|
154
|
+
emptyText: "No packages found.",
|
|
79
155
|
limit,
|
|
80
156
|
item: {
|
|
81
157
|
view: "tree",
|
|
@@ -84,7 +160,11 @@ function getPackageList({
|
|
|
84
160
|
content: [
|
|
85
161
|
itemPkgName,
|
|
86
162
|
"text: ' '",
|
|
87
|
-
|
|
163
|
+
{
|
|
164
|
+
view: "pill-badge",
|
|
165
|
+
className: SIZE_HEAT_CLASS,
|
|
166
|
+
data: "{ text: size.formatBytes(), sizeHeat }",
|
|
167
|
+
},
|
|
88
168
|
...getMetadataBadges({
|
|
89
169
|
deprecated: "pkgInstances.metadata.deprecated[0]",
|
|
90
170
|
outdated: "pkgInstances.[metadata and not metadata.isLatest]",
|
|
@@ -95,8 +175,8 @@ function getPackageList({
|
|
|
95
175
|
? {
|
|
96
176
|
view: "pill-badge",
|
|
97
177
|
when: "pkgInstances.size() > 1",
|
|
178
|
+
className: "badge-danger",
|
|
98
179
|
data: "(pkgInstances.size() - 1).pluralBadge(['copy','copies'], '+')",
|
|
99
|
-
color: "rgba(255, 0, 0, 0.35)",
|
|
100
180
|
}
|
|
101
181
|
: null,
|
|
102
182
|
{
|
|
@@ -141,7 +221,11 @@ function getPackageList({
|
|
|
141
221
|
}
|
|
142
222
|
function getTreeModule({ hasTextMatch = false, hasPercent = false } = {}) {
|
|
143
223
|
return [
|
|
144
|
-
|
|
224
|
+
{
|
|
225
|
+
view: "pill-badge",
|
|
226
|
+
className: "ext-badge",
|
|
227
|
+
data: "{ text: ext, color: ext.getExtColor() }",
|
|
228
|
+
},
|
|
145
229
|
hasTextMatch
|
|
146
230
|
? {
|
|
147
231
|
view: "link",
|
|
@@ -164,29 +248,29 @@ function getTreeModule({ hasTextMatch = false, hasPercent = false } = {}) {
|
|
|
164
248
|
color: "gold",
|
|
165
249
|
textColor: "black",
|
|
166
250
|
},
|
|
167
|
-
|
|
251
|
+
{
|
|
252
|
+
view: "pill-badge",
|
|
253
|
+
className: SIZE_HEAT_CLASS,
|
|
254
|
+
data: "{ text: size, sizeHeat }",
|
|
255
|
+
},
|
|
168
256
|
hasPercent
|
|
169
257
|
? "pill-badge:{ text: percent, color: 'rgba(120, 177, 9, 0.35)' }"
|
|
170
258
|
: null,
|
|
171
259
|
].filter(Boolean);
|
|
172
260
|
}
|
|
173
|
-
function getModulesTree({ data, limit }) {
|
|
261
|
+
function getModulesTree({ data, limit, sortable }) {
|
|
174
262
|
if (!data) throw new Error("[getModulesTree]: data is required");
|
|
175
|
-
|
|
176
|
-
view: "
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
expanded: false,
|
|
187
|
-
itemConfig: {
|
|
188
|
-
content: getTreeModule({ hasTextMatch: true }),
|
|
189
|
-
children: `
|
|
263
|
+
const getList = (listData) => ({
|
|
264
|
+
view: "list",
|
|
265
|
+
limit,
|
|
266
|
+
data: listData,
|
|
267
|
+
emptyText: "No modules found.",
|
|
268
|
+
item: {
|
|
269
|
+
view: "tree",
|
|
270
|
+
expanded: false,
|
|
271
|
+
itemConfig: {
|
|
272
|
+
content: getTreeModule({ hasTextMatch: true }),
|
|
273
|
+
children: `
|
|
190
274
|
[
|
|
191
275
|
{
|
|
192
276
|
title:'Imported by modules',
|
|
@@ -200,86 +284,183 @@ function getModulesTree({ data, limit }) {
|
|
|
200
284
|
}
|
|
201
285
|
].filter(=> $.data.size() > 0)
|
|
202
286
|
`,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
287
|
+
itemConfig: {
|
|
288
|
+
view: "switch",
|
|
289
|
+
content: [
|
|
290
|
+
{
|
|
291
|
+
when: 'type="reasons"',
|
|
292
|
+
content: {
|
|
293
|
+
view: "tree-leaf",
|
|
294
|
+
content: [
|
|
295
|
+
"text:title",
|
|
296
|
+
"text:' '",
|
|
297
|
+
"badge:{ text: $.data.size() }",
|
|
298
|
+
],
|
|
299
|
+
children: `$.data`,
|
|
300
|
+
itemConfig: {
|
|
209
301
|
view: "tree-leaf",
|
|
210
|
-
content:
|
|
211
|
-
"text:title",
|
|
212
|
-
"text:' '",
|
|
213
|
-
"badge:{ text: $.data.size() }",
|
|
214
|
-
],
|
|
215
|
-
children: `$.data`,
|
|
216
|
-
itemConfig: {
|
|
217
|
-
view: "tree-leaf",
|
|
218
|
-
content: getTreeModule(),
|
|
219
|
-
},
|
|
302
|
+
content: getTreeModule(),
|
|
220
303
|
},
|
|
221
304
|
},
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
when: 'type="duplicates"',
|
|
308
|
+
content: {
|
|
309
|
+
view: "tree-leaf",
|
|
310
|
+
content: [
|
|
311
|
+
"text:title",
|
|
312
|
+
"text:' '",
|
|
313
|
+
"badge:{ text: $.data.size() }",
|
|
314
|
+
],
|
|
315
|
+
children: `$.data`,
|
|
316
|
+
itemConfig: {
|
|
225
317
|
view: "tree-leaf",
|
|
226
|
-
content:
|
|
227
|
-
"text:title",
|
|
228
|
-
"text:' '",
|
|
229
|
-
"badge:{ text: $.data.size() }",
|
|
230
|
-
],
|
|
231
|
-
children: `$.data`,
|
|
232
|
-
itemConfig: {
|
|
233
|
-
view: "tree-leaf",
|
|
234
|
-
content: getTreeModule(),
|
|
235
|
-
},
|
|
318
|
+
content: getTreeModule(),
|
|
236
319
|
},
|
|
237
320
|
},
|
|
238
|
-
|
|
239
|
-
|
|
321
|
+
},
|
|
322
|
+
],
|
|
240
323
|
},
|
|
241
324
|
},
|
|
242
325
|
},
|
|
326
|
+
});
|
|
327
|
+
if (sortable)
|
|
328
|
+
return getSortableContentFilter({
|
|
329
|
+
data,
|
|
330
|
+
nameField: "name",
|
|
331
|
+
sizeField: "sizeInBytes",
|
|
332
|
+
duplicatesCount: "duplicates.size()",
|
|
333
|
+
content: getList,
|
|
334
|
+
});
|
|
335
|
+
return {
|
|
336
|
+
view: "content-filter",
|
|
337
|
+
data,
|
|
338
|
+
name: "filterByPathStr",
|
|
339
|
+
content: getList(".[name ~= #.filterByPathStr]"),
|
|
243
340
|
};
|
|
244
341
|
}
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
342
|
+
const findingItem = {
|
|
343
|
+
view: "expand",
|
|
344
|
+
className: "='in-finding in-finding-' + severity",
|
|
345
|
+
header: [
|
|
346
|
+
{
|
|
347
|
+
view: "pill-badge",
|
|
348
|
+
className: "in-severity",
|
|
349
|
+
data: `{
|
|
350
|
+
text: severity = 'high' ? 'High impact' : severity = 'medium' ? 'Saves size' : 'Advice',
|
|
351
|
+
color: severity = 'high' ? 'rgba(220, 50, 60, 0.3)' : severity = 'medium' ? 'rgba(255, 165, 0, 0.35)' : 'rgba(0, 170, 255, 0.25)',
|
|
352
|
+
}`,
|
|
353
|
+
},
|
|
354
|
+
"text: title",
|
|
355
|
+
{
|
|
356
|
+
view: "pill-badge",
|
|
357
|
+
when: "savings",
|
|
358
|
+
data: "{ text: '~' + savings.formatBytes(), postfix: savingsShare.percent(2), color: 'rgba(120, 177, 9, 0.35)' }",
|
|
359
|
+
tooltip: "text: 'Estimated savings: size and share of the bundle'",
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
view: "inline-list",
|
|
363
|
+
className: "in-packages",
|
|
364
|
+
when: "packageNames",
|
|
365
|
+
data: "packageNames",
|
|
366
|
+
item: {
|
|
367
|
+
view: "link",
|
|
368
|
+
className: "mo-chip mo-chip-pkg",
|
|
369
|
+
data: `{ href: $.pageLink("package", {}), text: $ }`,
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
],
|
|
373
|
+
content: {
|
|
374
|
+
view: "block",
|
|
375
|
+
className: "in-finding-content",
|
|
376
|
+
content: [
|
|
377
|
+
{
|
|
378
|
+
view: "markdown",
|
|
379
|
+
data: "message",
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
view: "block",
|
|
383
|
+
when: "packagesText",
|
|
384
|
+
className: "in-pre",
|
|
385
|
+
content: "text: packagesText",
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
view: "expand",
|
|
389
|
+
when: "affected",
|
|
390
|
+
className: "in-affected",
|
|
391
|
+
header: [
|
|
392
|
+
"text: 'Affected modules '",
|
|
393
|
+
"pill-badge: affected.size()",
|
|
394
|
+
"pill-badge: { text: affectedSize.formatBytes(), color: 'rgba(120, 177, 9, 0.35)' }",
|
|
395
|
+
],
|
|
396
|
+
content: {
|
|
397
|
+
view: "list",
|
|
398
|
+
data: "affected",
|
|
399
|
+
limit: 20,
|
|
400
|
+
item: {
|
|
401
|
+
view: "block",
|
|
402
|
+
content: getTreeModule(),
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
view: "block",
|
|
408
|
+
when: "docsUrls",
|
|
409
|
+
className: "in-docs",
|
|
410
|
+
content: [
|
|
411
|
+
"text: 'Learn more: '",
|
|
412
|
+
{
|
|
413
|
+
view: "inline-list",
|
|
414
|
+
data: "docsUrls",
|
|
415
|
+
item: {
|
|
416
|
+
view: "link",
|
|
417
|
+
external: true,
|
|
418
|
+
data: "{ href: $, text: $ }",
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
],
|
|
280
424
|
},
|
|
281
425
|
};
|
|
282
|
-
|
|
426
|
+
function getInsightsTab() {
|
|
427
|
+
return {
|
|
428
|
+
view: "block",
|
|
429
|
+
className: "tab-scroll insights",
|
|
430
|
+
data: "$.bundleInsights()",
|
|
431
|
+
content: [
|
|
432
|
+
{ view: "bundle-insights" },
|
|
433
|
+
{
|
|
434
|
+
view: "h3",
|
|
435
|
+
className: "in-title",
|
|
436
|
+
content: [
|
|
437
|
+
"text: 'Recommendations '",
|
|
438
|
+
{
|
|
439
|
+
view: "pill-badge",
|
|
440
|
+
when: "hasRecommendations",
|
|
441
|
+
data: "findings.size()",
|
|
442
|
+
},
|
|
443
|
+
],
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
view: "alert-warning",
|
|
447
|
+
when: "not hasRecommendations",
|
|
448
|
+
content:
|
|
449
|
+
"html: 'Recommendations are only available for production bundles. Generate the report from a bundle built with <code>--dev false</code> to see them.'",
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
view: "alert-success",
|
|
453
|
+
when: "hasRecommendations and not findings",
|
|
454
|
+
content: "text: 'No recommendations.'",
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
view: "list",
|
|
458
|
+
data: "findings",
|
|
459
|
+
item: findingItem,
|
|
460
|
+
},
|
|
461
|
+
],
|
|
462
|
+
};
|
|
463
|
+
}
|
|
283
464
|
function getCopyToClipboardButton({ textToCopy, className, text }) {
|
|
284
465
|
return {
|
|
285
466
|
view: "button",
|
|
@@ -302,10 +483,10 @@ function getCopyToClipboardButton({ textToCopy, className, text }) {
|
|
|
302
483
|
};
|
|
303
484
|
}
|
|
304
485
|
//#endregion
|
|
305
|
-
exports.externalLinkHtml = externalLinkHtml;
|
|
306
486
|
exports.getCopyToClipboardButton = getCopyToClipboardButton;
|
|
487
|
+
exports.getInsightsTab = getInsightsTab;
|
|
307
488
|
exports.getModulesTree = getModulesTree;
|
|
308
489
|
exports.getPackage = getPackage;
|
|
309
490
|
exports.getPackageList = getPackageList;
|
|
491
|
+
exports.getSortableContentFilter = getSortableContentFilter;
|
|
310
492
|
exports.getTreeModule = getTreeModule;
|
|
311
|
-
exports.metadata = metadata;
|