feat: track images with git lfs

This commit is contained in:
2024-04-04 19:17:27 +02:00
parent 5f2b2f59be
commit 9776b5a84a
193 changed files with 3295 additions and 4620 deletions

View File

@@ -1,10 +0,0 @@
{
"rust-analyzer.check.overrideCommand": [
"cargo",
"component",
"check",
"--workspace",
"--all-targets",
"--message-format=json"
],
}

View File

@@ -1,17 +0,0 @@
[package]
name = "add"
version = "0.1.0"
edition = "2021"
[dependencies]
wit-bindgen = { version = "0.19.2", default-features = false, features = [
"realloc",
] }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "component:add"
[package.metadata.component.dependencies]

View File

@@ -1,95 +0,0 @@
// Generated by `wit-bindgen` 0.18.0. DO NOT EDIT!
const _: () = {
#[doc(hidden)]
#[export_name = "execute"]
#[allow(non_snake_case)]
unsafe extern "C" fn __export_execute(arg0: i32,arg1: i32,) -> i32 {
#[allow(unused_imports)]
use wit_bindgen::rt::{alloc, vec::Vec, string::String};
// Before executing any other code, use this function to run all static
// constructors, if they have not yet been run. This is a hack required
// to work around wasi-libc ctors calling import functions to initialize
// the environment.
//
// This functionality will be removed once rust 1.69.0 is stable, at which
// point wasi-libc will no longer have this behavior.
//
// See
// https://github.com/bytecodealliance/preview2-prototyping/issues/99
// for more details.
#[cfg(target_arch="wasm32")]
wit_bindgen::rt::run_ctors_once();
let result0 = <_GuestImpl as Guest>::execute(arg0, arg1);
wit_bindgen::rt::as_i32(result0)
}
};
const _: () = {
#[doc(hidden)]
#[export_name = "get-definition"]
#[allow(non_snake_case)]
unsafe extern "C" fn __export_get_definition() -> i32 {
#[allow(unused_imports)]
use wit_bindgen::rt::{alloc, vec::Vec, string::String};
// Before executing any other code, use this function to run all static
// constructors, if they have not yet been run. This is a hack required
// to work around wasi-libc ctors calling import functions to initialize
// the environment.
//
// This functionality will be removed once rust 1.69.0 is stable, at which
// point wasi-libc will no longer have this behavior.
//
// See
// https://github.com/bytecodealliance/preview2-prototyping/issues/99
// for more details.
#[cfg(target_arch="wasm32")]
wit_bindgen::rt::run_ctors_once();
let result0 = <_GuestImpl as Guest>::get_definition();
let ptr1 = _RET_AREA.0.as_mut_ptr() as i32;
let vec2 = (result0.into_bytes()).into_boxed_slice();
let ptr2 = vec2.as_ptr() as i32;
let len2 = vec2.len() as i32;
::core::mem::forget(vec2);
*((ptr1 + 4) as *mut i32) = len2;
*((ptr1 + 0) as *mut i32) = ptr2;
ptr1
}
const _: () = {
#[doc(hidden)]
#[export_name = "cabi_post_get-definition"]
#[allow(non_snake_case)]
unsafe extern "C" fn __post_return_get_definition(arg0: i32,) {
let l0 = *((arg0 + 0) as *const i32);
let l1 = *((arg0 + 4) as *const i32);
wit_bindgen::rt::dealloc(l0, (l1) as usize, 1);
}
};
};
use super::Component as _GuestImpl;
pub trait Guest {
fn execute(left: i32,right: i32,) -> i32;
fn get_definition() -> wit_bindgen::rt::string::String;
}
#[allow(unused_imports)]
use wit_bindgen::rt::{alloc, vec::Vec, string::String};
#[repr(align(4))]
struct _RetArea([u8; 8]);
static mut _RET_AREA: _RetArea = _RetArea([0; 8]);
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:example"]
#[doc(hidden)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 210] = [0, 97, 115, 109, 13, 0, 1, 0, 0, 25, 22, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 4, 0, 7, 86, 1, 65, 2, 1, 65, 4, 1, 64, 2, 4, 108, 101, 102, 116, 122, 5, 114, 105, 103, 104, 116, 122, 0, 122, 4, 0, 7, 101, 120, 101, 99, 117, 116, 101, 1, 0, 1, 64, 0, 0, 115, 4, 0, 14, 103, 101, 116, 45, 100, 101, 102, 105, 110, 105, 116, 105, 111, 110, 1, 1, 4, 1, 21, 99, 111, 109, 112, 111, 110, 101, 110, 116, 58, 97, 100, 100, 47, 101, 120, 97, 109, 112, 108, 101, 4, 0, 11, 13, 1, 0, 7, 101, 120, 97, 109, 112, 108, 101, 3, 0, 0, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 50, 49, 46, 48, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 56, 46, 48];
#[inline(never)]
#[doc(hidden)]
#[cfg(target_arch = "wasm32")]
pub fn __link_section() {}

