Skip to content

Release v4.80.0

Choose a tag to compare

@github-actions github-actions released this 12 Oct 20:46
28b4c87

A live Stage - the cratis/stage image cratis run starts - now renders a ui profile that names a custom runtime package. It is handed the same approved package set a generated application is rendered with, plus the browser build of each package, and loads them at runtime instead of compiling them in.

Added

  • The Host reads a packages folder (Stage:Packages:Path, /packages in the image): approved-packages.json and one folder per approved package, named by its npm name. The set is validated with Scene's ApprovedPackageSetJson (malformed sets and a set reusing a shipped package name are refused), the package entry module is resolved from its package.json (exports, module, main, or index.js), and GET /stage/packages describes the set, where each module is served from, the style sheets and any diagnostics. Only the files inside the approved packages' folders, of the types a package ships, are served under /stage/packages/files/**; the set document and other folders are not reachable. (part of #237)
  • The frontend loads the packages before the first render through Scene's loadApprovedPackages, with an importer for each package the Stage reported - never an address a scene supplied - and renders them next to the shipped Cratis components with the package catalog resolving Package.component names. A package that is missing, does not load, lacks its export or differs from its declaration stops the Stage with the reasons on the page; a profile is never rendered with a package missing. A Stage handed no set renders the shipped packages exactly as before. (part of #237)
  • A shared import map in the Stage page maps react, react/jsx-runtime, react/jsx-dev-runtime, react-dom and react-dom/client to shim modules emitted by the build that re-export the Stage's own React, so a custom package's hooks and contexts are the Stage's. (part of #237)
  • StageShippedPackages in the contracts is the one list of shipped package names the renderer's catalog and the live package host both use.
  • Verification/live-custom-packages runs the built image against a model naming Acme.Charts with the package mounted (the authored component renders from the package, its property, its style sheet, shipped components beside it, no diagnostics) and again with the package folder missing (the Stage refuses to render and names the package), and a new live-custom-packages CI job runs it.
  • Documentation: Documentation/reference/custom-packages.md describes the live Stage's package folder, endpoints and import map in place of the former limit.

Fixed

  • The live Stage no longer silently renders a model whose profile names a custom package as if the package were not there: without the package it says so instead of rendering a placeholder.