Skip to content

Conversation

@sgammon
Copy link
Member

@sgammon sgammon commented Jul 16, 2025

Ready for review Powered by Pull Request Badge

Summary

Adds a (very simple) static site builder feature to Elide. Supports Markdown, MDX, HTML, and CSS. For now, everything builds file-wise, i.e. each source file is expected to be compiled into exactly-one target file.

  • Static Site Builder
    • New staticSite artifact in elide.pkl
    • StaticSiteContributor to process staticSite blocks
    • Prepare tasks for, and invoke, Markdown, CssBuilder, et al
    • Handle link rendering in Markdown
    • Pack to Zip
    • Support for JavaScript
    • Support for TypeScript
    • Support for SCSS
    • Support for HTML (basic minification)
    • Support identity-addressed assets
    • Support for generic copied files
    • Support link rewriting, asset extension rewriting
    • Support "Global" assets (included on every page)
    • Support page-specific assets
    • Support for image compression (jpg and png)
    • Support for Browserlist
      • New browsers { ... } block
      • Foreign manifest support
      • Dot-file support
    • Support simple dev server
      • Serve built site artifact
      • Serve generic cwd
      • Serve generic directory paths
      • Specify port/host via CLI flags (--host and --port)
      • Specify port/host via elide.pkl (dev.server { ... })
      • Auto-reload support (server-side)
      • Compression
      • Header integration with Chrome Dev Tools

Usage

The user declares a staticSite within their elide.pkl, and then provides a tree of sources.

elide.pkl

amends "elide:project.pkl"
import "elide:project.pkl" as build

artifacts {
  ["main"] = (build.staticSite("src")) {
    // settings can be customized here
  }
}

scripts {
  ["deploy"] = "wrangler deploy"
}

wrangler.toml

name = "elide-static-worker"

[assets]
directory = "./.dev/artifacts/sites/main"

src/index.md

---
title: Static Sample
---

# Static Sample

Static worker sample using Markdown.

terminal

> elide build
Building elide-web-static-worker
[0ms] Configuring project
[31ms] Dependencies ready
[31ms] Building 1 Markdown file (site: main)
[32ms] Packing static site 'main'
[32ms] ✓ Build successful

> elide deploy
$ wrangler deploy

 ⛅️ wrangler 4.24.3
───────────────────
🌀 Building list of assets...
✨ Read 1 file from the assets directory /home/sam/workspace/elide/packages/cli/src/projects/web-static-worker/.dev/artifacts/sites/main
🌀 Starting asset upload...
No updated asset files to upload. Proceeding with deployment...
Total Upload: 0.37 KiB / gzip: 0.25 KiB
Uploaded elide-static-worker (4.12 sec)
Deployed elide-static-worker triggers (0.03 sec)
  static-worker.samples.elide.dev (custom domain)
Current Version ID: 8183c723-29a6-4c8e-8f5f-bd5c7e9ec0c7

Tip

Deployed sample is available at static-worker.samples.elide.dev.

Changelog

feat(cli): static site manifest configurations
feat(tooling): add static site configurations
feat(builder): add static site build contributor
feat(builder): markdown, html, css build support
feat(builder): ability to easily build archives
feat(builder): add `MdxBuilder` and use it from `Markdown`
test(builder): amend markdown tests for compat
test(builder): add test for parsing frontmatter
test(builder): improve testing for `Markdown`
chore: add `web-static-worker` sample
chore: configure static worker sample
chore: deploy static worker sample
chore: add `mdxjs` crate and call into it from jni
chore: add md jni calls to reachability metadata

@sgammon sgammon added this to the Release R18: Beta milestone Jul 16, 2025
@sgammon sgammon requested review from a team and Copilot July 16, 2025 04:07
@sgammon sgammon self-assigned this Jul 16, 2025
@sgammon sgammon added feature Large PRs or issues with full-blown features tools:builder Stuff relating to Elide's builder labels Jul 16, 2025
@sgammon sgammon added this to Elide Jul 16, 2025

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

Attention: Patch coverage is 17.99163% with 1176 lines in your changes missing coverage. Please review.

