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.
Files changed (40) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +12 -255
  3. package/assets/global.css +1606 -105
  4. package/dist/bin.js +63 -20
  5. package/dist/client/fonts.js +45 -0
  6. package/dist/client/issues.js +5 -0
  7. package/dist/client/pages/_common.js +279 -98
  8. package/dist/client/pages/_module.js +347 -0
  9. package/dist/client/pages/default.js +144 -63
  10. package/dist/client/pages/module.js +2 -309
  11. package/dist/client/pages/moduleDiff.js +76 -0
  12. package/dist/client/pages/package.js +172 -154
  13. package/dist/client/prepare.js +15 -0
  14. package/dist/client/queryHelpers.js +487 -91
  15. package/dist/client/sizeHeat.js +7 -0
  16. package/dist/client/views/{_theme.js → _colorScheme.js} +2 -9
  17. package/dist/client/views/_html.js +52 -0
  18. package/dist/client/views/codeDiff.js +66 -0
  19. package/dist/client/views/compare.js +237 -0
  20. package/dist/client/views/importGraph.js +255 -0
  21. package/dist/client/views/insights.js +81 -0
  22. package/dist/client/views/moduleOverview.js +122 -0
  23. package/dist/client/views/packageOverview.js +116 -0
  24. package/dist/client/views/persistedFilterInput.js +27 -0
  25. package/dist/client/views/reportBar.js +89 -0
  26. package/dist/client/views/treemap.js +598 -0
  27. package/dist/discoveryrc.js +27 -7
  28. package/dist/rsdoctor.js +19 -99
  29. package/dist/src-DV3VzcQY.js +1548 -0
  30. package/package.json +9 -5
  31. package/assets/highcharts.css +0 -1
  32. package/dist/client/_virtual/_rolldown/runtime.js +0 -37
  33. package/dist/client/views/foamtree.js +0 -103
  34. package/dist/client/views/highcharts.js +0 -33
  35. package/dist/src-DPAqywOJ.js +0 -201
  36. package/vendors/foamtree.js +0 -9008
  37. package/vendors/high-contrast-dark.js +0 -1
  38. package/vendors/highcharts-exporting.js +0 -13
  39. package/vendors/highcharts-networkgraph.js +0 -1
  40. package/vendors/highcharts.js +0 -10
@@ -1,311 +1,4 @@
1
- const require_pages__common = require("./_common.js");
1
+ const require_pages__module = require("./_module.js");
2
2
  //#region src/client/pages/module.ts
