2022-01-07 22:09:52 -05:00
|
|
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
2019-08-14 11:03:02 -04:00
|
|
|
|
2021-12-29 08:30:08 -05:00
|
|
|
use crate::proc_state::ProcState;
|
|
|
|
use deno_core::Extension;
|
|
|
|
|
|
|
|
mod errors;
|
|
|
|
mod runtime_compiler;
|
2021-04-28 14:17:04 -04:00
|
|
|
pub mod testing;
|
2020-09-10 09:57:45 -04:00
|
|
|
|
2021-12-29 08:30:08 -05:00
|
|
|
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()
|
|
|
|
}
|