mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
--vfs-mount mounted a source without running it, and shared one ordered list of sources with --vfs-load, so neither option could say which entry it had contributed: the entry point was recovered from the position of --vfs-load among the mounts, in a list NODE_OPTIONS could prepend to. Nothing needs more than one mount from the command line: a program that wants more can mount them itself through node:vfs, where it also gets the instance. Remove --vfs-mount, leaving --vfs-load with the single source it mounts and runs, and reserve layer 0 for that source, numbering the file systems a program mounts itself from 1. The source is then at the same mount point in every thread, whatever else that thread mounts - including a thread where a --require preload mounted a file system of its own first - so a path into it stays valid in a worker. A worker still does not run that entry point: it inherits the source but not the decision to load from it. A worker created with its own execArgv inherits neither, so the documentation now says that such a worker must be given --experimental-vfs and --vfs-load again to run a script from the mount, and that --experimental-vfs is also what makes node:vfs available to the worker's own code. ERR_VFS_INVALID_TARGET now names --vfs-load as the source's origin, and the startup test moves to test-vfs-load.js, with the cases that covered mounting without loading removed and cases for the reserved mount point added. Signed-off-by: Philipp Dunkel <pip@pipobscure.com> PR-URL: https://github.com/nodejs/node/pull/66162 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>