Skip to content

Commit

Permalink
chore: bump node to v22.11.0 (main) (electron#44530)
Browse files Browse the repository at this point in the history
* chore: bump node in DEPS to v22.11.0

* src: move evp stuff to ncrypto

nodejs/node#54911

* crypto: add Date fields for validTo and validFrom

nodejs/node#54159

* module: fix discrepancy between .ts and .js

nodejs/node#54461

* esm: do not interpret "main" as a URL

nodejs/node#55003

* src: modernize likely/unlikely hints

nodejs/node#55155

* chore: update patch indices

* crypto: add validFromDate and validToDate fields to X509Certificate

nodejs/node#54159

* chore: fixup perfetto patch

* fix: clang warning in simdjson

* src: add receiver to fast api callback methods

nodejs/node#54408

* chore: fixup revert patch

* fixup! esm: do not interpret "main" as a URL

* fixup! crypto: add Date fields for validTo and validFrom

* fix: move ArrayBuffer test patch

* src: fixup Error.stackTraceLimit during snapshot building

nodejs/node#55121

* fix: bad rebase

* chore: fixup amaro

* chore: address feedback from review

* src: revert filesystem::path changes

nodejs/node#55015

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
2 people authored and soobinrho committed Jan 22, 2025
1 parent 5aabb6b commit 8c4d83f
Show file tree
Hide file tree
Showing 34 changed files with 364 additions and 556 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ vars = {
'chromium_version':
'133.0.6920.0',
'node_version':
'v22.9.0',
'v22.11.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':
Expand Down
14 changes: 7 additions & 7 deletions lib/node/asar-fs-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,9 +871,9 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
const binding = internalBinding('fs');

const { internalModuleStat } = binding;
internalBinding('fs').internalModuleStat = (pathArgument: string) => {
internalBinding('fs').internalModuleStat = (receiver: unknown, pathArgument: string) => {
const pathInfo = splitPath(pathArgument);
if (!pathInfo.isAsar) return internalModuleStat(pathArgument);
if (!pathInfo.isAsar) return internalModuleStat(receiver, pathArgument);
const { asarPath, filePath } = pathInfo;

// -ENOENT
Expand Down Expand Up @@ -908,7 +908,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
if (withFileTypes) {
initialItem = [
[...initialItem], initialItem.map((p: string) => {
return internalBinding('fs').internalModuleStat(path.join(originalPath, p));
return internalBinding('fs').internalModuleStat(binding, path.join(originalPath, p));
})
];
}
Expand Down Expand Up @@ -941,7 +941,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {

readdirResult = [
[...files], files.map((p: string) => {
return internalBinding('fs').internalModuleStat(path.join(direntPath, p));
return internalBinding('fs').internalModuleStat(binding, path.join(direntPath, p));
})
];
} else {
Expand All @@ -962,7 +962,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
const { 0: pathArg, 1: readDir } = queue.pop();
for (const ent of readDir) {
const direntPath = path.join(pathArg, ent);
const stat = internalBinding('fs').internalModuleStat(direntPath);
const stat = internalBinding('fs').internalModuleStat(binding, direntPath);
result.push(path.relative(originalPath, direntPath));

if (stat === 1) {
Expand Down Expand Up @@ -1014,7 +1014,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
if (withFileTypes) {
readdirResult = [
[...readdirResult], readdirResult.map((p: string) => {
return internalBinding('fs').internalModuleStat(path.join(pathArg, p));
return internalBinding('fs').internalModuleStat(binding, path.join(pathArg, p));
})
];
}
Expand Down Expand Up @@ -1054,7 +1054,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
for (let i = 0; i < readdirResult.length; i++) {
const resultPath = path.join(pathArg, readdirResult[i]);
const relativeResultPath = path.relative(basePath, resultPath);
const stat = internalBinding('fs').internalModuleStat(resultPath);
const stat = internalBinding('fs').internalModuleStat(binding, resultPath);

readdirResults.push(relativeResultPath);
if (stat === 1) pathsQueue.push(resultPath);
Expand Down
2 changes: 1 addition & 1 deletion patches/chromium/printing.patch
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ index 402be34ab888cdf834d0fb65de0832e9a8021ced..82ddc92a35d824926c30279e660cc4e8

#if BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/printing/printer_query_oop.cc b/chrome/browser/printing/printer_query_oop.cc
index e271d17b3261c47f3dbeaf9be0b3c4229ee27181..00b906660580aca7d5aabcde54d68c2161ea71dd 100644
index e271d17b3261c47f3dbeaf9be0b3c4229ee27181..ed19764250d9125915f0f948896acd7eae7911a6 100644
--- a/chrome/browser/printing/printer_query_oop.cc
+++ b/chrome/browser/printing/printer_query_oop.cc
@@ -127,7 +127,7 @@ void PrinterQueryOop::OnDidAskUserForSettings(
Expand Down
86 changes: 63 additions & 23 deletions patches/node/build_add_gn_build_files.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ however those files were cherry-picked from main branch and do not
really in 20/21. We have to wait until 22 is released to be able to
build with upstream GN files.

diff --git a/deps/simdjson/unofficial.gni b/deps/simdjson/unofficial.gni
index d6909b95886f4de3f0b953c2a2992f69066b7434..972955f9144aafcd3a3fe278b7aaad401cadddda 100644
--- a/deps/simdjson/unofficial.gni
+++ b/deps/simdjson/unofficial.gni
@@ -18,5 +18,6 @@ template("simdjson_gn_build") {
forward_variables_from(invoker, "*")
public_configs = [ ":simdjson_config" ]
sources = gypi_values.simdjson_sources
+ cflags_c = [ "-Wdeprecated-literal-operator" ]
}
}
diff --git a/deps/sqlite/unofficial.gni b/deps/sqlite/unofficial.gni
index ebb3ffcd6d42b4c16b6865a91ccf4428cffe864b..00225afa1fb4205f1e02d9f185aeb97d642b3fd9 100644
--- a/deps/sqlite/unofficial.gni
Expand All @@ -31,7 +42,7 @@ index ebb3ffcd6d42b4c16b6865a91ccf4428cffe864b..00225afa1fb4205f1e02d9f185aeb97d
"-Wno-unused-but-set-variable",
"-Wno-unused-function",
diff --git a/node.gni b/node.gni
index 9dca810decebd75aab427e306b3cc37c80fb55c9..32709b860ccb12d8d1e75342a65dda0b86129b21 100644
index 9dca810decebd75aab427e306b3cc37c80fb55c9..852f64fa9cfb50fe6e9ce7aa46be336d3196d5b8 100644
--- a/node.gni
+++ b/node.gni
@@ -5,10 +5,10 @@
Expand All @@ -56,20 +67,29 @@ index 9dca810decebd75aab427e306b3cc37c80fb55c9..32709b860ccb12d8d1e75342a65dda0b

# Custom build tag.
node_tag = ""
@@ -58,7 +58,7 @@ declare_args() {
@@ -58,7 +58,16 @@ declare_args() {
# TODO(zcbenz): There are few broken things for now:
# 1. cross-os compilation is not supported.
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
- node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64")
+ node_use_node_snapshot = false
+
+ # Build with Amaro (TypeScript utils).
+ node_use_amaro = true
+
+ # Allows downstream packagers (eg. Linux distributions) to build against system shared libraries.
+ use_system_cares = false
+ use_system_nghttp2 = false
+ use_system_llhttp = false
+ use_system_histogram = false
}

assert(!node_enable_inspector || node_use_openssl,
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
index 2bc7155f7c075e5a22ece7159a64a1c9ba3d8ac9..48d29a0d05538cd1d992f3f086d826e78d0d8882 100644
index 1bec44f6f29b0b652e92d2bb336fdb74b85eee30..599b59873dbb17ae5e7463403859e088ffb86cda 100644
--- a/src/node_builtins.cc
+++ b/src/node_builtins.cc
@@ -775,6 +775,7 @@ void BuiltinLoader::RegisterExternalReferences(
@@ -778,6 +778,7 @@ void BuiltinLoader::RegisterExternalReferences(
registry->Register(GetNatives);

RegisterExternalReferencesForInternalizedBuiltinCode(registry);
Expand All @@ -91,7 +111,7 @@ index 1cb85b9058d06555382e565dc32192a9fa48ed9f..cec9be01abd107e8612f70daf19b4834
// Handles compilation and caching of built-in JavaScript modules and
// bootstrap scripts, whose source are bundled into the binary as static data.
diff --git a/tools/generate_config_gypi.py b/tools/generate_config_gypi.py
index 45b3ac5006140fb55aad0e6b78084b753a947a76..8667857107e4f2481fd98032d4333b086fb7b479 100755
index 45b3ac5006140fb55aad0e6b78084b753a947a76..35cce2ea8fd85f21582962115ac455918d4c4553 100755
--- a/tools/generate_config_gypi.py
+++ b/tools/generate_config_gypi.py
@@ -21,7 +21,7 @@ import getnapibuildversion
Expand All @@ -103,6 +123,14 @@ index 45b3ac5006140fb55aad0e6b78084b753a947a76..8667857107e4f2481fd98032d4333b08
else:
GN = 'gn'

@@ -65,6 +65,7 @@ def translate_config(out_dir, config, v8_config):
eval(config['node_builtin_shareable_builtins']),
'node_module_version': int(config['node_module_version']),
'node_use_openssl': config['node_use_openssl'],
+ 'node_use_amaro': config['node_use_amaro'],
'node_use_node_code_cache': config['node_use_node_code_cache'],
'node_use_node_snapshot': config['node_use_node_snapshot'],
'v8_enable_inspector': # this is actually a node misnomer
diff --git a/tools/install.py b/tools/install.py
index bf54249b66c0d4e179deaae5a9fd55568e694fe0..31b94d2e4b532d3b8202b512e2d2f41d29a2a546 100755
--- a/tools/install.py
Expand All @@ -118,26 +146,26 @@ index bf54249b66c0d4e179deaae5a9fd55568e694fe0..31b94d2e4b532d3b8202b512e2d2f41d
diff --git a/tools/js2c.cc b/tools/js2c.cc
old mode 100644
new mode 100755
index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd786f64bb
index 21992cbe894a880e3223c379326b62db22f2f12d..1296a5457422099035ba34f2b02624f2e9dfb0f0
--- a/tools/js2c.cc
+++ b/tools/js2c.cc
@@ -30,6 +30,7 @@ namespace js2c {
@@ -28,6 +28,7 @@ namespace js2c {
int Main(int argc, char* argv[]);

static bool is_verbose = false;
+static bool only_js = false;

void Debug(const char* format, ...) {
va_list arguments;
@@ -196,6 +197,7 @@ const char* kTemplate = R"(
@@ -175,6 +176,7 @@ const char* kTemplate = R"(
#include "node_builtins.h"
#include "node_external_reference.h"
#include "node_internals.h"
+#include "node_threadsafe_cow-inl.h"

namespace node {

@@ -211,7 +213,11 @@ const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
@@ -190,7 +192,11 @@ const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
} // anonymous namespace

void BuiltinLoader::LoadJavaScriptSource() {
Expand All @@ -150,7 +178,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
}

void RegisterExternalReferencesForInternalizedBuiltinCode(
@@ -228,6 +234,45 @@ UnionBytes BuiltinLoader::GetConfig() {
@@ -207,6 +213,45 @@ UnionBytes BuiltinLoader::GetConfig() {
} // namespace node
)";

Expand Down Expand Up @@ -196,7 +224,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
Fragment Format(const Fragments& definitions,
const Fragments& initializers,
const Fragments& registrations) {
@@ -237,13 +282,12 @@ Fragment Format(const Fragments& definitions,
@@ -216,13 +261,12 @@ Fragment Format(const Fragments& definitions,
size_t init_size = init_buf.size();
std::vector<char> reg_buf = Join(registrations, "\n");
size_t reg_size = reg_buf.size();
Expand All @@ -213,7 +241,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
static_cast<int>(def_buf.size()),
def_buf.data(),
static_cast<int>(init_buf.size()),
@@ -834,12 +878,15 @@ int JS2C(const FileList& js_files,
@@ -846,12 +890,15 @@ int JS2C(const FileList& js_files,
}
}

Expand All @@ -229,7 +257,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
Fragment out = Format(definitions, initializers, registrations);
return WriteIfChanged(out, dest);
}
@@ -865,6 +912,8 @@ int Main(int argc, char* argv[]) {
@@ -877,6 +924,8 @@ int Main(int argc, char* argv[]) {
std::string arg(argv[i]);
if (arg == "--verbose") {
is_verbose = true;
Expand All @@ -238,7 +266,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
} else if (arg == "--root") {
if (i == argc - 1) {
fprintf(stderr, "--root must be followed by a path\n");
@@ -913,6 +962,14 @@ int Main(int argc, char* argv[]) {
@@ -925,6 +974,14 @@ int Main(int argc, char* argv[]) {
}
}

Expand All @@ -253,7 +281,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
// Should have exactly 3 types: `.js`, `.mjs` and `.gypi`.
assert(file_map.size() == 3);
auto gypi_it = file_map.find(".gypi");
@@ -939,6 +996,7 @@ int Main(int argc, char* argv[]) {
@@ -951,6 +1008,7 @@ int Main(int argc, char* argv[]) {
std::sort(mjs_it->second.begin(), mjs_it->second.end());

return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output);
Expand All @@ -274,26 +302,38 @@ index 65d0e1be42f0a85418491ebb548278cf431aa6a0..d4a31342f1c6107b029394c6e1d00a1d
except Exception as e:
print(str(e))
diff --git a/unofficial.gni b/unofficial.gni
index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1fa351a9d9 100644
index c3b311e4a7f5444b07d4d7028d4621806959804e..f6793b8bf22d6ac911a1977edaa881b6dbbe7ac7 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -139,6 +139,7 @@ template("node_gn_build") {
@@ -22,6 +22,11 @@ template("node_gn_build") {
} else {
defines += [ "HAVE_OPENSSL=0" ]
}
+ if (node_use_amaro) {
+ defines += [ "HAVE_AMARO=1" ]
+ } else {
+ defines += [ "HAVE_AMARO=0" ]
+ }
if (node_use_v8_platform) {
defines += [ "NODE_USE_V8_PLATFORM=1" ]
} else {
@@ -139,6 +144,7 @@ template("node_gn_build") {
public_deps = [
"deps/ada",
"deps/uv",
+ "//electron:electron_js2c",
"deps/simdjson",
"$node_v8_path",
]
@@ -150,7 +151,6 @@ template("node_gn_build") {
@@ -150,7 +156,6 @@ template("node_gn_build") {
"deps/llhttp",
"deps/nbytes",
"deps/nghttp2",
- "deps/ngtcp2",
"deps/postject",
"deps/simdutf",
"deps/sqlite",
@@ -159,7 +159,11 @@ template("node_gn_build") {
@@ -159,7 +164,11 @@ template("node_gn_build") {
"$node_v8_path:v8_libplatform",
]

Expand All @@ -305,7 +345,7 @@ index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1f
"$target_gen_dir/node_javascript.cc",
] + gypi_values.node_sources

@@ -178,8 +182,10 @@ template("node_gn_build") {
@@ -178,8 +187,10 @@ template("node_gn_build") {
deps += [ "//third_party/icu" ]
}
if (node_use_openssl) {
Expand All @@ -318,15 +358,15 @@ index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1f
sources += gypi_values.node_crypto_sources
}
if (node_enable_inspector) {
@@ -276,6 +282,7 @@ template("node_gn_build") {
@@ -276,6 +287,7 @@ template("node_gn_build") {
}

executable("node_js2c") {
+ defines = []
deps = [
"deps/simdutf",
"deps/uv",
@@ -286,26 +293,75 @@ template("node_gn_build") {
@@ -286,26 +298,75 @@ template("node_gn_build") {
"src/embedded_data.cc",
"src/embedded_data.h",
]
Expand Down Expand Up @@ -412,7 +452,7 @@ index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1f
outputs = [ "$target_gen_dir/node_javascript.cc" ]

# Get the path to node_js2c executable of the host toolchain.
@@ -319,11 +375,11 @@ template("node_gn_build") {
@@ -319,11 +380,11 @@ template("node_gn_build") {
get_label_info(":node_js2c($host_toolchain)", "name") +
host_executable_suffix

Expand Down
25 changes: 4 additions & 21 deletions patches/node/build_allow_unbundling_of_node_js_dependencies.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,19 @@ We don't need to do this for zlib, as the existing gn workflow uses the same

Upstreamed at https://github.com/nodejs/node/pull/55903

diff --git a/node.gni b/node.gni
index 18d58591e3d0f1f3512db00033c3410a65702864..99ec540ec41ddf5682eed7618ba87d6935b3b982 100644
--- a/node.gni
+++ b/node.gni
@@ -61,6 +61,12 @@ declare_args() {
# 1. cross-os compilation is not supported.
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
node_use_node_snapshot = false
+
+ # Allows downstream packagers (eg. Linux distributions) to build against system shared libraries.
+ use_system_cares = false
+ use_system_nghttp2 = false
+ use_system_llhttp = false
+ use_system_histogram = false
}

assert(!node_enable_inspector || node_use_openssl,
diff --git a/unofficial.gni b/unofficial.gni
index 3d8b7957e791ce2fa2a8d0937a87b6010087803d..c23922a301a721662ff34bf6e54fd26b41f25ccc 100644
index ddfbb97276b29df114ab455a2eed3b186b3af5d2..87bfc313dd1408e597e929ba93c8c0f52ae39ced 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -147,7 +147,6 @@ template("node_gn_build") {
@@ -152,7 +152,6 @@ template("node_gn_build") {
":run_node_js2c",
"deps/cares",
"deps/histogram",
- "deps/llhttp",
"deps/nbytes",
"deps/nghttp2",
"deps/postject",
@@ -178,7 +177,17 @@ template("node_gn_build") {
@@ -183,7 +182,17 @@ template("node_gn_build") {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
Expand All @@ -61,7 +44,7 @@ index 3d8b7957e791ce2fa2a8d0937a87b6010087803d..c23922a301a721662ff34bf6e54fd26b
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
}
@@ -205,6 +214,19 @@ template("node_gn_build") {
@@ -210,6 +219,19 @@ template("node_gn_build") {
sources += node_inspector.node_inspector_sources +
node_inspector.node_inspector_generated_sources
}
Expand Down
2 changes: 1 addition & 1 deletion patches/node/build_compile_with_c_20_support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8
This can be removed when Electron upgrades to a version of Node.js containing the required V8 version.

diff --git a/common.gypi b/common.gypi
index 74616453e2e047acbb9e25f2f93ebeab06011669..bce15fc4a8b3f2fa0b5a588e6a2b28d2b8b6ac45 100644
index 34aaf439936c874bd4c8b7d4ffd69477abb40193..69d10c17ef3c5b0ce6173d1754a975df589d9b61 100644
--- a/common.gypi
+++ b/common.gypi
@@ -518,7 +518,7 @@
Expand Down
Loading

0 comments on commit 8c4d83f

Please sign in to comment.