Not decided yet

Components on the server — design

Status: implemented are markup as HTML, components of the server, their results, Response going up, Content<T>, component values with a result, decorators with guards, wrappers that take the body and the request context, routes, and rooklang/server; the server of the site, site/server/main.rk, is written with them, and the guide has a section on them. The decisions are collected at the end of the document, together with what is not decided yet. Server markup, components and rooklang/server remain experimental in 1.x and may change between releases.

This document builds on components.md: components, decorators, context, components as values. It describes only what is different on the server.

  1. Streaming HTML. The head of a page could go out before the slow parts are ready, with a ReadableStream; then a Response from below would come too late for the status. Perhaps a decorator, @stream, that says a page may be sent in parts.
  2. Islands. A component of the browser made with @html-tag is a custom element, so the server can put <app-counter count={3}> into its HTML and a script of the browser bundle brings it to life. What is missing is how the server knows which scripts a page needs.
  3. The CSS of style. A component of the server with style could add its CSS once per response, into <head>; until then style is an error on the server.
  4. One component for both modes. A component without state, handlers and refs could be compiled both to DOM and to HTML, so that a page and its client share the markup.
  5. A decorator of a cache, @cache("60s"), that answers from memory before the body runs (a guard) and keeps the result after it (a wrapper).
  6. Whether a component of the server is marked async. Now it is not: all of them are. The order comp X() T is open as well.
  7. A flag of the CLI for markup as HTML, as --markup is for that of the browser; now the CLI takes it from the package.

Markdown source on GitHub