Repository navigation
Build on the module system, and make Lean.Data.Json optional - #3
Merged
Merged
Conversation
carlohamalainen
approved these changes
Oct 11, 2026
carlohamalainen
left a comment
Collaborator
There was a problem hiding this comment.
Looks good to me. Thanks.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
modulecan only import other modules, so a project on Lean's module system can't use datastar-lean yet. This converts the library to modules. It also moves theLean.Data.Jsondecoding into a module of its own, so that a program which reads JSON some other way doesn't link the Lean frontend.Datastar/is now amodule, withpublic imports and apublic section. Non-module code, such as the examples, the tests and datastar-brotli, imports it as before.Datastar.StdHttpgainssignalsTextFromQuery,signalsTextFromBodyandsignalsText, which return the signals as the JSON text the browser sent.signalsFromQuery,signalsFromBodyandreadSignalsmove to the newDatastar.LeanJson, which decodes that text withLean.Data.Json. Their signatures are unchanged.Datastar.Coreis everything exceptDatastar.LeanJson.import Datastarstill brings in both, so existing programs compile unchanged. A program that importsDatastar.StdHttpdirectly forreadSignalsnow needsDatastar.LeanJsonas well.The split is there because
Lean.Data.Jsonis part of the Lean frontend, and linking it makes a one-line program 104 MB rather than 1.4 MB.This is carlohamalainen/datastar-lean#4, applied to this repository now that the library lives here. lean-realworld-example-app, which uses modules throughout and reads the signals with lean-json, builds against this branch, and its API and website test suites pass.
Locally,
lake build,lake test, the doc lint for both packages,lake -d datastar-brotli test, the official SDK tests (scripts/test-sdk.sh) and the Playwright tests ine2e/pass. I haven't rundatastar-brotli/scripts/sanitize.sh.🤖 Generated with Claude Code