@bymaksym/loadline 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +229 -43
  2. package/dist/cli/cli/args.js +79 -128
  3. package/dist/cli/cli/gates.js +80 -14
  4. package/dist/cli/cli/main.js +164 -33
  5. package/dist/cli/cli/memory.js +40 -4
  6. package/dist/cli/cli/{declared.js → read/declared.js} +1 -1
  7. package/dist/cli/cli/read/locate.js +214 -0
  8. package/dist/cli/cli/{read-build.js → read/read-build.js} +149 -84
  9. package/dist/cli/cli/read/read-config.js +120 -0
  10. package/dist/cli/cli/{html-report.js → render/html-report.js} +14 -10
  11. package/dist/cli/cli/render/render-agent.js +114 -0
  12. package/dist/cli/cli/render/render-asked.js +104 -0
  13. package/dist/cli/cli/render/render-badge.js +140 -0
  14. package/dist/cli/cli/{render-json.js → render/render-json.js} +18 -5
  15. package/dist/cli/cli/{render-markdown.js → render/render-markdown.js} +5 -5
  16. package/dist/cli/cli/{render-pr.js → render/render-pr.js} +33 -13
  17. package/dist/cli/cli/{render-sarif.js → render/render-sarif.js} +8 -3
  18. package/dist/cli/cli/{render-text.js → render/render-text.js} +118 -111
  19. package/dist/cli/cli/render/terminal.js +55 -0
  20. package/dist/cli/cli/report.js +68 -27
  21. package/dist/cli/cli/self-check.js +19 -23
  22. package/dist/cli/cli/since-last.js +2 -2
  23. package/dist/cli/cli/text/text-errors.js +124 -0
  24. package/dist/cli/cli/text/text.js +343 -0
  25. package/dist/cli/cli/text/usage.js +240 -0
  26. package/dist/cli/src/app/core/analysis/analysis.js +63 -23
  27. package/dist/cli/src/app/core/analysis/{barrels.js → graph/barrels.js} +1 -1
  28. package/dist/cli/src/app/core/analysis/{blast.js → graph/blast.js} +56 -17
  29. package/dist/cli/src/app/core/analysis/{cycles.js → graph/cycles.js} +1 -1
  30. package/dist/cli/src/app/core/analysis/{importers.js → graph/importers.js} +1 -1
  31. package/dist/cli/src/app/core/analysis/{insights.js → graph/insights.js} +10 -4
  32. package/dist/cli/src/app/core/analysis/invariant.js +1 -1
  33. package/dist/cli/src/app/core/analysis/metafile.types.js +7 -1
  34. package/dist/cli/src/app/core/analysis/{delivery.js → screens/delivery.js} +1 -1
  35. package/dist/cli/src/app/core/analysis/{entries.js → screens/entries.js} +50 -9
  36. package/dist/cli/src/app/core/analysis/screens/marks.js +32 -0
  37. package/dist/cli/src/app/core/analysis/screens/route-files.js +116 -0
  38. package/dist/cli/src/app/core/analysis/{sourcemap.js → sourcemap/sourcemap.js} +106 -7
  39. package/dist/cli/src/app/core/analysis/{split-drift.js → sourcemap/split-drift.js} +1 -1
  40. package/dist/cli/src/app/core/analysis/tool.js +83 -0
  41. package/dist/cli/src/app/core/assets/assets.js +134 -15
  42. package/dist/cli/src/app/core/baseline/baseline.js +0 -0
  43. package/dist/cli/src/app/core/{intake → build-text}/index-html.js +168 -13
  44. package/dist/cli/src/app/core/build-text/route-table.js +178 -0
  45. package/dist/cli/src/app/core/build-text/tool-marks.js +54 -0
  46. package/dist/cli/src/app/core/caching/caching.js +121 -43
  47. package/dist/cli/src/app/core/caching/from-analysis.js +20 -4
  48. package/dist/cli/src/app/core/config/config-text.js +90 -0
  49. package/dist/cli/src/app/core/config/config-values.js +358 -0
  50. package/dist/cli/src/app/core/config/loadline-config.js +81 -16
  51. package/dist/cli/src/app/core/config/merge-config.js +98 -0
  52. package/dist/cli/src/app/core/deps/deps.js +104 -16
  53. package/dist/cli/src/app/core/export/summary.js +29 -5
  54. package/dist/cli/src/app/core/findings/actions.js +3 -1
  55. package/dist/cli/src/app/core/findings/{boot-single.js → bundle/boot-single.js} +3 -3
  56. package/dist/cli/src/app/core/findings/{dupes.js → bundle/dupes.js} +8 -5
  57. package/dist/cli/src/app/core/findings/{graph.js → bundle/graph.js} +30 -18
  58. package/dist/cli/src/app/core/findings/{own-in-boot.js → bundle/own-in-boot.js} +9 -5
  59. package/dist/cli/src/app/core/findings/{requests.js → bundle/requests.js} +3 -3
  60. package/dist/cli/src/app/core/findings/{shipped.js → bundle/shipped.js} +28 -14
  61. package/dist/cli/src/app/core/findings/compose.js +6 -1
  62. package/dist/cli/src/app/core/findings/effort.js +2 -0
  63. package/dist/cli/src/app/core/findings/finding.types.js +1 -0
  64. package/dist/cli/src/app/core/findings/findings.js +48 -19
  65. package/dist/cli/src/app/core/findings/{assets.js → folder/assets.js} +38 -14
  66. package/dist/cli/src/app/core/findings/{caching.js → folder/caching.js} +16 -9
  67. package/dist/cli/src/app/core/findings/{page.js → folder/page.js} +6 -2
  68. package/dist/cli/src/app/core/findings/{scan.js → folder/scan.js} +25 -11
  69. package/dist/cli/src/app/core/findings/kind-names.js +163 -0
  70. package/dist/cli/src/app/core/findings/{deps.js → supplied/deps.js} +13 -8
  71. package/dist/cli/src/app/core/findings/supplied/forbidden.js +71 -0
  72. package/dist/cli/src/app/core/findings/{situation.js → supplied/situation.js} +2 -2
  73. package/dist/cli/src/app/core/findings/text/causes.js +39 -0
  74. package/dist/cli/src/app/core/findings/{finding-html.js → text/finding-html.js} +8 -1
  75. package/dist/cli/src/app/core/findings/{finding-text.js → text/finding-text.js} +208 -77
  76. package/dist/cli/src/app/core/findings/text/tool-advice.js +97 -0
  77. package/dist/cli/src/app/core/format/format.utils.js +158 -11
  78. package/dist/cli/src/app/core/format/ownership.js +93 -0
  79. package/dist/cli/src/app/core/i18n/en.js +76 -17
  80. package/dist/cli/src/app/core/i18n/es.js +82 -22
  81. package/dist/cli/src/app/core/intake/bundle-graph.js +281 -43
  82. package/dist/cli/src/app/core/intake/dist-files.js +82 -14
  83. package/dist/cli/src/app/core/intake/embedded.js +11 -1
  84. package/dist/cli/src/app/core/intake/unreached.js +139 -0
  85. package/dist/cli/src/app/core/intake/webpack-modules.js +185 -0
  86. package/dist/cli/src/app/core/intake/webpack-stats.js +298 -0
  87. package/dist/cli/src/app/core/project/project-context.js +16 -4
  88. package/dist/cli/src/app/core/project/project-name.js +36 -0
  89. package/dist/cli/src/app/core/scan/scan.js +58 -19
  90. package/dist/cli/src/app/core/scan/secrets.js +23 -3
  91. package/dist/cli/src/app/core/situation/situation-text.js +23 -0
  92. package/dist/cli/src/app/core/situation/situation.js +6 -4
  93. package/dist/cli/src/app/core/timing/timing.js +5 -2
  94. package/dist/cli/src/app/core/whatif/defer.js +29 -4
  95. package/dist/cli/src/app/core/whatif/source-importers.js +58 -0
  96. package/dist/cli/src/app/core/whatif/why.js +102 -0
  97. package/docs/CONFIG-REFERENCE.md +230 -0
  98. package/docs/CONFIG.md +511 -0
  99. package/docs/HOW-IT-WORKS.md +286 -25
  100. package/loadline.html +24 -20
  101. package/loadline.schema.json +1209 -0
  102. package/package.json +35 -29
  103. package/dist/cli/cli/locate.js +0 -60
  104. package/dist/cli/cli/text.js +0 -215
  105. /package/dist/cli/cli/{read-build.types.js → read/read-build.types.js} +0 -0
  106. /package/dist/cli/cli/{render-json.types.js → render/render-json.types.js} +0 -0
  107. /package/dist/cli/cli/{text.types.js → text/text.types.js} +0 -0
  108. /package/dist/cli/src/app/core/analysis/{exclusive.js → graph/exclusive.js} +0 -0
  109. /package/dist/cli/src/app/core/analysis/{insights.types.js → graph/insights.types.js} +0 -0
  110. /package/dist/cli/src/app/core/analysis/{module-graph.js → graph/module-graph.js} +0 -0
  111. /package/dist/cli/src/app/core/analysis/{sourcemap.types.js → sourcemap/sourcemap.types.js} +0 -0
  112. /package/dist/cli/src/app/core/findings/{finding-plain.js → text/finding-plain.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bymaksym/loadline",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Weight per screen: what each screen of your app actually downloads.",
5
5
  "keywords": [
6
6
  "bundle-size",
@@ -34,7 +34,10 @@
34
34
  "bin/",
35
35
  "dist/cli/",
36
36
  "loadline.html",
37
+ "loadline.schema.json",
37
38
  "docs/HOW-IT-WORKS.md",
39
+ "docs/CONFIG.md",
40
+ "docs/CONFIG-REFERENCE.md",
38
41
  "README.md",
39
42
  "LICENSE"
40
43
  ],
@@ -82,13 +85,13 @@
82
85
  "*.{json,md,mjs,js}": [
83
86
  "prettier --write"
84
87
  ],
85
- "{*.md,src/app/core/i18n/*.ts,src/app/core/findings/finding-text.ts}": [
88
+ "{*.md,src/app/core/i18n/*.ts,src/app/core/findings/text/finding-text.ts}": [
86
89
  "cspell lint --no-progress --no-must-find-files"
87
90
  ]
88
91
  },
89
92
  "devDependencies": {
90
- "@angular/build": "^22.2.0",
91
- "@angular/cli": "^22.2.0",
93
+ "@angular/build": "^22.2.1",
94
+ "@angular/cli": "^22.2.1",
92
95
  "@angular/common": "^22.2.1",
93
96
  "@angular/compiler": "^22.2.1",
94
97
  "@angular/compiler-cli": "^22.2.1",
@@ -96,35 +99,35 @@
96
99
  "@angular/platform-browser": "^22.2.1",
97
100
  "@commitlint/cli": "^21.2.3",
98
101
  "@commitlint/config-conventional": "^21.2.3",
99
- "@cspell/dict-es-es": "^3.0.8",
102
+ "@cspell/dict-es-es": "^3.0.9",
100
103
  "@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
101
104
  "@eslint/js": "^10.0.1",
102
- "@secretlint/secretlint-rule-preset-recommend": "^13.0.6",
103
- "@types/node": "^26.6.3",
105
+ "@secretlint/secretlint-rule-preset-recommend": "^13.0.7",
106
+ "@types/node": "^26.6.4",
104
107
  "@vitest/eslint-plugin": "^1.6.27",
105
108
  "angular-eslint": "^22.5.0",
106
109
  "cspell": "^10.3.6",
107
- "eslint": "^10.11.0",
110
+ "eslint": "^10.12.0",
108
111
  "eslint-config-prettier": "^10.1.8",
109
112
  "eslint-import-resolver-typescript": "^4.4.5",
110
113
  "eslint-plugin-angular-modern": "^1.9.0",
111
- "eslint-plugin-baseline-js": "^0.7.2",
114
+ "eslint-plugin-baseline-js": "^0.7.4",
112
115
  "eslint-plugin-import-x": "^4.17.1",
113
116
  "eslint-plugin-regexp": "^3.3.1",
114
117
  "eslint-plugin-simple-import-sort": "^14.0.0",
115
- "eslint-plugin-unicorn": "^76.0.0",
118
+ "eslint-plugin-unicorn": "^77.0.0",
116
119
  "eslint-plugin-unused-imports": "^4.4.1",
117
- "html-validate": "^11.16.1",
120
+ "html-validate": "^11.16.2",
118
121
  "html-validate-angular": "^9.0.0",
119
122
  "husky": "^9.1.7",
120
123
  "jscpd": "^5.4.0",
121
- "jsdom": "^30.1.1",
124
+ "jsdom": "^30.1.2",
122
125
  "knip": "^6.39.0",
123
126
  "lint-staged": "^17.6.0",
124
127
  "npm-check-updates": "^23.1.0",
125
128
  "prettier": "^3.9.9",
126
129
  "rxjs": "~7.8.2",
127
- "secretlint": "^13.0.6",
130
+ "secretlint": "^13.0.7",
128
131
  "stylelint": "^17.16.0",
129
132
  "stylelint-config-clean-order": "^10.0.0",
130
133
  "stylelint-config-standard-scss": "^17.0.0",
@@ -136,7 +139,7 @@
136
139
  "stylelint-value-no-unknown-custom-properties": "^6.1.1",
137
140
  "tslib": "^2.8.1",
138
141
  "typescript": "~6.0.3",
139
- "typescript-eslint": "^8.71.0",
142
+ "typescript-eslint": "^8.71.1",
140
143
  "vitest": "^4.1.11"
141
144
  },
142
145
  "scripts": {
@@ -156,29 +159,32 @@
156
159
  "lint:ci": "eslint",
157
160
  "lint:types": "eslint --config eslint.typed.config.js",
158
161
  "lint:inspect": "pnpm dlx @eslint/config-inspector@3 --config eslint.typed.config.js",
159
- "lint:config": "node scripts/check-eslint-config.mjs",
160
- "lint:prettier": "eslint-config-prettier src/main.ts src/app/app.html cli/main.ts scripts/check.mjs",
161
- "lint-styles:ci": "stylelint src/**/*.scss",
162
- "lint-styles:scope": "node scripts/check-styles.mjs",
163
- "lint-styles": "stylelint --fix src/**/*.scss",
164
- "fix-all": "node scripts/check.mjs --fix",
165
- "check": "node scripts/check.mjs",
166
- "check:all": "node scripts/check.mjs --all",
162
+ "lint:config": "node tooling/check-eslint-config.mjs",
163
+ "config:check": "node tooling/check-config-found.mjs",
164
+ "lint:prettier": "eslint-config-prettier src/main.ts src/app/app.html cli/main.ts tooling/check.mjs",
165
+ "lint-styles:ci": "stylelint \"src/**/*.scss\"",
166
+ "lint-styles:scope": "node tooling/check-styles.mjs",
167
+ "lint:folders": "node tooling/check-folders.mjs",
168
+ "lint-styles": "stylelint --fix \"src/**/*.scss\"",
169
+ "fix-all": "node tooling/check.mjs --fix",
170
+ "check": "node tooling/check.mjs",
171
+ "check:all": "node tooling/check.mjs --all",
167
172
  "lint:all": "lint-staged",
168
173
  "typecheck": "tsc --noEmit --skipLibCheck --project tsconfig.app.json && tsc --noEmit --skipLibCheck --project tsconfig.cli.json && tsc --noEmit --skipLibCheck --project tsconfig.cli.spec.json && tsc --noEmit --skipLibCheck --project tsconfig.scripts.json",
169
- "knip": "node scripts/knip.mjs",
170
- "knip:deps": "node scripts/knip.mjs --include dependencies,unlisted,duplicates",
174
+ "knip": "node tooling/knip.mjs",
175
+ "knip:deps": "node tooling/knip.mjs --include dependencies,unlisted,duplicates",
171
176
  "a11y:audit": "html-validate \"src/**/*.html\"",
172
177
  "spell:audit": "cspell lint --no-progress",
173
- "i18n:audit": "node scripts/validate-i18n.mjs",
174
- "duplicates:audit": "node scripts/validate-duplicates.mjs",
178
+ "i18n:audit": "node tooling/validate-i18n.mjs",
179
+ "duplicates:audit": "node tooling/validate-duplicates.mjs",
175
180
  "deps:check": "ncu",
176
181
  "deps:update": "ncu --interactive",
177
182
  "deps:update:deep": "pnpm update --depth 9999",
178
183
  "deps:audit": "pnpm audit --audit-level high",
179
- "deps:upgrade": "pnpm run deps:update && pnpm install && pnpm run deps:update:deep && pnpm dedupe && (pnpm run fix-all || exit 0) && node scripts/check.mjs --all",
180
- "secrets:scan": "secretlint --maskSecrets \"**/*\"",
184
+ "deps:upgrade": "pnpm run deps:update && pnpm install && pnpm run deps:update:deep && pnpm dedupe && (pnpm run fix-all || exit 0) && node tooling/check.mjs --all",
185
+ "secrets:scan": "secretlint --secretlintrc .config/secretlintrc.json --secretlintignore .config/secretlintignore --maskSecrets \"**/*\"",
181
186
  "self:check": "pnpm run build:ci && node scripts/inline-build.mjs && node bin/loadline.js dist/loadline-app/browser-stats.json --dist dist/loadline-app/browser --self-check && node bin/loadline.js dist/loadline-app/browser-stats.json --dist dist/loadline-app/browser --project . && node bin/loadline.js dist/loadline-app/browser --format summary",
182
- "loadline": "node bin/loadline.js"
187
+ "loadline": "node bin/loadline.js",
188
+ "rounds": "node tooling/rounds/rounds.mjs"
183
189
  }
184
190
  }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- /**
3
- * What to read when the command is pointed at the root of a build rather than at one of its files.
4
- *
5
- * `ng build` writes `dist/<app>/browser/` and, with `--stats-json`, the metafile next to it — called
6
- * `stats.json` up to Angular 22.1 and `browser-stats.json` from 22.2, when the server half got a file
7
- * of its own (`server-stats.json`). Read in @angular/build itself: 22.1.8 writes `stats.json` with or
8
- * without a server, 22.2.0 writes `browser-stats.json` even when there is none. Asking for both paths by hand was the first thing anybody had to get right, and the
9
- * README naming only the old file sent people looking for something that was not there. Pointed at
10
- * `dist/<app>`, the command now finds both on its own and says which it found.
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.locateBuild = void 0;
14
- const promises_1 = require("node:fs/promises");
15
- const node_path_1 = require("node:path");
16
- /** The metafile's names, newest first: the first one present wins. */
17
- const STATS_NAMES = ['browser-stats.json', 'stats.json'];
18
- const isFile = async (path) => {
19
- try {
20
- const info = await (0, promises_1.stat)(path);
21
- return info.isFile();
22
- }
23
- catch {
24
- return false;
25
- }
26
- };
27
- const isDirectory = async (path) => {
28
- try {
29
- const info = await (0, promises_1.stat)(path);
30
- return info.isDirectory();
31
- }
32
- catch {
33
- return false;
34
- }
35
- };
36
- /**
37
- * @param target what was typed: a metafile, a browser folder or the root of a build.
38
- * @param dist `--dist`, when it was given. Anything typed by hand wins: nothing is looked up then.
39
- */
40
- const locateBuild = async (target, dist) => {
41
- if (dist || !(await isDirectory(target))) {
42
- return { target, dist, found: [] };
43
- }
44
- const browser = (0, node_path_1.join)(target, 'browser');
45
- const hasBrowser = await isDirectory(browser);
46
- let stats = null;
47
- for (const name of STATS_NAMES) {
48
- const candidate = (0, node_path_1.join)(target, name);
49
- if (await isFile(candidate)) {
50
- stats = candidate;
51
- break;
52
- }
53
- }
54
- if (stats) {
55
- return { target: stats, dist: hasBrowser ? browser : null, found: hasBrowser ? [stats, browser] : [stats] };
56
- }
57
- // No metafile: the browser folder is read as a graph, the way a folder always has been.
58
- return hasBrowser ? { target: browser, dist: null, found: [browser] } : { target, dist, found: [] };
59
- };
60
- exports.locateBuild = locateBuild;
@@ -1,215 +0,0 @@
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) => `${stats} · figures ${unit}`,
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
- firstTrip: (total, files, parts) => `The whole first trip is ${total} across ${files} ${files === 1 ? 'file' : 'files'} — ${parts} — ` +
25
- 'counting everything index.html asks for before anything appears. The figure above is the ' +
26
- 'JavaScript half, which is the half this report can break down.',
27
- htmlWritten: file => `The page with this build loaded: ${file}`,
28
- located: files => `found ${files}`,
29
- lastRunUnchanged: 'nothing moved',
30
- tripFonts: 'fonts',
31
- tripImages: 'images',
32
- componentStyles: count => `${count} component ${count === 1 ? 'stylesheet' : 'stylesheets'} of the metafile ${count === 1 ? 'is' : 'are'} ` +
33
- 'inside the JavaScript: Angular inlines them, so they are not files in the folder and are already in the figures.',
34
- sinceLast: (date, change) => `since the last run (${date}): ${change}`,
35
- serverLeftOut: count => `${count} output${count === 1 ? '' : 's'} of this build are not in the browser folder ` +
36
- '(the server side of a rendered build): left out, because nobody downloads them.',
37
- blocked: 'The baseline was measured in another unit: nothing is compared. Pass --dist, or --mode raw.',
38
- exactSplit: 'weight per file read from the source maps',
39
- headBoot: 'Bootstrap',
40
- headScreens: 'Screens',
41
- headSignals: 'Signals',
42
- headGates: 'Gates',
43
- headActions: 'What to fix first',
44
- headTime: 'Estimated time',
45
- headBudget: 'Suggested budget',
46
- actionsNote: 'An order over the signals below, not a selection: every one of them is still there.',
47
- colAction: 'Signal',
48
- colSaving: 'Off the first load',
49
- colEffort: 'Effort',
50
- effortLabel: {
51
- config: 'configuration',
52
- import: 'one import',
53
- refactor: 'refactor',
54
- none: '',
55
- },
56
- savingCell: saving => saving || '—',
57
- totalSaving: (bytes, after, count, estimated) => `${fixingEn(count)} would take ${bytes} off the first load, leaving it at about ${after}. ${estimated
58
- ? 'Compressed figures are an estimate: the raw bytes taken out, at the ratio the bootstrap ' +
59
- 'compresses by, since a single module has no compressed size of its own. '
60
- : '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 ` +
61
- 'together, so bytes reachable two ways are counted once.',
62
- profileName: { slow4g: 'slow 4G', fast4g: '4G', cable: 'cable' },
63
- timeNote: 'An estimate, not a measurement: a model over the bytes, the round trips and three standard ' +
64
- 'connection profiles. Transfer and latency go by what travels; parse and compile go by raw ' +
65
- 'bytes, because that is what the engine works on. Latency is editable in the criteria.',
66
- timeColumns: { profile: 'Connection', transfer: 'Transfer', latency: 'Latency', script: 'Parse', total: 'Total' },
67
- budgetNote: (warning, error, current) => `Nothing here writes a file. The initial load is ${current} raw (JavaScript and the CSS the page ` +
68
- `asks for, which is what Angular's initial budget counts), so a warning at ${warning} and an ` +
69
- `error at ${error} leaves room for a feature and still stops a pipeline.`,
70
- bootSummary: (files, screens) => `${files} ${files === 1 ? 'file' : 'files'}, downloaded before anything appears · ${screens} ${screens === 1 ? 'screen' : 'screens'}`,
71
- noScreens: 'No lazy screens: everything is in the bootstrap.',
72
- fix: 'Fix',
73
- passed: 'Every gate passed.',
74
- failed: count => `${count} ${count === 1 ? 'gate' : 'gates'} broken.`,
75
- noGates: 'No gate was asked for: this run reports and never fails.',
76
- overBoot: (actual, limit) => `Bootstrap is ${actual}, over the ${limit} allowed.`,
77
- overScreen: (screen, actual, limit) => `Screen ${screen} downloads ${actual}, over the ${limit} allowed.`,
78
- overOwn: (screen, actual, limit) => `Own code of ${screen} is ${actual}, over the ${limit} allowed.`,
79
- growthBoot: (diff, limit) => `Bootstrap grew ${diff}, over the ${limit} allowed.`,
80
- growthScreen: (screen, diff, limit) => `Screen ${screen} grew ${diff}, over the ${limit} allowed.`,
81
- growthPctBoot: (percent, limit) => `Bootstrap grew ${percent} %, over the ${limit} % allowed.`,
82
- growthPctScreen: (screen, percent, limit) => `Screen ${screen} grew ${percent} %, over the ${limit} % allowed.`,
83
- signalsRaised: (count, level) => `${count} ${count === 1 ? 'signal' : 'signals'} of severity ${level === 'mid' ? 'medium' : 'high'} or above.`,
84
- newPackages: names => `${names.length} ${names.length === 1 ? 'package has' : 'packages have'} entered the bootstrap: ${names.join(', ')}.`,
85
- configRead: file => `thresholds and accepted signals from ${file}`,
86
- configProblem: problem => `loadline.json: ${problem}`,
87
- accepted: (kind, why, who, until) => `${kind} — ${why}${who ? ` (${who})` : ''}${until ? `, until ${until}` : ', with no end date'}`,
88
- acceptedExpired: (kind, until) => `${kind} was accepted until ${until}. That date has passed, so it is raised again.`,
89
- 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.`,
90
- headAccepted: 'Accepted, and set aside',
91
- prFixed: count => `${count} fixed`,
92
- prNew: count => `${count} new`,
93
- prDetails: 'The whole report',
94
- screenBudgetNote: (warning, file, size) => 'And one per file. "anyScript" applies to every script the build emits — the bootstrap ones too — ' +
95
- 'which is what makes it usable when the names carry content hashes and a per-bundle budget cannot ' +
96
- `name anything. So it goes above the largest script there is today, ${file} at ${size}, or it fails ` +
97
- `the next build on a file nobody touched — ${warning}:`,
98
- headWhatIf: 'What if it were deferred',
99
- whatIfNote: 'The saving is exact: the graph is walked without those files, and what stops being ' +
100
- 'reachable is what stops being downloaded. What is NOT recomputed is the split — which ' +
101
- 'files end up in which chunk is the bundler’s decision, and a simulated one would produce ' +
102
- 'round trips and per-screen totals that look measured and are not. So those are unchanged ' +
103
- 'above, and the last column says who would be paying for it instead.',
104
- whatIfNobody: 'nothing lazy uses it',
105
- whatIfEstimated: 'In compressed figures those are the exact raw bytes at the ratio the bootstrap compresses by: ' +
106
- 'the right size, not the exact one, hence the ≈.',
107
- whatIfNotHere: format => `--what-if is not part of the ${format} format: run it again with --format text, summary or json to see the answer.`,
108
- colWhatIf: 'Deferred',
109
- colSize: 'In the bootstrap',
110
- colAfter: 'Bootstrap after',
111
- colWhoPays: 'Would then be paid by',
112
- };
113
- const ES = {
114
- lead: (stats, unit) => `${stats} · cifras ${unit}`,
115
- against: (baseline, date) => `comparado con ${baseline} (${date})`,
116
- pageCss: (size, files, total) => `Más ${size} de CSS en ${files === 1 ? 'la hoja de estilos' : `${files} hojas de estilos`} que pide la misma ` +
117
- `página, que bloquean el pintado y no están en la cifra de arriba: ${total} es lo que baja de verdad antes ` +
118
- 'de nada. Este informe desglosa solo el JavaScript.',
119
- firstTrip: (total, files, parts) => `El primer viaje entero son ${total} en ${files} ${files === 1 ? 'fichero' : 'ficheros'} — ${parts} — ` +
120
- 'contando todo lo que pide index.html antes de que aparezca nada. La cifra de arriba es la ' +
121
- 'mitad de JavaScript, que es la que este informe sabe desglosar.',
122
- htmlWritten: file => `La página con este build cargado: ${file}`,
123
- located: files => `encontrado ${files}`,
124
- lastRunUnchanged: 'no se ha movido nada',
125
- tripFonts: 'de tipografías',
126
- tripImages: 'de imágenes',
127
- componentStyles: count => `${count} ${count === 1 ? 'hoja de estilos de componente del metafile va' : 'hojas de estilos de componente del metafile van'} ` +
128
- 'dentro del JavaScript: Angular las incrusta, así que no son ficheros de la carpeta y ya están en las cifras.',
129
- sinceLast: (date, change) => `desde la última ejecución (${date}): ${change}`,
130
- serverLeftOut: count => `${count} salida${count === 1 ? '' : 's'} de este build no ${count === 1 ? 'está' : 'están'} en la carpeta ` +
131
- 'del navegador (el lado servidor de un build con render): fuera, porque nadie las descarga.',
132
- blocked: 'La línea base se midió en otra unidad: no se compara nada. Pasa --dist, o bien --mode raw.',
133
- exactSplit: 'peso por fichero leído de los source maps',
134
- headBoot: 'Bootstrap',
135
- headScreens: 'Pantallas',
136
- headSignals: 'Señales',
137
- headGates: 'Gates',
138
- headActions: 'Qué arreglo primero',
139
- headTime: 'Tiempo estimado',
140
- headBudget: 'Budget sugerido',
141
- actionsNote: 'Es un orden sobre las señales de abajo, no una selección: todas siguen estando.',
142
- colAction: 'Señal',
143
- colSaving: 'Fuera de la primera carga',
144
- colEffort: 'Esfuerzo',
145
- effortLabel: {
146
- config: 'configuración',
147
- import: 'un import',
148
- refactor: 'refactor',
149
- none: '',
150
- },
151
- savingCell: saving => saving || '—',
152
- totalSaving: (bytes, after, count, estimated) => `${fixingEs(count)} se quitarían ${bytes} de la primera carga y quedaría en unos ${after}. ${estimated
153
- ? 'Las cifras comprimidas son una estimación: los bytes en crudo que se quitan, a la proporción ' +
154
- 'en que se comprime el bootstrap, porque un módulo suelto no tiene tamaño comprimido propio. '
155
- : '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, ` +
156
- 'así que lo que se alcanza por dos caminos se cuenta una vez.',
157
- profileName: { slow4g: '4G lento', fast4g: '4G', cable: 'cable' },
158
- timeNote: 'Es una estimación, no una medición: un modelo sobre los bytes, las idas y vueltas y tres perfiles ' +
159
- 'de conexión estándar. La transferencia y la latencia van por lo que viaja; el parseo y la ' +
160
- 'compilación van por bytes en crudo, que es sobre lo que trabaja el motor. La latencia se edita ' +
161
- 'en los criterios.',
162
- timeColumns: {
163
- profile: 'Conexión',
164
- transfer: 'Transferencia',
165
- latency: 'Latencia',
166
- script: 'Parseo',
167
- total: 'Total',
168
- },
169
- budgetNote: (warning, error, current) => `Aquí no se escribe ningún fichero. La primera carga son ${current} en crudo (el JavaScript y el CSS ` +
170
- 'que pide la página, que es lo que cuenta el budget initial de Angular), así que un aviso en ' +
171
- `${warning} y un error en ${error} deja sitio para una funcionalidad y sigue parando un pipeline.`,
172
- bootSummary: (files, screens) => `${files} ${files === 1 ? 'fichero, descargado' : 'ficheros, descargados'} antes de que aparezca nada · ${screens} ${screens === 1 ? 'pantalla' : 'pantallas'}`,
173
- noScreens: 'No hay pantallas lazy: todo entra en el bootstrap.',
174
- fix: 'Qué hacer',
175
- passed: 'No se ha superado ningún gate.',
176
- failed: count => `${count} ${count === 1 ? 'gate superado' : 'gates superados'}.`,
177
- noGates: 'No se ha pedido ningún gate: esta ejecución informa y nunca falla.',
178
- overBoot: (actual, limit) => `El bootstrap es de ${actual} y el límite está en ${limit}.`,
179
- overScreen: (screen, actual, limit) => `La pantalla ${screen} descarga ${actual} y el límite está en ${limit}.`,
180
- overOwn: (screen, actual, limit) => `El código propio de ${screen} es de ${actual} y el límite está en ${limit}.`,
181
- growthBoot: (diff, limit) => `El bootstrap ha crecido ${diff} y el límite está en ${limit}.`,
182
- growthScreen: (screen, diff, limit) => `La pantalla ${screen} ha crecido ${diff} y el límite está en ${limit}.`,
183
- growthPctBoot: (percent, limit) => `El bootstrap ha crecido un ${percent} % y el límite está en el ${limit} %.`,
184
- growthPctScreen: (screen, percent, limit) => `La pantalla ${screen} ha crecido un ${percent} % y el límite está en el ${limit} %.`,
185
- signalsRaised: (count, level) => `${count} ${count === 1 ? 'señal' : 'señales'} de gravedad ${level === 'mid' ? 'media' : 'alta'} o superior.`,
186
- newPackages: names => `${names.length === 1 ? 'Ha entrado 1 paquete' : `Han entrado ${names.length} paquetes`} en el bootstrap: ${names.join(', ')}.`,
187
- configRead: file => `umbrales y señales aceptadas desde ${file}`,
188
- configProblem: problem => `loadline.json: ${problem}`,
189
- accepted: (kind, why, who, until) => `${kind} — ${why}${who ? ` (${who})` : ''}${until ? `, hasta ${until}` : ', sin fecha de caducidad'}`,
190
- acceptedExpired: (kind, until) => `${kind} se aceptó hasta ${until}. Esa fecha ya ha pasado, así que vuelve a salir.`,
191
- 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.`,
192
- headAccepted: 'Aceptadas, y apartadas',
193
- prFixed: count => `${count} resueltas`,
194
- prNew: count => `${count} nuevas`,
195
- prDetails: 'El informe entero',
196
- screenBudgetNote: (warning, file, size) => 'Y otro por fichero. «anyScript» aplica a cada script que emite el build —también a los del ' +
197
- 'arranque—, que es lo que lo hace usable cuando los nombres llevan hash y un budget por bundle no ' +
198
- `puede nombrar nada. Por eso va por encima del script más grande de hoy, ${file} con ${size}, o ` +
199
- `rompería el siguiente build por un fichero que nadie ha tocado — ${warning}:`,
200
- headWhatIf: 'Y si se difiriera',
201
- whatIfNote: 'El ahorro es exacto: se recorre el grafo sin esos ficheros, y lo que deja de alcanzarse es ' +
202
- 'lo que deja de descargarse. Lo que NO se recalcula es el troceado —qué ficheros acaban en ' +
203
- 'qué chunk lo decide el bundler, y simularlo daría idas y vueltas y totales por pantalla que ' +
204
- 'parecen medidos y no lo son—. Así que esos siguen igual arriba, y la última columna dice ' +
205
- 'quién lo pagaría en su lugar.',
206
- whatIfNobody: 'no lo usa nada diferido',
207
- whatIfEstimated: 'En cifras comprimidas son los bytes en crudo exactos a la proporción en que se comprime el ' +
208
- 'bootstrap: el tamaño correcto, no el exacto, y por eso el ≈.',
209
- whatIfNotHere: format => `--what-if no forma parte del formato ${format}: vuelve a lanzarlo con --format text, summary o json para ver la respuesta.`,
210
- colWhatIf: 'Diferido',
211
- colSize: 'En el bootstrap',
212
- colAfter: 'Bootstrap después',
213
- colWhoPays: 'Lo pagaría',
214
- };
215
- exports.CLI_TEXT = { es: ES, en: EN };