mirror of
https://github.com/gorules/zen.git
synced 2026-10-05 16:02:40 +00:00
feat: add bigjs to function node; (#77)
* feat: add bigjs to function node; * fix test * fix tests * fix fmt
This commit is contained in:
@@ -84,7 +84,9 @@ impl Script {
|
||||
return Err(anyhow!("Timeout exceeded"));
|
||||
}
|
||||
|
||||
let exception = tc_scope.exception().context("Failed to run loaded script")?;
|
||||
let exception = tc_scope
|
||||
.exception()
|
||||
.context("Failed to run loaded script")?;
|
||||
return Err(anyhow!(exception.to_rust_string_lossy(tc_scope)));
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -17,6 +17,6 @@ const console = {
|
||||
};
|
||||
|
||||
const main = (input) => ({
|
||||
output: handler(input, {moment: __GLOBAL__DAYJS, env: __GLOBAL__ENV}),
|
||||
output: handler(input, {moment: __GLOBAL__DAYJS, dayjs: __GLOBAL__DAYJS, Big: Big, env: __GLOBAL__ENV}),
|
||||
log,
|
||||
});
|
||||
|
||||
@@ -34,12 +34,16 @@ pub static BASE_VM: Lazy<Vec<u8>> = Lazy::new(|| {
|
||||
let scope = &mut v8::ContextScope::new(handle_scope, context);
|
||||
|
||||
let dayjs_src = v8::String::new(scope, include_str!("scripts/dayjs.js")).unwrap();
|
||||
let bigjs_src = v8::String::new(scope, include_str!("scripts/big.js")).unwrap();
|
||||
let internal_src = v8::String::new(scope, include_str!("scripts/internals.js")).unwrap();
|
||||
let env_src = v8::String::new(scope, env_src_string.as_str()).unwrap();
|
||||
|
||||
v8::Script::compile(scope, dayjs_src, None)
|
||||
.unwrap()
|
||||
.run(scope);
|
||||
v8::Script::compile(scope, bigjs_src, None)
|
||||
.unwrap()
|
||||
.run(scope);
|
||||
v8::Script::compile(scope, internal_src, None)
|
||||
.unwrap()
|
||||
.run(scope);
|
||||
|
||||
Reference in New Issue
Block a user