Project coverage is 39.99%. Comparing base (13bc39d) to head (af6afa2).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../kotlin/elide/tooling/web/StaticSiteContributor.kt 0.00% 624 Missing ⚠️
...kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt 13.13% 84 Missing and 2 partials ⚠️
.../main/kotlin/elide/tool/server/StaticSiteServer.kt 0.00% 70 Missing ⚠️
...uilder/src/main/kotlin/elide/tooling/img/Images.kt 0.00% 69 Missing ⚠️
...ilder/src/main/kotlin/elide/tooling/md/Markdown.kt 73.24% 31 Missing and 11 partials ⚠️
...src/main/kotlin/elide/tooling/project/SourceSet.kt 0.00% 36 Missing ⚠️
...der/src/main/kotlin/elide/tooling/img/ImgNative.kt 0.00% 33 Missing ⚠️
...r/src/main/kotlin/elide/tooling/img/ImageFormat.kt 0.00% 22 Missing ⚠️
...otlin/elide/tool/server/ChromeDevtoolsWorkspace.kt 0.00% 20 Missing ⚠️
...ain/kotlin/elide/tooling/archive/ArchiveBuilder.kt 0.00% 19 Missing ⚠️
... and 21 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1541      +/-   ##
==========================================
- Coverage   40.88%   39.99%   -0.89%     
==========================================
  Files         752      767      +15     
  Lines       35571    36940    +1369     
  Branches     5031     5218     +187     
==========================================
+ Hits        14542    14773     +231     
- Misses      19280    20396    +1116     
- Partials     1749     1771      +22     
Flag Coverage Δ
jvm 39.99% <17.99%> (-0.89%) ⬇️
lib 39.99% <17.99%> (-0.89%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../elide/tooling/jvm/resolver/MavenAetherResolver.kt 0.00% <ø> (ø)
...src/main/kotlin/elide/tooling/md/MarkdownFlavor.kt 100.00% <100.00%> (ø)
...ckages/cli/src/main/kotlin/elide/tool/cli/Elide.kt 32.43% <ø> (ø)
...li/src/main/kotlin/elide/tool/cli/GuestLanguage.kt 87.02% <100.00%> (ø)
...in/kotlin/elide/tool/cli/options/ProjectOptions.kt 18.18% <ø> (ø)
.../src/main/kotlin/elide/runtime/diag/Diagnostics.kt 75.00% <100.00%> (ø)
...ain/kotlin/elide/runtime/diag/MutableDiagnostic.kt 97.14% <100.00%> (+0.59%) ⬆️
...e/runtime/lang/javascript/JavaScriptPrecompiler.kt 55.55% <ø> (ø)
...er/src/main/kotlin/elide/tooling/web/WebBuilder.kt 55.55% <50.00%> (+8.49%) ⬆️
...lin/elide/tool/cli/cmd/builder/ToolBuildCommand.kt 5.79% <0.00%> (-0.05%) ⬇️
... and 29 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13bc39d...af6afa2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sgammon sgammon force-pushed the feat/web-builder branch from e1b3ba4 to 4275c56 Compare July 16, 2025 04:59
@sgammon sgammon moved this to In Progress in Elide Jul 16, 2025
@sgammon sgammon force-pushed the feat/web-builder branch from 4275c56 to 68fb628 Compare July 16, 2025 08:31
@socket-security
Copy link

socket-security bot commented Jul 17, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​biomejs/​biome@​2.1.1 ⏵ 1.8.393 -710010099 +2100

View full report

@sgammon sgammon force-pushed the feat/web-builder branch from ff44fbc to 6819558 Compare July 17, 2025 05:21
@sgammon sgammon force-pushed the feat/web-builder branch from 6819558 to c440fe5 Compare July 17, 2025 21:19
@sgammon sgammon requested a review from Copilot July 18, 2025 05:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive static site builder feature to Elide, enabling users to create and deploy static websites using Markdown, HTML, CSS, TypeScript, and other web technologies. The implementation includes build tooling, a development server, and integration with Cloudflare Workers for deployment.

  • Adds StaticSite artifact type with support for multiple content formats and asset processing
  • Implements static site build pipeline with markdown rendering, CSS/SCSS compilation, and JavaScript/TypeScript bundling
  • Includes development server with live reload, compression, and Chrome DevTools integration
  • Adds browser compatibility configuration through Browsers API with Browserslist support

Reviewed Changes

Copilot reviewed 99 out of 112 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/tooling/src/main/kotlin/elide/tooling/web/Browsers.kt New API for browser compatibility specifications using Browserslist format
packages/tooling/src/main/kotlin/elide/tooling/project/manifest/ElidePackageManifest.kt Added StaticSite artifact type and DevServerSettings configuration
packages/tooling/src/main/kotlin/elide/tooling/project/SourceSet.kt Extended source set language support for web assets (HTML, CSS, Markdown, etc.)
project/website/ Example static site project demonstrating the new web builder capabilities
packages/cli/src/projects/web-static-worker/ Sample static site project with Cloudflare Workers deployment

@sgammon sgammon force-pushed the feat/web-builder branch from bb80230 to 9713bc6 Compare July 18, 2025 05:51
sgammon and others added 11 commits July 18, 2025 02:40
feat: add `MdxBuilder` and use it from `Markdown`
test: improve testing for `Markdown`
chore: add `mdxjs` crate and call into it from jni
chore: add md jni calls to reachability metadata

Signed-off-by: Sam Gammon <sam@elide.dev>
feat(cli): static site manifest configurations
feat(tooling): add static site configurations
feat(builder): add static site build contributor
feat(builder): markdown, html, css build support
feat(builder): ability to easily build archives
test(builder): amend markdown tests for compat
test(builder): add test for parsing frontmatter
chore: add `web-static-worker` sample
chore: configure static worker sample
chore: deploy static worker sample

Signed-off-by: Sam Gammon <sam@elide.dev>
feat: match against, and then rewrite, markdown links
feat: ability to provide a link renderer to md build

Signed-off-by: Sam Gammon <sam@elide.ventures>
feat(builder): parse yaml with snakeyaml for frontmatter
test(builder): add test for parsing yaml frontmatter
chore(builder): drop/cleanup manual frontmatter parser

Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): support for copying static assets
feat(builder): support for global stylesheets
feat(builder): support for global scripts
feat(builder): support for site `prefix`
feat(tooling): scripts/stylesheets for `staticSite` block in `elide.pkl`
fix(tooling): bug with absolute copied/written paths for static sites
chore: add stylesheet and favicon to web static worker sample

Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): add simple js builder support
feat(builder): add simple ts builder support
fix(builder): markdown link rendering and prefix
chore: add js and ts files to example project
chore: add elide types to sample deps

Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): support `scss` flag in `web` crate
feat(builder): invoke `grass` crate and pass to `lightningcss`
fix(builder): extensions for compiled css files

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): jvm-side browserslist container
feat(builder): parse/load browserslist config
feat(builder): add `web.browsers { ... }` block
feat(builder): use project browsers for css builds
test(builder): test for browserslist css render
test(builder): test for browserlist builder

Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): add support for `styles` frontmatter property
feat(builder): add support for `scripts` frontmatter property

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
sgammon added 17 commits July 18, 2025 02:40
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): support for static site server
feat(cli): wire in static site server
feat(cli): support generic static servers in cwd

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): add html builder and minify settings
feat(builder): integrate html builder into md builder
test(builder): tests for html builder
feat(builder): web crate support for html builder
chore: initial structure for `media` crate

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): send workspace information to chrome, when in dev mode
feat(builder): wiring for server-side autoreload triggers
chore: update `tooling` api pins

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
feat(builder): load media crate and use it to compress images
feat(builder): implement `Image` facade on jvm
test(builder): tests for compressing pngs and jpgs

Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
@sgammon sgammon force-pushed the feat/web-builder branch from 9713bc6 to 4c96635 Compare July 18, 2025 09:41
@sgammon sgammon moved this from In Progress to Done in Elide Jul 18, 2025
@sgammon sgammon mentioned this pull request Jul 19, 2025
12 tasks
@sgammon sgammon force-pushed the feat/web-builder branch from 5459ac5 to dc9a651 Compare July 19, 2025 02:06
Signed-off-by: Sam Gammon <sam@elide.dev>
@sgammon sgammon force-pushed the feat/web-builder branch from dc9a651 to af6afa2 Compare July 19, 2025 02:10
@sgammon sgammon merged commit 20380c1 into main Jul 19, 2025
18 checks passed
@elidebot elidebot mentioned this pull request Jul 19, 2025
29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Large PRs or issues with full-blown features tools:builder Stuff relating to Elide's builder

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants