@hominis/fireforge 0.16.1 → 0.16.3

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 (39) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +9 -2
  3. package/dist/bin/fireforge.js +11 -2
  4. package/dist/src/commands/doctor-furnace.js +83 -1
  5. package/dist/src/commands/doctor.js +18 -0
  6. package/dist/src/commands/download.js +16 -1
  7. package/dist/src/commands/furnace/chrome-doc-templates.d.ts +21 -3
  8. package/dist/src/commands/furnace/chrome-doc-templates.js +23 -5
  9. package/dist/src/commands/furnace/chrome-doc-tests.js +42 -17
  10. package/dist/src/commands/furnace/create-templates.d.ts +17 -7
  11. package/dist/src/commands/furnace/create-templates.js +85 -31
  12. package/dist/src/commands/furnace/create-xpcshell.d.ts +1 -1
  13. package/dist/src/commands/furnace/create-xpcshell.js +1 -1
  14. package/dist/src/commands/import.js +63 -11
  15. package/dist/src/commands/patch/delete.js +10 -1
  16. package/dist/src/commands/setup-support.js +60 -7
  17. package/dist/src/commands/status.js +28 -1
  18. package/dist/src/commands/test.js +20 -4
  19. package/dist/src/commands/token.js +7 -1
  20. package/dist/src/commands/wire.js +14 -1
  21. package/dist/src/core/branding.d.ts +10 -0
  22. package/dist/src/core/branding.js +7 -9
  23. package/dist/src/core/build-prepare.js +8 -1
  24. package/dist/src/core/config-mutate.js +23 -1
  25. package/dist/src/core/file-lock.js +49 -15
  26. package/dist/src/core/furnace-operation.d.ts +17 -0
  27. package/dist/src/core/furnace-operation.js +30 -1
  28. package/dist/src/core/furnace-validate-helpers.d.ts +33 -1
  29. package/dist/src/core/furnace-validate-helpers.js +53 -2
  30. package/dist/src/core/git.js +39 -10
  31. package/dist/src/core/manifest-rules.js +16 -0
  32. package/dist/src/core/marionette-preflight.js +43 -12
  33. package/dist/src/core/patch-files.d.ts +12 -1
  34. package/dist/src/core/patch-files.js +14 -11
  35. package/dist/src/core/patch-lint.js +62 -11
  36. package/dist/src/core/patch-parse.d.ts +18 -7
  37. package/dist/src/core/patch-parse.js +24 -2
  38. package/dist/src/core/patch-transform.js +4 -1
  39. package/package.json +1 -1
@@ -104,14 +104,36 @@ export function parseHunksForFile(patchContent, targetFile) {
104
104
  newStart: parseInt(hunkMatch[3] ?? '0', 10),
105
105
  newCount: parseInt(hunkMatch[4] ?? '1', 10),
106
106
  lines: [],
107
- noNewlineAtEnd: false,
107
+ noNewlineAtEndOld: false,
108
+ noNewlineAtEndNew: false,
108
109
  };
109
110
  continue;
110
111
  }
111
112
  // Collect hunk lines
112
113
  if (currentHunk) {
113
114
  if (line === '\') {
114
- currentHunk.noNewlineAtEnd = true;
115
+ // The marker is an annotation on the immediately preceding body
116
+ // line. Peek the last collected line to decide which side(s) the
117
+ // annotation applies to — a single boolean cannot represent the
118
+ // asymmetric case where only one side lacks the trailing newline.
119
+ const previous = currentHunk.lines[currentHunk.lines.length - 1] ?? '';
120
+ if (previous.startsWith('-')) {
121
+ currentHunk.noNewlineAtEndOld = true;
122
+ }
123
+ else if (previous.startsWith('+')) {
124
+ currentHunk.noNewlineAtEndNew = true;
125
+ }
126
+ else if (previous.startsWith(' ')) {
127
+ // Context line: present in both sides, so the trailing-newline
128
+ // absence applies to both. This is rare (it only happens when
129
+ // the hunk ends on an unchanged line that itself is the last
130
+ // line of the file) but real — git emits it.
131
+ currentHunk.noNewlineAtEndOld = true;
132
+ currentHunk.noNewlineAtEndNew = true;
133
+ }
134
+ // If the marker appears with no preceding body line (malformed
135
+ // diff), leave both flags false — the downstream apply logic
136
+ // will still produce a defined result.
115
137
  }
116
138
  else if (line.startsWith('+') || line.startsWith('-') || line.startsWith(' ')) {
117
139
  currentHunk.lines.push(line);
@@ -105,7 +105,10 @@ export async function applyPatchToContent(content, patchPath, targetFile) {
105
105
  const sortedHunks = [...hunks].sort((a, b) => b.oldStart - a.oldStart);
106
106
  // The "no newline at end" marker applies to the last hunk in file order
107
107
  // (highest oldStart), which is the *first* hunk in our reverse-sorted array.
108
- const lastHunkNoNewline = sortedHunks[0]?.noNewlineAtEnd ?? false;
108
+ // We read the new-side flag because the output we produce corresponds to
109
+ // the new side; asymmetric diffs (old lacks newline, new has one — or
110
+ // vice versa) would otherwise disagree with `git apply`.
111
+ const lastHunkNoNewline = sortedHunks[0]?.noNewlineAtEndNew ?? false;
109
112
  for (const hunk of sortedHunks) {
110
113
  const newLines = [];
111
114
  // Compute actual old-line count from hunk body for cross-check
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hominis/fireforge",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "FireForge — a build tool for customizing Firefox",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",