Summary:
Fixes a bug where symlinks beginning with indirections (../) may fail to traverse in some projectRoot / watchFolders configurations.
This occurs due to incomplete "normalisation" of a symlink target in metro-file-map, relative to the project root. Given a project root of /project and a symlink /project/src/link-to-foo -> ../../project/foo.js, we would normalise the target to ../project/foo.js rather than simply foo.js - we were not taking into account that further normalisation could be possible after joining with projectRoot.
"Normal" paths are defined as being fully normalised relative to the project root. The unnecessary indirection out and back into the project root fails because TreeFS is a DAG, and internally there is no entry for rootNode.get('..').get('project') - this would be a cycle back to rootNode.
Changelog:
* **[Fix]:** Symlinks with indirections may not be resolvable
Summary: Fixes a bug where symlinks beginning with indirections (
../
) may fail to traverse in someprojectRoot
/watchFolders
configurations.This occurs due to incomplete "normalisation" of a symlink target in
metro-file-map
, relative to the project root. Given a project root of/project
and a symlink/project/src/link-to-foo -> ../../project/foo.js
, we would normalise the target to../project/foo.js
rather than simplyfoo.js
- we were not taking into account that further normalisation could be possible after joining withprojectRoot
."Normal" paths are defined as being fully normalised relative to the project root. The unnecessary indirection out and back into the project root fails because
TreeFS
is a DAG, and internally there is no entry forrootNode.get('..').get('project')
- this would be a cycle back torootNode
.Changelog:
Differential Revision: D49323614