mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 15:14:33 +00:00
refactor: remove CliState, use OpState, add CliModuleLoader (#7588)
- remove "CliState.workers" and "CliState.next_worker_id", instead store them on "OpState" using type aliases. - remove "CliState.global_timer" and "CliState.start_time", instead store them on "OpState" using type aliases. - remove "CliState.is_internal", instead pass it to Worker::new - move "CliState::permissions" to "OpState" - move "CliState::main_module" to "OpState" - move "CliState::global_state" to "OpState" - move "CliState::check_unstable()" to "GlobalState" - change "cli_state()" to "global_state()" - change "deno_core::ModuleLoader" trait to pass "OpState" to callbacks - rename "CliState" to "CliModuleLoader"
This commit is contained in:
parent
aaa5e6613a
commit
b657d743a2
30 changed files with 551 additions and 519 deletions
|
@ -114,9 +114,7 @@ where
|
|||
|
||||
{
|
||||
let state_ = state.borrow();
|
||||
// TODO(ry) The Rc below is a hack because we store Rc<CliState> in OpState.
|
||||
// Ideally it could be removed.
|
||||
let permissions = state_.borrow::<Rc<FP>>();
|
||||
let permissions = state_.borrow::<FP>();
|
||||
permissions.check_net_url(&url_)?;
|
||||
}
|
||||
|
||||
|
@ -221,9 +219,7 @@ where
|
|||
let args: CreateHttpClientOptions = serde_json::from_value(args)?;
|
||||
|
||||
if let Some(ca_file) = args.ca_file.clone() {
|
||||
// TODO(ry) The Rc below is a hack because we store Rc<CliState> in OpState.
|
||||
// Ideally it could be removed.
|
||||
let permissions = state.borrow::<Rc<FP>>();
|
||||
let permissions = state.borrow::<FP>();
|
||||
permissions.check_read(&PathBuf::from(ca_file))?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue