mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
refactor(ext/node): allow injecting NodeFs
from CLI (#18829)
This allows providing a `NodeFs` as part of the `WorkerOptions`.
This commit is contained in:
parent
bb74e75a04
commit
aa286fdecb
24 changed files with 1631 additions and 1687 deletions
|
@ -4,7 +4,6 @@ use crate::args::CliOptions;
|
|||
use crate::args::Flags;
|
||||
use crate::args::TaskFlags;
|
||||
use crate::colors;
|
||||
use crate::node::CliNodeResolver;
|
||||
use crate::npm::CliNpmResolver;
|
||||
use crate::proc_state::ProcState;
|
||||
use crate::util::fs::canonicalize_path;
|
||||
|
@ -13,7 +12,7 @@ use deno_core::anyhow::Context;
|
|||
use deno_core::error::AnyError;
|
||||
use deno_core::futures;
|
||||
use deno_core::futures::future::LocalBoxFuture;
|
||||
use deno_runtime::deno_node::RealFs;
|
||||
use deno_runtime::deno_node::NodeResolver;
|
||||
use deno_semver::npm::NpmPackageNv;
|
||||
use deno_task_shell::ExecuteResult;
|
||||
use deno_task_shell::ShellCommand;
|
||||
|
@ -236,13 +235,12 @@ impl ShellCommand for NpmPackageBinCommand {
|
|||
|
||||
fn resolve_npm_commands(
|
||||
npm_resolver: &CliNpmResolver,
|
||||
node_resolver: &CliNodeResolver,
|
||||
node_resolver: &NodeResolver,
|
||||
) -> Result<HashMap<String, Rc<dyn ShellCommand>>, AnyError> {
|
||||
let mut result = HashMap::new();
|
||||
let snapshot = npm_resolver.snapshot();
|
||||
for id in snapshot.top_level_packages() {
|
||||
let bin_commands =
|
||||
node_resolver.resolve_binary_commands::<RealFs>(&id.nv)?;
|
||||
let bin_commands = node_resolver.resolve_binary_commands(&id.nv)?;
|
||||
for bin_command in bin_commands {
|
||||
result.insert(
|
||||
bin_command.to_string(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue