Skip to content

Commit 03677a1

Browse files
feat: add v22.19.0 patch (#106)
## 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>
1 parent 7898d82 commit 03677a1

2 files changed

Lines changed: 26 additions & 23 deletions

File tree

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git node/common.gypi node/common.gypi
2-
index b88371ec13..343352b5c4 100644
2+
index 7780ae106b..584d3756ee 100644
33
--- node/common.gypi
44
+++ node/common.gypi
5-
@@ -191,7 +191,7 @@
5+
@@ -192,7 +192,7 @@
66
['clang==1', {
77
'lto': ' -flto ', # Clang
88
}, {
@@ -247,10 +247,10 @@ index ec69ad5123..1894032344 100644
247247
GetHeaderValue(kReadOnlySnapshotChecksumOffset);
248248
if (ro_snapshot_checksum != expected_ro_snapshot_checksum) {
249249
diff --git node/lib/child_process.js node/lib/child_process.js
250-
index e848b3d5ee..3e3ad3ec7c 100644
250+
index 655349b6fa..77092e0cd5 100644
251251
--- node/lib/child_process.js
252252
+++ node/lib/child_process.js
253-
@@ -169,7 +169,7 @@ function fork(modulePath, args = [], options) {
253+
@@ -171,7 +171,7 @@ function fork(modulePath, args = [], options) {
254254
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
255255
}
256256

@@ -315,10 +315,10 @@ index 0000000000..a697294fdf
315315
+ }());
316316
+}());
317317
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
318-
index d90476addb..8c87fa9019 100644
318+
index a7d8fa1139..bffe5a8a53 100644
319319
--- node/lib/internal/modules/cjs/loader.js
320320
+++ node/lib/internal/modules/cjs/loader.js
321-
@@ -250,12 +250,16 @@ function stat(filename) {
321+
@@ -252,14 +252,18 @@ function stat(filename) {
322322
// Guard against internal bugs where a non-string filename is passed in by mistake.
323323
assert(typeof filename === 'string');
324324

@@ -328,19 +328,22 @@ index d90476addb..8c87fa9019 100644
328328
const result = statCache.get(filename);
329329
if (result !== undefined) { return result; }
330330
}
331-
- const result = internalFsBinding.internalModuleStat(internalFsBinding, filename);
331+
- const result = internalFsBinding.internalModuleStat(filename);
332332
+ const fs = require('fs');
333333
+ const result = fs.existsSync(origFilename) ?
334334
+ (fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
335335
+
336336
if (statCache !== null && result >= 0) {
337-
// Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
337+
- // Only set cache when `internalModuleStat(filename)` succeeds.
338+
+ // Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
338339
statCache.set(filename, result);
340+
}
341+
return result;
339342
diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
340-
index df23a30b1b..4a414c469c 100644
343+
index fb669ea12e..6ad993581b 100644
341344
--- node/lib/internal/modules/package_json_reader.js
342345
+++ node/lib/internal/modules/package_json_reader.js
343-
@@ -105,17 +105,20 @@ const requiresJSONParse = (value) => (value !== undefined && (value[0] === '[' |
346+
@@ -108,17 +108,20 @@ const requiresJSONParse = (value) => (value !== undefined && (value[0] === '[' |
344347
* @returns {PackageConfig}
345348
*/
346349
function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
@@ -373,7 +376,7 @@ index df23a30b1b..4a414c469c 100644
373376
__proto__: null,
374377
...result.data,
375378
diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
376-
index 4e7be0594c..09efa7b745 100644
379+
index 98ed40e307..f9da878ea0 100644
377380
--- node/lib/internal/process/pre_execution.js
378381
+++ node/lib/internal/process/pre_execution.js
379382
@@ -50,7 +50,11 @@ const {
@@ -398,7 +401,7 @@ index 4e7be0594c..09efa7b745 100644
398401
// Expand process.argv[1] into a full path.
399402
const path = require('path');
400403
try {
401-
@@ -735,6 +740,7 @@ function loadPreloadModules() {
404+
@@ -725,6 +730,7 @@ function loadPreloadModules() {
402405
// For user code, we preload modules if `-r` is passed
403406
const preloadModules = getOptionValue('--require');
404407
if (preloadModules && preloadModules.length > 0) {
@@ -429,10 +432,10 @@ index ae71080620..b05638de75 100644
429432
throw e; /* node-do-not-add-exception-line */
430433
}
431434
diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
432-
index fa6eb29e6e..5d6dd23f6a 100644
435+
index aca49fddce..ddc54909ea 100644
433436
--- node/src/inspector_agent.cc
434437
+++ node/src/inspector_agent.cc
435-
@@ -819,11 +819,6 @@ bool Agent::Start(const std::string& path,
438+
@@ -832,11 +832,6 @@ bool Agent::Start(const std::string& path,
436439
StartIoThreadAsyncCallback));
437440
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
438441
start_io_thread_async.data = this;
@@ -445,7 +448,7 @@ index fa6eb29e6e..5d6dd23f6a 100644
445448
parent_env_->AddCleanupHook([](void* data) {
446449
Environment* env = static_cast<Environment*>(data);
447450
diff --git node/src/node.cc node/src/node.cc
448-
index c0d0b734ed..58583892f9 100644
451+
index 1b5e989e54..20f49ba2f2 100644
449452
--- node/src/node.cc
450453
+++ node/src/node.cc
451454
@@ -404,6 +404,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
@@ -473,7 +476,7 @@ index c0d0b734ed..58583892f9 100644
473476
}
474477

475478
diff --git node/src/node_contextify.cc node/src/node_contextify.cc
476-
index 7bfe42c593..836d98d6ed 100644
479+
index 386102dfe7..fa452538bf 100644
477480
--- node/src/node_contextify.cc
478481
+++ node/src/node_contextify.cc
479482
@@ -86,6 +86,7 @@ using v8::Symbol;
@@ -484,7 +487,7 @@ index 7bfe42c593..836d98d6ed 100644
484487

485488
// The vm module executes code in a sandboxed environment with a different
486489
// global object than the rest of the code. This is achieved by applying
487-
@@ -994,13 +995,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
490+
@@ -993,13 +994,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
488491
Local<ArrayBufferView> cached_data_buf;
489492
bool produce_cached_data = false;
490493
Local<Context> parsing_context = context;
@@ -501,7 +504,7 @@ index 7bfe42c593..836d98d6ed 100644
501504
CHECK(args[2]->IsNumber());
502505
line_offset = args[2].As<Int32>()->Value();
503506
CHECK(args[3]->IsNumber());
504-
@@ -1021,6 +1022,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
507+
@@ -1020,6 +1021,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
505508
}
506509
CHECK(args[7]->IsSymbol());
507510
id_symbol = args[7].As<Symbol>();
@@ -512,7 +515,7 @@ index 7bfe42c593..836d98d6ed 100644
512515
}
513516

514517
ContextifyScript* contextify_script =
515-
@@ -1068,6 +1073,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
518+
@@ -1067,6 +1072,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
516519
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
517520
Context::Scope scope(parsing_context);
518521

@@ -523,7 +526,7 @@ index 7bfe42c593..836d98d6ed 100644
523526
MaybeLocal<UnboundScript> maybe_v8_script =
524527
ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
525528

526-
@@ -1082,6 +1091,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
529+
@@ -1081,6 +1090,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
527530
return;
528531
}
529532

@@ -536,7 +539,7 @@ index 7bfe42c593..836d98d6ed 100644
536539
contextify_script->script_.Reset(isolate, v8_script);
537540
contextify_script->script_.SetWeak();
538541
contextify_script->object()->SetInternalField(kUnboundScriptSlot, v8_script);
539-
@@ -1121,6 +1136,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
542+
@@ -1120,6 +1135,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
540543
.IsNothing())
541544
return;
542545

@@ -658,7 +661,7 @@ index f66099a557..4048f6bd93 100644
658661
+ return adjacent(c, nargv);
659662
+}
660663
diff --git node/src/node_options.cc node/src/node_options.cc
661-
index da39abf79c..7f97afe7dc 100644
664+
index 249361e351..ef61e29dfb 100644
662665
--- node/src/node_options.cc
663666
+++ node/src/node_options.cc
664667
@@ -319,6 +319,7 @@ void Parse(

patches/patches.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"v22.17.1": ["node.v22.17.1.cpp.patch"],
2+
"v22.19.0": ["node.v22.19.0.cpp.patch"],
33
"v20.19.4": ["node.v20.19.4.cpp.patch"],
44
"v18.20.8": ["node.v18.20.8.cpp.patch"],
55
"v16.20.2": ["node.v16.20.2.cpp.patch"],

0 commit comments

Comments
 (0)