@bymaksym/loadline 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -43
- package/dist/cli/cli/args.js +79 -128
- package/dist/cli/cli/gates.js +80 -14
- package/dist/cli/cli/main.js +164 -33
- package/dist/cli/cli/memory.js +40 -4
- package/dist/cli/cli/{declared.js → read/declared.js} +1 -1
- package/dist/cli/cli/read/locate.js +214 -0
- package/dist/cli/cli/{read-build.js → read/read-build.js} +149 -84
- package/dist/cli/cli/read/read-config.js +120 -0
- package/dist/cli/cli/{html-report.js → render/html-report.js} +14 -10
- package/dist/cli/cli/render/render-agent.js +114 -0
- package/dist/cli/cli/render/render-asked.js +104 -0
- package/dist/cli/cli/render/render-badge.js +140 -0
- package/dist/cli/cli/{render-json.js → render/render-json.js} +18 -5
- package/dist/cli/cli/{render-markdown.js → render/render-markdown.js} +5 -5
- package/dist/cli/cli/{render-pr.js → render/render-pr.js} +33 -13
- package/dist/cli/cli/{render-sarif.js → render/render-sarif.js} +8 -3
- package/dist/cli/cli/{render-text.js → render/render-text.js} +118 -111
- package/dist/cli/cli/render/terminal.js +55 -0
- package/dist/cli/cli/report.js +68 -27
- package/dist/cli/cli/self-check.js +19 -23
- package/dist/cli/cli/since-last.js +2 -2
- package/dist/cli/cli/text/text-errors.js +124 -0
- package/dist/cli/cli/text/text.js +343 -0
- package/dist/cli/cli/text/usage.js +240 -0
- package/dist/cli/src/app/core/analysis/analysis.js +63 -23
- package/dist/cli/src/app/core/analysis/{barrels.js → graph/barrels.js} +1 -1
- package/dist/cli/src/app/core/analysis/{blast.js → graph/blast.js} +56 -17
- package/dist/cli/src/app/core/analysis/{cycles.js → graph/cycles.js} +1 -1
- package/dist/cli/src/app/core/analysis/{importers.js → graph/importers.js} +1 -1
- package/dist/cli/src/app/core/analysis/{insights.js → graph/insights.js} +10 -4
- package/dist/cli/src/app/core/analysis/invariant.js +1 -1
- package/dist/cli/src/app/core/analysis/metafile.types.js +7 -1
- package/dist/cli/src/app/core/analysis/{delivery.js → screens/delivery.js} +1 -1
- package/dist/cli/src/app/core/analysis/{entries.js → screens/entries.js} +50 -9
- package/dist/cli/src/app/core/analysis/screens/marks.js +32 -0
- package/dist/cli/src/app/core/analysis/screens/route-files.js +116 -0
- package/dist/cli/src/app/core/analysis/{sourcemap.js → sourcemap/sourcemap.js} +106 -7
- package/dist/cli/src/app/core/analysis/{split-drift.js → sourcemap/split-drift.js} +1 -1
- package/dist/cli/src/app/core/analysis/tool.js +83 -0
- package/dist/cli/src/app/core/assets/assets.js +134 -15
- package/dist/cli/src/app/core/baseline/baseline.js +0 -0
- package/dist/cli/src/app/core/{intake → build-text}/index-html.js +168 -13
- package/dist/cli/src/app/core/build-text/route-table.js +178 -0
- package/dist/cli/src/app/core/build-text/tool-marks.js +54 -0
- package/dist/cli/src/app/core/caching/caching.js +121 -43
- package/dist/cli/src/app/core/caching/from-analysis.js +20 -4
- package/dist/cli/src/app/core/config/config-text.js +90 -0
- package/dist/cli/src/app/core/config/config-values.js +358 -0
- package/dist/cli/src/app/core/config/loadline-config.js +81 -16
- package/dist/cli/src/app/core/config/merge-config.js +98 -0
- package/dist/cli/src/app/core/deps/deps.js +104 -16
- package/dist/cli/src/app/core/export/summary.js +29 -5
- package/dist/cli/src/app/core/findings/actions.js +3 -1
- package/dist/cli/src/app/core/findings/{boot-single.js → bundle/boot-single.js} +3 -3
- package/dist/cli/src/app/core/findings/{dupes.js → bundle/dupes.js} +8 -5
- package/dist/cli/src/app/core/findings/{graph.js → bundle/graph.js} +30 -18
- package/dist/cli/src/app/core/findings/{own-in-boot.js → bundle/own-in-boot.js} +9 -5
- package/dist/cli/src/app/core/findings/{requests.js → bundle/requests.js} +3 -3
- package/dist/cli/src/app/core/findings/{shipped.js → bundle/shipped.js} +28 -14
- package/dist/cli/src/app/core/findings/compose.js +6 -1
- package/dist/cli/src/app/core/findings/effort.js +2 -0
- package/dist/cli/src/app/core/findings/finding.types.js +1 -0
- package/dist/cli/src/app/core/findings/findings.js +48 -19
- package/dist/cli/src/app/core/findings/{assets.js → folder/assets.js} +38 -14
- package/dist/cli/src/app/core/findings/{caching.js → folder/caching.js} +16 -9
- package/dist/cli/src/app/core/findings/{page.js → folder/page.js} +6 -2
- package/dist/cli/src/app/core/findings/{scan.js → folder/scan.js} +25 -11
- package/dist/cli/src/app/core/findings/kind-names.js +163 -0
- package/dist/cli/src/app/core/findings/{deps.js → supplied/deps.js} +13 -8
- package/dist/cli/src/app/core/findings/supplied/forbidden.js +71 -0
- package/dist/cli/src/app/core/findings/{situation.js → supplied/situation.js} +2 -2
- package/dist/cli/src/app/core/findings/text/causes.js +39 -0
- package/dist/cli/src/app/core/findings/{finding-html.js → text/finding-html.js} +8 -1
- package/dist/cli/src/app/core/findings/{finding-text.js → text/finding-text.js} +208 -77
- package/dist/cli/src/app/core/findings/text/tool-advice.js +97 -0
- package/dist/cli/src/app/core/format/format.utils.js +158 -11
- package/dist/cli/src/app/core/format/ownership.js +93 -0
- package/dist/cli/src/app/core/i18n/en.js +76 -17
- package/dist/cli/src/app/core/i18n/es.js +82 -22
- package/dist/cli/src/app/core/intake/bundle-graph.js +281 -43
- package/dist/cli/src/app/core/intake/dist-files.js +82 -14
- package/dist/cli/src/app/core/intake/embedded.js +11 -1
- package/dist/cli/src/app/core/intake/unreached.js +139 -0
- package/dist/cli/src/app/core/intake/webpack-modules.js +185 -0
- package/dist/cli/src/app/core/intake/webpack-stats.js +298 -0
- package/dist/cli/src/app/core/project/project-context.js +16 -4
- package/dist/cli/src/app/core/project/project-name.js +36 -0
- package/dist/cli/src/app/core/scan/scan.js +58 -19
- package/dist/cli/src/app/core/scan/secrets.js +23 -3
- package/dist/cli/src/app/core/situation/situation-text.js +23 -0
- package/dist/cli/src/app/core/situation/situation.js +6 -4
- package/dist/cli/src/app/core/timing/timing.js +5 -2
- package/dist/cli/src/app/core/whatif/defer.js +29 -4
- package/dist/cli/src/app/core/whatif/source-importers.js +58 -0
- package/dist/cli/src/app/core/whatif/why.js +102 -0
- package/docs/CONFIG-REFERENCE.md +230 -0
- package/docs/CONFIG.md +511 -0
- package/docs/HOW-IT-WORKS.md +286 -25
- package/loadline.html +24 -20
- package/loadline.schema.json +1209 -0
- package/package.json +35 -29
- package/dist/cli/cli/locate.js +0 -60
- package/dist/cli/cli/text.js +0 -215
- /package/dist/cli/cli/{read-build.types.js → read/read-build.types.js} +0 -0
- /package/dist/cli/cli/{render-json.types.js → render/render-json.types.js} +0 -0
- /package/dist/cli/cli/{text.types.js → text/text.types.js} +0 -0
- /package/dist/cli/src/app/core/analysis/{exclusive.js → graph/exclusive.js} +0 -0
- /package/dist/cli/src/app/core/analysis/{insights.types.js → graph/insights.types.js} +0 -0
- /package/dist/cli/src/app/core/analysis/{module-graph.js → graph/module-graph.js} +0 -0
- /package/dist/cli/src/app/core/analysis/{sourcemap.types.js → sourcemap/sourcemap.types.js} +0 -0
- /package/dist/cli/src/app/core/findings/{finding-plain.js → text/finding-plain.js} +0 -0
|
@@ -100,6 +100,8 @@ exports.EFFORT = {
|
|
|
100
100
|
thirdParty: 'none',
|
|
101
101
|
licences: 'none',
|
|
102
102
|
transitive: 'none',
|
|
103
|
+
// The import the chain names, removed or made dynamic: the rule already said what to use instead.
|
|
104
|
+
forbidden: 'import',
|
|
103
105
|
updateWeight: 'none',
|
|
104
106
|
bootGrew: 'none',
|
|
105
107
|
bootNewPackages: 'none',
|
|
@@ -5,15 +5,18 @@ const criteria_1 = require("../criteria/criteria");
|
|
|
5
5
|
const format_utils_1 = require("../format/format.utils");
|
|
6
6
|
const project_context_1 = require("../project/project-context");
|
|
7
7
|
const situation_1 = require("../situation/situation");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const dupes_1 = require("./dupes");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
8
|
+
const actions_1 = require("./actions");
|
|
9
|
+
const boot_single_1 = require("./bundle/boot-single");
|
|
10
|
+
const dupes_1 = require("./bundle/dupes");
|
|
11
|
+
const graph_1 = require("./bundle/graph");
|
|
12
|
+
const own_in_boot_1 = require("./bundle/own-in-boot");
|
|
13
|
+
const requests_1 = require("./bundle/requests");
|
|
14
|
+
const shipped_1 = require("./bundle/shipped");
|
|
15
|
+
const caching_1 = require("./folder/caching");
|
|
16
|
+
const kind_names_1 = require("./kind-names");
|
|
17
|
+
const causes_1 = require("./text/causes");
|
|
18
|
+
const finding_html_1 = require("./text/finding-html");
|
|
19
|
+
const finding_text_1 = require("./text/finding-text");
|
|
17
20
|
const unitText = (lang, mode) => {
|
|
18
21
|
if (lang === 'es') {
|
|
19
22
|
return mode === 'raw' ? 'en crudo' : mode === 'brotli' ? 'comprimidas en brotli' : 'comprimidas en gzip';
|
|
@@ -112,13 +115,18 @@ declared = null) => {
|
|
|
112
115
|
target: { tab: 'boot', key: (0, format_utils_1.projectFolderOf)(first.path) },
|
|
113
116
|
kind: 'bigFile',
|
|
114
117
|
saving: insights.exclusiveOf(bigFiles.map(file => file.path)),
|
|
118
|
+
size: bigFiles.reduce((sum, file) => sum + file.bytes, 0),
|
|
115
119
|
sources: bigFiles.map(file => file.path),
|
|
120
|
+
// The files are raw bytes, and so is the limit they are held to: both are said in the
|
|
121
|
+
// report's unit, at the ratio the bootstrap compresses by, as the savings are.
|
|
116
122
|
...text.bigFile({
|
|
117
123
|
count: bigFiles.length,
|
|
118
|
-
each: (0,
|
|
124
|
+
each: (0, actions_1.formatSaving)(c.bigOwnFileBytes, (0, actions_1.unitScale)(analysis)),
|
|
119
125
|
name: (0, format_utils_1.baseName)(first.path),
|
|
120
|
-
size: (0,
|
|
121
|
-
list: bigFiles
|
|
126
|
+
size: (0, actions_1.formatSaving)(bigFiles.reduce((sum, file) => sum + file.bytes, 0), (0, actions_1.unitScale)(analysis)),
|
|
127
|
+
list: bigFiles
|
|
128
|
+
.map(file => `${(0, finding_html_1.mono)(file.path)} (${(0, actions_1.formatSaving)(file.bytes, (0, actions_1.unitScale)(analysis))})`)
|
|
129
|
+
.join(' · '),
|
|
122
130
|
}),
|
|
123
131
|
});
|
|
124
132
|
}
|
|
@@ -141,6 +149,7 @@ declared = null) => {
|
|
|
141
149
|
severity: 'mid',
|
|
142
150
|
target: { tab: 'screens', key: worstScreen.source },
|
|
143
151
|
kind: 'heavy',
|
|
152
|
+
size: worstScreen.own,
|
|
144
153
|
...text.heavy({
|
|
145
154
|
count: byOwn.length,
|
|
146
155
|
label: worstScreen.label,
|
|
@@ -158,6 +167,10 @@ declared = null) => {
|
|
|
158
167
|
const unreachable = analysis.unreachable;
|
|
159
168
|
if (unreachable.length > 0) {
|
|
160
169
|
const unreachableBytes = unreachable.reduce((sum, chunk) => sum + chunk.bytes, 0);
|
|
170
|
+
const namesakes = new Map();
|
|
171
|
+
for (const chunk of unreachable) {
|
|
172
|
+
namesakes.set((0, format_utils_1.baseName)(chunk.file), (namesakes.get((0, format_utils_1.baseName)(chunk.file)) ?? 0) + 1);
|
|
173
|
+
}
|
|
161
174
|
// `allChunks` is every chunk of the build, these among them, so the share is over that.
|
|
162
175
|
const allBytes = analysis.allChunks.reduce((sum, file) => sum + (analysis.chunkOf(file)?.bytes ?? 0), 0);
|
|
163
176
|
// Two service workers are a footnote; most of the build is not. The share is what decides,
|
|
@@ -168,6 +181,7 @@ declared = null) => {
|
|
|
168
181
|
severity: most ? 'mid' : 'info',
|
|
169
182
|
kind: 'unreachable',
|
|
170
183
|
...text.unreachable({
|
|
184
|
+
folder: analysis.readFrom === 'folder',
|
|
171
185
|
count: unreachable.length,
|
|
172
186
|
total: analysis.allChunks.length,
|
|
173
187
|
size: (0, format_utils_1.formatBytes)(unreachableBytes),
|
|
@@ -175,9 +189,11 @@ declared = null) => {
|
|
|
175
189
|
// All of them, heaviest first. This signal exists because a report described 12
|
|
176
190
|
// chunks of 244 without saying so; naming four of the 232 would be the same
|
|
177
191
|
// mistake one level down.
|
|
192
|
+
// By path where two share a name: TinyMCE ships 25 `plugin.min.js`, and the list
|
|
193
|
+
// read "plugin.min.js" 25 times, which identifies none of them.
|
|
178
194
|
list: unreachable
|
|
179
195
|
.toSorted((a, b) => b.bytes - a.bytes)
|
|
180
|
-
.map(chunk => (0, finding_html_1.mono)((0, format_utils_1.baseName)(chunk.file)))
|
|
196
|
+
.map(chunk => (0, finding_html_1.mono)((namesakes.get((0, format_utils_1.baseName)(chunk.file)) ?? 0) > 1 ? chunk.file : (0, format_utils_1.baseName)(chunk.file)))
|
|
181
197
|
.join(', '),
|
|
182
198
|
}),
|
|
183
199
|
});
|
|
@@ -263,6 +279,9 @@ const buildComparisonFindings = (comparison, lang, c) => {
|
|
|
263
279
|
before: (0, format_utils_1.formatBytes)(comparison.boot.before),
|
|
264
280
|
after: (0, format_utils_1.formatBytes)(comparison.boot.after),
|
|
265
281
|
baseline: comparison.baselineName,
|
|
282
|
+
causes: (0, causes_1.bootCausesText)(comparison, lang),
|
|
283
|
+
estimated: comparison.causesEstimated,
|
|
284
|
+
ownKnown: comparison.causesOwnKnown,
|
|
266
285
|
}),
|
|
267
286
|
});
|
|
268
287
|
}
|
|
@@ -274,8 +293,10 @@ const buildComparisonFindings = (comparison, lang, c) => {
|
|
|
274
293
|
kind: 'bootNewPackages',
|
|
275
294
|
...text.bootNewPackages({
|
|
276
295
|
count: comparison.newBootPackages.length,
|
|
296
|
+
// Raw, as everything inside a chunk is: at the ratio the bootstrap compresses by,
|
|
297
|
+
// or "marked (40 kB)" sat next to "marked ≈+15 kB" for the same package.
|
|
277
298
|
list: comparison.newBootPackages
|
|
278
|
-
.map(pkg => `${(0, finding_html_1.mono)(pkg.name)} (${(0, format_utils_1.formatBytes)(pkg.bytes)})`)
|
|
299
|
+
.map(pkg => `${(0, finding_html_1.mono)(pkg.name)} (${comparison.causesEstimated ? '≈' : ''}${(0, format_utils_1.formatBytes)(pkg.bytes * comparison.causesRatio)})`)
|
|
279
300
|
.join(' · '),
|
|
280
301
|
baseline: comparison.baselineName,
|
|
281
302
|
}),
|
|
@@ -284,15 +305,14 @@ const buildComparisonFindings = (comparison, lang, c) => {
|
|
|
284
305
|
// What the person actually wants to see on a merge request: not the delta of bytes, but which
|
|
285
306
|
// signals went away and which came in. It is the only thing that makes fixing something visible.
|
|
286
307
|
if (comparison.findingsComparable && (comparison.newFindings.length > 0 || comparison.goneFindings.length > 0)) {
|
|
287
|
-
const chips = (list) => list.map(item => (0, finding_html_1.mono)(item.kind)).join(', ');
|
|
288
308
|
findings.push({
|
|
289
309
|
severity: comparison.newFindings.length > 0 ? 'mid' : 'ok',
|
|
290
310
|
kind: 'signalsChanged',
|
|
291
311
|
...text.signalsChanged({
|
|
292
312
|
fixed: comparison.goneFindings.length,
|
|
293
313
|
added: comparison.newFindings.length,
|
|
294
|
-
fixedList:
|
|
295
|
-
addedList:
|
|
314
|
+
fixedList: (0, kind_names_1.signalList)(lang, comparison.goneFindings),
|
|
315
|
+
addedList: (0, kind_names_1.signalList)(lang, comparison.newFindings),
|
|
296
316
|
baseline: comparison.baselineName,
|
|
297
317
|
}),
|
|
298
318
|
});
|
|
@@ -318,6 +338,10 @@ const buildComparisonFindings = (comparison, lang, c) => {
|
|
|
318
338
|
const individual = sharedGrowth ? grown.filter(screen => !alike.includes(screen)) : grown;
|
|
319
339
|
const top = individual[0];
|
|
320
340
|
if (top) {
|
|
341
|
+
// Each screen with what grew in it, when both snapshots broke it down: "+120 kB" sends the
|
|
342
|
+
// person to open two reports side by side; "`xlsx` ≈+118 kB (new)" is the answer itself.
|
|
343
|
+
const rows = individual.map(screen => ({ screen, causes: (0, causes_1.screenCausesText)(screen, lang) }));
|
|
344
|
+
const explained = rows.filter(row => row.causes.length > 0);
|
|
321
345
|
findings.push({
|
|
322
346
|
severity: 'mid',
|
|
323
347
|
target: { tab: 'screens', key: top.source },
|
|
@@ -327,9 +351,14 @@ const buildComparisonFindings = (comparison, lang, c) => {
|
|
|
327
351
|
top: top.label,
|
|
328
352
|
diff: signed(top.lazy.diff),
|
|
329
353
|
pct: pctOf(top.lazy.ratio),
|
|
330
|
-
list:
|
|
331
|
-
.map(screen
|
|
354
|
+
list: rows
|
|
355
|
+
.map(({ screen, causes }) => {
|
|
356
|
+
const figure = `${(0, finding_html_1.mono)(screen.label)} ${signed(screen.lazy.diff)} (${pctOf(screen.lazy.ratio)} %)`;
|
|
357
|
+
return causes.length > 0 ? `${figure} — ${causes.join(', ')}` : figure;
|
|
358
|
+
})
|
|
332
359
|
.join(' · '),
|
|
360
|
+
explained: explained.length > 0,
|
|
361
|
+
estimated: explained.some(row => row.screen.causesEstimated),
|
|
333
362
|
}),
|
|
334
363
|
});
|
|
335
364
|
}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.buildAssetFindings = void 0;
|
|
15
|
-
const format_utils_1 = require("
|
|
16
|
-
const finding_html_1 = require("
|
|
17
|
-
const finding_text_1 = require("
|
|
15
|
+
const format_utils_1 = require("../../format/format.utils");
|
|
16
|
+
const finding_html_1 = require("../text/finding-html");
|
|
17
|
+
const finding_text_1 = require("../text/finding-text");
|
|
18
18
|
const named = (items) => items.map(item => (0, finding_html_1.mono)(item)).join(', ');
|
|
19
19
|
/**
|
|
20
20
|
* @param repoPaths where in the repository each unreferenced file comes from, when `angular.json`
|
|
@@ -32,15 +32,29 @@ const buildAssetFindings = (assets, lang, c, repoPaths = null, verified = false)
|
|
|
32
32
|
const fonts = assets.fonts;
|
|
33
33
|
const fontBytes = fonts.reduce((sum, family) => sum + family.bytes, 0);
|
|
34
34
|
const superseded = fonts.flatMap(family => family.superseded);
|
|
35
|
-
|
|
35
|
+
// Weights, not files: regular and bold in woff2 and ttf are two weights, and counting the
|
|
36
|
+
// second format here would raise the card for the very files the title says nobody downloads.
|
|
37
|
+
const manyWeights = fonts.filter(family => family.files.filter(file => !family.superseded.includes(file.name)).length > 2);
|
|
38
|
+
// What the superseded formats weigh. They are on the server and nobody downloads them — a
|
|
39
|
+
// browser takes the first format of the list it understands — so they are said apart from
|
|
40
|
+
// the total, which is a figure of the folder and not of a visit.
|
|
41
|
+
const spare = new Set(superseded);
|
|
42
|
+
const spareBytes = fonts
|
|
43
|
+
.flatMap(family => family.files)
|
|
44
|
+
.filter(file => spare.has(file.name))
|
|
45
|
+
.reduce((sum, file) => sum + file.bytes, 0);
|
|
36
46
|
if (fonts.length > 0 && (fontBytes >= c.shippedMinBytes || superseded.length > 0)) {
|
|
37
47
|
findings.push({
|
|
38
|
-
|
|
48
|
+
// A second format is clutter on the server, not bytes on the wire: on its own it is
|
|
49
|
+
// context. Weights nobody uses are downloaded the moment a style asks for them.
|
|
50
|
+
severity: manyWeights.length > 0 ? 'mid' : 'info',
|
|
39
51
|
kind: 'fonts',
|
|
52
|
+
size: fontBytes,
|
|
40
53
|
...text.fonts({
|
|
41
54
|
families: fonts.length,
|
|
42
55
|
files: fonts.reduce((sum, family) => sum + family.files.length, 0),
|
|
43
56
|
size: (0, format_utils_1.formatBytes)(fontBytes),
|
|
57
|
+
spare: (0, format_utils_1.formatBytes)(spareBytes),
|
|
44
58
|
superseded: named(superseded),
|
|
45
59
|
preloaded: named(fonts.flatMap(family => family.preloaded)),
|
|
46
60
|
list: fonts
|
|
@@ -71,18 +85,28 @@ const buildAssetFindings = (assets, lang, c, repoPaths = null, verified = false)
|
|
|
71
85
|
}
|
|
72
86
|
// 3 · The same file under two names. Only when the contents were compared: a list built from
|
|
73
87
|
// sizes alone would be a guess dressed as a finding.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
// And what travels twice apart from what is only stored twice: a copy nothing names is never
|
|
89
|
+
// downloaded, and two copies with one of them named cost the deploy, not the visit.
|
|
90
|
+
const listOf = (entries) => entries.map(entry => `${named(entry.names)} (${(0, format_utils_1.formatBytes)(entry.bytes)} ${text.each})`).join(' · ');
|
|
91
|
+
const wastedBy = (entries) => entries.reduce((sum, entry) => sum + entry.wasted, 0);
|
|
92
|
+
const travels = assets.duplicates.filter(entry => entry.named === null || entry.named > 1);
|
|
93
|
+
const stored = assets.duplicates.filter(entry => entry.named !== null && entry.named <= 1);
|
|
94
|
+
const wasted = wastedBy(travels);
|
|
95
|
+
if (assets.duplicates.length > 0) {
|
|
77
96
|
findings.push({
|
|
78
|
-
|
|
97
|
+
// A copy smaller than what moves between two builds is said, and is no work to plan.
|
|
98
|
+
severity: wasted >= c.growthMinBytes ? 'mid' : 'info',
|
|
79
99
|
kind: 'duplicateAssets',
|
|
80
100
|
...text.duplicateAssets({
|
|
81
|
-
count:
|
|
82
|
-
size: (0, format_utils_1.formatBytes)(
|
|
83
|
-
list:
|
|
84
|
-
|
|
85
|
-
.
|
|
101
|
+
count: travels.length,
|
|
102
|
+
size: (0, format_utils_1.formatBytes)(wasted),
|
|
103
|
+
list: listOf(travels),
|
|
104
|
+
stored: {
|
|
105
|
+
count: stored.length,
|
|
106
|
+
size: (0, format_utils_1.formatBytes)(wastedBy(stored)),
|
|
107
|
+
list: listOf(stored),
|
|
108
|
+
none: stored.every(entry => entry.named === 0),
|
|
109
|
+
},
|
|
86
110
|
}),
|
|
87
111
|
});
|
|
88
112
|
}
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.buildCachingFindings = exports.buildCascadeShapeFindings = void 0;
|
|
11
|
-
const blast_1 = require("
|
|
12
|
-
const format_utils_1 = require("
|
|
13
|
-
const situation_1 = require("
|
|
14
|
-
const finding_html_1 = require("
|
|
15
|
-
const finding_text_1 = require("
|
|
11
|
+
const blast_1 = require("../../analysis/graph/blast");
|
|
12
|
+
const format_utils_1 = require("../../format/format.utils");
|
|
13
|
+
const situation_1 = require("../../situation/situation");
|
|
14
|
+
const finding_html_1 = require("../text/finding-html");
|
|
15
|
+
const finding_text_1 = require("../text/finding-text");
|
|
16
16
|
/**
|
|
17
17
|
* How exposed this build is to the hash cascade, from its own topology.
|
|
18
18
|
*
|
|
@@ -31,7 +31,7 @@ const finding_text_1 = require("./finding-text");
|
|
|
31
31
|
const buildCascadeShapeFindings = (analysis, lang, situation = situation_1.EMPTY_SITUATION) => {
|
|
32
32
|
const shape = (0, blast_1.cascadeShapeOf)(analysis);
|
|
33
33
|
// Nothing to say about a build with no chunk that names several others: there is no shape yet.
|
|
34
|
-
if (!shape.hub || shape.names < 2) {
|
|
34
|
+
if (!shape.hub || (shape.via === 'names' && shape.names < 2)) {
|
|
35
35
|
return [];
|
|
36
36
|
}
|
|
37
37
|
const exposure = (0, situation_1.cascadeExposure)(situation);
|
|
@@ -54,6 +54,9 @@ const buildCascadeShapeFindings = (analysis, lang, situation = situation_1.EMPTY
|
|
|
54
54
|
hub: shape.hub,
|
|
55
55
|
names: shape.names,
|
|
56
56
|
named: shape.named,
|
|
57
|
+
concentrated: shape.concentrated,
|
|
58
|
+
hubInBoot: shape.hubInBoot,
|
|
59
|
+
imported: shape.via === 'imports',
|
|
57
60
|
size: (0, format_utils_1.formatBytes)(shape.bytes),
|
|
58
61
|
chunks: analysis.allChunks.length,
|
|
59
62
|
exposure,
|
|
@@ -63,7 +66,9 @@ const buildCascadeShapeFindings = (analysis, lang, situation = situation_1.EMPTY
|
|
|
63
66
|
];
|
|
64
67
|
};
|
|
65
68
|
exports.buildCascadeShapeFindings = buildCascadeShapeFindings;
|
|
66
|
-
const buildCachingFindings = (caching, lang, c, situation = situation_1.EMPTY_SITUATION
|
|
69
|
+
const buildCachingFindings = (caching, lang, c, situation = situation_1.EMPTY_SITUATION,
|
|
70
|
+
/** What wrote the build, for which setting the advice on splitting names. */
|
|
71
|
+
tool) => {
|
|
67
72
|
const text = finding_text_1.TEXT[lang];
|
|
68
73
|
const findings = [];
|
|
69
74
|
// 1 · What the update costs. The figure that does not exist anywhere else, and the one this
|
|
@@ -124,14 +129,16 @@ const buildCachingFindings = (caching, lang, c, situation = situation_1.EMPTY_SI
|
|
|
124
129
|
findings.push({
|
|
125
130
|
severity: worst.inBoot ? 'mid' : 'info',
|
|
126
131
|
kind: 'unstableChunk',
|
|
132
|
+
size: wasted,
|
|
127
133
|
...text.unstableChunk({
|
|
128
134
|
count: unstable.length,
|
|
129
135
|
name: worst.name,
|
|
130
136
|
pct: Math.round(worst.vendorRatio * 100),
|
|
131
|
-
size: (0, format_utils_1.formatBytes)(wasted)
|
|
137
|
+
size: `${worst.estimated ? '≈' : ''}${(0, format_utils_1.formatBytes)(wasted)}`,
|
|
132
138
|
inBoot: worst.inBoot,
|
|
139
|
+
tool,
|
|
133
140
|
list: unstable
|
|
134
|
-
.map(chunk => `${(0, finding_html_1.mono)(chunk.name)} — ${Math.round(chunk.vendorRatio * 100)} % ${(0, format_utils_1.formatBytes)(chunk.vendorBytes)}${chunk.inBoot ? ' (bootstrap)' : ''}`)
|
|
141
|
+
.map(chunk => `${(0, finding_html_1.mono)(chunk.name)} — ${Math.round(chunk.vendorRatio * 100)} % ${chunk.estimated ? '≈' : ''}${(0, format_utils_1.formatBytes)(chunk.vendorBytes)}${chunk.inBoot ? ' (bootstrap)' : ''}`)
|
|
135
142
|
.join(' · '),
|
|
136
143
|
}),
|
|
137
144
|
});
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.buildPageFindings = void 0;
|
|
13
|
-
const finding_text_1 = require("
|
|
13
|
+
const finding_text_1 = require("../text/finding-text");
|
|
14
14
|
/**
|
|
15
15
|
* A page fetching from somewhere else, when it does.
|
|
16
16
|
*
|
|
@@ -23,7 +23,10 @@ const buildPageFindings = (page, lang) => {
|
|
|
23
23
|
if (!page) {
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
// And the stylesheets that block the paint: an icon font or a web font's CSS from another host
|
|
27
|
+
// is the strictest "before anything appears" there is, and three real builds had one that no
|
|
28
|
+
// figure and no signal mentioned.
|
|
29
|
+
const carrying = page.origins.filter(row => row.scripts > 0 || (row.styles ?? 0) > 0);
|
|
27
30
|
if (carrying.length === 0 && !page.base) {
|
|
28
31
|
return [];
|
|
29
32
|
}
|
|
@@ -38,6 +41,7 @@ const buildPageFindings = (page, lang) => {
|
|
|
38
41
|
...finding_text_1.TEXT[lang].assetOrigin({
|
|
39
42
|
origins: carrying.map(row => row.origin),
|
|
40
43
|
scripts: carrying.reduce((sum, row) => sum + row.scripts, 0),
|
|
44
|
+
styles: carrying.reduce((sum, row) => sum + (row.styles ?? 0), 0),
|
|
41
45
|
files: page.origins.reduce((sum, row) => sum + row.files, 0),
|
|
42
46
|
cold: cold.map(row => row.origin),
|
|
43
47
|
warmed: carrying.filter(row => hinted.has(row.origin)).map(row => row.origin),
|
|
@@ -9,13 +9,20 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.buildScanFindings = void 0;
|
|
12
|
-
const
|
|
13
|
-
const finding_html_1 = require("
|
|
14
|
-
const finding_text_1 = require("
|
|
12
|
+
const actions_1 = require("../actions");
|
|
13
|
+
const finding_html_1 = require("../text/finding-html");
|
|
14
|
+
const finding_text_1 = require("../text/finding-text");
|
|
15
15
|
const named = (items) => items.map(item => (0, finding_html_1.mono)(item)).join(', ');
|
|
16
16
|
/** The ones that are a problem whatever else is true, as opposed to a build pointed at the wrong place. */
|
|
17
17
|
const ALWAYS_SERIOUS = new Set(['privateKey', 'awsKey', 'githubToken', 'slackToken', 'googleKey']);
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param scale how the raw weights of packages are said in the report's unit: `unitScale` of the
|
|
20
|
+
* analysis. Raw by default, which is what a raw report needs and nothing more.
|
|
21
|
+
*/
|
|
22
|
+
const buildScanFindings = (scan, lang, c, scale = actions_1.RAW_SCALE,
|
|
23
|
+
/** What wrote the build: which setting the advice on source maps names, and whose console it may be. */
|
|
24
|
+
tool) => {
|
|
25
|
+
const sized = (bytes) => (0, actions_1.formatSaving)(bytes, scale);
|
|
19
26
|
const text = finding_text_1.TEXT[lang];
|
|
20
27
|
const findings = [];
|
|
21
28
|
// 1 · Credentials and internal addresses. The cheapest finding here and the most expensive to
|
|
@@ -42,9 +49,12 @@ const buildScanFindings = (scan, lang, c) => {
|
|
|
42
49
|
open: open.length,
|
|
43
50
|
publicKeys: publicKeys.length,
|
|
44
51
|
theirs: [...new Set(theirs.map(match => match.owner ?? ''))].map(pkg => (0, finding_html_1.mono)(pkg)).join(', '),
|
|
45
|
-
kinds: [...new Set(secrets.map(match => match.kind))].join(', '),
|
|
52
|
+
kinds: [...new Set(secrets.map(match => text.secretNames[match.kind]))].join(', '),
|
|
53
|
+
// What raises the card, named in its title. A public Firebase key is said in the same
|
|
54
|
+
// card, so "medium" next to "public by design" read as the key being the problem.
|
|
55
|
+
openKinds: [...new Set(open.map(match => text.secretNames[match.kind]))].join(', '),
|
|
46
56
|
list: secrets
|
|
47
|
-
.map(match => `${(0, finding_html_1.mono)(match.
|
|
57
|
+
.map(match => `${text.secretNames[match.kind]} ${(0, finding_html_1.mono)(match.redacted)} (${(0, finding_html_1.mono)(match.chunk)}${match.count > 1 ? `, ×${match.count}` : ''}${match.benign ? `, ${text.secretBenign[match.benign]}` : ''}${match.owner ? `, ${text.secretOwner((0, finding_html_1.mono)(match.owner))}` : ''})`)
|
|
48
58
|
.join(' · '),
|
|
49
59
|
}),
|
|
50
60
|
});
|
|
@@ -66,7 +76,10 @@ const buildScanFindings = (scan, lang, c) => {
|
|
|
66
76
|
count: leftovers.length,
|
|
67
77
|
broken: breaking.length > 0,
|
|
68
78
|
unattributed,
|
|
69
|
-
|
|
79
|
+
tool,
|
|
80
|
+
list: leftovers
|
|
81
|
+
.map(item => `${text.leftoverNames[item.kind]} ×${item.count} (${named(item.where)})`)
|
|
82
|
+
.join(' · '),
|
|
70
83
|
}),
|
|
71
84
|
});
|
|
72
85
|
}
|
|
@@ -84,6 +97,7 @@ const buildScanFindings = (scan, lang, c) => {
|
|
|
84
97
|
files: exposure.ownFiles,
|
|
85
98
|
maps: exposure.maps,
|
|
86
99
|
env: exposure.envReferences,
|
|
100
|
+
tool,
|
|
87
101
|
list: exposure.paths.map(path => (0, finding_html_1.mono)(path)).join(' · '),
|
|
88
102
|
}),
|
|
89
103
|
});
|
|
@@ -98,11 +112,11 @@ const buildScanFindings = (scan, lang, c) => {
|
|
|
98
112
|
kind: 'thirdParty',
|
|
99
113
|
...text.thirdParty({
|
|
100
114
|
count: groups.reduce((sum, group) => sum + group.packages.length, 0),
|
|
101
|
-
size: (
|
|
102
|
-
total: (
|
|
115
|
+
size: sized(bootBytes),
|
|
116
|
+
total: sized(groups.reduce((sum, group) => sum + group.bytes, 0)),
|
|
103
117
|
list: groups
|
|
104
|
-
.map(group => `${(0, finding_html_1.mono)(group.category)} — ${(
|
|
105
|
-
.map(pkg => `${pkg.name} (${(
|
|
118
|
+
.map(group => `${(0, finding_html_1.mono)(group.category)} — ${sized(group.bytes)}: ${group.packages
|
|
119
|
+
.map(pkg => `${pkg.name} (${sized(pkg.bytes)}${pkg.inBoot ? ', bootstrap' : ''})`)
|
|
106
120
|
.join(', ')}`)
|
|
107
121
|
.join(' · '),
|
|
108
122
|
}),
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What each signal is, in the words its card uses, in both languages.
|
|
4
|
+
*
|
|
5
|
+
* A `Record` over every kind, so a signal added without a name here does not compile. The schema
|
|
6
|
+
* of `loadline.json` describes what `accepted` can name with the English half. The report uses
|
|
7
|
+
* both halves wherever it names a signal without its card at hand: one that went away since the
|
|
8
|
+
* baseline has no card any more, and "No longer raised: `cycles`, `dupes`" named two identifiers
|
|
9
|
+
* where it meant two problems.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.signalList = exports.KIND_NAMES = void 0;
|
|
13
|
+
const finding_html_1 = require("./text/finding-html");
|
|
14
|
+
exports.KIND_NAMES = {
|
|
15
|
+
en: {
|
|
16
|
+
shared: 'common code marked as lazy',
|
|
17
|
+
bootLazy: 'bootstrap for a lazy screen',
|
|
18
|
+
bootSingle: 'bootstrap package with a single importer',
|
|
19
|
+
bigFile: 'large source file',
|
|
20
|
+
dupes: 'duplicate copies of a package',
|
|
21
|
+
heavy: 'expensive screen',
|
|
22
|
+
clean: 'no signals',
|
|
23
|
+
commonJs: 'CommonJS package',
|
|
24
|
+
ownInBoot: 'your own code in the bootstrap for a lazy screen',
|
|
25
|
+
locales: 'every language of a library',
|
|
26
|
+
dataAsCode: 'data shipped as code',
|
|
27
|
+
sourceMaps: 'source maps in the folder',
|
|
28
|
+
noSourceMaps: 'folder without source maps',
|
|
29
|
+
splitDrift: 'the breakdown does not add up to the file',
|
|
30
|
+
prefetched: 'screens fetched before anybody asks',
|
|
31
|
+
unreachable: 'chunks this report cannot reach',
|
|
32
|
+
mixedImport: 'imported both statically and dynamically',
|
|
33
|
+
ownBarrel: 'barrel file of your own in the bootstrap',
|
|
34
|
+
packageBarrel: 'package that comes in whole',
|
|
35
|
+
cycles: 'import cycles',
|
|
36
|
+
paidTwice: 'bytes paid for twice',
|
|
37
|
+
twinScreens: 'twin screens',
|
|
38
|
+
theirs: 'whose first load this is',
|
|
39
|
+
fonts: 'fonts',
|
|
40
|
+
media: 'images and video',
|
|
41
|
+
duplicateAssets: 'the same file under two names',
|
|
42
|
+
unreferencedAssets: 'files nothing reaches',
|
|
43
|
+
inlinedData: 'files embedded as data URIs',
|
|
44
|
+
updateWeight: 'weight of the update',
|
|
45
|
+
unstableChunk: 'chunk mixing what changes with what does not',
|
|
46
|
+
unhashable: 'names that cannot be cached',
|
|
47
|
+
secrets: 'secrets or internal addresses in the bundle',
|
|
48
|
+
devLeftovers: 'development leftovers in production',
|
|
49
|
+
sourceExposed: 'your source code is published',
|
|
50
|
+
thirdParty: 'third-party services',
|
|
51
|
+
licences: 'licences with conditions',
|
|
52
|
+
vulnerable: 'vulnerabilities that actually ship',
|
|
53
|
+
transitive: 'packages you did not ask for',
|
|
54
|
+
forbidden: 'forbidden in loadline.json',
|
|
55
|
+
bootWaves: 'bootstrap in several round trips',
|
|
56
|
+
slowScreens: 'discovery depth',
|
|
57
|
+
manyRequests: 'granularity of the split',
|
|
58
|
+
bootGrew: 'bootstrap has grown',
|
|
59
|
+
bootNewPackages: 'new package in the bootstrap',
|
|
60
|
+
sharedGrew: 'shared chunk has grown',
|
|
61
|
+
signalsChanged: 'signals fixed and new',
|
|
62
|
+
screensGrew: 'screen has grown',
|
|
63
|
+
budgetNone: 'no size budget',
|
|
64
|
+
budgetNotBuilt: 'budget the pipeline never applies',
|
|
65
|
+
budgetWarnOnly: 'budget that only warns',
|
|
66
|
+
budgetTooHigh: 'budget too high',
|
|
67
|
+
zoneless: 'no zone.js',
|
|
68
|
+
assetOrigin: 'assets served from another host',
|
|
69
|
+
cascadeShape: 'hash cascade',
|
|
70
|
+
servedUncompressed: 'JavaScript served uncompressed',
|
|
71
|
+
measuredWaves: 'more batches than computed',
|
|
72
|
+
poolExhausted: 'the connection pool ran out',
|
|
73
|
+
thirdPartyLoad: 'third-party requests in the same load',
|
|
74
|
+
revalidated: 'hashed files being revalidated',
|
|
75
|
+
swControlling: 'a service worker controls this load',
|
|
76
|
+
measuredOrigin: 'the code came from another host',
|
|
77
|
+
observedChannel: 'observed environment',
|
|
78
|
+
measuredEager: 'the router loads an area the guard then rejects',
|
|
79
|
+
measuredExtra: 'measured above computed',
|
|
80
|
+
measuredShort: 'measured below computed',
|
|
81
|
+
measuredMatch: 'computed and measured agree',
|
|
82
|
+
situationAsked: 'the situation, answered',
|
|
83
|
+
situationPriority: 'which wait the team would rather pay',
|
|
84
|
+
situationMissing: 'questions that would change this report',
|
|
85
|
+
},
|
|
86
|
+
es: {
|
|
87
|
+
shared: 'código común marcado como lazy',
|
|
88
|
+
bootLazy: 'bootstrap para una pantalla lazy',
|
|
89
|
+
bootSingle: 'paquete del arranque con un solo importador',
|
|
90
|
+
bigFile: 'fichero propio grande',
|
|
91
|
+
dupes: 'copias duplicadas',
|
|
92
|
+
heavy: 'pantalla cara',
|
|
93
|
+
clean: 'sin señales',
|
|
94
|
+
commonJs: 'paquete en CommonJS',
|
|
95
|
+
ownInBoot: 'código tuyo en el bootstrap para una pantalla lazy',
|
|
96
|
+
locales: 'todos los idiomas de una librería',
|
|
97
|
+
dataAsCode: 'datos incluidos como código',
|
|
98
|
+
sourceMaps: 'source maps en la carpeta',
|
|
99
|
+
noSourceMaps: 'carpeta sin source maps',
|
|
100
|
+
splitDrift: 'el desglose no cuadra con el fichero',
|
|
101
|
+
prefetched: 'pantallas que se piden antes de que nadie las abra',
|
|
102
|
+
unreachable: 'chunks que el informe no alcanza',
|
|
103
|
+
mixedImport: 'import estático y dinámico a la vez',
|
|
104
|
+
ownBarrel: 'barrel file propio en el bootstrap',
|
|
105
|
+
packageBarrel: 'paquete que entra entero',
|
|
106
|
+
cycles: 'ciclos de importación',
|
|
107
|
+
paidTwice: 'bytes pagados dos veces',
|
|
108
|
+
twinScreens: 'pantallas gemelas',
|
|
109
|
+
theirs: 'de quién es la primera carga',
|
|
110
|
+
fonts: 'tipografías',
|
|
111
|
+
media: 'imágenes y vídeo',
|
|
112
|
+
duplicateAssets: 'el mismo fichero con dos nombres',
|
|
113
|
+
unreferencedAssets: 'ficheros que no alcanza nadie',
|
|
114
|
+
inlinedData: 'ficheros incrustados como data URI',
|
|
115
|
+
updateWeight: 'peso de la actualización',
|
|
116
|
+
unstableChunk: 'chunk que mezcla lo que cambia con lo que no',
|
|
117
|
+
unhashable: 'nombres que no se pueden cachear',
|
|
118
|
+
secrets: 'secretos o direcciones internas en el bundle',
|
|
119
|
+
devLeftovers: 'restos de desarrollo en producción',
|
|
120
|
+
sourceExposed: 'tu código fuente está publicado',
|
|
121
|
+
thirdParty: 'servicios de terceros',
|
|
122
|
+
licences: 'licencias con condiciones',
|
|
123
|
+
vulnerable: 'vulnerabilidades que sí viajan',
|
|
124
|
+
transitive: 'paquetes que no pides tú',
|
|
125
|
+
forbidden: 'prohibido en loadline.json',
|
|
126
|
+
bootWaves: 'el arranque en varias idas y vueltas',
|
|
127
|
+
slowScreens: 'profundidad de descubrimiento',
|
|
128
|
+
manyRequests: 'granularidad del troceado',
|
|
129
|
+
bootGrew: 'el bootstrap ha crecido',
|
|
130
|
+
bootNewPackages: 'paquete nuevo en el bootstrap',
|
|
131
|
+
sharedGrew: 'chunk compartido que ha crecido',
|
|
132
|
+
signalsChanged: 'señales nuevas y resueltas',
|
|
133
|
+
screensGrew: 'pantalla que ha crecido',
|
|
134
|
+
budgetNone: 'sin budget de tamaño',
|
|
135
|
+
budgetNotBuilt: 'budget que el pipeline no aplica',
|
|
136
|
+
budgetWarnOnly: 'budget que solo avisa',
|
|
137
|
+
budgetTooHigh: 'budget demasiado alto',
|
|
138
|
+
zoneless: 'sin zone.js',
|
|
139
|
+
assetOrigin: 'los assets salen de otro host',
|
|
140
|
+
cascadeShape: 'cascada de hashes',
|
|
141
|
+
servedUncompressed: 'JavaScript servido sin comprimir',
|
|
142
|
+
measuredWaves: 'más tandas de las calculadas',
|
|
143
|
+
poolExhausted: 'se agotó el pool de conexiones',
|
|
144
|
+
thirdPartyLoad: 'peticiones a terceros en la misma carga',
|
|
145
|
+
revalidated: 'ficheros con hash que se revalidan',
|
|
146
|
+
swControlling: 'un service worker controla esta carga',
|
|
147
|
+
measuredOrigin: 'el código vino de otro host',
|
|
148
|
+
observedChannel: 'entorno observado',
|
|
149
|
+
measuredEager: 'el router carga una zona antes de que el guard la rechace',
|
|
150
|
+
measuredExtra: 'medido por encima de lo calculado',
|
|
151
|
+
measuredShort: 'medido por debajo de lo calculado',
|
|
152
|
+
measuredMatch: 'calculado y medido coinciden',
|
|
153
|
+
situationAsked: 'la situación, contestada',
|
|
154
|
+
situationPriority: 'qué espera prefiere pagar el equipo',
|
|
155
|
+
situationMissing: 'preguntas que cambiarían este informe',
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Signals named by what each one is, with what it was about: "import cycles, duplicate copies of a
|
|
160
|
+
* package (`lodash`)". A signal that went away has no card left to take its chip from.
|
|
161
|
+
*/
|
|
162
|
+
const signalList = (lang, list) => list.map(item => `${exports.KIND_NAMES[lang][item.kind]}${item.key ? ` (${(0, finding_html_1.mono)(item.key)})` : ''}`).join(', ');
|
|
163
|
+
exports.signalList = signalList;
|
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.buildDepsFindings = void 0;
|
|
15
|
-
const
|
|
16
|
-
const finding_html_1 = require("
|
|
17
|
-
const finding_text_1 = require("
|
|
18
|
-
|
|
15
|
+
const actions_1 = require("../actions");
|
|
16
|
+
const finding_html_1 = require("../text/finding-html");
|
|
17
|
+
const finding_text_1 = require("../text/finding-text");
|
|
18
|
+
/**
|
|
19
|
+
* @param scale how the raw weights of packages are said in the report's unit: `unitScale` of the
|
|
20
|
+
* analysis. Raw by default.
|
|
21
|
+
*/
|
|
22
|
+
const buildDepsFindings = (deps, lang, c, scale = actions_1.RAW_SCALE) => {
|
|
23
|
+
const sized = (bytes) => (0, actions_1.formatSaving)(bytes, scale);
|
|
19
24
|
const text = finding_text_1.TEXT[lang];
|
|
20
25
|
const findings = [];
|
|
21
26
|
// 1 · The advisories that actually ship. Everything else is real and is not what a browser
|
|
@@ -35,7 +40,7 @@ const buildDepsFindings = (deps, lang, c) => {
|
|
|
35
40
|
inBoot: inBoot.length,
|
|
36
41
|
worst: first.package,
|
|
37
42
|
list: shipped
|
|
38
|
-
.map(advisory => `${(0, finding_html_1.mono)(advisory.package)} ${advisory.severity}${advisory.inBoot ? ', bootstrap' : ''} (${(
|
|
43
|
+
.map(advisory => `${(0, finding_html_1.mono)(advisory.package)} ${advisory.severity}${advisory.inBoot ? ', bootstrap' : ''} (${sized(advisory.bytes)}) — ${advisory.title}`)
|
|
39
44
|
.join(' · '),
|
|
40
45
|
elsewhere: deps.notShipped.map(advisory => (0, finding_html_1.mono)(advisory.package)).join(', '),
|
|
41
46
|
}),
|
|
@@ -52,11 +57,11 @@ const buildDepsFindings = (deps, lang, c) => {
|
|
|
52
57
|
kind: 'transitive',
|
|
53
58
|
...text.transitive({
|
|
54
59
|
count: transitive.length,
|
|
55
|
-
size: (
|
|
60
|
+
size: sized(bytes),
|
|
56
61
|
worst: heaviest.name,
|
|
57
|
-
worstSize: (
|
|
62
|
+
worstSize: sized(heaviest.bytes),
|
|
58
63
|
list: transitive
|
|
59
|
-
.map(entry => `${(0, finding_html_1.mono)(entry.name)} (${(
|
|
64
|
+
.map(entry => `${(0, finding_html_1.mono)(entry.name)} (${sized(entry.bytes)}${entry.inBoot ? ', bootstrap' : ''})${entry.chain.length > 0 ? ` — via ${entry.chain.join(' › ')}` : ''}`)
|
|
60
65
|
.join(' · '),
|
|
61
66
|
}),
|
|
62
67
|
});
|