Repository navigation
Conversation
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.
This adds an opt-in way for
file()to resolve paths inside a monorepo package's subdirectory, using the manifest'srepository.directory.Changes
fromManifest()takes a newuseDirectoryoption. When it'strueandrepository.directoryis a string, that value is passed on as thedirectoryoption. It defaults tofalse, so existing consumers keep getting repository-root URLs.fromUrl()andfile()take a newdirectoryoption.file()resolvespathrelative to it. Other methods (browse(),https(), etc.) are not affected..segments are removed, and/means the repository root.directoryis ignored.directorytofile()overrides the instance's value, so{ directory: '' }gives the repository root.directorythat contains a..segment is ignored completely.repository.directorycomes from untrusted manifests, so a value like../../other/repocould otherwise make the URL point at a different repository. Segments that only contain.., such as..foo, are kept.useDirectoryinstance is never shared with the default one.Notes
This is independent of #, which url-encodes
file()paths. Whichever PR lands second will have a small conflict infile(): the directory prefix should be applied first, andencodePathrun on the combined path. Once both have landed, I'll add tests that directory segments are url-encoded and that lone surrogates indirectorydon't throw.