summaryrefslogtreecommitdiff
path: root/cli/npm
diff options
context:
space:
mode:
Diffstat (limited to 'cli/npm')
-rw-r--r--cli/npm/byonm.rs20
-rw-r--r--cli/npm/managed/mod.rs34
-rw-r--r--cli/npm/mod.rs3
3 files changed, 27 insertions, 30 deletions
diff --git a/cli/npm/byonm.rs b/cli/npm/byonm.rs
index da36e3b53..469f98828 100644
--- a/cli/npm/byonm.rs
+++ b/cli/npm/byonm.rs
@@ -82,6 +82,16 @@ impl ByonmCliNpmResolver {
}
impl NpmResolver for ByonmCliNpmResolver {
+ fn get_npm_process_state(&self) -> String {
+ serde_json::to_string(&NpmProcessState {
+ kind: NpmProcessStateKind::Byonm,
+ local_node_modules_path: Some(
+ self.root_node_modules_dir.to_string_lossy().to_string(),
+ ),
+ })
+ .unwrap()
+ }
+
fn resolve_package_folder_from_package(
&self,
name: &str,
@@ -248,16 +258,6 @@ impl CliNpmResolver for ByonmCliNpmResolver {
)
}
- fn get_npm_process_state(&self) -> String {
- serde_json::to_string(&NpmProcessState {
- kind: NpmProcessStateKind::Byonm,
- local_node_modules_path: Some(
- self.root_node_modules_dir.to_string_lossy().to_string(),
- ),
- })
- .unwrap()
- }
-
fn check_state_hash(&self) -> Option<u64> {
// it is very difficult to determine the check state hash for byonm
// so we just return None to signify check caching is not supported
diff --git a/cli/npm/managed/mod.rs b/cli/npm/managed/mod.rs
index d59b81912..6cf7e6a32 100644
--- a/cli/npm/managed/mod.rs
+++ b/cli/npm/managed/mod.rs
@@ -492,6 +492,23 @@ impl ManagedCliNpmResolver {
}
impl NpmResolver for ManagedCliNpmResolver {
+ /// Gets the state of npm for the process.
+ fn get_npm_process_state(&self) -> String {
+ serde_json::to_string(&NpmProcessState {
+ kind: NpmProcessStateKind::Snapshot(
+ self
+ .resolution
+ .serialized_valid_snapshot()
+ .into_serialized(),
+ ),
+ local_node_modules_path: self
+ .fs_resolver
+ .node_modules_path()
+ .map(|p| p.to_string_lossy().to_string()),
+ })
+ .unwrap()
+ }
+
fn resolve_package_folder_from_package(
&self,
name: &str,
@@ -571,23 +588,6 @@ impl CliNpmResolver for ManagedCliNpmResolver {
self.resolve_pkg_folder_from_pkg_id(&pkg_id)
}
- /// Gets the state of npm for the process.
- fn get_npm_process_state(&self) -> String {
- serde_json::to_string(&NpmProcessState {
- kind: NpmProcessStateKind::Snapshot(
- self
- .resolution
- .serialized_valid_snapshot()
- .into_serialized(),
- ),
- local_node_modules_path: self
- .fs_resolver
- .node_modules_path()
- .map(|p| p.to_string_lossy().to_string()),
- })
- .unwrap()
- }
-
fn check_state_hash(&self) -> Option<u64> {
// We could go further and check all the individual
// npm packages, but that's probably overkill.
diff --git a/cli/npm/mod.rs b/cli/npm/mod.rs
index c9f261ccd..f4ea08186 100644
--- a/cli/npm/mod.rs
+++ b/cli/npm/mod.rs
@@ -83,9 +83,6 @@ pub trait CliNpmResolver: NpmResolver {
referrer: &ModuleSpecifier,
) -> Result<PathBuf, AnyError>;
- /// Gets the state of npm for the process.
- fn get_npm_process_state(&self) -> String;
-
/// Returns a hash returning the state of the npm resolver
/// or `None` if the state currently can't be determined.
fn check_state_hash(&self) -> Option<u64>;