mirror of
https://github.com/denoland/deno.git
synced 2025-01-19 20:26:20 -05:00
0b033140c0
As title. After this PR all npm resolution will be out of the CLI crate.
32 lines
947 B
Rust
32 lines
947 B
Rust
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
|
|
use std::sync::Arc;
|
|
|
|
use deno_core::serde_json;
|
|
use deno_resolver::npm::ByonmNpmResolver;
|
|
use deno_resolver::npm::ByonmNpmResolverCreateOptions;
|
|
use deno_runtime::ops::process::NpmProcessStateProvider;
|
|
|
|
use crate::args::NpmProcessState;
|
|
use crate::args::NpmProcessStateKind;
|
|
use crate::sys::CliSys;
|
|
|
|
pub type CliByonmNpmResolverCreateOptions =
|
|
ByonmNpmResolverCreateOptions<CliSys>;
|
|
pub type CliByonmNpmResolver = ByonmNpmResolver<CliSys>;
|
|
|
|
#[derive(Debug)]
|
|
pub struct CliByonmNpmProcessStateProvider(pub Arc<CliByonmNpmResolver>);
|
|
|
|
impl NpmProcessStateProvider for CliByonmNpmProcessStateProvider {
|
|
fn get_npm_process_state(&self) -> String {
|
|
serde_json::to_string(&NpmProcessState {
|
|
kind: NpmProcessStateKind::Byonm,
|
|
local_node_modules_path: self
|
|
.0
|
|
.root_node_modules_path()
|
|
.map(|p| p.to_string_lossy().to_string()),
|
|
})
|
|
.unwrap()
|
|
}
|
|
}
|