deno/cli/ops/mod.rs
Aaron O'Mullan 4208199490
cleanup(cli): use op Extensions (#13223)
Enabling op-middleware for overrides in lieu of imperative .replace_op() etc...

Impacts #13219,  #12938, #13122
2021-12-29 14:30:08 +01:00

30 lines
609 B
Rust

// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::proc_state::ProcState;
use deno_core::Extension;
mod errors;
mod runtime_compiler;
pub mod testing;
pub fn cli_exts(ps: ProcState, enable_compiler: bool) -> Vec<Extension> {
if enable_compiler {
vec![
init_proc_state(ps),
errors::init(),
runtime_compiler::init(),
]
} else {
vec![init_proc_state(ps), errors::init()]
}
}
fn init_proc_state(ps: ProcState) -> Extension {
Extension::builder()
.state(move |state| {
state.put(ps.clone());
Ok(())
})
.build()
}