react-native-bundle-discovery-ui 2.8.0 → 2.9.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 +26 -0
- package/README.md +12 -255
- package/assets/global.css +769 -53
- package/dist/bin.js +61 -20
- package/dist/client/issues.js +5 -0
- package/dist/client/pages/_common.js +258 -86
- package/dist/client/pages/_module.js +347 -0
- package/dist/client/pages/default.js +145 -62
- 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 +445 -81
- 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 +80 -0
- package/dist/client/views/moduleOverview.js +134 -0
- package/dist/client/views/packageOverview.js +114 -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 +26 -7
- package/dist/rsdoctor.js +4 -101
- package/dist/src-Bp8pPQrQ.js +1545 -0
- package/package.json +5 -3
- 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
|
@@ -5,202 +5,220 @@ discovery.page.define("package", {
|
|
|
5
5
|
data: `
|
|
6
6
|
// Tmp variables
|
|
7
7
|
$currentPkgName: #.id;
|
|
8
|
-
${require_pages__common.getPackage(`$pkg: modules.filter(=> path has "node_modules" and path
|
|
9
|
-
$copies: $pkg.pkgInstances.size() - 1;
|
|
10
|
-
$ver: $pkg.pkgInstances[0].version;
|
|
8
|
+
${require_pages__common.getPackage(`$pkg: modules.filter(=> path has "node_modules" and path.getModulesName() = $currentPkgName)`)}[0];
|
|
11
9
|
|
|
12
10
|
// Return value
|
|
13
|
-
{
|
|
14
|
-
...$,
|
|
15
|
-
currentPkgHasCopies: $copies > 0,
|
|
16
|
-
currentPkgCopiesCount: $copies,
|
|
17
|
-
currentPkgVersion: $ver,
|
|
18
|
-
currentPkgWithUniqVer: $pkg.pkgName + ($copies = 0 ? '@' + $ver : ''),
|
|
19
|
-
currentPkgWithUniqVerNpm: $pkg.pkgName + ($copies = 0 ? '/v/' + $ver : ''),
|
|
11
|
+
{
|
|
12
|
+
...$,
|
|
20
13
|
currentPkg: $pkg,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
currentPkgOutdated: $pkg.pkgInstances.[metadata and not metadata.isLatest],
|
|
24
|
-
currentPkgLatestVersion: $pkg.pkgInstances.metadata.latestVersion[0],
|
|
14
|
+
overview: $.packageOverview($currentPkgName),
|
|
15
|
+
currentPkgImportChain: $.importChain($currentPkgName),
|
|
25
16
|
}
|
|
26
17
|
`,
|
|
27
18
|
content: [
|
|
19
|
+
{
|
|
20
|
+
view: "alert-warning",
|
|
21
|
+
when: "not overview",
|
|
22
|
+
data: "'Package ' + #.id + ' is not found in the bundle'",
|
|
23
|
+
},
|
|
28
24
|
{
|
|
29
25
|
view: "block",
|
|
26
|
+
when: "overview",
|
|
27
|
+
className: "mo-wrap",
|
|
30
28
|
content: [
|
|
31
29
|
{
|
|
32
|
-
view: "
|
|
33
|
-
|
|
34
|
-
content: `badge: {
|
|
35
|
-
text: $.currentPkgWithUniqVer,
|
|
36
|
-
color: "#fffb5a",
|
|
37
|
-
}`,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
when: "$.currentPkgCopiesCount > 0",
|
|
41
|
-
view: "h2",
|
|
42
|
-
className: "inline-block no-margin",
|
|
43
|
-
content: [
|
|
44
|
-
`badge: {
|
|
45
|
-
text: '+' + $.currentPkgCopiesCount,
|
|
46
|
-
postfix: $.currentPkgCopiesCount = 1 ? 'copy' : 'copies',
|
|
47
|
-
color: "rgba(255, 0, 0, 0.35)"
|
|
48
|
-
}`,
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
when: "$.currentPkgDeprecated",
|
|
53
|
-
view: "h2",
|
|
54
|
-
className: "inline-block no-margin",
|
|
55
|
-
content: `badge: { text: 'deprecated', color: "rgba(255, 0, 0, 0.35)" }`,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
when: "$.currentPkgOutdated",
|
|
59
|
-
view: "h2",
|
|
60
|
-
className: "inline-block no-margin",
|
|
61
|
-
content: `badge: {
|
|
62
|
-
prefix: 'latest',
|
|
63
|
-
text: 'v' + $.currentPkgLatestVersion,
|
|
64
|
-
color: "rgba(255, 165, 0, 0.35)"
|
|
65
|
-
}`,
|
|
30
|
+
view: "package-overview",
|
|
31
|
+
data: "overview",
|
|
66
32
|
},
|
|
67
33
|
require_pages__common.getCopyToClipboardButton({
|
|
68
|
-
textToCopy:
|
|
69
|
-
className: "
|
|
34
|
+
textToCopy: "#.id",
|
|
35
|
+
className: "mo-copy",
|
|
70
36
|
}),
|
|
71
37
|
],
|
|
72
38
|
},
|
|
73
39
|
{
|
|
74
|
-
when: "$.currentPkgDeprecated",
|
|
75
40
|
view: "list",
|
|
76
|
-
|
|
41
|
+
when: "overview.deprecated",
|
|
42
|
+
data: "overview.deprecated",
|
|
77
43
|
item: {
|
|
78
44
|
view: "alert-danger",
|
|
45
|
+
className: "m-v-8",
|
|
79
46
|
content: [
|
|
80
47
|
"html: '<b>Deprecated</b> '",
|
|
81
|
-
"text: 'v' + version + (#.data.
|
|
48
|
+
"text: 'v' + version + (#.data.overview.copies.size() > 1 ? ' (' + path + ')' : '') + ': '",
|
|
82
49
|
"text: metadata.deprecated",
|
|
83
50
|
],
|
|
84
51
|
},
|
|
85
52
|
},
|
|
86
|
-
"html: '<br>'",
|
|
87
53
|
{
|
|
88
|
-
view: "
|
|
89
|
-
|
|
90
|
-
|
|
54
|
+
view: "tabs",
|
|
55
|
+
when: "overview",
|
|
56
|
+
name: "tabs",
|
|
57
|
+
className: "mo-tabs",
|
|
58
|
+
tabs: [
|
|
91
59
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
data: `{ href: "https://www.npmjs.com/package/" + currentPkgWithUniqVerNpm }`,
|
|
95
|
-
content: [
|
|
96
|
-
"text: 'npmjs.com'",
|
|
97
|
-
`html: '<span class="my-icon-inline my-icon-12">${require_pages__common.externalLinkHtml}</span>'`,
|
|
98
|
-
],
|
|
60
|
+
value: "files",
|
|
61
|
+
content: ["text:'Files '", "pill-badge: overview.filesCount"],
|
|
99
62
|
},
|
|
100
|
-
"text: ' '",
|
|
101
63
|
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
data: `{ href: "https://bundlephobia.com/package/" + currentPkgWithUniqVer }`,
|
|
105
|
-
content: [
|
|
106
|
-
"text: 'bundlephobia.com'",
|
|
107
|
-
`html: '<span class="my-icon-inline my-icon-12">${require_pages__common.externalLinkHtml}</span>'`,
|
|
108
|
-
],
|
|
64
|
+
value: "importers",
|
|
65
|
+
content: ["text:'Imported by '", "pill-badge: overview.importedBy"],
|
|
109
66
|
},
|
|
110
|
-
"text: ' '",
|
|
111
67
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
content: [
|
|
116
|
-
"text: 'packagephobia.com'",
|
|
117
|
-
`html: '<span class="my-icon-inline my-icon-12">${require_pages__common.externalLinkHtml}</span>'`,
|
|
118
|
-
],
|
|
68
|
+
value: "why",
|
|
69
|
+
when: "currentPkgImportChain",
|
|
70
|
+
text: "Why bundled",
|
|
119
71
|
},
|
|
120
72
|
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
content: [
|
|
125
|
-
{
|
|
126
|
-
view: "html",
|
|
127
|
-
data: `'<img class="bundlejs-badge-img" src="https://deno.bundlejs.com/?q=' + q + '&badge=detailed" />'`,
|
|
128
|
-
},
|
|
129
|
-
],
|
|
73
|
+
value: "versions",
|
|
74
|
+
when: "overview.copies.[metadata]",
|
|
75
|
+
content: ["text:'Versions '", "pill-badge: overview.copies.size()"],
|
|
130
76
|
},
|
|
131
77
|
],
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
78
|
+
content: {
|
|
79
|
+
view: "switch",
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
when: '#.tabs="files"',
|
|
83
|
+
content: require_pages__common.getPackageList({
|
|
84
|
+
data: "$.currentPkg",
|
|
85
|
+
itemPkgName: "text: pkgName",
|
|
86
|
+
showCopiesBadge: false,
|
|
87
|
+
expanded: true,
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
when: '#.tabs="importers"',
|
|
92
|
+
content: [
|
|
93
|
+
{
|
|
94
|
+
view: "text",
|
|
95
|
+
className: "why-hint",
|
|
96
|
+
data: "'Modules outside of the package that import its files:'",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
view: "list",
|
|
100
|
+
data: "overview.importers",
|
|
101
|
+
emptyText:
|
|
102
|
+
"Nothing imports it: the bundler loads it before the app code (e.g. polyfills)",
|
|
103
|
+
item: {
|
|
104
|
+
view: "tree",
|
|
105
|
+
expanded: false,
|
|
106
|
+
itemConfig: {
|
|
107
|
+
content: [
|
|
108
|
+
...require_pages__common.getTreeModule(),
|
|
109
|
+
"pill-badge: imports.size().pluralBadge(['import', 'imports'])",
|
|
110
|
+
],
|
|
111
|
+
children: "imports",
|
|
112
|
+
itemConfig: {
|
|
113
|
+
view: "tree-leaf",
|
|
114
|
+
content: require_pages__common.getTreeModule(),
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
when: '#.tabs="why"',
|
|
123
|
+
content: {
|
|
124
|
+
view: "block",
|
|
125
|
+
data: "$.currentPkgImportChain",
|
|
126
|
+
className: "why",
|
|
161
127
|
content: [
|
|
162
128
|
{
|
|
163
|
-
view: "
|
|
164
|
-
|
|
165
|
-
data: `
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
129
|
+
view: "text",
|
|
130
|
+
className: "why-hint",
|
|
131
|
+
data: `fromEntry
|
|
132
|
+
? 'The shortest import chain from the entry point:'
|
|
133
|
+
: 'Not imported from the entry point: the bundler runs it before the app code (e.g. polyfills). The shortest chain:'`,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
view: "list",
|
|
137
|
+
data: "steps",
|
|
138
|
+
className: "why-chain",
|
|
139
|
+
item: {
|
|
140
|
+
view: "block",
|
|
141
|
+
className:
|
|
142
|
+
"=isTarget ? 'why-step why-step-target' : 'why-step'",
|
|
143
|
+
content: [
|
|
144
|
+
...require_pages__common.getTreeModule(),
|
|
145
|
+
{
|
|
146
|
+
view: "pill-badge",
|
|
147
|
+
when: "entersPackage",
|
|
148
|
+
className: "why-enters",
|
|
149
|
+
data: "{ prefix: 'enters', text: entersPackage, color: 'rgba(0, 170, 255, 0.25)' }",
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
169
153
|
},
|
|
170
154
|
],
|
|
171
155
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
when: '#.tabs="versions"',
|
|
159
|
+
content: {
|
|
160
|
+
view: "table",
|
|
161
|
+
data: "overview.copies.[metadata]",
|
|
162
|
+
cols: [
|
|
163
|
+
{
|
|
164
|
+
header: "Path",
|
|
165
|
+
content: "text: path",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
header: "Version",
|
|
169
|
+
content: "pill-badge:{ text: 'v' + version, color: '#0af' }",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
header: "Size",
|
|
173
|
+
content:
|
|
174
|
+
"pill-badge:{ text: size.formatBytes(), color: 'rgba(120, 177, 9, 0.35)' }",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
header: "Published",
|
|
178
|
+
data: "metadata.createdAt",
|
|
179
|
+
content: [
|
|
180
|
+
"text: formatDate()",
|
|
181
|
+
"text: ' '",
|
|
182
|
+
"pill-badge:{ text: timeAgo() }",
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
header: "Latest",
|
|
187
|
+
content: [
|
|
188
|
+
{
|
|
189
|
+
view: "link",
|
|
190
|
+
external: true,
|
|
191
|
+
data: `{
|
|
192
|
+
href: "https://www.npmjs.com/package/" + #.id + "/v/" + metadata.latestVersion,
|
|
193
|
+
text: 'v' + metadata.latestVersion,
|
|
194
|
+
}`,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
header: "Status",
|
|
200
|
+
content: {
|
|
201
|
+
view: "switch",
|
|
202
|
+
content: [
|
|
203
|
+
{
|
|
204
|
+
when: "metadata.deprecated",
|
|
205
|
+
content: `badge: { text: 'deprecated', color: "rgba(255, 0, 0, 0.35)" }`,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
when: "metadata.isLatest",
|
|
209
|
+
content: `badge: { text: 'latest', color: "rgba(120, 177, 9, 0.35)" }`,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
content: `badge: { text: 'outdated', color: "rgba(255, 165, 0, 0.35)" }`,
|
|
213
|
+
},
|
|
214
|
+
],
|
|
187
215
|
},
|
|
188
|
-
|
|
189
|
-
|
|
216
|
+
},
|
|
217
|
+
],
|
|
190
218
|
},
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
},
|
|
195
|
-
"html: '<hr>'",
|
|
196
|
-
{
|
|
197
|
-
view: "block",
|
|
198
|
-
content: require_pages__common.getPackageList({
|
|
199
|
-
data: "$.currentPkg",
|
|
200
|
-
itemPkgName: "text: pkgName",
|
|
201
|
-
showCopiesBadge: false,
|
|
202
|
-
expanded: true,
|
|
203
|
-
}),
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
},
|
|
204
222
|
},
|
|
205
223
|
],
|
|
206
224
|
});
|
package/dist/client/prepare.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
const require_issues = require("./issues.js");
|
|
1
2
|
//#region src/client/prepare.ts
|
|
3
|
+
function addIssue(module, issue) {
|
|
4
|
+
module.issues ??= [];
|
|
5
|
+
if (!module.issues.includes(issue)) module.issues.push(issue);
|
|
6
|
+
}
|
|
2
7
|
function getDuplicateId(path) {
|
|
3
8
|
const uniqueNodeModulePath = path.split("node_modules/").pop();
|
|
4
9
|
const ids = [uniqueNodeModulePath];
|
|
@@ -19,6 +24,7 @@ function prepare(input) {
|
|
|
19
24
|
const moduleMap = /* @__PURE__ */ new Map();
|
|
20
25
|
const duplicatesMap = /* @__PURE__ */ new Map();
|
|
21
26
|
const allLodashModules = /* @__PURE__ */ new Set();
|
|
27
|
+
data.recommendations ??= null;
|
|
22
28
|
data.packages.forEach((pkg) => {
|
|
23
29
|
pkg.path = pkg.absolutePath.replace(`${data.rootFolder}/`, "");
|
|
24
30
|
});
|
|
@@ -52,11 +58,20 @@ function prepare(input) {
|
|
|
52
58
|
if (m.path.endsWith("node_modules/lodash/index.js"))
|
|
53
59
|
m.duplicates.push(...allLodashModules);
|
|
54
60
|
delete m._tmp_ids;
|
|
61
|
+
if (m.duplicates.length > 0) addIssue(m, require_issues.DUPLICATE_ISSUE);
|
|
55
62
|
m.dependencies.forEach((dependency) => {
|
|
56
63
|
const dependentModule = moduleMap.get(dependency.absolutePath);
|
|
57
64
|
if (dependentModule) dependentModule.dependents.push(m);
|
|
58
65
|
});
|
|
59
66
|
});
|
|
67
|
+
const modulesByPath = new Map(data.modules.map((m) => [m.absolutePath, m]));
|
|
68
|
+
data.recommendations?.forEach((finding) => {
|
|
69
|
+
finding.modules = finding.modules?.map((path) => {
|
|
70
|
+
const module = modulesByPath.get(path);
|
|
71
|
+
if (module && finding.sizeInBytes) addIssue(module, finding.title);
|
|
72
|
+
return module?.path ?? path;
|
|
73
|
+
});
|
|
74
|
+
});
|
|
60
75
|
return data;
|
|
61
76
|
}
|
|
62
77
|
//#endregion
|