3
- function getMetroWarn({ when, href, linkText, content }) {
4
- return {
5
- view: "alert-warning",
6
- when,
7
- className: "m-v-8",
8
- content: [
9
- ...content,
10
- linkText && href
11
- ? {
12
- view: "link",
13
- data: {
14
- external: true,
15
- href,
16
- text: linkText,
17
- },
18
- }
19
- : null,
20
- ].filter(Boolean),
21
- };
22
- }
23
- discovery.page.define("module", {
24
- view: "context",
25
- data: `{
26
- $currentModule: $.modules.[path = #.id].pick(0);
27
- ...$,
28
- currentModule: $currentModule,
29
- isEntry: $currentModule.isEntry,
30
- isInjectedByMetro: $currentModule.path = '__prelude__' or $currentModule.path has '@react-native/js-polyfills',
31
- isWebpackRuntime: $currentModule.path has '__runtime__',
32
- }`,
33
- content: [
34
- {
35
- view: "h2",
36
- content: [
37
- 'text: "Module: "',
38
- "text: $.currentModule.path",
39
- require_pages__common.getCopyToClipboardButton({
40
- textToCopy: `$.currentModule.path`,
41
- className: "m-l-0_5em",
42
- }),
43
- ],
44
- },
45
- {
46
- view: "tabs",
47
- name: "tabs",
48
- tabs: [
49
- {
50
- value: "mcontent",
51
- text: "Module content",
52
- },
53
- {
54
- value: "networkGraph",
55
- when: "not isInjectedByMetro and not isEntry and not isWebpackRuntime",
56
- text: "Imported by modules",
57
- },
58
- {
59
- value: "mduplicates",
60
- when: "not isInjectedByMetro and not isEntry and not isWebpackRuntime and currentModule.duplicates",
61
- text: "Duplicates",
62
- },
63
- ],
64
- content: {
65
- view: "switch",
66
- content: [
67
- {
68
- when: '#.tabs="mcontent"',
69
- content: [
70
- getMetroWarn({
71
- when: "$.currentModule.path = '__prelude__'",
72
- content: [
73
- "html: '<b>__prelude__</b>'",
74
- "text: ' is a special runtime code that was generated by the Metro bundler, see: '",
75
- ],
76
- href: "https://github.com/facebook/metro/blob/f595e9e1c9021ad372b489be8958cc298eb1e0d9/packages/metro/src/lib/getPreludeCode.js#L25-L33",
77
- linkText: "getPreludeCode.js",
78
- }),
79
- getMetroWarn({
80
- when: "$.currentModule.path = '__runtime__'",
81
- content: [
82
- "html: '<b>__runtime__</b>'",
83
- "text: ' is a special runtime code that was generated by the Webpack/Rspack bundler'",
84
- ],
85
- }),
86
- getMetroWarn({
87
- when: "$.currentModule.path has '@react-native/js-polyfills'",
88
- content: [
89
- "html: '<b>@react-native/js-polyfills/*</b>'",
90
- "text: ' is a special package that was injected by the Metro bundler, see: '",
91
- ],
92
- href: "https://github.com/facebook/react-native/blob/198c6fc81cda67a46fff457cc39eb2a297eddc01/packages/metro-config/src/index.flow.js#L61",
93
- linkText: "rn/metro-config/index.js",
94
- }),
95
- getMetroWarn({
96
- when: "$.currentModule.path has 'metro-runtime'",
97
- content: [
98
- "html: '<b>metro-runtime/*</b>'",
99
- "text: ' is a special package that was injected by the Metro bundler, see: '",
100
- ],
101
- href: "https://github.com/facebook/metro/blob/f595e9e1c9021ad372b489be8958cc298eb1e0d9/packages/metro-config/src/defaults/defaults.js#L61-L63",
102
- linkText: "metro-config/index.js",
103
- }),
104
- {
105
- view: "hstack",
106
- className: "flex-no-wrap",
107
- content: [
108
- {
109
- view: "block",
110
- className: "width-50p",
111
- content: [
112
- "h5: 'Source'",
113
- {
114
- view: "source",
115
- syntax: "ts",
116
- source: "=$.currentModule.source.code",
117
- },
118
- ],
119
- },
120
- {
121
- view: "block",
122
- className: "width-50p",
123
- content: [
124
- {
125
- view: "h5",
126
- content: 'text:"Output"',
127
- },
128
- {
129
- view: "context",
130
- modifiers: [
131
- {
132
- view: "checkbox",
133
- name: "prettify",
134
- checked: true,
135
- className: "prettify-checkbox",
136
- content: 'text:"Prettify"',
137
- },
138
- ],
139
- content: [
140
- {
141
- view: "source-prettify",
142
- syntax: "ts",
143
- source:
144
- "=(#.prettify ? $.currentModule.output.code.prettifyJS() : $.currentModule.output.code)",
145
- },
146
- ],
147
- },
148
- ],
149
- },
150
- ],
151
- },
152
- ],
153
- },
154
- {
155
- when: '#.tabs="networkGraph"',
156
- content: {
157
- view: "context",
158
- context: `{ ...#, maxParentDepth: $.currentModule.getBestNetworkGraphSize() }`,
159
- modifiers: [
160
- "html: '<br/>'",
161
- "text:'Max parent depth: '",
162
- {
163
- view: "input",
164
- name: "maxParentDepth",
165
- className: "inline-block",
166
- htmlType: "number",
167
- htmlMin: 1,
168
- htmlMax: 10,
169
- },
170
- ],
171
- content: [
172
- {
173
- view: "context",
174
- data: `{
175
- // Vars
176
- $tmp: $.currentModule.getNetworkGraph({ maxParentDepth: #.maxParentDepth });
177
- $limit: 150;
178
- // Return data
179
- currentModule: $.currentModule,
180
- entryPointPath: $tmp.entryPointPath,
181
- limit: $limit,
182
- data: $tmp.data,
183
- isGraphTooBig: $tmp.data.size() > $limit,
184
- }`,
185
- content: [
186
- {
187
- when: "isGraphTooBig",
188
- view: "block",
189
- className: "m-v-8",
190
- content: [
191
- {
192
- view: "alert-warning",
193
- data: '"Amount of dependencies "+$.data.size()+" (limit: "+$.limit+") are too big to display as a graph :("',
194
- },
195
- ],
196
- },
197
- {
198
- view: "hstack",
199
- className: "flex-no-wrap two-column",
200
- content: [
201
- {
202
- when: "not isGraphTooBig",
203
- view: "highcharts",
204
- data: `{
205
- options: {
206
- chart: {
207
- type: "networkgraph",
208
- height: "500px",
209
- },
210
- title: {
211
- text: "Import Dependency Graph",
212
- align: "left",
213
- },
214
- subtitle: {
215
- text: "It shows which modules import this file (Red - current module, Gold - entry point)",
216
- align: "left",
217
- },
218
- plotOptions: {
219
- networkgraph: {
220
- keys: ["from", "to"],
221
- layoutAlgorithm: {
222
- enableSimulation: true,
223
- friction: -0.9,
224
- gravitationalConstant: 0.06,
225
- },
226
- },
227
- },
228
- series: [
229
- {
230
- accessibility: {
231
- enabled: false,
232
- },
233
- dataLabels: {
234
- enabled: true,
235
- linkFormat: "",
236
- style: {
237
- fontSize: "0.8em",
238
- fontWeight: "normal",
239
- },
240
- },
241
- id: "lang-tree",
242
- data: $.data,
243
- nodes:[
244
- { id: $.currentModule.path, marker: { radius: 15, fillColor: 'red' }, },
245
- { id: $.entryPointPath, marker: { radius: 15, fillColor: 'gold' } }
246
- ].filter(=> id),
247
- },
248
- ],
249
- },
250
- }`,
251
- },
252
- {
253
- view: "block",
254
- content: [
255
- "h4: 'Modules that import this file: ' + $.currentModule.path",
256
- {
257
- view: "list",
258
- data: `
259
- $totalSize: modules.sum(=>output.sizeInBytes);
260
- $toModule: => {
261
- $deepIdx: $$ + 1;
262
- ext: $.path.getFileExtension(),
263
- name: $.path,
264
- size: $.output.sizeInBytes.formatBytes(),
265
- percent: ($.output.sizeInBytes / $totalSize).percent(3),
266
- children: $deepIdx < 2 ? $.dependents.map(=> $.$toModule()) : null,
267
- };
268
- $.currentModule.dependents.map(=> $.$toModule(0))
269
- `,
270
- emptyText: "⚠️ No importing modules found",
271
- item: {
272
- view: "tree",
273
- expanded: false,
274
- itemConfig: {
275
- content: require_pages__common.getTreeModule({
276
- hasTextMatch: true,
277
- }),
278
- children: `$.children`,
279
- },
280
- },
281
- },
282
- ],
283
- },
284
- ],
285
- },
286
- ],
287
- },
288
- ],
289
- },
290
- },
291
- {
292
- when: '#.tabs="mduplicates"',
293
- content: require_pages__common.getModulesTree({
294
- data: `
295
- $totalSize: modules.sum(=>output.sizeInBytes);
296
- $toModule: => {
297
- ext: $.path.getFileExtension(),
298
- name: $.path,
299
- size: $.output.sizeInBytes.formatBytes(),
300
- percent: ($.output.sizeInBytes / $totalSize).percent(3),
301
- };
302
- currentModule.duplicates.map(=> $.$toModule())
303
- `,
304
- }),
305
- },
306
- ],
307
- },
308
- },
309
- ],
310
- });
3
+ discovery.page.define("module", require_pages__module.getModulePage());
311
4
  //#endregion
