feat: unix adaptor for elm called starmelon
Introduce starmelon, a program for executing elm functions with input from files and writing the output back to files. Support evaluating 4 types of values and 12 types of functions. ```elm x : String x : Bytes x : VirtualDom.Node msg x : Json.Encode.Value f : String -> String f : String -> Bytes f : String -> VirtualDom.Node msg f : String -> Json.Encode.Value f : Bytes -> String f : Bytes -> Bytes f : Bytes -> VirtualDom.Node msg f : Bytes -> Json.Encode.Value f : Json.Encode.Value -> String f : Json.Encode.Value -> Bytes f : Json.Encode.Value -> VirtualDom.Node msg f : Json.Encode.Value -> Json.Encode.Value ``` My target use case for starmelon is generating html files. It is nice to be able to write parameterized framgents of markup in multiple modules and then compose them into a final value. I also have in mind attempting to replace helm (kubernetes pacakge manager) because I hate how error prone its string based templating language is.
This commit is contained in:
commit
f7aff7585d
8 changed files with 1356 additions and 0 deletions
24
Cargo.toml
Normal file
24
Cargo.toml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
[package]
|
||||||
|
name = "starmelon"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
structopt = { version = "0.3" }
|
||||||
|
elmi = { path = "../../../infra/rust-elmi" }
|
||||||
|
uuid = { version = "0.8", features = [ "v4" ] }
|
||||||
|
ahash = "0.7"
|
||||||
|
serde = { version = "1.0", features = [ "derive" ] }
|
||||||
|
serde_json = { version ="1.0", features = [] }
|
||||||
|
|
||||||
|
# All of these are required for deno's javascript runtime. We need to keep the
|
||||||
|
# same versions as other projects in our cargo workspace. Multiple different
|
||||||
|
# versions of rust_v8 seem to break its build script.
|
||||||
|
deno_runtime = "0.21.0"
|
||||||
|
tokio = { version = "1.6", features = ["full"] }
|
||||||
|
deno_core = "0.95.0"
|
||||||
|
deno_web = "0.44"
|
||||||
|
rusty_v8 = "0.25.3"
|
||||||
|
futures = "0.3.15"
|
||||||
11
examples/single-page/Cargo.toml
Normal file
11
examples/single-page/Cargo.toml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
[package]
|
||||||
|
name = "single-page"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
[lib]
|
||||||
|
crate-type = [ "dylib" ]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
|
||||||
25
examples/single-page/elm.json
Normal file
25
examples/single-page/elm.json
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"type": "application",
|
||||||
|
"source-directories": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"elm-version": "0.19.1",
|
||||||
|
"dependencies": {
|
||||||
|
"direct": {
|
||||||
|
"elm/browser": "1.0.2",
|
||||||
|
"elm/core": "1.0.5",
|
||||||
|
"elm/html": "1.0.0",
|
||||||
|
"elm/svg": "1.0.1"
|
||||||
|
},
|
||||||
|
"indirect": {
|
||||||
|
"elm/json": "1.1.3",
|
||||||
|
"elm/time": "1.0.0",
|
||||||
|
"elm/url": "1.0.0",
|
||||||
|
"elm/virtual-dom": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test-dependencies": {
|
||||||
|
"direct": {},
|
||||||
|
"indirect": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
examples/single-page/src/Foo/Main.elm
Normal file
14
examples/single-page/src/Foo/Main.elm
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
module Foo.Main exposing (view)
|
||||||
|
|
||||||
|
import Html exposing (Html, div, text)
|
||||||
|
import Array exposing (Array)
|
||||||
|
|
||||||
|
type alias Model =
|
||||||
|
{ a : Int
|
||||||
|
, b : Array Int
|
||||||
|
}
|
||||||
|
|
||||||
|
view : Model -> Html msg
|
||||||
|
view model =
|
||||||
|
div []
|
||||||
|
[ text "Hello world" ]
|
||||||
19
examples/single-page/src/Main.elm
Normal file
19
examples/single-page/src/Main.elm
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
module Main exposing (view, view2)
|
||||||
|
|
||||||
|
import Html exposing (Html, div, text)
|
||||||
|
import Svg exposing (Svg, svg)
|
||||||
|
import Array exposing (Array)
|
||||||
|
|
||||||
|
type alias Model =
|
||||||
|
{ a : Int
|
||||||
|
, b : Array Int
|
||||||
|
}
|
||||||
|
|
||||||
|
view2 : String -> Svg msg
|
||||||
|
view2 model =
|
||||||
|
svg [] []
|
||||||
|
|
||||||
|
view : String -> Html msg
|
||||||
|
view model =
|
||||||
|
div []
|
||||||
|
[ text <| "Hello world" ++ model ]
|
||||||
6
examples/single-page/src/lib.rs
Normal file
6
examples/single-page/src/lib.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#![crate_type = "dylib"]
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn foobar() -> i32 {
|
||||||
|
42
|
||||||
|
}
|
||||||
1
examples/single-page/starmelon
Symbolic link
1
examples/single-page/starmelon
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../../target/debug/starmelon
|
||||||
1256
src/main.rs
Normal file
1256
src/main.rs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue