Skip to content

Commit 77c4ffb

Browse files
committed
sea: address review comments
Remove two comments in EnvironmentOptions::CheckOptions() that repeat what the code and the error message already say, and move the note that --vfs-load cannot be used in a single executable application out of the "Worker threads" section, since it applies to every SEA. Refs: #67223 Assisted-by: a coding agent Signed-off-by: Manjeet Singh <024manjeetsingh@gmail.com>
1 parent c9abbb8 commit 77c4ffb

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

‎doc/api/single-executable-applications.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ The VFS supports the `node:fs` operations for reading files and directories.
223223
Since the SEA VFS is read-only, write operations fail with `EROFS`. See the
224224
[VFS documentation][] for the full list of supported operations.
225225

226+
`useVfs` does for a single executable application what [`--vfs-load`][] does
227+
for `node`: the entry point is its `"main"`, and modules resolve against its
228+
own files. `--vfs-load` therefore cannot be used in a single executable
229+
application, whether or not it uses `useVfs`: `--build-sea` rejects it in
230+
`"execArgv"`, and the executable rejects it at startup when it comes from
231+
`--node-options` or from the `execArgv` of a worker.
232+
226233
#### Loading modules from the VFS in a SEA
227234

228235
When `useVfs` is enabled, the main script is executed from inside the
@@ -284,13 +291,6 @@ new Worker(path.join(__dirname, 'worker.js'));
284291
A virtual file system mounted with [`vfs.mount()`][] in one thread is not
285292
mounted in the others, so a worker cannot load a script from it.
286293
287-
`useVfs` does for a single executable application what [`--vfs-load`][] does
288-
for `node`: the entry point is its `"main"`, and modules resolve against its
289-
own files. `--vfs-load` therefore cannot be used in a single executable
290-
application: `--build-sea` rejects it in `"execArgv"`, and the executable
291-
rejects it at startup when it comes from `--node-options` or from the
292-
`execArgv` of a worker.
293-
294294
#### Serving the assets from a ZIP archive with `"vfsArchive"`
295295
296296
Instead of listing individual `"assets"`, the configuration can point

‎src/node_options.cc‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,8 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors,
320320
}
321321

322322
#ifndef DISABLE_SINGLE_EXECUTABLE_APPLICATION
323-
// "useVfs" is the --vfs-load of a SEA, whichever provider serves the VFS,
324-
// and takes the mount point reserved for the --vfs-load source.
325323
sea_vfs = sea::IsSingleExecutable() &&
326324
sea::FindSingleExecutableResource().use_vfs();
327-
// The entry point of a SEA is its "main", and resolving modules against its
328-
// files is what "useVfs" does, so --vfs-load has nothing to do in any SEA.
329-
// Accepting it from --node-options would also let whoever runs the binary
330-
// change what it resolves, which is why it is disallowed in NODE_OPTIONS.
331325
if (!vfs_load_source.empty() && sea::IsSingleExecutable()) {
332326
errors->push_back(
333327
"--vfs-load cannot be used in a single executable application");

0 commit comments

Comments
 (0)