Packages
I build a few open-source packages that you might find helpful. You can also follow me on GitHub.
Go
-
hangar: helper to build Fly.io services
Provides tools to help build distributed services on Fly.io, such as managing various local copies of a daemon that run in different 'locations'.
-
https-forward: (install via Snap): simple reverse proxy for local services
Want to serve random http services on the real internet with automatic certificate generation?—i.e., you have local dev servers on
localhost:3000
and so on. This is a simple Go-based https:// server that'll reverse proxy to http-only services with a number of configuration options (but is not a general-purpose web server).
NPM
-
kuto: faster updates for big JS projects
Kuto takes a novel approach to splitting code, one which re-uses existing code a client already has when serving updates. It's good for big bundle sizes (>1mb).
-
html-template-compiler: static HTML template compiler for JS
Compiles HTML templates to TypeScript which can then be used in a type-safe way inside your code, on the server or the client. This is used on Emojibuff to render pages both on the server and offline within the Service Worker, rather than caching all HTML.
-
ok-emoji: helpers for working with emoji
This provides JavaScript support for working with emoji, such as parsing TR51-encoded data and helpers to validate that the current browser/environment supports a given emoji.
-
tiny-stable-stringify: tiny stable
JSON.stringify
Used to consistently sort keys when you stringify JSON objects, useful for comparisons. Tiny, 2% the code of the 'leading package', as this (ab)uses the built-in behavior of sorting keys in
Record
. -
esm-resolve: a permissive ESM resolver in pure JS for Node
Resolves import strings, which may be useful for a bundler or other tool, without using Node internals. Supports subpath exports, conditions, all that tricky stuff, and is a bit more permissive than Node itself.
-
parq: a Parquet reader in JavaScript
Does what it says on the tin and processes Parquet, a common data science format. Has a live demo.
-
typed-event-types: allows you to set the type of
Event
Now that we can subclass
EventTarget
, it's useful to be able to say that event"foo"
generates a certain subclass ofEvent
. This simple package just provides TS types to help with that. -
dhost: simple webserver that never caches anything
Sick of dev web servers where you aren't sure that you're getting the latest version of something? This will always serve the latest version of a file, and is fast to boot.
-
thorish: a dumping ground for libraries.
I've attempted to consolidate the libraries that I use for a lot of my projects. This basically consists of helpers to do with
Map
/Set
, as well as lots of things to do with async iterators andPromise
. You can add this to yourdevDependencies
and then compile in the things you use, since it's tree-shakable and has no side-effects. -
but-csv: a 479 byte CSV parser and builder.
This was built in reaction to how complex even "light-weight" CSV libraries are: they do too much (including streaming), but if you just want to bring everything into memory and get some data out quickly, this is for you.
-
but-unzip: a <1k byte unzip library.
Work with zip files in your browser or Node. This is miniscule in Node, and small in the browser (~1k) for 90% of users. For the last 10%, you can dynamically include a ~20kb deflate helper.
-
sents and sents-cli: a small filesystem watcher for build scripts
There's obviously tools like Chokidar which are the standard, but they have lots of dependencies and often include native code, the bane of every Node developer's existence. These two libraries do all of what those do, and deal with platform differences, all in JS.
-
viz-observer: notifies you when an element changes on your page
This is a library which provides something not built-in to the DOM: watches an element move or resize on your page, or basically change dimensions in any way. You have
ResizeObserver
, but there's noMoveObserver
—this provides a kind of union of that. It's really useful for say, showing a tooltip attached to another element, where you don't share the DOM tree. -
fast-text-encoding: a polyfill for
TextEncoder
andTextDecoder
You probably don't need this, browsers and Node have moved on. But it's heavily depended on.
-
undoer: allows you to arbirtrarily handle real browser undo/redo events
This is a useful library but is mostly a showcase of this blog post.