View File

@@ -1,16 +0,0 @@
mod bindings;
use bindings::Guest;
struct Component;
impl Guest for Component {
/// Say hello!
fn execute(left: i32, right: i32) -> i32 {
left + right
}
fn get_definition() -> String {
let definition = include_str!("./node.json");
definition.to_string()
}
}

View File

@@ -1,17 +0,0 @@
{
"inputs": {
"left": {
"type": "integer",
"default": 50,
"min": 0,
"max": 255
},
"right": {
"type": "integer",
"default": 50,
"min": 0,
"max": 255
}
},
"outputs": ["integer"]
}

View File

@@ -1,7 +0,0 @@
package component:add;
/// An example world for the component to target.
world example {
export execute: func(left: s32, right: s32) -> s32;
export get-definition: func() -> string;
}

6
nodes/max/plantarium/math/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log

View File

@@ -0,0 +1,25 @@
[package]
name = "math"
version = "0.1.0"
authors = ["Max Richter <jim-x@web.de>"]
edition = "2018"
[lib]
crate-type = ["cdylib", "rlib"]
[features]
default = ["console_error_panic_hook"]
[dependencies]
wasm-bindgen = "0.2.84"
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.4"
console_error_panic_hook = { version = "0.1.7", optional = true }
plantarium = { version = "0.1.0", path = "../../../../packages/plantarium" }
[dev-dependencies]
wasm-bindgen-test = "0.3.34"
[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"

View File

@@ -0,0 +1,5 @@
{
"scripts": {
"build": "wasm-pack build --release"
}
}

View File

@@ -0,0 +1,40 @@
mod utils;
use plantarium::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn get_outputs() -> Vec<String> {
vec!["float".to_string()]
}
#[wasm_bindgen]
pub fn get_id() -> String {
"math".to_string()
}
#[wasm_bindgen]
pub fn get_input_types() -> String {
utils::set_panic_hook();
r#"{
"op_type": { "type": "select", "labels": ["add", "subtract", "multiply", "divide"], "internal": true, "value": 0 },
"a": { "type": "float", "value": 2 },
"b": { "type": "float", "value": 2 }
}"#.to_string()
}
#[wasm_bindgen]
pub fn execute(var_op_type: JsValue, var_a: JsValue, var_b: JsValue) -> f64 {
utils::set_panic_hook();
let op_type = unwrap_int(var_op_type);
let a = unwrap_float(var_a);
let b = unwrap_float(var_b);
match op_type {
1 => return a - b,
2 => return a * b,
3 => return a / b,
_ => return a + b,
}
}

View File

@@ -0,0 +1,10 @@
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
}

View File

@@ -0,0 +1,13 @@
//! Test suite for the Web and headless browsers.
#![cfg(target_arch = "wasm32")]
extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pass() {
assert_eq!(1 + 1, 2);
}

