if (
              // Add the root only if the target is the root or we have
              // collapsed segments.
              i > 0 ||
              normalSymlinkTarget.ancestorOfRootIdx === 0 ||
              joinedResult.collapsedSegments > 0
            ) {
              reverseAncestors.push({
                ancestorOfRootIdx: i,
                node,
                normalPath: collapsedPath,
                segmentName: this.#pathUtils.getBasenameOfNthAncestor(i),
              });
            }
The core traversal algorithm of TreeFS - takes a normal path and traverses
through a tree of maps keyed on path segments, returning the node,
canonical path, and other metadata if successful, or the first missing
segment otherwise.

When a symlink is encountered, we set a new target of the symlink's
normalised target path plus the remainder of the original target path. In
this way, the eventual target path in a successful lookup has all symlinks
resolved, and gives us the real path "for free". Similarly if a traversal
fails, we automatically have the real path of the first non-existent node.

Note that this code is extremely hot during resolution, being the most
expensive part of a file existence check. Benchmark any modifications!