sea: mount bundled assets as a virtual file system
The Issue & Context
Node.js introduced a new SEA (Self-Extracting Archive) integration enabling bundled assets to be mounted as a read-only virtual file system (VFS) when the 'useVfs' option is enabled in the SEA configuration.
Root Cause Analysis
Previously, bundled assets could not be accessed transparently as a virtual file system, limiting how the main script and its dependencies could be executed and resolved within the SEA environment.
Solution Strategy & Architectural Pattern
The PR implements a SEAProvider that mounts bundled assets lazily as a read-only VFS at runtime, with no fixed mount path. The main script runs inside this mount, enabling __filename, __dirname, require(), and ESM imports to resolve relative to the virtual file system. Asset content is loaded on-demand from the SEA blob, and the system supports both CommonJS and ESM entry points while disallowing conflicting options like 'useSnapshot' or 'useCodeCache'.
Key Takeaway for Contributors
Mounting bundled assets as a virtual file system inside SEA improves modularity and runtime resolution of embedded resources, enabling seamless execution of main scripts and dependencies within a controlled, read-only environment without duplicating source files at build time.