@hominis/fireforge 0.46.1 → 0.46.2

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.
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.46.1",
4
- "commit": "821990fd7d076a205f37618055c0a01a95180aed",
5
- "shortCommit": "821990fd7d07",
3
+ "version": "0.46.2",
4
+ "commit": "533adc217a82c2a17735e8b38e25d8f41f8bfad8",
5
+ "shortCommit": "533adc217a82",
6
6
  "dirty": false,
7
7
  "dirtyHash": null,
8
- "buildTime": "2026-09-05T22:29:34.415Z"
8
+ "buildTime": "2026-09-05T23:00:12.026Z"
9
9
  }
@@ -22,6 +22,14 @@
22
22
  * any downstream consumer that indexes by column (or derives an
23
23
  * insertion index as a line number in the original array) still
24
24
  * agrees on line numbers.
25
+ *
26
+ * Spans are copied with `indexOf` + `slice` rather than appended one
27
+ * character at a time. The per-character form allocated a rope link per
28
+ * character of every line in `tokens.css`, which on a long line cost far
29
+ * more than the scan it feeds: blanking a 1.6 MB line took ~39 ms against
30
+ * ~0.07 ms here, and the GC that pressure provoked grew faster than the
31
+ * input did — enough to make the scanners' linearity test read as
32
+ * super-linear on a loaded runner.
25
33
  */
26
34
  export declare function stripBlockCommentsInLines(lines: string[]): string[];
27
35
  /**
@@ -41,33 +41,46 @@ function rootOpensBraceOnLine(line) {
41
41
  * any downstream consumer that indexes by column (or derives an
42
42
  * insertion index as a line number in the original array) still
43
43
  * agrees on line numbers.
44
+ *
45
+ * Spans are copied with `indexOf` + `slice` rather than appended one
46
+ * character at a time. The per-character form allocated a rope link per
47
+ * character of every line in `tokens.css`, which on a long line cost far
48
+ * more than the scan it feeds: blanking a 1.6 MB line took ~39 ms against
49
+ * ~0.07 ms here, and the GC that pressure provoked grew faster than the
50
+ * input did — enough to make the scanners' linearity test read as
51
+ * super-linear on a loaded runner.
44
52
  */
45
53
  export function stripBlockCommentsInLines(lines) {
46
54
  const out = [];
47
55
  let inBlockComment = false;
48
56
  for (const original of lines) {
57
+ // A line with no comment to enter or leave is already its own mirror.
58
+ if (!inBlockComment && !original.includes('/*')) {
59
+ out.push(original);
60
+ continue;
61
+ }
49
62
  let line = '';
50
- for (let i = 0; i < original.length; i++) {
63
+ let i = 0;
64
+ while (i < original.length) {
51
65
  if (inBlockComment) {
52
- if (original[i] === '*' && original[i + 1] === '/') {
53
- line += ' ';
54
- i += 1;
55
- inBlockComment = false;
56
- }
57
- else {
58
- line += ' ';
66
+ const end = original.indexOf('*/', i);
67
+ if (end === -1) {
68
+ line += ' '.repeat(original.length - i);
69
+ break;
59
70
  }
60
- }
61
- else if (original[i] === '/' && original[i + 1] === '*') {
62
- line += ' ';
63
- i += 1;
64
- inBlockComment = true;
71
+ line += ' '.repeat(end + 2 - i);
72
+ i = end + 2;
73
+ inBlockComment = false;
65
74
  }
66
75
  else {
67
- // `original[i]` is provably defined here (the bounds check is
68
- // the loop condition), but TS narrows it to `string | undefined`.
69
- // Default to empty string so the concat stays well-typed.
70
- line += original[i] ?? '';
76
+ const start = original.indexOf('/*', i);
77
+ if (start === -1) {
78
+ line += original.slice(i);
79
+ break;
80
+ }
81
+ line += `${original.slice(i, start)} `;
82
+ i = start + 2;
83
+ inBlockComment = true;
71
84
  }
72
85
  }
73
86
  out.push(line);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hominis/fireforge",
3
- "version": "0.46.1",
3
+ "version": "0.46.2",
4
4
  "description": "FireForge — a build tool for customizing Firefox",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",