fix(npm): correct package_store_prefix_len for links in external-repo sub-packages#2896
Open
ma-oli wants to merge 1 commit into
Open
fix(npm): correct package_store_prefix_len for links in external-repo sub-packages#2896ma-oli wants to merge 1 commit into
ma-oli wants to merge 1 commit into
Conversation
… sub-packages `_symlink_package_store` strips `package_store_prefix_len` characters from a dependency's `package_store_directory.short_path` to form the relative symlink target. The length omitted the "/" separators that follow the package path and the repo name, so for a link target in a non-root package of an external repository it stripped two characters too few. The leftover was the trailing "s/" of ".aspect_rules_js/", producing dangling symlinks such as `../../s/<pkg>@<ver>/node_modules/<pkg>` and `ERR_MODULE_NOT_FOUND` at runtime. In a root module the miscount is only one character and is masked by "//" path collapsing, so it surfaces only when a module's npm packages live in a sub-package (e.g. //frontend) and that module is consumed as an external dependency. Account for both separators: +1 after the package path and +1 after the repo name.
|
|
Member
|
Can you add a test reproducing the issue? I would think such an error would have been caught by now so there must be something unique going on here? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_symlink_package_storestripspackage_store_prefix_lencharacters from a dependency'spackage_store_directory.short_pathto form the relative symlink target. The length omitted the "/" separators that follow the package path and the repo name, so for a link target in a non-root package of an external repository it stripped two characters too few. The leftover was the trailing "s/" of ".aspect_rules_js/", producing dangling symlinks such as../../s/<pkg>@<ver>/node_modules/<pkg>andERR_MODULE_NOT_FOUNDat runtime.In a root module the miscount is only one character and is masked by "//" path collapsing, so it surfaces only when a module's npm packages live in a sub-package (e.g. //frontend) and that module is consumed as an external dependency.
Account for both separators: +1 after the package path and +1 after the repo name.
Changes are visible to end-users: yes/no
Test plan