@bymaksym/loadline 0.1.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +272 -45
  2. package/dist/cli/cli/args.js +97 -116
  3. package/dist/cli/cli/gates.js +80 -14
  4. package/dist/cli/cli/main.js +275 -31
  5. package/dist/cli/cli/memory.js +114 -0
  6. package/dist/cli/cli/read/declared.js +52 -0
  7. package/dist/cli/cli/read/locate.js +214 -0
  8. package/dist/cli/cli/{read-build.js → read/read-build.js} +156 -87
  9. package/dist/cli/cli/read/read-config.js +120 -0
  10. package/dist/cli/cli/render/html-report.js +111 -0
  11. package/dist/cli/cli/render/render-agent.js +114 -0
  12. package/dist/cli/cli/render/render-asked.js +104 -0
  13. package/dist/cli/cli/render/render-badge.js +140 -0
  14. package/dist/cli/cli/{render-json.js → render/render-json.js} +26 -10
  15. package/dist/cli/cli/{render-markdown.js → render/render-markdown.js} +6 -6
  16. package/dist/cli/cli/{render-pr.js → render/render-pr.js} +37 -15
  17. package/dist/cli/cli/{render-sarif.js → render/render-sarif.js} +11 -6
  18. package/dist/cli/cli/{render-text.js → render/render-text.js} +169 -127
  19. package/dist/cli/cli/render/terminal.js +55 -0
  20. package/dist/cli/cli/report.js +76 -29
  21. package/dist/cli/cli/self-check.js +19 -23
  22. package/dist/cli/cli/since-last.js +45 -0
  23. package/dist/cli/cli/text/text-errors.js +124 -0
  24. package/dist/cli/cli/text/text.js +343 -0
  25. package/dist/cli/cli/text/usage.js +240 -0
  26. package/dist/cli/src/app/core/analysis/analysis.js +68 -24
  27. package/dist/cli/src/app/core/analysis/{barrels.js → graph/barrels.js} +10 -3
  28. package/dist/cli/src/app/core/analysis/{blast.js → graph/blast.js} +56 -17
  29. package/dist/cli/src/app/core/analysis/{cycles.js → graph/cycles.js} +1 -1
  30. package/dist/cli/src/app/core/analysis/{importers.js → graph/importers.js} +1 -1
  31. package/dist/cli/src/app/core/analysis/{insights.js → graph/insights.js} +10 -4
  32. package/dist/cli/src/app/core/analysis/invariant.js +1 -1
  33. package/dist/cli/src/app/core/analysis/metafile.types.js +21 -7
  34. package/dist/cli/src/app/core/analysis/{delivery.js → screens/delivery.js} +1 -1
  35. package/dist/cli/src/app/core/analysis/{entries.js → screens/entries.js} +87 -11
  36. package/dist/cli/src/app/core/analysis/screens/marks.js +32 -0
  37. package/dist/cli/src/app/core/analysis/screens/route-files.js +116 -0
  38. package/dist/cli/src/app/core/analysis/{sourcemap.js → sourcemap/sourcemap.js} +106 -7
  39. package/dist/cli/src/app/core/analysis/{split-drift.js → sourcemap/split-drift.js} +13 -7
  40. package/dist/cli/src/app/core/analysis/tool.js +83 -0
  41. package/dist/cli/src/app/core/assets/assets.js +137 -16
  42. package/dist/cli/src/app/core/baseline/baseline.js +0 -0
  43. package/dist/cli/src/app/core/{intake → build-text}/index-html.js +234 -29
  44. package/dist/cli/src/app/core/build-text/route-table.js +178 -0
  45. package/dist/cli/src/app/core/build-text/tool-marks.js +54 -0
  46. package/dist/cli/src/app/core/caching/caching.js +123 -45
  47. package/dist/cli/src/app/core/caching/from-analysis.js +20 -4
  48. package/dist/cli/src/app/core/config/config-text.js +90 -0
  49. package/dist/cli/src/app/core/config/config-values.js +358 -0
  50. package/dist/cli/src/app/core/config/loadline-config.js +81 -16
  51. package/dist/cli/src/app/core/config/merge-config.js +98 -0
  52. package/dist/cli/src/app/core/deps/deps.js +141 -23
  53. package/dist/cli/src/app/core/deps/pins.js +63 -0
  54. package/dist/cli/src/app/core/export/summary.js +54 -12
  55. package/dist/cli/src/app/core/findings/actions.js +65 -6
  56. package/dist/cli/src/app/core/findings/bundle/boot-single.js +76 -0
  57. package/dist/cli/src/app/core/findings/bundle/dupes.js +68 -0
  58. package/dist/cli/src/app/core/findings/{graph.js → bundle/graph.js} +32 -20
  59. package/dist/cli/src/app/core/findings/{own-in-boot.js → bundle/own-in-boot.js} +9 -5
  60. package/dist/cli/src/app/core/findings/{requests.js → bundle/requests.js} +3 -3
  61. package/dist/cli/src/app/core/findings/{shipped.js → bundle/shipped.js} +30 -18
  62. package/dist/cli/src/app/core/findings/compose.js +6 -1
  63. package/dist/cli/src/app/core/findings/effort.js +4 -0
  64. package/dist/cli/src/app/core/findings/finding.types.js +2 -0
  65. package/dist/cli/src/app/core/findings/findings.js +68 -55
  66. package/dist/cli/src/app/core/findings/{assets.js → folder/assets.js} +65 -16
  67. package/dist/cli/src/app/core/findings/{caching.js → folder/caching.js} +17 -10
  68. package/dist/cli/src/app/core/findings/{page.js → folder/page.js} +6 -2
  69. package/dist/cli/src/app/core/findings/{scan.js → folder/scan.js} +37 -13
  70. package/dist/cli/src/app/core/findings/kind-names.js +163 -0
  71. package/dist/cli/src/app/core/findings/{deps.js → supplied/deps.js} +13 -8
  72. package/dist/cli/src/app/core/findings/supplied/forbidden.js +71 -0
  73. package/dist/cli/src/app/core/findings/{situation.js → supplied/situation.js} +2 -2
  74. package/dist/cli/src/app/core/findings/text/causes.js +39 -0
  75. package/dist/cli/src/app/core/findings/text/finding-html.js +33 -0
  76. package/dist/cli/src/app/core/findings/{finding-text.js → text/finding-text.js} +307 -103
  77. package/dist/cli/src/app/core/findings/text/tool-advice.js +97 -0
  78. package/dist/cli/src/app/core/format/format.utils.js +172 -18
  79. package/dist/cli/src/app/core/format/ownership.js +93 -0
  80. package/dist/cli/src/app/core/i18n/en.js +180 -61
  81. package/dist/cli/src/app/core/i18n/es.js +192 -68
  82. package/dist/cli/src/app/core/intake/bundle-graph.js +285 -46
  83. package/dist/cli/src/app/core/intake/dist-files.js +87 -16
  84. package/dist/cli/src/app/core/intake/embedded.js +56 -0
  85. package/dist/cli/src/app/core/intake/unreached.js +139 -0
  86. package/dist/cli/src/app/core/intake/webpack-modules.js +185 -0
  87. package/dist/cli/src/app/core/intake/webpack-stats.js +298 -0
  88. package/dist/cli/src/app/core/project/budget-advice.js +14 -10
  89. package/dist/cli/src/app/core/project/project-context.js +89 -19
  90. package/dist/cli/src/app/core/project/project-name.js +36 -0
  91. package/dist/cli/src/app/core/scan/scan.js +116 -39
  92. package/dist/cli/src/app/core/scan/secrets.js +0 -0
  93. package/dist/cli/src/app/core/situation/situation-text.js +23 -0
  94. package/dist/cli/src/app/core/situation/situation.js +9 -8
  95. package/dist/cli/src/app/core/timing/timing.js +5 -2
  96. package/dist/cli/src/app/core/whatif/defer.js +29 -4
  97. package/dist/cli/src/app/core/whatif/source-importers.js +58 -0
  98. package/dist/cli/src/app/core/whatif/why.js +102 -0
  99. package/dist/cli/src/app/state/report-messages.utils.js +1 -4
  100. package/docs/CONFIG-REFERENCE.md +230 -0
  101. package/docs/CONFIG.md +511 -0
  102. package/docs/HOW-IT-WORKS.md +286 -25
  103. package/loadline.html +26 -24
  104. package/loadline.schema.json +1209 -0
  105. package/package.json +71 -35
  106. package/dist/cli/cli/text.js +0 -180
  107. package/dist/cli/src/app/core/findings/finding-html.js +0 -13
  108. /package/dist/cli/cli/{read-build.types.js → read/read-build.types.js} +0 -0
  109. /package/dist/cli/cli/{render-json.types.js → render/render-json.types.js} +0 -0
  110. /package/dist/cli/cli/{text.types.js → text/text.types.js} +0 -0
  111. /package/dist/cli/src/app/core/analysis/{exclusive.js → graph/exclusive.js} +0 -0
  112. /package/dist/cli/src/app/core/analysis/{insights.types.js → graph/insights.types.js} +0 -0
  113. /package/dist/cli/src/app/core/analysis/{module-graph.js → graph/module-graph.js} +0 -0
  114. /package/dist/cli/src/app/core/analysis/{sourcemap.types.js → sourcemap/sourcemap.types.js} +0 -0
  115. /package/dist/cli/src/app/core/findings/{finding-plain.js → text/finding-plain.js} +0 -0
