diff --git a/patches/node.v14.21.1.cpp.patch b/patches/node.v14.21.2.cpp.patch similarity index 100% rename from patches/node.v14.21.1.cpp.patch rename to patches/node.v14.21.2.cpp.patch diff --git a/patches/node.v16.18.1.cpp.patch b/patches/node.v16.19.0.cpp.patch similarity index 97% rename from patches/node.v16.18.1.cpp.patch rename to patches/node.v16.19.0.cpp.patch index ac5d815..fac0096 100644 --- a/patches/node.v16.18.1.cpp.patch +++ b/patches/node.v16.19.0.cpp.patch @@ -1,6 +1,6 @@ --- node/common.gypi +++ node/common.gypi -@@ -183,7 +183,7 @@ +@@ -179,7 +179,7 @@ 'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD) }], ['llvm_version=="0.0"', { @@ -257,7 +257,7 @@ index 0000000000..fb2d47f52b } --- node/src/inspector_agent.cc +++ node/src/inspector_agent.cc -@@ -690,8 +690,6 @@ bool Agent::Start(const std::string& path, +@@ -693,8 +693,6 @@ bool Agent::Start(const std::string& path, StartIoThreadAsyncCallback)); uv_unref(reinterpret_cast(&start_io_thread_async)); start_io_thread_async.data = this; @@ -277,7 +277,7 @@ index 0000000000..fb2d47f52b if (env->worker_context() != nullptr) { return StartExecution(env, "internal/main/worker_thread"); } -@@ -599,13 +601,6 @@ static struct { +@@ -603,13 +605,6 @@ static struct { inline void PlatformInit() { #ifdef __POSIX__ @@ -291,7 +291,7 @@ index 0000000000..fb2d47f52b // Make sure file descriptors 0-2 are valid before we start logging anything. for (auto& s : stdio) { const int fd = &s - stdio; -@@ -621,10 +616,6 @@ inline void PlatformInit() { +@@ -625,10 +620,6 @@ inline void PlatformInit() { ABORT(); } @@ -312,7 +312,7 @@ index 0000000000..fb2d47f52b using v8::Value; using v8::WeakCallbackInfo; using v8::WeakCallbackType; -@@ -711,11 +712,12 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -715,11 +716,12 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { Local cached_data_buf; bool produce_cached_data = false; Local parsing_context = context; @@ -326,7 +326,7 @@ index 0000000000..fb2d47f52b CHECK(args[2]->IsNumber()); line_offset = args[2].As()->Value(); CHECK(args[3]->IsNumber()); -@@ -734,6 +736,7 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -738,6 +740,7 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { CHECK_NOT_NULL(sandbox); parsing_context = sandbox->context(); } @@ -334,7 +334,7 @@ index 0000000000..fb2d47f52b } ContextifyScript* contextify_script = -@@ -785,6 +788,10 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -789,6 +792,10 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { ShouldNotAbortOnUncaughtScope no_abort_scope(env); Context::Scope scope(parsing_context); @@ -345,7 +345,7 @@ index 0000000000..fb2d47f52b MaybeLocal v8_script = ScriptCompiler::CompileUnboundScript( isolate, &source, -@@ -799,6 +806,13 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -803,6 +810,13 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { "ContextifyScript::New"); return; } @@ -359,7 +359,7 @@ index 0000000000..fb2d47f52b contextify_script->script_.Reset(isolate, v8_script.ToLocalChecked()); Local env_context = env->context(); -@@ -825,6 +839,11 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -829,6 +843,11 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { env->cached_data_produced_string(), Boolean::New(isolate, cached_data_produced)).Check(); } @@ -482,7 +482,7 @@ index 0000000000..fb2d47f52b +} --- node/src/node_options.cc +++ node/src/node_options.cc -@@ -275,6 +275,7 @@ void Parse( +@@ -299,6 +299,7 @@ void Parse( // TODO(addaleax): Make that unnecessary. DebugOptionsParser::DebugOptionsParser() { diff --git a/patches/node.v18.12.1.cpp.patch b/patches/node.v18.13.0.cpp.patch similarity index 92% rename from patches/node.v18.12.1.cpp.patch rename to patches/node.v18.13.0.cpp.patch index bfdb1ed..b694e9d 100644 --- a/patches/node.v18.12.1.cpp.patch +++ b/patches/node.v18.13.0.cpp.patch @@ -140,7 +140,7 @@ if (payload_length > max_payload_length) { --- node/lib/child_process.js +++ node/lib/child_process.js -@@ -164,7 +164,7 @@ function fork(modulePath, args = [], options) { +@@ -167,7 +167,7 @@ function fork(modulePath, args = [], options) { throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio'); } @@ -149,7 +149,6 @@ } function _forkChild(fd, serializationMode) { -index 00000000000..fb2d47f52b6 --- /dev/null +++ node/lib/internal/bootstrap/pkg.js @@ -0,0 +1,44 @@ @@ -197,43 +196,9 @@ index 00000000000..fb2d47f52b6 + } + }()); +}()); ---- node/lib/internal/process/pre_execution.js -+++ node/lib/internal/process/pre_execution.js -@@ -33,8 +33,13 @@ const { - isBuildingSnapshot, - } = require('v8').startupSnapshot; - -+let _alreadyPrepared = false; -+ - function prepareMainThreadExecution(expandArgv1 = false, - initialzeModules = true) { -+ if (_alreadyPrepared === true) return; -+ _alreadyPrepared = true; -+ - refreshRuntimeOptions(); - - // TODO(joyeecheung): this is also necessary for workers when they deserialize -@@ -128,7 +133,8 @@ function patchProcessObject(expandArgv1) { - process.argv[0] = process.execPath; - - if (expandArgv1 && process.argv[1] && -- !StringPrototypeStartsWith(process.argv[1], '-')) { -+ !StringPrototypeStartsWith(process.argv[1], '-') && -+ process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') { - // Expand process.argv[1] into a full path. - const path = require('path'); - try { -@@ -589,6 +595,7 @@ function loadPreloadModules() { - // For user code, we preload modules if `-r` is passed - const preloadModules = getOptionValue('--require'); - if (preloadModules && preloadModules.length > 0) { -+ assert(false, '--require is not supported'); - const { - Module: { - _preloadModules --- node/lib/internal/modules/cjs/loader.js +++ node/lib/internal/modules/cjs/loader.js -@@ -92,7 +92,7 @@ const fs = require('fs'); +@@ -94,7 +94,7 @@ const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); const { sep } = path; @@ -253,6 +218,39 @@ index 00000000000..fb2d47f52b6 const { pathToFileURL } = require('url'); const { toNamespacedPath } = require('path'); +--- node/lib/internal/process/pre_execution.js ++++ node/lib/internal/process/pre_execution.js +@@ -32,7 +32,12 @@ const { + isBuildingSnapshot, + } = require('v8').startupSnapshot; + ++let _alreadyPrepared = false; ++ + function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) { ++ if (_alreadyPrepared === true) return; ++ _alreadyPrepared = true; ++ + prepareExecution({ + expandArgv1, + initializeModules, +@@ -150,7 +155,8 @@ function patchProcessObject(expandArgv1) { + process.argv[0] = process.execPath; + + if (expandArgv1 && process.argv[1] && +- !StringPrototypeStartsWith(process.argv[1], '-')) { ++ !StringPrototypeStartsWith(process.argv[1], '-') && ++ process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') { + // Expand process.argv[1] into a full path. + const path = require('path'); + try { +@@ -613,6 +619,7 @@ function loadPreloadModules() { + // For user code, we preload modules if `-r` is passed + const preloadModules = getOptionValue('--require'); + if (preloadModules && preloadModules.length > 0) { ++ assert(false, '--require is not supported'); + const { + Module: { + _preloadModules --- node/lib/vm.js +++ node/lib/vm.js @@ -79,6 +79,7 @@ class Script extends ContextifyScript { @@ -275,7 +273,7 @@ index 00000000000..fb2d47f52b6 } --- node/src/inspector_agent.cc +++ node/src/inspector_agent.cc -@@ -693,8 +693,6 @@ bool Agent::Start(const std::string& path, +@@ -692,8 +692,6 @@ bool Agent::Start(const std::string& path, StartIoThreadAsyncCallback)); uv_unref(reinterpret_cast(&start_io_thread_async)); start_io_thread_async.data = this; @@ -286,7 +284,7 @@ index 00000000000..fb2d47f52b6 Environment* env = static_cast(data); --- node/src/node.cc +++ node/src/node.cc -@@ -458,6 +458,8 @@ MaybeLocal StartExecution(Environment* env, StartExecutionCallback cb) { +@@ -312,6 +312,8 @@ MaybeLocal StartExecution(Environment* env, StartExecutionCallback cb) { return env->RunSnapshotDeserializeMain(); } @@ -295,7 +293,7 @@ index 00000000000..fb2d47f52b6 if (env->worker_context() != nullptr) { return StartExecution(env, "internal/main/worker_thread"); } -@@ -628,14 +630,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) { +@@ -503,14 +505,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) { } if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) { @@ -312,7 +310,7 @@ index 00000000000..fb2d47f52b6 --- node/src/node_contextify.cc +++ node/src/node_contextify.cc -@@ -74,6 +74,7 @@ using v8::ScriptOrModule; +@@ -73,6 +73,7 @@ using v8::ScriptOrigin; using v8::String; using v8::Uint32; using v8::UnboundScript; @@ -320,7 +318,7 @@ index 00000000000..fb2d47f52b6 using v8::Value; using v8::WeakCallbackInfo; using v8::WeakCallbackType; -@@ -741,11 +742,12 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -769,11 +770,12 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { Local cached_data_buf; bool produce_cached_data = false; Local parsing_context = context; @@ -334,7 +332,7 @@ index 00000000000..fb2d47f52b6 CHECK(args[2]->IsNumber()); line_offset = args[2].As()->Value(); CHECK(args[3]->IsNumber()); -@@ -764,6 +766,7 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -792,6 +794,7 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { CHECK_NOT_NULL(sandbox); parsing_context = sandbox->context(); } @@ -342,7 +340,7 @@ index 00000000000..fb2d47f52b6 } ContextifyScript* contextify_script = -@@ -814,6 +817,10 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { +@@ -842,6 +845,10 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { ShouldNotAbortOnUncaughtScope no_abort_scope(env); Context::Scope scope(parsing_context); @@ -350,10 +348,10 @@ index 00000000000..fb2d47f52b6 + V8::EnableCompilationForSourcelessUse(); + } + - MaybeLocal v8_script = ScriptCompiler::CompileUnboundScript( - isolate, - &source, -@@ -828,6 +835,13 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { + MaybeLocal maybe_v8_script = + ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options); + +@@ -855,6 +862,13 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { "ContextifyScript::New"); return; } @@ -364,14 +362,13 @@ index 00000000000..fb2d47f52b6 + } + } + - contextify_script->script_.Reset(isolate, v8_script.ToLocalChecked()); + contextify_script->script_.Reset(isolate, v8_script); Local env_context = env->context(); -@@ -854,6 +868,11 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { - env->cached_data_produced_string(), - Boolean::New(isolate, cached_data_produced)).Check(); - } -+ +@@ -888,6 +902,10 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { + v8_script->GetSourceMappingURL()) + .Check(); + + if (sourceless && produce_cached_data) { + V8::DisableCompilationForSourcelessUse(); + } @@ -489,7 +486,7 @@ index 00000000000..fb2d47f52b6 +} --- node/src/node_options.cc +++ node/src/node_options.cc -@@ -299,6 +299,7 @@ void Parse( +@@ -301,6 +301,7 @@ void Parse( // TODO(addaleax): Make that unnecessary. DebugOptionsParser::DebugOptionsParser() { diff --git a/patches/patches.json b/patches/patches.json index 5cd314f..ce8dd21 100644 --- a/patches/patches.json +++ b/patches/patches.json @@ -1,7 +1,7 @@ { - "v18.12.1": ["node.v18.12.1.cpp.patch"], - "v16.18.1": ["node.v16.18.1.cpp.patch"], - "v14.21.1": ["node.v14.21.1.cpp.patch"], + "v18.13.0": ["node.v18.13.0.cpp.patch"], + "v16.19.0": ["node.v16.19.0.cpp.patch"], + "v14.21.2": ["node.v14.21.2.cpp.patch"], "v12.22.11": ["node.v12.22.11.cpp.patch"], "v10.24.1": ["node.v10.24.1.cpp.patch"], "v8.17.0": ["node.v8.17.0.cpp.patch"]