Skip to content

Commit 7c977ce

Browse files
committed
Merge branch 'main' of https://github.com/yao-pkg/pkg-fetch
2 parents 45e2576 + 4361e3e commit 7c977ce

2 files changed

Lines changed: 119 additions & 23 deletions

File tree

Lines changed: 118 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) {
@@ -428,11 +431,104 @@ index ae71080620..b05638de75 100644
428431
} catch (e) {
429432
throw e; /* node-do-not-add-exception-line */
430433
}
434+
diff --git node/resolution_output.txt node/resolution_output.txt
435+
new file mode 100644
436+
index 0000000000..0e4b95bd5c
437+
--- /dev/null
438+
+++ node/resolution_output.txt
439+
@@ -0,0 +1,87 @@
440+
+Processing section 1/1 for ./lib/internal/modules/cjs/loader.js...
441+
+Found 1 reject files to process
442+
+Processing: ./lib/internal/modules/cjs/loader.js.rej -> ./lib/internal/modules/cjs/loader.js
443+
+Prompt for OpenAI API:
444+
+I have a Git patch that failed to apply. Here's the specific section that needs to be fixed:
445+
+
446+
+REJECTED PATCH HUNK:
447+
+```
448+
+@@ -250,12 +250,16 @@
449+
+ // Guard against internal bugs where a non-string filename is passed in by mistake.
450+
+ assert(typeof filename === 'string');
451+
+
452+
++ const origFilename = filename;
453+
+ filename = path.toNamespacedPath(filename);
454+
+ if (statCache !== null) {
455+
+ const result = statCache.get(filename);
456+
+ if (result !== undefined) { return result; }
457+
+ }
458+
+- const result = internalFsBinding.internalModuleStat(internalFsBinding, filename);
459+
++ const fs = require('fs');
460+
++ const result = fs.existsSync(origFilename) ?
461+
++ (fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
462+
++
463+
+ if (statCache !== null && result >= 0) {
464+
+ // Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
465+
+ statCache.set(filename, result);
466+
+```
467+
+
468+
+CURRENT FILE SECTION (lines 245-266):
469+
+```
470+
+}
471+
+
472+
+/**
473+
+ * Get a path's properties, using an in-memory cache to minimize lookups.
474+
+ * @param {string} filename Absolute path to the file
475+
+ */
476+
+function stat(filename) {
477+
+ // Guard against internal bugs where a non-string filename is passed in by mistake.
478+
+ assert(typeof filename === 'string');
479+
+
480+
+ filename = path.toNamespacedPath(filename);
481+
+ if (statCache !== null) {
482+
+ const result = statCache.get(filename);
483+
+ if (result !== undefined) { return result; }
484+
+ }
485+
+ const result = internalFsBinding.internalModuleStat(filename);
486+
+ if (statCache !== null && result >= 0) {
487+
+ // Only set cache when `internalModuleStat(filename)` succeeds.
488+
+ statCache.set(filename, result);
489+
+ }
490+
+ return result;
491+
+}
492+
+```
493+
+
494+
+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.
495+
+Resolved content for ./lib/internal/modules/cjs/loader.js:
496+
+}
497+
+
498+
+/**
499+
+ * Get a path's properties, using an in-memory cache to minimize lookups.
500+
+ * @param {string} filename Absolute path to the file
501+
+ */
502+
+function stat(filename) {
503+
+ // Guard against internal bugs where a non-string filename is passed in by mistake.
504+
+ assert(typeof filename === 'string');
505+
+
506+
+ const origFilename = filename;
507+
+ filename = path.toNamespacedPath(filename);
508+
+ if (statCache !== null) {
509+
+ const result = statCache.get(filename);
510+
+ if (result !== undefined) { return result; }
511+
+ }
512+
+ const fs = require('fs');
513+
+ const result = fs.existsSync(origFilename) ?
514+
+ (fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
515+
+
516+
+ if (statCache !== null && result >= 0) {
517+
+ // Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
518+
+ statCache.set(filename, result);
519+
+ }
520+
+ return result;
521+
+}
522+
+✅ Successfully resolved ./lib/internal/modules/cjs/loader.js
523+
+CONFLICTS_RESOLVED=1
524+
+TOTAL_CONFLICTS=1
525+
+HAS_UNRESOLVED=False
526+
+Resolution summary: 1/1 conflicts resolved
431527
diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
432-
index fa6eb29e6e..5d6dd23f6a 100644
528+
index aca49fddce..ddc54909ea 100644
433529
--- node/src/inspector_agent.cc
434530
+++ node/src/inspector_agent.cc
435-
@@ -819,11 +819,6 @@ bool Agent::Start(const std::string& path,
531+
@@ -832,11 +832,6 @@ bool Agent::Start(const std::string& path,
436532
StartIoThreadAsyncCallback));
437533
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
438534
start_io_thread_async.data = this;
@@ -445,7 +541,7 @@ index fa6eb29e6e..5d6dd23f6a 100644
445541
parent_env_->AddCleanupHook([](void* data) {
446542
Environment* env = static_cast<Environment*>(data);
447543
diff --git node/src/node.cc node/src/node.cc
448-
index c0d0b734ed..58583892f9 100644
544+
index 1b5e989e54..20f49ba2f2 100644
449545
--- node/src/node.cc
450546
+++ node/src/node.cc
451547
@@ -404,6 +404,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
@@ -473,7 +569,7 @@ index c0d0b734ed..58583892f9 100644
473569
}
474570

475571
diff --git node/src/node_contextify.cc node/src/node_contextify.cc
476-
index 7bfe42c593..836d98d6ed 100644
572+
index 386102dfe7..fa452538bf 100644
477573
--- node/src/node_contextify.cc
478574
+++ node/src/node_contextify.cc
479575
@@ -86,6 +86,7 @@ using v8::Symbol;
@@ -484,7 +580,7 @@ index 7bfe42c593..836d98d6ed 100644
484580

485581
// The vm module executes code in a sandboxed environment with a different
486582
// 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) {
583+
@@ -993,13 +994,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
488584
Local<ArrayBufferView> cached_data_buf;
489585
bool produce_cached_data = false;
490586
Local<Context> parsing_context = context;
@@ -501,7 +597,7 @@ index 7bfe42c593..836d98d6ed 100644
501597
CHECK(args[2]->IsNumber());
502598
line_offset = args[2].As<Int32>()->Value();
503599
CHECK(args[3]->IsNumber());
504-
@@ -1021,6 +1022,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
600+
@@ -1020,6 +1021,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
505601
}
506602
CHECK(args[7]->IsSymbol());
507603
id_symbol = args[7].As<Symbol>();
@@ -512,7 +608,7 @@ index 7bfe42c593..836d98d6ed 100644
512608
}
513609

