@vernikr/size-report 2.7.0 → 2.8.1

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/src/page/build.js CHANGED
@@ -24,8 +24,10 @@ export function esc(s) {
24
24
  *
25
25
  * The chapters follow the page's subjects, and the order of pasting (the list below) is the order of declarations in
26
26
  * the assembled program: the calculation first, then the choice's state, the nodes, the panel, the table and the
27
- * assembling. The chapters are **slices of one text**: pasting glues them in a row, so the assembled page would stay
28
- * the same if the chapters became one file again. */
27
+ * assembling. A chapter that is gone leaves the page with one subject fewer rather than with a hole: the stripe over
28
+ * a long drawing left with the freeze it was drawn for (`src/page/app.js` says what a switch costs now). The
29
+ * chapters are **slices of one text**: pasting glues them in a row, so the assembled page would stay the same if
30
+ * the chapters became one file again. */
29
31
  export function stripModules(src) {
30
32
  return src.split('\n')
31
33
  .filter((line) => !/^import\s.*;\s*$/.test(line))
@@ -43,7 +45,7 @@ export function pageSource(file) {
43
45
  /* The list of chapters lives here rather than in the tests: one copy for the builder and for the guard
44
46
  * (`test/page-view.test.js` reads the same program and compares it with the sources). The payload chapter comes
45
47
  * first of the page's own: it is what turns the block into the data everything else reads. */
46
- export const PAGE_PARTS = ['./payload.js', './state.js', './dom.js', './work.js', './panel.js', './table.js', './app.js'];
48
+ export const PAGE_PARTS = ['./payload.js', './state.js', './dom.js', './panel.js', './table.js', './app.js'];
47
49
 
48
50
  /* The form the artifact carries: the same stripping the `min` metric counts (`src/strip.js`) — comments out,
49
51
  * indentation and blank lines out — applied to what is pasted, while the sources on disk keep everything: they are
@@ -124,11 +126,13 @@ function uiText(page, loc) {
124
126
  * one (`src/page/payload.js`, `appDecode`), so the two places it is read are the encoder here and the decoder there.
125
127
  * `test/contract-data.test.js` holds the round trip between them.
126
128
  *
127
- * What the block leaves out besides the sparse form is the list of skipped commits: it changes with the report's own
128
- * commit (one with nothing to say lands in the list), and the file would stop being a **fixed point** — a rebuild
129
- * after its own commit would yield different bytes and the hook would commit the report forever. The page has no use
130
- * for the list at all: it does not show it. It stays available to the reader `--data`, `--json` and `explain`
131
- * answer from the same run.
129
+ * What the block leaves out besides the sparse form are two facts the page does not read. The list of skipped commits
130
+ * changes with the report's own commit (one with nothing to say lands in the list), and the file would stop being a
131
+ * **fixed point** — a rebuild after its own commit would yield different bytes and the hook would commit the report
132
+ * forever; the page does not show it. The other is `last`, the columns the newest commit touched: the page orders the
133
+ * columns by the numbers themselves, which is a different fact (`src/page/table.js` says why), and the block would
134
+ * carry a list nothing asks for. Both stay available to the reader — `--data`, `--json` and `explain` answer from the
135
+ * same run.
132
136
  *
133
137
  * How much this is worth: the artifact of this repository carried 1 370 627 B of data as a snapshot per commit — 95 %
134
138
  * of the whole file — while nine tenths of the cells repeat the row above; the same history as changes is about 84 000
@@ -137,7 +141,7 @@ function uiText(page, loc) {
137
141
  /* The block's fields, in the order the encoder writes them. The shape is closed: a field added here has to be read in
138
142
  * the decoder, and the page's checks compare the block with this list rather than with a description of it. */
139
143
  export const PAGE_KEYS = ['schema', 'tool', 'report', 'hrefPrefix', 'strs', 'metrics', 'cats', 'files',
140
- 'catalog', 'rows', 'last', 'hist'];
144
+ 'catalog', 'rows', 'hist'];
141
145
 
142
146
  /* The texts of the block, each written once. The dictionary is extended in the order of the walk `pagePayload` makes
143
147
  * — files in the column order, rows in the history order — and the order of the first appearance is what decides an
@@ -225,10 +229,8 @@ export function pagePayload(data) {
225
229
  r.section === null ? null : dict.of(r.section.head),
226
230
  r.section !== null && r.section.added ? 1 : 0,
227
231
  r.href === null ? null : dict.of(r.href.slice(prefix.length))]),
228
- last: [],
229
232
  hist: history(keys, data.files, data.rows)
230
233
  };
231
- data.last.forEach((on, i) => { if (on) out.last.push(i); });
232
234
  return out;
233
235
  }
234
236
 
@@ -255,14 +257,9 @@ export function pageHtml(data, cfg) {
255
257
  + squeezedCss(TABLE_CSS) + '\n' + squeezedCss(PAGE_CSS) + '\n</style>\n</head>\n<body>\n'
256
258
  + '<header>\n<h1>' + esc(data.report.heading) + '</h1>\n'
257
259
  + '<p class="sub">' + esc(subText(data, loc.page)) + '</p>\n</header>\n'
258
- /* The stripe of the drawing stands first in the page and is fixed to the window's top edge rather than laid out
259
- * with the rest: the page's shape is a grid of five rows (`src/page/app.css`), and a stripe that appeared and
260
- * disappeared inside it would move the numbers under the reader's eyes every time a switch is drawn. It holds an
261
- * empty child rather than a share: the length of an indeterminate stripe is the styling's business. */
262
- + '<div id="bar" class="bar" role="progressbar" aria-label="' + esc(loc.page.working) + '" hidden><i></i></div>\n'
263
260
  + '<div id="panel" class="panel"></div>\n'
264
261
  + '<p id="notice" class="notice" hidden></p>\n'
265
- + '<div id="shell" class="shell"><table id="grid"></table></div>\n'
262
+ + '<div id="shell" class="shell"><div id="grid" class="grid"></div></div>\n'
266
263
  + '<p id="state" class="state" hidden></p>\n'
267
264
  + '<p id="note" class="note"></p>\n'
268
265
  + '<script type="application/octet-stream" id="data" data-pack="base64+gzip">'
@@ -15,7 +15,9 @@
15
15
  * moved (deltas against its own previous record) or disappeared, and this chapter puts the snapshots back
16
16
  * together. The whole history walk is O(number of changes) rather than O(rows × files).
17
17
  *
18
- * The model after `appDecode` is exactly `--data`: the calculation (`rowModel`, `totalsOf`, `cellParts`,
18
+ * The model after `appDecode` is exactly `--data` but for one field: the history's mark `last` (the columns the
19
+ * newest commit touched) is not carried, because the page orders its columns by the numbers rather than by the
20
+ * commit's list of paths (`src/page/table.js`). The calculation (`rowModel`, `totalsOf`, `cellParts`,
19
21
  * `valueParts`), the table and the panel know nothing about the sparse form, so there is no second way to
20
22
  * count a row. A value that did not move is **one object shared by the rows that hold it** — the heap keeps
21
23
  * the distinct numbers rather than a copy per commit — and because every consumer reads `v[metric]` and
@@ -149,8 +151,6 @@ function appRowOf(p, r, values) {
149
151
  export function appDecode(p) {
150
152
  const keys = p.metrics.map((m) => appText(p, m[0]));
151
153
  const hist = appUnroll(p, keys);
152
- const last = p.files.map(() => false);
153
- p.last.forEach((i) => { last[i] = true; });
154
154
  return {
155
155
  schema: p.schema,
156
156
  tool: p.tool,
@@ -162,7 +162,6 @@ export function appDecode(p) {
162
162
  paths: f[2].map((i) => p.strs[i]), category: appText(p, f[3]), categoryBy: appText(p, f[4]) })),
163
163
  catalog: p.catalog.map((e) => ({ path: appText(p, e[0]), why: appText(p, e[1]) })),
164
164
  rows: p.rows.map((r, ri) => appRowOf(p, r, hist.rows[ri])),
165
- now: hist.now,
166
- last: last
165
+ now: hist.now
167
166
  };
168
167
  }