Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(vendor): ignore import map in output directory instead of erroring #14998

Merged
merged 7 commits into from
Jun 30, 2022

Conversation

dsherret
Copy link
Member

This ignores an import map specified in the output directory instead of erroring.

Closes #14899

cli/args/mod.rs Outdated
@@ -122,6 +122,14 @@ impl RootConfig {
)
}

/// Removes the import map from the configuration.
pub fn remove_import_map(&mut self) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh? This seems a bit strange to me, we are we modifying configuration from the process?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to ensure that the import map is not used for anything. An easy way to do that is to modify this configuration to not specify it and then use this mutated configuration that doesn't specify an import map to build everything.

Actually, maybe RootOptions might have been a better name than RootConfig?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change this name to clear_import_map

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to ensure that the import map is not used for anything. An easy way to do that is to modify this configuration to not specify it and then use this mutated configuration that doesn't specify an import map to build everything.

Ok 👍

Actually, maybe RootOptions might have been a better name than RootConfig?

Yes, I think that might be a better name. Maybe CliOptions would be better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that might be a better name. Maybe CliOptions would be better?

Ok, I like CliOptions. I can do another PR after this one that renames it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see when I go to work on it. I don't think it's necessary, but this was a decent stepping stone.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, one nice thing about doing it lazily is that we can surface errors only when necessary and can ignore errors in certain scenarios. For example, only displaying task errors when running a deno task or when using watch we could display an error about a certain part not working, but still continue execution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that indeed seems interesting, but I'm worried about potential can of worms we could open. I'll leave it to you to make the decision.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already works lazily. Changing it to not be lazy could open a can of worms of more errors happening.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartlomieju I added an "overrides" instead of clearing out the underlying structure. Let me know if this looks better than before.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -44,13 +44,19 @@ use crate::file_fetcher::CacheSetting;
use crate::lockfile::Lockfile;
use crate::version;

#[derive(Default)]
struct CliOptionOverrides {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good 👍 could use a doctring

@dsherret dsherret merged commit e46584a into denoland:main Jun 30, 2022
@dsherret dsherret deleted the fix_ignore_import_map branch June 30, 2022 00:41
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot update the vendored modules when import map is in output directory
2 participants