514610
ContextifyScript* contextify_script =
515-
@@ -1068,6 +1073,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
611+
@@ -1067,6 +1072,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
516612
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
517613
Context::Scope scope(parsing_context);
518614

@@ -523,7 +619,7 @@ index 7bfe42c593..836d98d6ed 100644
523619
MaybeLocal<UnboundScript> maybe_v8_script =
524620
ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
525621

526-
@@ -1082,6 +1091,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
622+
@@ -1081,6 +1090,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
527623
return;
528624
}
529625

@@ -536,7 +632,7 @@ index 7bfe42c593..836d98d6ed 100644
536632
contextify_script->script_.Reset(isolate, v8_script);
537633
contextify_script->script_.SetWeak();
538634
contextify_script->object()->SetInternalField(kUnboundScriptSlot, v8_script);
539-
@@ -1121,6 +1136,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
635+
@@ -1120,6 +1135,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
540636
.IsNothing())
541637
return;
542638

@@ -658,7 +754,7 @@ index f66099a557..4048f6bd93 100644
658754
+ return adjacent(c, nargv);
659755
+}
660756
diff --git node/src/node_options.cc node/src/node_options.cc
661-
index da39abf79c..7f97afe7dc 100644
757+
index 249361e351..ef61e29dfb 100644
662758
--- node/src/node_options.cc
663759
+++ node/src/node_options.cc
664760
@@ -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)