Skip to content

Commit 3dcd62c

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 24aa85a commit 3dcd62c

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
@@ -220,6 +220,13 @@ The VFS supports the `node:fs` operations for reading files and directories.
220220
Since the SEA VFS is read-only, write operations fail with `EROFS`. See the
221221
[VFS documentation][] for the full list of supported operations.
222222

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

225232
When `useVfs` is enabled, the main script is executed from inside the
@@ -281,13 +288,6 @@ new Worker(path.join(__dirname, 'worker.js'));
281288
A virtual file system mounted with [`vfs.mount()`][] in one thread is not
282289
mounted in the others, so a worker cannot load a script from it.
283290
284-
`useVfs` does for a single executable application what [`--vfs-load`][] does
285-
for `node`: the entry point is its `"main"`, and modules resolve against its
286-
own files. `--vfs-load` therefore cannot be used in a single executable
287-
application: `--build-sea` rejects it in `"execArgv"`, and the executable
288-
rejects it at startup when it comes from `--node-options` or from the
289-
`execArgv` of a worker.
290-
291291
#### Serving the assets from a ZIP archive with `"vfsArchive"`
292292
293293
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
@@ -317,14 +317,8 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors,
317317
}
318318

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

0 commit comments

Comments
 (0)