From b657d743a22802b8232fbf558f2f00bf2942096f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 20 Sep 2020 01:17:35 +0200 Subject: 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" --- cli/ops/plugin.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cli/ops/plugin.rs') diff --git a/cli/ops/plugin.rs b/cli/ops/plugin.rs index e0081ce09..c862fb674 100644 --- a/cli/ops/plugin.rs +++ b/cli/ops/plugin.rs @@ -1,6 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use crate::metrics::metrics_op; +use crate::permissions::Permissions; use deno_core::error::AnyError; use deno_core::plugin_api; use deno_core::BufVec; @@ -39,9 +40,10 @@ pub fn op_open_plugin( let args: OpenPluginArgs = serde_json::from_value(args)?; let filename = PathBuf::from(&args.filename); - let cli_state = super::cli_state(state); + let cli_state = super::global_state(state); cli_state.check_unstable("Deno.openPlugin"); - cli_state.check_plugin(&filename)?; + let permissions = state.borrow::(); + permissions.check_plugin(&filename)?; debug!("Loading Plugin: {:#?}", filename); let plugin_lib = Library::open(filename).map(Rc::new)?; -- cgit v1.2.3