-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Nelson
committed
Nov 28, 2024
1 parent
6d477de
commit c4e1ce3
Showing
21 changed files
with
64,002 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
elixir 1.15.2 | ||
erlang 25.1 | ||
rust 1.81.0 | ||
erlang 26.2.1 | ||
elixir 1.17.2-otp-26 | ||
nodejs 18.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
defmodule LaunchCart.Forms.WasmComponentHandler.Native do | ||
use Rustler, otp_app: :launch_cart, crate: :launchcart_formhandler_native | ||
|
||
def instantiate(_store, _component), do: error() | ||
|
||
def handle_submit(_store, _instance, _form_data), do: error() | ||
|
||
def engine_new(_config), do: error() | ||
|
||
def new_component(_store, _component), do: error() | ||
|
||
def new_store(_options, _limits), do: error() | ||
|
||
defp error, do: :erlang.nif_error(:nif_not_loaded) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule LaunchCart.Forms.WasmComponentHandler do | ||
alias LaunchCart.Forms.WasmComponentHandler.Native | ||
|
||
defstruct instance: nil, store: nil, reference: nil | ||
|
||
def handle_submit(%__MODULE__{instance: instance, store: store}, form_data), do: Native.handle_submit(store, instance, form_data) | ||
|
||
def new(component_bytes, options \\ []) do | ||
store = Native.new_store(%WasmComponentsEx.WasiOptions{}, %WasmComponentsEx.StoreLimits{}) | ||
component = Native.new_component(store, component_bytes) | ||
instance = Native.instantiate(store, component) | ||
{:ok, %__MODULE__{instance: instance, store: store}} | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[target.'cfg(target_os = "macos")'] | ||
rustflags = [ | ||
"-C", "link-arg=-undefined", | ||
"-C", "link-arg=dynamic_lookup", | ||
] | ||
|
||
# See https://github.com/rust-lang/rust/issues/59302 | ||
[target.x86_64-unknown-linux-musl] | ||
rustflags = [ | ||
"-C", "target-feature=-crt-static" | ||
] | ||
|
||
[target.aarch64-unknown-linux-musl] | ||
rustflags = [ | ||
"-C", "target-feature=-crt-static" | ||
] | ||
|
||
# Provides a small build size, but takes more time to build. | ||
[profile.release] | ||
lto = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Oops, something went wrong.