summaryrefslogtreecommitdiff
path: root/cli/npm/registry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/npm/registry.rs')
-rw-r--r--cli/npm/registry.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/npm/registry.rs b/cli/npm/registry.rs
index bcdada30d..75760c171 100644
--- a/cli/npm/registry.rs
+++ b/cli/npm/registry.rs
@@ -232,6 +232,13 @@ impl NpmRegistryApi {
}))
}
+ /// Creates an npm registry API that will be uninitialized
+ /// and error for every request. This is useful for tests
+ /// or for initializing the LSP.
+ pub fn new_uninitialized() -> Self {
+ Self(Arc::new(NullNpmRegistryApiInner))
+ }
+
#[cfg(test)]
pub fn new_for_test(api: TestNpmRegistryApiInner) -> NpmRegistryApi {
Self(Arc::new(api))
@@ -294,6 +301,13 @@ impl NpmRegistryApi {
self.0.clear_memory_cache();
}
+ pub fn get_cached_package_info(
+ &self,
+ name: &str,
+ ) -> Option<Arc<NpmPackageInfo>> {
+ self.0.get_cached_package_info(name)
+ }
+
pub fn base_url(&self) -> &Url {
self.0.base_url()
}