Skip to content
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

Merged
merged 2 commits into from
Feb 12, 2024
Merged

Add a --pkg-importer flag #2169

merged 2 commits into from
Feb 12, 2024

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Feb 7, 2024

@nex3 nex3 requested a review from jathak February 7, 2024 01:30
/// 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('.')
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor

@ntkme ntkme Feb 7, 2024

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.

Copy link
Contributor

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

Copy link
Contributor Author

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.

@nex3 nex3 merged commit 00571ec into main Feb 12, 2024
34 checks passed
@nex3 nex3 deleted the pkg-importer-flag branch February 12, 2024 23:57
lmeysel pushed a commit to lmeysel/dart-sass that referenced this pull request Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants