

Discover more from hrbrmstr's Daily Drop
WebAssembly Universal Binaries
I have a moderately held policy to stay away from recommending betas in this newsletter. Betas are often fraught with peril and vaporware promises. Despite not being able to get this particular beta to work (yet), I felt compelled to cover it, today.
The Wasmer folks (you know, the ones who make it possible to run Wasm files on your system?) just announced that v3.0.0b of Wasmer can make platform-native binaries.
You read that right. Platform native binaries.
Why is this useful?
Consider Apple Silicon. Sure, Apple made a Rosetta 2 to enable on-the-fly translation of x86_64 instruction to arm64 instructions. If they hadn't done that (so, if they had "pulled a Microsoft"), macOS life would have been terrible for a while. If all the cool Homebrew utilities we run had Wasm targets, then it would have just been a minor wait until there was a Wasm→arm64 target available for Clang or Zig (either is required for Wasmer's latest magic to work). Or, as Wasmer puts it:
As new chipsets are being added and used in the ecosystem (ARM, RISC-V), we need to ensure current tools continue working with them.
If CLI tools start targeting WebAssembly as their end target, we can let Wasmer automatically generate native executables for each platform and chipset, so when new chips and OSS appear, we don’t need to worry about recompiling again our software. They will just simply work.
Apart from this, native binaries are automatically sandboxed and do not have any permissions into the underlying OS unless explicitly determined, making them much safer than the normal binaries we use daily.
Their new wasmer create-exe
operation converts Wasm to a static object file and an accompanying C header file. They pair that with a minimal C compiler/linker file and some glue code. (The article goes into a bit more depth.)
I'm hoping to try this out on a compatible system this week. If it does what it says on the tin, we are in for some truly exciting times ahead.
temir
If you do any web coding at all, you've likely heard about Vue — a JavaScript framework for building user interfaces. It builds on top of standard HTML, CSS and JavaScript, and provides a declarative and component-based programming model that helps you efficiently develop user interfaces, be it simple or complex.
Vue makes it much easier (well, sort of…plain HTML, normal CSS, and basic JavaScript are way easier, until web pages/sites get more complex) to design web experiences.
What if you know Vue/CSS/JavaScript but want to design for the terminal user interface (TUI)? Or, what if you're a solid coder but TUI layouts (including styles/colors/etc) seem daunting, and you'd like to enlist the help of one of your designer friends who only knows tech like Vue?
Well, now you can use temir! The temir tagline is "Vue for CLIs. Build your CLI output using components", and it's a well-executed project. Here's "hello, world" using temir (output is the section banner image):
<script lang="ts" setup>
import { ref } from '@vue/runtime-core'
import { TBox, TText } from '@temir/core'
const count = ref(0)
setInterval(() => { count.value++ }, 100)
</script>
<template>
<TBox
:margin="5"
:width="30"
:height="5"
border-style="double"
justify-content="center"
align-items="center"
>
<TText color="#42b883">
🌈 Hi TEMIR !! {{ count }}
</TText>
</TBox>
</template>
Temir is the work of @webfansplz, and it might just convince me to try my next CLI project in JavaScript, especially when Wasmer (above) might be able to make a platform-native binary from it.
Give the repo's examples a solid look, and check out MDN's Vue resources if you haven't poked at Vue, or it's been a while since you've used Vue.
tree
Now, hold on a second.
Calm down.
I know you're like, "WT*?! The tree command? Rly?! Srsly?!" But hear me out.
Sure, you (likely) know you can do:
$ tree /etc/vim
/etc/vim
├── vimrc
└── vimrc.tiny
0 directories, 2 files
BUT, did you know you can do:
$ tree -J /etc/vim
[
{"type":"directory","name":"/etc/vim","contents":[
{"type":"file","name":"vimrc"},
{"type":"file","name":"vimrc.tiny"}
]}
,
{"type":"report","directories":0,"files":2}
]
I, for one, did not, until I looked for a way to do this at the CLI today (part of the "continued rebuild of the DL380 I borked on Sunday”).
FIN
Monday turned out to be a pretty good day for liberal Democracy in America. ☮