Skip to content

feat: embed Datastar JS bundle, serve via --datastar#38

Merged
cablehead merged 7 commits intomainfrom
feat/embedded-datastar-js
Feb 15, 2026
Merged

feat: embed Datastar JS bundle, serve via --datastar#38
cablehead merged 7 commits intomainfrom
feat/embedded-datastar-js

Conversation

@cablehead
Copy link
Owner

@cablehead cablehead commented Feb 14, 2026

Embeds the Datastar 1.0.0-RC.7 JS bundle (~31KB, ~11KB brotli) in the binary. The --datastar flag serves it at /datastar@1.0.0-RC.7.js with immutable cache headers, intercepted before the user closure runs.

image

Built-in endpoint

Requests to the versioned path are handled directly in the handler, skipping the nushell closure entirely. The brotli-compressed bundle is pre-built and embedded via include_bytes! -- zero runtime compression, zero-copy serving. The endpoint is only active when --datastar is passed.

$ http-nu --datastar :3001 ./serve.nu

DATASTAR_JS_PATH constant

The datastar module exports $DATASTAR_JS_PATH so scripts reference the path without hardcoding the version:

use http-nu/datastar *
SCRIPT {type: "module" src: $DATASTAR_JS_PATH}

Other changes

  • Examples updated from $DATASTAR_CDN_URL to $DATASTAR_JS_PATH
  • examples/datastar-counter/ added with a minimal client-side counter demo

@cablehead cablehead merged commit 9740ce1 into main Feb 15, 2026
7 checks passed
@cablehead cablehead deleted the feat/embedded-datastar-js branch February 15, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant