commit
99863f314d
8 changed files with 20 additions and 8 deletions
|
@ -2,7 +2,7 @@ use napi::{CallContext, JsExternal, JsObject, JsString};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct QueryEngine {
|
pub struct QueryEngine {
|
||||||
datamodel: String,
|
pub datamodel: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Sync for QueryEngine {}
|
unsafe impl Sync for QueryEngine {}
|
||||||
|
|
|
@ -65,6 +65,10 @@ export class BuildCommand extends Command {
|
||||||
)} file, relative to cwd`,
|
)} file, relative to cwd`,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
project = Option.String('-p', {
|
||||||
|
description: `Bypass to ${chalk.green('cargo -p')}`,
|
||||||
|
})
|
||||||
|
|
||||||
cargoFlags = Option.String('--cargo-flags', '', {
|
cargoFlags = Option.String('--cargo-flags', '', {
|
||||||
description: `All the others flag passed to ${chalk.yellow('cargo')}`,
|
description: `All the others flag passed to ${chalk.yellow('cargo')}`,
|
||||||
})
|
})
|
||||||
|
@ -123,10 +127,12 @@ export class BuildCommand extends Command {
|
||||||
}).toString('utf8'),
|
}).toString('utf8'),
|
||||||
)
|
)
|
||||||
debug(`Current triple is: ${chalk.green(triple.raw)}`)
|
debug(`Current triple is: ${chalk.green(triple.raw)}`)
|
||||||
|
const pFlag = this.project ? `-p ${this.project}` : ''
|
||||||
const externalFlags = [
|
const externalFlags = [
|
||||||
releaseFlag,
|
releaseFlag,
|
||||||
targetFlag,
|
targetFlag,
|
||||||
featuresFlag,
|
featuresFlag,
|
||||||
|
pFlag,
|
||||||
this.cargoFlags,
|
this.cargoFlags,
|
||||||
]
|
]
|
||||||
.filter((flag) => Boolean(flag))
|
.filter((flag) => Boolean(flag))
|
||||||
|
|
|
@ -11,9 +11,10 @@ version = "2.0.0-beta.1"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
async = ["tokio_rt"]
|
async = ["tokio_rt"]
|
||||||
|
experimental = ["napi-sys/experimental"]
|
||||||
compat-mode = []
|
compat-mode = []
|
||||||
default = ["napi3", "compat-mode"] # for most Node.js users
|
default = ["napi3", "compat-mode"] # for most Node.js users
|
||||||
full = ["latin1", "napi8", "async", "serde-json"]
|
full = ["latin1", "napi8", "async", "serde-json", "experimental"]
|
||||||
latin1 = ["encoding_rs"]
|
latin1 = ["encoding_rs"]
|
||||||
napi1 = []
|
napi1 = []
|
||||||
napi2 = ["napi1"]
|
napi2 = ["napi1"]
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::hash::Hash;
|
||||||
|
|
||||||
use crate::bindgen_prelude::{Env, Result, ToNapiValue, *};
|
use crate::bindgen_prelude::{Env, Result, ToNapiValue, *};
|
||||||
|
|
||||||
impl<K, V> TypeName for HashMap<K, V> {
|
impl<K, V, S> TypeName for HashMap<K, V, S> {
|
||||||
fn type_name() -> &'static str {
|
fn type_name() -> &'static str {
|
||||||
"HashMap"
|
"HashMap"
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ impl<K, V> TypeName for HashMap<K, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K, V> ToNapiValue for HashMap<K, V>
|
impl<K, V, S> ToNapiValue for HashMap<K, V, S>
|
||||||
where
|
where
|
||||||
K: AsRef<str>,
|
K: AsRef<str>,
|
||||||
V: ToNapiValue,
|
V: ToNapiValue,
|
||||||
|
|
|
@ -1194,7 +1194,7 @@ impl Env {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Serialize `Rust Struct` into `JavaScript Value`
|
/// ### Serialize `Rust Struct` into `JavaScript Value`
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #[derive(Serialize, Debug, Deserialize)]
|
/// #[derive(Serialize, Debug, Deserialize)]
|
||||||
|
@ -1220,7 +1220,7 @@ impl Env {
|
||||||
node.serialize(s).map(JsUnknown)
|
node.serialize(s).map(JsUnknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Deserialize data from `JsValue`
|
/// ### Deserialize data from `JsValue`
|
||||||
/// ```
|
/// ```
|
||||||
/// #[derive(Serialize, Debug, Deserialize)]
|
/// #[derive(Serialize, Debug, Deserialize)]
|
||||||
/// struct AnObject {
|
/// struct AnObject {
|
||||||
|
|
|
@ -151,6 +151,9 @@ pub struct JsTypeError(Error);
|
||||||
|
|
||||||
pub struct JsRangeError(Error);
|
pub struct JsRangeError(Error);
|
||||||
|
|
||||||
|
#[cfg(feature = "experimental")]
|
||||||
|
pub struct JsSyntaxError(Error);
|
||||||
|
|
||||||
macro_rules! impl_object_methods {
|
macro_rules! impl_object_methods {
|
||||||
($js_value:ident, $kind:expr) => {
|
($js_value:ident, $kind:expr) => {
|
||||||
impl $js_value {
|
impl $js_value {
|
||||||
|
|
|
@ -183,6 +183,8 @@ pub(crate) unsafe fn log_js_value<V: AsRef<[sys::napi_value]>>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub use crate::bindgen_runtime::ctor as module_init;
|
||||||
|
|
||||||
pub mod bindgen_prelude {
|
pub mod bindgen_prelude {
|
||||||
#[cfg(feature = "compat-mode")]
|
#[cfg(feature = "compat-mode")]
|
||||||
pub use crate::bindgen_runtime::register_module_exports;
|
pub use crate::bindgen_runtime::register_module_exports;
|
||||||
|
|
|
@ -5,8 +5,8 @@ use napi::{
|
||||||
use napi_derive::js_function;
|
use napi_derive::js_function;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct A {
|
pub struct A {
|
||||||
cb: ThreadsafeFunction<String>,
|
pub cb: ThreadsafeFunction<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[js_function(1)]
|
#[js_function(1)]
|
||||||
|
|
Loading…
Reference in a new issue