[web.worker] bundle named server templates together #125

Merged
eleith merged 1 commits from feat/worker-template-set into main 2026-10-19 21:49:10 +00:00

Summary

Extend the worker compiler from one source to a named set of templates:

  • compileTemplates({ name: { source, filename } }) produces one standalone bundle.
  • The generated module exports render(name, props) returning { body, head }.
  • Every template shares one Svelte server runtime; each render has independent output/CSS.
  • Names are JSON-encoded and selected through a Map, including reserved or quoted names.
  • Source warnings retain filenames; invalid source rejects compilation; unknown names throw.

The old single-source API had no live callers beyond its tests/documentation and
is replaced rather than kept as an unused wrapper.

Scope

Five files only: compiler, its tests, one runtime-context fixture, documentation
and a worker patch changeset. No new dependencies, configuration discovery,
piece/site registration policy, revision publication, worker job hooks, web
integration, fallback behavior or image-pipeline changes.

Verification

  • All 282 worker tests pass across 47 files.
  • Native artifact test prevents workspace dependency fallback and proves shared
    runtime function identity/context cleanup across separately compiled templates.
  • Tests cover selection, output/style isolation, escaped content, reserved/quoted
    names, unknown names and original source diagnostics.
  • ESLint, production TypeScript build, formatting and diff checks pass.
  • Compiler coverage is 100%; overall coverage is 97.65% statements/lines,
    89.86% branches and 99.03% functions.
  • Independent code review found no actionable issues.

Reviewed and explicitly approved before staging. One commit above merged #124;
private plans and unrelated archive edits are excluded.

## Summary Extend the worker compiler from one source to a named set of templates: - `compileTemplates({ name: { source, filename } })` produces one standalone bundle. - The generated module exports `render(name, props)` returning `{ body, head }`. - Every template shares one Svelte server runtime; each render has independent output/CSS. - Names are JSON-encoded and selected through a Map, including reserved or quoted names. - Source warnings retain filenames; invalid source rejects compilation; unknown names throw. The old single-source API had no live callers beyond its tests/documentation and is replaced rather than kept as an unused wrapper. ## Scope Five files only: compiler, its tests, one runtime-context fixture, documentation and a worker patch changeset. No new dependencies, configuration discovery, piece/site registration policy, revision publication, worker job hooks, web integration, fallback behavior or image-pipeline changes. ## Verification - All 282 worker tests pass across 47 files. - Native artifact test prevents workspace dependency fallback and proves shared runtime function identity/context cleanup across separately compiled templates. - Tests cover selection, output/style isolation, escaped content, reserved/quoted names, unknown names and original source diagnostics. - ESLint, production TypeScript build, formatting and diff checks pass. - Compiler coverage is 100%; overall coverage is 97.65% statements/lines, 89.86% branches and 99.03% functions. - Independent code review found no actionable issues. Reviewed and explicitly approved before staging. One commit above merged #124; private plans and unrelated archive edits are excluded.
eleith-gitea-agent Bot added 1 commit 2026-10-19 21:47:48 +00:00
[web.worker] bundle named templates with one server runtime
ci/woodpecker/pr/web-worker Pipeline was successful
ci/woodpecker/push/web-worker Pipeline was successful
c1f688893e
Reviewed and explicitly approved before staging. Compile named sources into one standalone renderer with safe name selection, shared Svelte context and isolated render output. Preserve source diagnostics; no configuration discovery, publication, job registration, or web integration.
eleith merged commit c1f688893e into main 2026-10-19 21:49:10 +00:00
eleith deleted branch feat/worker-template-set 2026-10-19 21:49:10 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eleith/luzzle#125