@bymaksym/loadline 0.1.0 → 1.1.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.
Files changed (115) hide show
  1. package/README.md +272 -45
  2. package/dist/cli/cli/args.js +97 -116
  3. package/dist/cli/cli/gates.js +80 -14
  4. package/dist/cli/cli/main.js +275 -31
  5. package/dist/cli/cli/memory.js +114 -0
  6. package/dist/cli/cli/read/declared.js +52 -0
  7. package/dist/cli/cli/read/locate.js +214 -0
  8. package/dist/cli/cli/{read-build.js → read/read-build.js} +156 -87
  9. package/dist/cli/cli/read/read-config.js +120 -0
  10. package/dist/cli/cli/render/html-report.js +111 -0
  11. package/dist/cli/cli/render/render-agent.js +114 -0
  12. package/dist/cli/cli/render/render-asked.js +104 -0
  13. package/dist/cli/cli/render/render-badge.js +140 -0
  14. package/dist/cli/cli/{render-json.js → render/render-json.js} +26 -10
  15. package/dist/cli/cli/{render-markdown.js → render/render-markdown.js} +6 -6
  16. package/dist/cli/cli/{render-pr.js → render/render-pr.js} +37 -15
  17. package/dist/cli/cli/{render-sarif.js → render/render-sarif.js} +11 -6
  18. package/dist/cli/cli/{render-text.js → render/render-text.js} +169 -127
  19. package/dist/cli/cli/render/terminal.js +55 -0
  20. package/dist/cli/cli/report.js +76 -29
  21. package/dist/cli/cli/self-check.js +19 -23
  22. package/dist/cli/cli/since-last.js +45 -0
  23. package/dist/cli/cli/text/text-errors.js +124 -0
  24. package/dist/cli/cli/text/text.js +343 -0
  25. package/dist/cli/cli/text/usage.js +240 -0
  26. package/dist/cli/src/app/core/analysis/analysis.js +68 -24
  27. package/dist/cli/src/app/core/analysis/{barrels.js → graph/barrels.js} +10 -3
  28. package/dist/cli/src/app/core/analysis/{blast.js → graph/blast.js} +56 -17
  29. package/dist/cli/src/app/core/analysis/{cycles.js → graph/cycles.js} +1 -1
  30. package/dist/cli/src/app/core/analysis/{importers.js → graph/importers.js} +1 -1
  31. package/dist/cli/src/app/core/analysis/{insights.js → graph/insights.js} +10 -4
  32. package/dist/cli/src/app/core/analysis/invariant.js +1 -1
  33. package/dist/cli/src/app/core/analysis/metafile.types.js +21 -7
  34. package/dist/cli/src/app/core/analysis/{delivery.js → screens/delivery.js} +1 -1
  35. package/dist/cli/src/app/core/analysis/{entries.js → screens/entries.js} +87 -11
  36. package/dist/cli/src/app/core/analysis/screens/marks.js +32 -0
  37. package/dist/cli/src/app/core/analysis/screens/route-files.js +116 -0
  38. package/dist/cli/src/app/core/analysis/{sourcemap.js → sourcemap/sourcemap.js} +106 -7
  39. package/dist/cli/src/app/core/analysis/{split-drift.js → sourcemap/split-drift.js} +13 -7
  40. package/dist/cli/src/app/core/analysis/tool.js +83 -0
  41. package/dist/cli/src/app/core/assets/assets.js +137 -16
  42. package/dist/cli/src/app/core/baseline/baseline.js +0 -0
  43. package/dist/cli/src/app/core/{intake → build-text}/index-html.js +234 -29
  44. package/dist/cli/src/app/core/build-text/route-table.js +178 -0
  45. package/dist/cli/src/app/core/build-text/tool-marks.js +54 -0
  46. package/dist/cli/src/app/core/caching/caching.js +123 -45
  47. package/dist/cli/src/app/core/caching/from-analysis.js +20 -4
  48. package/dist/cli/src/app/core/config/config-text.js +90 -0
  49. package/dist/cli/src/app/core/config/config-values.js +358 -0
  50. package/dist/cli/src/app/core/config/loadline-config.js +81 -16
  51. package/dist/cli/src/app/core/config/merge-config.js +98 -0
  52. package/dist/cli/src/app/core/deps/deps.js +141 -23
  53. package/dist/cli/src/app/core/deps/pins.js +63 -0
  54. package/dist/cli/src/app/core/export/summary.js +54 -12
  55. package/dist/cli/src/app/core/findings/actions.js +65 -6
  56. package/dist/cli/src/app/core/findings/bundle/boot-single.js +76 -0
  57. package/dist/cli/src/app/core/findings/bundle/dupes.js +68 -0
  58. package/dist/cli/src/app/core/findings/{graph.js → bundle/graph.js} +32 -20
  59. package/dist/cli/src/app/core/findings/{own-in-boot.js → bundle/own-in-boot.js} +9 -5
  60. package/dist/cli/src/app/core/findings/{requests.js → bundle/requests.js} +3 -3
  61. package/dist/cli/src/app/core/findings/{shipped.js → bundle/shipped.js} +30 -18
  62. package/dist/cli/src/app/core/findings/compose.js +6 -1
  63. package/dist/cli/src/app/core/findings/effort.js +4 -0
  64. package/dist/cli/src/app/core/findings/finding.types.js +2 -0
  65. package/dist/cli/src/app/core/findings/findings.js +68 -55
  66. package/dist/cli/src/app/core/findings/{assets.js → folder/assets.js} +65 -16
  67. package/dist/cli/src/app/core/findings/{caching.js → folder/caching.js} +17 -10
  68. package/dist/cli/src/app/core/findings/{page.js → folder/page.js} +6 -2
  69. package/dist/cli/src/app/core/findings/{scan.js → folder/scan.js} +37 -13
  70. package/dist/cli/src/app/core/findings/kind-names.js +163 -0
  71. package/dist/cli/src/app/core/findings/{deps.js → supplied/deps.js} +13 -8
  72. package/dist/cli/src/app/core/findings/supplied/forbidden.js +71 -0
  73. package/dist/cli/src/app/core/findings/{situation.js → supplied/situation.js} +2 -2
  74. package/dist/cli/src/app/core/findings/text/causes.js +39 -0
  75. package/dist/cli/src/app/core/findings/text/finding-html.js +33 -0
  76. package/dist/cli/src/app/core/findings/{finding-text.js → text/finding-text.js} +307 -103
  77. package/dist/cli/src/app/core/findings/text/tool-advice.js +97 -0
  78. package/dist/cli/src/app/core/format/format.utils.js +172 -18
  79. package/dist/cli/src/app/core/format/ownership.js +93 -0
  80. package/dist/cli/src/app/core/i18n/en.js +180 -61
  81. package/dist/cli/src/app/core/i18n/es.js +192 -68
  82. package/dist/cli/src/app/core/intake/bundle-graph.js +285 -46
  83. package/dist/cli/src/app/core/intake/dist-files.js +87 -16
  84. package/dist/cli/src/app/core/intake/embedded.js +56 -0
  85. package/dist/cli/src/app/core/intake/unreached.js +139 -0
  86. package/dist/cli/src/app/core/intake/webpack-modules.js +185 -0
  87. package/dist/cli/src/app/core/intake/webpack-stats.js +298 -0
  88. package/dist/cli/src/app/core/project/budget-advice.js +14 -10
  89. package/dist/cli/src/app/core/project/project-context.js +89 -19
  90. package/dist/cli/src/app/core/project/project-name.js +36 -0
  91. package/dist/cli/src/app/core/scan/scan.js +116 -39
  92. package/dist/cli/src/app/core/scan/secrets.js +0 -0
  93. package/dist/cli/src/app/core/situation/situation-text.js +23 -0
  94. package/dist/cli/src/app/core/situation/situation.js +9 -8
  95. package/dist/cli/src/app/core/timing/timing.js +5 -2
  96. package/dist/cli/src/app/core/whatif/defer.js +29 -4
  97. package/dist/cli/src/app/core/whatif/source-importers.js +58 -0
  98. package/dist/cli/src/app/core/whatif/why.js +102 -0
  99. package/dist/cli/src/app/state/report-messages.utils.js +1 -4
  100. package/docs/CONFIG-REFERENCE.md +230 -0
  101. package/docs/CONFIG.md +511 -0
  102. package/docs/HOW-IT-WORKS.md +286 -25
  103. package/loadline.html +26 -24
  104. package/loadline.schema.json +1209 -0
  105. package/package.json +71 -35
  106. package/dist/cli/cli/text.js +0 -180
  107. package/dist/cli/src/app/core/findings/finding-html.js +0 -13
  108. /package/dist/cli/cli/{read-build.types.js → read/read-build.types.js} +0 -0
  109. /package/dist/cli/cli/{render-json.types.js → render/render-json.types.js} +0 -0
  110. /package/dist/cli/cli/{text.types.js → text/text.types.js} +0 -0
  111. /package/dist/cli/src/app/core/analysis/{exclusive.js → graph/exclusive.js} +0 -0
  112. /package/dist/cli/src/app/core/analysis/{insights.types.js → graph/insights.types.js} +0 -0
  113. /package/dist/cli/src/app/core/analysis/{module-graph.js → graph/module-graph.js} +0 -0
  114. /package/dist/cli/src/app/core/analysis/{sourcemap.types.js → sourcemap/sourcemap.types.js} +0 -0
  115. /package/dist/cli/src/app/core/findings/{finding-plain.js → text/finding-plain.js} +0 -0
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TEXT = void 0;
4
- const format_utils_1 = require("../format/format.utils");
4
+ const format_utils_1 = require("../../format/format.utils");
5
5
  const finding_html_1 = require("./finding-html");
6
+ const tool_advice_1 = require("./tool-advice");
6
7
  /** A share as a percentage, for the answers that arrive as a fraction of one. */
7
8
  const pct = (share) => `${Math.round(share * 100)} %`;
8
9
  /**
@@ -17,6 +18,15 @@ exports.TEXT = {
17
18
  es: {
18
19
  /** What the entry through the root is called when the measurement matches no screen. */
19
20
  rootScreen: 'la raíz',
21
+ // The small pieces the lists inside a signal are built from. They were written in English in
22
+ // the modules that build the lists, and `--lang es` printed them in English in the middle of
23
+ // a Spanish sentence.
24
+ andMore: (count) => `y ${count} más`,
25
+ inPage: 'la pide la página',
26
+ each: 'cada uno',
27
+ fileCount: (count) => `${count} ${count === 1 ? 'fichero' : 'ficheros'}`,
28
+ packageBarrelRow: (files, entries, size, inBoot) => `${files} ${files === 1 ? 'fichero entra' : 'ficheros entran'}, ${entries} ${entries === 1 ? 'se importa' : 'se importan'} desde fuera, ${size}${inBoot ? ' (bootstrap)' : ''}`,
29
+ ownBarrelRow: (reexports, pulls, size) => `${reexports} ${reexports === 1 ? 'reexportación' : 'reexportaciones'}, ${pulls} ${pulls === 1 ? 'fichero' : 'ficheros'}, ${size}`,
20
30
  shared: (d) => ({
21
31
  chip: 'código común marcado como lazy',
22
32
  title: `${d.size} que se descargan en ${d.screens} de tus ${d.total} pantallas`,
@@ -33,6 +43,14 @@ exports.TEXT = {
33
43
  ? `, en ${d.routes}, que es donde se carga la pantalla`
34
44
  : ', dentro de un fichero de rutas lazy'}. Un efecto secundario a tener en cuenta: si tienes guards que comparan contra ${(0, finding_html_1.mono)('routeConfig.path')}, deja el guard en la ruta padre, porque al anidar el hijo pasa a tener ${(0, finding_html_1.mono)("path: ''")} y el guard deja de reconocerla.`,
35
45
  }),
46
+ bootSingle: (d) => ({
47
+ chip: 'paquete del arranque con un solo importador',
48
+ title: d.count === 1
49
+ ? `${d.pkg} pesa ${d.size} en el bootstrap y solo lo importa ${d.importer}`
50
+ : `${d.count} paquetes del bootstrap (${d.size}) que importa un solo fichero tuyo cada uno`,
51
+ body: `Lo descarga <strong>toda carga de la aplicación</strong> y entra por un único fichero tuyo, que no es una pantalla. Un solo importador es una dirección: hay un sitio donde decidir si el paquete hace falta antes de pintar o solo cuando ocurre algo —un inicio de sesión, abrir un diálogo, detectar el navegador—. ${d.list}.`,
52
+ fix: `Si no hace falta para el primer pintado, cambia el import estático de ese fichero por un ${(0, finding_html_1.mono)('await import()')} en el método que lo usa: el paquete sale del bootstrap a un chunk propio que se baja la primera vez que se llama. Con un SDK que hay que inicializar (Firebase, Teams), inicialízalo dentro de esa misma función y guarda la promesa para no repetirlo. Si sí hace falta antes de pintar —un tema, una comprobación de sesión al arrancar—, déjalo: entonces esta señal solo informa.`,
53
+ }),
36
54
  commonJs: (d) => ({
37
55
  chip: 'paquete en CommonJS',
38
56
  title: d.count === 1
@@ -63,24 +81,34 @@ exports.TEXT = {
63
81
  body: `Un fichero tuyo de este tamaño suele ser una tabla de constantes —claves de traducción, catálogos, rutas— que entra entera porque se referencia desde todas partes. ${d.list}`,
64
82
  fix: 'Comprueba cuánto es comprimido antes de tocarlo: el texto repetitivo baja mucho y puede no compensar. Si crece con cada entrada nueva, al menos vigílalo con un budget de tamaño.',
65
83
  }),
66
- dupeZone: { boot: 'en el bootstrap', shared: 'en un chunk compartido', own: 'en una sola pantalla' },
67
- dupeCopy: (d) => `<strong>${d.version ? `versión ${d.version}` : d.under ? `copia anidada en ${(0, finding_html_1.mono)(d.under)}` : 'copia principal'}</strong> · ${d.size} · ${d.zone}. ${d.chain ? `Entra por ${d.chain}` : 'No se ha podido seguir desde el punto de entrada'}${d.own ? `; la importa tu código en ${d.own}` : d.via ? `; la importa ${d.via}` : ''}.`,
84
+ // `own` is a lazy chunk at most one screen loads, which includes none: a chunk only another lazy
85
+ // chunk asks for. "In a single screen" was said of mermaid's diagram chunks, which no screen loads.
86
+ dupeZone: {
87
+ boot: 'en el bootstrap',
88
+ shared: 'en un chunk compartido',
89
+ own: 'en diferido, como mucho en una pantalla',
90
+ },
91
+ dupeCopy: (d) => `<strong>${d.version ? `versión ${d.version}` : d.under ? `copia anidada en ${(0, finding_html_1.mono)(d.under)}` : 'copia principal'}</strong> · ${d.size} · ${d.zone}. ${d.chain ? `Entra por ${d.chain}` : 'No se ha podido seguir desde el punto de entrada'}${d.own ? `; la importa tu código en ${d.own}` : d.via ? `; la importa ${d.via}` : ''}${d.pinned ? `; ${d.pinned.parent} la fija a ${d.pinned.range} exacta` : ''}.`,
68
92
  dupes: (d) => ({
69
93
  chip: 'copias duplicadas',
70
94
  title: `${d.count} paquete${d.count > 1 ? 's' : ''} que viaja${d.count > 1 ? 'n' : ''} más de una vez en el bundle`,
71
95
  body: `Se paga el peso dos veces porque dos dependencias piden rangos incompatibles.${d.inBoot
72
96
  ? ' Una de las copias está en el bootstrap, así que ese peso de más lo descarga todo el mundo.'
73
97
  : ''} ${d.list}`,
74
- fix: d.viaDependency
75
- ? `Al menos una de las copias no la pides tú: la importa otra dependencia, así que alinear tu ${(0, finding_html_1.mono)('package.json')} no basta. Fuerza la resolución con ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) o ${(0, finding_html_1.mono)('resolutions')} (yarn), y comprueba que la versión que dejas vale para las dos.`
76
- : `Las dos copias entran por dependencias que pides tú directamente: alinea las versiones en ${(0, finding_html_1.mono)('package.json')} y vuelve a medir.`,
98
+ fix: d.pinnedApart
99
+ ? `<strong>No se puede deduplicar desde tu proyecto</strong>: ${d.pinnedApart} fija su copia a una versión exacta, y la otra va por otra versión mayor. Forzar una sola con ${(0, finding_html_1.mono)('overrides')} o ${(0, finding_html_1.mono)('resolutions')} es meter un cambio de versión mayor dentro de ${d.pinnedApart}, que no se ha publicado contra esa versión. Lo razonable es aceptar la señal y esperar a que ${d.pinnedApart} se actualice${d.pinnedSame ? `; lo de ${d.pinnedSame} va en la misma versión mayor y ahí un override sí puede valer, probándolo` : ''}.`
100
+ : d.viaDependency
101
+ ? `Al menos una de las copias no la pides tú: la importa otra dependencia, así que alinear tu ${(0, finding_html_1.mono)('package.json')} no basta. Fuerza la resolución con ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) o ${(0, finding_html_1.mono)('resolutions')} (yarn), y comprueba que la versión que dejas vale para las dos${d.pinnedSame
102
+ ? `: ${d.pinnedSame} fija su copia a una versión exacta, así que el override cambia una dependencia que esa librería no ha probado`
103
+ : ` —pasa ${(0, finding_html_1.mono)('--lock')} y el informe dirá si alguna está fijada a versión exacta—`}.`
104
+ : `Las dos copias entran por dependencias que pides tú directamente: alinea las versiones en ${(0, finding_html_1.mono)('package.json')} y vuelve a medir.`,
77
105
  }),
78
106
  heavy: (d) => ({
79
107
  chip: d.count === 1 ? 'pantalla cara' : 'pantallas caras',
80
108
  title: d.count === 1
81
109
  ? `${d.label} incluye ${d.own} que no usa nadie más`
82
110
  : `${d.count} pantallas traen mucho más código propio que el resto; la peor es ${d.label} con ${d.own}`,
83
- body: `La pantalla media tiene ${d.median} de código propio. ${d.count === 1 ? 'Esta tiene' : `${d.label} tiene`} ${d.own}, así que trae una librería pesada solo para ella.${d.list ? ` Detrás van ${d.list}.` : ''}`,
111
+ body: `La pantalla media tiene ${d.median} de código propio. ${d.count === 1 ? 'Esta tiene' : `${d.label} tiene`} ${d.own}, así que trae una librería pesada solo para ella.${d.list ? ` Detrás ${d.count === 2 ? 'va' : 'van'} ${d.list}.` : ''}`,
84
112
  fix: 'Si esa librería solo hace falta al abrir algo dentro de la pantalla (un visor, un editor, una gráfica), muévela a un bloque lazy para que no la pague quien solo pasa por ahí. Con varias pantallas en la lista, mira antes si es la misma librería en todas: entonces el arreglo es uno, no cinco.',
85
113
  }),
86
114
  ownInBoot: (d) => ({
@@ -103,15 +131,15 @@ exports.TEXT = {
103
131
  bootWaves: (d) => ({
104
132
  chip: 'el arranque en varias idas y vueltas',
105
133
  title: `La primera carga tarda ${d.waves} idas y vueltas antes de pintar nada`,
106
- body: `Un trozo que ${(0, finding_html_1.mono)('index.html')} nombra —el script de entrada o un ${(0, finding_html_1.mono)('modulepreload')}— se pide de inmediato; uno que no, solo se descubre cuando ha llegado y se ha leído el que lo importa. ${d.count === 1 ? 'Queda 1 trozo del arranque sin nombrar' : `Quedan ${d.count} trozos del arranque sin nombrar`}: ${d.list}. Son los mismos bytes una ida y vuelta más tarde, y caen justo en el momento que paga todo el mundo.${d.count === 1 ? '' : d.next === d.count ? ' Los descubre todos de una vez, así que entre todos cuestan una ida y vuelta, no una cada uno.' : ` De esos, ${d.next === 1 ? '1 se descubre' : `${d.next} se descubren`} en la ida y vuelta siguiente y el resto va detrás: eso es una cadena, y cada nivel cuesta su propio viaje.`}`,
134
+ body: `Un chunk que ${(0, finding_html_1.mono)('index.html')} nombra —el script de entrada o un ${(0, finding_html_1.mono)('modulepreload')}— se pide de inmediato; uno que no, solo se descubre cuando ha llegado y se ha leído el que lo importa. ${d.count === 1 ? 'Queda 1 chunk del arranque sin nombrar' : `Quedan ${d.count} chunks del arranque sin nombrar`}: ${d.list}. Son los mismos bytes una ida y vuelta más tarde, y caen justo en el momento que paga todo el mundo.${d.count === 1 ? '' : d.next === d.count ? ' Los descubre todos de una vez, así que entre todos cuestan una ida y vuelta, no una cada uno.' : ` De esos, ${d.next === 1 ? '1 se descubre' : `${d.next} se descubren`} en la ida y vuelta siguiente y el resto va detrás: eso es una cadena, y cada nivel cuesta su propio viaje.`}`,
107
135
  fix: `${d.critical
108
136
  ? `La cadena que cuesta viajes de verdad es ${d.critical} (${d.criticalBytes}): esos son los que, nombrados en la página, quitan una espera.${d.offPath > 0 ? ` Los otros ${d.offPath} llegan en un viaje que ya se paga de todos modos, así que una etiqueta para ellos no adelanta nada y sí compite por el ancho de banda.` : ''} `
109
- : ''}Nombrar en la página lo que hoy se descubre leyendo es lo que quita la espera, y <strong>la cantidad de etiquetas es parte del coste, no de la solución</strong>. ${d.count === 1 ? 'Aquí es una etiqueta.' : d.next === d.count ? `Aquí hacen falta las ${d.count}: comparten viaje, así que poner algunas y no todas no adelanta nada.` : `Aquí ${d.next === 1 ? 'la del trozo del viaje siguiente acorta' : `las ${d.next} del viaje siguiente acortan`} la cadena en un nivel; llegar a una sola ida y vuelta pide las ${d.count}.`} Casi ningún proyecto las escribe a mano: Angular las escribe para los trozos iniciales y Vite tiene ${(0, finding_html_1.mono)('build.modulePreload')} —si está apagado, esta es la factura—. Lo que no conviene es tomarlo como costumbre: una página con decenas de ${(0, finding_html_1.mono)('modulepreload')} compite por el ancho de banda con el CSS que bloquea el pintado, y hay equipos que han medido el primer pintado <strong>peor</strong> después de añadirlos. Ponlas <strong>después</strong> de los ${(0, finding_html_1.mono)('&lt;link rel="stylesheet"&gt;')}, para que la hoja de estilos no pierda su prioridad, y solo para el arranque: un trozo de una ruta a la que nadie ha navegado todavía se precarga por intención o en reposo, nunca con un ${(0, finding_html_1.mono)('modulepreload')} que paga todo el mundo. Y si resulta que no hacen falta antes de pintar, la otra salida es diferirlos, y entonces la primera carga además pesa menos.`,
137
+ : ''}Nombrar en la página lo que hoy se descubre leyendo es lo que quita la espera, y <strong>la cantidad de etiquetas es parte del coste, no de la solución</strong>. ${d.count === 1 ? 'Aquí es una etiqueta.' : d.next === d.count ? `Aquí hacen falta las ${d.count}: comparten viaje, así que poner algunas y no todas no adelanta nada.` : `Aquí ${d.next === 1 ? 'la del chunk del viaje siguiente acorta' : `las ${d.next} del viaje siguiente acortan`} la cadena en un nivel; llegar a una sola ida y vuelta pide las ${d.count}.`} Casi ningún proyecto las escribe a mano: Angular las escribe para los chunks iniciales y Vite tiene ${(0, finding_html_1.mono)('build.modulePreload')} —si está apagado, esta es la factura—. Lo que no conviene es tomarlo como costumbre: una página con decenas de ${(0, finding_html_1.mono)('modulepreload')} compite por el ancho de banda con el CSS que bloquea el pintado, y hay equipos que han medido el primer pintado <strong>peor</strong> después de añadirlos. Ponlas <strong>después</strong> de los ${(0, finding_html_1.mono)('&lt;link rel="stylesheet"&gt;')}, para que la hoja de estilos no pierda su prioridad, y solo para el arranque: un chunk de una ruta a la que nadie ha navegado todavía se precarga por intención o en reposo, nunca con un ${(0, finding_html_1.mono)('modulepreload')} que paga todo el mundo. Y si resulta que no hacen falta antes de pintar, la otra salida es diferirlos, y entonces la primera carga además pesa menos.`,
110
138
  }),
111
139
  slowScreens: (d) => ({
112
140
  chip: 'profundidad de descubrimiento',
113
141
  title: `${d.worstLabel} tarda ${d.worstWaves} idas y vueltas en estar completa: ${d.worstMs} ms de espera pura`,
114
- body: `El navegador no sabe que un trozo existe hasta que ha descargado y leído el que lo importa, así que una pantalla repartida en varios niveles de importaciones estáticas cuesta esas peticiones <strong>en serie</strong>, pese lo que pese. <strong>El umbral aquí es una fórmula, no un número:</strong> cada ida y vuelta es al menos una latencia, así que ${d.worstWaves} × ${d.latencyMs} ms = ${d.worstMs} ms que ninguna cifra de tamaño enseña. Y vale igual en todos los protocolos: ninguna compresión toca una ida y vuelta, y el multiplexado tampoco, porque lo que limita no es el transporte sino el descubrimiento secuencial. ${d.count === 1 ? 'Una pantalla llega' : `${d.count} pantallas llegan`} en ${d.max} o más: ${d.list}. ${d.worstWidth <= 1
142
+ body: `El navegador no sabe que un chunk existe hasta que ha descargado y leído el que lo importa, así que una pantalla repartida en varios niveles de importaciones estáticas cuesta esas peticiones <strong>en serie</strong>, pese lo que pese. <strong>El umbral aquí es una fórmula, no un número:</strong> cada ida y vuelta es al menos una latencia, así que ${d.worstWaves} × ${d.latencyMs} ms = ${d.worstMs} ms que ninguna cifra de tamaño enseña. Y vale igual en todos los protocolos: ninguna compresión toca una ida y vuelta, y el multiplexado tampoco, porque lo que limita no es el transporte sino el descubrimiento secuencial. ${d.count === 1 ? 'Una pantalla llega' : `${d.count} pantallas llegan`} en ${d.max} o más: ${d.list}. ${d.worstWidth <= 1
115
143
  ? 'Su viaje más ancho trae un solo fichero: es una cadena de punta a punta, y cada nivel que se aplane quita una espera entera.'
116
144
  : `Su viaje más ancho trae ${d.worstWidth} ficheros: profundidad y anchura son problemas distintos y el número de viajes los cuenta igual. Los ${d.worstWidth} de ese viaje cuestan uno entre todos; lo que cuesta viajes es lo que va detrás de ellos.`}`,
117
145
  fix: 'Mira la cadena en la tabla de Pantallas: cada nivel es un fichero que importa a otro de forma estática. Se acorta importando desde la pantalla lo que hoy le llega a través de un intermediario, o —si el bundler lo permite— haciendo que el cargador pida la lista entera de golpe, que es lo que hace Vite con su lista de precarga. No es una cuestión de tamaño: fusionar chunks no la arregla si la cadena sigue teniendo la misma profundidad.',
@@ -133,12 +161,12 @@ exports.TEXT = {
133
161
  fix: 'Los datos se piden con una petición en vez de importarse: sácalos a la carpeta de recursos y tráelos con un fetch. Así se cachean aparte, no retrasan el bootstrap, y cambiarlos no invalida el JavaScript. Si de verdad hacen falta antes de pintar, al menos que no se descarguen junto a todo lo demás.',
134
162
  }),
135
163
  unreachable: (d) => ({
136
- chip: d.most ? 'la mayor parte del build no entra en el informe' : 'trozos que el informe no alcanza',
164
+ chip: d.most ? 'la mayor parte del build no entra en el informe' : 'chunks que el informe no alcanza',
137
165
  title: d.most
138
- ? `${d.count} de tus ${d.total} trozos (${d.size}) no salen en ningún número de aquí`
139
- : `${d.count} trozo${d.count > 1 ? 's' : ''} (${d.size}) que no alcanza nada desde la entrada`,
140
- body: `Nada de lo que se llega desde donde arranca la aplicación importa ${d.count > 1 ? 'estos ficheros' : 'este fichero'}, ni de forma estática ni diferida: ${d.list}. Puede ser <strong>el lado servidor</strong> de un build con render —una compilación escribe los dos lados en el mismo ${(0, finding_html_1.mono)('stats.json')}, y sin la carpeta no hay forma de saber cuál es cuál—, un service worker —que no es parte de la primera carga—, un ${(0, finding_html_1.mono)('import()')} cuya ruta se construye en tiempo de ejecución —VitePress escribe uno por página, y entonces esto es casi todo el sitio— o lo que dejó una compilación anterior en una carpeta que nadie limpia.`,
141
- fix: `Si tu aplicación tiene render en servidor, suelta también la carpeta del navegador —${(0, finding_html_1.mono)('--dist')} en el comando— y los dos lados se separan solos: sin ella el informe puede estar describiendo el bundle del servidor, que suele ser el más grande de los dos. Si son service workers, no hay nada que hacer. Si el sitio genera una página por ruta, esos trozos se descargan al navegar y este informe solo describe lo que alcanza la entrada: léelo como lo que cuesta entrar, no como el tamaño del sitio. Y si no es ninguna, limpia la carpeta antes de compilar: los restos son peso muerto en el servidor y hacen que todas las cifras de aquí se queden cortas.`,
166
+ ? `${d.count} de tus ${d.total} chunks (${d.size}) no salen en ningún número de aquí`
167
+ : `${d.count} chunk${d.count > 1 ? 's' : ''} (${d.size}) que no alcanza nada desde la entrada`,
168
+ body: `Nada de lo que se llega desde donde arranca la aplicación importa ${d.count > 1 ? 'estos ficheros' : 'este fichero'}, ni de forma estática ni diferida: ${d.list}. Puede ser ${d.folder ? '' : `<strong>el lado servidor</strong> de un build con render —una compilación escribe los dos lados en el mismo ${(0, finding_html_1.mono)('stats.json')}, y sin la carpeta no hay forma de saber cuál es cuál—, `}un service worker —que no es parte de la primera carga—, un ${(0, finding_html_1.mono)('import()')} cuya ruta se construye en tiempo de ejecución —VitePress escribe uno por página, y entonces esto es casi todo el sitio— o lo que dejó una compilación anterior en una carpeta que nadie limpia.`,
169
+ fix: `${d.folder ? '' : `Si tu aplicación tiene render en servidor, suelta también la carpeta del navegador —${(0, finding_html_1.mono)('--dist')} en el comando— y los dos lados se separan solos: sin ella el informe puede estar describiendo el bundle del servidor, que suele ser el más grande de los dos. `}Si son service workers, no hay nada que hacer. Tampoco si son una librería copiada tal cual desde la carpeta ${(0, finding_html_1.mono)('public/')} que un script carga en tiempo de ejecución por su URL —un editor de texto enriquecido, un visor de PDF—: nada las importa, llegan cuando ese código las pide. Si el sitio genera una página por ruta, esos chunks se descargan al navegar y este informe solo describe lo que alcanza la entrada: léelo como lo que cuesta entrar, no como el tamaño del sitio. Y si no es ninguna, limpia la carpeta antes de compilar: los restos son peso muerto en el servidor y hacen que todas las cifras de aquí se queden cortas.`,
142
170
  }),
143
171
  prefetched: (d) => ({
144
172
  chip: 'pantallas que se piden antes de que nadie las abra',
@@ -152,19 +180,21 @@ exports.TEXT = {
152
180
  ? `Tus ${d.unnamed} pantallas salen con el nombre de su chunk, así que la tabla de arriba no se puede leer`
153
181
  : 'Esta carpeta no trae ficheros .map, y eso recorta el informe',
154
182
  body: `${d.unnamed > 0 ? `Cada fila de la tabla de pantallas es un hash de contenido —${(0, finding_html_1.mono)('chunk-Brh4_81T')} en vez de ${(0, finding_html_1.mono)('orders')}— porque esta carpeta no trae ficheros ${(0, finding_html_1.mono)('.map')}. Las cifras de al lado son correctas; qué pantalla es cada una, este informe no lo puede decir. ` : ''}Sin ellos se sabe lo que pesa cada chunk y no lo que hay dentro: las pantallas salen con el nombre de su fichero de chunk —${(0, finding_html_1.mono)('0fPdmq0U.js')} en vez de ${(0, finding_html_1.mono)('orders')}— y no hay desglose por paquete ni cadena desde la entrada. Los tamaños, las pantallas, los chunks compartidos y las idas y vueltas sí salen enteros.`,
155
- fix: `Compila con source maps —${(0, finding_html_1.mono)('sourcemap: true')} en Vite, ${(0, finding_html_1.mono)('"sourceMap": true')} en Angular— y vuelve a soltar la carpeta; no hace falta desplegarlos. Con Angular 17 o posterior, soltar además el ${(0, finding_html_1.mono)('stats.json')} de ${(0, finding_html_1.mono)('ng build --stats-json')} da lo mismo sin compilar dos veces.`,
183
+ fix: `Compila con source maps —${(0, tool_advice_1.mapsOn)(d.tool, 'es')}— y vuelve a soltar la carpeta; no hace falta desplegarlos.${(0, tool_advice_1.mayBeAngular)(d.tool) ? ` Con Angular 17 o posterior, soltar además el ${(0, finding_html_1.mono)('stats.json')} de ${(0, finding_html_1.mono)('ng build --stats-json')} da lo mismo sin compilar dos veces.` : d.tool?.bundler === 'webpack' ? ` Soltar además el ${(0, finding_html_1.mono)('stats.json')} de webpack da lo mismo sin compilar dos veces.` : ''}`,
156
184
  }),
157
185
  splitDrift: (d) => ({
158
186
  chip: 'el desglose no cuadra con el fichero',
159
187
  title: `El desglose por fichero suma un ${d.percent} % de lo que pesan los chunks que describe`,
160
- body: `Hay dos medidas del mismo chunk y tendrían que dar lo mismo: lo que pesa el fichero (${d.file}) y lo que suman los pesos por fichero de dentro (${d.measured}), sobre ${d.chunks === 1 ? '1 chunk' : `${d.chunks} chunks`}. No lo dan, así que lo que el ${(0, finding_html_1.mono)('stats.json')} dice que hay dentro de un chunk no es una descripción del fichero que se sirve. <strong>Por qué difieren no se sabe desde aquí</strong> —algo cambió la salida después de escribirlo— y no hace falta saberlo para leer la consecuencia. Las cifras de arriba —el arranque, cada pantalla, las idas y vueltas— salen del fichero y son exactas. Las que se miden <strong>dentro</strong> de un chunk —el reparto por paquete, la columna exclusiva, lo que ahorraría un ${(0, finding_html_1.mono)('--what-if')}— salen de esta suma, así que van un ${d.off} % ${d.high ? 'altas' : 'bajas'}.`,
161
- fix: `Compila con source maps —${(0, finding_html_1.mono)('"sourceMap": true')} en Angular, ${(0, finding_html_1.mono)('sourcemap: true')} en Vite— y suelta la carpeta: cuando hay ${(0, finding_html_1.mono)('.map')} el reparto se mide sobre el fichero generado y esta diferencia desaparece. No hace falta desplegarlos. Mientras tanto, léelas como una cota superior: el orden de la lista es correcto —todas están infladas igual— y la cifra absoluta no lo es.`,
188
+ body: `Hay dos medidas del mismo chunk y tendrían que dar lo mismo: lo que pesa el fichero (${d.file}) y lo que suman los pesos por fichero de dentro (${d.measured}), sobre ${d.chunks === 1 ? '1 chunk' : `${d.chunks} chunks`}. No lo dan, así que lo que el ${(0, finding_html_1.mono)('stats.json')} dice que hay dentro de un chunk no es una descripción del fichero que se sirve. ${d.angular
189
+ ? '<strong>La causa es el optimizador de chunks de Angular</strong>: después de esbuild vuelve a empaquetar los chunks con Rolldown y reescribe el peso de cada fichero como la longitud de ese paso repartida en proporción, antes de la minificación final. Por eso las partes suman más que el fichero, y en la misma proporción en todos. No son las hojas de estilos de los componentes: esas van dentro del JavaScript y ya están en el peso del fichero.'
190
+ : '<strong>Por qué difieren no se sabe desde aquí</strong> —algo cambió la salida después de escribirlo— y no hace falta saberlo para leer la consecuencia.'} Las cifras de arriba —el arranque, cada pantalla, las idas y vueltas— salen del fichero y son exactas. Las que se miden <strong>dentro</strong> de un chunk —el reparto por paquete, la columna exclusiva, lo que ahorraría un ${(0, finding_html_1.mono)('--what-if')}— salen de esta suma, así que van un ${d.off} % ${d.high ? 'altas' : 'bajas'}.`,
191
+ fix: `Compila con source maps —${(0, tool_advice_1.mapsOn)(d.tool, 'es')}— y suelta la carpeta: cuando hay ${(0, finding_html_1.mono)('.map')} el reparto se mide sobre el fichero generado y esta diferencia desaparece. No hace falta desplegarlos. Mientras tanto, léelas como una cota superior: el orden de la lista es correcto —todas están infladas igual— y la cifra absoluta no lo es.`,
162
192
  }),
163
193
  sourceMaps: (d) => ({
164
194
  chip: 'source maps en la carpeta',
165
195
  title: `La carpeta de build trae ${d.count === 1 ? '1 source map' : `${d.count} source maps`}`,
166
196
  body: 'Un source map reconstruye tu fuente a partir de lo compilado. No pesa en la descarga —el navegador solo lo pide si abres las herramientas—, pero si esta carpeta es la que subes, cualquiera que conozca la URL tiene tu código.',
167
- fix: `Con ${(0, finding_html_1.mono)('"sourceMap": { "scripts": true, "hidden": true }')} se generan sin enlazarlos desde el bundle, que es lo que quieres para subirlos a tu herramienta de errores. Que el bundle deje de enlazarlos no impide que el servidor los siga sirviendo: si los .map acaban en el servidor, siguen ahí para quien conozca la URL.`,
197
+ fix: `Con ${(0, tool_advice_1.mapsHidden)(d.tool, 'es')} se generan sin enlazarlos desde el bundle, que es lo que quieres para subirlos a tu herramienta de errores. Que el bundle deje de enlazarlos no impide que el servidor los siga sirviendo: si los .map acaban en el servidor, siguen ahí para quien conozca la URL.`,
168
198
  }),
169
199
  clean: (d) => ({
170
200
  chip: 'sin señales',
@@ -226,13 +256,13 @@ exports.TEXT = {
226
256
  chip: 'tipografías',
227
257
  title: d.superseded === ''
228
258
  ? `${d.size} de tipografías: ${d.files} ficheros en ${d.families} ${d.families === 1 ? 'familia' : 'familias'}`
229
- : `${d.size} de tipografías, y algunas viajan dos veces en dos formatos`,
259
+ : `${d.size} de tipografías en el servidor, ${d.spare} de ellos en un segundo formato que ningún navegador actual descarga`,
230
260
  body: `Ningún analizador de bundle enseña esto porque todos paran en el JavaScript, y siete pesos de una familia para usar dos es un hallazgo de trescientos kilobytes. ${d.list}.${d.superseded ? ` En un formato que otro de la misma carpeta ya sustituye: ${d.superseded}.` : ''}${d.preloaded ? ` La página precarga ${d.preloaded}, así que esos entran en la primera carga.` : ''}`,
231
- fix: `Cuenta los pesos que la interfaz usa de verdad —normalmente son dos, regular y bold— y borra el resto de la configuración de fuentes. Si hay un ${(0, finding_html_1.mono)('.woff2')} al lado de un ${(0, finding_html_1.mono)('.ttf')} de la misma cara, el segundo solo lo necesita un navegador que ya no usa nadie: quítalo de la lista de formatos. Y precarga solo lo que hace falta antes de pintar: un ${(0, finding_html_1.mono)('preload')} por peso convierte la lista entera en primera carga.`,
261
+ fix: `Cuenta los pesos que la interfaz usa de verdad —normalmente son dos, regular y bold— y borra el resto de la configuración de fuentes. Salvo que sean subconjuntos ${(0, finding_html_1.mono)('unicode-range')} de un mismo peso —decenas de ficheros de una familia suelen serlo, como los de una fuente china—: esos los pide el navegador solo para los caracteres que hay en pantalla, y ahí no sobra ninguno. Si hay un ${(0, finding_html_1.mono)('.woff2')} al lado de un ${(0, finding_html_1.mono)('.ttf')} de la misma cara, el segundo solo lo necesita un navegador que ya no usa nadie: quítalo de la lista de formatos. Y precarga solo lo que hace falta antes de pintar: un ${(0, finding_html_1.mono)('preload')} por peso convierte la lista entera en primera carga.`,
232
262
  }),
233
263
  media: (d) => ({
234
264
  chip: 'imágenes y vídeo',
235
- title: `${d.size} en ${d.count} ${d.count === 1 ? 'fichero' : 'ficheros'} de imagen o vídeo${d.inPage > 0 ? `, ${d.inPage} de ellos pedidos por la página` : ''}`,
265
+ title: `${d.size} en ${d.count} ${d.count === 1 ? 'fichero' : 'ficheros'} de imagen o vídeo${d.inPage > 0 ? `, ${d.inPage === 1 ? 'uno de ellos pedido' : `${d.inPage} de ellos pedidos`} por la página` : ''}`,
236
266
  body: `Aquí no se recomprime nada: prometer «esto en AVIF pesaría 310 kB» sería inventarse una cifra. Se dice lo que pesa, en qué formato llega y si el ${(0, finding_html_1.mono)('index.html')} lo pide de entrada.${d.outdated > 0
237
267
  ? ` ${d.outdated === 1 ? 'Un fichero llega' : `${d.outdated} ficheros llegan`} en un formato antiguo teniendo el moderno al lado en la misma carpeta: ${d.outdatedList}.`
238
268
  : ''} ${d.list}.`,
@@ -240,15 +270,27 @@ exports.TEXT = {
240
270
  }),
241
271
  duplicateAssets: (d) => ({
242
272
  chip: 'el mismo fichero con dos nombres',
243
- title: `${d.size} en ${d.count === 1 ? 'un fichero que viaja' : `${d.count} ficheros que viajan`} dos veces con nombres distintos`,
244
- body: `El contenido es idéntico byte a byte —se ha comparado, no se ha supuesto por el tamaño— y aun así son entradas de caché separadas, así que quien visita la página los descarga los dos. ${d.list}.`,
245
- fix: 'Casi siempre es el mismo recurso importado desde dos sitios con rutas distintas, o una copia que quedó de una migración. Unifica el import y borra la copia. Si los dos nombres los genera el build, mira si un plugin está copiando la carpeta de recursos además de procesarla.',
273
+ ...(d.count > 0
274
+ ? {
275
+ title: `${d.size} en ${d.count === 1 ? 'un fichero que viaja' : `${d.count} ficheros que viajan`} dos veces con nombres distintos`,
276
+ body: `El contenido es idéntico byte a byte —se ha comparado, no se ha supuesto por el tamaño— y aun así son entradas de caché separadas, así que quien visita la página los descarga los dos. ${d.list}.${d.stored.count > 0 ? ` Aparte, guardados dos veces y descargados una como mucho, porque nada nombra la otra copia: ${d.stored.list}.` : ''}`,
277
+ fix: 'Casi siempre es el mismo recurso importado desde dos sitios con rutas distintas, o una copia que quedó de una migración. Unifica el import y borra la copia. Si los dos nombres los genera el build, mira si un plugin está copiando la carpeta de recursos además de procesarla.',
278
+ }
279
+ : {
280
+ title: `${d.stored.size} en ${d.stored.count === 1 ? 'un fichero' : `${d.stored.count} ficheros`} que la carpeta guarda dos veces y la página descarga una como mucho`,
281
+ body: `El contenido es idéntico byte a byte —se ha comparado, no se ha supuesto por el tamaño—, pero ${d.stored.none ? 'ni la página ni el código nombran ninguna de las copias' : 'la página y el código nombran solo una de las copias'}, y una copia que nada nombra no se descarga salvo que algo construya su URL al ejecutarse: esto cuesta espacio donde se despliega, no tiempo en la visita. ${d.stored.list}.`,
282
+ fix: 'En la visita no hay nada que ahorrar. Si el build escribe los dos nombres a propósito —hay herramientas que escriben un fichero con su nombre y otra vez con un hash—, déjalo; si no, borra la copia que nada nombra.',
283
+ }),
246
284
  }),
247
285
  unreferencedAssets: (d) => ({
248
286
  chip: 'ficheros que no alcanza nadie',
249
287
  title: `${d.size} en ${d.count === 1 ? '1 fichero que no nombra' : `${d.count} ficheros que no nombra`} ni el HTML, ni el CSS, ni ningún chunk`,
250
- body: `Es la misma idea que la señal de trozos inalcanzables, un nivel más afuera: se ha buscado cada nombre de fichero en el texto de los demás y estos no salen en ninguno. En una carpeta que nadie limpia suele haber megabytes de despliegues anteriores. ${d.list}.`,
251
- fix: `Antes de borrar nada, ten en cuenta lo que esta búsqueda no ve: una ruta construida en tiempo de ejecución (${(0, finding_html_1.mono)('/assets/ + name + .png')}), un fichero que pide el service worker o algo que referencia el servidor y no el bundle. Lo que quede después de descartar eso son restos: limpia la carpeta antes de compilar, porque ocupan sitio en el servidor y ensucian cualquier medida de la carpeta.`,
288
+ body: `Es la misma idea que la señal de chunks inalcanzables, un nivel más afuera: se ha buscado cada nombre de fichero en el texto de los demás y estos no salen en ninguno.${d.fromRepo > 0
289
+ ? ` <strong>${d.fromRepo === d.count ? (d.count === 1 ? 'No es un resto' : 'No son restos') : `${d.fromRepo} de ${d.count} no son restos`} de un despliegue anterior</strong>: ${d.verified ? (d.fromRepo === 1 ? 'está en' : 'están en') : d.fromRepo === 1 ? 'sale de' : 'salen de'} ${d.folders}, la carpeta que ${(0, finding_html_1.mono)('angular.json')} copia tal cual en cada build${d.verified ? '' : ' (según su configuración de assets)'}, y Angular vacía la carpeta de salida antes de compilar.`
290
+ : ' En una carpeta que nadie limpia suele haber megabytes de despliegues anteriores.'} ${d.list}.`,
291
+ fix: d.fromRepo > 0
292
+ ? `Antes de borrar nada, descarta lo que esta búsqueda no ve: una ruta construida en tiempo de ejecución (${(0, finding_html_1.mono)('/assets/ + name + .png')}), un fichero que pide el service worker, el manifiesto o el servidor, o una imagen que solo se enlaza desde fuera (${(0, finding_html_1.mono)('og:image')}, un correo). Lo que quede después, <strong>bórralo del repositorio</strong> —de ${d.folders}—: limpiar la carpeta de build no sirve, porque el siguiente build lo vuelve a copiar.`
293
+ : `Antes de borrar nada, ten en cuenta lo que esta búsqueda no ve: una ruta construida en tiempo de ejecución (${(0, finding_html_1.mono)('/assets/ + name + .png')}), un fichero que pide el service worker o algo que referencia el servidor y no el bundle. Lo que quede después de descartar eso son restos: limpia la carpeta antes de compilar, porque ocupan sitio en el servidor y ensucian cualquier medida de la carpeta.`,
252
294
  }),
253
295
  inlinedData: (d) => ({
254
296
  chip: 'ficheros incrustados como data URI',
@@ -260,7 +302,7 @@ exports.TEXT = {
260
302
  updateWeight: (d) => ({
261
303
  chip: 'peso de la actualización',
262
304
  title: `Quien ya tenía la versión anterior descarga ${d.size} (el ${d.pct} % del build)`,
263
- body: `Esta es la mitad del coste real que no mira nadie: casi todas las visitas a una aplicación en marcha son de alguien que ya tenía la versión de ayer, y lo que descarga no es el bundle, es lo que ha cambiado de nombre. Una visita nueva descarga ${d.fresh}. ${d.reused} ficheros conservan su nombre y no se piden otra vez. Cambian o entran ${d.count}: ${d.list}.${d.removed ? ` Y desaparecen ${d.removed}.` : ''}${d.carried > 0 && d.roots > 0
305
+ body: `Esta es la mitad del coste real que no mira nadie: casi todas las visitas a una aplicación en marcha son de alguien que ya tenía la versión de ayer, y lo que descarga no es el bundle, es lo que ha cambiado de nombre. Una visita nueva descarga ${d.fresh}. ${d.reused === 1 ? '1 fichero conserva su nombre y no se pide' : `${d.reused} ficheros conservan su nombre y no se piden`} otra vez. Cambian o entran ${d.count}: ${d.list}.${d.removed ? ` Y desaparecen ${d.removed}.` : ''}${d.carried > 0 && d.roots > 0
264
306
  ? ` <strong>De los que cambian, ${d.roots === 1 ? 'solo 1 no nombra' : `solo ${d.roots} no nombran`} a ningún otro que también cambiara (${d.rootSize}): ${d.rootList}.</strong> Ahí cayó la edición. ${d.carried === 1 ? 'El otro lleva' : `Los otros ${d.carried} llevan`} dentro el nombre con hash de alguno de esos, así que ${d.carried === 1 ? 'su hash se movió' : 'sus hashes se movieron'} sin que su contenido tuviera por qué: ${d.carriedSize} de cascada. Sin ella este despliegue habría costado ${d.rootSize}.`
265
307
  : d.carried > 0
266
308
  ? ` <strong>En cuál de ellos cayó la edición no se puede decir desde aquí.</strong> Todos los ficheros que cambiaron llevan dentro el nombre con hash de otro que también cambió, así que el grafo de nombres entre ellos se cierra sobre sí mismo y no queda ninguno cuyo hash solo se pueda haber movido por su propio contenido. Eso no es un hueco en la lectura, es la forma: es lo que se ve cuando hay un eje del que los chunks diferidos vuelven a importar, que es el reparto por defecto de Vite y de Rollup y lo que mide la señal de cascada de más abajo. Así que los ${d.carriedSize} son el coste de un despliegue y el reparto entre la edición y su consecuencia no está disponible —que no es lo mismo que decir que la edición no pesa nada—.`
@@ -279,24 +321,58 @@ exports.TEXT = {
279
321
  ? `${d.name} es ${d.pct} % código de terceros y se invalida con cada cambio tuyo`
280
322
  : `${d.count} chunks mezclan dependencias y código tuyo: ${d.size} se reinvalidan en cada despliegue`,
281
323
  body: `Las dependencias no cambian en meses y tu código cambia a diario. Un chunk que junta las dos cosas cambia de hash cada vez que tocas una línea, y todo lo que lleva dentro de terceros se vuelve a descargar para nada.${d.inBoot ? ' Y está en el bootstrap, así que lo paga toda visita de vuelta.' : ''} ${d.list}.`,
282
- fix: `Sepáralos: en Rollup y Vite con una regla de ${(0, finding_html_1.mono)('manualChunks')} que mande todo lo de ${(0, finding_html_1.mono)('node_modules')} a su propio chunk; Angular ya lo hace por defecto y si aquí sale algo, mira si un import estático está arrastrando una dependencia a un chunk tuyo. Ojo con el extremo contrario: un único chunk de vendor gigantesco se invalida entero cuando actualizas una sola librería, así que lo que se busca es separar por frecuencia de cambio, no por origen.`,
324
+ fix: `Sepáralos: ${(0, tool_advice_1.webpackSplit)(d.tool, 'es')}en Rollup y Vite con una regla de ${(0, finding_html_1.mono)('manualChunks')} que mande todo lo de ${(0, finding_html_1.mono)('node_modules')} a su propio chunk; el application builder de Angular no tiene esa regla ni una opción para ella: separa por quién importa qué, así que un servicio tuyo que importan todas las pantallas acaba en el mismo chunk que el framework —lo que hay que buscar es justo eso, un fichero tuyo que importa todo el mundo, y lo que lo saca es importarlo desde menos sitios—. Ojo con el extremo contrario: un único chunk de vendor gigantesco se invalida entero cuando actualizas una sola librería, así que lo que se busca es separar por frecuencia de cambio, no por origen.`,
283
325
  }),
284
326
  unhashable: (d) => ({
285
327
  chip: 'nombres que no se pueden cachear',
286
328
  title: d.query === ''
287
329
  ? `${d.count} ${d.count === 1 ? 'fichero no lleva' : 'ficheros no llevan'} hash en el nombre`
288
330
  : `Hay ficheros con la versión en la query (${d.query}): se revalidan en cada visita`,
289
- body: `Un fichero sin hash en el nombre no se puede cachear para siempre: el navegador tiene que preguntar si ha cambiado en cada visita, y esa pregunta cuesta una ida y vuelta aunque la respuesta sea que no. ${d.inPage > 0 ? `${d.inPage} de ellos los pide la página de entrada (${d.size}).` : 'Ninguno lo pide la página de entrada.'} ${d.list}.`,
331
+ body: `Un fichero sin hash en el nombre no se puede cachear para siempre: el navegador tiene que preguntar si ha cambiado en cada visita, y esa pregunta cuesta una ida y vuelta aunque la respuesta sea que no. ${d.inPage > 0 ? `${d.inPage === 1 ? 'Uno de ellos lo pide' : `${d.inPage} de ellos los pide`} la página de entrada (${d.size}).` : 'Ninguno lo pide la página de entrada.'} ${d.list}.`,
290
332
  fix: `Casi siempre es informativo: un ${(0, finding_html_1.mono)('favicon.ico')} o un ${(0, finding_html_1.mono)('manifest.webmanifest')} no llevan hash y no hace falta que lo lleven. Cuando salta por algo grande que pide la página, ponle hash en el nombre desde la configuración del build. La versión en la query (${(0, finding_html_1.mono)('?v=3')}) es el caso que casi siempre es un error: cambia la URL de todos los ficheros a la vez en cada despliegue, que es justo lo contrario de lo que hace un hash por fichero.`,
291
333
  }),
292
334
  // --- lo que dice leer el texto del build (IDEAS §F) ---
335
+ secretBenign: {
336
+ firebaseConfig: 'configuración web de Firebase: pública por diseño',
337
+ envDefined: 'la propia compilación define process.env',
338
+ },
339
+ // Said in words, not as the internal kind: "Tipos: privateKey" was the report's own variable.
340
+ secretNames: {
341
+ privateKey: 'clave privada',
342
+ awsKey: 'clave de AWS',
343
+ googleKey: 'clave de Google',
344
+ githubToken: 'token de GitHub',
345
+ slackToken: 'token de Slack',
346
+ jwt: 'JWT',
347
+ internalUrl: 'dirección interna',
348
+ envLeftover: 'variable de entorno sin sustituir',
349
+ },
350
+ leftoverNames: {
351
+ nodeEnv: 'comprobación de NODE_ENV',
352
+ reactDev: 'React de desarrollo',
353
+ testFiles: 'ficheros de test',
354
+ devServer: 'cliente del servidor de desarrollo',
355
+ consoleLogs: 'console.log',
356
+ debugger: 'debugger',
357
+ },
358
+ secretOwner: (pkg) => `es código de ${pkg}`,
293
359
  secrets: (d) => ({
294
- chip: 'secretos o direcciones internas en el bundle',
360
+ chip: d.open > 0
361
+ ? 'secretos o direcciones internas en el bundle'
362
+ : 'cadenas con forma de secreto, explicadas',
295
363
  title: d.serious > 0
296
- ? `${d.serious === 1 ? 'Una credencial con forma de credencial viaja' : `${d.serious} credenciales con forma de credencial viajan`} en el bundle`
297
- : `${d.count} ${d.count === 1 ? 'coincidencia' : 'coincidencias'} de secreto o dirección interna en el bundle`,
298
- body: `Cada patrón de aquí identifica un formato concreto por su prefijo y su longitud —${(0, finding_html_1.mono)('AKIA')} y dieciséis caracteres es una clave de AWS y no otra cosa—, a propósito: no hay ninguna regla del tipo «cadena larga cerca de la palabra key», que es la que encuentra las de verdad y también cien nombres de variable minificados. Tipos: ${d.kinds}. Nada se imprime entero: este informe se pega en incidencias, y una herramienta que imprime una clave viva la ha publicado por segunda vez. ${d.list}.`,
299
- fix: `Si alguna es real, lo primero es <strong>rotarla</strong>, no borrarla del código: lo que está desplegado ya lo tiene cualquiera que sepa la URL, y quitarla del siguiente build no revoca nada. Después, mira cómo entró: casi siempre es un ${(0, finding_html_1.mono)('.env')} que el bundler incrusta porque la variable no empieza por el prefijo público del framework, o una constante de configuración con la clave de servidor en vez de la de cliente. Una dirección interna no es una credencial pero sí es topología: dice qué hay dentro y cómo se llama.`,
364
+ ? `${d.serious === 1 ? 'Una credencial de formato reconocible viaja' : `${d.serious} credenciales de formato reconocible viajan`} en el bundle`
365
+ : d.open > 0
366
+ ? `${d.open} ${d.open === 1 ? 'coincidencia sin explicar' : 'coincidencias sin explicar'} de secreto o dirección interna en el bundle (${d.openKinds})${d.publicKeys > 0 ? ': la clave pública de Firebase no es lo que sube el nivel' : ''}`
367
+ : `${d.count} ${d.count === 1 ? 'cadena con forma de secreto que no lo es' : 'cadenas con forma de secreto que no lo son'}`,
368
+ body: `Cada patrón de aquí identifica un formato concreto por su prefijo y su longitud —${(0, finding_html_1.mono)('AKIA')} y dieciséis caracteres es una clave de AWS y no otra cosa—, a propósito: no hay ninguna regla del tipo «cadena larga cerca de la palabra key». Tipos: ${d.kinds}.${d.publicKeys > 0
369
+ ? ` <strong>${d.publicKeys === 1 ? 'La clave de Google es' : `${d.publicKeys} de las claves de Google son`} el ${(0, finding_html_1.mono)('apiKey')} de una configuración web de Firebase</strong>: ${d.publicKeys === 1 ? 'está' : 'están'} junto a ${(0, finding_html_1.mono)('authDomain')}, ${(0, finding_html_1.mono)('projectId')} o ${(0, finding_html_1.mono)('messagingSenderId')}. Esa clave identifica el proyecto ante Google y la lleva toda aplicación web con Firebase; no da acceso a nada por sí sola, así que no es una filtración.`
370
+ : ''}${d.theirs
371
+ ? ` Los ${(0, finding_html_1.mono)('process.env')} que quedan son de ${d.theirs}: es el paquete leyendo su propio interruptor, no una variable tuya que el build no sustituyó, y en el navegador se queda en ${(0, finding_html_1.mono)('undefined')}.`
372
+ : ''} Nada se imprime entero: este informe se pega en incidencias, y una herramienta que imprime una clave viva la ha publicado por segunda vez. ${d.list}.`,
373
+ fix: d.open > 0
374
+ ? `Si alguna es real, lo primero es <strong>rotarla</strong>, no borrarla del código: lo que está desplegado ya lo tiene cualquiera que sepa la URL, y quitarla del siguiente build no revoca nada. Después, mira cómo entró: casi siempre es un ${(0, finding_html_1.mono)('.env')} que el bundler incrusta porque la variable no empieza por el prefijo público del framework, o una constante de configuración con la clave de servidor en vez de la de cliente. Una dirección interna no es una credencial pero sí es topología: dice qué hay dentro y cómo se llama.`
375
+ : `No hay nada que rotar.${d.publicKeys > 0 ? ' Lo que protege los datos de Firebase son las reglas de seguridad y App Check, no la clave: comprueba que las reglas no estén abiertas y, si quieres, restringe la clave a tus dominios en la consola de Google Cloud.' : ''}${d.theirs ? ` Lo que lee ${d.theirs} no es tuyo: si molesta, ${(0, finding_html_1.mono)('define')} en el build puede fijar esa variable, y en el navegador no cambia nada.` : ''}`,
300
376
  }),
301
377
  devLeftovers: (d) => ({
302
378
  chip: d.unattributed ? 'marcas de desarrollo en la compilación' : 'restos de desarrollo en producción',
@@ -308,7 +384,7 @@ exports.TEXT = {
308
384
  body: `${d.broken
309
385
  ? 'La compilación de desarrollo de una librería no está minificada, lleva los avisos dentro y pesa varias veces lo que la de producción. Antes de mirar ninguna cifra de aquí: esta no es la carpeta que se despliega, o el pipeline está compilando con la configuración equivocada.'
310
386
  : d.unattributed
311
- ? `Estos chunks no llevan mapa de fuentes al lado, así que la posición de cada coincidencia no se puede devolver al fichero donde se escribió — y un ${(0, finding_html_1.mono)('console.log')} tuyo es idéntico al que hay dentro de ${(0, finding_html_1.mono)('@angular/core')}, que publica un servicio de consola y mete uno en todas las compilaciones de Angular que existen. Las coincidencias son reales; de quién son, aquí no se sabe.`
387
+ ? `Estos chunks no llevan mapa de fuentes al lado, así que la posición de cada coincidencia no se puede devolver al fichero donde se escribió — y un ${(0, finding_html_1.mono)('console.log')} tuyo es idéntico al de cualquier librería${(0, tool_advice_1.mayBeAngular)(d.tool) ? `, como el que hay dentro de ${(0, finding_html_1.mono)('@angular/core')}, que publica un servicio de consola y mete uno en todas las compilaciones de Angular que existen` : ''}. Las coincidencias son reales; de quién son, aquí no se sabe.`
312
388
  : 'Ninguno de estos rompe nada por sí solo, pero todos son cosas que nadie quiso desplegar. Cada uno se ha seguido por los mapas de fuentes hasta un fichero tuyo, así que ninguno es de tu framework.'} ${d.list}.`,
313
389
  fix: d.broken
314
390
  ? 'El arreglo es anterior a todo lo demás: compila con la configuración de producción y vuelve a medir, porque ninguna cifra de este informe describe lo que descargan tus usuarios.'
@@ -319,8 +395,8 @@ exports.TEXT = {
319
395
  sourceExposed: (d) => ({
320
396
  chip: 'tu código fuente está publicado',
321
397
  title: `${d.files} ficheros de tu código fuente se reconstruyen desde los ${d.maps} source maps de esta carpeta`,
322
- body: `El informe ya avisaba de que los ${(0, finding_html_1.mono)('.map')} están aquí, y esa frase se ignora porque suena a detalle de configuración. Esto es lo mismo dicho de forma que no se pueda ignorar: los mapas llevan el texto original dentro, así que cualquiera que conozca la URL tiene tus ficheros, tus rutas internas y tus comentarios.${d.env > 0 ? ` Dentro hay ${d.env} referencias a variables de entorno.` : ''} Rutas: ${d.list}.`,
323
- fix: `Si esta es la carpeta que subes, o no despliegas los mapas o los generas con ${(0, finding_html_1.mono)('"sourceMap": { "scripts": true, "hidden": true }')} y los subes solo a tu herramienta de errores. Ten en cuenta que dejar de enlazarlos desde el bundle no impide que el servidor los siga sirviendo: si los ficheros acaban en el servidor, siguen ahí. Y si esta es una carpeta local, aquí no hay nada que arreglar; el informe no puede distinguir las dos cosas, así que lo dice en vez de acusar.`,
398
+ body: `El informe ya avisaba de que los ${(0, finding_html_1.mono)('.map')} están aquí, y esa frase se ignora porque suena a detalle de configuración. Esto es lo mismo dicho de forma que no se pueda ignorar: los mapas llevan el texto original dentro, así que cualquiera que conozca la URL tiene tus ficheros, tus rutas internas y tus comentarios.${d.env > 0 ? ` Dentro hay ${d.env === 1 ? '1 referencia a una variable' : `${d.env} referencias a variables`} de entorno.` : ''} Rutas: ${d.list}.`,
399
+ fix: `Si esta es la carpeta que subes, o no despliegas los mapas o los generas ocultos —${(0, tool_advice_1.mapsHidden)(d.tool, 'es')}— y los subes solo a tu herramienta de errores. Ten en cuenta que dejar de enlazarlos desde el bundle no impide que el servidor los siga sirviendo: si los ficheros acaban en el servidor, siguen ahí. Y si esta es una carpeta local, aquí no hay nada que arreglar; el informe no puede distinguir las dos cosas, así que lo dice en vez de acusar.`,
324
400
  }),
325
401
  thirdParty: (d) => ({
326
402
  chip: 'servicios de terceros',
@@ -351,27 +427,43 @@ exports.TEXT = {
351
427
  body: `El lock file convierte «quién mete esto» de una suposición en una respuesta: cada uno sale con la cadena de dependencias que lo trae. Que un paquete sea transitivo no es un problema —así funciona npm—, pero sí cambia el arreglo: alinear tu ${(0, finding_html_1.mono)('package.json')} no mueve nada, y lo que hace falta es una resolución forzada o quitar la dependencia que lo pide. ${d.list}.`,
352
428
  fix: `Si alguno pesa lo bastante como para importar, mira la cadena: casi siempre hay un paquete intermedio con una alternativa más ligera, o una versión más nueva que ya no lo arrastra. Cuando el que lo mete es una dependencia que no vas a cambiar, la salida es ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) o ${(0, finding_html_1.mono)('resolutions')} (yarn) — y comprobar después que la aplicación sigue funcionando, porque forzar una resolución es exactamente saltarse lo que esa dependencia pedía.`,
353
429
  }),
430
+ forbidden: (d) => ({
431
+ chip: 'prohibido en loadline.json',
432
+ title: d.inBoot
433
+ ? `${d.rule} está en el bootstrap (${d.size}) y loadline.json lo prohíbe ahí`
434
+ : `${d.rule} está en el build (${d.size}) y loadline.json lo prohíbe`,
435
+ body: `El equipo lo dejó escrito en ${(0, finding_html_1.mono)('forbidden')}: <strong>${d.why}</strong>. La regla ${d.ruleHtml} encaja con ${d.names.join(', ')}${d.more > 0 ? ` y ${(0, format_utils_1.formatCount)(d.more)} más` : ''}${d.inBoot ? ', dentro de lo que se descarga antes de pintar nada' : ''}.${d.chain ? ` Entra por ${d.chain}.` : ''}`,
436
+ fix: `Quita o cambia el import que lo trae${d.chain ? ': el último fichero tuyo de esa cadena es el que hay que tocar' : ''}${d.inBoot ? `, o conviértelo en un ${(0, finding_html_1.mono)('import()')} dinámico para que salga de la primera carga` : ''}. Si de momento tiene que quedarse, apúntalo en ${(0, finding_html_1.mono)('accepted')} con su ${(0, finding_html_1.mono)('why')} y un ${(0, finding_html_1.mono)('until')}: así vuelve cuando pase la fecha. Si la regla ya no vale, se borra de ${(0, finding_html_1.mono)('forbidden')} en una revisión, no aquí.`,
437
+ }),
354
438
  // --- against a baseline ---
355
439
  bootGrew: (d) => ({
356
440
  chip: 'el bootstrap ha crecido',
357
441
  title: `El bootstrap ha crecido ${d.diff} (${d.pct} %) desde la línea base`,
358
- body: `Antes ${(0, finding_html_1.mono)(d.before)}, ahora ${(0, finding_html_1.mono)(d.after)}. Lo paga toda carga de la aplicación, entre a donde entre. Línea base: ${(0, finding_html_1.mono)(d.baseline)}.`,
359
- fix: 'Mira en la pestaña de bootstrap qué paquetes son nuevos o han crecido. Si el crecimiento viene de una funcionalidad nueva que solo usa una pantalla, muévela a los proveedores de esa ruta.',
442
+ body: `Antes ${(0, finding_html_1.mono)(d.before)}, ahora ${(0, finding_html_1.mono)(d.after)}. Lo paga toda carga de la aplicación, entre a donde entre. Línea base: ${(0, finding_html_1.mono)(d.baseline)}.${d.causes
443
+ ? ` <strong>De dónde sale:</strong> ${d.causes}.${d.estimated ? ' Cada cifra es su peso en crudo a la proporción en que se comprime el bootstrap: el tamaño correcto, no el exacto, y por eso el ≈.' : ''}${d.ownKnown ? '' : ' Solo paquetes: la línea base es anterior a que se guardaran las carpetas de tu propio código.'}`
444
+ : ''}`,
445
+ fix: `${d.causes ? 'Empieza por la primera de la lista: con' : 'Mira en la pestaña de bootstrap qué paquetes son nuevos o han crecido. Con'} ${(0, finding_html_1.mono)('--why <paquete>')} el comando dice qué import lo mete y dónde cortarlo. Si el crecimiento viene de una funcionalidad nueva que solo usa una pantalla, impórtala desde esa pantalla y no desde código que corren todas (en Angular, regístrala en los providers de esa ruta).`,
360
446
  }),
447
+ /** What happened to one cause of the bootstrap's change, after its figure. */
448
+ bootCauseChange: { new: 'nuevo', gone: 'ya no está', grew: '', shrank: '' },
449
+ /** A folder of the project's own code, as opposed to a package. */
450
+ bootCauseOwn: 'tu código',
361
451
  bootNewPackages: (d) => ({
362
452
  chip: 'paquete nuevo en el bootstrap',
363
453
  title: d.count === 1
364
454
  ? 'Un paquete ha entrado en el bootstrap desde la última medición'
365
455
  : `${d.count} paquetes han entrado en el bootstrap desde la última medición`,
366
456
  body: `No estaban en el bootstrap de ${(0, finding_html_1.mono)(d.baseline)} y ahora sí: ${d.list}. Cada uno lo descarga todo el mundo antes de ver nada.`,
367
- fix: 'Comprueba quién los importa (columna «quién lo importa» del bootstrap). Si el consumidor es una pantalla lazy, el registro va en los proveedores de esa ruta, no en la configuración de bootstrap.',
457
+ fix: `${(0, finding_html_1.mono)('--why <paquete>')} dice qué fichero tuyo lo importa (en la página, la pestaña Bootstrap). Si lo que lo usa es una pantalla lazy, el import va en esa pantalla; en Angular, su registro va en los providers de esa ruta y no en la configuración del bootstrap.`,
368
458
  }),
369
459
  screensGrew: (d) => ({
370
460
  chip: 'pantalla que ha crecido',
371
461
  title: d.count === 1
372
462
  ? `${d.top} ha crecido ${d.diff} (${d.pct} %) en lo que carga aparte del bootstrap`
373
463
  : `${d.count} pantallas han crecido en lo que cargan aparte del bootstrap; la que más, ${d.top} (${d.diff}, ${d.pct} %)`,
374
- body: `Se compara compartido + propio, sin el bootstrap, para que un bootstrap más grande no marque todas las pantallas a la vez. ${d.list}`,
464
+ body: `Se compara compartido + propio, sin el bootstrap, para que un bootstrap más grande no marque todas las pantallas a la vez. ${d.list}${d.explained
465
+ ? `. Tras el guion, <strong>de dónde sale</strong>: los paquetes y las carpetas de tu propio código que se han movido en lo que carga la pantalla.${d.estimated ? ' Cada cifra es su peso en crudo a la proporción en que se comprime esa pantalla: el tamaño correcto, no el exacto, y por eso el ≈.' : ''}`
466
+ : ''}`,
375
467
  fix: 'Abre la pantalla en su pestaña y mira qué chunk ha crecido: si es uno compartido, el crecimiento es de todas las pantallas que lo cargan y conviene tratarlo ahí.',
376
468
  }),
377
469
  signalsChanged: (d) => ({
@@ -412,9 +504,9 @@ exports.TEXT = {
412
504
  }),
413
505
  budgetTooHigh: (d) => ({
414
506
  chip: 'budget demasiado alto',
415
- title: `${d.count === 1 ? 'El budget' : 'Los budgets'} de ${d.configs} ${d.count === 1 ? 'está' : 'están'} en ${d.error} y el bootstrap pesa ${d.boot}: no puede saltar`,
416
- body: `Es más de ${d.factor} veces el bootstrap actual (solo JavaScript, en crudo, que es lo que mide Angular). Un budget así no vigila nada: para llegar a él la aplicación tendría que multiplicar su tamaño.`,
417
- fix: 'Baja el error a algo que no quieras cruzar (por ejemplo, un 25 % por encima del bootstrap actual) y el aviso algo por debajo. Súbelo solo cuando alguien decida a sabiendas que el bootstrap tiene que crecer.',
507
+ title: `${d.count === 1 ? 'El budget' : 'Los budgets'} de ${d.configs} ${d.count === 1 ? 'está' : 'están'} en ${d.error} y la carga inicial pesa ${d.boot}: no puede saltar`,
508
+ body: `Es más de ${d.factor} veces la carga inicial de hoy: el JavaScript y el CSS iniciales en crudo, que es exactamente lo que suma el budget ${(0, finding_html_1.mono)('initial')} de Angular y la misma cifra sobre la que se calcula el budget sugerido. Un budget así no vigila nada: para llegar a él la aplicación tendría que multiplicar su tamaño.`,
509
+ fix: 'Baja el error a algo que no quieras cruzar (por ejemplo, un 25 % por encima de la carga inicial de hoy) y el aviso algo por debajo. Súbelo solo cuando alguien decida a sabiendas que el arranque tiene que crecer.',
418
510
  }),
419
511
  budgetWarnOnly: (d) => ({
420
512
  chip: 'budget que solo avisa',
@@ -435,18 +527,28 @@ exports.TEXT = {
435
527
  ? 'cascada de hashes: riesgo bajo'
436
528
  : 'cascada de hashes: riesgo medio',
437
529
  title: d.risk === 'high'
438
- ? `${d.hub} nombra a ${d.names} chunks y lo importan ${d.named}: tocar cualquier hoja mueve el build entero`
530
+ ? d.imported
531
+ ? `A ${d.hub} ${d.named === 1 ? 'lo importa 1' : `lo importan ${d.named}`} de ${d.chunks} chunks: cualquier cambio dentro de él les cambia el nombre a todos`
532
+ : `${d.hub} nombra a ${d.names} chunks y ${d.named === 1 ? 'lo importa 1' : `lo importan ${d.named}`}: tocar cualquier hoja mueve el build entero`
439
533
  : d.risk === 'low'
440
534
  ? `Los nombres están concentrados en ${d.hub}, que pesa ${d.size}: la cascada apenas se propaga`
441
- : `Los nombres están repartidos: ${d.hub} es el que más lleva, ${d.names} de ${d.chunks}`,
535
+ : d.concentrated
536
+ ? `${d.hub} nombra ${d.names} de ${d.chunks} chunks y ${d.named === 0 ? 'ninguno lleva su nombre' : d.named === 1 ? 'lo importa 1' : `lo importan ${d.named}`}: un cambio se para en él`
537
+ : `Los nombres están repartidos: ${d.hub} es el que más lleva, ${d.names} de ${d.chunks}`,
442
538
  body: `Un bundler escribe el nombre con hash de cada chunk que importa dentro del chunk que lo importa, así que un cambio viaja por esas aristas. Lo que decide cuánto viaja no es qué bundler es, es la topología, y por eso se mide en vez de citarse. ${d.risk === 'low'
443
- ? `Aquí ${(0, finding_html_1.mono)(d.hub)} pesa ${d.size} y concentra ${d.names} nombres: es la forma del <em>runtime chunk</em>, que es exactamente lo que hace webpack y lo que evita en gran parte el problema. <strong>Con un matiz que suele caerse:</strong> ese chunk cambia en cada despliegue, así que tiene que ser diminuto y estar inlineado en el HTML. Si se sirve como fichero cacheable aparte, se ha quedado el coste y se ha perdido el beneficio.`
539
+ ? `Aquí ${(0, finding_html_1.mono)(d.hub)} pesa ${d.size} y concentra ${d.names} nombres: es la forma del <em>runtime chunk</em>, que es exactamente lo que hace webpack y lo que evita en gran parte el problema. ${d.hubInBoot ? '<strong>Con un matiz que suele caerse:</strong> ese chunk cambia en cada despliegue, así que tiene que ser diminuto y estar inlineado en el HTML. Si se sirve como fichero cacheable aparte, se ha quedado el coste y se ha perdido el beneficio.' : 'No forma parte de la primera carga: llega con la pantalla que lo necesita, así que lo que cuesta un cambio es ese fichero pequeño, una vez, para quien abra esa pantalla.'}`
444
540
  : d.risk === 'high'
445
- ? `Aquí ${(0, finding_html_1.mono)(d.hub)} nombra ${d.names} de los ${d.chunks} chunks del build <strong>y</strong> lo importan ${d.named}: es la forma hub-and-spoke. Cambia una hoja → cambia el hub → cambia todo lo que importa el hub, que aquí es casi todo. No crece con la profundidad: da un salto.`
446
- : `Aquí no hay un fichero que lo concentre todo: ${(0, finding_html_1.mono)(d.hub)} nombra ${d.names} de ${d.chunks}. Un cambio viaja, pero no alcanza al build entero.`}`,
541
+ ? d.imported
542
+ ? `Aquí ${(0, finding_html_1.mono)(d.hub)} lo importan ${d.named} de los ${d.chunks} chunks del build, y cada uno lleva su nombre con hash dentro. Cualquier cosa que cambie dentro de él —una línea de tu código que viva ahí, una dependencia que sube de versión— le da un nombre nuevo, y con él a todos los que lo nombran: ${d.named + 1} ficheros que se vuelven a descargar por una edición.`
543
+ : `Aquí ${(0, finding_html_1.mono)(d.hub)} nombra ${d.names} de los ${d.chunks} chunks del build <strong>y</strong> lo importan ${d.named}: es la forma hub-and-spoke. Cambia una hoja → cambia el hub → cambia todo lo que importa el hub, que aquí es casi todo. No crece con la profundidad: da un salto.`
544
+ : d.concentrated
545
+ ? `Aquí ${(0, finding_html_1.mono)(d.hub)} nombra ${d.names} de los ${d.chunks} chunks, pero ${d.named === 0 ? 'ningún chunk lleva su nombre con un hash que cambie' : d.named === 1 ? 'solo lo importa 1 por un nombre con hash' : `solo lo importan ${d.named} por un nombre con hash`}: un cambio en una hoja cambia ${(0, finding_html_1.mono)(d.hub)} y ahí se para. Lo que cuesta es ese fichero, ${d.size}, descargado otra vez en cada cambio.`
546
+ : `Aquí no hay un fichero que lo concentre todo: ${(0, finding_html_1.mono)(d.hub)} nombra ${d.names} de ${d.chunks}. Un cambio viaja, pero no alcanza al build entero.`}`,
447
547
  fix: `${d.risk === 'low'
448
- ? `Comprueba que ${(0, finding_html_1.mono)(d.hub)} va inlineado en ${(0, finding_html_1.mono)('index.html')} y no como fichero aparte con hash: es lo único que hay que vigilar en esta forma.`
449
- : 'Las salidas tienen todas un precio y ninguna es automática: los import maps sacan los especificadores al HTML (a cambio de un HTML no cacheable, que normalmente ya lo es), romper el hub con <span class="mono">manualChunks</span> se paga con una primera carga mayor —lo avisa la propia documentación de Rollup—, y la compresión con diccionario abarata la redescarga en vez de hacerla menos frecuente.'} Y una cita que conviene leer entera: los tests de tooling.report dicen que Rollup no debería tener este problema, y cubren un caso de dos niveles. Una aplicación real con un chunk compartido que todas las rutas importan falla igual. La cita es correcta y no significa lo que parece.${d.exposure === 'unknown'
548
+ ? d.hubInBoot
549
+ ? `Comprueba que ${(0, finding_html_1.mono)(d.hub)} va inlineado en ${(0, finding_html_1.mono)('index.html')} y no como fichero aparte con hash: es lo único que hay que vigilar en esta forma.`
550
+ : `Nada que hacer mientras ${(0, finding_html_1.mono)(d.hub)} siga siendo pequeño: es la forma buena. Lo que hay que vigilar es que no crezca hasta ser el hub que todo importa.`
551
+ : `${d.imported ? `Lo primero es que en ${(0, finding_html_1.mono)(d.hub)} no viva lo que cambia a diario: si tu propio código está dentro (lo dice la señal de chunks que mezclan dependencias y código tuyo), sácalo a su propio chunk y el compartido solo cambiará cuando cambien las dependencias. ` : ''}Las salidas tienen todas un precio y ninguna es automática: los import maps sacan los especificadores al HTML (a cambio de un HTML no cacheable, que normalmente ya lo es), romper el hub con <span class="mono">manualChunks</span> se paga con una primera carga mayor —lo avisa la propia documentación de Rollup—, y la compresión con diccionario abarata la redescarga en vez de hacerla menos frecuente.`} Y una cita que conviene leer entera: los tests de tooling.report dicen que Rollup no debería tener este problema, y cubren un caso de dos niveles. Una aplicación real con un chunk compartido que todas las rutas importan falla igual. La cita es correcta y no significa lo que parece.${d.exposure === 'unknown'
450
552
  ? ' Lo que aquí no se dice es si esta forma importa: eso depende de cada cuánto despliegas y de qué proporción vuelve, que son dos de las cinco preguntas sobre la situación. Hasta que estén contestadas, la topología se enseña y el color se retiene.'
451
553
  : d.exposure === 'high'
452
554
  ? ` Y con lo que se ha contestado sobre la situación, esta forma se paga ${d.perWeek === null ? 'varias veces por semana' : `${(0, format_utils_1.formatCount)(d.perWeek)} veces por semana`} y por persona, que es lo que la saca de ser una curiosidad topológica.`
@@ -457,10 +559,14 @@ exports.TEXT = {
457
559
  // --- de dónde sale la primera carga ---
458
560
  assetOrigin: (d) => ({
459
561
  chip: 'los assets salen de otro host',
460
- title: d.origins.length === 1
461
- ? `${d.scripts} ficheros de JavaScript de la primera carga se sirven desde ${d.origins[0]}, no desde el origen de la página`
462
- : `El JavaScript de la primera carga se reparte entre ${d.origins.length} hosts que no son el de la página`,
463
- body: `${d.origins.map(origin => (0, finding_html_1.mono)(origin)).join(', ')} — ${d.scripts} ficheros de JavaScript y ${d.files} ficheros en total. Antes del primer byte del primer chunk hay una resolución DNS, una conexión TCP y un handshake TLS contra ese host (o un handshake QUIC), y eso es tiempo que ninguna cifra de peso de este informe ve: el conteo de viajes empieza a contar cuando la conexión ya existe.${d.base
562
+ title: d.scripts === 0
563
+ ? d.origins.length === 1
564
+ ? `${d.styles === 1 ? 'La hoja de estilos que bloquea el pintado se sirve' : `${d.styles} hojas de estilos que bloquean el pintado se sirven`} desde ${d.origins[0]}, no desde el origen de la página`
565
+ : `Las hojas de estilos que bloquean el pintado vienen de ${d.origins.length} hosts que no son el de la página`
566
+ : d.origins.length === 1
567
+ ? `${d.scripts} ficheros de JavaScript de la primera carga se sirven desde ${d.origins[0]}, no desde el origen de la página`
568
+ : `El JavaScript de la primera carga se reparte entre ${d.origins.length} hosts que no son el de la página`,
569
+ body: `${d.origins.map(origin => (0, finding_html_1.mono)(origin)).join(', ')} — ${[d.scripts > 0 ? `${d.scripts} ficheros de JavaScript` : '', d.styles > 0 ? (d.styles === 1 ? '1 hoja de estilos que bloquea el pintado' : `${d.styles} hojas de estilos que bloquean el pintado`) : ''].filter(Boolean).join(', ')} y ${d.files} ficheros en total.${d.styles > 0 ? ' Nada se pinta hasta que llega una hoja de estilos de esas.' : ''} Antes del primer byte del primer chunk hay una resolución DNS, una conexión TCP y un handshake TLS contra ese host (o un handshake QUIC), y eso es tiempo que ninguna cifra de peso de este informe ve: el conteo de viajes empieza a contar cuando la conexión ya existe.${d.base
464
570
  ? ` Además hay un ${(0, finding_html_1.mono)('<base href>')} apuntando a ${(0, finding_html_1.mono)(d.base)}, así que no es un fichero suelto: todas las URLs relativas de la página se resuelven ahí.`
465
571
  : ''} Y tiene el lado contrario, que conviene decir en la misma frase: bajo HTTP/1.1 un segundo origen es un segundo pool de seis conexiones, así que la misma decisión que añade un handshake quita cola de peticiones.`,
466
572
  fix: d.cold.length > 0
@@ -626,6 +732,12 @@ exports.TEXT = {
626
732
  en: {
627
733
  /** What the entry through the root is called when the measurement matches no screen. */
628
734
  rootScreen: 'the root',
735
+ andMore: (count) => `and ${count} more`,
736
+ inPage: 'asked for by the page',
737
+ each: 'each',
738
+ fileCount: (count) => `${count} ${count === 1 ? 'file' : 'files'}`,
739
+ packageBarrelRow: (files, entries, size, inBoot) => `${files} ${files === 1 ? 'file' : 'files'} in, ${entries} imported from outside, ${size}${inBoot ? ' (bootstrap)' : ''}`,
740
+ ownBarrelRow: (reexports, pulls, size) => `${reexports} re-exports, ${pulls} ${pulls === 1 ? 'file' : 'files'}, ${size}`,
629
741
  shared: (d) => ({
630
742
  chip: 'common code marked as lazy',
631
743
  title: `${d.size} downloaded by ${d.screens} of your ${d.total} screens`,
@@ -640,6 +752,14 @@ exports.TEXT = {
640
752
  : ''}`,
641
753
  fix: `Move its registration out of the bootstrap config and into that route’s providers${d.routes ? `, in ${d.routes}, where the screen is loaded from` : ', inside a lazy routes file'}. One side effect to keep in mind: if you have guards comparing against ${(0, finding_html_1.mono)('routeConfig.path')}, keep the guard on the parent route, because once nested the child gets ${(0, finding_html_1.mono)("path: ''")} and the guard stops recognising it.`,
642
754
  }),
755
+ bootSingle: (d) => ({
756
+ chip: 'bootstrap package with a single importer',
757
+ title: d.count === 1
758
+ ? `${d.pkg} weighs ${d.size} in the bootstrap and only ${d.importer} imports it`
759
+ : `${d.count} bootstrap packages (${d.size}) that one file of yours imports each`,
760
+ body: `<strong>Every load of the app</strong> downloads it, and it comes in through a single file of yours that is not a screen. One importer is an address: there is one place to decide whether the package is needed before the first paint or only when something happens — signing in, opening a dialog, sniffing the browser. ${d.list}.`,
761
+ fix: `If it is not needed for the first paint, turn that file's static import into an ${(0, finding_html_1.mono)('await import()')} in the method that uses it: the package leaves the bootstrap for a chunk of its own, downloaded the first time that method runs. With an SDK that has to be initialised (Firebase, Teams), initialise it inside that same function and keep the promise so it runs once. If it is needed before the first paint — a theme, a session check at start-up — leave it: then this signal is only information.`,
762
+ }),
643
763
  commonJs: (d) => ({
644
764
  chip: 'CommonJS package',
645
765
  title: d.count === 1
@@ -670,22 +790,30 @@ exports.TEXT = {
670
790
  body: `A file of yours this heavy is usually a constants table — translation keys, catalogues, routes — that comes in whole because it is referenced from everywhere. ${d.list}`,
671
791
  fix: 'Check the compressed size before touching it: repetitive text compresses very well and the change may not pay off. If it grows with every new entry, at least put a size budget on it.',
672
792
  }),
673
- dupeZone: { boot: 'in the bootstrap', shared: 'in a shared chunk', own: 'in a single screen' },
674
- dupeCopy: (d) => `<strong>${d.version ? `version ${d.version}` : d.under ? `copy nested inside ${(0, finding_html_1.mono)(d.under)}` : 'top-level copy'}</strong> · ${d.size} · ${d.zone}. ${d.chain ? `Comes in through ${d.chain}` : 'Could not be followed from the entry point'}${d.own ? `; your own code imports it in ${d.own}` : d.via ? `; ${d.via} imports it` : ''}.`,
793
+ dupeZone: {
794
+ boot: 'in the bootstrap',
795
+ shared: 'in a shared chunk',
796
+ own: 'loaded lazily, by one screen at most',
797
+ },
798
+ dupeCopy: (d) => `<strong>${d.version ? `version ${d.version}` : d.under ? `copy nested inside ${(0, finding_html_1.mono)(d.under)}` : 'top-level copy'}</strong> · ${d.size} · ${d.zone}. ${d.chain ? `Comes in through ${d.chain}` : 'Could not be followed from the entry point'}${d.own ? `; your own code imports it in ${d.own}` : d.via ? `; ${d.via} imports it` : ''}${d.pinned ? `; ${d.pinned.parent} pins it to exactly ${d.pinned.range}` : ''}.`,
675
799
  dupes: (d) => ({
676
800
  chip: 'duplicate copies',
677
801
  title: `${d.count} package${d.count > 1 ? 's' : ''} shipped more than once`,
678
802
  body: `You pay the weight twice because two dependencies ask for incompatible ranges.${d.inBoot ? ' One of the copies is in the bootstrap, so everybody downloads that extra weight.' : ''} ${d.list}`,
679
- fix: d.viaDependency
680
- ? `At least one copy is not one you asked for: another dependency imports it, so aligning your ${(0, finding_html_1.mono)('package.json')} is not enough. Force the resolution with ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) or ${(0, finding_html_1.mono)('resolutions')} (yarn), and check that the version you keep works for both.`
681
- : `Both copies come in through dependencies you ask for directly: align the versions in ${(0, finding_html_1.mono)('package.json')} and measure again.`,
803
+ fix: d.pinnedApart
804
+ ? `<strong>This cannot be deduplicated from your project</strong>: ${d.pinnedApart} pins its copy to an exact version, and the other copy is on another major. Forcing a single one with ${(0, finding_html_1.mono)('overrides')} or ${(0, finding_html_1.mono)('resolutions')} puts a major version change inside ${d.pinnedApart}, which was never released against it. The sensible move is to accept the signal and wait for ${d.pinnedApart} to update${d.pinnedSame ? `; the one under ${d.pinnedSame} is on the same major, and an override may work there, once tested` : ''}.`
805
+ : d.viaDependency
806
+ ? `At least one copy is not one you asked for: another dependency imports it, so aligning your ${(0, finding_html_1.mono)('package.json')} is not enough. Force the resolution with ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) or ${(0, finding_html_1.mono)('resolutions')} (yarn), and check that the version you keep works for both${d.pinnedSame
807
+ ? `: ${d.pinnedSame} pins its copy to an exact version, so the override changes a dependency that library has not been tested with`
808
+ : ` — pass ${(0, finding_html_1.mono)('--lock')} and the report will say whether any of them is pinned to an exact version`}.`
809
+ : `Both copies come in through dependencies you ask for directly: align the versions in ${(0, finding_html_1.mono)('package.json')} and measure again.`,
682
810
  }),
683
811
  heavy: (d) => ({
684
812
  chip: d.count === 1 ? 'expensive screen' : 'expensive screens',
685
813
  title: d.count === 1
686
814
  ? `${d.label} includes ${d.own} that nothing else uses`
687
815
  : `${d.count} screens carry far more code of their own than the rest, worst of them ${d.label} with ${d.own}`,
688
- body: `The median screen carries ${d.median} of its own code. ${d.count === 1 ? 'This one carries' : `${d.label} carries`} ${d.own}, so it pulls a heavy library just for itself.${d.list ? ` Behind it come ${d.list}.` : ''}`,
816
+ body: `The median screen carries ${d.median} of its own code. ${d.count === 1 ? 'This one carries' : `${d.label} carries`} ${d.own}, so it pulls a heavy library just for itself.${d.list ? ` Behind it ${d.count === 2 ? 'comes' : 'come'} ${d.list}.` : ''}`,
689
817
  fix: 'If that library is only needed once you open something inside the screen (a viewer, an editor, a chart), move it into a lazy block so people who merely pass through do not pay for it. With several screens on the list, check first whether it is the same library in all of them: then there is one fix, not five.',
690
818
  }),
691
819
  ownInBoot: (d) => ({
@@ -742,8 +870,8 @@ exports.TEXT = {
742
870
  title: d.most
743
871
  ? `${d.count} of your ${d.total} chunks (${d.size}) are in no figure here`
744
872
  : `${d.count} chunk${d.count > 1 ? 's' : ''} (${d.size}) that nothing reaches from the entry point`,
745
- body: `Nothing reachable from where the application starts imports ${d.count > 1 ? 'these files' : 'this file'}, statically or lazily: ${d.list}. It can be <strong>the server side</strong> of a rendered build — one build writes both halves into the same ${(0, finding_html_1.mono)('stats.json')}, and without the folder there is nothing to tell them apart by — a service worker, which is not part of the first load, an ${(0, finding_html_1.mono)('import()')} whose path is built at run time, which VitePress writes one of per page and then this is most of the site, or what a previous build left in a folder nobody cleans.`,
746
- fix: `If your application renders on the server, drop the browser folder as well — ${(0, finding_html_1.mono)('--dist')} on the command line — and the two sides separate on their own: without it this report may be describing the server bundle, which is usually the bigger of the two. If they are service workers, there is nothing to do. If the site writes a page per route, those chunks download on navigation and this report only describes what the entry reaches: read it as the cost of arriving, not as the size of the site. And if it is none of those, clean the folder before building: leftovers are dead weight on the server and make every figure here read low.`,
873
+ body: `Nothing reachable from where the application starts imports ${d.count > 1 ? 'these files' : 'this file'}, statically or lazily: ${d.list}. It can be ${d.folder ? '' : `<strong>the server side</strong> of a rendered build — one build writes both halves into the same ${(0, finding_html_1.mono)('stats.json')}, and without the folder there is nothing to tell them apart by — `}a service worker, which is not part of the first load, an ${(0, finding_html_1.mono)('import()')} whose path is built at run time, which VitePress writes one of per page and then this is most of the site, or what a previous build left in a folder nobody cleans.`,
874
+ fix: `${d.folder ? '' : `If your application renders on the server, drop the browser folder as well — ${(0, finding_html_1.mono)('--dist')} on the command line — and the two sides separate on their own: without it this report may be describing the server bundle, which is usually the bigger of the two. `}If they are service workers, there is nothing to do. Nor if they are a library copied as is from the ${(0, finding_html_1.mono)('public/')} folder that a script loads at run time by its URL — a rich text editor, a PDF viewer —: nothing imports those, they arrive when that code asks for them. If the site writes a page per route, those chunks download on navigation and this report only describes what the entry reaches: read it as the cost of arriving, not as the size of the site. And if it is none of those, clean the folder before building: leftovers are dead weight on the server and make every figure here read low.`,
747
875
  }),
748
876
  prefetched: (d) => ({
749
877
  chip: 'screens fetched before anybody asks',
@@ -757,19 +885,21 @@ exports.TEXT = {
757
885
  ? `All ${d.unnamed} of your screens are named after their chunk, so the table above cannot be read`
758
886
  : 'This folder carries no .map files, and that cuts the report short',
759
887
  body: `${d.unnamed > 0 ? `Every row of the screens table is a content hash — ${(0, finding_html_1.mono)('chunk-Brh4_81T')} rather than ${(0, finding_html_1.mono)('orders')} — because this folder carries no ${(0, finding_html_1.mono)('.map')} files. The figures next to them are right; which screen each one is, this report cannot say. ` : ''}Without them the weight of each chunk is known and what is inside it is not: screens come out named after their chunk file — ${(0, finding_html_1.mono)('0fPdmq0U.js')} instead of ${(0, finding_html_1.mono)('orders')} — and there is no breakdown by package and no chain from the entry point. Sizes, screens, shared chunks and round trips all still come out in full.`,
760
- fix: `Build with source maps — ${(0, finding_html_1.mono)('sourcemap: true')} in Vite, ${(0, finding_html_1.mono)('"sourceMap": true')} in Angular — and drop the folder again; they do not have to be deployed. On Angular 17 or later, dropping the ${(0, finding_html_1.mono)('stats.json')} from ${(0, finding_html_1.mono)('ng build --stats-json')} alongside gives the same thing without building twice.`,
888
+ fix: `Build with source maps — ${(0, tool_advice_1.mapsOn)(d.tool, 'en')} — and drop the folder again; they do not have to be deployed.${(0, tool_advice_1.mayBeAngular)(d.tool) ? ` On Angular 17 or later, dropping the ${(0, finding_html_1.mono)('stats.json')} from ${(0, finding_html_1.mono)('ng build --stats-json')} alongside gives the same thing without building twice.` : d.tool?.bundler === 'webpack' ? ` Dropping webpack's ${(0, finding_html_1.mono)('stats.json')} alongside gives the same thing without building twice.` : ''}`,
761
889
  }),
762
890
  splitDrift: (d) => ({
763
891
  chip: 'the breakdown does not add up to the file',
764
892
  title: `The per-file breakdown adds up to ${d.percent} % of what the chunks it describes weigh`,
765
- body: `There are two measurements of the same chunk and they are supposed to agree: what the file weighs (${d.file}) and what the per-file weights inside it add up to (${d.measured}), over ${d.chunks === 1 ? '1 chunk' : `${d.chunks} chunks`}. They do not, so what the ${(0, finding_html_1.mono)('stats.json')} says is inside a chunk is not an account of the file being served. <strong>Why they differ cannot be told from here</strong> — something changed the output after it was written — and it does not have to be known to read the consequence. The figures above — the bootstrap, each screen, the round trips — come from the file and are exact. The ones measured <strong>inside</strong> a chunk — the breakdown by package, the exclusive column, what a ${(0, finding_html_1.mono)('--what-if')} would save — come from this sum, so they read ${d.off} % ${d.high ? 'high' : 'low'}.`,
766
- fix: `Build with source maps — ${(0, finding_html_1.mono)('"sourceMap": true')} in Angular, ${(0, finding_html_1.mono)('sourcemap: true')} in Vite — and drop the folder: with ${(0, finding_html_1.mono)('.map')} files the split is measured on the generated file itself and this difference goes away. They do not have to be deployed. Until then, read those figures as an upper bound: the order of the list is right — all of them are inflated by the same ratio — and the absolute number is not.`,
893
+ body: `There are two measurements of the same chunk and they are supposed to agree: what the file weighs (${d.file}) and what the per-file weights inside it add up to (${d.measured}), over ${d.chunks === 1 ? '1 chunk' : `${d.chunks} chunks`}. They do not, so what the ${(0, finding_html_1.mono)('stats.json')} says is inside a chunk is not an account of the file being served. ${d.angular
894
+ ? "<strong>The cause is Angular's chunk optimizer</strong>: after esbuild it bundles the chunks again with Rolldown and rewrites each file's weight as that pass's length shared out in proportion, before the final minification. That is why the parts add up to more than the file, and by the same factor in every chunk. It is not the component stylesheets: those are inside the JavaScript and already in the file's weight."
895
+ : '<strong>Why they differ cannot be told from here</strong> — something changed the output after it was written — and it does not have to be known to read the consequence.'} The figures above — the bootstrap, each screen, the round trips — come from the file and are exact. The ones measured <strong>inside</strong> a chunk — the breakdown by package, the exclusive column, what a ${(0, finding_html_1.mono)('--what-if')} would save — come from this sum, so they read ${d.off} % ${d.high ? 'high' : 'low'}.`,
896
+ fix: `Build with source maps — ${(0, tool_advice_1.mapsOn)(d.tool, 'en')} — and drop the folder: with ${(0, finding_html_1.mono)('.map')} files the split is measured on the generated file itself and this difference goes away. They do not have to be deployed. Until then, read those figures as an upper bound: the order of the list is right — all of them are inflated by the same ratio — and the absolute number is not.`,
767
897
  }),
768
898
  sourceMaps: (d) => ({
769
899
  chip: 'source maps in the folder',
770
900
  title: `The build folder carries ${d.count === 1 ? '1 source map' : `${d.count} source maps`}`,
771
901
  body: 'A source map reconstructs your source from the compiled output. It does not weigh on the download — the browser only asks for it if you open the tools — but if this is the folder you deploy, anybody who knows the URL has your code.',
772
- fix: `With ${(0, finding_html_1.mono)('"sourceMap": { "scripts": true, "hidden": true }')} they are generated without being linked from the bundle, which is what you want in order to upload them to your error tool. The bundle no longer linking them does not stop the server from serving them: if the .map files end up on the server, they are still there for whoever knows the URL.`,
902
+ fix: `With ${(0, tool_advice_1.mapsHidden)(d.tool, 'en')} they are generated without being linked from the bundle, which is what you want in order to upload them to your error tool. The bundle no longer linking them does not stop the server from serving them: if the .map files end up on the server, they are still there for whoever knows the URL.`,
773
903
  }),
774
904
  clean: (d) => ({
775
905
  chip: 'no signals',
@@ -831,9 +961,9 @@ exports.TEXT = {
831
961
  chip: 'fonts',
832
962
  title: d.superseded === ''
833
963
  ? `${d.size} of fonts: ${d.files} files across ${d.families} ${d.families === 1 ? 'family' : 'families'}`
834
- : `${d.size} of fonts, and some of them ship twice in two formats`,
964
+ : `${d.size} of fonts on the server, ${d.spare} of it in a second format no current browser downloads`,
835
965
  body: `No bundle analyser shows this, because they all stop at the JavaScript, and seven weights of one family to use two is a three-hundred-kilobyte finding. ${d.list}.${d.superseded ? ` In a format another file in the same folder already supersedes: ${d.superseded}.` : ''}${d.preloaded ? ` The page preloads ${d.preloaded}, so those are part of the first load.` : ''}`,
836
- fix: `Count the weights the interface actually uses — usually two, regular and bold — and drop the rest from the font configuration. Where a ${(0, finding_html_1.mono)('.woff2')} sits next to a ${(0, finding_html_1.mono)('.ttf')} of the same face, the second is only wanted by a browser nobody runs any more: take it out of the format list. And preload only what is needed before the first paint: one ${(0, finding_html_1.mono)('preload')} per weight turns the whole list into first-load bytes.`,
966
+ fix: `Count the weights the interface actually uses — usually two, regular and bold — and drop the rest from the font configuration. Unless they are ${(0, finding_html_1.mono)('unicode-range')} subsets of one weight — dozens of files of one family usually are, as a CJK font's — which the browser fetches only for the characters on screen: there, none of them is spare. Where a ${(0, finding_html_1.mono)('.woff2')} sits next to a ${(0, finding_html_1.mono)('.ttf')} of the same face, the second is only wanted by a browser nobody runs any more: take it out of the format list. And preload only what is needed before the first paint: one ${(0, finding_html_1.mono)('preload')} per weight turns the whole list into first-load bytes.`,
837
967
  }),
838
968
  media: (d) => ({
839
969
  chip: 'images and video',
@@ -845,15 +975,27 @@ exports.TEXT = {
845
975
  }),
846
976
  duplicateAssets: (d) => ({
847
977
  chip: 'the same file under two names',
848
- title: `${d.size} in ${d.count === 1 ? 'a file that ships' : `${d.count} files that ship`} twice under different names`,
849
- body: `The content is identical byte for byte — it was compared, not assumed from the size — and they are still separate cache entries, so a visitor downloads both. ${d.list}.`,
850
- fix: 'Almost always the same asset imported from two places by different paths, or a copy left over from a migration. Unify the import and delete the copy. If the build generates both names, check whether a plugin is copying the assets folder as well as processing it.',
978
+ ...(d.count > 0
979
+ ? {
980
+ title: `${d.size} in ${d.count === 1 ? 'a file that ships' : `${d.count} files that ship`} twice under different names`,
981
+ body: `The content is identical byte for byte — it was compared, not assumed from the size — and they are still separate cache entries, so a visitor downloads both. ${d.list}.${d.stored.count > 0 ? ` Besides, stored twice and downloaded once at most, because nothing names the other copy: ${d.stored.list}.` : ''}`,
982
+ fix: 'Almost always the same asset imported from two places by different paths, or a copy left over from a migration. Unify the import and delete the copy. If the build generates both names, check whether a plugin is copying the assets folder as well as processing it.',
983
+ }
984
+ : {
985
+ title: `${d.stored.size} in ${d.stored.count === 1 ? 'a file' : `${d.stored.count} files`} the folder holds twice and the page downloads once at most`,
986
+ body: `The content is identical byte for byte — it was compared, not assumed from the size — but ${d.stored.none ? 'neither the page nor the code names any of the copies' : 'the page and the code name only one of the copies'}, and a copy nothing names is not downloaded unless something builds its URL at run time: this costs space where the build is deployed, not time on the visit. ${d.stored.list}.`,
987
+ fix: 'There is nothing to save on the visit. If the build writes both names on purpose — some tools write a file under its own name and again under a hash — leave it; otherwise delete the copy nothing names.',
988
+ }),
851
989
  }),
852
990
  unreferencedAssets: (d) => ({
853
991
  chip: 'files nothing reaches',
854
992
  title: `${d.size} in ${d.count === 1 ? '1 file named by' : `${d.count} files named by`} neither the HTML, nor the CSS, nor any chunk`,
855
- body: `The same idea as the unreachable-chunks signal, one level further out: every file name was searched for in the text of the others, and these appear in none of them. A folder nobody cleans usually holds megabytes of previous deploys. ${d.list}.`,
856
- fix: `Before deleting anything, keep in mind what this search cannot see: a path built at run time (${(0, finding_html_1.mono)('/assets/ + name + .png')}), a file the service worker asks for, or something the server references rather than the bundle. What is left after discarding those is leftovers: clean the folder before building, because they take space on the server and skew any measurement of the folder.`,
993
+ body: `The same idea as the unreachable-chunks signal, one level further out: every file name was searched for in the text of the others, and these appear in none of them.${d.fromRepo > 0
994
+ ? ` <strong>${d.fromRepo === d.count ? (d.count === 1 ? 'It is not a leftover' : 'They are not leftovers') : `${d.fromRepo} of ${d.count} are not leftovers`} of an old deploy</strong>: ${d.fromRepo === 1 ? 'it' : 'they'} ${d.verified ? (d.fromRepo === 1 ? 'is in' : 'are in') : d.fromRepo === 1 ? 'comes from' : 'come from'} ${d.folders}, the folder ${(0, finding_html_1.mono)('angular.json')} copies as it is on every build${d.verified ? '' : ' (going by its assets configuration)'}, and Angular empties the output folder before building.`
995
+ : ' A folder nobody cleans usually holds megabytes of previous deploys.'} ${d.list}.`,
996
+ fix: d.fromRepo > 0
997
+ ? `Before deleting anything, rule out what this search cannot see: a path built at run time (${(0, finding_html_1.mono)('/assets/ + name + .png')}), a file the service worker, the manifest or the server asks for, or a picture only linked from outside (${(0, finding_html_1.mono)('og:image')}, an email). Whatever is left, <strong>delete it from the repository</strong> — from ${d.folders} —: cleaning the build folder does nothing, because the next build copies it back.`
998
+ : `Before deleting anything, keep in mind what this search cannot see: a path built at run time (${(0, finding_html_1.mono)('/assets/ + name + .png')}), a file the service worker asks for, or something the server references rather than the bundle. What is left after discarding those is leftovers: clean the folder before building, because they take space on the server and skew any measurement of the folder.`,
857
999
  }),
858
1000
  inlinedData: (d) => ({
859
1001
  chip: 'files embedded as data URIs',
@@ -865,7 +1007,7 @@ exports.TEXT = {
865
1007
  updateWeight: (d) => ({
866
1008
  chip: 'weight of the update',
867
1009
  title: `Somebody who already had the previous version downloads ${d.size} (${d.pct} % of the build)`,
868
- body: `This is the half of the real cost nobody looks at: almost every visit to a running application is somebody who already had yesterday's version, and what they download is not the bundle, it is whatever changed name. A first visit downloads ${d.fresh}. ${d.reused} files keep their name and are not asked for again. ${d.count} change or arrive: ${d.list}.${d.removed ? ` And ${d.removed} are gone.` : ''}${d.carried > 0 && d.roots > 0
1010
+ body: `This is the half of the real cost nobody looks at: almost every visit to a running application is somebody who already had yesterday's version, and what they download is not the bundle, it is whatever changed name. A first visit downloads ${d.fresh}. ${d.reused === 1 ? '1 file keeps its name and is' : `${d.reused} files keep their name and are`} not asked for again. ${d.count} change or arrive: ${d.list}.${d.removed ? ` And ${d.removed} are gone.` : ''}${d.carried > 0 && d.roots > 0
869
1011
  ? ` <strong>Of the ones that changed, ${d.roots === 1 ? 'only 1 names' : `only ${d.roots} name`} no other file that also changed (${d.rootSize}): ${d.rootList}.</strong> That is where the edit landed. ${d.carried === 1 ? 'The other one carries' : `The other ${d.carried} carry`} the hashed name of one of those inside, so ${d.carried === 1 ? 'its hash' : 'their hashes'} moved without their content having to: ${d.carriedSize} of cascade. Without it this deploy would have cost ${d.rootSize}.`
870
1012
  : d.carried > 0
871
1013
  ? ` <strong>Which of them the edit landed in cannot be told from here.</strong> Every file that changed carries the hashed name of another one that also changed, so the naming graph among them closes on itself and there is no file left whose hash can only have moved for its own sake. That is not a gap in the reading, it is the shape: it is what a hub the lazy chunks import back from looks like, which is the default layout in Vite and Rollup and what the cascade signal below measures. So the ${d.carriedSize} is one deploy's cost and the split into the edit and its consequence is unavailable — which is not the same as the edit being nothing.`
@@ -884,24 +1026,56 @@ exports.TEXT = {
884
1026
  ? `${d.name} is ${d.pct} % third-party code and is invalidated by every change of yours`
885
1027
  : `${d.count} chunks mix dependencies with your own code: ${d.size} is re-invalidated on every deploy`,
886
1028
  body: `Dependencies do not change for months and your code changes daily. A chunk holding both gets a new hash every time you touch a line, and everything third-party inside it is downloaded again for nothing.${d.inBoot ? ' And it is in the bootstrap, so every returning visit pays for it.' : ''} ${d.list}.`,
887
- fix: `Split them: in Rollup and Vite with a ${(0, finding_html_1.mono)('manualChunks')} rule sending everything from ${(0, finding_html_1.mono)('node_modules')} to its own chunk. Angular already does this by default, so if something shows up here, look for a static import dragging a dependency into a chunk of yours. Watch the opposite extreme: one enormous vendor chunk is invalidated whole when a single library is updated, so what is wanted is a split by how often things change, not by where they came from.`,
1029
+ fix: `Split them: ${(0, tool_advice_1.webpackSplit)(d.tool, 'en')}in Rollup and Vite with a ${(0, finding_html_1.mono)('manualChunks')} rule sending everything from ${(0, finding_html_1.mono)('node_modules')} to its own chunk. Angular's application builder has no such rule and no option for one: it splits by what imports what, so a service of yours imported by every screen lands in the same chunk as the framework — the case to look for is exactly that, a file of yours that everything imports, and what moves it out is importing it from fewer places. Watch the opposite extreme: one enormous vendor chunk is invalidated whole when a single library is updated, so what is wanted is a split by how often things change, not by where they came from.`,
888
1030
  }),
889
1031
  unhashable: (d) => ({
890
1032
  chip: 'names that cannot be cached',
891
1033
  title: d.query === ''
892
1034
  ? `${d.count} ${d.count === 1 ? 'file carries' : 'files carry'} no hash in the name`
893
1035
  : `Some files carry the version in the query (${d.query}): they revalidate on every visit`,
894
- body: `A file without a hash in its name cannot be cached for good: the browser has to ask whether it changed on every visit, and that question costs a round trip even when the answer is no. ${d.inPage > 0 ? `${d.inPage} of them are asked for by the page itself (${d.size}).` : 'None of them is asked for by the page itself.'} ${d.list}.`,
1036
+ body: `A file without a hash in its name cannot be cached for good: the browser has to ask whether it changed on every visit, and that question costs a round trip even when the answer is no. ${d.inPage > 0 ? `${d.inPage === 1 ? 'One of them is' : `${d.inPage} of them are`} asked for by the page itself (${d.size}).` : 'None of them is asked for by the page itself.'} ${d.list}.`,
895
1037
  fix: `Almost always informative: a ${(0, finding_html_1.mono)('favicon.ico')} or a ${(0, finding_html_1.mono)('manifest.webmanifest')} carry no hash and do not need one. When it fires on something large the page asks for, hash the name in the build configuration. The version-in-the-query case (${(0, finding_html_1.mono)('?v=3')}) is the one that is nearly always a mistake: it changes the URL of every file at once on every deploy, which is the opposite of what a per-file hash does.`,
896
1038
  }),
897
1039
  // --- what reading the text of the build says (IDEAS §F) ---
1040
+ secretBenign: {
1041
+ firebaseConfig: 'Firebase web configuration: public by design',
1042
+ envDefined: 'the build defines process.env itself',
1043
+ },
1044
+ // Said in words, not as the internal kind: "Kinds: privateKey" was the report's own variable.
1045
+ secretNames: {
1046
+ privateKey: 'private key',
1047
+ awsKey: 'AWS key',
1048
+ googleKey: 'Google key',
1049
+ githubToken: 'GitHub token',
1050
+ slackToken: 'Slack token',
1051
+ jwt: 'JWT',
1052
+ internalUrl: 'internal address',
1053
+ envLeftover: 'unsubstituted environment variable',
1054
+ },
1055
+ leftoverNames: {
1056
+ nodeEnv: 'NODE_ENV check',
1057
+ reactDev: 'development React',
1058
+ testFiles: 'test files',
1059
+ devServer: 'development server client',
1060
+ consoleLogs: 'console.log',
1061
+ debugger: 'debugger',
1062
+ },
1063
+ secretOwner: (pkg) => `code of ${pkg}`,
898
1064
  secrets: (d) => ({
899
- chip: 'secrets or internal addresses in the bundle',
1065
+ chip: d.open > 0 ? 'secrets or internal addresses in the bundle' : 'secret-shaped strings, explained',
900
1066
  title: d.serious > 0
901
1067
  ? `${d.serious === 1 ? 'A string shaped like a credential ships' : `${d.serious} strings shaped like credentials ship`} in the bundle`
902
- : `${d.count} ${d.count === 1 ? 'match' : 'matches'} for a secret or an internal address in the bundle`,
903
- body: `Every pattern here identifies a specific format by its own prefix and length — ${(0, finding_html_1.mono)('AKIA')} plus sixteen characters is an AWS key and nothing else — deliberately: there is no rule for "a long string near the word key", which is the one that finds the real ones and also a hundred minified variable names. Kinds: ${d.kinds}. Nothing is printed whole: this report gets pasted into issues, and a tool that prints a live credential in full has published it a second time. ${d.list}.`,
904
- fix: `If any of them is real, the first move is to <strong>rotate</strong> it, not to delete it from the code: what is deployed is already in the hands of anybody who knows the URL, and taking it out of the next build revokes nothing. Then look at how it got in: almost always a ${(0, finding_html_1.mono)('.env')} the bundler inlines because the variable does not start with the framework's public prefix, or a configuration constant holding the server key instead of the client one. An internal address is not a credential, but it is topology: it says what is inside and what it is called.`,
1068
+ : d.open > 0
1069
+ ? `${d.open} unexplained ${d.open === 1 ? 'match' : 'matches'} for a secret or an internal address in the bundle (${d.openKinds})${d.publicKeys > 0 ? ': the public Firebase key is not what raises it' : ''}`
1070
+ : `${d.count} ${d.count === 1 ? 'string shaped like a secret that is not one' : 'strings shaped like secrets that are not'}`,
1071
+ body: `Every pattern here identifies a specific format by its own prefix and length — ${(0, finding_html_1.mono)('AKIA')} plus sixteen characters is an AWS key and nothing else — deliberately: there is no rule for "a long string near the word key". Kinds: ${d.kinds}.${d.publicKeys > 0
1072
+ ? ` <strong>${d.publicKeys === 1 ? 'The Google key is' : `${d.publicKeys} of the Google keys are`} the ${(0, finding_html_1.mono)('apiKey')} of a Firebase web configuration</strong>: ${d.publicKeys === 1 ? 'it sits' : 'they sit'} next to ${(0, finding_html_1.mono)('authDomain')}, ${(0, finding_html_1.mono)('projectId')} or ${(0, finding_html_1.mono)('messagingSenderId')}. That key identifies the project to Google and every web app using Firebase ships it; on its own it grants access to nothing, so it is not a leak.`
1073
+ : ''}${d.theirs
1074
+ ? ` The ${(0, finding_html_1.mono)('process.env')} left in belong to ${d.theirs}: the package reading its own switch, not a variable of yours the build failed to substitute, and in a browser it stays ${(0, finding_html_1.mono)('undefined')}.`
1075
+ : ''} Nothing is printed whole: this report gets pasted into issues, and a tool that prints a live credential in full has published it a second time. ${d.list}.`,
1076
+ fix: d.open > 0
1077
+ ? `If any of them is real, the first move is to <strong>rotate</strong> it, not to delete it from the code: what is deployed is already in the hands of anybody who knows the URL, and taking it out of the next build revokes nothing. Then look at how it got in: almost always a ${(0, finding_html_1.mono)('.env')} the bundler inlines because the variable does not start with the framework's public prefix, or a configuration constant holding the server key instead of the client one. An internal address is not a credential, but it is topology: it says what is inside and what it is called.`
1078
+ : `There is nothing to rotate.${d.publicKeys > 0 ? ' What protects Firebase data is the security rules and App Check, not the key: check that the rules are not open and, if you like, restrict the key to your domains in the Google Cloud console.' : ''}${d.theirs ? ` What ${d.theirs} reads is not yours: if it bothers you, ${(0, finding_html_1.mono)('define')} in the build can pin that variable, and it changes nothing in the browser.` : ''}`,
905
1079
  }),
906
1080
  devLeftovers: (d) => ({
907
1081
  chip: d.unattributed ? 'development markers in the build' : 'development leftovers in production',
@@ -913,7 +1087,7 @@ exports.TEXT = {
913
1087
  body: `${d.broken
914
1088
  ? 'The development build of a library is not minified, carries its warnings inside it and weighs several times what the production one does. Before reading any figure here: this is not the folder that gets deployed, or the pipeline is building with the wrong configuration.'
915
1089
  : d.unattributed
916
- ? `These chunks carry no source map, so the position of each match cannot be traced back to the file it was written in — and a ${(0, finding_html_1.mono)('console.log')} of yours looks exactly like the one inside ${(0, finding_html_1.mono)('@angular/core')}, which ships a console service and puts one in every Angular build there is. The matches are real; whose they are is not known here.`
1090
+ ? `These chunks carry no source map, so the position of each match cannot be traced back to the file it was written in — and a ${(0, finding_html_1.mono)('console.log')} of yours looks exactly like one inside any library${(0, tool_advice_1.mayBeAngular)(d.tool) ? `, such as the one inside ${(0, finding_html_1.mono)('@angular/core')}, which ships a console service and puts one in every Angular build there is` : ''}. The matches are real; whose they are is not known here.`
917
1091
  : 'None of these breaks anything on its own, but every one of them is something nobody meant to deploy. Each one was traced through the source maps to a file of yours, so none of them is your framework’s.'} ${d.list}.`,
918
1092
  fix: d.broken
919
1093
  ? 'The fix comes before everything else: build with the production configuration and measure again, because no figure in this report describes what your users download.'
@@ -924,8 +1098,8 @@ exports.TEXT = {
924
1098
  sourceExposed: (d) => ({
925
1099
  chip: 'your source code is published',
926
1100
  title: `${d.files} files of your source can be reconstructed from the ${d.maps} source maps in this folder`,
927
- body: `The report already said the ${(0, finding_html_1.mono)('.map')} files are here, and that sentence gets ignored because it sounds like a configuration nicety. This is the same fact put in a way that cannot be: the maps carry the original text inside them, so anybody who knows the URL has your files, your internal paths and your comments.${d.env > 0 ? ` Inside them are ${d.env} references to environment variables.` : ''} Paths: ${d.list}.`,
928
- fix: `If this is the folder you upload, either do not deploy the maps or generate them with ${(0, finding_html_1.mono)('"sourceMap": { "scripts": true, "hidden": true }')} and upload them only to your error tool. Keep in mind that no longer linking them from the bundle does not stop the server from serving them: if the files end up on the server, they are still there. And if this is a local folder, there is nothing to fix; the report cannot tell the two apart, so it says so rather than accusing.`,
1101
+ body: `The report already said the ${(0, finding_html_1.mono)('.map')} files are here, and that sentence gets ignored because it sounds like a configuration nicety. This is the same fact put in a way that cannot be: the maps carry the original text inside them, so anybody who knows the URL has your files, your internal paths and your comments.${d.env > 0 ? ` Inside them ${d.env === 1 ? 'is 1 reference to an environment variable' : `are ${d.env} references to environment variables`}.` : ''} Paths: ${d.list}.`,
1102
+ fix: `If this is the folder you upload, either do not deploy the maps or generate them hidden — ${(0, tool_advice_1.mapsHidden)(d.tool, 'en')} — and upload them only to your error tool. Keep in mind that no longer linking them from the bundle does not stop the server from serving them: if the files end up on the server, they are still there. And if this is a local folder, there is nothing to fix; the report cannot tell the two apart, so it says so rather than accusing.`,
929
1103
  }),
930
1104
  thirdParty: (d) => ({
931
1105
  chip: 'third-party services',
@@ -956,27 +1130,43 @@ exports.TEXT = {
956
1130
  body: `The lock file turns "who brings this in" from a guess into an answer: each one comes with the dependency chain that pulls it. Being transitive is not a problem in itself — that is how npm works — but it changes the fix: aligning your ${(0, finding_html_1.mono)('package.json')} moves nothing, and what is needed is a forced resolution or dropping the dependency that asks for it. ${d.list}.`,
957
1131
  fix: `Where one weighs enough to matter, read the chain: there is usually an intermediate package with a lighter alternative, or a newer version that no longer drags it in. When the thing pulling it is a dependency you are not going to change, the way out is ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) or ${(0, finding_html_1.mono)('resolutions')} (yarn) — and then checking the application still works, because forcing a resolution is exactly overriding what that dependency asked for.`,
958
1132
  }),
1133
+ forbidden: (d) => ({
1134
+ chip: 'forbidden in loadline.json',
1135
+ title: d.inBoot
1136
+ ? `${d.rule} is in the bootstrap (${d.size}), and loadline.json forbids it there`
1137
+ : `${d.rule} is in the build (${d.size}), and loadline.json forbids it`,
1138
+ body: `The team wrote it down in ${(0, finding_html_1.mono)('forbidden')}: <strong>${d.why}</strong>. The rule ${d.ruleHtml} matches ${d.names.join(', ')}${d.more > 0 ? ` and ${(0, format_utils_1.formatCount)(d.more)} more` : ''}${d.inBoot ? ', inside what downloads before anything is painted' : ''}.${d.chain ? ` It comes in through ${d.chain}.` : ''}`,
1139
+ fix: `Remove or change the import that brings it in${d.chain ? ': the last file of yours in that chain is the one to edit' : ''}${d.inBoot ? `, or turn it into a dynamic ${(0, finding_html_1.mono)('import()')} so it leaves the first load` : ''}. If it has to stay for now, write it in ${(0, finding_html_1.mono)('accepted')} with its ${(0, finding_html_1.mono)('why')} and an ${(0, finding_html_1.mono)('until')}: it comes back when the date passes. If the rule no longer holds, it is removed from ${(0, finding_html_1.mono)('forbidden')} in a review, not here.`,
1140
+ }),
959
1141
  // --- against a baseline ---
960
1142
  bootGrew: (d) => ({
961
1143
  chip: 'bootstrap has grown',
962
1144
  title: `The bootstrap has grown ${d.diff} (${d.pct} %) since the baseline`,
963
- body: `Before ${(0, finding_html_1.mono)(d.before)}, now ${(0, finding_html_1.mono)(d.after)}. Every load of the app pays for it, whatever screen it lands on. Baseline: ${(0, finding_html_1.mono)(d.baseline)}.`,
964
- fix: 'Check the bootstrap tab for packages that are new or have grown. If the growth comes from a new feature only one screen uses, move it to that route’s providers.',
1145
+ body: `Before ${(0, finding_html_1.mono)(d.before)}, now ${(0, finding_html_1.mono)(d.after)}. Every load of the app pays for it, whatever screen it lands on. Baseline: ${(0, finding_html_1.mono)(d.baseline)}.${d.causes
1146
+ ? ` <strong>Where it comes from:</strong> ${d.causes}.${d.estimated ? ' Each figure is its raw weight at the ratio the bootstrap compresses by: the right size, not the exact one, hence the ≈.' : ''}${d.ownKnown ? '' : ' Packages only: the baseline predates the folders of your own code being recorded.'}`
1147
+ : ''}`,
1148
+ fix: `${d.causes ? 'Start with the first of the list:' : 'Check the bootstrap tab for packages that are new or have grown.'} ${(0, finding_html_1.mono)('--why <package>')} on the command says which import brings it in and where to cut it. If the growth comes from a new feature only one screen uses, import it from that screen rather than from code every screen runs (in Angular, register it in that route’s providers).`,
965
1149
  }),
1150
+ /** What happened to one cause of the bootstrap's change, after its figure. */
1151
+ bootCauseChange: { new: 'new', gone: 'gone', grew: '', shrank: '' },
1152
+ /** A folder of the project's own code, as opposed to a package. */
1153
+ bootCauseOwn: 'your code',
966
1154
  bootNewPackages: (d) => ({
967
1155
  chip: 'new package in the bootstrap',
968
1156
  title: d.count === 1
969
1157
  ? 'A package has entered the bootstrap since the last measurement'
970
1158
  : `${d.count} packages have entered the bootstrap since the last measurement`,
971
1159
  body: `Not in the bootstrap of ${(0, finding_html_1.mono)(d.baseline)}, in it now: ${d.list}. Everyone downloads each of them before seeing anything.`,
972
- fix: 'Check who imports them (the “imported by” column of the bootstrap). If the consumer is a lazy screen, the registration belongs in that route’s providers, not in the bootstrap config.',
1160
+ fix: `${(0, finding_html_1.mono)('--why <package>')} says which file of yours imports it (on the page, the Bootstrap tab). If what uses it is a lazy screen, the import belongs in that screen; in Angular, its registration belongs in that route’s providers rather than in the bootstrap config.`,
973
1161
  }),
974
1162
  screensGrew: (d) => ({
975
1163
  chip: 'screen has grown',
976
1164
  title: d.count === 1
977
1165
  ? `${d.top} has grown ${d.diff} (${d.pct} %) in what it loads beyond the bootstrap`
978
1166
  : `${d.count} screens have grown in what they load beyond the bootstrap; the most, ${d.top} (${d.diff}, ${d.pct} %)`,
979
- body: `Shared + own is compared, without the bootstrap, so a bigger bootstrap does not flag every screen at once. ${d.list}`,
1167
+ body: `Shared + own is compared, without the bootstrap, so a bigger bootstrap does not flag every screen at once. ${d.list}${d.explained
1168
+ ? `. After the dash, <strong>where it comes from</strong>: the packages and folders of your own code that moved in what the screen loads.${d.estimated ? ' Each figure is its raw weight at the ratio that screen compresses by: the right size, not the exact one, hence the ≈.' : ''}`
1169
+ : ''}`,
980
1170
  fix: 'Open the screen in its tab and see which chunk grew: if it is a shared one, the growth belongs to every screen loading it and is best dealt with there.',
981
1171
  }),
982
1172
  signalsChanged: (d) => ({
@@ -1017,9 +1207,9 @@ exports.TEXT = {
1017
1207
  }),
1018
1208
  budgetTooHigh: (d) => ({
1019
1209
  chip: 'budget too high',
1020
- title: `The ${d.configs} ${d.count === 1 ? 'budget is' : 'budgets are'} ${d.error} and the bootstrap weighs ${d.boot}: ${d.count === 1 ? 'it' : 'they'} cannot fire`,
1021
- body: `That is more than ${d.factor} times the current bootstrap (JavaScript only, raw, which is what Angular measures). A budget like that watches nothing: the app would have to multiply its size to reach it.`,
1022
- fix: 'Lower the error to something you do not want to cross (say 25 % above the current bootstrap) and the warning a little below. Raise it only when someone knowingly decides the bootstrap has to grow.',
1210
+ title: `The ${d.configs} ${d.count === 1 ? 'budget is' : 'budgets are'} ${d.error} and the initial load weighs ${d.boot}: ${d.count === 1 ? 'it' : 'they'} cannot fire`,
1211
+ body: `That is more than ${d.factor} times today's initial load: the initial JavaScript and CSS, raw, which is exactly what Angular's ${(0, finding_html_1.mono)('initial')} budget adds up and the same figure the suggested budget is computed from. A budget like that watches nothing: the app would have to multiply its size to reach it.`,
1212
+ fix: 'Lower the error to something you do not want to cross (say 25 % above the initial load today) and the warning a little below. Raise it only when someone knowingly decides the start-up has to grow.',
1023
1213
  }),
1024
1214
  budgetWarnOnly: (d) => ({
1025
1215
  chip: 'budget that only warns',
@@ -1040,18 +1230,28 @@ exports.TEXT = {
1040
1230
  ? 'hash cascade: low risk'
1041
1231
  : 'hash cascade: medium risk',
1042
1232
  title: d.risk === 'high'
1043
- ? `${d.hub} names ${d.names} chunks and is imported by ${d.named}: touching any leaf moves the whole build`
1233
+ ? d.imported
1234
+ ? `${d.hub} is imported by ${d.named} of ${d.chunks} chunks: any change inside it renames all of them`
1235
+ : `${d.hub} names ${d.names} chunks and is imported by ${d.named}: touching any leaf moves the whole build`
1044
1236
  : d.risk === 'low'
1045
1237
  ? `The names are concentrated in ${d.hub}, which weighs ${d.size}: the cascade barely travels`
1046
- : `The names are spread about: ${d.hub} carries the most, ${d.names} of ${d.chunks}`,
1238
+ : d.concentrated
1239
+ ? `${d.hub} names ${d.names} of ${d.chunks} chunks and ${d.named === 0 ? 'no chunk carries its name' : `is imported by ${d.named}`}: a change stops there`
1240
+ : `The names are spread about: ${d.hub} carries the most, ${d.names} of ${d.chunks}`,
1047
1241
  body: `A bundler writes the hashed name of every chunk it imports inside the importing chunk, so a change travels along those edges. What decides how far it travels is not which bundler it is, it is the topology — which is why this is measured rather than quoted. ${d.risk === 'low'
1048
- ? `Here ${(0, finding_html_1.mono)(d.hub)} weighs ${d.size} and holds ${d.names} names: that is the <em>runtime chunk</em> shape, which is exactly what webpack does and what largely avoids the problem. <strong>With a footnote that usually gets dropped:</strong> that chunk changes on every deploy, so it has to be tiny and inlined into the HTML. Served as a separate cacheable file, the cost is kept and the benefit is lost.`
1242
+ ? `Here ${(0, finding_html_1.mono)(d.hub)} weighs ${d.size} and holds ${d.names} names: that is the <em>runtime chunk</em> shape, which is exactly what webpack does and what largely avoids the problem. ${d.hubInBoot ? '<strong>With a footnote that usually gets dropped:</strong> that chunk changes on every deploy, so it has to be tiny and inlined into the HTML. Served as a separate cacheable file, the cost is kept and the benefit is lost.' : 'It is not part of the first load: it is fetched with the screen that needs it, so what a change costs is that one small file, once, for whoever opens that screen.'}`
1049
1243
  : d.risk === 'high'
1050
- ? `Here ${(0, finding_html_1.mono)(d.hub)} names ${d.names} of the build's ${d.chunks} chunks <strong>and</strong> is imported by ${d.named}: that is the hub-and-spoke shape. Change a leaf → the hub changes → everything importing the hub changes, which here is nearly everything. It does not grow with depth: it jumps.`
1051
- : `Here no single file concentrates the names: ${(0, finding_html_1.mono)(d.hub)} names ${d.names} of ${d.chunks}. A change travels, but it does not reach the whole build.`}`,
1244
+ ? d.imported
1245
+ ? `Here ${(0, finding_html_1.mono)(d.hub)} is imported by ${d.named} of the build's ${d.chunks} chunks, and each of them carries its hashed name. Anything that changes inside it — a line of your code that lives there, a dependency bump — gives it a new name, and every chunk naming it gets one too: ${d.named + 1} files downloaded again for one edit.`
1246
+ : `Here ${(0, finding_html_1.mono)(d.hub)} names ${d.names} of the build's ${d.chunks} chunks <strong>and</strong> is imported by ${d.named}: that is the hub-and-spoke shape. Change a leaf → the hub changes → everything importing the hub changes, which here is nearly everything. It does not grow with depth: it jumps.`
1247
+ : d.concentrated
1248
+ ? `Here ${(0, finding_html_1.mono)(d.hub)} names ${d.names} of the build's ${d.chunks} chunks, but ${d.named === 0 ? 'no chunk carries its name with a hash that changes' : d.named === 1 ? 'only 1 imports it by a hashed name' : `only ${d.named} import it by a hashed name`}: a change to a leaf changes ${(0, finding_html_1.mono)(d.hub)} and stops there. What it costs is that file, ${d.size}, downloaded again on every change.`
1249
+ : `Here no single file concentrates the names: ${(0, finding_html_1.mono)(d.hub)} names ${d.names} of ${d.chunks}. A change travels, but it does not reach the whole build.`}`,
1052
1250
  fix: `${d.risk === 'low'
1053
- ? `Check that ${(0, finding_html_1.mono)(d.hub)} is inlined into ${(0, finding_html_1.mono)('index.html')} rather than served as a separate hashed file: that is the only thing to watch in this shape.`
1054
- : 'Every way out has a price and none is automatic: import maps move the specifiers into the HTML (at the cost of an uncacheable HTML, which it usually already is), breaking the hub with <span class="mono">manualChunks</span> is paid for with a bigger first load — Rollup’s own documentation says so — and compression dictionaries make the re-download cheap rather than rarer.'} And one citation worth reading in full: tooling.report's tests say Rollup should not have this problem, and they cover a two-level case. A real application with one shared chunk every route imports fails all the same. The citation is correct and does not mean what it looks like.${d.exposure === 'unknown'
1251
+ ? d.hubInBoot
1252
+ ? `Check that ${(0, finding_html_1.mono)(d.hub)} is inlined into ${(0, finding_html_1.mono)('index.html')} rather than served as a separate hashed file: that is the only thing to watch in this shape.`
1253
+ : `Nothing to do while ${(0, finding_html_1.mono)(d.hub)} stays small: it is the right shape. What to watch is that it does not grow into the hub everything imports.`
1254
+ : `${d.imported ? `First, keep what changes daily out of ${(0, finding_html_1.mono)(d.hub)}: if your own code sits in it (the signal about chunks mixing dependencies with your code says whether it does), move it to a chunk of its own, and the shared one only changes when the dependencies do. ` : ''}Every way out has a price and none is automatic: import maps move the specifiers into the HTML (at the cost of an uncacheable HTML, which it usually already is), breaking the hub with <span class="mono">manualChunks</span> is paid for with a bigger first load — Rollup’s own documentation says so — and compression dictionaries make the re-download cheap rather than rarer.`} And one citation worth reading in full: tooling.report's tests say Rollup should not have this problem, and they cover a two-level case. A real application with one shared chunk every route imports fails all the same. The citation is correct and does not mean what it looks like.${d.exposure === 'unknown'
1055
1255
  ? ' What is not said here is whether this shape matters: that depends on how often you deploy and how many people come back, which are two of the five questions about the situation. Until they are answered, the topology is shown and the colour withheld.'
1056
1256
  : d.exposure === 'high'
1057
1257
  ? ` And going by the answers about the situation, this shape is paid for ${d.perWeek === null ? 'several times a week' : `${(0, format_utils_1.formatCount)(d.perWeek)} times a week`} per person, which is what takes it out of being a topological curiosity.`
@@ -1062,10 +1262,14 @@ exports.TEXT = {
1062
1262
  // --- where the first load comes from ---
1063
1263
  assetOrigin: (d) => ({
1064
1264
  chip: 'assets served from another host',
1065
- title: d.origins.length === 1
1066
- ? `${d.scripts} JavaScript files of the first load are served from ${d.origins[0]}, not from the page's own origin`
1067
- : `The JavaScript of the first load is spread across ${d.origins.length} hosts that are not the page's own`,
1068
- body: `${d.origins.map(origin => (0, finding_html_1.mono)(origin)).join(', ')} — ${d.scripts} JavaScript files and ${d.files} files in total. Before the first byte of the first chunk there is a DNS lookup, a TCP connection and a TLS handshake against that host (or a QUIC handshake), and that is time no weight figure in this report can see: the round-trip count starts once the connection already exists.${d.base
1265
+ title: d.scripts === 0
1266
+ ? d.origins.length === 1
1267
+ ? `${d.styles === 1 ? 'The render-blocking stylesheet is' : `${d.styles} render-blocking stylesheets are`} served from ${d.origins[0]}, not from the page's own origin`
1268
+ : `The render-blocking stylesheets come from ${d.origins.length} hosts that are not the page's own`
1269
+ : d.origins.length === 1
1270
+ ? `${d.scripts} JavaScript files of the first load are served from ${d.origins[0]}, not from the page's own origin`
1271
+ : `The JavaScript of the first load is spread across ${d.origins.length} hosts that are not the page's own`,
1272
+ body: `${d.origins.map(origin => (0, finding_html_1.mono)(origin)).join(', ')} — ${[d.scripts > 0 ? `${d.scripts} JavaScript files` : '', d.styles > 0 ? (d.styles === 1 ? '1 render-blocking stylesheet' : `${d.styles} render-blocking stylesheets`) : ''].filter(Boolean).join(', ')} and ${d.files} files in total.${d.styles > 0 ? ' Nothing is painted until such a stylesheet has arrived.' : ''} Before the first byte of the first chunk there is a DNS lookup, a TCP connection and a TLS handshake against that host (or a QUIC handshake), and that is time no weight figure in this report can see: the round-trip count starts once the connection already exists.${d.base
1069
1273
  ? ` There is also a ${(0, finding_html_1.mono)('<base href>')} pointing at ${(0, finding_html_1.mono)(d.base)}, so this is not one stray file: every relative URL of the page resolves there.`
1070
1274
  : ''} And it cuts the other way, which belongs in the same sentence: under HTTP/1.1 a second origin is a second pool of six connections, so the same decision that adds a handshake takes away queueing.`,
1071
1275
  fix: d.cold.length > 0