Skip to content

Commit 8c4d83f

Browse files
electron-roller[bot]codebytere
authored andcommitted
chore: bump node to v22.11.0 (main) (electron#44530)
* 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 <[email protected]>
1 parent 5aabb6b commit 8c4d83f

File tree

34 files changed

+364
-556
lines changed

34 files changed

+364
-556
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ vars = {
44
'chromium_version':
55
'133.0.6920.0',
66
'node_version':
7-
'v22.9.0',
7+
'v22.11.0',
88
'nan_version':
99
'e14bdcd1f72d62bca1d541b66da43130384ec213',
1010
'squirrel.mac_version':

lib/node/asar-fs-wrapper.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -871,9 +871,9 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
871871
const binding = internalBinding('fs');
872872

873873
const { internalModuleStat } = binding;
874-
internalBinding('fs').internalModuleStat = (pathArgument: string) => {
874+
internalBinding('fs').internalModuleStat = (receiver: unknown, pathArgument: string) => {
875875
const pathInfo = splitPath(pathArgument);
876-
if (!pathInfo.isAsar) return internalModuleStat(pathArgument);
876+
if (!pathInfo.isAsar) return internalModuleStat(receiver, pathArgument);
877877
const { asarPath, filePath } = pathInfo;
878878

879879
// -ENOENT
@@ -908,7 +908,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
908908
if (withFileTypes) {
909909
initialItem = [
910910
[...initialItem], initialItem.map((p: string) => {
911-
return internalBinding('fs').internalModuleStat(path.join(originalPath, p));
911+
return internalBinding('fs').internalModuleStat(binding, path.join(originalPath, p));
912912
})
913913
];
914914
}
@@ -941,7 +941,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
941941

942942
readdirResult = [
943943
[...files], files.map((p: string) => {
944-
return internalBinding('fs').internalModuleStat(path.join(direntPath, p));
944+
return internalBinding('fs').internalModuleStat(binding, path.join(direntPath, p));
945945
})
946946
];
947947
} else {
@@ -962,7 +962,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
962962
const { 0: pathArg, 1: readDir } = queue.pop();
963963
for (const ent of readDir) {
964964
const direntPath = path.join(pathArg, ent);
965-
const stat = internalBinding('fs').internalModuleStat(direntPath);
965+
const stat = internalBinding('fs').internalModuleStat(binding, direntPath);
966966
result.push(path.relative(originalPath, direntPath));
967967

968968
if (stat === 1) {
@@ -1014,7 +1014,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
10141014
if (withFileTypes) {
10151015
readdirResult = [
10161016
[...readdirResult], readdirResult.map((p: string) => {
1017-
return internalBinding('fs').internalModuleStat(path.join(pathArg, p));
1017+
return internalBinding('fs').internalModuleStat(binding, path.join(pathArg, p));
10181018
})
10191019
];
10201020
}
@@ -1054,7 +1054,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
10541054
for (let i = 0; i < readdirResult.length; i++) {
10551055
const resultPath = path.join(pathArg, readdirResult[i]);
10561056
const relativeResultPath = path.relative(basePath, resultPath);
1057-
const stat = internalBinding('fs').internalModuleStat(resultPath);
1057+
const stat = internalBinding('fs').internalModuleStat(binding, resultPath);
10581058

10591059
readdirResults.push(relativeResultPath);
10601060
if (stat === 1) pathsQueue.push(resultPath);

patches/chromium/printing.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ index 402be34ab888cdf834d0fb65de0832e9a8021ced..82ddc92a35d824926c30279e660cc4e8
605605

606606
#if BUILDFLAG(IS_CHROMEOS)
607607
diff --git a/chrome/browser/printing/printer_query_oop.cc b/chrome/browser/printing/printer_query_oop.cc
608-
index e271d17b3261c47f3dbeaf9be0b3c4229ee27181..00b906660580aca7d5aabcde54d68c2161ea71dd 100644
608+
index e271d17b3261c47f3dbeaf9be0b3c4229ee27181..ed19764250d9125915f0f948896acd7eae7911a6 100644
609609
--- a/chrome/browser/printing/printer_query_oop.cc
610610
+++ b/chrome/browser/printing/printer_query_oop.cc
611611
@@ -127,7 +127,7 @@ void PrinterQueryOop::OnDidAskUserForSettings(

patches/node/build_add_gn_build_files.patch

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ however those files were cherry-picked from main branch and do not
1010
really in 20/21. We have to wait until 22 is released to be able to
1111
build with upstream GN files.
1212

13+
diff --git a/deps/simdjson/unofficial.gni b/deps/simdjson/unofficial.gni
14+
index d6909b95886f4de3f0b953c2a2992f69066b7434..972955f9144aafcd3a3fe278b7aaad401cadddda 100644
15+
--- a/deps/simdjson/unofficial.gni
16+
+++ b/deps/simdjson/unofficial.gni
17+
@@ -18,5 +18,6 @@ template("simdjson_gn_build") {
18+
forward_variables_from(invoker, "*")
19+
public_configs = [ ":simdjson_config" ]
20+
sources = gypi_values.simdjson_sources
21+
+ cflags_c = [ "-Wdeprecated-literal-operator" ]
22+
}
23+
}
1324
diff --git a/deps/sqlite/unofficial.gni b/deps/sqlite/unofficial.gni
1425
index ebb3ffcd6d42b4c16b6865a91ccf4428cffe864b..00225afa1fb4205f1e02d9f185aeb97d642b3fd9 100644
1526
--- a/deps/sqlite/unofficial.gni
@@ -31,7 +42,7 @@ index ebb3ffcd6d42b4c16b6865a91ccf4428cffe864b..00225afa1fb4205f1e02d9f185aeb97d
3142
"-Wno-unused-but-set-variable",
3243
"-Wno-unused-function",
3344
diff --git a/node.gni b/node.gni
34-
index 9dca810decebd75aab427e306b3cc37c80fb55c9..32709b860ccb12d8d1e75342a65dda0b86129b21 100644
45+
index 9dca810decebd75aab427e306b3cc37c80fb55c9..852f64fa9cfb50fe6e9ce7aa46be336d3196d5b8 100644
3546
--- a/node.gni
3647
+++ b/node.gni
3748
@@ -5,10 +5,10 @@
@@ -56,20 +67,29 @@ index 9dca810decebd75aab427e306b3cc37c80fb55c9..32709b860ccb12d8d1e75342a65dda0b
5667

5768
# Custom build tag.
5869
node_tag = ""
59-
@@ -58,7 +58,7 @@ declare_args() {
70+
@@ -58,7 +58,16 @@ declare_args() {
6071
# TODO(zcbenz): There are few broken things for now:
6172
# 1. cross-os compilation is not supported.
6273
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
6374
- node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64")
6475
+ node_use_node_snapshot = false
76+
+
77+
+ # Build with Amaro (TypeScript utils).
78+
+ node_use_amaro = true
79+
+
80+
+ # Allows downstream packagers (eg. Linux distributions) to build against system shared libraries.
81+
+ use_system_cares = false
82+
+ use_system_nghttp2 = false
83+
+ use_system_llhttp = false
84+
+ use_system_histogram = false
6585
}
6686

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

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

126+
@@ -65,6 +65,7 @@ def translate_config(out_dir, config, v8_config):
127+
eval(config['node_builtin_shareable_builtins']),
128+
'node_module_version': int(config['node_module_version']),
129+
'node_use_openssl': config['node_use_openssl'],
130+
+ 'node_use_amaro': config['node_use_amaro'],
131+
'node_use_node_code_cache': config['node_use_node_code_cache'],
132+
'node_use_node_snapshot': config['node_use_node_snapshot'],
133+
'v8_enable_inspector': # this is actually a node misnomer
106134
diff --git a/tools/install.py b/tools/install.py
107135
index bf54249b66c0d4e179deaae5a9fd55568e694fe0..31b94d2e4b532d3b8202b512e2d2f41d29a2a546 100755
108136
--- a/tools/install.py
@@ -118,26 +146,26 @@ index bf54249b66c0d4e179deaae5a9fd55568e694fe0..31b94d2e4b532d3b8202b512e2d2f41d
118146
diff --git a/tools/js2c.cc b/tools/js2c.cc
119147
old mode 100644
120148
new mode 100755
121-
index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd786f64bb
149+
index 21992cbe894a880e3223c379326b62db22f2f12d..1296a5457422099035ba34f2b02624f2e9dfb0f0
122150
--- a/tools/js2c.cc
123151
+++ b/tools/js2c.cc
124-
@@ -30,6 +30,7 @@ namespace js2c {
152+
@@ -28,6 +28,7 @@ namespace js2c {
125153
int Main(int argc, char* argv[]);
126154

127155
static bool is_verbose = false;
128156
+static bool only_js = false;
129157

130158
void Debug(const char* format, ...) {
131159
va_list arguments;
132-
@@ -196,6 +197,7 @@ const char* kTemplate = R"(
160+
@@ -175,6 +176,7 @@ const char* kTemplate = R"(
133161
#include "node_builtins.h"
134162
#include "node_external_reference.h"
135163
#include "node_internals.h"
136164
+#include "node_threadsafe_cow-inl.h"
137165

138166
namespace node {
139167

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

143171
void BuiltinLoader::LoadJavaScriptSource() {
@@ -150,7 +178,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
150178
}
151179

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

@@ -196,7 +224,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
196224
Fragment Format(const Fragments& definitions,
197225
const Fragments& initializers,
198226
const Fragments& registrations) {
199-
@@ -237,13 +282,12 @@ Fragment Format(const Fragments& definitions,
227+
@@ -216,13 +261,12 @@ Fragment Format(const Fragments& definitions,
200228
size_t init_size = init_buf.size();
201229
std::vector<char> reg_buf = Join(registrations, "\n");
202230
size_t reg_size = reg_buf.size();
@@ -213,7 +241,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
213241
static_cast<int>(def_buf.size()),
214242
def_buf.data(),
215243
static_cast<int>(init_buf.size()),
216-
@@ -834,12 +878,15 @@ int JS2C(const FileList& js_files,
244+
@@ -846,12 +890,15 @@ int JS2C(const FileList& js_files,
217245
}
218246
}
219247

@@ -229,7 +257,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
229257
Fragment out = Format(definitions, initializers, registrations);
230258
return WriteIfChanged(out, dest);
231259
}
232-
@@ -865,6 +912,8 @@ int Main(int argc, char* argv[]) {
260+
@@ -877,6 +924,8 @@ int Main(int argc, char* argv[]) {
233261
std::string arg(argv[i]);
234262
if (arg == "--verbose") {
235263
is_verbose = true;
@@ -238,7 +266,7 @@ index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd
238266
} else if (arg == "--root") {
239267
if (i == argc - 1) {
240268
fprintf(stderr, "--root must be followed by a path\n");
241-
@@ -913,6 +962,14 @@ int Main(int argc, char* argv[]) {
269+
@@ -925,6 +974,14 @@ int Main(int argc, char* argv[]) {
242270
}
243271
}
244272

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

259287
return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output);
@@ -274,26 +302,38 @@ index 65d0e1be42f0a85418491ebb548278cf431aa6a0..d4a31342f1c6107b029394c6e1d00a1d
274302
except Exception as e:
275303
print(str(e))
276304
diff --git a/unofficial.gni b/unofficial.gni
277-
index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1fa351a9d9 100644
305+
index c3b311e4a7f5444b07d4d7028d4621806959804e..f6793b8bf22d6ac911a1977edaa881b6dbbe7ac7 100644
278306
--- a/unofficial.gni
279307
+++ b/unofficial.gni
280-
@@ -139,6 +139,7 @@ template("node_gn_build") {
308+
@@ -22,6 +22,11 @@ template("node_gn_build") {
309+
} else {
310+
defines += [ "HAVE_OPENSSL=0" ]
311+
}
312+
+ if (node_use_amaro) {
313+
+ defines += [ "HAVE_AMARO=1" ]
314+
+ } else {
315+
+ defines += [ "HAVE_AMARO=0" ]
316+
+ }
317+
if (node_use_v8_platform) {
318+
defines += [ "NODE_USE_V8_PLATFORM=1" ]
319+
} else {
320+
@@ -139,6 +144,7 @@ template("node_gn_build") {
281321
public_deps = [
282322
"deps/ada",
283323
"deps/uv",
284324
+ "//electron:electron_js2c",
285325
"deps/simdjson",
286326
"$node_v8_path",
287327
]
288-
@@ -150,7 +151,6 @@ template("node_gn_build") {
328+
@@ -150,7 +156,6 @@ template("node_gn_build") {
289329
"deps/llhttp",
290330
"deps/nbytes",
291331
"deps/nghttp2",
292332
- "deps/ngtcp2",
293333
"deps/postject",
294334
"deps/simdutf",
295335
"deps/sqlite",
296-
@@ -159,7 +159,11 @@ template("node_gn_build") {
336+
@@ -159,7 +164,11 @@ template("node_gn_build") {
297337
"$node_v8_path:v8_libplatform",
298338
]
299339

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

308-
@@ -178,8 +182,10 @@ template("node_gn_build") {
348+
@@ -178,8 +187,10 @@ template("node_gn_build") {
309349
deps += [ "//third_party/icu" ]
310350
}
311351
if (node_use_openssl) {
@@ -318,15 +358,15 @@ index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1f
318358
sources += gypi_values.node_crypto_sources
319359
}
320360
if (node_enable_inspector) {
321-
@@ -276,6 +282,7 @@ template("node_gn_build") {
361+
@@ -276,6 +287,7 @@ template("node_gn_build") {
322362
}
323363

324364
executable("node_js2c") {
325365
+ defines = []
326366
deps = [
327367
"deps/simdutf",
328368
"deps/uv",
329-
@@ -286,26 +293,75 @@ template("node_gn_build") {
369+
@@ -286,26 +298,75 @@ template("node_gn_build") {
330370
"src/embedded_data.cc",
331371
"src/embedded_data.h",
332372
]
@@ -412,7 +452,7 @@ index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1f
412452
outputs = [ "$target_gen_dir/node_javascript.cc" ]
413453

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

patches/node/build_allow_unbundling_of_node_js_dependencies.patch

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,19 @@ We don't need to do this for zlib, as the existing gn workflow uses the same
1313

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

16-
diff --git a/node.gni b/node.gni
17-
index 18d58591e3d0f1f3512db00033c3410a65702864..99ec540ec41ddf5682eed7618ba87d6935b3b982 100644
18-
--- a/node.gni
19-
+++ b/node.gni
20-
@@ -61,6 +61,12 @@ declare_args() {
21-
# 1. cross-os compilation is not supported.
22-
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
23-
node_use_node_snapshot = false
24-
+
25-
+ # Allows downstream packagers (eg. Linux distributions) to build against system shared libraries.
26-
+ use_system_cares = false
27-
+ use_system_nghttp2 = false
28-
+ use_system_llhttp = false
29-
+ use_system_histogram = false
30-
}
31-
32-
assert(!node_enable_inspector || node_use_openssl,
3316
diff --git a/unofficial.gni b/unofficial.gni
34-
index 3d8b7957e791ce2fa2a8d0937a87b6010087803d..c23922a301a721662ff34bf6e54fd26b41f25ccc 100644
17+
index ddfbb97276b29df114ab455a2eed3b186b3af5d2..87bfc313dd1408e597e929ba93c8c0f52ae39ced 100644
3518
--- a/unofficial.gni
3619
+++ b/unofficial.gni
37-
@@ -147,7 +147,6 @@ template("node_gn_build") {
20+
@@ -152,7 +152,6 @@ template("node_gn_build") {
3821
":run_node_js2c",
3922
"deps/cares",
4023
"deps/histogram",
4124
- "deps/llhttp",
4225
"deps/nbytes",
4326
"deps/nghttp2",
4427
"deps/postject",
45-
@@ -178,7 +177,17 @@ template("node_gn_build") {
28+
@@ -183,7 +182,17 @@ template("node_gn_build") {
4629
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
4730
configs += [ "//build/config/gcc:symbol_visibility_default" ]
4831
}
@@ -61,7 +44,7 @@ index 3d8b7957e791ce2fa2a8d0937a87b6010087803d..c23922a301a721662ff34bf6e54fd26b
6144
if (v8_enable_i18n_support) {
6245
deps += [ "//third_party/icu" ]
6346
}
64-
@@ -205,6 +214,19 @@ template("node_gn_build") {
47+
@@ -210,6 +219,19 @@ template("node_gn_build") {
6548
sources += node_inspector.node_inspector_sources +
6649
node_inspector.node_inspector_generated_sources
6750
}

patches/node/build_compile_with_c_20_support.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8
1010
This can be removed when Electron upgrades to a version of Node.js containing the required V8 version.
1111

1212
diff --git a/common.gypi b/common.gypi
13-
index 74616453e2e047acbb9e25f2f93ebeab06011669..bce15fc4a8b3f2fa0b5a588e6a2b28d2b8b6ac45 100644
13+
index 34aaf439936c874bd4c8b7d4ffd69477abb40193..69d10c17ef3c5b0ce6173d1754a975df589d9b61 100644
1414
--- a/common.gypi
1515
+++ b/common.gypi
1616
@@ -518,7 +518,7 @@

0 commit comments

Comments
 (0)