@@ -0,0 +1,76 @@
1
+ const require_pages__module = require("./_module.js");
2
+ //#region src/client/pages/moduleDiff.ts
3
+ discovery.page.define(
4
+ "module-diff",
5
+ require_pages__module.getModulePage({
6
+ codeTabText: "Diff",
7
+ extraData: "before: $.comparison.beforeModules[#.id],",
8
+ codeContent: {
9
+ view: "switch",
10
+ content: [
11
+ {
12
+ when: "not before",
13
+ content: {
14
+ view: "alert-warning",
15
+ data: "'This module was not changed compared with the \"before\" report'",
16
+ },
17
+ },
18
+ {
19
+ content: {
20
+ view: "hstack",
21
+ className: "flex-no-wrap",
22
+ content: [
23
+ {
24
+ view: "block",
25
+ when: "not isImageOrFontAsset",
26
+ className: "width-50p",
27
+ content: [
28
+ {
29
+ view: "h5",
30
+ className: "mo-pane-title",
31
+ content: "text: 'Source diff'",
32
+ },
33
+ {
34
+ view: "code-diff",
35
+ data: "{ before: before.source, after: currentModule.source.code }",
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ view: "block",
41
+ className: (data) =>
42
+ data.isImageOrFontAsset ? "" : "width-50p",
43
+ content: [
44
+ {
45
+ view: "h5",
46
+ className: "mo-pane-title",
47
+ content: "text: 'Output diff'",
48
+ },
49
+ {
50
+ view: "context",
51
+ modifiers: [
52
+ {
53
+ view: "checkbox",
54
+ name: "prettify",
55
+ checked: true,
56
+ className: "prettify-checkbox",
57
+ content: 'text:"Prettify"',
58
+ },
59
+ ],
60
+ content: {
61
+ view: "code-diff",
62
+ data: `#.prettify
63
+ ? { before: before.output.prettifyJS(), after: currentModule.output.code.prettifyJS() }
64
+ : { before: before.output, after: currentModule.output.code }`,
65
+ },
66
+ },
67
+ ],
68
+ },
69
+ ],
70
+ },
71
+ },
72
+ ],
73
+ },
74
+ }),
75
+ );
76
+ //#endregion