@bymaksym/loadline 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/cli/main.js +7 -4
- package/dist/cli/cli/read/locate.js +61 -0
- package/dist/cli/cli/read/read-build.js +7 -4
- package/dist/cli/cli/read/read-config.js +21 -3
- package/dist/cli/cli/render/render-json.js +1 -0
- package/dist/cli/cli/render/render-text.js +25 -1
- package/dist/cli/cli/report.js +10 -3
- package/dist/cli/cli/text/text-errors.js +14 -0
- package/dist/cli/cli/text/text.js +4 -0
- package/dist/cli/cli/text/usage.js +4 -4
- package/dist/cli/src/app/core/analysis/analysis.js +18 -4
- package/dist/cli/src/app/core/analysis/sourcemap/index-map.js +193 -0
- package/dist/cli/src/app/core/analysis/sourcemap/sourcemap.js +2 -1
- package/dist/cli/src/app/core/analysis/sourcemap/split-drift.js +39 -1
- package/dist/cli/src/app/core/assets/assets.js +35 -6
- package/dist/cli/src/app/core/caching/caching.js +1 -0
- package/dist/cli/src/app/core/deps/deps.js +68 -19
- package/dist/cli/src/app/core/export/summary.js +2 -1
- package/dist/cli/src/app/core/findings/actions.js +24 -3
- package/dist/cli/src/app/core/findings/bundle/dupes.js +22 -7
- package/dist/cli/src/app/core/findings/bundle/requests.js +1 -0
- package/dist/cli/src/app/core/findings/bundle/shipped.js +17 -2
- package/dist/cli/src/app/core/findings/effort.js +5 -5
- package/dist/cli/src/app/core/findings/folder/assets.js +13 -2
- package/dist/cli/src/app/core/findings/folder/caching.js +5 -5
- package/dist/cli/src/app/core/findings/folder/scan.js +2 -7
- package/dist/cli/src/app/core/findings/supplied/forbidden.js +1 -1
- package/dist/cli/src/app/core/findings/text/finding-html.js +25 -2
- package/dist/cli/src/app/core/findings/text/finding-text.js +88 -42
- package/dist/cli/src/app/core/findings/text/tool-advice.js +33 -1
- package/dist/cli/src/app/core/format/format.utils.js +14 -1
- package/dist/cli/src/app/core/i18n/en.js +57 -0
- package/dist/cli/src/app/core/i18n/es.js +57 -0
- package/dist/cli/src/app/core/intake/bundle-graph.js +2 -1
- package/dist/cli/src/app/core/intake/native-export.js +84 -0
- package/dist/cli/src/app/core/project/budget-advice.js +22 -1
- package/dist/cli/src/app/core/project/project-name.js +32 -4
- package/dist/cli/src/app/core/scan/scan.js +56 -8
- package/dist/cli/src/app/core/situation/situation.js +3 -3
- package/dist/cli/src/app/core/whatif/source-importers.js +2 -1
- package/docs/CONFIG.md +2 -1
- package/docs/HOW-IT-WORKS.md +90 -7
- package/loadline.html +23 -21
- package/package.json +38 -39
|
@@ -23,6 +23,7 @@ exports.TEXT = {
|
|
|
23
23
|
// a Spanish sentence.
|
|
24
24
|
andMore: (count) => `y ${count} más`,
|
|
25
25
|
inPage: 'la pide la página',
|
|
26
|
+
ownInChunk: (size) => `${size} tuyos`,
|
|
26
27
|
each: 'cada uno',
|
|
27
28
|
fileCount: (count) => `${count} ${count === 1 ? 'fichero' : 'ficheros'}`,
|
|
28
29
|
packageBarrelRow: (files, entries, size, inBoot) => `${files} ${files === 1 ? 'fichero entra' : 'ficheros entran'}, ${entries} ${entries === 1 ? 'se importa' : 'se importan'} desde fuera, ${size}${inBoot ? ' (bootstrap)' : ''}`,
|
|
@@ -95,13 +96,21 @@ exports.TEXT = {
|
|
|
95
96
|
body: `Se paga el peso dos veces porque dos dependencias piden rangos incompatibles.${d.inBoot
|
|
96
97
|
? ' Una de las copias está en el bootstrap, así que ese peso de más lo descarga todo el mundo.'
|
|
97
98
|
: ''} ${d.list}`,
|
|
98
|
-
fix:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
fix: [
|
|
100
|
+
d.apart
|
|
101
|
+
? `<strong>${d.apart.packages}: no se puede deduplicar desde tu proyecto</strong>. ${d.apart.parents} fija su copia a una versión exacta, y la otra va por otra versión mayor. Forzar una sola con ${(0, finding_html_1.mono)('overrides')} o ${(0, finding_html_1.mono)('resolutions')} es meter un cambio de versión mayor dentro de ${d.apart.parents}, que no se ha publicado contra esa versión. Lo razonable es aceptar la señal y esperar a que ${d.apart.parents} se actualice.`
|
|
102
|
+
: '',
|
|
103
|
+
d.override
|
|
104
|
+
? `${d.override.packages}: al menos una de las copias no la pides tú; la importa otra dependencia, así que alinear tu ${(0, finding_html_1.mono)('package.json')} no basta. Fuerza la resolución con ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) o ${(0, finding_html_1.mono)('resolutions')} (yarn), y comprueba que la versión que dejas vale para las dos${d.override.pinnedSame
|
|
105
|
+
? `: ${d.override.pinnedSame} fija su copia a una versión exacta de la misma versión mayor, así que el override cambia una dependencia que esa librería no ha probado`
|
|
103
106
|
: ` —pasa ${(0, finding_html_1.mono)('--lock')} y el informe dirá si alguna está fijada a versión exacta—`}.`
|
|
104
|
-
:
|
|
107
|
+
: '',
|
|
108
|
+
d.align
|
|
109
|
+
? `${d.align}: las dos copias entran por dependencias que pides tú directamente; alinea las versiones en ${(0, finding_html_1.mono)('package.json')} y vuelve a medir.`
|
|
110
|
+
: '',
|
|
111
|
+
]
|
|
112
|
+
.filter(sentence => sentence !== '')
|
|
113
|
+
.join(' '),
|
|
105
114
|
}),
|
|
106
115
|
heavy: (d) => ({
|
|
107
116
|
chip: d.count === 1 ? 'pantalla cara' : 'pantallas caras',
|
|
@@ -142,7 +151,7 @@ exports.TEXT = {
|
|
|
142
151
|
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
|
|
143
152
|
? '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.'
|
|
144
153
|
: `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.`}`,
|
|
145
|
-
fix:
|
|
154
|
+
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, ${(0, tool_advice_1.screenPreload)(d.tool, 'es')}. No es una cuestión de tamaño: fusionar chunks no la arregla si la cadena sigue teniendo la misma profundidad.`,
|
|
146
155
|
}),
|
|
147
156
|
locales: (d) => ({
|
|
148
157
|
chip: 'todos los idiomas de una librería',
|
|
@@ -187,13 +196,17 @@ exports.TEXT = {
|
|
|
187
196
|
title: `El desglose por fichero suma un ${d.percent} % de lo que pesan los chunks que describe`,
|
|
188
197
|
body: `Hay dos medidas del mismo chunk y tendrían que dar lo mismo: lo que pesa el fichero (${d.file}) y lo que suman los pesos por fichero de dentro (${d.measured}), sobre ${d.chunks === 1 ? '1 chunk' : `${d.chunks} chunks`}. No lo dan, así que lo que el ${(0, finding_html_1.mono)('stats.json')} dice que hay dentro de un chunk no es una descripción del fichero que se sirve. ${d.angular
|
|
189
198
|
? '<strong>La causa es el optimizador de chunks de Angular</strong>: después de esbuild vuelve a empaquetar los chunks con Rolldown y reescribe el peso de cada fichero como la longitud de ese paso repartida en proporción, antes de la minificación final. Por eso las partes suman más que el fichero, y en la misma proporción en todos. No son las hojas de estilos de los componentes: esas van dentro del JavaScript y ya están en el peso del fichero.'
|
|
190
|
-
: '<strong>Por qué difieren no se sabe desde aquí</strong> —algo cambió la salida después de escribirlo— y no hace falta saberlo para leer la consecuencia.'} Las cifras de arriba —el arranque, cada pantalla, las idas y vueltas— salen del fichero y son exactas. Las que se miden <strong>dentro</strong> de un chunk —el reparto por paquete, la columna exclusiva, lo que ahorraría un ${(0, finding_html_1.mono)('--what-if')}— salen de esta suma,
|
|
191
|
-
|
|
199
|
+
: '<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, que va un ${d.off} % ${d.high ? 'alta' : 'baja'}. ${d.high
|
|
200
|
+
? '<strong>En este informe están escaladas al peso de cada chunk</strong>: cada fichero conserva su parte y las partes vuelven a sumar el fichero, así que cuadran con las cifras de arriba en todas las fichas. Son un reparto proporcional, no una medida: aproximadas en lo que el reparto se desvíe.'
|
|
201
|
+
: 'Por debajo no se escalan: lo que falta suele ser código que no es de ningún fichero —el runtime del bundler, un envoltorio— y repartirlo sería inventárselo.'}`,
|
|
202
|
+
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, el orden de la lista es correcto${d.high ? ' y las cifras escaladas, una buena aproximación' : ''}.`,
|
|
192
203
|
}),
|
|
193
204
|
sourceMaps: (d) => ({
|
|
194
205
|
chip: 'source maps en la carpeta',
|
|
195
|
-
title: `La carpeta de build trae ${d.count === 1 ? '1 source map' : `${d.count} source maps`}`,
|
|
196
|
-
body:
|
|
206
|
+
title: `La carpeta de build trae ${d.count === 1 ? '1 source map' : `${d.count} source maps`}${d.unread && d.unread === d.count ? ' en un formato que Loadline no lee' : ''}`,
|
|
207
|
+
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.${d.unread
|
|
208
|
+
? ` ${d.unread === d.count ? (d.count === 1 ? 'Este está' : 'Están') : `${d.unread} de ellos están`} en un formato que Loadline no lee —ni JSON con ${(0, finding_html_1.mono)('sources')} y ${(0, finding_html_1.mono)('mappings')}, ni un mapa por secciones con cada mapa dentro—, así que lo que hay dentro de esos chunks no sale de ellos: las cifras de dentro son aproximadas.`
|
|
209
|
+
: ''}`,
|
|
197
210
|
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.`,
|
|
198
211
|
}),
|
|
199
212
|
clean: (d) => ({
|
|
@@ -257,7 +270,9 @@ exports.TEXT = {
|
|
|
257
270
|
title: d.superseded === ''
|
|
258
271
|
? `${d.size} de tipografías: ${d.files} ficheros en ${d.families} ${d.families === 1 ? 'familia' : 'familias'}`
|
|
259
272
|
: `${d.size} de tipografías en el servidor, ${d.spare} de ellos en un segundo formato que ningún navegador actual descarga`,
|
|
260
|
-
body: `Ningún analizador de bundle enseña esto porque todos paran en el JavaScript
|
|
273
|
+
body: `Ningún analizador de bundle enseña esto porque todos paran en el JavaScript${d.widest
|
|
274
|
+
? `: aquí ${(0, finding_html_1.mono)(d.widest.name)} trae ${d.widest.weights} pesos, cuando una interfaz suele usar dos.`
|
|
275
|
+
: ', y los pesos y formatos de una tipografía suman kilobytes que nadie mira.'} ${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.` : ''}`,
|
|
261
276
|
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.`,
|
|
262
277
|
}),
|
|
263
278
|
media: (d) => ({
|
|
@@ -273,14 +288,20 @@ exports.TEXT = {
|
|
|
273
288
|
...(d.count > 0
|
|
274
289
|
? {
|
|
275
290
|
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}.` : ''}`,
|
|
291
|
+
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}.` : ''}${d.icons.count > 0 ? ` Y son iconos de varias plataformas, de los que cada navegador descarga uno: ${d.icons.list}.` : ''}`,
|
|
277
292
|
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
293
|
}
|
|
279
|
-
:
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
294
|
+
: d.stored.count > 0
|
|
295
|
+
? {
|
|
296
|
+
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`,
|
|
297
|
+
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}.${d.icons.count > 0 ? ` Y son iconos de varias plataformas, de los que cada navegador descarga uno: ${d.icons.list}.` : ''}`,
|
|
298
|
+
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.',
|
|
299
|
+
}
|
|
300
|
+
: {
|
|
301
|
+
title: `${d.icons.count === 1 ? 'Un icono' : `${d.icons.count} iconos`} con el mismo dibujo para varias plataformas: cada navegador descarga uno`,
|
|
302
|
+
body: `El contenido es idéntico byte a byte, pero cada copia se nombra como el icono de una plataforma —un ${(0, finding_html_1.mono)('<link rel>')} de la página, el manifiesto, ${(0, finding_html_1.mono)('browserconfig.xml')}—, que es lo que escribe cualquier generador de favicons. Cada navegador elige el suyo, así que nadie descarga dos. ${d.icons.list}.`,
|
|
303
|
+
fix: 'En la visita no hay nada que ahorrar, y quitar una copia puede dejar a una plataforma sin su icono. Si molesta tenerlas repetidas en el servidor, que el manifiesto y los enlaces apunten al mismo fichero.',
|
|
304
|
+
}),
|
|
284
305
|
}),
|
|
285
306
|
unreferencedAssets: (d) => ({
|
|
286
307
|
chip: 'ficheros que no alcanza nadie',
|
|
@@ -318,9 +339,9 @@ exports.TEXT = {
|
|
|
318
339
|
unstableChunk: (d) => ({
|
|
319
340
|
chip: 'chunk que mezcla lo que cambia con lo que no',
|
|
320
341
|
title: d.count === 1
|
|
321
|
-
? `${d.name} es ${d.pct} % código de terceros
|
|
342
|
+
? `${d.name} es ${d.pct} % código de terceros: ${d.own} tuyos hacen que sus ${d.vendor} se vuelvan a descargar en cada despliegue`
|
|
322
343
|
: `${d.count} chunks mezclan dependencias y código tuyo: ${d.size} se reinvalidan en cada despliegue`,
|
|
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}.`,
|
|
344
|
+
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. Lo que mueve el hash es la parte tuya, por pequeña que sea: en ${(0, finding_html_1.mono)(d.name)} son ${d.own}.${d.inBoot ? ' Y está en el bootstrap, así que lo paga toda visita de vuelta.' : ''} ${d.list}.`,
|
|
324
345
|
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.`,
|
|
325
346
|
}),
|
|
326
347
|
unhashable: (d) => ({
|
|
@@ -385,7 +406,9 @@ exports.TEXT = {
|
|
|
385
406
|
? '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.'
|
|
386
407
|
: d.unattributed
|
|
387
408
|
? `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.`
|
|
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.'}
|
|
409
|
+
: '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.copied
|
|
410
|
+
? ` No todo está en un chunk: ${d.copied} no lo escribió el bundler, se copia tal cual al build (de ${(0, finding_html_1.mono)('public/')} o de una carpeta de recursos), así que ningún mapa de fuentes lo va a cubrir: lo que lleva se mira en el propio fichero.`
|
|
411
|
+
: ''} ${d.list}.`,
|
|
389
412
|
fix: d.broken
|
|
390
413
|
? '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.'
|
|
391
414
|
: d.unattributed
|
|
@@ -734,6 +757,7 @@ exports.TEXT = {
|
|
|
734
757
|
rootScreen: 'the root',
|
|
735
758
|
andMore: (count) => `and ${count} more`,
|
|
736
759
|
inPage: 'asked for by the page',
|
|
760
|
+
ownInChunk: (size) => `${size} of yours`,
|
|
737
761
|
each: 'each',
|
|
738
762
|
fileCount: (count) => `${count} ${count === 1 ? 'file' : 'files'}`,
|
|
739
763
|
packageBarrelRow: (files, entries, size, inBoot) => `${files} ${files === 1 ? 'file' : 'files'} in, ${entries} imported from outside, ${size}${inBoot ? ' (bootstrap)' : ''}`,
|
|
@@ -800,13 +824,21 @@ exports.TEXT = {
|
|
|
800
824
|
chip: 'duplicate copies',
|
|
801
825
|
title: `${d.count} package${d.count > 1 ? 's' : ''} shipped more than once`,
|
|
802
826
|
body: `You pay the weight twice because two dependencies ask for incompatible ranges.${d.inBoot ? ' One of the copies is in the bootstrap, so everybody downloads that extra weight.' : ''} ${d.list}`,
|
|
803
|
-
fix:
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
827
|
+
fix: [
|
|
828
|
+
d.apart
|
|
829
|
+
? `<strong>${d.apart.packages}: this cannot be deduplicated from your project</strong>. ${d.apart.parents} pins its copy to an exact version, and the other copy is on another major. Forcing a single one with ${(0, finding_html_1.mono)('overrides')} or ${(0, finding_html_1.mono)('resolutions')} puts a major version change inside ${d.apart.parents}, which was never released against it. The sensible move is to accept the signal and wait for ${d.apart.parents} to update.`
|
|
830
|
+
: '',
|
|
831
|
+
d.override
|
|
832
|
+
? `${d.override.packages}: at least one copy is not one you asked for; another dependency imports it, so aligning your ${(0, finding_html_1.mono)('package.json')} is not enough. Force the resolution with ${(0, finding_html_1.mono)('pnpm.overrides')}, ${(0, finding_html_1.mono)('overrides')} (npm) or ${(0, finding_html_1.mono)('resolutions')} (yarn), and check that the version you keep works for both${d.override.pinnedSame
|
|
833
|
+
? `: ${d.override.pinnedSame} pins its copy to an exact version on the same major, so the override changes a dependency that library has not been tested with`
|
|
808
834
|
: ` — pass ${(0, finding_html_1.mono)('--lock')} and the report will say whether any of them is pinned to an exact version`}.`
|
|
809
|
-
:
|
|
835
|
+
: '',
|
|
836
|
+
d.align
|
|
837
|
+
? `${d.align}: both copies come in through dependencies you ask for directly; align the versions in ${(0, finding_html_1.mono)('package.json')} and measure again.`
|
|
838
|
+
: '',
|
|
839
|
+
]
|
|
840
|
+
.filter(sentence => sentence !== '')
|
|
841
|
+
.join(' '),
|
|
810
842
|
}),
|
|
811
843
|
heavy: (d) => ({
|
|
812
844
|
chip: d.count === 1 ? 'expensive screen' : 'expensive screens',
|
|
@@ -847,7 +879,7 @@ exports.TEXT = {
|
|
|
847
879
|
body: `A browser does not know a chunk exists until it has downloaded and parsed the one importing it, so a screen split across several levels of static imports costs that many requests <strong>in a row</strong>, however little it weighs. <strong>The threshold here is a formula, not a number:</strong> every round trip is at least one latency, so ${d.worstWaves} × ${d.latencyMs} ms = ${d.worstMs} ms that no size figure shows. And it holds under every protocol: no compression touches a round trip, and neither does multiplexing, because what limits this is sequential discovery rather than transport. ${d.count === 1 ? 'One screen takes' : `${d.count} screens take`} ${d.max} or more: ${d.list}. ${d.worstWidth <= 1
|
|
848
880
|
? 'Its widest trip brings a single file: it is a chain end to end, and every level flattened removes a whole wait.'
|
|
849
881
|
: `Its widest trip brings ${d.worstWidth} files: depth and width are different problems and a count of trips reports them as one. Those ${d.worstWidth} cost one trip between them; what costs trips is whatever sits behind them.`}`,
|
|
850
|
-
fix:
|
|
882
|
+
fix: `Look at the chain in the Screens tab: each level is one file statically importing another. It shortens by importing from the screen what reaches it today through an intermediary, ${(0, tool_advice_1.screenPreload)(d.tool, 'en')}. This is not a question of size: merging chunks does not fix it while the chain is as deep.`,
|
|
851
883
|
}),
|
|
852
884
|
locales: (d) => ({
|
|
853
885
|
chip: 'every language of a library',
|
|
@@ -892,13 +924,17 @@ exports.TEXT = {
|
|
|
892
924
|
title: `The per-file breakdown adds up to ${d.percent} % of what the chunks it describes weigh`,
|
|
893
925
|
body: `There are two measurements of the same chunk and they are supposed to agree: what the file weighs (${d.file}) and what the per-file weights inside it add up to (${d.measured}), over ${d.chunks === 1 ? '1 chunk' : `${d.chunks} chunks`}. They do not, so what the ${(0, finding_html_1.mono)('stats.json')} says is inside a chunk is not an account of the file being served. ${d.angular
|
|
894
926
|
? "<strong>The cause is Angular's chunk optimizer</strong>: after esbuild it bundles the chunks again with Rolldown and rewrites each file's weight as that pass's length shared out in proportion, before the final minification. That is why the parts add up to more than the file, and by the same factor in every chunk. It is not the component stylesheets: those are inside the JavaScript and already in the file's weight."
|
|
895
|
-
: '<strong>Why they differ cannot be told from here</strong> — something changed the output after it was written — and it does not have to be known to read the consequence.'} The figures above — the bootstrap, each screen, the round trips — come from the file and are exact. The ones measured <strong>inside</strong> a chunk — the breakdown by package, the exclusive column, what a ${(0, finding_html_1.mono)('--what-if')} would save — come from this sum,
|
|
896
|
-
|
|
927
|
+
: '<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, which is ${d.off} % ${d.high ? 'high' : 'low'}. ${d.high
|
|
928
|
+
? "<strong>In this report they are scaled to each chunk's weight</strong>: each file keeps its share and the shares add up to the file again, so they agree with the figures above on every card. They are a proportion, not a measurement: approximate by as much as the share is off."
|
|
929
|
+
: "Short is not scaled: what is missing is usually code that is nobody's file — the bundler's runtime, a wrapper — and sharing it out would be making it up."}`,
|
|
930
|
+
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, the order of the list is right${d.high ? ' and the scaled figures are a good approximation' : ''}.`,
|
|
897
931
|
}),
|
|
898
932
|
sourceMaps: (d) => ({
|
|
899
933
|
chip: 'source maps in the folder',
|
|
900
|
-
title: `The build folder carries ${d.count === 1 ? '1 source map' : `${d.count} source maps`}`,
|
|
901
|
-
body:
|
|
934
|
+
title: `The build folder carries ${d.count === 1 ? '1 source map' : `${d.count} source maps`}${d.unread && d.unread === d.count ? ' in a format Loadline does not read' : ''}`,
|
|
935
|
+
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.${d.unread
|
|
936
|
+
? ` ${d.unread === d.count ? (d.count === 1 ? 'This one is' : 'They are') : `${d.unread} of them are`} in a format Loadline does not read — neither JSON with ${(0, finding_html_1.mono)('sources')} and ${(0, finding_html_1.mono)('mappings')}, nor an index map with each map inside its section — so what is inside those chunks does not come from them: the figures inside are approximate.`
|
|
937
|
+
: ''}`,
|
|
902
938
|
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.`,
|
|
903
939
|
}),
|
|
904
940
|
clean: (d) => ({
|
|
@@ -962,7 +998,9 @@ exports.TEXT = {
|
|
|
962
998
|
title: d.superseded === ''
|
|
963
999
|
? `${d.size} of fonts: ${d.files} files across ${d.families} ${d.families === 1 ? 'family' : 'families'}`
|
|
964
1000
|
: `${d.size} of fonts on the server, ${d.spare} of it in a second format no current browser downloads`,
|
|
965
|
-
body: `No bundle analyser shows this, because they all stop at the JavaScript
|
|
1001
|
+
body: `No bundle analyser shows this, because they all stop at the JavaScript${d.widest
|
|
1002
|
+
? `: here ${(0, finding_html_1.mono)(d.widest.name)} ships ${d.widest.weights} weights, where an interface usually uses two.`
|
|
1003
|
+
: ', and the weights and formats of a typeface add up to kilobytes nobody looks at.'} ${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.` : ''}`,
|
|
966
1004
|
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.`,
|
|
967
1005
|
}),
|
|
968
1006
|
media: (d) => ({
|
|
@@ -978,14 +1016,20 @@ exports.TEXT = {
|
|
|
978
1016
|
...(d.count > 0
|
|
979
1017
|
? {
|
|
980
1018
|
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}.` : ''}`,
|
|
1019
|
+
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}.` : ''}${d.icons.count > 0 ? ` And these are icons for several platforms, each browser downloading one: ${d.icons.list}.` : ''}`,
|
|
982
1020
|
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
1021
|
}
|
|
984
|
-
:
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1022
|
+
: d.stored.count > 0
|
|
1023
|
+
? {
|
|
1024
|
+
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`,
|
|
1025
|
+
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}.${d.icons.count > 0 ? ` And these are icons for several platforms, each browser downloading one: ${d.icons.list}.` : ''}`,
|
|
1026
|
+
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.',
|
|
1027
|
+
}
|
|
1028
|
+
: {
|
|
1029
|
+
title: `${d.icons.count === 1 ? 'An icon' : `${d.icons.count} icons`} with the same picture for several platforms: each browser downloads one`,
|
|
1030
|
+
body: `The content is identical byte for byte, but each copy is named as one platform's icon — a ${(0, finding_html_1.mono)('<link rel>')} of the page, the manifest, ${(0, finding_html_1.mono)('browserconfig.xml')} — which is what any favicon generator writes. Each browser picks its own, so nobody downloads two. ${d.icons.list}.`,
|
|
1031
|
+
fix: 'There is nothing to save on the visit, and removing a copy can leave a platform without its icon. If the repetition on the server bothers you, point the manifest and the links at one file.',
|
|
1032
|
+
}),
|
|
989
1033
|
}),
|
|
990
1034
|
unreferencedAssets: (d) => ({
|
|
991
1035
|
chip: 'files nothing reaches',
|
|
@@ -1023,9 +1067,9 @@ exports.TEXT = {
|
|
|
1023
1067
|
unstableChunk: (d) => ({
|
|
1024
1068
|
chip: 'chunk mixing what changes with what does not',
|
|
1025
1069
|
title: d.count === 1
|
|
1026
|
-
? `${d.name} is ${d.pct} % third-party code
|
|
1070
|
+
? `${d.name} is ${d.pct} % third-party code: ${d.own} of yours make its ${d.vendor} download again on every deploy`
|
|
1027
1071
|
: `${d.count} chunks mix dependencies with your own code: ${d.size} is re-invalidated on every deploy`,
|
|
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}.`,
|
|
1072
|
+
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. What moves the hash is your part, however small: in ${(0, finding_html_1.mono)(d.name)} it is ${d.own}.${d.inBoot ? ' And it is in the bootstrap, so every returning visit pays for it.' : ''} ${d.list}.`,
|
|
1029
1073
|
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.`,
|
|
1030
1074
|
}),
|
|
1031
1075
|
unhashable: (d) => ({
|
|
@@ -1088,7 +1132,9 @@ exports.TEXT = {
|
|
|
1088
1132
|
? '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.'
|
|
1089
1133
|
: d.unattributed
|
|
1090
1134
|
? `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.`
|
|
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.'}
|
|
1135
|
+
: '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.copied
|
|
1136
|
+
? ` Not all of it is in a chunk: ${d.copied} was not written by the bundler but copied into the build as it is (from ${(0, finding_html_1.mono)('public/')} or an assets folder), so no source map will cover it: what it holds is read in the file itself.`
|
|
1137
|
+
: ''} ${d.list}.`,
|
|
1092
1138
|
fix: d.broken
|
|
1093
1139
|
? '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.'
|
|
1094
1140
|
: d.unattributed
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* one line that applies; without it, it is the two common ones, as before.
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.webpackSplit = exports.mayBeAngular = exports.mapsHidden = exports.mapsOn = void 0;
|
|
11
|
+
exports.screenPreload = exports.webpackSplit = exports.mayBeAngular = exports.mapsHidden = exports.mapsOn = void 0;
|
|
12
12
|
const finding_html_1 = require("./finding-html");
|
|
13
13
|
const VITE_CONFIG = { en: 'vite.config', es: 'vite.config' };
|
|
14
14
|
/** Source maps on. */
|
|
@@ -95,3 +95,35 @@ const webpackSplit = (tool, lang) => {
|
|
|
95
95
|
: `in webpack with a group of ${(0, finding_html_1.mono)('optimization.splitChunks.cacheGroups')} for ${(0, finding_html_1.mono)('node_modules')}; `;
|
|
96
96
|
};
|
|
97
97
|
exports.webpackSplit = webpackSplit;
|
|
98
|
+
/**
|
|
99
|
+
* How the tool that wrote the build fetches a screen's chunks before the chain discovers them, as
|
|
100
|
+
* the clause the advice on deep screens ends with. It named Vite's preload list in an Angular app,
|
|
101
|
+
* whose answer is the router's preloading — which that app did not have.
|
|
102
|
+
*/
|
|
103
|
+
const screenPreload = (tool, lang) => {
|
|
104
|
+
const es = lang === 'es';
|
|
105
|
+
if (tool?.framework === 'angular') {
|
|
106
|
+
return es
|
|
107
|
+
? `o haciendo que el router de Angular precargue las rutas lazy con ${(0, finding_html_1.mono)('withPreloading(PreloadAllModules)')} en ${(0, finding_html_1.mono)('provideRouter')} (${(0, finding_html_1.mono)('preloadingStrategy')} en ${(0, finding_html_1.mono)('RouterModule.forRoot')}): los niveles de la cadena se pagan en tiempo libre, antes del clic`
|
|
108
|
+
: `or by having Angular's router preload the lazy routes with ${(0, finding_html_1.mono)('withPreloading(PreloadAllModules)')} in ${(0, finding_html_1.mono)('provideRouter')} (${(0, finding_html_1.mono)('preloadingStrategy')} in ${(0, finding_html_1.mono)('RouterModule.forRoot')}): the levels of the chain are paid in idle time, before the click`;
|
|
109
|
+
}
|
|
110
|
+
if (tool?.bundler === 'vite' || tool?.framework === 'nuxt' || tool?.framework === 'sveltekit') {
|
|
111
|
+
return es
|
|
112
|
+
? `o dejando que el cargador pida la lista entera de golpe, que es lo que hace la lista de precarga de Vite (${(0, finding_html_1.mono)('build.modulePreload')}, activa salvo que se apague)`
|
|
113
|
+
: `or by letting the loader ask for the whole list at once, which is what Vite's preload list does (${(0, finding_html_1.mono)('build.modulePreload')}, on unless switched off)`;
|
|
114
|
+
}
|
|
115
|
+
if (tool?.bundler === 'webpack') {
|
|
116
|
+
return es
|
|
117
|
+
? `o marcando el ${(0, finding_html_1.mono)('import()')} de la pantalla con ${(0, finding_html_1.mono)('/* webpackPrefetch: true */')}, para que webpack baje sus chunks en tiempo libre`
|
|
118
|
+
: `or by marking the screen's ${(0, finding_html_1.mono)('import()')} with ${(0, finding_html_1.mono)('/* webpackPrefetch: true */')}, so webpack fetches its chunks in idle time`;
|
|
119
|
+
}
|
|
120
|
+
if (tool?.bundler) {
|
|
121
|
+
return es
|
|
122
|
+
? `o nombrando los chunks de la pantalla con ${(0, finding_html_1.mono)('<link rel="modulepreload">')} cuando se vaya a abrir`
|
|
123
|
+
: `or by naming the screen's chunks with ${(0, finding_html_1.mono)('<link rel="modulepreload">')} when it is about to open`;
|
|
124
|
+
}
|
|
125
|
+
return es
|
|
126
|
+
? 'o —si el bundler lo permite— haciendo que el cargador pida la lista entera de golpe, como la lista de precarga de Vite o la precarga del router de Angular'
|
|
127
|
+
: "or — where the bundler allows it — by having the loader ask for the whole list at once, as Vite's preload list or Angular's router preloading do";
|
|
128
|
+
};
|
|
129
|
+
exports.screenPreload = screenPreload;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/** Presentation helpers and metafile path normalisation. */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.matchesStars = exports.namedBy = exports.formatDelta = exports.elidePath = exports.uniqueLabels = exports.screenLabel = exports.chunkLabel = exports.SOURCE_EXTENSION = exports.ROUTE_SUFFIXES = exports.VIEW_SUFFIXES = exports.projectFolderOf = exports.chainSteps = exports.packageOf = exports.shortName = exports.ANGULAR_BAZEL = exports.baseName = exports.formatCount = exports.formatBytesApart = exports.formatBytes = exports.setUnitSpace = exports.setNumberLang = void 0;
|
|
4
|
+
exports.matchesStars = exports.namedBy = exports.formatDelta = exports.elidePath = exports.uniqueLabels = exports.screenLabel = exports.chunkLabel = exports.SOURCE_EXTENSION = exports.ROUTE_SUFFIXES = exports.VIEW_SUFFIXES = exports.projectFolderOf = exports.chainSteps = exports.packageOf = exports.shortName = exports.ANGULAR_BAZEL = exports.baseName = exports.formatShare = exports.formatCount = exports.formatBytesApart = exports.formatBytes = exports.setUnitSpace = exports.setNumberLang = void 0;
|
|
5
5
|
const ownership_1 = require("./ownership");
|
|
6
6
|
const KB = 1024;
|
|
7
7
|
/**
|
|
@@ -68,6 +68,19 @@ exports.formatBytesApart = formatBytesApart;
|
|
|
68
68
|
*/
|
|
69
69
|
const formatCount = (value) => numbers.counts.format(value);
|
|
70
70
|
exports.formatCount = formatCount;
|
|
71
|
+
/**
|
|
72
|
+
* A share as a percentage that never rounds to a whole it is not: 0.9979 is "99.7", not "100", and
|
|
73
|
+
* 0.002 is "0.2", not "0". A chunk said to be "100 % dependencies" reads as one that never changes,
|
|
74
|
+
* when the 0.2 % left is exactly what makes it download again on every deploy.
|
|
75
|
+
*/
|
|
76
|
+
const formatShare = (ratio) => {
|
|
77
|
+
const whole = Math.round(ratio * 100);
|
|
78
|
+
if (whole >= 100 && ratio < 1) {
|
|
79
|
+
return numbers.counts.format(Math.min(99.9, Math.floor(ratio * 1000) / 10));
|
|
80
|
+
}
|
|
81
|
+
return whole <= 0 && ratio > 0 ? numbers.counts.format(Math.max(0.1, Math.ceil(ratio * 1000) / 10)) : String(whole);
|
|
82
|
+
};
|
|
83
|
+
exports.formatShare = formatShare;
|
|
71
84
|
/** Last segment of a path: `chunk-ABC.js`, `login.page.ts`. */
|
|
72
85
|
const baseName = (path) => path.split('/').pop() ?? path;
|
|
73
86
|
exports.baseName = baseName;
|
|
@@ -508,6 +508,63 @@ exports.EN = {
|
|
|
508
508
|
mapLegendOwn: 'your code',
|
|
509
509
|
mapEmpty: 'Nothing to draw with this filter.',
|
|
510
510
|
mapPick: 'Hover a rectangle, or Tab through them, to see what it is.',
|
|
511
|
+
tabFlow: 'Flow',
|
|
512
|
+
howToFlow: '<p>Bytes flow left to right. On the left, each <strong>package</strong> (and your own code), as tall as what it weighs in the build. In the middle, <strong>where those bytes live</strong>: the bootstrap, which every screen downloads before anything; the shared chunks, which several screens download; and each screen’s own chunks. On the right, each <strong>screen</strong> with its first trip: bootstrap + shared + own.</p><p>The colour of a ribbon is where it lives: grey bootstrap, orange shared, green one screen only. <strong>The left and the middle count each byte once; the right counts it once per screen that downloads it</strong>, so it has a scale of its own and a ribbon narrows or widens on its way there. A chunk six screens download leaves in six ribbons.</p><p>Hover a package to light the part of every ribbon that is that package, and see which screens pay for it. Click it, or press Enter on it, to pin it and open its detail; Escape clears. The table has the same numbers.</p>',
|
|
513
|
+
secFlow: 'Where the bytes go',
|
|
514
|
+
secFlowSub: 'Which package makes which screen heavy, and whether every screen pays for it.',
|
|
515
|
+
flowColSources: 'Packages',
|
|
516
|
+
flowColMiddles: 'Where they live',
|
|
517
|
+
flowColTargets: 'Screens · first trip',
|
|
518
|
+
flowOwnCode: 'Your code',
|
|
519
|
+
flowUnattributed: 'Bundler code',
|
|
520
|
+
flowUnknown: 'Not broken down',
|
|
521
|
+
flowMorePackages: count => `${count} more packages`,
|
|
522
|
+
flowBoot: 'Bootstrap',
|
|
523
|
+
flowMoreShared: count => `${count} more shared chunks`,
|
|
524
|
+
flowOwnChunks: 'Each screen’s own',
|
|
525
|
+
flowMoreScreens: count => `${count} other screens`,
|
|
526
|
+
flowApp: 'The page',
|
|
527
|
+
flowReachAll: 'every screen',
|
|
528
|
+
flowReachOnly: screen => `only ${screen}`,
|
|
529
|
+
flowReach: screens => (screens === 1 ? 'on 1 screen' : `on ${screens} screens`),
|
|
530
|
+
flowOneEach: 'one screen each',
|
|
531
|
+
flowScale: 'Left and middle: bytes in the build, counted once. Right: what each screen downloads, so a chunk five screens load reaches five of them.',
|
|
532
|
+
flowHint: 'Hover or Tab to follow · Enter pins · Escape clears',
|
|
533
|
+
flowView: 'Show as',
|
|
534
|
+
flowViewChart: 'Diagram',
|
|
535
|
+
flowViewTable: 'Table',
|
|
536
|
+
flowLegShared: 'Shared · several screens download it',
|
|
537
|
+
flowTakeawayMisplaced: (pkg, size, importers, where, downloads) => {
|
|
538
|
+
const who = importers.length === 1
|
|
539
|
+
? `${importers[0] ?? ''} imports`
|
|
540
|
+
: importers.length === 2
|
|
541
|
+
? `${importers[0] ?? ''} and ${importers[1] ?? ''} import`
|
|
542
|
+
: `${importers.length} screens import`;
|
|
543
|
+
const place = where === 'boot' ? 'the bootstrap' : 'a shared chunk';
|
|
544
|
+
return `${pkg} is ${size} and only ${who} it, but it sits in ${place}: ${downloads} screens download it.`;
|
|
545
|
+
},
|
|
546
|
+
flowTakeawayDriver: (pkg, size, screen, total, where, downloads) => where === 'shared'
|
|
547
|
+
? `${pkg} (${size}) is what makes ${screen} the heaviest screen (${total}); it sits in a shared chunk, so ${downloads} screens download it.`
|
|
548
|
+
: downloads === 1
|
|
549
|
+
? `${pkg} (${size}) is what makes ${screen} the heaviest screen (${total}), and only ${screen} downloads it.`
|
|
550
|
+
: `${pkg} (${size}) is what makes ${screen} the heaviest screen (${total}), and ${downloads} screens download it.`,
|
|
551
|
+
flowTakeawayBoot: (pkg, size, boot, screens) => screens > 0
|
|
552
|
+
? `Every screen starts with the same ${boot} of bootstrap; the heaviest part of it is ${pkg} (${size}).`
|
|
553
|
+
: `The page downloads ${boot} before anything; the heaviest part of it is ${pkg} (${size}).`,
|
|
554
|
+
flowTakeawayScreen: (screen, total, boot, shared, own) => `${screen} downloads the most on its first trip, ${total}: ${boot} of bootstrap every screen pays, ${shared} shared with other screens and ${own} of its own. Source maps in the folder would say which packages.`,
|
|
555
|
+
flowPick: 'Hover a package or a screen, or Tab to it, to follow its bytes. Click to pin it here.',
|
|
556
|
+
flowClear: 'Clear',
|
|
557
|
+
flowWhere: 'Where it lives',
|
|
558
|
+
flowDownloadedBy: 'Who downloads it',
|
|
559
|
+
flowBeyondBoot: 'What it downloads on top of the bootstrap',
|
|
560
|
+
flowMadeOf: 'What fills it',
|
|
561
|
+
flowGrouped: 'Grouped here',
|
|
562
|
+
flowThPackage: 'Package',
|
|
563
|
+
flowThReach: 'Downloaded by',
|
|
564
|
+
flowThTrip: 'First trip',
|
|
565
|
+
flowThDriver: 'Heaviest beyond the bootstrap',
|
|
566
|
+
flowEmpty: 'Nothing to draw: no chunk of this build is downloaded by a screen.',
|
|
567
|
+
flowOpen: 'See where the bytes go',
|
|
511
568
|
secBoot: 'What is in the bootstrap',
|
|
512
569
|
secBootSub: 'What downloads before anything appears, grouped by package and by your own folders.',
|
|
513
570
|
secShared: 'Shared chunks',
|
|
@@ -512,6 +512,63 @@ exports.ES = {
|
|
|
512
512
|
mapLegendOwn: 'código tuyo',
|
|
513
513
|
mapEmpty: 'Nada que dibujar con este filtro.',
|
|
514
514
|
mapPick: 'Pasa el ratón por un rectángulo o recórrelos con Tab para ver qué es.',
|
|
515
|
+
tabFlow: 'Flujo',
|
|
516
|
+
howToFlow: '<p>Los bytes van de izquierda a derecha. A la izquierda, cada <strong>paquete</strong> (y tu propio código), tan alto como lo que pesa en el build. En el centro, <strong>dónde viven esos bytes</strong>: el bootstrap, que toda pantalla descarga antes que nada; los chunks compartidos, que descargan varias pantallas; y los chunks propios de cada pantalla. A la derecha, cada <strong>pantalla</strong> con su primer viaje: bootstrap + compartido + propio.</p><p>El color de una cinta es dónde vive: gris bootstrap, naranja compartido, verde solo una pantalla. <strong>La izquierda y el centro cuentan cada byte una vez; la derecha lo cuenta una vez por cada pantalla que lo descarga</strong>, así que tiene su propia escala y una cinta se estrecha o se ensancha al llegar. Un chunk que descargan seis pantallas sale en seis cintas.</p><p>Pasa el ratón por un paquete para iluminar la parte de cada cinta que es ese paquete y ver qué pantallas lo pagan. Haz clic, o pulsa Intro sobre él, para fijarlo y abrir su detalle; Escape lo quita. La tabla tiene las mismas cifras.</p>',
|
|
517
|
+
secFlow: 'A dónde van los bytes',
|
|
518
|
+
secFlowSub: 'Qué paquete hace pesada cada pantalla, y si lo paga toda pantalla o solo algunas.',
|
|
519
|
+
flowColSources: 'Paquetes',
|
|
520
|
+
flowColMiddles: 'Dónde viven',
|
|
521
|
+
flowColTargets: 'Pantallas · primer viaje',
|
|
522
|
+
flowOwnCode: 'Tu código',
|
|
523
|
+
flowUnattributed: 'Código del bundler',
|
|
524
|
+
flowUnknown: 'Sin desglosar',
|
|
525
|
+
flowMorePackages: count => `${count} paquetes más`,
|
|
526
|
+
flowBoot: 'Bootstrap',
|
|
527
|
+
flowMoreShared: count => `${count} chunks compartidos más`,
|
|
528
|
+
flowOwnChunks: 'Propio de cada pantalla',
|
|
529
|
+
flowMoreScreens: count => `${count} pantallas más`,
|
|
530
|
+
flowApp: 'La página',
|
|
531
|
+
flowReachAll: 'toda pantalla',
|
|
532
|
+
flowReachOnly: screen => `solo ${screen}`,
|
|
533
|
+
flowReach: screens => (screens === 1 ? 'en 1 pantalla' : `en ${screens} pantallas`),
|
|
534
|
+
flowOneEach: 'una pantalla cada uno',
|
|
535
|
+
flowScale: 'Izquierda y centro: bytes del build, contados una vez. Derecha: lo que descarga cada pantalla, así que un chunk que cargan cinco pantallas llega a las cinco.',
|
|
536
|
+
flowHint: 'Ratón o Tab para seguirlo · Intro fija · Escape quita',
|
|
537
|
+
flowView: 'Ver como',
|
|
538
|
+
flowViewChart: 'Diagrama',
|
|
539
|
+
flowViewTable: 'Tabla',
|
|
540
|
+
flowLegShared: 'Compartido · lo descargan varias pantallas',
|
|
541
|
+
flowTakeawayMisplaced: (pkg, size, importers, where, downloads) => {
|
|
542
|
+
const who = importers.length === 1
|
|
543
|
+
? `lo importa ${importers[0] ?? ''}`
|
|
544
|
+
: importers.length === 2
|
|
545
|
+
? `lo importan ${importers[0] ?? ''} y ${importers[1] ?? ''}`
|
|
546
|
+
: `lo importan ${importers.length} pantallas`;
|
|
547
|
+
const place = where === 'boot' ? 'el bootstrap' : 'un chunk compartido';
|
|
548
|
+
return `${pkg} pesa ${size} y solo ${who}, pero está en ${place}: lo descargan ${downloads} pantallas.`;
|
|
549
|
+
},
|
|
550
|
+
flowTakeawayDriver: (pkg, size, screen, total, where, downloads) => where === 'shared'
|
|
551
|
+
? `${pkg} (${size}) es lo que hace de ${screen} la pantalla más pesada (${total}); está en un chunk compartido, así que lo descargan ${downloads} pantallas.`
|
|
552
|
+
: downloads === 1
|
|
553
|
+
? `${pkg} (${size}) es lo que hace de ${screen} la pantalla más pesada (${total}), y solo lo descarga ${screen}.`
|
|
554
|
+
: `${pkg} (${size}) es lo que hace de ${screen} la pantalla más pesada (${total}), y lo descargan ${downloads} pantallas.`,
|
|
555
|
+
flowTakeawayBoot: (pkg, size, boot, screens) => screens > 0
|
|
556
|
+
? `Toda pantalla empieza por los mismos ${boot} de bootstrap; lo que más pesa en él es ${pkg} (${size}).`
|
|
557
|
+
: `La página descarga ${boot} antes que nada; lo que más pesa en ello es ${pkg} (${size}).`,
|
|
558
|
+
flowTakeawayScreen: (screen, total, boot, shared, own) => `${screen} es la que más descarga en su primer viaje, ${total}: ${boot} de bootstrap que paga toda pantalla, ${shared} compartidos con otras y ${own} propios. Con los source maps en la carpeta se vería qué paquetes.`,
|
|
559
|
+
flowPick: 'Pasa el ratón por un paquete o una pantalla, o llega con Tab, para seguir sus bytes. Haz clic para fijarlo aquí.',
|
|
560
|
+
flowClear: 'Quitar',
|
|
561
|
+
flowWhere: 'Dónde vive',
|
|
562
|
+
flowDownloadedBy: 'Quién lo descarga',
|
|
563
|
+
flowBeyondBoot: 'Lo que descarga además del bootstrap',
|
|
564
|
+
flowMadeOf: 'Qué lo llena',
|
|
565
|
+
flowGrouped: 'Agrupado aquí',
|
|
566
|
+
flowThPackage: 'Paquete',
|
|
567
|
+
flowThReach: 'Lo descargan',
|
|
568
|
+
flowThTrip: 'Primer viaje',
|
|
569
|
+
flowThDriver: 'Lo más pesado además del bootstrap',
|
|
570
|
+
flowEmpty: 'Nada que dibujar: ningún chunk de este build lo descarga una pantalla.',
|
|
571
|
+
flowOpen: 'Ver a dónde van los bytes',
|
|
515
572
|
secBoot: 'Qué hay en el bootstrap',
|
|
516
573
|
secBootSub: 'Lo que se descarga antes de ver nada, agrupado por paquete y por carpeta tuya.',
|
|
517
574
|
secShared: 'Chunks compartidos',
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.readFolderGraph = exports.readBundleGraph = exports.entrySourceOf = exports.resolveFrom = void 0;
|
|
26
|
+
const index_map_1 = require("../analysis/sourcemap/index-map");
|
|
26
27
|
const sourcemap_1 = require("../analysis/sourcemap/sourcemap");
|
|
27
28
|
const index_html_1 = require("../build-text/index-html");
|
|
28
29
|
const route_table_1 = require("../build-text/route-table");
|
|
@@ -369,7 +370,7 @@ const mapOf = async (chunk, code, byPath) => {
|
|
|
369
370
|
return null;
|
|
370
371
|
}
|
|
371
372
|
try {
|
|
372
|
-
const parsed =
|
|
373
|
+
const parsed = (0, index_map_1.parseSourceMap)(await file.text());
|
|
373
374
|
return (0, sourcemap_1.isSourceMap)(parsed) ? parsed : null;
|
|
374
375
|
}
|
|
375
376
|
catch {
|