diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-10-11 11:41:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 11:41:54 -0700 |
commit | 97d8498d46bbfb7bb16eeb3a69565d2aeda1e5aa (patch) | |
tree | cfe85f3afccda5c0f87cbb29b79e0eab8d9c0d97 /cli/ops/compiler.rs | |
parent | 04ed8d0531b7c2c308b28b742f5c332345d97065 (diff) |
Add init methods for each op module (#3087)
Diffstat (limited to 'cli/ops/compiler.rs')
-rw-r--r-- | cli/ops/compiler.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs index 4228842dd..720eb65fc 100644 --- a/cli/ops/compiler.rs +++ b/cli/ops/compiler.rs @@ -2,9 +2,22 @@ use super::dispatch_json::{Deserialize, JsonOp, Value}; use crate::futures::future::join_all; use crate::futures::Future; +use crate::ops::json_op; use crate::state::ThreadSafeState; use deno::*; +pub fn init(i: &mut Isolate, s: &ThreadSafeState) { + i.register_op("cache", s.core_op(json_op(s.stateful_op(op_cache)))); + i.register_op( + "fetch_source_files", + s.core_op(json_op(s.stateful_op(op_fetch_source_files))), + ); + i.register_op( + "fetch_asset", + s.core_op(json_op(s.stateful_op(op_fetch_asset))), + ); +} + #[derive(Deserialize)] #[serde(rename_all = "camelCase")] struct CacheArgs { @@ -13,7 +26,7 @@ struct CacheArgs { extension: String, } -pub fn op_cache( +fn op_cache( state: &ThreadSafeState, args: Value, _zero_copy: Option<PinnedBuf>, @@ -38,7 +51,7 @@ struct FetchSourceFilesArgs { referrer: String, } -pub fn op_fetch_source_files( +fn op_fetch_source_files( state: &ThreadSafeState, args: Value, _data: Option<PinnedBuf>, @@ -85,7 +98,7 @@ struct FetchAssetArgs { name: String, } -pub fn op_fetch_asset( +fn op_fetch_asset( _state: &ThreadSafeState, args: Value, _zero_copy: Option<PinnedBuf>, |