summaryrefslogtreecommitdiff
path: root/cli/file_fetcher.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-09-22 16:39:58 +0200
committerGitHub <noreply@github.com>2022-09-22 10:39:58 -0400
commit9a216806d514b5f41c73c777010572cdf3c51eab (patch)
tree3bc96c287936bc75b37add644944507c0f8ccf6b /cli/file_fetcher.rs
parent06c77a30f9c00a562ff2a34b96fe828e0d29a33f (diff)
feat(npm): add support for --reload=npm: and --reload=npm:<package> (#15972)
Diffstat (limited to 'cli/file_fetcher.rs')
-rw-r--r--cli/file_fetcher.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs
index 3e3776f24..e16b808d9 100644
--- a/cli/file_fetcher.rs
+++ b/cli/file_fetcher.rs
@@ -146,6 +146,23 @@ impl CacheSetting {
}
}
}
+
+ pub fn should_use_for_npm_package(&self, package_name: &str) -> bool {
+ match self {
+ CacheSetting::ReloadAll => false,
+ CacheSetting::ReloadSome(list) => {
+ if list.contains(&"npm:".to_string()) {
+ return false;
+ }
+ let specifier = format!("npm:{}", package_name);
+ if list.contains(&specifier) {
+ return false;
+ }
+ true
+ }
+ _ => true,
+ }
+ }
}
/// Fetch a source file from the local file system.