react-native-bundle-discovery-ui 2.9.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.
@@ -118,7 +118,7 @@ function createGraph(host, data) {
118
118
  svg("circle", {
119
119
  r: radius(point),
120
120
  fill: nodeColor(point.data),
121
- stroke: dark ? "#111" : "#fff",
121
+ stroke: dark ? "#161618" : "#f1f1ef",
122
122
  "stroke-width": 1.5,
123
123
  }),
124
124
  );
@@ -1,3 +1,4 @@
1
+ require("../sizeHeat.js");
1
2
  const require_views__html = require("./_html.js");
2
3
  //#region src/client/views/insights.ts
3
4
  function topList(title, items, page, badge) {
@@ -7,10 +8,10 @@ function topList(title, items, page, badge) {
7
8
  <div class="mo-card-label">${title}</div>
8
9
  ${items
9
10
  .map(
10
- (item) => `
11
+ (item, index) => `
11
12
  <a class="in-row" href="${require_views__html.escapeHTML(discovery.encodePageHash(page, item.name))}">
12
13
  <span class="in-row-name" title="${require_views__html.escapeHTML(item.name)}">${require_views__html.escapeHTML(item.name)}${badge ? badge(item) : ""}</span>
13
- <span class="in-row-size">${require_views__html.formatBytes(item.size)}</span>
14
+ <span class="in-row-size${index < 3 && item.size > 716800 ? ` size-heat size-heat-${3 - index}` : ""}">${require_views__html.formatBytes(item.size)}</span>
14
15
  <span class="in-row-share">${require_views__html.formatPercent(item.share)}</span>
15
16
  <span class="in-row-bar"><span style="width:${Math.max(item.bar * 100, 1).toFixed(2)}%"></span></span>
16
17
  </a>`,
@@ -15,7 +15,7 @@ function renderHeader(o) {
15
15
  ? require_views__html.chip(`Injected by ${o.injectedBy}`, "warn")
16
16
  : "",
17
17
  o.pkg?.metadata?.deprecated
18
- ? require_views__html.chip("Deprecated", "danger")
18
+ ? require_views__html.chip("Deprecated", "deprecated")
19
19
  : "",
20
20
  o.pkg?.metadata && !o.pkg.metadata.isLatest && o.pkg.metadata.latestVersion
21
21
  ? require_views__html.chip(
@@ -30,7 +30,7 @@ function renderHeader(o) {
30
30
  ].join("");
31
31
  return `
32
32
  <div class="mo-header">
33
- <span class="mo-ext" style="background:${extColor(o.ext)}">${require_views__html.escapeHTML(o.ext)}</span>
33
+ <span class="mo-ext">${require_views__html.escapeHTML(o.ext)}</span>
34
34
  <div class="mo-title">
35
35
  <div class="mo-dir">${require_views__html.escapeHTML(o.dir)}</div>
36
36
  <div class="mo-file">${require_views__html.escapeHTML(o.file)}</div>
@@ -38,18 +38,6 @@ function renderHeader(o) {
38
38
  </div>
39
39
  </div>`;
40
40
  }
41
- function extColor(ext) {
42
- const colors = {
43
- js: "#f1e05a",
44
- ts: "#3178c6",
45
- tsx: "#3178c6",
46
- json: "#e34c26",
47
- svg: "#e69f0d",
48
- css: "#563d7c",
49
- png: "#e44b23",
50
- };
51
- return `${colors[ext] ?? colors.js}55`;
52
- }
53
41
  function renderCards(o) {
54
42
  const delta = o.sourceSize ? o.outputSize / o.sourceSize - 1 : 0;
55
43
  const deltaText =
@@ -17,7 +17,9 @@ function renderHeader(o) {
17
17
  "pkg",
18
18
  ),
19
19
  ),
20
- o.deprecated.length ? require_views__html.chip("Deprecated", "danger") : "",
20
+ o.deprecated.length
21
+ ? require_views__html.chip("Deprecated", "deprecated")
22
+ : "",
21
23
  o.isOutdated && o.latestVersion
22
24
  ? require_views__html.chip(
23
25
  `Latest v${require_views__html.escapeHTML(o.latestVersion)}`,
@@ -28,7 +28,7 @@ function renderBuild(s) {
28
28
  if (s.dev === true)
29
29
  chips.push(
30
30
  chip(
31
- "⚠ Dev bundle",
31
+ "Dev bundle",
32
32
  "warn",
33
33
  "__DEV__ is true: the bundle has dev-only code, so sizes are bigger than in production. Build with --dev false.",
34
34
  ),
@@ -38,7 +38,7 @@ function renderBuild(s) {
38
38
  if (s.minify === false)
39
39
  chips.push(
40
40
  chip(
41
- "⚠ Not minified",
41
+ "Not minified",
42
42
  "warn",
43
43
  "Minify is off: sizes are bigger than in a release build. Build with --minify true.",
44
44
  ),
@@ -67,7 +67,7 @@ const HUE_SHIFT_STEPS = [8, 4];
67
67
  const MIN_SHADED_SIZE = 6;
68
68
  const HEADER_HEIGHT = 16;
69
69
  const BREADCRUMB_HEIGHT = 26;
70
- const FONT = "11px system-ui, -apple-system, sans-serif";
70
+ const FONT = '11px "Geist Mono", ui-monospace, monospace';
71
71
  const MAX_SCALE = 64;
72
72
  const COLOR_BY_OPTIONS = [
73
73
  {
@@ -20,6 +20,7 @@ const config = {
20
20
  setup: node_path.default.resolve(__dirname, "client/setup.js"),
21
21
  view: {
22
22
  assets: [
23
+ node_path.default.resolve(__dirname, "client/fonts.js"),
23
24
  node_path.default.resolve(__dirname, "../assets/global.css"),
24
25
  node_path.default.resolve(__dirname, "client/pages/default.js"),
25
26
  node_path.default.resolve(__dirname, "client/pages/module.js"),
package/dist/rsdoctor.js CHANGED
@@ -1,5 +1,22 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-Bp8pPQrQ.js");
2
+ const require_src = require("./src-DV3VzcQY.js");
3
+ //#region src/rsdoctor.ts
4
+ /** Loads a report for the generated discovery.js config and adds recommendations */
5
+ function loadReport({ path, rsdoctor, esbuild, compare }) {
6
+ const data = require(path);
7
+ const report = require_src.withRecommendations(
8
+ rsdoctor
9
+ ? require_src.transformRSDoctorData(data)
10
+ : esbuild
11
+ ? require_src.transformEsbuildMetafile(data, path)
12
+ : data,
13
+ );
14
+ return compare
15
+ ? require_src.withComparison(report, require(compare), compare)
16
+ : report;
17
+ }
18
+ //#endregion
19
+ exports.loadReport = loadReport;
3
20
  exports.transformEsbuildMetafile = require_src.transformEsbuildMetafile;
4
21
  exports.transformRSDoctorData = require_src.transformRSDoctorData;
5
22
  exports.withComparison = require_src.withComparison;
@@ -193,6 +193,7 @@ const transformEsbuildMetafile = (metafile, reportPath) => {
193
193
  };
194
194
  });
195
195
  return {
196
+ kind: "esbuild",
196
197
  date: Date.now(),
197
198
  entryPoint: entryPoint ? toAbsolute(entryPoint) : "",
198
199
  rootFolder,
@@ -289,6 +290,7 @@ const transformRSDoctorData = (rsdoctorData) => {
289
290
  const tmpDependenciesMap = getDependenciesMap(rsdoctorData);
290
291
  const firstConfig = rsdoctorData.data.configs[0];
291
292
  return {
293
+ kind: "rsdoctor",
292
294
  date: Date.now(),
293
295
  entryPoint: getEntryFile(rsdoctorData),
294
296
  rootFolder: firstConfig.root,
@@ -406,7 +408,9 @@ const recommendation$14 = {
406
408
  const details = deprecatedPackages
407
409
  .map(({ id, reason, latestVersion }) => {
408
410
  const latest = latestVersion ? ` (latest: ${latestVersion})` : "";
409
- return reason ? ` - ${id}${latest}: ${reason}` : ` - ${id}${latest}`;
411
+ return reason
412
+ ? ` - \`${id}\`${latest}: ${reason}`
413
+ : ` - \`${id}\`${latest}`;
410
414
  })
411
415
  .join("\n");
412
416
  return {
@@ -854,7 +858,7 @@ const recommendation$12 = {
854
858
  );
855
859
  if (bundledDevPackages.length === 0) return null;
856
860
  return {
857
- message: `Detected dev-only packages in the production bundle: ${bundledDevPackages.join(", ")}.
861
+ message: `Detected dev-only packages in the production bundle: ${bundledDevPackages.map((id) => `\`${id}\``).join(", ")}.
858
862
 
859
863
  Move debug-only imports/usage behind \`__DEV__\` checks so Metro can exclude them from release builds, see example below:
860
864
 
@@ -1029,7 +1033,7 @@ const recommendation$9 = {
1029
1033
  if (outdatedPackages.length === 0) return null;
1030
1034
  const details = outdatedPackages
1031
1035
  .map(({ id, createdAt, ageInYears, latestVersion }) => {
1032
- return ` - ${id} (${`published ${createdAt.slice(0, 10)}, ${ageInYears.toFixed(1)} years ago`}${latestVersion ? `, latest: ${latestVersion}` : ""})`;
1036
+ return ` - \`${id}\` (${`published ${createdAt.slice(0, 10)}, ${ageInYears.toFixed(1)} years ago`}${latestVersion ? `, latest: ${latestVersion}` : ""})`;
1033
1037
  })
1034
1038
  .join("\n");
1035
1039
  return {
@@ -1339,13 +1343,12 @@ const recommendation$2 = {
1339
1343
  id: "rn-issue-promise-polyfill",
1340
1344
  title: "Remove Promise polyfills",
1341
1345
  check: (report) => {
1342
- if (report.kind === "webpack") return null;
1343
1346
  const packages = report.packages;
1344
1347
  const modules = report.modules;
1345
1348
  const reactNativeVersion = getReactNativeVersion(packages);
1346
- const deadPromiseModules = modules.filter((module) =>
1347
- module?.path?.includes(deadCode),
1348
- );
1349
+ const deadPromiseModules = report.kind
1350
+ ? []
1351
+ : modules.filter((module) => module?.path?.includes(deadCode));
1349
1352
  const hasDeadPromiseModule = deadPromiseModules.length > 0;
1350
1353
  const removablePolyfills = [];
1351
1354
  const removableModules = [...deadPromiseModules];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bundle-discovery-ui",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "Browser UI for React Native bundle reports",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,9 +17,9 @@
17
17
  "assets"
18
18
  ],
19
19
  "scripts": {
20
- "build": "run -T tsdown && run -T prettier --write --log-level warn --ignore-path= \"dist/**/*.js\"",
20
+ "build": "run -T tsdown && node scripts/fonts.mjs && run -T prettier --write --log-level warn --ignore-path= \"dist/**/*.js\"",
21
21
  "typecheck": "run -T tsc -p tsconfig.json && run -T tsc -p src/client/tsconfig.json",
22
- "dev": "run -T tsdown && NODE_ENV=development discovery --config dist/discoveryrc.js",
22
+ "dev": "run -T tsdown && node scripts/fonts.mjs && NODE_ENV=development discovery --config dist/discoveryrc.js",
23
23
  "prepack": "cp ../../README.md README.md"
24
24
  },
25
25
  "dependencies": {
@@ -32,6 +32,8 @@
32
32
  "prettier": "^3.9.6"
33
33
  },
34
34
  "devDependencies": {
35
+ "@fontsource-variable/geist": "^5.3.0",
36
+ "@fontsource-variable/geist-mono": "^5.3.0",
35
37
  "@react-native-bundle-discovery/shared": "0.0.0",
36
38
  "@types/d3-hierarchy": "^3.1.7",
37
39
  "@types/minimist": "^1.2.5"