summaryrefslogtreecommitdiff
path: root/cli/npm/common.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-06-08 20:05:28 -0400
committerGitHub <noreply@github.com>2024-06-08 20:05:28 -0400
commit31154ff95899166a2535fc859c1fca2cbf19d422 (patch)
tree1497c08b1c88e271c48d19539b6d619b4db82cb9 /cli/npm/common.rs
parent32f5b4808ef7591401b46ea5bb3d680c18dedf20 (diff)
fix(check): attempt to resolve types from pkg before `@types` pkg (#24152)
I've been meaning to fix this for ages, but I finally ran into it here: https://github.com/dsherret/ts-ast-viewer/actions/runs/9432038675/job/25981325408 We need to resolve the `@types` package as a fallback instead of eagerly resolving it.
Diffstat (limited to 'cli/npm/common.rs')
-rw-r--r--cli/npm/common.rs22
1 files changed, 0 insertions, 22 deletions
diff --git a/cli/npm/common.rs b/cli/npm/common.rs
index bf45aa5b8..c55f73cd5 100644
--- a/cli/npm/common.rs
+++ b/cli/npm/common.rs
@@ -3,14 +3,6 @@
use deno_npm::npm_rc::RegistryConfig;
use reqwest::header;
-/// Gets the corresponding @types package for the provided package name.
-pub fn types_package_name(package_name: &str) -> String {
- debug_assert!(!package_name.starts_with("@types/"));
- // Scoped packages will get two underscores for each slash
- // https://github.com/DefinitelyTyped/DefinitelyTyped/tree/15f1ece08f7b498f4b9a2147c2a46e94416ca777#what-about-scoped-packages
- format!("@types/{}", package_name.replace('/', "__"))
-}
-
// TODO(bartlomieju): support more auth methods besides token and basic auth
pub fn maybe_auth_header_for_npm_registry(
registry_config: &RegistryConfig,
@@ -31,17 +23,3 @@ pub fn maybe_auth_header_for_npm_registry(
None
}
-
-#[cfg(test)]
-mod test {
- use super::types_package_name;
-
- #[test]
- fn test_types_package_name() {
- assert_eq!(types_package_name("name"), "@types/name");
- assert_eq!(
- types_package_name("@scoped/package"),
- "@types/@scoped__package"
- );
- }
-}