View File

@@ -0,0 +1,6 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log

View File

@@ -0,0 +1,27 @@
[package]
name = "random"
version = "0.1.0"
authors = ["Max Richter <jim-x@web.de>"]
edition = "2018"
[lib]
crate-type = ["cdylib", "rlib"]
[features]
default = ["console_error_panic_hook"]
[dependencies]
wasm-bindgen = "0.2.84"
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.7", optional = true }
[dev-dependencies]
wasm-bindgen-test = "0.3.34"
[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"

View File

@@ -0,0 +1,5 @@
{
"scripts": {
"build": "wasm-pack build --release"
}
}

View File

@@ -0,0 +1,13 @@
mod utils;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet() {
alert("Hello, random!");
}

View File

@@ -0,0 +1,10 @@
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
}

View File

@@ -0,0 +1,13 @@
//! Test suite for the Web and headless browsers.
#![cfg(target_arch = "wasm32")]
extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pass() {
assert_eq!(1 + 1, 2);
}

View File

@@ -1,11 +0,0 @@
[package]
name = "multiply"
version = "0.1.0"
edition = "2021"
[dependencies]
wasm-bindgen = "0.2.91"
[lib]
crate-type = ["cdylib"]

View File

@@ -1,20 +0,0 @@
use std::ffi::CString;
use std::os::raw::c_char;
#[no_mangle]
pub extern "C" fn execute(a: u32, b: u32) -> u32 {
a + b
}
const DEFINITION: &str = include_str!("./node.json");
#[no_mangle]
pub fn get_definition() -> *mut c_char {
let s = CString::new(DEFINITION).unwrap();
s.into_raw()
}
#[no_mangle]
pub fn get_definition_len() -> usize {
DEFINITION.len()
}

View File

@@ -1,17 +0,0 @@
{
"inputs": {
"left": {
"type": "integer",
"default": 50,
"min": 0,
"max": 255
},
"right": {
"type": "integer",
"default": 50,
"min": 0,
"max": 255
}
},
"outputs": ["integer"]
}

View File

@@ -1,10 +0,0 @@
{
"rust-analyzer.check.overrideCommand": [
"cargo",
"component",
"check",
"--workspace",
"--all-targets",
"--message-format=json"
],
}

View File

@@ -1,17 +0,0 @@
[package]
name = "subtract"
version = "0.1.0"
edition = "2021"
[dependencies]
wit-bindgen = { version = "0.19.2", default-features = false, features = [
"realloc",
] }
[lib]
crate-type = ["cdylib"]
[package.metadata.component]
package = "component:subtract"
[package.metadata.component.dependencies]

View File

@@ -1,95 +0,0 @@
// Generated by `wit-bindgen` 0.18.0. DO NOT EDIT!
const _: () = {
#[doc(hidden)]
#[export_name = "execute"]
#[allow(non_snake_case)]
unsafe extern "C" fn __export_execute(arg0: i32,arg1: i32,) -> i32 {
#[allow(unused_imports)]
use wit_bindgen::rt::{alloc, vec::Vec, string::String};
// Before executing any other code, use this function to run all static
// constructors, if they have not yet been run. This is a hack required
// to work around wasi-libc ctors calling import functions to initialize
// the environment.
//
// This functionality will be removed once rust 1.69.0 is stable, at which
// point wasi-libc will no longer have this behavior.
//
// See
// https://github.com/bytecodealliance/preview2-prototyping/issues/99
// for more details.
#[cfg(target_arch="wasm32")]
wit_bindgen::rt::run_ctors_once();
let result0 = <_GuestImpl as Guest>::execute(arg0, arg1);
wit_bindgen::rt::as_i32(result0)
}
};
const _: () = {
#[doc(hidden)]
#[export_name = "get-definition"]
#[allow(non_snake_case)]
unsafe extern "C" fn __export_get_definition() -> i32 {
#[allow(unused_imports)]
use wit_bindgen::rt::{alloc, vec::Vec, string::String};
// Before executing any other code, use this function to run all static
// constructors, if they have not yet been run. This is a hack required
// to work around wasi-libc ctors calling import functions to initialize
// the environment.
//
// This functionality will be removed once rust 1.69.0 is stable, at which
// point wasi-libc will no longer have this behavior.
//
// See
// https://github.com/bytecodealliance/preview2-prototyping/issues/99
// for more details.
#[cfg(target_arch="wasm32")]
wit_bindgen::rt::run_ctors_once();
let result0 = <_GuestImpl as Guest>::get_definition();
let ptr1 = _RET_AREA.0.as_mut_ptr() as i32;
let vec2 = (result0.into_bytes()).into_boxed_slice();
let ptr2 = vec2.as_ptr() as i32;
let len2 = vec2.len() as i32;
::core::mem::forget(vec2);
*((ptr1 + 4) as *mut i32) = len2;
*((ptr1 + 0) as *mut i32) = ptr2;
ptr1
}
const _: () = {
#[doc(hidden)]
#[export_name = "cabi_post_get-definition"]
#[allow(non_snake_case)]
unsafe extern "C" fn __post_return_get_definition(arg0: i32,) {
let l0 = *((arg0 + 0) as *const i32);
let l1 = *((arg0 + 4) as *const i32);
wit_bindgen::rt::dealloc(l0, (l1) as usize, 1);
}
};
};
use super::Component as _GuestImpl;
pub trait Guest {
fn execute(left: i32,right: i32,) -> i32;
fn get_definition() -> wit_bindgen::rt::string::String;
}
#[allow(unused_imports)]
use wit_bindgen::rt::{alloc, vec::Vec, string::String};
#[repr(align(4))]
struct _RetArea([u8; 8]);
static mut _RET_AREA: _RetArea = _RetArea([0; 8]);
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:example"]
#[doc(hidden)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 215] = [0, 97, 115, 109, 13, 0, 1, 0, 0, 25, 22, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 4, 0, 7, 91, 1, 65, 2, 1, 65, 4, 1, 64, 2, 4, 108, 101, 102, 116, 122, 5, 114, 105, 103, 104, 116, 122, 0, 122, 4, 0, 7, 101, 120, 101, 99, 117, 116, 101, 1, 0, 1, 64, 0, 0, 115, 4, 0, 14, 103, 101, 116, 45, 100, 101, 102, 105, 110, 105, 116, 105, 111, 110, 1, 1, 4, 1, 26, 99, 111, 109, 112, 111, 110, 101, 110, 116, 58, 115, 117, 98, 116, 114, 97, 99, 116, 47, 101, 120, 97, 109, 112, 108, 101, 4, 0, 11, 13, 1, 0, 7, 101, 120, 97, 109, 112, 108, 101, 3, 0, 0, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 50, 49, 46, 48, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 56, 46, 48];
#[inline(never)]
#[doc(hidden)]
#[cfg(target_arch = "wasm32")]
pub fn __link_section() {}

View File

@@ -1,16 +0,0 @@
mod bindings;
use bindings::Guest;
struct Component;
impl Guest for Component {
/// Say hello!
fn execute(left: i32, right: i32) -> i32 {
left - right
}
fn get_definition() -> String {
let definition = include_str!("./node.json");
definition.to_string()
}
}

View File

@@ -1,17 +0,0 @@
{
"inputs": {
"left": {
"type": "integer",
"default": 50,
"min": 0,
"max": 255
},
"right": {
"type": "integer",
"default": 50,
"min": 0,
"max": 255
}
},
"outputs": ["integer"]
}

View File

@@ -1,7 +0,0 @@
package component:subtract;
/// An example world for the component to target.
world example {
export execute: func(left: s32, right: s32) -> s32;
export get-definition: func() -> string;
}