From 98f54832410a410ff725a1408df2fa9224b05719 Mon Sep 17 00:00:00 2001 From: SoraSuegami Date: Thu, 28 Sep 2023 08:34:31 +0900 Subject: [PATCH] Add features. --- packages/apis/Cargo.toml | 4 ++++ packages/apis/src/lib.rs | 1 + packages/compiler/Cargo.toml | 5 ++--- packages/compiler/src/lib.rs | 5 +---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/apis/Cargo.toml b/packages/apis/Cargo.toml index 7611ff1..2cdbdc3 100644 --- a/packages/apis/Cargo.toml +++ b/packages/apis/Cargo.toml @@ -22,3 +22,7 @@ serde_json = "1.0.95" version = "0.10" default-features = false features = ["napi-6"] + +[features] +default = ["export_neon_main"] +export_neon_main = [] diff --git a/packages/apis/src/lib.rs b/packages/apis/src/lib.rs index d0a4e92..7239e98 100644 --- a/packages/apis/src/lib.rs +++ b/packages/apis/src/lib.rs @@ -4,6 +4,7 @@ pub mod padding; use extract_substrs::extract_substr_idxes_node; use padding::pad_string_node; +#[cfg(feature = "export_neon_main")] #[neon::main] fn main(mut cx: ModuleContext) -> NeonResult<()> { cx.export_function("extractSubstrIdxes", extract_substr_idxes_node)?; diff --git a/packages/compiler/Cargo.toml b/packages/compiler/Cargo.toml index dae183c..bbfa76f 100644 --- a/packages/compiler/Cargo.toml +++ b/packages/compiler/Cargo.toml @@ -31,8 +31,7 @@ clap = { version = "=4.2.1", features = ["derive"] } version = "0.10" default-features = false features = ["napi-6"] -optional = true [features] -default = ["node"] -node = ["neon"] +default = ["export_neon_main"] +export_neon_main = [] diff --git a/packages/compiler/src/lib.rs b/packages/compiler/src/lib.rs index 258bb9b..f31e0be 100644 --- a/packages/compiler/src/lib.rs +++ b/packages/compiler/src/lib.rs @@ -4,11 +4,8 @@ pub mod circom; pub mod halo2; pub mod js_caller; -#[cfg(feature = "node")] pub mod node; -#[cfg(feature = "node")] use crate::node::*; -#[cfg(feature = "node")] use neon; use crate::js_caller::*; @@ -462,7 +459,7 @@ pub(crate) fn add_graph_nodes( Ok(()) } -#[cfg(feature = "node")] +#[cfg(feature = "export_neon_main")] #[neon::main] fn main(mut cx: neon::prelude::ModuleContext) -> neon::prelude::NeonResult<()> { cx.export_function("genFromDecomposed", gen_from_decomposed_node)?;