diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/extensions.rs | 8 | ||||
-rw-r--r-- | core/lib.rs | 1 | ||||
-rw-r--r-- | core/plugin_api.rs | 22 |
3 files changed, 4 insertions, 27 deletions
diff --git a/core/extensions.rs b/core/extensions.rs index 9ad2b3697..e38d11fc9 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -24,7 +24,7 @@ impl Extension { /// returns JS source code to be loaded into the isolate (either at snapshotting, /// or at startup). as a vector of a tuple of the file name, and the source code. - pub(crate) fn init_js(&self) -> Vec<SourcePair> { + pub fn init_js(&self) -> Vec<SourcePair> { match &self.js_files { Some(files) => files.clone(), None => vec![], @@ -32,7 +32,7 @@ impl Extension { } /// Called at JsRuntime startup to initialize ops in the isolate. - pub(crate) fn init_ops(&mut self) -> Option<Vec<OpPair>> { + pub fn init_ops(&mut self) -> Option<Vec<OpPair>> { // TODO(@AaronO): maybe make op registration idempotent if self.initialized { panic!("init_ops called twice: not idempotent or correct"); @@ -43,7 +43,7 @@ impl Extension { } /// Allows setting up the initial op-state of an isolate at startup. - pub(crate) fn init_state(&self, state: &mut OpState) -> Result<(), AnyError> { + pub fn init_state(&self, state: &mut OpState) -> Result<(), AnyError> { match &self.opstate_fn { Some(ofn) => ofn(state), None => Ok(()), @@ -51,7 +51,7 @@ impl Extension { } /// init_middleware lets us middleware op registrations, it's called before init_ops - pub(crate) fn init_middleware(&mut self) -> Option<Box<OpMiddlewareFn>> { + pub fn init_middleware(&mut self) -> Option<Box<OpMiddlewareFn>> { self.middleware_fn.take() } } diff --git a/core/lib.rs b/core/lib.rs index 4e7345c40..1f75b0ee3 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -12,7 +12,6 @@ mod normalize_path; mod ops; mod ops_builtin; mod ops_json; -pub mod plugin_api; mod resources; mod runtime; diff --git a/core/plugin_api.rs b/core/plugin_api.rs deleted file mode 100644 index 9f37df6f3..000000000 --- a/core/plugin_api.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -// This file defines the public interface for dynamically loaded plugins. - -// The plugin needs to do all interaction with the CLI crate through trait -// objects and function pointers. This ensures that no concrete internal methods -// (such as register_op and the closures created by it) can end up in the plugin -// shared library itself, which would cause segfaults when the plugin is -// unloaded and all functions in the plugin library are unmapped from memory. - -pub use crate::Op; -pub use crate::OpId; -pub use crate::OpResult; -pub use crate::ZeroCopyBuf; - -pub type InitFn = fn(&mut dyn Interface); - -pub type DispatchOpFn = fn(&mut dyn Interface, Option<ZeroCopyBuf>) -> Op; - -pub trait Interface { - fn register_op(&mut self, name: &str, dispatcher: DispatchOpFn) -> OpId; -} |