Skip to content

Commit

Permalink
remove resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn committed Feb 5, 2025
1 parent 1f6fb4e commit 04b1c9d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2,849 deletions.
40 changes: 1 addition & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ serde_json = "1.0.85"
url = { version = "2.3.1" }
import_map = { version = "0.21.0", features = ["ext"], optional = true }
thiserror = "2"
dashmap = "5.5.3"
deno_error = { version = "0.5.3", features = ["url"] }
deno_media_type = { version = "0.2.5", features = ["url"] }
boxed_error = "0.2.3"
deno_semver = { version = "0.7.1", optional = true }
deno_package_json = { version = "0.4.0", optional = true }
Expand Down
62 changes: 9 additions & 53 deletions src/workspace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,21 @@ use crate::sync::new_rc;
use crate::UrlToFilePathError;

mod discovery;
mod resolver;

pub use resolver::sloppy_imports_resolve;
pub use resolver::CreateResolverOptions;
pub use resolver::FsCacheOptions;
pub use resolver::MappedResolution;
pub use resolver::MappedResolutionDiagnostic;
pub use resolver::MappedResolutionError;
pub use resolver::PackageJsonDepResolution;
pub use resolver::ResolutionKind;
pub use resolver::ResolverWorkspaceJsrPackage;
pub use resolver::SloppyImportsOptions;
pub use resolver::SloppyImportsResolutionReason;
pub use resolver::SpecifiedImportMap;
pub use resolver::WorkspaceResolvePkgJsonFolderError;
pub use resolver::WorkspaceResolvePkgJsonFolderErrorKind;
pub use resolver::WorkspaceResolver;
pub use resolver::WorkspaceResolverCreateError;
pub use resolver::WorkspaceResolverDiagnostic;

#[allow(clippy::disallowed_types)]
type UrlRc = crate::sync::MaybeArc<Url>;
#[allow(clippy::disallowed_types)]
type WorkspaceRc = crate::sync::MaybeArc<Workspace>;

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ResolverWorkspaceJsrPackage {
pub base: Url,
pub name: String,
pub version: Option<Version>,
pub exports: IndexMap<String, String>,
pub is_patch: bool,
}

#[derive(Debug, Clone)]
pub struct JsrPackageConfig {
/// The package name.
Expand Down Expand Up @@ -564,14 +554,6 @@ impl Workspace {
})
}

pub fn create_resolver<TSys: FsMetadata + FsRead>(
&self,
sys: TSys,
options: CreateResolverOptions,
) -> Result<WorkspaceResolver<TSys>, WorkspaceResolverCreateError> {
WorkspaceResolver::from_workspace(self, sys, options)
}

/// Resolves a workspace directory, which can be used for deriving
/// configuration specific to a member.
pub fn resolve_member_dir(
Expand Down Expand Up @@ -2737,32 +2719,6 @@ pub mod test {
.unwrap(),
}]
);
let resolver = workspace_dir
.workspace
.create_resolver(UnreachableSys, Default::default())
.unwrap();
assert_eq!(
serde_json::from_str::<serde_json::Value>(
&resolver.maybe_import_map().unwrap().to_json()
)
.unwrap(),
json!({
"imports": {
"@scope/pkg": "jsr:@scope/pkg@1",
"@scope/pkg/": "jsr:/@scope/pkg@1/"
},
"scopes": {
"https://deno.land/x/": {
"@scope/pkg": "jsr:@scope/pkg@2",
"@scope/pkg/": "jsr:/@scope/pkg@2/"
},
"./member/": {
"@scope/pkg": "jsr:@scope/pkg@3",
"@scope/pkg/": "jsr:/@scope/pkg@3/"
}
}
})
);
}

#[test]
Expand Down
Loading

0 comments on commit 04b1c9d

Please sign in to comment.