Repository navigation
Release v4.80.0
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,/packagesin the image):approved-packages.jsonand one folder per approved package, named by its npm name. The set is validated with Scene'sApprovedPackageSetJson(malformed sets and a set reusing a shipped package name are refused), the package entry module is resolved from itspackage.json(exports,module,main, orindex.js), andGET /stage/packagesdescribes 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 resolvingPackage.componentnames. 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-domandreact-dom/clientto 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) StageShippedPackagesin the contracts is the one list of shipped package names the renderer's catalog and the live package host both use.Verification/live-custom-packagesruns the built image against a model namingAcme.Chartswith 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 newlive-custom-packagesCI job runs it.- Documentation:
Documentation/reference/custom-packages.mddescribes 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.