react-native-bundle-discovery-ui 2.7.0-rc.0 → 2.7.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/CHANGELOG.md +7 -0
- package/dist/bin.js +221 -152
- package/dist/client/_virtual/_rolldown/runtime.js +26 -12
- package/dist/client/pages/_common.js +238 -209
- package/dist/client/pages/default.js +146 -129
- package/dist/client/pages/module.js +223 -172
- package/dist/client/pages/package.js +171 -151
- package/dist/client/prepare.js +56 -45
- package/dist/client/queryHelpers.js +302 -260
- package/dist/client/setup.js +2 -2
- package/dist/client/views/_theme.js +9 -7
- package/dist/client/views/foamtree.js +94 -79
- package/dist/client/views/highcharts.js +23 -13
- package/dist/client/views/prettify.js +17 -7
- package/dist/discoveryrc.js +18 -13
- package/dist/rolldown-runtime-VH7oDXx4.js +30 -16
- package/dist/rsdoctor.js +86 -59
- package/dist/src-BSLX-He2.js +25 -19
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
//#region src/client/pages/_common.ts
|
|
3
3
|
const platformColor = `transformOptions.platform = 'android' ? 'rgba(194, 239, 116, .4)' : 'rgba(119, 31, 218, .4)'`;
|
|
4
4
|
function getPackage(entry) {
|
|
5
|
-
|
|
5
|
+
return `
|
|
6
6
|
$packages: $.packages;
|
|
7
7
|
$totalSize: $.modules.sum(=>output.sizeInBytes);
|
|
8
8
|
$toModule: => {
|
|
@@ -31,139 +31,162 @@ function getPackage(entry) {
|
|
|
31
31
|
}))`;
|
|
32
32
|
}
|
|
33
33
|
const metadataTooltip = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
view: "text",
|
|
35
|
+
when: "metadata.createdAt",
|
|
36
|
+
data: "'Published ' + metadata.createdAt.formatDate() + ' (' + metadata.createdAt.timeAgo() + ')'",
|
|
37
37
|
};
|
|
38
38
|
const outdatedColor = "rgba(255, 165, 0, 0.35)";
|
|
39
|
-
function getMetadataBadges({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
function getMetadataBadges({
|
|
40
|
+
deprecated,
|
|
41
|
+
outdated,
|
|
42
|
+
latestVersion,
|
|
43
|
+
renderLatestVersion,
|
|
44
|
+
}) {
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
view: "pill-badge",
|
|
48
|
+
when: deprecated,
|
|
49
|
+
data: `{ text: '⚠️ deprecated', message: ${deprecated} }`,
|
|
50
|
+
color: "#cf222e",
|
|
51
|
+
textColor: "white",
|
|
52
|
+
darkColor: "#f85149",
|
|
53
|
+
darkTextColor: "white",
|
|
54
|
+
tooltip: "text: message",
|
|
55
|
+
},
|
|
56
|
+
renderLatestVersion
|
|
57
|
+
? {
|
|
58
|
+
view: "pill-badge",
|
|
59
|
+
when: outdated,
|
|
60
|
+
data: `{ text: '↑ v' + ${latestVersion} }`,
|
|
61
|
+
color: outdatedColor,
|
|
62
|
+
tooltip: "text: 'Latest version on npm'",
|
|
63
|
+
}
|
|
64
|
+
: null,
|
|
65
|
+
].filter(Boolean);
|
|
56
66
|
}
|
|
57
|
-
function getPackageList({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
67
|
+
function getPackageList({
|
|
68
|
+
data,
|
|
69
|
+
itemPkgName,
|
|
70
|
+
showCopiesBadge,
|
|
71
|
+
expanded,
|
|
72
|
+
limit,
|
|
73
|
+
subLimit,
|
|
74
|
+
}) {
|
|
75
|
+
return {
|
|
76
|
+
view: "list",
|
|
77
|
+
data,
|
|
78
|
+
emptyText: "⚠️ No packages found",
|
|
79
|
+
limit,
|
|
80
|
+
item: {
|
|
81
|
+
view: "tree",
|
|
82
|
+
expanded,
|
|
83
|
+
itemConfig: {
|
|
84
|
+
content: [
|
|
85
|
+
itemPkgName,
|
|
86
|
+
"text: ' '",
|
|
87
|
+
"pill-badge:{ text: size.formatBytes(), color: 'rgba(120, 177, 9, 0.35)' }",
|
|
88
|
+
...getMetadataBadges({
|
|
89
|
+
deprecated: "pkgInstances.metadata.deprecated[0]",
|
|
90
|
+
outdated: "pkgInstances.[metadata and not metadata.isLatest]",
|
|
91
|
+
latestVersion: "pkgInstances.metadata.latestVersion[0]",
|
|
92
|
+
renderLatestVersion: false,
|
|
93
|
+
}),
|
|
94
|
+
showCopiesBadge
|
|
95
|
+
? {
|
|
96
|
+
view: "pill-badge",
|
|
97
|
+
when: "pkgInstances.size() > 1",
|
|
98
|
+
data: "(pkgInstances.size() - 1).pluralBadge(['copy','copies'], '+')",
|
|
99
|
+
color: "rgba(255, 0, 0, 0.35)",
|
|
100
|
+
}
|
|
101
|
+
: null,
|
|
102
|
+
{
|
|
103
|
+
view: "pill-badge",
|
|
104
|
+
data: "pkgInstances.modules.size().pluralBadge(['file','files'])",
|
|
105
|
+
},
|
|
106
|
+
].filter(Boolean),
|
|
107
|
+
children: `$.pkgInstances`,
|
|
108
|
+
itemConfig: {
|
|
109
|
+
view: "tree-leaf",
|
|
110
|
+
limit: subLimit,
|
|
111
|
+
content: [
|
|
112
|
+
"text:pkgName",
|
|
113
|
+
"text:' '",
|
|
114
|
+
{
|
|
115
|
+
view: "pill-badge",
|
|
116
|
+
data: "{ text: 'v' + version, metadata }",
|
|
117
|
+
color: "#0af",
|
|
118
|
+
tooltip: metadataTooltip,
|
|
119
|
+
},
|
|
120
|
+
"pill-badge:{ text: size.formatBytes(), color: 'rgba(120, 177, 9, 0.35)' }",
|
|
121
|
+
{
|
|
122
|
+
view: "pill-badge",
|
|
123
|
+
data: "modules.size().pluralBadge(['file','files'])",
|
|
124
|
+
},
|
|
125
|
+
...getMetadataBadges({
|
|
126
|
+
deprecated: "metadata.deprecated",
|
|
127
|
+
outdated: "metadata and not metadata.isLatest",
|
|
128
|
+
latestVersion: "metadata.latestVersion",
|
|
129
|
+
renderLatestVersion: true,
|
|
130
|
+
}),
|
|
131
|
+
],
|
|
132
|
+
children: `$.modules`,
|
|
133
|
+
itemConfig: {
|
|
134
|
+
view: "tree-leaf",
|
|
135
|
+
content: getTreeModule({ hasPercent: true }),
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
122
141
|
}
|
|
123
142
|
function getTreeModule({ hasTextMatch = false, hasPercent = false } = {}) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
143
|
+
return [
|
|
144
|
+
"pill-badge:{ text: ext, color: ext.getExtColor() }",
|
|
145
|
+
hasTextMatch
|
|
146
|
+
? {
|
|
147
|
+
view: "link",
|
|
148
|
+
content: hasTextMatch ? "text-match" : "text",
|
|
149
|
+
data: `{
|
|
130
150
|
href: name.pageLink("module", {}),
|
|
131
151
|
text: name,
|
|
132
152
|
match: #.filterByPathStr
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
}`,
|
|
154
|
+
}
|
|
155
|
+
: {
|
|
156
|
+
view: "link",
|
|
157
|
+
data: `{ href: $.name.pageLink("module", {}), text: $.name }`,
|
|
158
|
+
},
|
|
159
|
+
"text:' '",
|
|
160
|
+
{
|
|
161
|
+
view: "badge",
|
|
162
|
+
when: "isEntry",
|
|
163
|
+
text: "Entrypoint",
|
|
164
|
+
color: "gold",
|
|
165
|
+
textColor: "black",
|
|
166
|
+
},
|
|
167
|
+
"pill-badge:{ text: size, color: 'rgba(120, 177, 9, 0.35)' }",
|
|
168
|
+
hasPercent
|
|
169
|
+
? "pill-badge:{ text: percent, color: 'rgba(120, 177, 9, 0.35)' }"
|
|
170
|
+
: null,
|
|
171
|
+
].filter(Boolean);
|
|
149
172
|
}
|
|
150
173
|
function getModulesTree({ data, limit }) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
174
|
+
if (!data) throw new Error("[getModulesTree]: data is required");
|
|
175
|
+
return {
|
|
176
|
+
view: "content-filter",
|
|
177
|
+
data,
|
|
178
|
+
name: "filterByPathStr",
|
|
179
|
+
content: {
|
|
180
|
+
view: "list",
|
|
181
|
+
limit,
|
|
182
|
+
data: ".[name ~= #.filterByPathStr]",
|
|
183
|
+
emptyText: "⚠️ No modules found",
|
|
184
|
+
item: {
|
|
185
|
+
view: "tree",
|
|
186
|
+
expanded: false,
|
|
187
|
+
itemConfig: {
|
|
188
|
+
content: getTreeModule({ hasTextMatch: true }),
|
|
189
|
+
children: `
|
|
167
190
|
[
|
|
168
191
|
{
|
|
169
192
|
title:'Imported by modules',
|
|
@@ -177,100 +200,106 @@ function getModulesTree({ data, limit }) {
|
|
|
177
200
|
}
|
|
178
201
|
].filter(=> $.data.size() > 0)
|
|
179
202
|
`,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
203
|
+
itemConfig: {
|
|
204
|
+
view: "switch",
|
|
205
|
+
content: [
|
|
206
|
+
{
|
|
207
|
+
when: 'type="reasons"',
|
|
208
|
+
content: {
|
|
209
|
+
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
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
when: 'type="duplicates"',
|
|
224
|
+
content: {
|
|
225
|
+
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
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
};
|
|
218
244
|
}
|
|
219
245
|
const metadata = {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
246
|
+
platform: {
|
|
247
|
+
when: "transformOptions.platform",
|
|
248
|
+
view: "badge",
|
|
249
|
+
data: `{ prefix: 'Platform: ', text: transformOptions.platform, color: ${platformColor} }`,
|
|
250
|
+
},
|
|
251
|
+
size: {
|
|
252
|
+
when: "modules.filter(=> $.path has 'node_modules').size()",
|
|
253
|
+
view: "badge",
|
|
254
|
+
data: `{ prefix: 'Size: ', text: modules.sum(=>output.sizeInBytes).formatBytes(), color: ${platformColor} }`,
|
|
255
|
+
},
|
|
256
|
+
node_modules_size: {
|
|
257
|
+
when: "modules.filter(=> $.path has 'node_modules').size()",
|
|
258
|
+
view: "badge",
|
|
259
|
+
data: "{ prefix: 'node_modules: ', text: modules.filter(=> $.path has 'node_modules').sum(=>output.sizeInBytes).formatBytes(), color: 'rgba(255, 0, 0, 0.35)' }",
|
|
260
|
+
},
|
|
261
|
+
source_code_size: {
|
|
262
|
+
when: "modules.filter(=> $.path has 'node_modules').size()",
|
|
263
|
+
view: "badge",
|
|
264
|
+
data: `
|
|
239
265
|
// vars
|
|
240
266
|
$totalSize: modules.sum(=>output.sizeInBytes);
|
|
241
267
|
$thirdPartySize: modules.filter(=> $.path has 'node_modules').sum(=>output.sizeInBytes);
|
|
242
268
|
// return data
|
|
243
|
-
{ prefix: 'Source code: ', text: ($totalSize - $thirdPartySize).formatBytes(), color: 'rgba(148, 111, 234, 0.5)' }
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
269
|
+
{ prefix: 'Source code: ', text: ($totalSize - $thirdPartySize).formatBytes(), color: 'rgba(148, 111, 234, 0.5)' }`,
|
|
270
|
+
},
|
|
271
|
+
is_dev: {
|
|
272
|
+
when: "transformOptions.dev != null",
|
|
273
|
+
view: "badge",
|
|
274
|
+
data: "{ prefix: '__DEV__: ', text: transformOptions.dev }",
|
|
275
|
+
},
|
|
276
|
+
is_minified: {
|
|
277
|
+
when: "transformOptions.minify != null",
|
|
278
|
+
view: "badge",
|
|
279
|
+
data: "{ prefix: 'Minify: ', text: transformOptions.minify }",
|
|
280
|
+
},
|
|
255
281
|
};
|
|
256
282
|
const externalLinkHtml = `<svg class="my-icon my-icon-link" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" ><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"></path></svg>`;
|
|
257
283
|
function getCopyToClipboardButton({ textToCopy, className, text }) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
284
|
+
return {
|
|
285
|
+
view: "button",
|
|
286
|
+
className: `${className ?? ""} copy-to-clipboard`,
|
|
287
|
+
text,
|
|
288
|
+
data: `{ textToCopy: ${textToCopy} }`,
|
|
289
|
+
onClick(elm, data) {
|
|
290
|
+
clearTimeout(elm.__timer);
|
|
291
|
+
navigator.clipboard
|
|
292
|
+
.writeText(data.textToCopy)
|
|
293
|
+
.then(() => {
|
|
294
|
+
elm.classList.add("done");
|
|
295
|
+
elm.__timer = setTimeout(() => elm.classList.remove("done"), 2e3);
|
|
296
|
+
})
|
|
297
|
+
.catch(() => {
|
|
298
|
+
elm.classList.add("err");
|
|
299
|
+
elm.__timer = setTimeout(() => elm.classList.remove("err"), 2e3);
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
};
|
|
274
303
|
}
|
|
275
304
|
//#endregion
|
|
276
305
|
exports.externalLinkHtml = externalLinkHtml;
|