LocalResource(root::AbstractString, path::AbstractString, [transform::Function])

Define a local resource to be served at the given path. Optionally specify a transform function that takes outputs the contents of path as a String instead; used for resources that need pre-processing, e.g. TypeScript.

Resource(url::String; name::String, sha256::String)

A remote resource that is downloaded and cached locally.


A middleware that serves resources defined in mod at the paths returned by pathof for each resource.


On-the-fly building of local scripts using bun as the build tool.

If the source file and the build artifact are different file types, e.g. TypeScript, not JavaScript, then specify source as the .ts file.

    root::AbstractString = pwd(),
    entrypoint::AbstractString = "input.ts",
    outdir::AbstractString = "dist",
) -> Watcher

Runs bun build --watch in the given root directory, watching the entrypoint file and writing to the outdir directory. after_rebuild is called whenever the build finishes. This is a zero-argument function that can be used to run any code after the rebuild finishes, such as browser auto-reloaders.

The returned Watcher object can be closed to stop the watcher.

@comptime ex

Evaluate an expression at compile time. This is useful for constructing Resource objects at compile time, e.g.:

my_resource() = @comptime Resource("https://example.com/my_resource.txt"; sha256="...")

while still allowing the value to be "Revise-able", since it isn't a global constant, and instead is a function return value.