- Go builds the shim in
libesbuild. - zig cross compiles the linux and windows shims. Only
bb natives --allneeds it:brew install zig.
Esbuild releases executables. This project builds a shared library from its
Go API. libesbuild/shim.go wraps the API in five C functions, compiled with
-buildmode=c-shared:
char *esbuild_version(void);
char *esbuild_transform(const char *code, const char *options_json);
char *esbuild_build(const char *options_json);
char *esbuild_analyze_metafile(const char *metafile, const char *options_json);
void esbuild_free(char *p);Options and results use JSON, so new esbuild options do not require new C functions.
Build the shim for your machine, then run the tests on both hosts:
bb natives
bb test
clojure -M:local:test
bb natives writes into libesbuild/resources. The :local alias and
bb.edn point at that directory instead of the released jar.
bb natives --all builds every platform the jar carries:
bb natives --all
Xcode covers both mac architectures and zig covers the rest, so one macOS machine builds the whole jar. The linux targets name a glibc version, which sets the oldest linux the library loads on.
Push a libesbuild-<version> tag to release the natives, and a v<version>
tag to release the library.
The library itself is a git dep for now, so only libesbuild goes to Clojars.
To release from your own machine instead, deploy the natives first, because the library pom names them:
export CLOJARS_USERNAME=<user>
export CLOJARS_PASSWORD=<token from https://clojars.org/tokens>
bb publish:libesbuild --bump
bb publish:esbuild --bump
libesbuild/version.edn holds the esbuild version and the shim number.
--bump raises the shim number, or starts at 1 for a new esbuild. After the
deploy it pins the new version in deps.edn, commits and pushes.
version.edn holds the library version. --bump raises the release number,
and after the deploy commits and pushes. Both tasks refuse unknown options.
deploy builds the jar, and the natives jar builds any shim that is missing
or was built from another esbuild or other shim sources. It refuses to deploy a
jar that lacks a platform, carries an empty or stale shared library, or carries
one it does not expect. Clojars keeps every version it accepts, so those checks
are the last line before it is permanent.
Use bb install:libesbuild for a local m2 install instead.
The root and libesbuild are separate projects that both name their build
namespace build, so lint them apart:
clj-kondo --lint src test examples bb build.clj
clj-kondo --lint libesbuild/build.clj