Skip to content

Lasm 0.10.0

Latest

Choose a tag to compare

@github-actions github-actions released this 18 Nov 11:33
· 48 commits to main since this release
c0dbd71

Lasm 0.10.0

A minor release with breaking changes: the last release of Stage 0, which settles Lasm's public API before 1.0. Upgrade with npm install -D @lasm/cli@0.10.0; ^0.9.0 does not pick it up. Every breaking change has a migration note below, under "Breaking changes and migration".

What breaks: Lasm.Fetch and Lasm.KV are deleted, so programs serve HTTP and keep data through each platform's own interface: Node.serve and exportDefault with the web's Request and Response, Lasm.Fastly, Lasm.WASI.Http, and the generated Workers KV, Deno KV and Fastly KV Store bindings (#359, #346). The WASI CGI server mode goes with Lasm.Fetch: --target wasi is for command-line and batch programs, and HTTP on WASI is wasi-http (#359). --target azure is now --target azure-functions and --target gcf is --target cloud-functions (#339). @lasm/cli exports only its public entry points, with the new @lasm/cli/lean (#353). The generated node:sqlite and bun:sqlite statements bind SQL NULL, which changes their parameter shapes (#352).

What's new: constructors for every documented Node class (DatabaseSync.new ":memory:"), Deno KV compiled into the package, one error shape across the CLI's commands (#352, #356, #353). The example apps (Conduit, Folio, Ledger, Porter, Tandem) and every template use only Stage 0's final APIs: no Lasm.Fetch, Lasm.KV or Lasm.RPC, no hand-written binding where a generated one exists (#345, #348, #350, #351, #354, #355).

Every API decision is recorded, with its alternatives, in docs/API_DECISIONS.md and the per-milestone files in docs/api/decisions/.

Breaking changes and migration

Lasm.Fetch is deleted (#359)

  • Lasm.Fetch, Lasm.Fetch.Assets and Lasm.Fetch.Embed are deleted
    (API decisions A44–A46, 0.2-1, 0.2-2, 0.2-9). Programs serve HTTP with each
    platform's own interface: a handler on the web's own Request and
    Response (Lasm.JS.Web) with Node.serve on Node and exportDefault
    elsewhere, Lasm.Fastly on Fastly Compute and Lasm.WASI.Http on
    wasi-http. lasm init --template fetch writes all of these (Main.lean,
    Export.lean, Fastly.lean, WasiHttp.lean). Migration, part by part:

    Lasm.Fetch Replacement
    serve on Node Node.serve { fetch := handle } (import Lasm.JS.Node.Serve), with handle : Request → Async Response on Lasm.JS.Web's types: templates/fetch/Main.lean
    serve on the edge, Bun and Deno exportDefault handle (import Lasm.JS): templates/fetch/Export.lean
    serve on the function platforms (Lambda, Vercel, Netlify, Azure, Cloud Functions) exportDefault handle, which the generated platform file calls directly
    serve on Fastly Compute Lasm.Fastly (HttpReq.bodyDownstreamGet, HttpResp.sendDownstream, …): templates/fetch/Fastly.lean
    serve on wasi-http (wasmtime serve, Spin) Lasm.WASI.Http: IncomingHandler.serve fun request out => … and respond out status headers body: templates/fetch/WasiHttp.lean
    serve as a CGI program (--target wasi, Spin's wagi executor) Removed: --target wasi is for command-line and batch programs. Serve HTTP with --target wasi-http
    fetch, get, post Lasm.JS.Web.fetch on JavaScript hosts, HttpReq.send (and sendAsync) on Fastly, OutgoingHandler.handle on wasi-http
    Request, Response, Handler and their helpers (path, segments, queryParam?, header?, Response.json, .text, .redirect, …) The web's own Request/Response (URL.new (← request.url), url.pathname, url.searchParams, (← request.headers).get, Response.new), or an app-local copy of the few helpers an app uses, as the templates' Handler.lean, Fastly.lean and WasiHttp.lean do
    Response.streaming, ServeOptions.streamRequestBody The platform's streams: a ReadableStream body on JavaScript hosts, HttpBody.write with a streamed response on Fastly, OutgoingBody.write on wasi-http
    embed_dir!, Assets An app-local copy: templates/fullstack/Embed.lean (embed_dir!) and Http.lean (Assets.serve)
  • The WASI CGI server mode is removed (A44): src/wasi/lasm_fetch_wasi.c
    is deleted, and so is --target fastly's host for Lasm.Fetch (its request,
    response and dynamic backends). Programs on Lasm.Fastly and
    Lasm.WASI.Http link as before.

  • Removed with it: examples/fetch (its routes are examples/fastly's
    and examples/wasi-http's), docs/FETCH.md, the fetch-example
    target-equivalence app, and the native libFuzzer targets
    lean-fetch-request, wasi-cgi and fastly-host.

Lasm.KV is deleted (#346)

  • Lasm.KV is deleted (API decision 0.5-18). Use the platform's own store
    through its generated binding:

    • Workers KV as a KVNamespace field of the Worker's typed Env
      (Lasm.JS.Cloudflare.Kv, env.TODOS.get key,
      env.TODOS.put key (.domString value));
    • Deno KV through Lasm.JS.Deno.Kv (openKv,
      kv.get #[.domString name, .domString key], kv.set …);
    • Fastly's KV Store through Lasm.Fastly.KvStore.

    Migration: replace Lasm.KV.open name with the store of the platform the
    program is built for; where a platform has none, keep a Std.HashMap in an
    IO.Ref. A missing binding now fails loudly instead of falling back to
    memory.

Azure and Google targets are named after the platforms (#339)

  • --target azure is now --target azure-functions, and --target gcf is
    now --target cloud-functions
    (0.7-24), whose default output is
    cloud-functions/ (was gcf/). The same names apply to
    lasm package --target, lasm init --deploy and the
    npm run build:<target> scripts lasm init writes. The old names are
    refused with the new one (did you mean --target cloud-functions?).
    Migration: in package.json scripts, CI and deploy commands, azure →
    azure-functions, gcf → cloud-functions, and gcf/ →
    cloud-functions/ (for example
    gcloud functions deploy … --source cloud-functions).

@lasm/cli exports only its public entry points (#353)

  • The wildcard export is gone (0.7-19): @lasm/cli exports
    @lasm/cli/vite, @lasm/cli/vite/client, @lasm/cli/package.json and the
    new @lasm/cli/lean, so @lasm/cli/src/… imports no longer resolve.
    @lasm/cli/lean's lasmLean(source) returns Lasm's own lean and lake,
    the Lean version and Lean's library directory, for checking a project's
    proofs with the Lean the build uses. Migration:
    import('@lasm/cli/src/managed-lean.mjs') and
    provisionLean(file, { modules: 'extended', progress }) →
    import('@lasm/cli/lean') and lasmLean(file, { progress }).

node:sqlite and bun:sqlite bind SQL NULL (#352)

  • SQL NULL binds on node:sqlite and bun:sqlite (0.4-45).
    StatementSync.all, get, run and iterate take Array (Option …)
    (none is NULL); Bun's Statement.all, get, run and values take one
    Data per value (stmt.all #[.null, toJS 7]). Migration:
    stmt.all (namedParameters := …) #[…] is
    stmt.allWithNamedParameters named #[…] (likewise get, run,
    iterate, and Console.log's first argument: logWithData); on Bun,
    stmt.run #[#[x]] is stmt.run #[x].

New

  • Constructors of every documented Node class (0.4-46, #352):
    DatabaseSync.new ":memory:", stream.Writable.new, Hash, … (38, from
    the constructor headings of Node's Markdown docs).
  • Deno KV ships compiled (0.4-47, #356). import Lasm.JS.Deno.Kv no longer
    compiles anything on a program's first build. The rest of Lasm.JS.Deno and
    Lasm.JS.Bun still compiles on first import.

Changes

  • Every command words its errors the same way (0.7-17, #353): an unknown
    name is Unknown <kind> "x" (did you mean …?). Choose one of: … in
    lasm build, lasm dev, lasm package and lasm init (lasm dev --target, lasm init --deploy and lasm package --target changed);
    lasm init --deploy without a value says --deploy requires a value;
    lasm dev Main.txt says Expected a Lean source file (Main.lean), not Main.txt, as lasm build does. Exit status: 0, 1 for every Lasm error, or
    the program's own status under lasm run. Migration: none, unless a script
    matched the old texts.
  • lasm package names the closest target for an unknown one, as the other
    commands do (0.7-24, #339).
  • The fullstack template's Deno.lean uses the generated Deno KV binding
    (Lasm.JS.Deno.Kv: openKv, Kv.get, Kv.set) instead of calling
    Deno.openKv by hand; the database opens on the first request (#345).
  • zlib.gzip, gzipSync and the other convenience methods are no longer
    marked "Node.js 26 and later" (#352).

Example apps

Every example app is on @lasm/cli 0.9.0 and Stage 0's final APIs: no
Lasm.Fetch, Lasm.KV or Lasm.RPC, per-spec Lasm.JS.Web.* imports, and
one entry file per serving model.

  • Conduit (#351): ServerNode.lean (Node.serve), ServerDeno.lean
    (Deno.serve), ServerBun.lean (Bun.serve), ServerFunction.lean
    (exportDefault, built with lasm build --target lambda|vercel|netlify and
    packaged for Azure and Google; the Lambda container image is the .zip's
    files on Lambda's base image), ServerWorkers.lean (typed Env with D1),
    ServerDenoDeploy.lean (Deno KV through Lasm.JS.Deno.Kv),
    ServerVercelEdge.lean, ServerNetlifyEdge.lean, ServerSupabase.lean,
    ServerFastly.lean (Fastly KV through Lasm.Fastly.KvStore),
    ServerWasiHttp.lean. SQLite and Web Crypto go through the generated
    Lasm.JS.Node.Sqlite, Lasm.JS.Bun.Sqlite, Lasm.JS.Cloudflare.D1 and
    Lasm.JS.Web.Webcrypto; the browser app's commands are data
    (Frontend/Cmd.lean) performed with Cmd.task, fetch and
    localStorage. All 52 propositions (307 theorems) still hold.
  • Folio (#354): one entry file per serving model, with no runtime
    detection: the live preview's server is PreviewServer.lean
    (Node.serve), PreviewServerBun.lean (Bun.serve) and
    PreviewServerDeno.lean (Deno.serve); the site server
    (Server/Edge.lean) is ServerWorkers.lean (the default export, with a
    typed Env whose KV namespace folio is Lasm.JS.Cloudflare's
    KVNamespace), ServerDenoDeploy.lean (the default export on Deno KV
    through Lasm.JS.Deno.Kv) and ServerFastly.lean (Fastly's KV Store through
    Lasm.Fastly). Each reads its platform's store through the generated
    binding, and a missing store is an error naming it instead of a store in
    memory. On Fastly, the pathological input unclosed <!-- is no longer
    skipped: with Lasm's mimalloc build it fits Compute's 128 MB heap (#246).
    The folio command and the batch renderer keep their Node, WASI and
    browser builds. Every proposition still holds.
  • Ledger (#355): SQLite through the generated bindings
    (Lasm.JS.Node.Sqlite on Node and Deno, Lasm.JS.Bun.Sqlite on Bun,
    Lasm.JS.Cloudflare.D1 on Workers, with a typed Env); Node serves with
    Node.serve, Deno with Deno.serve (ServerDeno.lean), Bun with
    Bun.serve; the function platforms run ServerFunction.lean, whose
    handler is published with exportDefault. The page loads with Cmd.task
    and the generated fetch. On Workers, the embedded files are served
    without their Brotli copies (Cloudflare compresses), and commits rely on
    D1's atomic batch (0.5-8, #349).
  • Porter (#348): Server/D1.lean on the generated D1Database, a typed
    Workers Env (DB, ISSUER, PORTER_CONFIG), Node.serve on Node, and
    ServerExport.lean (exportDefault) for Deno and the function platforms;
    Web Crypto through the generated Lasm.JS.Web.Webcrypto.
  • Tandem (#350): SQLite through the generated bindings
    (Lasm.JS.Node.Sqlite on Node and Deno, Lasm.JS.Bun.Sqlite on Bun,
    Lasm.JS.Cloudflare.D1 on Workers with a typed Env and exportDefault).
    WebSockets through the generated Deno.upgradeWebSocket and Bun.serve's
    websocket handlers with server.upgrade; on Node, Tandem's own server is
    the generated Lasm.JS.Node.Http with the ws package, because Node has no
    WebSocket server and Node.serve has no upgrade hook yet (0.4-7). The
    editor's effects are data (Tandem.Ui.Effect), performed with Cmd.task
    over the generated browser bindings and played by the deterministic
    simulation in its world.

The hand-written bindings left in the apps bind what 0.9.0 does not
generate: node:sqlite's new DatabaseSync (0.10.0 generates
DatabaseSync.new, #352), Porter's bun:sqlite new Database, Tandem's ws
server and Conduit's @netlify/blobs.

Internals (no change to how programs build or run)

  • Lasm.Fetch's proved request model moves to the test suite (A45, #359):
    the path resolution, percent decoding and query helpers, and the theorem
    segments_no_dot_segments, are now verification/cli/Lasm/RequestPath
    (Lasm.RequestPath), a specification checked by
    scripts/library-proofs.mjs; its two candidates are evaluated on generated
    URLs by test/library-proofs/RequestPath.lean.
  • Native fuzzing targets the Lasm.JS value codec (#359): the native fuzz
    harness has a new target, lean-js-wire, which fuzzes the Lean half of the
    Lasm.JS value codec and checks the proved round trip
    (Lasm.JS.Spec.decode_encode) on every value it reads.
  • API decisions (docs only): 0.5-8, Ledger's Workers questions:
    compression is left to Cloudflare and there is no Lasm lock (#349); 0.7-7
    and 0.7-16 closed (#357); A55, no WASI reactor build in Stage 0 (#358);
    Jordan's 2026-11-16 sign-offs (#360).