## Node.js Patch Update to v24.9.0
This PR updates the Node.js patch to version 24.9.0.
The workflow automatically attempts to resolve patch conflicts using AI
when the OpenAI API key is available.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
### Problem
The macOS x64 build was timing out when using `macos-14` runners with
`MAKE_JOB_COUNT=2`, likely due to cross-compilation overhead.
### Solution
- Changed `runs-on` from `macos-14` to `macos-15-intel` to use native
Intel hardware
- Increased `MAKE_JOB_COUNT` from `2` to `4` to utilize all 4 CPU cores
available on Intel runners
### Result
Resolves build timeout issues for macOS x64 builds by eliminating
cross-compilation and maximising CPU utilization.
Tested Build:
https://github.com/nrranjithnr/pkg-fetch/actions/runs/17977769583
This PR adds Node24 support
**Node/V8 changes:**
- Move to new V8 syntax for some constructs (e.g. Cast<>)
- Tracked down two issues which caused the read-only snapshot to be
different across platforms:
- in `read-only-serializer:258` the "live" pointer gets overwritten by
the encoded slot (EncodedTagged).
If V8_COMPRESS_POINTERS is not enabled, EncodedTagged is 4 bytes, but
the live pointer is 8 bytes.
memcpy() only copies EncodeTagged leaving 4bytes of "garbage" (=previous
upper pointer half) which is semi-random per run - fixed this by
clearing the whole value first
- the CSA_HOLE_SECURITY_CHECK macro somehow leaves a string with a
platform-dependent filename in the readonly heap as a constant, replaced
that with "placeholder"
- add PKG_TRACE_READONLY_HEAP blocks for debugging further snapshot
issues
Those fixes partially fix the sourceless cross-build issues introduced
in Node 22 - For my test builds linux/linuxstatic/alpine/win on x64 are
now compatible again. The heap contents on macos builds and other arm64
is wildly different, not sure why. I don't think this kind of
compatibility is a goal for the V8 snapshot implementation in general.
(This affects Node SEA as well, but SEA always has the source to fall
back onto, which incurs a small performance hit)
**Build Changes:**
- Update linux/linuxcross build to use gcc 12 (required for Node 24)
- For aloine/linuxstatic: Node 24 doesn't build on the muslcc image used
previously, the image is unmaintained (although the toolchain builder
isn't, we could build our own image)
- Moved alpine/linuxstatic to native Alpine x64/arm64 toolchains, which
seems to work quite well
- Some minor upgrades to the Windows build, but had to enable `full-icu`
for now because the ICU code gen step crashes with `small-icu` on the GH
action build runners (not on my Windows test machine though)
- Moved the macos build to macos 14 which is now required for Node 24 -
x64 is now cross-built from arm64 because GH doesn't offer free macos14
x64 build workers
- Removed all builds for Node 18 and older
-
**Notes:**
- Needs more testing, I did some basic testing for x64 builds as well as
macos/arm64
- I added a backport of the snapshot-determinism fixes to the latest
Node 22 patch
## Node.js Patch Update to v20.19.5
This PR updates the Node.js patch to version 20.19.5.
The workflow automatically attempts to resolve patch conflicts using AI
when the OpenAI API key is available.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
## Node.js Patch Update to v22.19.0
This PR updates the Node.js patch to version 22.19.0.
The workflow automatically attempts to resolve patch conflicts using AI
when the OpenAI API key is available.
### AI Resolution Details
Processing section 1/1 for ./lib/internal/modules/cjs/loader.js...
Found 1 reject files to process
Processing: ./lib/internal/modules/cjs/loader.js.rej ->
./lib/internal/modules/cjs/loader.js
Prompt for OpenAI API:
I have a Git patch that failed to apply. Here's the specific section
that needs to be fixed:
REJECTED PATCH HUNK:
```
@@ -250,12 +250,16 @@
// Guard against internal bugs where a non-string filename is passed in by mistake.
assert(typeof filename === 'string');
+ const origFilename = filename;
filename = path.toNamespacedPath(filename);
if (statCache !== null) {
const result = statCache.get(filename);
if (result !== undefined) { return result; }
}
- const result = internalFsBinding.internalModuleStat(internalFsBinding, filename);
+ const fs = require('fs');
+ const result = fs.existsSync(origFilename) ?
+ (fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
+
if (statCache !== null && result >= 0) {
// Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
statCache.set(filename, result);
```
CURRENT FILE SECTION (lines 245-266):
```
}
/**
* Get a path's properties, using an in-memory cache to minimize lookups.
* @param {string} filename Absolute path to the file
*/
function stat(filename) {
// Guard against internal bugs where a non-string filename is passed in by mistake.
assert(typeof filename === 'string');
filename = path.toNamespacedPath(filename);
if (statCache !== null) {
const result = statCache.get(filename);
if (result !== undefined) { return result; }
}
const result = internalFsBinding.internalModuleStat(filename);
if (statCache !== null && result >= 0) {
// Only set cache when `internalModuleStat(filename)` succeeds.
statCache.set(filename, result);
}
return result;
}
```
Please apply the intended changes from the rejected hunk to this file
section. Return ONLY the corrected file section content, preserving the
exact line structure and formatting. Do not add explanations or markdown
formatting.
RESOLVED CONTENT for ./lib/internal/modules/cjs/loader.js:
```
}
/**
* Get a path's properties, using an in-memory cache to minimize lookups.
* @param {string} filename Absolute path to the file
*/
function stat(filename) {
// Guard against internal bugs where a non-string filename is passed in by mistake.
assert(typeof filename === 'string');
const origFilename = filename;
filename = path.toNamespacedPath(filename);
if (statCache !== null) {
const result = statCache.get(filename);
if (result !== undefined) { return result; }
}
const fs = require('fs');
const result = fs.existsSync(origFilename) ?
(fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
if (statCache !== null && result >= 0) {
// Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
statCache.set(filename, result);
}
return result;
}
```
✅ Successfully resolved ./lib/internal/modules/cjs/loader.js
CONFLICTS_RESOLVED=1
TOTAL_CONFLICTS=1
HAS_UNRESOLVED=False
Resolution summary: 1/1 conflicts resolved
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>