-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a --pkg-importer
flag
#2169
Conversation
/// The list of built-in importers to use to load `pkg:` URLs. | ||
List<Importer> get pkgImporters => [ | ||
for (var _ in _options['pkg-importer'] as List<String>) | ||
NodePackageImporter('.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better if the entry point dir is customizable. E.g. --node-pkg-importer=/entrypoint/dir
and maybe implicitly use pwd if not directory is not provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would only ever be relevant when resolving a pkg:
importer from stdin, at which point I think it's easy enough to just change the CWD of the executable if it really matters. Adding an additional flag for it is pretty heavyweight, so I'd like to avoid it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe clarify that this is PWD based in the help
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is that tomorrow if we have another --pkg-importer=x
and user may want to have both --pkg-importer=node
and --pkg-importer=x
. In theory it's fine to have more than one pkg importer, that they should be attempted in order just like other importers. While it is ok to repeat the --pkg-importer
option, but at the same time, it is a bit confusing whether it means overriding previous option or repeating the same option with different parameters, that's why I thought --node-pkg-importer
might be better than --pkg-importer=node
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe this should be a list option e.g. --pkg-importer=node,x,y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was intended to be a list option. Having it that way, rather than separate named options, allows users to explicitly specify the order of multiple built-in pkg:
importers, which I think is important.
See sass/sass#2739