@bymaksym/loadline 1.0.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 (112) hide show
  1. package/README.md +211 -43
  2. package/dist/cli/cli/args.js +79 -128
  3. package/dist/cli/cli/gates.js +80 -14
  4. package/dist/cli/cli/main.js +164 -33
  5. package/dist/cli/cli/memory.js +40 -4
  6. package/dist/cli/cli/{declared.js → read/declared.js} +1 -1
  7. package/dist/cli/cli/read/locate.js +214 -0
  8. package/dist/cli/cli/{read-build.js → read/read-build.js} +149 -84
  9. package/dist/cli/cli/read/read-config.js +120 -0
  10. package/dist/cli/cli/{html-report.js → render/html-report.js} +14 -10
  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} +18 -5
  15. package/dist/cli/cli/{render-markdown.js → render/render-markdown.js} +5 -5
  16. package/dist/cli/cli/{render-pr.js → render/render-pr.js} +33 -13
  17. package/dist/cli/cli/{render-sarif.js → render/render-sarif.js} +8 -3
  18. package/dist/cli/cli/{render-text.js → render/render-text.js} +118 -111
  19. package/dist/cli/cli/render/terminal.js +55 -0
  20. package/dist/cli/cli/report.js +68 -27
  21. package/dist/cli/cli/self-check.js +19 -23
  22. package/dist/cli/cli/since-last.js +2 -2
  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 +63 -23
  27. package/dist/cli/src/app/core/analysis/{barrels.js → graph/barrels.js} +1 -1
  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 +7 -1
  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} +50 -9
  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} +1 -1
  40. package/dist/cli/src/app/core/analysis/tool.js +83 -0
  41. package/dist/cli/src/app/core/assets/assets.js +134 -15
  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 +168 -13
  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 +121 -43
  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 +104 -16
  53. package/dist/cli/src/app/core/export/summary.js +29 -5
  54. package/dist/cli/src/app/core/findings/actions.js +3 -1
  55. package/dist/cli/src/app/core/findings/{boot-single.js → bundle/boot-single.js} +3 -3
  56. package/dist/cli/src/app/core/findings/{dupes.js → bundle/dupes.js} +8 -5
  57. package/dist/cli/src/app/core/findings/{graph.js → bundle/graph.js} +30 -18
  58. package/dist/cli/src/app/core/findings/{own-in-boot.js → bundle/own-in-boot.js} +9 -5
  59. package/dist/cli/src/app/core/findings/{requests.js → bundle/requests.js} +3 -3
  60. package/dist/cli/src/app/core/findings/{shipped.js → bundle/shipped.js} +28 -14
  61. package/dist/cli/src/app/core/findings/compose.js +6 -1
  62. package/dist/cli/src/app/core/findings/effort.js +2 -0
  63. package/dist/cli/src/app/core/findings/finding.types.js +1 -0
  64. package/dist/cli/src/app/core/findings/findings.js +48 -19
  65. package/dist/cli/src/app/core/findings/{assets.js → folder/assets.js} +38 -14
  66. package/dist/cli/src/app/core/findings/{caching.js → folder/caching.js} +16 -9
  67. package/dist/cli/src/app/core/findings/{page.js → folder/page.js} +6 -2
  68. package/dist/cli/src/app/core/findings/{scan.js → folder/scan.js} +25 -11
  69. package/dist/cli/src/app/core/findings/kind-names.js +163 -0
  70. package/dist/cli/src/app/core/findings/{deps.js → supplied/deps.js} +13 -8
  71. package/dist/cli/src/app/core/findings/supplied/forbidden.js +71 -0
  72. package/dist/cli/src/app/core/findings/{situation.js → supplied/situation.js} +2 -2
  73. package/dist/cli/src/app/core/findings/text/causes.js +39 -0
  74. package/dist/cli/src/app/core/findings/{finding-html.js → text/finding-html.js} +8 -1
  75. package/dist/cli/src/app/core/findings/{finding-text.js → text/finding-text.js} +208 -77
  76. package/dist/cli/src/app/core/findings/text/tool-advice.js +97 -0
  77. package/dist/cli/src/app/core/format/format.utils.js +158 -11
  78. package/dist/cli/src/app/core/format/ownership.js +93 -0
  79. package/dist/cli/src/app/core/i18n/en.js +76 -17
  80. package/dist/cli/src/app/core/i18n/es.js +82 -22
  81. package/dist/cli/src/app/core/intake/bundle-graph.js +281 -43
  82. package/dist/cli/src/app/core/intake/dist-files.js +82 -14
  83. package/dist/cli/src/app/core/intake/embedded.js +11 -1
  84. package/dist/cli/src/app/core/intake/unreached.js +139 -0
  85. package/dist/cli/src/app/core/intake/webpack-modules.js +185 -0
  86. package/dist/cli/src/app/core/intake/webpack-stats.js +298 -0
  87. package/dist/cli/src/app/core/project/project-context.js +16 -4
  88. package/dist/cli/src/app/core/project/project-name.js +36 -0
  89. package/dist/cli/src/app/core/scan/scan.js +58 -19
  90. package/dist/cli/src/app/core/scan/secrets.js +23 -3
  91. package/dist/cli/src/app/core/situation/situation-text.js +23 -0
  92. package/dist/cli/src/app/core/situation/situation.js +6 -4
  93. package/dist/cli/src/app/core/timing/timing.js +5 -2
  94. package/dist/cli/src/app/core/whatif/defer.js +29 -4
  95. package/dist/cli/src/app/core/whatif/source-importers.js +58 -0
  96. package/dist/cli/src/app/core/whatif/why.js +102 -0
  97. package/docs/CONFIG-REFERENCE.md +230 -0
  98. package/docs/CONFIG.md +511 -0
  99. package/docs/HOW-IT-WORKS.md +286 -25
  100. package/loadline.html +24 -20
  101. package/loadline.schema.json +1209 -0
  102. package/package.json +35 -29
  103. package/dist/cli/cli/locate.js +0 -60
  104. package/dist/cli/cli/text.js +0 -215
  105. /package/dist/cli/cli/{read-build.types.js → read/read-build.types.js} +0 -0
  106. /package/dist/cli/cli/{render-json.types.js → render/render-json.types.js} +0 -0
  107. /package/dist/cli/cli/{text.types.js → text/text.types.js} +0 -0
  108. /package/dist/cli/src/app/core/analysis/{exclusive.js → graph/exclusive.js} +0 -0
  109. /package/dist/cli/src/app/core/analysis/{insights.types.js → graph/insights.types.js} +0 -0
  110. /package/dist/cli/src/app/core/analysis/{module-graph.js → graph/module-graph.js} +0 -0
  111. /package/dist/cli/src/app/core/analysis/{sourcemap.types.js → sourcemap/sourcemap.types.js} +0 -0
  112. /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
  /**
@@ -80,7 +81,13 @@ exports.TEXT = {
80
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}`,
81
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.',
82
83
  }),
83
- dupeZone: { boot: 'en el bootstrap', shared: 'en un chunk compartido', own: 'en una sola pantalla' },
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
+ },
84
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` : ''}.`,
85
92
  dupes: (d) => ({
86
93
  chip: 'copias duplicadas',
@@ -101,7 +108,7 @@ exports.TEXT = {
101
108
  title: d.count === 1
102
109
  ? `${d.label} incluye ${d.own} que no usa nadie más`
103
110
  : `${d.count} pantallas traen mucho más código propio que el resto; la peor es ${d.label} con ${d.own}`,
104
- 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}.` : ''}`,
105
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.',
106
113
  }),
107
114
  ownInBoot: (d) => ({
@@ -124,15 +131,15 @@ exports.TEXT = {
124
131
  bootWaves: (d) => ({
125
132
  chip: 'el arranque en varias idas y vueltas',
126
133
  title: `La primera carga tarda ${d.waves} idas y vueltas antes de pintar nada`,
127
- 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.`}`,
128
135
  fix: `${d.critical
129
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.` : ''} `
130
- : ''}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.`,
131
138
  }),
132
139
  slowScreens: (d) => ({
133
140
  chip: 'profundidad de descubrimiento',
134
141
  title: `${d.worstLabel} tarda ${d.worstWaves} idas y vueltas en estar completa: ${d.worstMs} ms de espera pura`,
135
- 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
136
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.'
137
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.`}`,
138
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.',
@@ -154,12 +161,12 @@ exports.TEXT = {
154
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.',
155
162
  }),
156
163
  unreachable: (d) => ({
157
- 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',
158
165
  title: d.most
159
- ? `${d.count} de tus ${d.total} trozos (${d.size}) no salen en ningún número de aquí`
160
- : `${d.count} trozo${d.count > 1 ? 's' : ''} (${d.size}) que no alcanza nada desde la entrada`,
161
- 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.`,
162
- 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.`,
163
170
  }),
164
171
  prefetched: (d) => ({
165
172
  chip: 'pantallas que se piden antes de que nadie las abra',
@@ -173,7 +180,7 @@ exports.TEXT = {
173
180
  ? `Tus ${d.unnamed} pantallas salen con el nombre de su chunk, así que la tabla de arriba no se puede leer`
174
181
  : 'Esta carpeta no trae ficheros .map, y eso recorta el informe',
175
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.`,
176
- 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.` : ''}`,
177
184
  }),
178
185
  splitDrift: (d) => ({
179
186
  chip: 'el desglose no cuadra con el fichero',
@@ -181,13 +188,13 @@ exports.TEXT = {
181
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
182
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.'
183
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'}.`,
184
- 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.`,
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.`,
185
192
  }),
186
193
  sourceMaps: (d) => ({
187
194
  chip: 'source maps en la carpeta',
188
195
  title: `La carpeta de build trae ${d.count === 1 ? '1 source map' : `${d.count} source maps`}`,
189
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.',
190
- 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.`,
191
198
  }),
192
199
  clean: (d) => ({
193
200
  chip: 'sin señales',
@@ -249,9 +256,9 @@ exports.TEXT = {
249
256
  chip: 'tipografías',
250
257
  title: d.superseded === ''
251
258
  ? `${d.size} de tipografías: ${d.files} ficheros en ${d.families} ${d.families === 1 ? 'familia' : 'familias'}`
252
- : `${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`,
253
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.` : ''}`,
254
- 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.`,
255
262
  }),
256
263
  media: (d) => ({
257
264
  chip: 'imágenes y vídeo',
@@ -263,14 +270,22 @@ exports.TEXT = {
263
270
  }),
264
271
  duplicateAssets: (d) => ({
265
272
  chip: 'el mismo fichero con dos nombres',
266
- title: `${d.size} en ${d.count === 1 ? 'un fichero que viaja' : `${d.count} ficheros que viajan`} dos veces con nombres distintos`,
267
- 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}.`,
268
- 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
+ }),
269
284
  }),
270
285
  unreferencedAssets: (d) => ({
271
286
  chip: 'ficheros que no alcanza nadie',
272
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`,
273
- 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.${d.fromRepo > 0
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
274
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.`
275
290
  : ' En una carpeta que nadie limpia suele haber megabytes de despliegues anteriores.'} ${d.list}.`,
276
291
  fix: d.fromRepo > 0
@@ -287,7 +302,7 @@ exports.TEXT = {
287
302
  updateWeight: (d) => ({
288
303
  chip: 'peso de la actualización',
289
304
  title: `Quien ya tenía la versión anterior descarga ${d.size} (el ${d.pct} % del build)`,
290
- 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
291
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}.`
292
307
  : d.carried > 0
293
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—.`
@@ -306,7 +321,7 @@ exports.TEXT = {
306
321
  ? `${d.name} es ${d.pct} % código de terceros y se invalida con cada cambio tuyo`
307
322
  : `${d.count} chunks mezclan dependencias y código tuyo: ${d.size} se reinvalidan en cada despliegue`,
308
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}.`,
309
- 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.`,
310
325
  }),
311
326
  unhashable: (d) => ({
312
327
  chip: 'nombres que no se pueden cachear',
@@ -317,16 +332,38 @@ exports.TEXT = {
317
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.`,
318
333
  }),
319
334
  // --- lo que dice leer el texto del build (IDEAS §F) ---
320
- secretBenign: { firebaseConfig: 'configuración web de Firebase: pública por diseño' },
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
+ },
321
358
  secretOwner: (pkg) => `es código de ${pkg}`,
322
359
  secrets: (d) => ({
323
360
  chip: d.open > 0
324
361
  ? 'secretos o direcciones internas en el bundle'
325
362
  : 'cadenas con forma de secreto, explicadas',
326
363
  title: d.serious > 0
327
- ? `${d.serious === 1 ? 'Una credencial con forma de credencial viaja' : `${d.serious} credenciales con forma de credencial viajan`} en el bundle`
364
+ ? `${d.serious === 1 ? 'Una credencial de formato reconocible viaja' : `${d.serious} credenciales de formato reconocible viajan`} en el bundle`
328
365
  : d.open > 0
329
- ? `${d.open} ${d.open === 1 ? 'coincidencia' : 'coincidencias'} de secreto o dirección interna en el bundle`
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' : ''}`
330
367
  : `${d.count} ${d.count === 1 ? 'cadena con forma de secreto que no lo es' : 'cadenas con forma de secreto que no lo son'}`,
331
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
332
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.`
@@ -347,7 +384,7 @@ exports.TEXT = {
347
384
  body: `${d.broken
348
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.'
349
386
  : d.unattributed
350
- ? `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.`
351
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}.`,
352
389
  fix: d.broken
353
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.'
@@ -358,8 +395,8 @@ exports.TEXT = {
358
395
  sourceExposed: (d) => ({
359
396
  chip: 'tu código fuente está publicado',
360
397
  title: `${d.files} ficheros de tu código fuente se reconstruyen desde los ${d.maps} source maps de esta carpeta`,
361
- 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}.`,
362
- 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.`,
363
400
  }),
364
401
  thirdParty: (d) => ({
365
402
  chip: 'servicios de terceros',
@@ -390,27 +427,43 @@ exports.TEXT = {
390
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}.`,
391
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.`,
392
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
+ }),
393
438
  // --- against a baseline ---
394
439
  bootGrew: (d) => ({
395
440
  chip: 'el bootstrap ha crecido',
396
441
  title: `El bootstrap ha crecido ${d.diff} (${d.pct} %) desde la línea base`,
397
- 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)}.`,
398
- 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).`,
399
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',
400
451
  bootNewPackages: (d) => ({
401
452
  chip: 'paquete nuevo en el bootstrap',
402
453
  title: d.count === 1
403
454
  ? 'Un paquete ha entrado en el bootstrap desde la última medición'
404
455
  : `${d.count} paquetes han entrado en el bootstrap desde la última medición`,
405
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.`,
406
- 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.`,
407
458
  }),
408
459
  screensGrew: (d) => ({
409
460
  chip: 'pantalla que ha crecido',
410
461
  title: d.count === 1
411
462
  ? `${d.top} ha crecido ${d.diff} (${d.pct} %) en lo que carga aparte del bootstrap`
412
463
  : `${d.count} pantallas han crecido en lo que cargan aparte del bootstrap; la que más, ${d.top} (${d.diff}, ${d.pct} %)`,
413
- 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
+ : ''}`,
414
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í.',
415
468
  }),
416
469
  signalsChanged: (d) => ({
@@ -474,18 +527,28 @@ exports.TEXT = {
474
527
  ? 'cascada de hashes: riesgo bajo'
475
528
  : 'cascada de hashes: riesgo medio',
476
529
  title: d.risk === 'high'
477
- ? `${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`
478
533
  : d.risk === 'low'
479
534
  ? `Los nombres están concentrados en ${d.hub}, que pesa ${d.size}: la cascada apenas se propaga`
480
- : `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}`,
481
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'
482
- ? `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.'}`
483
540
  : d.risk === 'high'
484
- ? `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.`
485
- : `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.`}`,
486
547
  fix: `${d.risk === 'low'
487
- ? `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.`
488
- : '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'
489
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.'
490
553
  : d.exposure === 'high'
491
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.`
@@ -496,10 +559,14 @@ exports.TEXT = {
496
559
  // --- de dónde sale la primera carga ---
497
560
  assetOrigin: (d) => ({
498
561
  chip: 'los assets salen de otro host',
499
- title: d.origins.length === 1
500
- ? `${d.scripts} ficheros de JavaScript de la primera carga se sirven desde ${d.origins[0]}, no desde el origen de la página`
501
- : `El JavaScript de la primera carga se reparte entre ${d.origins.length} hosts que no son el de la página`,
502
- 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
503
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í.`
504
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.`,
505
572
  fix: d.cold.length > 0
@@ -723,7 +790,11 @@ exports.TEXT = {
723
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}`,
724
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.',
725
792
  }),
726
- dupeZone: { boot: 'in the bootstrap', shared: 'in a shared chunk', own: 'in a single screen' },
793
+ dupeZone: {
794
+ boot: 'in the bootstrap',
795
+ shared: 'in a shared chunk',
796
+ own: 'loaded lazily, by one screen at most',
797
+ },
727
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}` : ''}.`,
728
799
  dupes: (d) => ({
729
800
  chip: 'duplicate copies',
@@ -742,7 +813,7 @@ exports.TEXT = {
742
813
  title: d.count === 1
743
814
  ? `${d.label} includes ${d.own} that nothing else uses`
744
815
  : `${d.count} screens carry far more code of their own than the rest, worst of them ${d.label} with ${d.own}`,
745
- 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}.` : ''}`,
746
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.',
747
818
  }),
748
819
  ownInBoot: (d) => ({
@@ -799,8 +870,8 @@ exports.TEXT = {
799
870
  title: d.most
800
871
  ? `${d.count} of your ${d.total} chunks (${d.size}) are in no figure here`
801
872
  : `${d.count} chunk${d.count > 1 ? 's' : ''} (${d.size}) that nothing reaches from the entry point`,
802
- 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.`,
803
- 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.`,
804
875
  }),
805
876
  prefetched: (d) => ({
806
877
  chip: 'screens fetched before anybody asks',
@@ -814,7 +885,7 @@ exports.TEXT = {
814
885
  ? `All ${d.unnamed} of your screens are named after their chunk, so the table above cannot be read`
815
886
  : 'This folder carries no .map files, and that cuts the report short',
816
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.`,
817
- 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.` : ''}`,
818
889
  }),
819
890
  splitDrift: (d) => ({
820
891
  chip: 'the breakdown does not add up to the file',
@@ -822,13 +893,13 @@ exports.TEXT = {
822
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
823
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."
824
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'}.`,
825
- 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.`,
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.`,
826
897
  }),
827
898
  sourceMaps: (d) => ({
828
899
  chip: 'source maps in the folder',
829
900
  title: `The build folder carries ${d.count === 1 ? '1 source map' : `${d.count} source maps`}`,
830
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.',
831
- 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.`,
832
903
  }),
833
904
  clean: (d) => ({
834
905
  chip: 'no signals',
@@ -890,9 +961,9 @@ exports.TEXT = {
890
961
  chip: 'fonts',
891
962
  title: d.superseded === ''
892
963
  ? `${d.size} of fonts: ${d.files} files across ${d.families} ${d.families === 1 ? 'family' : 'families'}`
893
- : `${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`,
894
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.` : ''}`,
895
- 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.`,
896
967
  }),
897
968
  media: (d) => ({
898
969
  chip: 'images and video',
@@ -904,9 +975,17 @@ exports.TEXT = {
904
975
  }),
905
976
  duplicateAssets: (d) => ({
906
977
  chip: 'the same file under two names',
907
- title: `${d.size} in ${d.count === 1 ? 'a file that ships' : `${d.count} files that ship`} twice under different names`,
908
- 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}.`,
909
- 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
+ }),
910
989
  }),
911
990
  unreferencedAssets: (d) => ({
912
991
  chip: 'files nothing reaches',
@@ -928,7 +1007,7 @@ exports.TEXT = {
928
1007
  updateWeight: (d) => ({
929
1008
  chip: 'weight of the update',
930
1009
  title: `Somebody who already had the previous version downloads ${d.size} (${d.pct} % of the build)`,
931
- 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
932
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}.`
933
1012
  : d.carried > 0
934
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.`
@@ -947,7 +1026,7 @@ exports.TEXT = {
947
1026
  ? `${d.name} is ${d.pct} % third-party code and is invalidated by every change of yours`
948
1027
  : `${d.count} chunks mix dependencies with your own code: ${d.size} is re-invalidated on every deploy`,
949
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}.`,
950
- 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.`,
951
1030
  }),
952
1031
  unhashable: (d) => ({
953
1032
  chip: 'names that cannot be cached',
@@ -958,14 +1037,36 @@ exports.TEXT = {
958
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.`,
959
1038
  }),
960
1039
  // --- what reading the text of the build says (IDEAS §F) ---
961
- secretBenign: { firebaseConfig: 'Firebase web configuration: public by design' },
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
+ },
962
1063
  secretOwner: (pkg) => `code of ${pkg}`,
963
1064
  secrets: (d) => ({
964
1065
  chip: d.open > 0 ? 'secrets or internal addresses in the bundle' : 'secret-shaped strings, explained',
965
1066
  title: d.serious > 0
966
1067
  ? `${d.serious === 1 ? 'A string shaped like a credential ships' : `${d.serious} strings shaped like credentials ship`} in the bundle`
967
1068
  : d.open > 0
968
- ? `${d.open} ${d.open === 1 ? 'match' : 'matches'} for a secret or an internal address in the bundle`
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' : ''}`
969
1070
  : `${d.count} ${d.count === 1 ? 'string shaped like a secret that is not one' : 'strings shaped like secrets that are not'}`,
970
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
971
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.`
@@ -986,7 +1087,7 @@ exports.TEXT = {
986
1087
  body: `${d.broken
987
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.'
988
1089
  : d.unattributed
989
- ? `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.`
990
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}.`,
991
1092
  fix: d.broken
992
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.'
@@ -997,8 +1098,8 @@ exports.TEXT = {
997
1098
  sourceExposed: (d) => ({
998
1099
  chip: 'your source code is published',
999
1100
  title: `${d.files} files of your source can be reconstructed from the ${d.maps} source maps in this folder`,
1000
- 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}.`,
1001
- 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.`,
1002
1103
  }),
1003
1104
  thirdParty: (d) => ({
1004
1105
  chip: 'third-party services',
@@ -1029,27 +1130,43 @@ exports.TEXT = {
1029
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}.`,
1030
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.`,
1031
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
+ }),
1032
1141
  // --- against a baseline ---
1033
1142
  bootGrew: (d) => ({
1034
1143
  chip: 'bootstrap has grown',
1035
1144
  title: `The bootstrap has grown ${d.diff} (${d.pct} %) since the baseline`,
1036
- 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)}.`,
1037
- 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).`,
1038
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',
1039
1154
  bootNewPackages: (d) => ({
1040
1155
  chip: 'new package in the bootstrap',
1041
1156
  title: d.count === 1
1042
1157
  ? 'A package has entered the bootstrap since the last measurement'
1043
1158
  : `${d.count} packages have entered the bootstrap since the last measurement`,
1044
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.`,
1045
- 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.`,
1046
1161
  }),
1047
1162
  screensGrew: (d) => ({
1048
1163
  chip: 'screen has grown',
1049
1164
  title: d.count === 1
1050
1165
  ? `${d.top} has grown ${d.diff} (${d.pct} %) in what it loads beyond the bootstrap`
1051
1166
  : `${d.count} screens have grown in what they load beyond the bootstrap; the most, ${d.top} (${d.diff}, ${d.pct} %)`,
1052
- 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
+ : ''}`,
1053
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.',
1054
1171
  }),
1055
1172
  signalsChanged: (d) => ({
@@ -1113,18 +1230,28 @@ exports.TEXT = {
1113
1230
  ? 'hash cascade: low risk'
1114
1231
  : 'hash cascade: medium risk',
1115
1232
  title: d.risk === 'high'
1116
- ? `${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`
1117
1236
  : d.risk === 'low'
1118
1237
  ? `The names are concentrated in ${d.hub}, which weighs ${d.size}: the cascade barely travels`
1119
- : `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}`,
1120
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'
1121
- ? `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.'}`
1122
1243
  : d.risk === 'high'
1123
- ? `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.`
1124
- : `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.`}`,
1125
1250
  fix: `${d.risk === 'low'
1126
- ? `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.`
1127
- : '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'
1128
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.'
1129
1256
  : d.exposure === 'high'
1130
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.`
@@ -1135,10 +1262,14 @@ exports.TEXT = {
1135
1262
  // --- where the first load comes from ---
1136
1263
  assetOrigin: (d) => ({
1137
1264
  chip: 'assets served from another host',
1138
- title: d.origins.length === 1
1139
- ? `${d.scripts} JavaScript files of the first load are served from ${d.origins[0]}, not from the page's own origin`
1140
- : `The JavaScript of the first load is spread across ${d.origins.length} hosts that are not the page's own`,
1141
- 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
1142
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.`
1143
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.`,
1144
1275
  fix: d.cold.length > 0