<aside> ⚠️
This document is shared externally.
</aside>
User Issue: Turbopack refuses to read files outside of the project root. This interferes with various tooling, including the pnpm global store and npm link.
Related GitHub Issues:
notify-rs to set up filesystem watchers.
inotify.ReadDirectoryChangesW with bWatchSubtree) and MacOS (FSEvent), it watches the entire project root.npm linked package without updating the package manager lockfile).FileSystem trait to to embed files inside of the Turbopack binary (e.g. for Turbopack’s JavaScript runtime) and to isolate output files from source code to prevent source code from depending on outputs in the .next directory (which could create a cycle and hang the compiler).DiskFileSystem::new_internal, so it acts as a cache key. The root path on-disk is stored inside of a Vc<_>, so only things reading that root path will be invalidated if the root path changes.DiskFileSystem aware of every other DiskFileSystem that is safe to navigate to (everything minus the output filesystem).
Vc<DiskFileSystemMap> inside of DiskFileSystem.
RwLock<Vc<DiskFileSystemMap>> or as a turbo_tasks::State<DiskFileSystemMap>DiskFileSystems in a PatriciaMap keyed by their canonicalized paths to allow quick lookup.FileSystemPath::join into separate sync and async APIs
FileSystemPath::join_child_path
Vc<DiskFileSystemMap>, returns a FileSystemPath."../" generates an error.FileSystemPath::join_relative_path
#[turbo_tasks::function], takes a non-Vc FileSystemPath as the self argument and returns a Vc<FileSystemPath>"../"Vc<DiskFileSystemMap>, so this should automatically invalidate if the map changes.Vcs, triggering the immutable task optimization in turbo-tasks.pnpm's default global store path in the default list of filesystem roots.
storeDir, it’s likely not practical for us to detect this automatically.npm link problem, but the user has to manually configure additional roots for Turbopack.
npm linking for temporary local development or debugging, so it should ideally work without much extra configuration.[project]/../../other-package/package.json, but to generate some loud warnings when this happens..cache/bazel or .local/share/pnpm/store might be excessively expensive.