39 Commits
Author SHA1 Message Date
Samuel AttardandClaude 8a6429e414 build: upgrade to TypeScript 7 (#54172)
TypeScript 7.0 is the native compiler and ships no JavaScript API. The
earlier changes in this series already moved everything that transpiled
on the fly (script/ and spec/) onto Node's own type stripping, so what
is left here is the compiler swap itself:

* typescript ^5.8.3 -> ^7.0.2.
* build/bundle/typecheck.mjs spawns tsc instead of driving the compiler
  API (the rootDir/private-field diagnostics it used to filter out are
  handled by tsconfig.electron.json setting rootDir to the parent
  checkout instead).
* tsconfig.json drops the removed baseUrl option and anchors the paths
  mapping explicitly; tsconfig.default_app.json moves off the removed
  "node" module resolution; `declare module NodeJS` becomes a namespace.
* A few lib/, spec and docs snippets wrap Buffers for the stricter
  Buffer/ArrayBuffer typings that Blob now expects.

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-21 15:21:32 -07:00
claude[bot]andClaude 7128ee7576 build: bundle lib/ with rolldown instead of webpack (#54080)
* build: bundle lib/ with rolldown instead of webpack

Replace the webpack + ts-loader pipeline that builds Electron's internal
JavaScript bundles with a small rolldown driver (build/bundle/bundle.mjs).

- build/bundle/targets.mjs describes the seven bundles (browser, renderer,
  worker, webview, isolated_renderer, node, utility) and the per-target
  behaviour that used to live in one webpack config each.
- BUILDFLAG(...) folding, the `electron` aliases, the Promise/process/
  Buffer/global providers and the profiling/try-catch wrappers are kept
  with the same semantics. Node built-ins imported from lazily evaluated
  modules stay lazy via a one line CommonJS shim so that load order
  matches the old bundles.
- Type checking moves out of the bundling step into a single
  electron_lib_typecheck action (build/bundle/typecheck.mjs) that every
  bundle depends on, instead of running seven times.
- gen-filenames.ts asks bundle.mjs for the module graph directly and
  emits a lib_typecheck_sources list for the new action.
- A few lib/ modules are adjusted for an ESM-first bundler: net.ts uses
  a plain module.exports object, web-contents.ts keeps its session
  side-effect import explicitly, and defineProperties caches the loaded
  module so each electron.* getter keeps returning the same object.

Drops webpack, webpack-cli and ts-loader from devDependencies.

* chore: wrap comment for clang-format

* build: keep bundle declarations out of the wrapper's parameter scope

node_mksnapshot compiles the js2c bundles with Node's built-in module
parameters (exports, require, module, process, internalBinding,
primordials), and a hoisted top-level `const { internalBinding } = ...`
from lib/node redeclared one of them. Wrap the bundle body in an IIFE, as
the webpack output was.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-18 17:52:57 +02:00
Samuel Attard 971045f1f7 perf: find and apply the app's package.json natively before the main-process JS runs (#53963)
* perf: find and apply the app's package.json natively before the main-process JS runs

lib/browser/init.ts located the app by pushing each of resources/app.asar,
app and default_app.asar through Module._load('<dir>/package.json') inside
a try/catch (a full CommonJS resolve, an fs.existsSync-style archive probe
and a thrown MODULE_NOT_FOUND per miss), then set the name, version, Linux
desktop name (desktop-name.ts, NFKD + two regex passes) and v8Flags one
app.* call at a time, stat'ed for Squirrel's Update.exe on Windows, and
registered a will-finish-launching listener that built the default menu
from default-menu.ts. base-window.ts gave every new window the application
menu from a JS _init hook.

ElectronBrowserMainParts now does the lookup with one asar-aware read per
candidate and applies the manifest to Browser directly (app_package.cc),
leaving init.ts only {path, main, esm} to load the entry script from. The
default File/Edit/View/Window menu is installed by Menu before
will-finish-launching is emitted unless the app already called
Menu.setApplicationMenu, and BaseWindow picks up the application menu when
it is wrapped. desktop-name.ts and default-menu.ts are deleted; the
desktop-name spec runs against the native implementation.

* fix: keep the app menu ahead of browser-window-created, tolerate non-UTF-8 package.json, register Menu templates before the default menu is built

* fix: apply package.json v8Flags just before the entry script so the startup bundles keep their code cache
2026-09-17 13:10:20 -07:00
David Sanders 101bd86383 build: cleanup eslint/oxlint disable comments (#53925) 2026-09-14 23:20:22 -07:00
Samuel Attard d6b4cf6d8f perf: speed up fs operations on paths inside asar archives (#53852)
* perf: make fs operations on paths inside an asar archive cheaper than real files

Loading modules from app.asar was measurably slower than loading the same
files from disk because every stat/realpath/readdir on an archive path paid
for a native path split that built a V8 dictionary, a fake Stats array built
through the slow iterable path, and a real realpath() of the archive file.

- splitPath: find the archive prefix in JS and memoise the native verdict per
  prefix, with a last-prefix fast path; skip path.normalize() for already
  normalized absolute POSIX paths.
- internalModuleStat: consult the module stat cache before splitting the path.
- Fill a shared scratch Float64Array/BigInt64Array for Stats instead of
  allocating one from a JS array per call.
- Memoise the archive file's own realpath per archive; honour the `encoding`
  option for asar realpath results (previously threw for 'buffer').
- readdir(withFileTypes)/opendir: one native readdirWithTypes() call instead
  of a stat per child.
- Native: allocation-free header walk over string_view, a per-archive
  path->node memo, zero-copy ASCII path arguments, and DictionaryTemplate
  results for stat()/getFileInfo().
- Wrap child_process eagerly instead of through a Module._load hook (init.ts
  already requires it; the hook taxed every require() and missed ESM
  imports of node:child_process).
- Read ELECTRON_LOG_ASAR_READS once.

* perf: locate the archive component of a path natively in one call

Replace the JS-side prefix memo and normalization regexes in the asar fs
wrapper with a lean native asar.splitPath(): it reads the path without
copying when it is ASCII, walks the components once, memoises "is this
*.asar prefix an archive file" by string, and reports when the path has
"."/".."/empty components so the caller can path.normalize() and ask again
(user-supplied paths only; the module loader's are already normalized).

The JS splitPath() is reduced to the type coercion, the /\.asar/i pre-check
that keeps unrelated paths out of native code, the call, and two slices.
Spec coverage for the binding is updated to the new integer contract and a
wrapper-level test for un-normalized archive paths is added.

* test: cover native asar path splitting and archive lookups; fix edge cases

Add an "internals" suite to asar-spec that builds its own archives (nested
directories, link chains and cycles, non-ASCII names, an upper-case .ASAR,
an archive inside a real directory named *.asar, a bogus *.asar file) and
exercises the electron_common_asar binding directly: splitPath() prefix
detection and its normalization contract, Archive.stat/getFileInfo/readdir/
readdirWithTypes/realpath, the lookup memo past its size limit, concurrent
use from worker threads, and the fs wrapper on Buffer/URL/relative/
un-normalized paths.

Fixes found while writing them and by review:
- splitPath() returned a UTF-8 byte offset; report UTF-16 code units so an
  archive under a non-ASCII directory splits correctly.
- Decide "needs normalization" lexically before probing the disk, and ignore
  any number of trailing separators.
- internalModuleStat goes through the normalizing splitPath() again so
  un-normalized NODE_PATH / require.resolve({ paths }) entries keep working.
- Keep separate archive realpath memos for realpath() and realpath.native().
- Skip empty components in the archive header walk.
- Read ELECTRON_LOG_ASAR_READS per call again so it can be set from main.js.

* fix: keep un-openable and not-yet-existing *.asar paths behaving as before

Follow-ups from review of the asar fast path:

- Native splitPath() now rejects paths containing control characters, as the
  base::FilePath converter used by Archive::New() does, so an .asar file under
  such a directory stays an ordinary file instead of an "Invalid package".
- IsDirectoryCached()/IsArchivePrefix() only memoise answers for paths that
  exist. A *.asar path probed before anything is created there (the win32
  mkdir wrapper does this) is re-evaluated later instead of being pinned as
  an archive for the life of the process. This predates the branch for
  IsDirectoryCached().
- getFileInfo() fills the integrity slot with undefined when absent so the
  DictionaryTemplate result keeps using its cached map.
- Spec: create the *.asar-named fixture directory through original-fs, derive
  the realpath.native expectation with the native flavour (8.3 temp paths on
  Windows runners), and cover the cases above.

* perf: read ELECTRON_LOG_ASAR_READS once per process

process.env goes through Node's env interceptor (getenv under a lock) and the
flag was checked on every read of a packed file. Sample it at startup instead
and document that it must be set in the launching environment.
2026-09-14 11:29:32 -07:00
Shelley Vohr cea20e3ae3 fix: don't start an app instance when a helper is executed without --type (#53831)
* fix: don't start an app instance when a helper is executed without --type

On macOS the helper executables link the same framework as the main
binary, so executing one without a --type argument runs it as a browser
process from inside the helper bundle. That is what child_process.fork()
does when the runAsNode fuse is disabled: the fork wrapper points execPath
at the helper and sets ELECTRON_RUN_AS_NODE, the fuse ignores the
variable, and a second app instance starts whose GPU, network-service and
renderer children then fail to launch because their helper paths are
derived from the helper's own name.

Make helper executables exit with EX_USAGE when no --type is present,
matching Chrome's "Helper application requires --type" check, and make
child_process.fork() throw when the runAsNode fuse is disabled instead of
launching a process that cannot work.

* fix: satisfy -Wunsafe-buffer-usage in the helper argv scan

* chore: format
2026-09-11 20:46:28 -04:00
Shelley Vohr 76d261a3b5 refactor: hand crashpad env to run-as-node children from lib/node/init (#53527)
* refactor: hand crashpad env to run-as-node children from lib/node/init

Wrap internal/child_process's ChildProcess.prototype.spawn and spawnSync in
lib/node/init.ts to add CRASHDUMP_SIGNAL_FD / CRASHPAD_HANDLER_PID for
ELECTRON_RUN_AS_NODE children of process.execPath on Linux, replacing the
patch to Node's normalizeSpawnArguments().

* chore: oxfmt

* fix: leave invalid spawn options to Node's validation

parallel/test-child-process-constructor calls ChildProcess.prototype.spawn with
non-object options and non-array envPairs and expects Node's own errors.
2026-09-05 11:00:31 +02:00
Shelley Vohr b8cf2969e1 refactor: look up internalBinding and linked bindings without patching Node (#53528)
* refactor: look up internalBinding and linked bindings without patching Node

asar-fs-wrapper takes internalBinding from require('internal/bootstrap/realm');
sandboxed preloads resolve linked bindings through NodeBindings::GetLinkedBinding(),
backed by accessors the NODE_LINKED_BINDING_CONTEXT_AWARE macro now emits. Drops
the two Node patches that exposed process.internalBinding and
node::binding::get_linked_module().

* chore: clang-format

* fix: only run the node_init preload in the principal realm

Node runs the embedder preload for ShadowRealms too. The bundle used to bail
there by accident (process.internalBinding was undefined); now that
internalBinding resolves it got as far as require('child_process') and hit the
PipeWrap template CHECK. Skip non-principal realms explicitly, which also lets
parallel/test-shadow-realm-custom-loaders run again.

* chore: clang-format
2026-09-05 11:00:15 +02:00
claude[bot]andClaude Fable 5.1 18e2caa485 fix: terminate immediately on asar integrity violation (#53433)
* fix: terminate immediately on asar integrity violation

The JS-side asar integrity check ends the process via
process.reallyExit(1), which bottoms out in libc exit(). That runs
atexit handlers and static destructors on the main thread while
Chromium's threads are still live, and on Windows intermittently
dies with an access violation (0xC0000005) before reaching
ExitProcess, so the process exits with the wrong code. Terminate
via base::Process::TerminateCurrentProcessImmediately instead so
nothing else runs and exit code 1 is preserved.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj

* refactor: drop dead exit fallbacks after exitImmediately

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj

* refactor: move exitImmediately to the v8_util binding

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-02 21:55:20 -07:00
Samuel Attard 7377022f03 feat: serve asar file descriptors, streams and copies from the archive (#52833)
* feat: serve asar file descriptors, streams and copies from the archive

fs.open/openSync/promises.open, fs.createReadStream, fs.copyFile/cp (and
their sync/promise variants) previously extracted a packed asar entry into a
temporary file first (Archive::CopyFileOut): a synchronous, main-thread copy of
the whole file on first access, a temp copy left behind for the life of the
process, and a cached copy that later opens with write flags could corrupt.

The wrapper now hands out real file descriptors duplicated from the archive's
retained handle and hooks the fs binding so every fd-based API (read/readv/
fstat/close/readFile(fd), ReadStream, FileHandle) reads straight out of the
archive. With ASAR integrity enabled, bytes are only ever served from a
block whose hash was just verified, and a violation terminates the process
synchronously instead of after the tampered data was already handed back.
Copies stream from the archive to the destination; opening a packed file for
writing fails with EACCES; fchmod/fchown/futimes on such descriptors are
refused. Only process.dlopen and child_process.execFile still need a real
path and keep using the temporary copy (now made read-only).

Also adds fs.opendir/readlink support for archives, makes fs.stat follow
archive symlinks (fs.cp dereference now works), returns BigIntStats when
asked, and gives original-fs its own pristine copy of the fs binding so it is
unaffected by these overrides.

* docs: note the asar file descriptor behavior change in breaking-changes

* fix: address review of the asar fd reader

- readv on a packed entry: a zero-length buffer no longer ends the clamped
  read early; later buffers are still filled, like preadv.
- copyFile with COPYFILE_FICLONE_FORCE on an unpacked entry is passed to
  native fs (which may reflink); only packed entries reject it with ENOTSUP.
- FileHandle#close() forgets the descriptor entry immediately instead of
  waiting for the C++ handle's fd to be reset after the threadpool close, so
  a real file that reuses the number in that window is never routed through
  the archive reader.
- open() of a symbolic link to a directory reports EISDIR, not ENOENT.
- readlink and opendir honour name encodings other than 'buffer'.
- recursive readdir withFileTypes skips an unreadable archive entry instead
  of dropping the rest of the listing.

* fix: keep the asar fs binding hooks working when Array's iterator is deleted

- Forward pass-through calls with Function#apply and index access instead of
  spread / array destructuring, which need Array.prototype[Symbol.iterator]
  (user code may delete it; parallel/test-require-delete-array-iterator).
- Use literal permission bits for the fake asar stats: the S_IRGRP/S_IROTH/
  S_IX* constants do not exist on Windows, so the modes came out as 0600.
- Allow blocking around the chmod of a copied-out temp file; CopyFileOut is
  also reached from the UI thread via WebContents.downloadURL().

* fix: report the executable bit from asar stat and drop stale fd entries

- Archive::Stat now exposes `executable`, so fs.stat/lstat of a packed
  executable report 0755 like fs.fstat does; fs.cp no longer strips the bit
  that copyFile preserved when it chmods the destination to the source mode.
- A descriptor for a packed entry can be closed without going through
  fs.close (a native FileHandle built on it, e.g. http2's respondWithFile,
  a FileHandle moved to a worker, or one closed on GC). Whenever fs hands out
  a descriptor number (native pass-through open or a new archive-backed one),
  any stale entry for that number is dropped first, so it can never capture
  the new owner's reads, and its retained block is returned to the budget.
- Document http2stream.respondWithFile()/respondWithFD() among the APIs
  that read the raw descriptor.

* fix: hand out a sentinel descriptor for packed asar entries, not the archive

The descriptor returned by open() for a packed entry used to be a dup of the
archive's own handle. Code that read it directly instead of through fs (a
native addon, a child's stdio, net.Socket({ fd }), http2's respondWithFile)
silently got bytes of the archive at the wrong offset, and a raw handle to
the archive escaped to user code.

Hand out a per-open dup of a write-only null device instead. It identifies
the entry to fs, which serves every read from the archive's retained handle
positionally as before, and it is useless to anything else: direct reads
fail with EBADF, the archive itself is never exposed, and a descriptor
closed behind our back can at worst misroute through fs, never leak archive
bytes. Writes, truncation and metadata changes through such a descriptor are
refused with EACCES rather than vanishing into the null device. copyFile and
the writeFile fast path read the entry without allocating a descriptor at
all.

* chore: clang-format electron_api_asar.cc

* fix: use libuv error numbers for asar fs errors

libuv's error numbers differ from POSIX errno on Windows (UV_EACCES is
-4092 there, not -13) and Node decodes `errno` through libuv's table, so the
hand-written errno values decoded as UNKNOWN on Windows. Take them from the
uv binding instead.

Also refuse writeFileSync's utf8 fast path when it is given a packed entry's
descriptor rather than a path.
2026-08-21 23:03:41 -07:00
Shelley Vohr 51d485b858 perf: cut first-window, ipc, contextBridge, Buffer and asar overhead (#52923)
* perf: preallocate the file descriptor table before threads start (linux)

Linux grows a process's file descriptor table in powers of two on demand
and, once the table is shared with other threads, expand_fdtable() waits
for a full RCU grace period before freeing the old table. Whichever
open()/socket()/memfd call crosses the 64-descriptor boundary in an
already multi-threaded process eats that wait; in the browser process it
lands inside the first `new BrowserWindow` (the renderer's channel and
shared memory setup) and measured 55-115 ms of uninterruptible sleep in
openat() on a 64-vCPU host, 10-30 ms being typical elsewhere.

content's zygote already grows the table of every child it forks for this
reason (content/zygote/zygote_linux.cc). Do the same in main() for the
browser and the exec'd children: one F_DUPFD_CLOEXEC to descriptor 512
while the process is still single-threaded leaves a 1024-entry table
(8 KB) behind and nothing else. Where RLIMIT_NOFILE is lower the fcntl
fails and nothing changes.

* perf: stop rebuilding the whole path per component in asar::GetAsarArchivePath

GetAsarArchivePath() located the archive by calling DirName() once per
path component and MatchesExtension() on each intermediate path (a
BaseName() copy every time), then split the result with
AppendRelativePath(), which runs GetComponents() over both the parent
and the child. For a file inside app.asar that is dozens of string
allocations per lookup, and the fs wrapper performs this lookup
(asar.splitPath) for every fs call whose path mentions ".asar" - around
ten per require()'d module.

Scan the component boundaries as offsets into the existing string
instead, hand only the candidate component to MatchesExtension(), and
build the relative part with Append() from the components after the
match. The outputs are byte-identical to before, including the existing
corner cases (a real directory named *.asar is not an archive, the
deepest matching component wins, doubled separators and a leading "."
collapse the way Append() collapses them, a trailing separator on the
archive path itself is kept); new asar-spec cases pin those down.

* perf: keep context bridge proxy function state in the function's data array

The proxy that contextBridge installs for a function carried its target,
receiver and dynamic-property flag as three private properties on a state
object, so every call through the bridge did three v8::Private::ForApi
lookups (each allocating the key string) plus three GetPrivate calls
before it could invoke anything. Store the three values in a packed
v8::Array handed to v8::Function::New as the callback data and read them
back by index. The array is only reachable through the function's data
slot, exactly like the old state object, so nothing new becomes visible
to either world; the original-function marker on the proxy itself stays a
private property because that one has to live on a script-visible
object.

* perf: trim per-value work when the context bridge copies objects and arrays

Copying a plain object or array across the bridge visits every value, and
each visit paid for a trace event, three Blink wrapper probes
(WebElement, WebBlob, VideoFrame) that can only ever match API wrapper
objects, and, for object properties, an extra destination Context::Scope
enter/exit on top of the source one. Arrays were also filled with one
Set() per element.

Skip the Blink probes unless the value is an API wrapper object, drop the
inner trace event (the entry points keep theirs), read each property
under the source scope and define it under the destination scope that is
already active, and build array clones with the bulk v8::Array::New. The
values produced, the object cache and the recursion order are unchanged.

* perf: give V8's in-sandbox allocator a PartitionAlloc backend outside renderers

Node allocates Buffer.allocUnsafe(), Buffer.allocUnsafeSlow() and the
64 KB Buffer pool refill through ArrayBuffer::Allocator::NewDefaultAllocator()
(Electron's sandboxed-pointers patch), which under the V8 sandbox forwards
to V8's built-in in-sandbox allocator. V8 documents that allocator as a slow
placeholder embedders are expected to replace: it hands out page-granular
regions under a global mutex and zero-fills even "uninitialized" requests.
Blink replaces it for renderers (V8Initializer::InitializeInSandboxAllocator);
the browser, utility and ELECTRON_RUN_AS_NODE processes never did, so every
unpooled Buffer there paid a map/unmap round trip: Buffer.allocUnsafe of
1 MB ~300 us against ~12 us in a stock Node build, 64 KB ~30 us against
~2 us, and fs.readFile of a 1 MB file was several times slower than
reading into a preallocated buffer.

JavascriptEnvironment now installs an allocator with
v8::V8::SetInSandboxAllocator() before the isolate is created, backed by
gin's array buffer partition (which already lives inside the sandbox) the
same way Blink's is backed by its ArrayBufferContents partition.
PartitionAlloc refuses single allocations of ~2 GiB and more while the
placeholder had no such cap, so requests above PartitionAlloc's limit go to
the sandbox's address space directly (checked up front, so V8 never sees a
failed allocation to retry) and Buffer.allocUnsafe of 2 GiB and more keeps
working. Measured in the main process: allocUnsafe 64 KB 33 -> 5.6 us,
1 MB 297 -> 36 us, 4 MB 1691 -> 41 us, allocUnsafeSlow 1 MB 218 -> 13 us,
fs.promises.readFile 1 MB 1.2 -> 0.9 ms. Page zeroing moves from the
allocator to first touch, so a Buffer that is immediately written end to
end pays the same faults later instead.

* perf: serialize ipc values straight into the buffer they are sent in

Values passed through ipcRenderer.send/invoke/sendSync/sendToHost,
webContents.send, webFrameMain.send and their service worker equivalents
travel as blink.mojom.CloneableMessage. For payloads above mojo's 64 KB
inline limit that costs three fresh multi-megabyte buffers per hop: the
V8 serializer grows a zero-filled std::vector, mojo copies that into a
newly created shared memory region, and the receiving traits copy the
region back out into another vector before V8 reads a byte. In profiles
of 1-4 MB messages both main threads spent 30-40% of their time in page
faults for those buffers.

Electron owns both ends of these interfaces, so give them their own
payload type: electron.mojom.SerializedValue is a BigBuffer plus the
number of bytes written. The serializer keeps small values on the heap as
before and, once V8 asks for more than the inline limit, continues in the
shared memory region that will be sent, so the sender never holds a
second copy. On the receiving side a renderer parses the region in
place; the browser (and any other process) still parses a private copy,
because the sender keeps write access to shared memory while it is read.

MessagePort/postMessage paths keep blink's TransferableMessage, and the
CloneableMessage overloads stay for in-process users (contextBridge,
app 'second-instance' data).

The serializer moves to shared memory once V8's request shows the value
needs more than an inline message (not merely when the doubled request
crosses 64 KB), and grows regions 4x from there, so a value written in
many small pieces creates two or three regions rather than one per
doubling; each region is a brokered round trip for a sandboxed renderer
on Linux. Object-heavy payloads (arrays of small records) measure
renderer -> main 1 MB 10.2 -> 10.2 ms and 4 MB 41.5 -> 39.9 ms with this,
against +8% / +3% with per-doubling regions.

* perf: size protocol and asar response pipes to the body

Electron's URL loaders created their response data pipes with mojo's
64 KB default (the asar loader with a hard-coded 65536 copied from an old
FileURLLoader), so every response larger than that reached the renderer
in 64 KB slices, each one a producer wakeup on the browser main thread
plus a consumer wakeup in the renderer. Chromium since sized these up:
network::GetDataPipeDefaultAllocationSize() is 512 KB for ordinary loads
and 2 MB (kLargerSizeIfPossible) for file://.

A pipe is a shared memory buffer that base preallocates in full, though,
so a uniformly larger pipe makes every small response measurably slower
for the sake of the large ones. Instead, where the body size is known up
front, size the pipe to the body with the same caps upstream uses: archive
entries (file-like) up to the 2 MB file:// size, string/buffer responses
and any protocol response that declares a Content-Length up to the
512 KB default. Streams of unknown length keep mojo's default. Small
responses keep exactly the pipe they had; a 16 MB archive entry reaches
the renderer in 8 slices instead of 256, a 16 MB protocol body with a
known length in 32.

* perf: remember module stat results for paths inside an archive

Module resolution calls internalModuleStat() thousands of times while an
app loads from app.asar, and most of those repeat a path it already asked
about (parent node_modules directories, extension-less candidates):
loading a 1040-module tree issues 6357 calls for 2751 distinct paths, 5065
of them misses. Node's own stat cache only remembers hits and only within
one require() chain, so every repeat went back through the archive
lookup.

An archive's header never changes once it is open, so keep the answers
derived from it in a Map keyed by the path (bounded, cleared when it grows
past 16k entries). Answers that came from failing to open the archive are
not kept, so an archive that appears later is still picked up.
2026-08-18 16:31:26 -04:00
Sanidhya SinghandCharles Kerr 1af96e8b82 fix: set Dirent.parentPath in asar fs.readdir withFileTypes (#51845)
The asar fs wrapper built Dirent objects with `new fs.Dirent(name, type)`
in the non-recursive readdir handlers, which left `parentPath` undefined.
As a result `Dirent.parentPath` was missing for `fs.readdir` /
`readdirSync` (and for `fs.glob` / `globSync`, which read directories
through these handlers) when operating inside an asar archive, while it
was correctly populated outside of asar and on the recursive readdir
code path.

Use the internal `getDirent(path, name, type)` helper instead, matching
both the recursive readdir path and Node's own behavior, so `parentPath`
is set to the directory that was read.

Fixes #51838

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2026-07-28 20:24:56 -04:00
Felix Rieseberg 940b24db8d chore: remove EnvironmentOptions::experimental_fetch dependency (#51923)
* chore: remove EnvironmentOptions::experimental_fetch dependency

Node.js removed the experimental_fetch option in nodejs/node#62759
since fetch is now unconditionally enabled. We had been patching the
field back in so that node_main.cc could read it and node_bindings.cc
could pass --no-experimental-fetch to renderer/worker processes.

Neither is necessary:

- In ELECTRON_RUN_AS_NODE mode, fetch is always available, so WASM
  streaming (which depends on Response) should always be set up.
- In renderer/worker processes, kNoBrowserGlobals already causes
  Node's PrincipalRealm::BootstrapRealm to skip
  internal/bootstrap/web/exposed-window-or-worker.js, which is where
  fetch/Request/Response/Headers/FormData are defined. Node's fetch
  globals were never being installed; Blink's win by default.

Drop the patch and the two call sites that depended on it.

Closes #51912

* fix: restore Blink's WASM streaming callback in renderer/worker

SetIsolateUpForNode now unconditionally registers Node's WASM streaming
callback (nodejs/node#62759 dropped the experimental_fetch gate). With
kNoBrowserGlobals the JS half of that callback is never installed, so
WebAssembly.compileStreaming/instantiateStreaming would crash on
CHECK(\!impl.IsEmpty()) in node_wasm_web_api.cc.

Re-register Blink's handler via WasmResponseExtensions::Initialize after
CreateEnvironment in renderer and worker so Blink's implementation wins.

Also drop the now-redundant blink* global stash/restore: with
kNoBrowserGlobals Node neither installs nor deletes fetch/Response/etc,
so Blink's bindings are never disturbed and the round-trip through
blinkfetch was a no-op.

Add a spec asserting fetch/Headers/Request/Response/FormData stringify
to [native code] in a nodeIntegration renderer.

* fixup: rebase on #51953 and preserve Blink's EventSource

- Resolve modify/delete on the fetch patch (delete wins; the
  experimental_fetch gate it added to environment.cc is no longer
  needed since WasmResponseExtensions::Initialize handles the
  callback restoration in Electron's renderer code).
- Revert the environment.cc index hash in
  api_delete_deprecated_fields_on_v8_isolate.patch now that the
  preceding patch is gone (verified with `e patches node`).
- Preserve Blink's EventSource around LoadEnvironment in renderer
  and worker: Node's setupEventsource() in pre_execution.js deletes
  globalThis.EventSource whenever --experimental-eventsource is not
  set, and unlike setupNavigator/setupWebStorage it does not check
  noBrowserGlobals first. The previous blink* stash covered this as
  a side effect; restore just EventSource explicitly in C++.
- Extend the [native code] spec assertion to cover EventSource.

* fixup: pass --experimental-eventsource instead of C++ save/restore

The C++ save/restore around LoadEnvironment was too late: preload
scripts run inside LoadEnvironment, after Node's setupEventsource()
has deleted globalThis.EventSource but before the C++ restore. This
broke 'preload has synchronous access to all eventual window APIs'.

Pass --experimental-eventsource for renderer/worker so Node's
setupEventsource() becomes a no-op and Blink's binding is never
deleted. Under kNoBrowserGlobals Node never installs its own undici
EventSource, so the flag's only effect is suppressing the delete.
2026-06-16 16:44:26 -04:00
Samuel Attard 2c94aac330 build: add oxfmt for JS/TS formatting and import sorting (#50692)
* build: add oxfmt for code formatting and import sorting

Adds oxfmt as a devDependency alongside oxlint and wires it into the
lint pipeline. The .oxfmtrc.json config matches Electron's current JS
style (single quotes, semicolons, 2-space indent, trailing commas off,
printWidth 100) and configures sortImports with custom groups that
mirror the import/order pathGroups previously enforced by ESLint:
@electron/internal, @electron/*, and {electron,electron/**} each get
their own ordered group ahead of external modules.

- `yarn lint:fmt` runs `oxfmt --check` over JS/TS sources and is
  chained into `yarn lint` so CI enforces it automatically.
- `yarn format` runs `oxfmt --write` for local fix-up.
- lint-staged invokes `oxfmt --write` on staged .js/.ts/.mjs/.cjs
  files before oxlint, so formatting is applied at commit time.

The next commit applies the formatter to the existing codebase so the
check actually passes.

* chore: apply oxfmt formatting to JS and TS sources

Runs `yarn format` across lib/, spec/, script/, build/, default_app/,
and npm/ to bring the codebase in line with the .oxfmtrc.json settings
added in the previous commit. This is a pure formatting pass: import
statements are sorted into the groups defined by the config, method
chains longer than printWidth are broken, single-quoted strings
containing apostrophes are switched to double quotes, and a handful of
single-statement `if` bodies are re-wrapped and get braces added by
`oxlint --fix` to satisfy the `curly: multi-line` rule.

No behavior changes.
2026-04-12 02:03:04 -07:00
CalvinandClaude Opus 4.6 8b7e7de208 fix: return numeric blksize and blocks from asar fs.stat (#50825)
fix: return numeric `blksize` and `blocks` from asar `fs.stat`

Previously, `fs.stat` on files inside `.asar` archives returned
`undefined` for `blksize` and `blocks`, violating the Node.js API
contract where these fields must be `number | bigint`.

Use `4096` for `blksize` (matching the convention used by `memfs` and
the proposed `node:vfs` module in nodejs/node#61478) and compute
`blocks` as `ceil(size / 512)` (standard 512-byte block units).

Fixes #42686

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 10:19:09 +02:00
Noah Gregory a561dd97a6 fix: add ASAR support to additional copy methods (#50226)
* fix: add ASAR support for additional copy methods

* test: add tests for ASAR support for additional copy messages
2026-03-16 14:36:48 +01:00
Samuel Attard d0241ea27d fix: delete temporary blink* globals after restoring Blink implementations (#49991)
ElectronRendererClient::DidCreateScriptContext (and the worker
equivalent) save Blink's fetch/Response/FormData/Request/Headers/
EventSource as temporary globalThis.blink* properties before Node
initialization may overwrite them. node/init.ts and worker/init.ts
restore the originals but previously never deleted the temporary
blink* globals.

They persisted as non-standard global pollution visible to page
content when contextIsolation is disabled -- a minor fingerprinting
signal and a bypass for any preload that wraps window.fetch (page
could call blinkfetch() instead).
2026-03-02 10:44:49 +00:00
Shelley Vohr 3345edd2bf chore: upgrade Node.js to v24.10.0 (#48613)
* chore: upgrade Node.js to v24.10.0

* chore: fixup crypto patch

* chore: fixup crypto test patch

* src: prepare for v8 sandboxing

https://github.com/nodejs/node/pull/58376

* esm: fix module.exports export on CJS modules

https://github.com/nodejs/node/pull/57366

* chore: fixup lazyload fs patch

* esm: Source Phase Imports for WebAssembly

https://github.com/nodejs/node/pull/56919

* module: remove --experimental-default-type

https://github.com/nodejs/node/pull/56092

* lib,src: refactor assert to load error source from memory

https://github.com/nodejs/node/pull/59751

* src: add source location to v8::TaskRunner

https://github.com/nodejs/node/pull/54077

* src: remove dependency on wrapper-descriptor-based CppHeap

https://github.com/nodejs/node/pull/54077

* src: do not use soon-to-be-deprecated V8 API

https://github.com/nodejs/node/pull/53174

* src: stop using deprecated fields of v8::FastApiCallbackOptions

https://github.com/nodejs/node/pull/54077

* test: update v8-stats test for V8 12.6

https://github.com/nodejs/node/pull/54077

* esm: unflag --experimental-wasm-modules

https://github.com/nodejs/node/pull/57038

* test: adapt assert tests to stack trace changes

https://github.com/nodejs/node/pull/58070

* src,test: unregister the isolate after disposal and before freeing

https://github.com/nodejs/node/pull/58070

* src: use cppgc to manage ContextifyContext

https://github.com/nodejs/node/pull/56522

* src: replace uses of FastApiTypedArray

https://github.com/nodejs/node/pull/58070

* module: integrate TypeScript into compile cache

https://github.com/nodejs/node/pull/56629

* deps: update ada to 3.2.7

https://github.com/nodejs/node/pull/59336

* src: make minor cleanups in encoding_binding.cc

https://github.com/nodejs/node/pull/57448

* src: switch from `Get/SetPrototype` to `Get/SetPrototypeV2`

https://github.com/nodejs/node/pull/55453

* src: use non-deprecated Get/SetPrototype methods

https://github.com/nodejs/node/pull/59671

* src: simplify string_bytes with views

https://github.com/nodejs/node/pull/54876

* src: improve utf8 string generation performance

https://github.com/nodejs/node/pull/54873

* src: use non-deprecated Utf8LengthV2() method

https://github.com/nodejs/node/pull/58070

* src: use non-deprecated WriteUtf8V2() method

https://github.com/nodejs/node/pull/58070

* src: refactor WriteUCS2 and remove flags argument

https://github.com/nodejs/node/pull/58163

* src: use String::WriteV2() in TwoByteValue

https://github.com/nodejs/node/pull/58164

* node-api: use WriteV2 in napi_get_value_string_utf16

https://github.com/nodejs/node/pull/58165

* node-api: use WriteOneByteV2 in napi_get_value_string_latin1

https://github.com/nodejs/node/pull/58325

* src: migrate WriteOneByte to WriteOneByteV2

https://github.com/nodejs/node/pull/59634

* fs: introduce dirent\.parentPath

https://github.com/nodejs/node/pull/50976

* src: avoid copy by using std::views::keys

https://github.com/nodejs/node/pull/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

https://github.com/nodejs/node/pull/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

https://github.com/nodejs/node/pull/59082

* chore: fixup crypto tests

* chore: HostImportModuleWithPhaseDynamically todo

* fix: cjs esm failures

* fix: v8::Object::Wrappable issues

- https://github.com/v8/node/commit/b72a6157543d68218cc385fc17b81b7005567d0a
- https://github.com/v8/node/commit/490bac24967c5bc2190c340611d4badba6af340e
- https://github.com/v8/node/commit/4896a0dd693b604a80913b42c1fd9af0b5c4680c

* chore: remove deleted specs

* src: use v8::ExternalMemoryAccounter

https://github.com/nodejs/node/pull/58070

* fs: port SonicBoom module to fs module as FastUtf8Stream

https://github.com/nodejs/node/pull/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
2025-10-30 19:16:48 +01:00
David Sanders a201d6c541 build: drop @types/webpack-env in favor of webpack/module types (#47798)
* build: drop @types/webpack-env in favor of webpack/module types

* chore: improve type when assigning to global.require
2025-08-08 18:09:23 -07:00
electron-roller[bot]andShelley Vohr 40cdfdb1d1 chore: bump node to v22.18.0 (main) (#47937)
* chore: bump node in DEPS to v22.18.0

* crypto: fix inclusion of OPENSSL_IS_BORINGSSL define

https://github.com/nodejs/node/pull/58845

* crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4

https://github.com/nodejs/node/pull/58960

* permission: propagate permission model flags on spawn

https://github.com/nodejs/node/pull/58853

* esm: syncify default path of ModuleLoader\.load

https://github.com/nodejs/node/pull/57419

* src: remove fast API for InternalModuleStat

https://github.com/nodejs/node/pull/58489

* src: simplify adding fast APIs to ExternalReferenceRegistry

https://github.com/nodejs/node/pull/58896/

* chore: fixup patch indices

* src: fix internalModuleStat v8 fast path

https://github.com/nodejs/node/pull/58054

* test: add tests to ensure that node.1 is kept in sync with cli.md

https://github.com/nodejs/node/pull/58878

* crypto: fix SHAKE128/256 breaking change introduced with OpenSSL 3.4

https://github.com/nodejs/node/pull/58942

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-08-04 14:40:36 -04:00
electron-roller[bot]andShelley Vohr 4dccccadbb chore: bump node to v22.17.0 (main) (#47557)
* chore: bump node in DEPS to v22.17.0

* build: use //third_party/simdutf by default in GN

https://github.com/nodejs/node/pull/58115

* chore: adjust crypto specs:

- https://github.com/nodejs/node/pull/58117
- https://github.com/nodejs/node/pull/58387

* deps: update libuv to 1.51.0

https://github.com/nodejs/node/pull/58124

* test: fix test-buffer-tostring-range on allocation failure

https://github.com/nodejs/node/pull/58416

* build: use FILE_OFFSET_BITS=64 esp. on 32-bit arch

https://github.com/nodejs/node/pull/58090

* build: use //third_party/simdutf by default in GN

https://github.com/nodejs/node/pull/58115

* inspector: add protocol method Network.dataReceived

https://github.com/nodejs/node/pull/58001

* test: force slow JSON.stringify path for overflow

https://github.com/nodejs/node/pull/58181

* chore: fixup patch indices

* 6049967: Remove protocol::Maybe and roll inspector_protocol

https://chromium-review.googlesource.com/c/chromium/src/+/6049967

* chore: fixup crypto test patch

* src: fix module buffer allocation

https://github.com/nodejs/node/pull/57738

* crypto: expose process.features.openssl_is_boringssl

https://github.com/nodejs/node/pull/58387

* util: add internal assignFunctionName() function

https://github.com/nodejs/node/pull/57916

* build: fix pointer compression builds

https://github.com/nodejs/node/pull/58171

* chore: put back config options

* fixup! deps: update libuv to 1.51.0

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-06-28 16:33:09 +02:00
Fedor Indutny 7601af5200 fix: don't copy 'package.json's out of ASAR file (#46390)
New Node.js module resolution system reads `package.json` from imported
modules by reading from the file natively in C++ without calling into
`fs.readFileSync`. The ASAR FS wrapper code had copied files out into a
temporary folder as a workaround, but it is inefficient and does not
cover all module resolution mechanisms in Node.js.

In this change we expose `overrideReadFileSync` method on the `modules`
binding in Node.js, and use this override to call into ASAR-supporting
`fs.readFileSync`.
2025-04-03 13:39:53 -07:00
electron-roller[bot]andShelley Vohr 93f4a93e12 chore: bump node to v22.13.1 (main) (#45307)
* chore: bump node in DEPS to v22.13.1

* chore: fixup GN build file

* https://github.com/nodejs/node/pull/55529
* https://github.com/nodejs/node/pull/55798
* https://github.com/nodejs/node/pull/55530

* module: simplify --inspect-brk handling

https://github.com/nodejs/node/pull/55679

* src: fix outdated js2c.cc references

https://github.com/nodejs/node/pull/56133

* crypto: include openssl/rand.h explicitly

https://github.com/nodejs/node/pull/55425

* build: use variable for crypto dep path

https://github.com/nodejs/node/pull/55928

* crypto: fix RSA_PKCS1_PADDING error message

https://github.com/nodejs/node/pull/55629

* build: use variable for simdutf path

https://github.com/nodejs/node/pull/56196

* test,crypto: make crypto tests work with BoringSSL

https://github.com/nodejs/node/pull/55491

* fix: suppress clang -Wdeprecated-declarations in libuv

https://github.com/libuv/libuv/pull/4486

* deps: update libuv to 1.49.1

https://github.com/nodejs/node/pull/55114

* test: make test-node-output-v8-warning more flexible

https://github.com/nodejs/node/pull/55401

* [v22.x] Revert "v8: enable maglev on supported architectures"

https://github.com/nodejs/node/pull/54384

* fix: potential WIN32_LEAN_AND_MEAN redefinition

https://github.com/c-ares/c-ares/pull/869

* deps: update nghttp2 to 1.64.0

https://github.com/nodejs/node/pull/55559

* src: provide workaround for container-overflow

https://github.com/nodejs/node/pull/55591

* build: use variable for simdutf path

https://github.com/nodejs/node/pull/56196

* chore: fixup patch indices

* fixup! module: simplify --inspect-brk handling

* lib: fix fs.readdir recursive async

https://github.com/nodejs/node/pull/56041

* lib: avoid excluding symlinks in recursive fs.readdir with filetypes

https://github.com/nodejs/node/pull/55714/

This doesn't currently play well with ASAR - this should be fixed in a follow up

* test: disable CJS permission test for config.main

This has diverged as a result of our revert of
src,lb: reducing C++ calls of esm legacy main resolve

* fixup! lib: fix fs.readdir recursive async

* deps: update libuv to 1.49.1

https://github.com/nodejs/node/pull/55114

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-29 15:41:00 -05:00
electron-roller[bot]andShelley Vohr 863faea542 chore: bump node to v22.11.0 (main) (#44530)
* chore: bump node in DEPS to v22.11.0

* src: move evp stuff to ncrypto

https://github.com/nodejs/node/pull/54911

* crypto: add Date fields for validTo and validFrom

https://github.com/nodejs/node/pull/54159

* module: fix discrepancy between .ts and .js

https://github.com/nodejs/node/pull/54461

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

https://github.com/nodejs/node/pull/55003

* src: modernize likely/unlikely hints

https://github.com/nodejs/node/pull/55155

* chore: update patch indices

* crypto: add validFromDate and validToDate fields to X509Certificate

https://github.com/nodejs/node/pull/54159

* chore: fixup perfetto patch

* fix: clang warning in simdjson

* src: add receiver to fast api callback methods

https://github.com/nodejs/node/pull/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

https://github.com/nodejs/node/pull/55121

* fix: bad rebase

* chore: fixup amaro

* chore: address feedback from review

* src: revert filesystem::path changes

https://github.com/nodejs/node/pull/55015

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-01-22 12:16:26 -05:00
Shelley Vohr a15e42e9ff chore: cleanup following internal switch to readPackageJSON (#44644)
chore: cleanup following internal switch to readPackageJSON
2024-11-15 11:36:18 -05:00
Keeley HammondandShelley Vohr 946ab5f1d7 build: reland bump Node.js to v22.9.0 (#44597)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-11-13 15:34:30 +01:00
Keeley Hammond f9a04012b9 build: revert bump Node.js to v22.9.0 (#44596)
* Revert "chore: bump Node.js to v22.9.0 (#44281)"

This reverts commit c63d0d61e7.

* chore: update patches
2024-11-07 19:20:50 -08:00
Shelley Vohr c63d0d61e7 chore: bump Node.js to v22.9.0 (#44281)
* chore: bump Node.js to v22.9.0

* build: drop base64 dep in GN build

https://github.com/nodejs/node/pull/52856

* build,tools: make addons tests work with GN

https://github.com/nodejs/node/pull/50737

* fs: add fast api for InternalModuleStat

https://github.com/nodejs/node/pull/51344

* src: move package_json_reader cache to c++

https://github.com/nodejs/node/pull/50322

* crypto: disable PKCS#1 padding for privateDecrypt

https://github.com/nodejs-private/node-private/pull/525

* src: move more crypto code to ncrypto

https://github.com/nodejs/node/pull/54320

* crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey

https://github.com/nodejs/node/pull/50234

* src: shift more crypto impl details to ncrypto

https://github.com/nodejs/node/pull/54028

* src: switch crypto APIs to use Maybe<void>

https://github.com/nodejs/node/pull/54775

* crypto: remove DEFAULT_ENCODING

https://github.com/nodejs/node/pull/47182

* deps: update libuv to 1.47.0

https://github.com/nodejs/node/pull/50650

* build: fix conflict gyp configs

https://github.com/nodejs/node/pull/53605

* lib,src: drop --experimental-network-imports

https://github.com/nodejs/node/pull/53822

* esm: align sync and async load implementations

https://github.com/nodejs/node/pull/49152

* esm: remove unnecessary toNamespacedPath calls

https://github.com/nodejs/node/pull/53656

* module: detect ESM syntax by trying to recompile as SourceTextModule

https://github.com/nodejs/node/pull/52413

* test: adapt debugger tests to V8 11.4

https://github.com/nodejs/node/pull/49639

* lib: update usage of always on Atomics API

https://github.com/nodejs/node/pull/49639

* test: adapt test-fs-write to V8 internal changes

https://github.com/nodejs/node/pull/49639

* test: adapt to new V8 trusted memory spaces

https://github.com/nodejs/node/pull/50115

* deps: update libuv to 1.47.0

https://github.com/nodejs/node/pull/50650

* src: use non-deprecated v8::Uint8Array::kMaxLength

https://github.com/nodejs/node/pull/50115

* src: update default V8 platform to override functions with location

https://github.com/nodejs/node/pull/51362

* src: add missing TryCatch

https://github.com/nodejs/node/pull/51362

* lib,test: handle new Iterator global

https://github.com/nodejs/node/pull/51362

* src: use non-deprecated version of CreateSyntheticModule

https://github.com/nodejs/node/pull/50115

* src: remove calls to recently deprecated V8 APIs

https://github.com/nodejs/node/pull/52996

* src: use new V8 API to define stream accessor

https://github.com/nodejs/node/pull/53084

* src: do not use deprecated V8 API

https://github.com/nodejs/node/pull/53084

* src: do not use soon-to-be-deprecated V8 API

https://github.com/nodejs/node/pull/53174

* src: migrate to new V8 interceptors API

https://github.com/nodejs/node/pull/52745

* src: use supported API to get stalled TLA messages

https://github.com/nodejs/node/pull/51362

* module: print location of unsettled top-level await in entry points

https://github.com/nodejs/node/pull/51999

* test: make snapshot comparison more flexible

https://github.com/nodejs/node/pull/54375

* test: do not set concurrency on parallelized runs

https://github.com/nodejs/node/pull/52177

* src: move FromNamespacedPath to path.cc

https://github.com/nodejs/node/pull/53540

* test: adapt to new V8 trusted memory spaces

https://github.com/nodejs/node/pull/50115

* build: add option to enable clang-cl on Windows

https://github.com/nodejs/node/pull/52870

* chore: fixup patch indices

* chore: add/remove changed files

* esm: drop support for import assertions

https://github.com/nodejs/node/pull/54890

* build: compile with C++20 support

https://github.com/nodejs/node/pull/52838

* deps: update nghttp2 to 1.62.1

https://github.com/nodejs/node/pull/52966

* src: parse inspector profiles with simdjson

https://github.com/nodejs/node/pull/51783

* build: add GN build files

https://github.com/nodejs/node/pull/47637

* deps,lib,src: add experimental web storage

https://github.com/nodejs/node/pull/52435

* build: add missing BoringSSL dep

* src: rewrite task runner in c++

https://github.com/nodejs/node/pull/52609

* fixup! build: add GN build files

* src: stop using deprecated fields of v8::FastApiCallbackOptions

https://github.com/nodejs/node/pull/54077

* fix: shadow variable

* build: add back incorrectly removed SetAccessor patch

* fixup! fixup! build: add GN build files

* crypto: fix integer comparison in crypto for BoringSSL

* src,lib: reducing C++ calls of esm legacy main resolve

https://github.com/nodejs/node/pull/48325

* src: move more crypto_dh.cc code to ncrypto

https://github.com/nodejs/node/pull/54459

* chore: fixup GN files for previous commit

* src: move more crypto code to ncrypto

https://github.com/nodejs/node/pull/54320

* Fixup Perfetto ifdef guards

* fix: missing electron_natives dep

* fix: node_use_node_platform = false

* fix: include src/node_snapshot_stub.cc in libnode

* 5507047: [import-attributes] Remove support for import assertions

https://chromium-review.googlesource.com/c/v8/v8/+/5507047

* fix: restore v8-sandbox.h in filenames.json

* fix: re-add original-fs generation logic

* fix: ngtcp2 openssl dep

* test: try removing NAPI_VERSION undef

* chore(deps): bump @types/node

* src: move more crypto_dh.cc code to ncrypto

https://github.com/nodejs/node/pull/54459

* esm: remove unnecessary toNamespacedPath calls

https://github.com/nodejs/node/pull/53656

* buffer: fix out of range for toString

https://github.com/nodejs/node/pull/54553

* lib: rewrite AsyncLocalStorage without async_hooks

https://github.com/nodejs/node/pull/48528

* module: print amount of load time of a cjs module

https://github.com/nodejs/node/pull/52213

* test: skip reproducible snapshot test on 32-bit

https://github.com/nodejs/node/pull/53592

* fixup! src: move more crypto_dh.cc code to ncrypto

* test: adjust emittedUntil return type

* chore: remove redundant wpt streams patch

* fixup! chore(deps): bump @types/node

* fix: gn executable name on Windows

* fix: build on Windows

* fix: rename conflicting win32 symbols in //third_party/sqlite

On Windows otherwise we get:

lld-link: error: duplicate symbol: sqlite3_win32_write_debug
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:47987
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_sleep
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48042
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_is_nt
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48113
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_utf8_to_unicode
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48470
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_unicode_to_utf8
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48486
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_mbcs_to_utf8
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48502
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_mbcs_to_utf8_v2
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48518
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_utf8_to_mbcs
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48534
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

lld-link: error: duplicate symbol: sqlite3_win32_utf8_to_mbcs_v2
>>> defined at .\..\..\third_party\electron_node\deps\sqlite\sqlite3.c:48550
>>>            obj/third_party/electron_node/deps/sqlite/sqlite/sqlite3.obj
>>> defined at obj/third_party/sqlite\chromium_sqlite3/sqlite3_shim.obj

* docs: remove unnecessary ts-expect-error after types bump

* src: move package resolver to c++

https://github.com/nodejs/node/pull/50322

* build: set ASAN detect_container_overflow=0

https://github.com/nodejs/node/issues/55584

* chore: fixup rebase

* test: disable failing ASAN test

* win: almost fix race detecting ESRCH in uv_kill

https://github.com/libuv/libuv/pull/4341
2024-11-04 13:41:56 -05:00
Shelley Vohr 15151c6853 fix: EventSource undefined in Renderer/Worker (#44475) 2024-10-31 15:24:44 -04:00
Samuel Attard 122685194a build: add import/order eslint rule (#44085)
* build: add import/order eslint rule

* chore: run lint:js --fix
2024-10-02 19:10:44 -07:00
Shelley Vohr 4aa9070e6c fix: missing fetch-dependent interfaces in Node.js (#42419)
fix: missing fetch-dependent interfaces in Node.js
2024-06-11 16:59:53 -05:00
653d0f009e chore: bump node to v20.13.1 (main) (#42088)
* chore: bump node in DEPS to v20.13.0

* crypto: enable NODE_EXTRA_CA_CERTS with BoringSSL

https://github.com/nodejs/node/pull/52217

* test: skip test for dynamically linked OpenSSL

https://github.com/nodejs/node/pull/52542

* lib, url: add a `windows` option to path parsing

https://github.com/nodejs/node/pull/52509

* src: use dedicated routine to compile function for builtin CJS loader

https://github.com/nodejs/node/pull/52016

* test: mark test as flaky

https://github.com/nodejs/node/pull/52671

* build,tools: add test-ubsan ci

https://github.com/nodejs/node/pull/46297

* src: preload function for Environment

https://github.com/nodejs/node/pull/51539

* chore: fixup patch indices

* deps: update c-ares to 1.28.1

https://github.com/nodejs/node/pull/52285

* chore: handle updated filenames

- https://github.com/nodejs/node/pull/51999
- https://github.com/nodejs/node/pull/51927

* chore: bump node in DEPS to v20.13.1

* events: extract addAbortListener for safe internal use

https://github.com/nodejs/node/pull/52081

* module: print location of unsettled top-level await in entry points

https://github.com/nodejs/node/pull/51999

* fs: add stacktrace to fs/promises

https://github.com/nodejs/node/pull/49849

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2024-05-13 11:43:14 -04:00
7120c58297 chore: bump node to v20.12.2 (main) (#41710)
* chore: bump node in DEPS to v20.12.0

* chore: update build_add_gn_build_files.patch

* chore: update patches

* chore: bump node in DEPS to v20.12.1

* chore: update patches

* build: encode non-ASCII Latin1 characters as one byte in JS2C

https://github.com/nodejs/node/pull/51605

* crypto: use EVP_MD_fetch and cache EVP_MD for hashes

https://github.com/nodejs/node/pull/51034

* chore: update filenames.json

* chore: bump node in DEPS to v20.12.2

* chore: update patches

* src: support configurable snapshot

https://github.com/nodejs/node/pull/50453

* test: remove test-domain-error-types flaky designation

https://github.com/nodejs/node/pull/51717

* src: avoid draining platform tasks at FreeEnvironment

https://github.com/nodejs/node/pull/51290

* chore: fix accidentally deleted v8 dep

* lib: define FormData and fetch etc. in the built-in snapshot

https://github.com/nodejs/node/pull/51598

* chore: rebase on main

* chore: remove stray log

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Cheng <zcbenz@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2024-04-17 12:39:13 -04:00
Shelley Vohr 040acaaf30 fix: support withFileTypes in fs.{readdir|readdirSync} (#41627)
fix: support withFileTypes in fs.{readdir|readdirSync}
2024-03-21 10:22:40 -04:00
Shelley Vohr b02918883f fix: support recursive readdir in Asar files (#41582) 2024-03-19 11:10:14 +01:00
Milan Burda dac29f9949 refactor: type-safe module imports / requires (#41192) 2024-02-05 16:36:28 +09:00
Milan Burda fb88375ab4 refactor: type-safe imports in lib/node/init.ts (#41148) 2024-01-31 08:38:56 +09:00
Cheng Zhao db2bf1a0d1 fix: apply module search paths restriction on worker and child process (#41118) 2024-01-26 17:29:04 +09:00
Cheng Zhao d13a93fb61 chore: remove node patches by using the preload feature (#41080) 2024-01-24 09:54:32 -06:00