@@ -0,0 +1,343 @@
1
+ "use strict";
2
+ /** Both languages of the command's own words. See `text.types.ts` for why they are kept apart. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CLI_TEXT = void 0;
5
+ /** "Fixing both", not "acting on all 2": the line under the ranked signals, as the page words it. */
6
+ const fixingEn = (count) => {
7
+ if (count === 1) {
8
+ return 'Fixing it';
9
+ }
10
+ return count === 2 ? 'Fixing both' : `Fixing all ${count}`;
11
+ };
12
+ const fixingEs = (count) => {
13
+ if (count === 1) {
14
+ return 'Arreglándola';
15
+ }
16
+ return count === 2 ? 'Arreglando las dos' : `Arreglando las ${count}`;
17
+ };
18
+ const EN = {
19
+ lead: (stats, unit, tool) => `${stats} · figures ${unit}${tool ? ` · ${tool}` : ''}`,
20
+ against: (baseline, date) => `compared against ${baseline} (${date})`,
21
+ pageCss: (size, files, total) => `Plus ${size} of CSS in ${files === 1 ? 'the stylesheet' : `${files} stylesheets`} the same page asks for, ` +
22
+ `which block the paint and are not in the figure above: ${total} really comes down first. ` +
23
+ 'This report breaks down JavaScript only.',
24
+ tripInline: size => `(${size} of it inline in the page)`,
25
+ firstTrip: (total, files, parts) => `The whole first trip is ${total} across ${files} ${files === 1 ? 'file' : 'files'} — ${parts} — ` +
26
+ 'counting everything index.html asks for before anything appears. The figure above is the ' +
27
+ 'JavaScript half, which is the half this report can break down.',
28
+ htmlWritten: file => `The page with this build loaded: ${file}`,
29
+ severity: { high: 'high', mid: 'mid', ok: 'ok', info: 'info' },
30
+ exportWritten: file => `This build's snapshot, to be the --baseline of a later run: ${file}`,
31
+ htmlInsideBuild: folder => `It is inside ${folder}, which the next build empties: write it somewhere else to keep it.`,
32
+ located: files => `found ${files}`,
33
+ alsoFound: folders => `the newest build was read; also found ${folders}: pass one of them to read it instead`,
34
+ lastRunUnchanged: 'nothing moved',
35
+ tripFonts: 'fonts',
36
+ tripImages: 'images',
37
+ componentStyles: count => `${count} component ${count === 1 ? 'stylesheet' : 'stylesheets'} of the metafile ${count === 1 ? 'is' : 'are'} ` +
38
+ 'inside the JavaScript: Angular inlines them, so they are not files in the folder and are already in the figures.',
39
+ offPageLeftOut: ({ legacy, serviceWorker, server, ignored }) => `${[
40
+ legacy > 0 &&
41
+ `${legacy === 1 ? '1 file is' : `${legacy} files are`} the copy for browsers without ES modules (nomodule)`,
42
+ serviceWorker > 0 &&
43
+ `${serviceWorker === 1 ? '1 file is' : `${serviceWorker} files are`} the service worker and what it imports`,
44
+ server > 0 && `${server === 1 ? '1 file runs' : `${server} files run`} only on the server (FastBoot)`,
45
+ ignored > 0 && `${ignored === 1 ? '1 file is' : `${ignored} files are`} in build.ignore of loadline.json`,
46
+ ]
47
+ .filter(Boolean)
48
+ .join('; ')}: left out, because no screen downloads them on a current browser.`,
49
+ sinceLast: (date, change, branch) => `since the last run (${date}${branch ? `, on branch ${branch}` : ''}): ${change}`,
50
+ serverLeftOut: count => `${count === 1 ? '1 output of this build is' : `${count} outputs of this build are`} not in the browser folder ` +
51
+ '(the server side of a rendered build, or a file renamed after it was built, as Angular 8 does with its es5 polyfills): left out, because nobody downloads them under that name.',
52
+ blocked: (baseline, now) => `The baseline was measured in ${baseline} and this build in ${now}: nothing is compared. ${baseline === 'raw'
53
+ ? 'Pass --mode raw.'
54
+ : `Pass --mode ${baseline}, with the build folder that has those files.`}`,
55
+ exactSplit: 'weight per file read from the source maps',
56
+ opaqueSome: (chunks, count) => `${count === 1 ? 'One bootstrap chunk carries' : `${count} bootstrap chunks carry`} no source map, so what is inside ${count === 1 ? 'it' : 'them'} is not known: ${chunks}.`,
57
+ opaque: 'No source maps in this folder: what each chunk weighs is known, what is inside it is not. ' +
58
+ 'Screens carry their chunk name, and no saving per package or file can be measured.',
59
+ headBoot: 'Bootstrap',
60
+ headScreens: 'Screens',
61
+ headSignals: 'Signals',
62
+ headGates: 'Gates',
63
+ headActions: 'What to fix first',
64
+ headTime: 'Estimated time',
65
+ headBudget: 'Suggested budget',
66
+ actionsNote: 'An order over the signals below, not a selection: every one of them is still there.',
67
+ colAction: 'Signal',
68
+ colSaving: 'Off the first load',
69
+ colEffort: 'Effort',
70
+ effortLabel: {
71
+ config: 'configuration',
72
+ import: 'one import',
73
+ refactor: 'refactor',
74
+ none: '',
75
+ },
76
+ savingCell: saving => saving || '—',
77
+ totalSaving: (bytes, after, count, estimated) => `${fixingEn(count)} would take ${bytes} off the first load, leaving it at about ${after}. ${estimated
78
+ ? 'Compressed figures are an estimate: the raw bytes taken out, at the ratio the bootstrap ' +
79
+ 'compresses by, since a single module has no compressed size of its own. '
80
+ : 'The figures are raw minified bytes inside the chunk. '}They are not added up: the graph is walked once with every file named above taken out ` +
81
+ 'together, so bytes reachable two ways are counted once.',
82
+ profileName: { slow4g: 'slow 4G', fast4g: '4G', cable: 'cable' },
83
+ timeNote: 'An estimate, not a measurement: a model over the bytes, the round trips and three standard ' +
84
+ 'connection profiles. Transfer and latency go by what travels; parse and compile go by raw ' +
85
+ 'bytes, because that is what the engine works on. Latency is editable in the criteria.',
86
+ timeColumns: { profile: 'Connection', transfer: 'Transfer', latency: 'Latency', script: 'Parse', total: 'Total' },
87
+ budgetNote: (warning, error, current) => `Nothing here writes a file. The initial load is ${current} raw (JavaScript and the CSS the page ` +
88
+ `asks for, which is what Angular's initial budget counts), so a warning at ${warning} and an ` +
89
+ `error at ${error} leaves room for a feature and still stops a pipeline.`,
90
+ bootSummary: (files, screens) => `${files} ${files === 1 ? 'file' : 'files'}, downloaded before anything appears · ${screens} ${screens === 1 ? 'screen' : 'screens'}`,
91
+ noScreens: 'No lazy screens: everything is in the bootstrap.',
92
+ notScreens: parts => `Loaded lazily and not counted as screens: ${parts.join('; ')}.`,
93
+ notScreensPart: {
94
+ blocks: (count, list) => `${count} ${count === 1 ? 'block' : 'blocks'} deferred inside a screen (${list})`,
95
+ groupers: (count, list) => `${count} route ${count === 1 ? 'file' : 'files'}, paid by the screens behind ${count === 1 ? 'it' : 'them'} (${list})`,
96
+ packages: (count, list) => `${count} ${count === 1 ? 'package' : 'packages'} loaded on demand (${list})`,
97
+ data: (count, list) => `${count} data ${count === 1 ? 'chunk' : 'chunks'} (${list})`,
98
+ workers: (count, list) => `${count} web ${count === 1 ? 'worker' : 'workers'} (${list})`,
99
+ onDemand: (count, list) => `${count} ${count === 1 ? 'chunk' : 'chunks'} of yours no route opens: components, tabs, language files (${list})`,
100
+ },
101
+ noRouteTable: 'No route table was found in the code, so every chunk loaded lazily counts as a screen: some of these may be tabs or components inside a page rather than places somebody navigates to.',
102
+ routeCss: (count, list) => `Screens also load ${count === 1 ? 'a stylesheet' : `${count} stylesheets`} of their own (${list}), not in their totals: the figures here are JavaScript.`,
103
+ fix: 'Fix',
104
+ passed: 'Every gate passed.',
105
+ failed: count => `${count} ${count === 1 ? 'gate' : 'gates'} broken.`,
106
+ noGates: 'No gate was asked for: this run reports and never fails.',
107
+ overBoot: (actual, limit) => `Bootstrap is ${actual}, over the ${limit} allowed.`,
108
+ overScreen: (screen, actual, limit) => `Screen ${screen} downloads ${actual}, over the ${limit} allowed.`,
109
+ screenLimitUnmatched: (name, screens) => `loadline.json: "gates.screens" has a limit for "${name}", and no screen has that name, so it guards nothing. ` +
110
+ `The screens are: ${screens.join(', ') || 'none'}.`,
111
+ growthUnchecked: 'The growth gates cannot run, and a gate that cannot run would pass.',
112
+ newPackageUnchecked: '--fail-on-new-package needs something to say what was there before: a --baseline, or a "packages" list in loadline.json.',
113
+ configGrowthSkipped: 'loadline.json: the growth gates need a --baseline, and this run has none, so they were not checked.',
114
+ configNewPackageSkipped: 'loadline.json: "gates.failOnNewPackage" needs a --baseline or a "packages" list, and this run has neither, so it was not checked.',
115
+ overOwn: (screen, actual, limit) => `Own code of ${screen} is ${actual}, over the ${limit} allowed.`,
116
+ growthBoot: (diff, limit) => `Bootstrap grew ${diff}, over the ${limit} allowed.`,
117
+ growthScreen: (screen, diff, limit) => `Screen ${screen} grew ${diff}, over the ${limit} allowed.`,
118
+ growthPctBoot: (percent, limit) => `Bootstrap grew ${percent} %, over the ${limit} % allowed.`,
119
+ growthPctScreen: (screen, percent, limit) => `Screen ${screen} grew ${percent} %, over the ${limit} % allowed.`,
120
+ signalsRaised: (count, level) => `${count} ${count === 1 ? 'signal' : 'signals'} of severity ${level === 'mid' ? 'medium' : 'high'} or above.`,
121
+ signalRaised: (kind, count) => `The ${kind} signal was raised${count === 1 ? '' : ` ${count} times`}, and "gates.failOnSignals" fails on it.`,
122
+ newPackages: names => `${names.length} ${names.length === 1 ? 'package has' : 'packages have'} entered the bootstrap: ${names.join(', ')}.`,
123
+ configRead: file => `thresholds and accepted signals from ${file}`,
124
+ configProblem: (file, problem) => `${file}: ${problem}`,
125
+ accepted: (kind, why, who, until) => `${kind} — ${why}${who ? ` (${who})` : ''}${until ? `, until ${until}` : ', with no end date'}`,
126
+ acceptedExpired: (kind, until) => `${kind} was accepted until ${until}. That date has passed, so it is raised again.`,
127
+ acceptedGrew: (kind, was, now) => `${kind} was accepted at ${was} and is now ${now}. What was agreed to is not what is here, so it is raised again.`,
128
+ headAccepted: 'Accepted, and set aside',
129
+ prFixed: count => `${count} fixed`,
130
+ prNew: count => `${count} new`,
131
+ prDetails: 'The whole report',
132
+ prCut: '(cut to fit a comment: --format text has all of it)',
133
+ screenBudgetNote: (warning, file, size) => 'And one per file. "anyScript" applies to every script the build emits — the bootstrap ones too — ' +
134
+ 'which is what makes it usable when the names carry content hashes and a per-bundle budget cannot ' +
135
+ `name anything. So it goes above the largest script there is today, ${file} at ${size}, or it fails ` +
136
+ `the next build on a file nobody touched — ${warning}:`,
137
+ headWhatIf: 'What if it were deferred',
138
+ whatIfNote: 'The saving is exact: the graph is walked without those files, and what stops being ' +
139
+ 'reachable is what stops being downloaded. What is NOT recomputed is the split — which ' +
140
+ 'files end up in which chunk is the bundler’s decision, and a simulated one would produce ' +
141
+ 'round trips and per-screen totals that look measured and are not. So those are unchanged ' +
142
+ 'above, and the last column says who would be paying for it instead.',
143
+ whatIfNobody: 'nothing lazy uses it',
144
+ whatIfEstimated: 'In compressed figures those are the exact raw bytes at the ratio the bootstrap compresses by: ' +
145
+ 'the right size, not the exact one, hence the ≈.',
146
+ whatIfNotHere: format => `--what-if is not part of the ${format} format: run it again with --format text, summary, json or agent to see the answer.`,
147
+ colWhatIf: 'Deferred',
148
+ headWhy: 'Why it is here',
149
+ whyReach: {
150
+ boot: 'in the first load, through',
151
+ lazy: 'not in the first load: it already arrives behind an import(), through',
152
+ unreached: 'in the build, and nothing reachable from the entry point imports it',
153
+ absent: 'not in this build: no package, folder or file goes by that name',
154
+ unknown: 'cannot be known: without source maps nothing inside a chunk has a name',
155
+ unchained: 'in the first load, and nothing in this build says which file brings it in: a build folder records which chunk holds what, not which file imports which, and no source of the project in its maps names it',
156
+ sourced: 'in the first load. A build folder does not record which file imports which, but the sources inside its maps do',
157
+ deferred: 'not in the first load: it arrives later, with whatever asks for it',
158
+ },
159
+ whyCutSourced: (files, what, upTo) => `${files.length === 1 ? `${files[0]} imports it` : `${files.length} files of yours in the first load import it — ${files.join(', ')}`}. ` +
160
+ `An import() of ${what} there would take up to ${upTo} off the first load: what it weighs in it, and less if part of it also arrives another way.`,
161
+ whyCut: (file, what, saved, through, payers) => `${through ? `It comes in through ${what}. ` : ''}Cut here: an import() of ${what} in ${file} would take ${saved} ` +
162
+ `off the first load${payers ? `, and ${payers} would pay for it instead` : ''}.`,
163
+ whyCutAlso: (file, others, everywhere) => `Cutting it in ${file} alone saves nothing: ${others.length === 1 ? `${others[0]} imports it too` : `${others.length} more files of the first load import it too — ${others.join(', ')}`}. ` +
164
+ `An import() in every one of them would take ${everywhere} off the first load.`,
165
+ whyCutShared: file => `Cutting it in ${file} alone saves nothing: it also arrives another way. The figure under --what-if says how much once every way is cut.`,
166
+ whyNoCut: 'The entry point imports it itself: the import() would go in the entry file.',
167
+ whyNotHere: format => `--why is not part of the ${format} format: run it again with --format text, json or agent to see the answer.`,
168
+ whatIfUnknown: 'cannot be measured',
169
+ whatIfAbsent: 'not in this build',
170
+ whatIfUnknownWhy: 'Where it says "cannot be measured": a build folder records which chunk holds what and not which file imports which, so what would stop being downloaded cannot be walked. The Size column is the most it could be; the stats.json of the build, or the page with it, gives the exact figure.',
171
+ savingUnknown: 'A dash here means "not known", not "nothing": without source maps no saving can be measured.',
172
+ colSize: 'In the bootstrap',
173
+ colAfter: 'Bootstrap after',
174
+ colWhoPays: 'Would then be paid by',
175
+ };
176
+ const ES = {
177
+ lead: (stats, unit, tool) => `${stats} · cifras ${unit}${tool ? ` · ${tool}` : ''}`,
178
+ against: (baseline, date) => `comparado con ${baseline} (${date})`,
179
+ pageCss: (size, files, total) => `Más ${size} de CSS en ${files === 1 ? 'la hoja de estilos' : `${files} hojas de estilos`} que pide la misma ` +
180
+ `página, que bloquean el pintado y no están en la cifra de arriba: ${total} es lo que baja de verdad antes ` +
181
+ 'de nada. Este informe desglosa solo el JavaScript.',
182
+ tripInline: size => `(${size} de ello en línea en la página)`,
183
+ firstTrip: (total, files, parts) => `El primer viaje entero son ${total} en ${files} ${files === 1 ? 'fichero' : 'ficheros'} — ${parts} — ` +
184
+ 'contando todo lo que pide index.html antes de que aparezca nada. La cifra de arriba es la ' +
185
+ 'mitad de JavaScript, que es la que este informe sabe desglosar.',
186
+ htmlWritten: file => `La página con este build cargado: ${file}`,
187
+ severity: { high: 'alta', mid: 'media', ok: 'ok', info: 'info' },
188
+ exportWritten: file => `La foto de este build, para ser la --baseline de otra ejecución: ${file}`,
189
+ htmlInsideBuild: folder => `Está dentro de ${folder}, que el siguiente build vacía: guárdala en otro sitio para conservarla.`,
190
+ located: files => `encontrado ${files}`,
191
+ alsoFound: folders => `se ha leído el build más reciente; también hay ${folders}: pasa uno de ellos para leerlo`,
192
+ lastRunUnchanged: 'no se ha movido nada',
193
+ tripFonts: 'de tipografías',
194
+ tripImages: 'de imágenes',
195
+ componentStyles: count => `${count} ${count === 1 ? 'hoja de estilos de componente del metafile va' : 'hojas de estilos de componente del metafile van'} ` +
196
+ 'dentro del JavaScript: Angular las incrusta, así que no son ficheros de la carpeta y ya están en las cifras.',
197
+ offPageLeftOut: ({ legacy, serviceWorker, server, ignored }) => `${[
198
+ legacy > 0 &&
199
+ `${legacy === 1 ? '1 fichero es' : `${legacy} ficheros son`} la copia para navegadores sin módulos ES (nomodule)`,
200
+ serviceWorker > 0 &&
201
+ `${serviceWorker === 1 ? '1 fichero es' : `${serviceWorker} ficheros son`} el service worker y lo que importa`,
202
+ server > 0 &&
203
+ `${server === 1 ? '1 fichero corre' : `${server} ficheros corren`} solo en el servidor (FastBoot)`,
204
+ ignored > 0 &&
205
+ `${ignored === 1 ? '1 fichero está' : `${ignored} ficheros están`} en build.ignore de loadline.json`,
206
+ ]
207
+ .filter(Boolean)
208
+ .join('; ')}: fuera, porque ninguna pantalla los descarga en un navegador actual.`,
209
+ sinceLast: (date, change, branch) => `desde la última ejecución (${date}${branch ? `, en la rama ${branch}` : ''}): ${change}`,
210
+ serverLeftOut: count => `${count} salida${count === 1 ? '' : 's'} de este build no ${count === 1 ? 'está' : 'están'} en la carpeta ` +
211
+ 'del navegador (el lado servidor de un build con render, o un fichero renombrado después de compilarlo, como hace Angular 8 con sus polyfills es5): fuera, porque nadie las descarga con ese nombre.',
212
+ blocked: (baseline, now) => `La línea base se midió en ${baseline} y este build en ${now}: no se compara nada. ${baseline === 'raw'
213
+ ? 'Pasa --mode raw.'
214
+ : `Pasa --mode ${baseline}, con la carpeta de build que tiene esos ficheros.`}`,
215
+ exactSplit: 'peso por fichero leído de los source maps',
216
+ opaqueSome: (chunks, count) => `${count === 1 ? 'Un chunk del bootstrap no trae' : `${count} chunks del bootstrap no traen`} source map, así que no se sabe qué hay dentro: ${chunks}.`,
217
+ opaque: 'Esta carpeta no trae source maps: se sabe lo que pesa cada chunk y no lo que hay dentro. ' +
218
+ 'Las pantallas llevan el nombre de su chunk, y no se puede medir ningún ahorro por paquete o fichero.',
219
+ headBoot: 'Bootstrap',
220
+ headScreens: 'Pantallas',
221
+ headSignals: 'Señales',
222
+ headGates: 'Gates',
223
+ headActions: 'Qué arreglo primero',
224
+ headTime: 'Tiempo estimado',
225
+ headBudget: 'Budget sugerido',
226
+ actionsNote: 'Es un orden sobre las señales de abajo, no una selección: todas siguen estando.',
227
+ colAction: 'Señal',
228
+ colSaving: 'Fuera de la primera carga',
229
+ colEffort: 'Esfuerzo',
230
+ effortLabel: {
231
+ config: 'configuración',
232
+ import: 'un import',
233
+ refactor: 'refactor',
234
+ none: '',
235
+ },
236
+ savingCell: saving => saving || '—',
237
+ totalSaving: (bytes, after, count, estimated) => `${fixingEs(count)} se quitarían ${bytes} de la primera carga y quedaría en unos ${after}. ${estimated
238
+ ? 'Las cifras comprimidas son una estimación: los bytes en crudo que se quitan, a la proporción ' +
239
+ 'en que se comprime el bootstrap, porque un módulo suelto no tiene tamaño comprimido propio. '
240
+ : 'Las cifras son bytes minificados en crudo dentro del chunk. '}No se suman: el grafo se recorre una vez quitando de golpe todos los ficheros nombrados arriba, ` +
241
+ 'así que lo que se alcanza por dos caminos se cuenta una vez.',
242
+ profileName: { slow4g: '4G lento', fast4g: '4G', cable: 'cable' },
243
+ timeNote: 'Es una estimación, no una medición: un modelo sobre los bytes, las idas y vueltas y tres perfiles ' +
244
+ 'de conexión estándar. La transferencia y la latencia van por lo que viaja; el parseo y la ' +
245
+ 'compilación van por bytes en crudo, que es sobre lo que trabaja el motor. La latencia se edita ' +
246
+ 'en los criterios.',
247
+ timeColumns: {
248
+ profile: 'Conexión',
249
+ transfer: 'Transferencia',
250
+ latency: 'Latencia',
251
+ script: 'Parseo',
252
+ total: 'Total',
253
+ },
254
+ budgetNote: (warning, error, current) => `Aquí no se escribe ningún fichero. La primera carga son ${current} en crudo (el JavaScript y el CSS ` +
255
+ 'que pide la página, que es lo que cuenta el budget initial de Angular), así que un aviso en ' +
256
+ `${warning} y un error en ${error} deja sitio para una funcionalidad y sigue parando un pipeline.`,
257
+ bootSummary: (files, screens) => `${files} ${files === 1 ? 'fichero, descargado' : 'ficheros, descargados'} antes de que aparezca nada · ${screens} ${screens === 1 ? 'pantalla' : 'pantallas'}`,
258
+ noScreens: 'No hay pantallas lazy: todo entra en el bootstrap.',
259
+ notScreens: parts => `Se cargan en diferido y no cuentan como pantallas: ${parts.join('; ')}.`,
260
+ notScreensPart: {
261
+ blocks: (count, list) => `${count} ${count === 1 ? 'bloque diferido' : 'bloques diferidos'} dentro de una pantalla (${list})`,
262
+ groupers: (count, list) => `${count} ${count === 1 ? 'fichero de rutas, que pagan las pantallas que hay detrás' : 'ficheros de rutas, que pagan las pantallas que hay detrás'} (${list})`,
263
+ packages: (count, list) => `${count} ${count === 1 ? 'paquete que se carga' : 'paquetes que se cargan'} cuando hace falta (${list})`,
264
+ data: (count, list) => `${count} ${count === 1 ? 'chunk de datos' : 'chunks de datos'} (${list})`,
265
+ workers: (count, list) => `${count} web ${count === 1 ? 'worker' : 'workers'} (${list})`,
266
+ onDemand: (count, list) => `${count} ${count === 1 ? 'chunk tuyo que no abre' : 'chunks tuyos que no abre'} ninguna ruta: componentes, pestañas, ficheros de idioma (${list})`,
267
+ },
268
+ noRouteTable: 'No se ha encontrado una tabla de rutas en el código, así que cada chunk que se carga en diferido cuenta como pantalla: alguna puede ser una pestaña o un componente dentro de una página y no un sitio al que se navega.',
269
+ routeCss: (count, list) => `Las pantallas también cargan ${count === 1 ? 'una hoja de estilos propia' : `${count} hojas de estilos propias`} (${list}), que sus totales no cuentan: estas cifras son JavaScript.`,
270
+ fix: 'Qué hacer',
271
+ passed: 'No se ha superado ningún gate.',
272
+ failed: count => `${count} ${count === 1 ? 'gate superado' : 'gates superados'}.`,
273
+ noGates: 'No se ha pedido ningún gate: esta ejecución informa y nunca falla.',
274
+ overBoot: (actual, limit) => `El bootstrap es de ${actual} y el límite está en ${limit}.`,
275
+ overScreen: (screen, actual, limit) => `La pantalla ${screen} descarga ${actual} y el límite está en ${limit}.`,
276
+ screenLimitUnmatched: (name, screens) => `loadline.json: "gates.screens" tiene un límite para "${name}" y ninguna pantalla se llama así, así que no vigila nada. ` +
277
+ `Las pantallas son: ${screens.join(', ') || 'ninguna'}.`,
278
+ growthUnchecked: 'Los gates de crecimiento no pueden ejecutarse, y un gate que no se ejecuta pasaría.',
279
+ newPackageUnchecked: '--fail-on-new-package necesita algo que diga qué había antes: una --baseline, o una lista "packages" en loadline.json.',
280
+ configGrowthSkipped: 'loadline.json: los gates de crecimiento necesitan una --baseline y esta ejecución no tiene, así que no se han comprobado.',
281
+ configNewPackageSkipped: 'loadline.json: "gates.failOnNewPackage" necesita una --baseline o una lista "packages" y esta ejecución no tiene ninguna, así que no se ha comprobado.',
282
+ overOwn: (screen, actual, limit) => `El código propio de ${screen} es de ${actual} y el límite está en ${limit}.`,
283
+ growthBoot: (diff, limit) => `El bootstrap ha crecido ${diff} y el límite está en ${limit}.`,
284
+ growthScreen: (screen, diff, limit) => `La pantalla ${screen} ha crecido ${diff} y el límite está en ${limit}.`,
285
+ growthPctBoot: (percent, limit) => `El bootstrap ha crecido un ${percent} % y el límite está en el ${limit} %.`,
286
+ growthPctScreen: (screen, percent, limit) => `La pantalla ${screen} ha crecido un ${percent} % y el límite está en el ${limit} %.`,
287
+ signalsRaised: (count, level) => `${count} ${count === 1 ? 'señal' : 'señales'} de gravedad ${level === 'mid' ? 'media' : 'alta'} o superior.`,
288
+ signalRaised: (kind, count) => `Ha saltado la señal ${kind}${count === 1 ? '' : ` ${count} veces`}, y "gates.failOnSignals" falla con ella.`,
289
+ newPackages: names => `${names.length === 1 ? 'Ha entrado 1 paquete' : `Han entrado ${names.length} paquetes`} en el bootstrap: ${names.join(', ')}.`,
290
+ configRead: file => `umbrales y señales aceptadas desde ${file}`,
291
+ configProblem: (file, problem) => `${file}: ${problem}`,
292
+ accepted: (kind, why, who, until) => `${kind} — ${why}${who ? ` (${who})` : ''}${until ? `, hasta ${until}` : ', sin fecha de caducidad'}`,
293
+ acceptedExpired: (kind, until) => `${kind} se aceptó hasta ${until}. Esa fecha ya ha pasado, así que vuelve a salir.`,
294
+ acceptedGrew: (kind, was, now) => `${kind} se aceptó con ${was} y ahora son ${now}. Lo que se acordó no es lo que hay, así que vuelve a salir.`,
295
+ headAccepted: 'Aceptadas, y apartadas',
296
+ prFixed: count => `${count} resueltas`,
297
+ prNew: count => `${count} nuevas`,
298
+ prDetails: 'El informe entero',
299
+ prCut: '(recortado para caber en un comentario: --format text lo tiene entero)',
300
+ screenBudgetNote: (warning, file, size) => 'Y otro por fichero. «anyScript» aplica a cada script que emite el build —también a los del ' +
301
+ 'arranque—, que es lo que lo hace usable cuando los nombres llevan hash y un budget por bundle no ' +
302
+ `puede nombrar nada. Por eso va por encima del script más grande de hoy, ${file} con ${size}, o ` +
303
+ `rompería el siguiente build por un fichero que nadie ha tocado — ${warning}:`,
304
+ headWhatIf: 'Y si se difiriera',
305
+ whatIfNote: 'El ahorro es exacto: se recorre el grafo sin esos ficheros, y lo que deja de alcanzarse es ' +
306
+ 'lo que deja de descargarse. Lo que NO se recalcula es el troceado —qué ficheros acaban en ' +
307
+ 'qué chunk lo decide el bundler, y simularlo daría idas y vueltas y totales por pantalla que ' +
308
+ 'parecen medidos y no lo son—. Así que esos siguen igual arriba, y la última columna dice ' +
309
+ 'quién lo pagaría en su lugar.',
310
+ whatIfNobody: 'no lo usa nada diferido',
311
+ whatIfEstimated: 'En cifras comprimidas son los bytes en crudo exactos a la proporción en que se comprime el ' +
312
+ 'bootstrap: el tamaño correcto, no el exacto, y por eso el ≈.',
313
+ whatIfNotHere: format => `--what-if no forma parte del formato ${format}: vuelve a lanzarlo con --format text, summary, json o agent para ver la respuesta.`,
314
+ colWhatIf: 'Diferido',
315
+ headWhy: 'Por qué está aquí',
316
+ whyReach: {
317
+ boot: 'en la primera carga, por',
318
+ lazy: 'no está en la primera carga: ya llega detrás de un import(), por',
319
+ unreached: 'está en el build, y nada de lo que se alcanza desde la entrada lo importa',
320
+ absent: 'no está en este build: ningún paquete, carpeta ni fichero se llama así',
321
+ unknown: 'no se puede saber: sin source maps nada de dentro de un chunk tiene nombre',
322
+ unchained: 'está en la primera carga, y nada en este build dice qué fichero lo trae: una carpeta de build guarda qué chunk lleva qué, no qué fichero importa a cuál, y ninguna fuente del proyecto en sus maps lo nombra',
323
+ sourced: 'está en la primera carga. Una carpeta de build no guarda qué fichero importa a cuál, pero las fuentes de dentro de sus maps sí',
324
+ deferred: 'no está en la primera carga: llega después, con lo que lo pida',
325
+ },
326
+ whyCutSourced: (files, what, upTo) => `${files.length === 1 ? `${files[0]} lo importa` : `${files.length} ficheros tuyos de la primera carga lo importan — ${files.join(', ')}`}. ` +
327
+ `Un import() de ${what} ahí sacaría como mucho ${upTo} de la primera carga: lo que pesa en ella, y menos si parte llega también por otro camino.`,
328
+ whyCut: (file, what, saved, through, payers) => `${through ? `Llega a través de ${what}. ` : ''}Corta aquí: un import() de ${what} en ${file} sacaría ${saved} ` +
329
+ `de la primera carga${payers ? `, y ${payers.includes(',') ? 'lo pagarían' : 'lo pagaría'} ${payers}` : ''}.`,
330
+ whyCutAlso: (file, others, everywhere) => `Cortarlo solo en ${file} no ahorra nada: ${others.length === 1 ? `${others[0]} también lo importa` : `otros ${others.length} ficheros de la primera carga también lo importan — ${others.join(', ')}`}. ` +
331
+ `Un import() en todos ellos sacaría ${everywhere} de la primera carga.`,
332
+ whyCutShared: file => `Cortarlo solo en ${file} no ahorra nada: también llega por otro camino. La cifra de --what-if dice cuánto, una vez cortados todos.`,
333
+ whyNoCut: 'Lo importa la propia entrada: el import() iría en el fichero de entrada.',
334
+ whyNotHere: format => `--why no forma parte del formato ${format}: vuelve a lanzarlo con --format text, json o agent para ver la respuesta.`,
335
+ whatIfUnknown: 'no se puede medir',
336
+ whatIfAbsent: 'no está en este build',
337
+ whatIfUnknownWhy: 'Donde dice «no se puede medir»: una carpeta de build guarda qué chunk lleva qué y no qué fichero importa a cuál, así que no se puede recorrer qué dejaría de descargarse. La columna del tamaño es lo máximo que podría ser; el stats.json del build, o la página con él, da la cifra exacta.',
338
+ savingUnknown: 'Aquí «—» quiere decir «no se sabe», no «nada»: sin source maps no se puede medir ningún ahorro.',
339
+ colSize: 'En el bootstrap',
340
+ colAfter: 'Bootstrap después',
341
+ colWhoPays: 'Lo pagaría',
342
+ };
343
+ exports.CLI_TEXT = { es: ES, en: EN };
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ /**
3
+ * `loadline --help`, in both languages of the report. `--lang es --help` printed it in English, the
4
+ * one page of the command somebody reads before anything else.
5
+ *
6
+ * The flags, the formats and the commands are the same in both: they are what is typed.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.USAGE = void 0;
10
+ const EN = `Loadline — weight per screen, from the terminal.
11
+
12
+ Usage
13
+ loadline <build root|stats.json|browser folder> [options]
14
+
15
+ The root of an Angular build — dist/<app> — is enough: browser-stats.json (Angular 22.2+) or
16
+ stats.json, and the browser/ folder next to it, are found on their own.
17
+
18
+ A build folder works on its own too: its chunks carry the import graph, so anything that emits ES
19
+ modules — Vite, Rollup, Rolldown, esbuild — is read without a stats file. It has to hold the
20
+ index.html of the build, which is what names the chunk the application starts at.
21
+
22
+ Reading the build
23
+ --dist <folder> The build output (the "browser" folder). Gives gzip figures, brotli when
24
+ it carries .br files, and exact per-file weights when it carries .js.map.
25
+ Not needed when the folder is what is being analysed.
26
+ --entry <script> A script the application starts at, when the page starts it in a way
27
+ this does not read: "client.*.js", with * for the hash. Repeatable; the
28
+ same as build.entries of loadline.json, for one run.
29
+ --baseline <file> A previous stats.json or a Loadline export, to compare against.
30
+ --export <file> Write this build's snapshot there, to be the --baseline of a later run.
31
+ The other half of --baseline, and the only one a build that writes no
32
+ stats.json has: a folder read as a graph could be compared against a
33
+ baseline and never produce one.
34
+ --lock <file> pnpm-lock.yaml, package-lock.json or yarn.lock. Says which packages you
35
+ did not ask for directly and what pulls each one in, reading what the
36
+ project asks for from the package.json next to it.
37
+ --audit <file.json> The output of "pnpm audit --json", "npm audit --json" or "yarn audit
38
+ --json". Crossed with what actually ships: "3 of your 47 are in the
39
+ first load" instead of "you have 47". Nothing is fetched — both files
40
+ are ones you already have.
41
+ --project <folder> Where angular.json, package.json and the pipeline file live. Adds the
42
+ budget checks. Not read unless asked for.
43
+ --mode raw|gzip|brotli Which figure the report is in. Default: the best --dist allows.
44
+ --criteria <file.json> Thresholds replacing the recommended ones. The Criteria tab of the page
45
+ writes this file with its "Download criteria" button.
46
+ --config <file.json> loadline.json: the thresholds, the gates and the signals the team has
47
+ decided to live with, kept next to the code. Without the flag, a
48
+ loadline.json in the working directory is read if there is one. Flags on
49
+ the command line win over the file.
50
+ --print-config Print that loadline.json with everything it "extends" joined in, and
51
+ stop: which threshold won, without reading three files. Needs no build.
52
+ The page cannot follow "extends"; drop what this prints on it instead.
53
+
54
+ Output
55
+ --format <format> text, summary, json, markdown, pr-comment, sarif, agent or badge.
56
+ Default: text.
57
+ summary is the whole report in a dozen lines — the figures, what to
58
+ fix first and nothing else — for a pipeline step that runs next to
59
+ twenty others and should not bury them.
60
+ pr-comment writes the comment a bot leaves on a merge request, with
61
+ an HTML marker so the next run edits it instead of adding a
62
+ sixteenth one. sarif anchors each signal to a file, which is what
63
+ GitHub's code scanning reads. agent is for a coding agent or a
64
+ script: the five actions worth most, each with its file or package,
65
+ import chain and saving, as fixed key=value lines and no prose.
66
+ badge is an SVG of the first load — "first load | 133 kB", with the
67
+ change when there is a --baseline — coloured by its verdict, to
68
+ commit next to a README or attach to a pull request.
69
+ --html <file> Also write the page — treemap, search, every chunk — with this build
70
+ already loaded into it. One self-contained file: nothing to drag in,
71
+ nothing fetched, opens offline.
72
+ --open Open what --html wrote.
73
+ --lang en|es Default: en.
74
+ --no-color Never emit colour. It is off already when stdout is not a terminal.
75
+ --no-cache Do not remember this run. By default each run is kept in
76
+ node_modules/.cache/loadline and the next one says what moved —
77
+ "bootstrap 156 kB → 129 kB" — without a --baseline.
78
+
79
+ Failing the build
80
+ --max-boot <size> Fail when the bootstrap is over it.
81
+ --max-screen <size> Fail when the total download of a screen is over it.
82
+ --max-own <size> Fail when the own code of a screen is over it.
83
+ --max-growth <size> With --baseline: fail when the bootstrap or a screen grows by more.
84
+ --max-growth-pct <n> The same, as a percentage.
85
+ --fail-on high|mid|none Fail when a signal of that severity is raised. Default: none.
86
+ --fail-on-new-package Fail when a package enters the bootstrap that was not in the baseline,
87
+ or that the "packages" list of loadline.json does not name.
88
+
89
+ Asking what if
90
+ --what-if <name> What the first load would weigh without that package, folder or file —
91
+ the figure to have BEFORE spending the afternoon. Exact: the graph is
92
+ walked without those files, and what stops being reachable is what stops
93
+ being downloaded. It does not re-chunk the build, so the round trips and
94
+ the per-screen totals are not recomputed and the output says so.
95
+ Repeatable.
96
+ --why <name> Why that package, folder or file is in the first load: the chain of
97
+ imports from the entry point, the file of yours where an import()
98
+ would take it out, and what that would save. Repeatable.
99
+
100
+ Checking the tool itself
101
+ --self-check Work the bootstrap out twice — once by walking the import graph, once
102
+ by closing what index.html announces — and fail when the two disagree.
103
+ It says nothing about the bundle: it catches the build changing shape
104
+ under Loadline, which is how the figures go wrong without an error.
105
+ Needs the index.html, so pass the build folder or add --dist. Prints
106
+ the check and nothing else.
107
+
108
+ Exit codes
109
+ 0 ran, nothing broke a gate.
110
+ 1 a gate broke.
111
+ 2 the arguments or the files could not be used.
112
+
113
+ Examples
114
+ loadline dist/app
115
+ loadline dist/app --html loadline.html --open
116
+ loadline dist/app/browser
117
+ loadline dist/app/stats.json --dist dist/app/browser
118
+ loadline dist/app/stats.json --dist dist/app/browser --max-boot 350kB --fail-on high
119
+ loadline dist/app/stats.json --baseline prev/stats.json --max-growth 20kB --format json
120
+ loadline dist --export loadline-baseline.json
121
+ loadline dist --baseline loadline-baseline.json --max-growth 20kB
122
+ loadline dist/app/stats.json --dist dist/app/browser --self-check
123
+ `;
124
+ const ES = `Loadline — el peso de cada pantalla, desde la terminal.
125
+
126
+ Uso
127
+ loadline <raíz del build|stats.json|carpeta browser> [opciones]
128
+
129
+ Basta con la raíz de un build de Angular — dist/<app> —: browser-stats.json (Angular 22.2+) o
130
+ stats.json, y la carpeta browser/ de al lado, se encuentran solos.
131
+
132
+ Una carpeta de build también sirve sola: sus chunks llevan el grafo de imports, así que todo lo
133
+ que emite módulos ES — Vite, Rollup, Rolldown, esbuild — se lee sin fichero de stats. Tiene que
134
+ traer el index.html del build, que es lo que nombra el chunk por el que arranca la aplicación.
135
+
136
+ Leer el build
137
+ --dist <carpeta> La salida del build (la carpeta "browser"). Da las cifras gzip, brotli si
138
+ trae ficheros .br, y el peso exacto de cada fichero si trae .js.map. No
139
+ hace falta cuando la carpeta es lo que se analiza.
140
+ --entry <script> Un script por el que arranca la aplicación, cuando la página lo arranca
141
+ de una forma que esto no lee: "client.*.js", con * para el hash.
142
+ Repetible; lo mismo que build.entries de loadline.json, para una vez.
143
+ --baseline <fichero> Un stats.json anterior o una exportación de Loadline, para comparar.
144
+ --export <fichero> Escribe ahí la foto de este build, para ser la --baseline de otra
145
+ ejecución. La otra mitad de --baseline, y la única que tiene un build
146
+ que no escribe stats.json: una carpeta leída como grafo podía compararse
147
+ con una baseline y nunca producir una.
148
+ --lock <fichero> pnpm-lock.yaml, package-lock.json o yarn.lock. Dice qué paquetes no
149
+ pediste tú directamente y qué trae cada uno, leyendo lo que pide el
150
+ proyecto del package.json de al lado.
151
+ --audit <fichero.json> La salida de "pnpm audit --json", "npm audit --json" o "yarn audit
152
+ --json", cruzada con lo que de verdad se envía: "3 de tus 47 están en
153
+ la primera carga" en vez de "tienes 47". No se descarga nada: los dos
154
+ ficheros ya los tienes.
155
+ --project <carpeta> Donde están angular.json, package.json y el fichero del pipeline. Añade
156
+ las comprobaciones de budgets. No se lee si no se pide.
157
+ --mode raw|gzip|brotli En qué cifra va el informe. Por defecto: la mejor que permita --dist.
158
+ --criteria <fichero.json>
159
+ Umbrales que sustituyen a los recomendados. La pestaña Criterios de la
160
+ página escribe este fichero con su botón "Descargar criterios".
161
+ --config <fichero.json> loadline.json: los umbrales, los gates y las señales que el equipo ha
162
+ decidido aceptar, junto al código. Sin la opción, se lee el
163
+ loadline.json del directorio de trabajo si lo hay. Las opciones de la
164
+ línea de comandos ganan al fichero.
165
+ --print-config Muestra ese loadline.json con todo lo que hereda con "extends" ya
166
+ unido, y para: qué umbral ha ganado, sin leer tres ficheros. No necesita
167
+ build. La página no puede seguir "extends"; suéltale lo que esto escribe.
168
+
169
+ Salida
170
+ --format <formato> text, summary, json, markdown, pr-comment, sarif, agent o badge.
171
+ Por defecto: text.
172
+ summary es el informe entero en una docena de líneas — las cifras,
173
+ qué arreglar primero y nada más —, para un paso del pipeline que
174
+ va junto a otros veinte y no debe taparlos.
175
+ pr-comment escribe el comentario que deja un bot en una merge
176
+ request, con una marca HTML para que la siguiente ejecución lo
177
+ edite en vez de añadir el decimosexto. sarif ancla cada señal a un
178
+ fichero, que es lo que lee el code scanning de GitHub. agent es
179
+ para un agente de código o un script: las cinco acciones que más
180
+ valen, cada una con su fichero o paquete, cadena de imports y
181
+ ahorro, en líneas clave=valor fijas y sin prosa.
182
+ badge es un SVG de la primera carga — "first load | 133 kB", con el
183
+ cambio si hay --baseline —, coloreado según el veredicto, para
184
+ ponerlo junto a un README o adjuntarlo a una pull request.
185
+ --html <fichero> Escribe también la página — treemap, búsqueda, cada chunk — con
186
+ este build ya cargado. Un único fichero autocontenido: nada que
187
+ arrastrar, nada que descargar, se abre sin conexión.
188
+ --open Abre lo que ha escrito --html.
189
+ --lang en|es Por defecto: en.
190
+ --no-color Nunca escribe color. Ya va sin él cuando stdout no es una terminal.
191
+ --no-cache No recuerda esta ejecución. Por defecto cada ejecución se guarda en
192
+ node_modules/.cache/loadline y la siguiente dice qué se ha movido —
193
+ "bootstrap 156 kB → 129 kB" — sin --baseline.
194
+
195
+ Romper el build
196
+ --max-boot <tamaño> Falla si el bootstrap lo supera.
197
+ --max-screen <tamaño> Falla si la descarga total de una pantalla lo supera.
198
+ --max-own <tamaño> Falla si el código propio de una pantalla lo supera.
199
+ --max-growth <tamaño> Con --baseline: falla si el bootstrap o una pantalla crece más que eso.
200
+ --max-growth-pct <n> Lo mismo, en porcentaje.
201
+ --fail-on high|mid|none Falla si sale una señal de esa gravedad. Por defecto: none.
202
+ --fail-on-new-package Falla si entra en el bootstrap un paquete que no estaba en la baseline,
203
+ o que no nombra la lista "packages" de loadline.json.
204
+
205
+ Preguntar qué pasaría
206
+ --what-if <nombre> Cuánto pesaría la primera carga sin ese paquete, carpeta o fichero: la
207
+ cifra que conviene tener ANTES de dedicarle la tarde. Exacta: se recorre
208
+ el grafo sin esos ficheros, y lo que deja de alcanzarse es lo que deja
209
+ de descargarse. No vuelve a trocear el build, así que las idas y vueltas
210
+ y los totales por pantalla no se recalculan, y la salida lo dice.
211
+ Repetible.
212
+ --why <nombre> Por qué ese paquete, carpeta o fichero está en la primera carga: la
213
+ cadena de imports desde el punto de entrada, el fichero tuyo donde un
214
+ import() lo sacaría, y cuánto ahorraría. Repetible.
215
+
216
+ Comprobar la propia herramienta
217
+ --self-check Calcula el bootstrap dos veces — recorriendo el grafo de imports y
218
+ cerrando lo que anuncia el index.html — y falla si no coinciden. No dice
219
+ nada del bundle: detecta que el build ha cambiado de forma por debajo de
220
+ Loadline, que es como las cifras se equivocan sin dar error. Necesita el
221
+ index.html, así que pasa la carpeta del build o añade --dist. Imprime la
222
+ comprobación y nada más.
223
+
224
+ Códigos de salida
225
+ 0 se ha ejecutado y no se ha roto ningún gate.
226
+ 1 se ha roto un gate.
227
+ 2 no se han podido usar los argumentos o los ficheros.
228
+
229
+ Ejemplos
230
+ loadline dist/app
231
+ loadline dist/app --html loadline.html --open
232
+ loadline dist/app/browser
233
+ loadline dist/app/stats.json --dist dist/app/browser
234
+ loadline dist/app/stats.json --dist dist/app/browser --max-boot 350kB --fail-on high
235
+ loadline dist/app/stats.json --baseline prev/stats.json --max-growth 20kB --format json
236
+ loadline dist --export loadline-baseline.json
237
+ loadline dist --baseline loadline-baseline.json --max-growth 20kB
238
+ loadline dist/app/stats.json --dist dist/app/browser --self-check
239
+ `;
240
+ exports.USAGE = { en: EN, es: ES };