Skip to content

Commit 62527fa

Browse files
committed
chore: upgrade Node.js to v24.10.0 (electron#48613)
* chore: upgrade Node.js to v24.10.0 * chore: fixup crypto patch * chore: fixup crypto test patch * src: prepare for v8 sandboxing nodejs/node#58376 * esm: fix module.exports export on CJS modules nodejs/node#57366 * chore: fixup lazyload fs patch * esm: Source Phase Imports for WebAssembly nodejs/node#56919 * module: remove --experimental-default-type nodejs/node#56092 * lib,src: refactor assert to load error source from memory nodejs/node#59751 * src: add source location to v8::TaskRunner nodejs/node#54077 * src: remove dependency on wrapper-descriptor-based CppHeap nodejs/node#54077 * src: do not use soon-to-be-deprecated V8 API nodejs/node#53174 * src: stop using deprecated fields of v8::FastApiCallbackOptions nodejs/node#54077 * test: update v8-stats test for V8 12.6 nodejs/node#54077 * esm: unflag --experimental-wasm-modules nodejs/node#57038 * test: adapt assert tests to stack trace changes nodejs/node#58070 * src,test: unregister the isolate after disposal and before freeing nodejs/node#58070 * src: use cppgc to manage ContextifyContext nodejs/node#56522 * src: replace uses of FastApiTypedArray nodejs/node#58070 * module: integrate TypeScript into compile cache nodejs/node#56629 * deps: update ada to 3.2.7 nodejs/node#59336 * src: make minor cleanups in encoding_binding.cc nodejs/node#57448 * src: switch from `Get/SetPrototype` to `Get/SetPrototypeV2` nodejs/node#55453 * src: use non-deprecated Get/SetPrototype methods nodejs/node#59671 * src: simplify string_bytes with views nodejs/node#54876 * src: improve utf8 string generation performance nodejs/node#54873 * src: use non-deprecated Utf8LengthV2() method nodejs/node#58070 * src: use non-deprecated WriteUtf8V2() method nodejs/node#58070 * src: refactor WriteUCS2 and remove flags argument nodejs/node#58163 * src: use String::WriteV2() in TwoByteValue nodejs/node#58164 * node-api: use WriteV2 in napi_get_value_string_utf16 nodejs/node#58165 * node-api: use WriteOneByteV2 in napi_get_value_string_latin1 nodejs/node#58325 * src: migrate WriteOneByte to WriteOneByteV2 nodejs/node#59634 * fs: introduce dirent\.parentPath nodejs/node#50976 * src: avoid copy by using std::views::keys nodejs/node#56080 * chore: fixup patch indices * fix: errant use of context->GetIsolate() * fix: tweak BoringSSL compat patch for new changes * fix: add back missing isolate dtor declaration * fixup! esm: fix module.exports export on CJS modules * cli: remove --no-experimental-fetch flag https://github.com/nodejs/node/pull/52611/files * esm: Source Phase Imports for WebAssembly nodejs/node#56919 * fixup! src: prepare for v8 sandboxing * chore: bump @types/node to v24 * chore: fix const assignment in crypto test * fix: sandbox pointer patch issues * chore: rework source phase import patch * src: add percentage support to --max-old-space-size nodejs/node#59082 * chore: fixup crypto tests * chore: HostImportModuleWithPhaseDynamically todo * fix: cjs esm failures * fix: v8::Object::Wrappable issues - v8/node@b72a615 - v8/node@490bac2 - v8/node@4896a0d * chore: remove deleted specs * src: use v8::ExternalMemoryAccounter nodejs/node#58070 * fs: port SonicBoom module to fs module as FastUtf8Stream nodejs/node#58897 * chore: tweak sandboxed pr patch * test: disable parallel/test-os-checked-function * test: use WHATWG URL instead of url.parse * fix: OPENSSL_secure_zalloc doesn't work in BoringSSL * chore: fix accidental extra line * 7017517: [defer-import-eval] Parse import defer syntax https://chromium-review.googlesource.com/c/v8/v8/+/7017517
1 parent 51e0d9d commit 62527fa

File tree

80 files changed

+2002
-4068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2002
-4068
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
'143.0.7499.0',
66
'node_version':
7-
'v22.20.0',
7+
'v24.10.0',
88
'nan_version':
99
'675cefebca42410733da8a454c8d9391fcebfbc2',
1010
'squirrel.mac_version':

lib/browser/api/net-fetch.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ export function fetchWithSession (input: RequestInfo, init: (RequestInit & {bypa
119119
p.reject(err);
120120
});
121121

122-
if (!req.body?.pipeTo(Writable.toWeb(r as unknown as Writable)).then(() => r.end())) { r.end(); }
122+
// pipeTo expects a WritableStream<Uint8Array>. Node.js' Writable.toWeb returns WritableStream<any>,
123+
// which causes a TS structural mismatch.
124+
const writable = Writable.toWeb(r as unknown as Writable) as unknown as WritableStream<Uint8Array>;
125+
if (!req.body?.pipeTo(writable).then(() => r.end())) { r.end(); }
123126

124127
return p.promise;
125128
}

lib/browser/api/protocol.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { createReadStream } from 'fs';
44
import { Readable } from 'stream';
55
import { ReadableStream } from 'stream/web';
66

7+
import type { ReadableStreamDefaultReader } from 'stream/web';
8+
79
// Global protocol APIs.
810
const { registerSchemesAsPrivileged, getStandardSchemes, Protocol } = process._linkedBinding('electron_browser_protocol');
911

@@ -12,7 +14,7 @@ const ERR_UNEXPECTED = -9;
1214

1315
const isBuiltInScheme = (scheme: string) => ['http', 'https', 'file'].includes(scheme);
1416

15-
function makeStreamFromPipe (pipe: any): ReadableStream {
17+
function makeStreamFromPipe (pipe: any): ReadableStream<Uint8Array> {
1618
const buf = new Uint8Array(1024 * 1024 /* 1 MB */);
1719
return new ReadableStream({
1820
async pull (controller) {
@@ -38,21 +40,26 @@ function makeStreamFromFileInfo ({
3840
filePath: string;
3941
offset?: number;
4042
length?: number;
41-
}): ReadableStream {
43+
}): ReadableStream<Uint8Array> {
44+
// Node's Readable.toWeb produces a WHATWG ReadableStream whose chunks are Uint8Array.
4245
return Readable.toWeb(createReadStream(filePath, {
4346
start: offset,
4447
end: length >= 0 ? offset + length : undefined
45-
}));
48+
})) as ReadableStream<Uint8Array>;
4649
}
4750

4851
function convertToRequestBody (uploadData: ProtocolRequest['uploadData']): RequestInit['body'] {
4952
if (!uploadData) return null;
5053
// Optimization: skip creating a stream if the request is just a single buffer.
51-
if (uploadData.length === 1 && (uploadData[0] as any).type === 'rawData') return uploadData[0].bytes;
54+
if (uploadData.length === 1 && (uploadData[0] as any).type === 'rawData') {
55+
return uploadData[0].bytes as any;
56+
}
5257

53-
const chunks = [...uploadData] as any[]; // TODO: types are wrong
54-
let current: ReadableStreamDefaultReader | null = null;
55-
return new ReadableStream({
58+
const chunks = [...uploadData] as any[]; // TODO: refine ProtocolRequest types
59+
// Use Node's web stream types explicitly to avoid DOM lib vs Node lib structural mismatches.
60+
// Generic <Uint8Array> ensures reader.read() returns value?: Uint8Array consistent with enqueue.
61+
let current: ReadableStreamDefaultReader<Uint8Array> | null = null;
62+
return new ReadableStream<Uint8Array>({
5663
async pull (controller) {
5764
if (current) {
5865
const { done, value } = await current.read();
@@ -67,7 +74,7 @@ function convertToRequestBody (uploadData: ProtocolRequest['uploadData']): Reque
6774
if (!chunks.length) { return controller.close(); }
6875
const chunk = chunks.shift()!;
6976
if (chunk.type === 'rawData') {
70-
controller.enqueue(chunk.bytes);
77+
controller.enqueue(chunk.bytes as Uint8Array);
7178
} else if (chunk.type === 'file') {
7279
current = makeStreamFromFileInfo(chunk).getReader();
7380
return this.pull!(controller);

lib/browser/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ process.on('uncaughtException', function (error) {
4040
// Emit 'exit' event on quit.
4141
const { app } = require('electron');
4242

43-
app.on('quit', (_event, exitCode) => {
43+
app.on('quit', (_event: any, exitCode: number) => {
4444
process.emit('exit', exitCode);
4545
});
4646

lib/node/asar-fs-wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
746746

747747
context.readdirResults.push(dirent);
748748
if (dirent!.isDirectory() || stat === 1) {
749-
context.pathsQueue.push(path.join(dirent!.path, dirent!.name));
749+
context.pathsQueue.push(path.join(dirent!.parentPath, dirent!.name));
750750
}
751751
}
752752
}

npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"@electron/get": "^2.0.0",
12-
"@types/node": "^22.7.7",
12+
"@types/node": "^24.9.0",
1313
"extract-zip": "^2.0.1"
1414
},
1515
"engines": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@octokit/rest": "^20.1.2",
1515
"@primer/octicons": "^10.0.0",
1616
"@types/minimist": "^1.2.5",
17-
"@types/node": "^22.7.7",
17+
"@types/node": "^24.9.0",
1818
"@types/semver": "^7.5.8",
1919
"@types/stream-json": "^1.7.8",
2020
"@types/temp": "^0.9.4",

patches/node/.patches

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,25 @@ chore_expose_importmoduledynamically_and.patch
1717
test_formally_mark_some_tests_as_flaky.patch
1818
fix_do_not_resolve_electron_entrypoints.patch
1919
ci_ensure_node_tests_set_electron_run_as_node.patch
20-
fix_assert_module_in_the_renderer_process.patch
2120
fix_allow_passing_fileexists_fn_to_legacymainresolve.patch
2221
fix_remove_deprecated_errno_constants.patch
2322
build_enable_perfetto.patch
24-
fix_add_source_location_for_v8_task_runner.patch
25-
src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch
26-
test_update_v8-stats_test_for_v8_12_6.patch
27-
src_do_not_use_soon-to-be-deprecated_v8_api.patch
28-
src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch
29-
build_compile_with_c_20_support.patch
30-
add_v8_taskpirority_to_foreground_task_runner_signature.patch
31-
cli_remove_deprecated_v8_flag.patch
3223
build_restore_clang_as_default_compiler_on_macos.patch
33-
fix_remove_outdated_v8_flags_from_node_cc.patch
3424
chore_disable_deprecation_ftbfs_in_simdjson_header.patch
3525
build_allow_unbundling_of_node_js_dependencies.patch
36-
test_use_static_method_names_in_call_stacks.patch
37-
fix_remove_fastapitypedarray_usage.patch
38-
test_handle_explicit_resource_management_globals.patch
3926
build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch
4027
fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch
41-
chore_add_createexternalizabletwobytestring_to_globals.patch
4228
refactor_attach_cppgc_heap_on_v8_isolate_creation.patch
4329
fix_ensure_traverseparent_bails_on_resource_path_exit.patch
44-
cli_move_--trace-atomics-wait_to_eol.patch
4530
fix_cppgc_initializing_twice.patch
46-
fix_task_starvation_in_inspector_context_test.patch
4731
fix_expose_readfilesync_override_for_modules.patch
4832
fix_array_out-of-bounds_read_in_boyer-moore_search.patch
49-
chore_add_missing_include_of_iterator.patch
5033
test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch
5134
chore_exclude_electron_node_folder_from_exit-time-destructors.patch
5235
api_remove_deprecated_getisolate.patch
53-
src_switch_from_get_setprototype_to_get_setprototypev2.patch
54-
fix_replace_deprecated_setprototype.patch
5536
fix_redefined_macos_sdk_header_symbols.patch
56-
src_simplify_string_bytes_with_views.patch
57-
src_improve_utf8_string_generation_performance.patch
58-
src_use_non-deprecated_utf8lengthv2_method.patch
59-
src_use_non-deprecated_writeutf8v2_method.patch
60-
src_refactor_writeucs2_and_remove_flags_argument.patch
61-
src_use_string_writev2_in_twobytevalue.patch
62-
node-api_use_writev2_in_napi_get_value_string_utf16.patch
63-
node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch
64-
src_migrate_writeonebyte_to_writeonebytev2.patch
37+
fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch
38+
feat_disable_js_source_phase_imports_by_default.patch
39+
fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch
40+
lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch
41+
chore_handle_support_for_import_defer_as_ns_and_import_defer.patch

patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)