The install keeps a package's links to its own content as links in an
injected copy, following the importer's rules: a link to an imported
path is recreated, a link to a file the import leaves out becomes that
file, and a link to any other directory is left out. The sync after a
script listed in syncInjectedDepsAfterScripts, and the edit watcher,
followed links instead:
- v12: a directory link the script added became a real directory, and
under deployAllFiles it went missing.
- v11: the same materializing in packlist mode, and the sync failed on
a copy that links to one directory twice (EEXIST) or links back to an
ancestor (ELOOP). v11's walk of every file also had no cycle guard,
so an install with deployAllFiles failed on such a link.
Both syncers now read the source with the install's symlink policy and
the copy without following links, record a link by the package-relative
path it points at, and recreate it with the importer's rules. v12 moves
relative_link_target and symlink_file_or_copy from the importer into
pnpm-fs to share them. v11 exports internalSymlinkTarget and
copyInternalSymlink from fs.indexed-pkg-importer, and adds a
preserveSymlinks option and an ancestor guard to the directory
fetcher's walk.
v11's install under deployAllFiles still materializes directory links,
where v12 keeps them. Each sync matches its own install.
Part of pnpm/tasks#147.