Repository navigation
[experimental] render: every file is the page as a live app, with the page's script always in it - #12039
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec ef4beae |
PR Analysis Report🔎 Preview ·
|
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| ~ | cli |
./api/experimental · Types · type RenderPageResponse |
data: { input: string; output: string; bytes: number; files: string[]; stylesheets: string[]; classes: number; cssBytes: number; images: number; warnings: RenderWarning[] } → data: { input: string; output: string; bytes: number; files: string[]; stylesheets: string[]; classes: number; cssBytes: number; images: number; warnings: RenderWarni … #49f620bb |
import type {RenderPageResponse} from '@astryxdesign/cli/api/experimental'; const x: RenderPageResponse = {data: …} |
Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
CI impact: +4.1 job-min per update · pool +2.3% · time to green −31.4 min · standard runners · 1 CI action or script file changed (not measured)
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 182 | 186.1 | +4.1 |
| Runner pool, runner-minutes a day | 63,754 | 65,203 | +1,449 (+2.3%) |
| Average concurrent jobs | 44.3 | 45.3 | +1 |
| Time to green (median → this run) | 43.5 min | 12.1 min | −31.4 min |
| Runs a day | 350 | 350 | 0 |
Changed jobs: node-browser-contracts changed: standard
Not measured (the jobs that use these keep their recent minutes above): .github/scripts/render-interaction-parity.browser.test.mjs.
Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: the interactive render works for plain pages, but six defects and one missing test need fixing first.
Blocking
--interactiverefuses packages that are ready for the browser, because the Node built-in check inclient-bundle.mjsruns before resolution for every importer, so a package'sbrowsermap ("fs": false) and an installed npm polyfill such aseventsnever apply; resolve the name withbuild.resolvefirst and refuse only when that fails.- A page module loaded lazily (
lazy(() => import('./panel'))) is unstyled in the interactive file, becausepage-worker.mjscompiles the page's StyleX CSS before the bundle step records that module's rules; compute the CSS after the bundle. - The text output prints
script: … (N modules), which no JSON key names, and omitsinteractive,scriptBytesandscriptModules, against the CLI rule that text field names mirror JSON keys; print those keys and add an--interactivecase totext-json-parity.test.mjs. - The optional peer range
>=0.25.0 <1.0.0makes npm install a second esbuild in projects that already hold an older one (a Vite 6.0 app gets esbuild 0.28.2 at its root) and print an ERESOLVE warning when esbuild <0.25 is a direct dependency, so the docs line "a CLI install does not carry it" is not true; declare a range that excludes nothing npm may find and keep the minimum as a runtime check, or declare no peer. - The render guide says copy buttons fall back to the browser's copy command in a sandboxed frame, but Core's
useClipboardhas no such fallback until #12035 lands; drop the sentence or land it after #12035. esbuild-peer.mjsfinds esbuild withrequire.resolveinstead of the existingfindInstalledPackageinfoundation/fs/paths.mjs, which already finds an installed package with its version and avoids NODE_PATH and global folders; use the shared finder.- No test proves that
--interactivecomposes with--title, which the CLI's option rules require for every pair of options; add one.
Smaller points: the API-level install suggestion for a missing esbuild is untested through render(), and "loads nothing from the network and runs no eval" is exact only as "the render adds no network request and no eval".
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the script is inline after the embedded source, bundled, minified and tree-shaken by esbuild: verified (
client-bundle.mjsbuild options,render-page.mjswrite order). - Claim: the page's own files compile as the server compiled them: verified for aliases, assets and StyleX class names; false for StyleX rules of a lazily loaded module (blocking finding).
- Claim: the markup paints first inside a
display: contentswrapper andcreateRootdraws the live page: verified (code and jsdom test). - Claim: the stylesheet keeps the rules every class name in the script needs: verified for Core and package stylesheets; false for the page's own StyleX in lazily loaded modules.
- Claim: the note, the printed commands, the "Render it again" line and the record carry the interactive mode: verified (tests).
- Claim: esbuild is an optional peer loaded only by
--interactive, found from the page's folder then beside the CLI: verified (render-page.mjs, static-render test). - Claim: a CLI install does not grow and a cold
npxstays as fast: true for a coldnpx; false for npm projects that already hold an esbuild below 0.25. - Claim: a missing or out-of-range esbuild writes nothing and names the install command: verified (tests).
- Claim: a page whose script needs Node stops with
ERR_RENDER_INTERACTIVEnaming the module: verified, but browser-ready packages are refused too (blocking finding). - Claim:
--interactivewith--reverseisERR_INVALID_ARGUMENT; new optional JSON fieldsinteractive,scriptBytes,scriptModules: verified (tests, CLI run). - Claim: the record gains an optional
interactiveand the render format stays 1: verified (source-block.mjs). - Claim: a render without
--interactiveis unchanged byte for byte: verified (test). - Claim: the script cannot end its element or pose as the embedded source, and it is parsed before it is written: verified (
scriptSafe,vm.Script). - Claim: released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse an interactive file exactly: not reproduced; consistent with the reverse reader.
- Claim: the template sweep, the Chromium sandbox run and the file sizes: not reproduced; a one-button page measured 508 KB here.
- Claim (docs): copy buttons copy in a sandboxed frame: false at this head (blocking finding).
- Files:
.changeset/render-interactive.mdclear;api/render/_adapter.mjsnon-blocking test note;api/render/render.doc.mjsclear;api/render/render.interactive.test.mjsmissing--titlepair test;api/render/render.mjsclear;api/render/render.type.mjsclear;assets/docs/tree/render-pages.doc.mjsfalse copy and install claims;assets/docs/tree/share-a-page.doc.mjsclear;commands/experimental-render.doc.mjsclear;commands/experimental/render.mjstext/JSON key mismatch;doc-compiler/doc-loads.test.mjsclear;foundation/render/client-bundle.mjsbuilt-in refusal;foundation/render/esbuild-peer.mjsshared finder bypassed;foundation/render/file-header.mjsclear;foundation/render/page-worker.mjsCSS before bundle;foundation/render/render-page.mjsclear;foundation/render/source-block.mjsclear;response/error-codes.doc.mjsclear;response/error-codes.mjsclear;packages/cli/package.jsonpeer range;pnpm-lock.yamlclear.
…o its controls work in the file
…tyle lazy modules, print the JSON keys, peer of any version
ef4beae to
5fb3b9f
Compare
|
/approve-spec 5fb3b9f |
|
/approve-spec c8fca50 |
There was a problem hiding this comment.
Changes requested: the interactive render works as described and every point from the last review is fixed, but one misleading output remains.
Blocking
- Miss: an
--interactiverender still adds thescreen-queryandchart-sizewarnings (render-page.mjs, the two warnings afterconst script), which say the file never runsuseMediaQueryand that an undrawn chart stays empty, although the file's own script runs the query and draws the chart once it mounts; word both for the interactive file, or drop them whenscriptis set, and add a test for each.
Smaller points, none blocking: the exit-code text still speaks of "the range the CLI declares" though the CLI now declares any version, the --interactive help text and RenderOptions.interactive still say "no network and no dependency", and "a strict content security policy" holds for the script only under a policy that allows inline scripts, the one the description tested.
Claims and files checked
Review mode: full; reason: history
- Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (client bundle build options, write order in the render).
- Claim: the markup paints first in a
display: contentswrapper and the script draws the live page withcreateRoot: verified (code, jsdom test, a page outside a project clicked here). - Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets,
?raw/?inline): verified (one shared compile function). - Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test; local and package stylesheets probed here).
- Claim: a package's
browsermap and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (test). - Claim: the stylesheet keeps the rules every class name in the script needs: verified (kept-rule set).
- Claim: the note, the printed commands, the "Render it again" line and the record carry the interactive mode: verified (tests).
- Claim: esbuild is an optional peer of any version, loaded only by
--interactive, and installing the CLI never adds or moves an esbuild a project has: verified (manifest, static-render test, npm probe with a Vite 6 project). - Claim: esbuild is found from the page's folder, then beside the CLI, through the shared package lookup; missing or out of range, the render writes nothing and names the install command in the project's package manager: verified (tests, shared finder and install-command helper).
- Claim: a page whose script needs Node stops with
ERR_RENDER_INTERACTIVEnaming the module: verified (test). - Claim:
--interactivewith--reverseisERR_INVALID_ARGUMENT; the JSON addsinteractive,scriptBytes,scriptModulesand the text prints the same keys: verified (tests, parity case). - Claim: the record gains an optional
interactiveand the render format stays 1: verified. - Claim: a render without
--interactiveis unchanged: verified (code path and test). - Claim: doctor never mentions esbuild: verified (test).
- Claim: the render adds no network request and no
eval: verified for the render; the script runs only where the frame allows scripts and the policy allows inline scripts (non-blocking wording note). - Claim: with
--interactive, a layout picked withuseMediaQueryfits the reader's screen once the script runs: true in the file, contradicted by the render's own warning (blocking finding). - Claim: released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse an interactive file exactly: not reproduced; consistent with the reverse reader.
- Claim: the template sweep, the Chromium sandbox run and the file sizes: not reproduced; a one-button Astryx counter page carried 412.6 KB of script here.
- Claim: the copy-button console errors are fixed in Core by #12035: that pull request is still open; this pull request's docs no longer rely on it.
- Files:
.changeset/render-interactive.mdclear (policy wording note);api/render/_adapter.mjsclear;api/render/render.doc.mjsclear (policy wording note);api/render/render.interactive-missing.test.mjsclear;api/render/render.interactive.test.mjsclear;api/render/render.mjsclear;api/render/render.type.mjswording note;assets/docs/tree/render-pages.doc.mjsclear;assets/docs/tree/share-a-page.doc.mjsclear;commands/experimental-render.doc.mjswording notes;commands/experimental/render.mjsclear;commands/text-json-parity.test.mjsclear;doc-compiler/doc-loads.test.mjsclear;foundation/render/client-bundle.mjsclear;foundation/render/esbuild-peer.mjsclear;foundation/render/file-header.mjsclear;foundation/render/page-worker.mjsclear;foundation/render/render-page.mjswarnings for interactive renders (blocking);foundation/render/source-block.mjsclear;response/error-codes.doc.mjsclear;response/error-codes.mjsclear;packages/cli/package.jsonclear;pnpm-lock.yamlclear.
…warnings say what the script does
|
/approve-spec 52c6572 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The interactive render's screen-query and chart-size warnings now describe what the interactive file does, with a test each, and the wording points from the last review are fixed; nothing blocks.
One small point: the description says #12035 fixes the copy-button console errors, but that pull request is still open.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (client-bundle.mjs build options; render-page.mjs writes the script after the source block; test).
- Claim: the markup paints first in a
display: contentswrapper and the script draws the live page withcreateRoot: verified (render-page.mjs body and style, client-bundle.mjs mount, jsdom test). - Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets,
?raw/?inline): verified (one shared page compile in page-worker.mjs). - Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test).
- Claim: a package's
browsermap and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (client-bundle.mjs resolves first; test). - Claim: the stylesheet keeps the rules every class name in the script needs: verified (render-page.mjs kept-rule set).
- Claim: the note, the printed commands, the "Render it again" line and the record carry the interactive mode: verified (tests).
- Claim: the
screen-queryandchart-sizewarnings say what an interactive file does, and that a viewer blocking scripts keeps the first paint: verified (render-page.mjs, two tests, a narrow-screen probe that switches layouts once the script runs). - Claim: esbuild is an optional peer of any version, loaded by dynamic import only for
--interactive, so a CLI install neither grows nor adds or moves a project's esbuild: verified (package.json, static-render test). - Claim: the render checks
>=0.25.0 <1.0.0itself, looks in the page's folder then beside the CLI through the shared lookup, and when none fits writes nothing and names the install command in the project's package manager: verified (esbuild-peer.mjs, tests). - Claim: still one file, with no network request and no
evaladded by the render, so it runs in a frame that allows scripts under a policy that allows inline scripts: verified for the render; the browser sandbox run was not reproduced. - Claim:
--reversegives the source back byte for byte, and--interactivewith--reverseisERR_INVALID_ARGUMENT: verified (tests). - Claim: the JSON gains
interactive,scriptBytes,scriptModules(andinteractiveon a reverse), and the text prints the same keys: verified (tests, parity case). - Claim: a page whose script needs Node stops with the new
ERR_RENDER_INTERACTIVEnaming the module; a missing or old esbuild isERR_RENDER_MISSING_DEPENDENCYwith the install command: verified (tests). - Claim: the record gains an optional
interactiveand the render format stays 1: verified (source-block.mjs). - Claim: a render without
--interactiveis unchanged byte for byte: verified (the base and head CLIs wrote identical bytes for the same page). - Claim: doctor never mentions esbuild: verified (test).
- Claim: released CLIs 0.7.10, 0.7.12 and 0.7.15 reverse an interactive file exactly: not reproduced; consistent with the reverse reader, which stops at the embedded source.
- Claim: the template sweep, the browser sandbox checks and the file sizes: not reproduced; a one-button counter page carried 412.6 KB of script here.
- Claim: the copy-button errors are fixed in Core by #12035: that pull request is still open (non-blocking).
- Files:
.changeset/render-interactive.mdclear;api/render/_adapter.mjsclear;api/render/render.doc.mjsclear;api/render/render.interactive-missing.test.mjsclear;api/render/render.interactive.test.mjsclear;api/render/render.mjsclear;api/render/render.type.mjsclear;assets/docs/tree/render-pages.doc.mjsclear;assets/docs/tree/share-a-page.doc.mjsclear;commands/experimental-render.doc.mjsclear;commands/experimental/render.mjsclear;commands/text-json-parity.test.mjsclear;doc-compiler/doc-loads.test.mjsclear;foundation/render/client-bundle.mjsclear;foundation/render/esbuild-peer.mjsclear;foundation/render/file-header.mjsclear;foundation/render/page-worker.mjsclear;foundation/render/render-page.mjsclear (warnings fixed);foundation/render/source-block.mjsclear;response/error-codes.doc.mjsclear;response/error-codes.mjsclear;packages/cli/package.jsonclear;pnpm-lock.yamlclear.
There was a problem hiding this comment.
Changes requested: the interactive render works as described and every earlier point is fixed, but CI on this head fails the required test check on two tests this change breaks.
- Found by CI:
scripts/npm/published-manifests.test.mjsstill expects Core to be the CLI's only peer, so the new optionalesbuildpeer inpackages/cli/package.jsonfails it; update the test to expect both optional peers and rename it. - Found by CI: the new "Keep the controls working" prose in
packages/cli/assets/docs/tree/render-pages.doc.mjsrepeats share-a-page's "in an artifact viewer that shows HTML in a sandboxed frame" word for word, sopackages/cli/test/core-doc-quality.test.mjsfails; reword the sentence or link to share-a-page instead.
Both tests pass on the base branch and fail on this head.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
- Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (client-bundle.mjs build options; render-page.mjs writes it after the source block; test).
- Claim: the markup paints first in a
display: contentswrapper and the script draws the live page withcreateRoot: verified (render-page.mjs:1328-1331, client-bundle.mjs:101-103, jsdom test). - Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets,
?raw/?inline): verified (one sharedcompilePageModulein page-worker.mjs). - Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test).
- Claim: a package's
browsermap and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (client-bundle.mjs:124; test). - Claim: the stylesheet keeps the rules every class name in the script needs: verified (render-page.mjs:1038).
- Claim: the note, the printed commands, the "Render it again" line and the record keep the interactive mode: verified (tests).
- Claim: the
screen-queryandchart-sizewarnings say what an interactive file does: verified (render-page.mjs:1131, :1151, :1168; tests). - Claim: esbuild is an optional peer of any version, loaded by dynamic import only for
--interactive, so a CLI install neither grows nor adds or moves a project's esbuild: verified (package.json, page-worker.mjs, static-render test); it breaks the manifest test above. - Claim: the render checks
>=0.25.0 <1.0.0itself, looks in the page's folder then beside the CLI through the shared lookup, and names the install command in the project's package manager: verified (esbuild-peer.mjs, tests). - Claim: still one file, with no network request and no
evaladded by the render, so it runs in a sandboxed frame that allows inline scripts: verified for the render output; the browser sandbox run was not reproduced. - Claim:
--reversegives the source back byte for byte, and--interactivewith--reverseisERR_INVALID_ARGUMENT: verified (tests). - Claim: the JSON gains
interactive,scriptBytes,scriptModules(andinteractiveon a reverse), and the text prints the same keys: verified (tests, parity case). - Claim: a page whose script needs Node stops with
ERR_RENDER_INTERACTIVEnaming the module; a missing or old esbuild isERR_RENDER_MISSING_DEPENDENCYwith the install command: verified (tests). - Claim: the record gains an optional
interactiveand the render format stays 1: verified (source-block.mjs). - Claim: a render without
--interactiveis unchanged byte for byte: verified (static-render test). - Claim: doctor never mentions esbuild: verified (test).
- Claim: released CLIs reverse an interactive file exactly: not reproduced; consistent with the reverse reader, which stops at the embedded source.
- Claim: the template sweep, the browser sandbox checks and the file sizes: not reproduced.
- Claim: the copy-button errors are fixed in Core by the clipboard fallback pull request: verified, it is now merged.
- Claim: the listed test, typecheck, README, structure, changeset, Prettier and ESLint runs: lint, typecheck and smoke checks pass in CI; the listed test run leaves out the two failing tests above.
- Files:
.changeset/render-interactive.mdclear;api/render/_adapter.mjsclear;api/render/render.doc.mjsclear;api/render/render.interactive-missing.test.mjsclear;api/render/render.interactive.test.mjsclear;api/render/render.mjsclear;api/render/render.type.mjsclear;assets/docs/tree/render-pages.doc.mjsrepeated passage (blocking);assets/docs/tree/share-a-page.doc.mjsclear;commands/experimental-render.doc.mjsclear;commands/experimental/render.mjsclear;commands/text-json-parity.test.mjsclear;doc-compiler/doc-loads.test.mjsclear;foundation/render/client-bundle.mjsclear;foundation/render/esbuild-peer.mjsclear;foundation/render/file-header.mjsclear;foundation/render/page-worker.mjsclear;foundation/render/render-page.mjsclear;foundation/render/source-block.mjsclear;response/error-codes.doc.mjsclear;response/error-codes.mjsclear;packages/cli/package.jsonbreaks the manifest test (blocking);pnpm-lock.yamlclear.
…es esbuild as the CLI's second optional peer; the render guide no longer repeats the share guide
|
/approve-spec f980fc7 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. Its run found no room under the CI ceiling and was cancelled before the test, build and docsite jobs started, so it needs a re-run.
Both points from the last review are fixed: the manifest test now expects esbuild as the CLI's second optional peer, and the render guide's new section no longer repeats the share guide, so both tests pass on this head.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: the file carries the page's own script inline after the embedded source, bundled for the browser, minified and tree-shaken: verified (
client-bundle.mjs:158-178,render-page.mjs:1410; test). - Claim: the markup paints first in a
display: contentselement and the script draws the live page into it withcreateRoot: verified (render-page.mjs:1328-1331,client-bundle.mjs:101-103; jsdom test; Chromium frames). - Claim: the page's own files compile as the server compiled them (aliases, StyleX class names, assets,
?raw/?inline): verified (one sharedcompilePageModuleinpage-worker.mjs). - Claim: a lazily loaded module is bundled and its styles join the stylesheet: verified (test).
- Claim: a package's
browsermap and an installed stand-in for a Node module work, and a Node module is refused only when nothing resolves it: verified (client-bundle.mjs:124-140; test). - Claim: the stylesheet keeps the rules every class name in the script needs: verified (
render-page.mjs:1038). - Claim: the note, the printed commands, the "Render it again" line and the record keep the interactive mode: verified (
file-header.mjs,source-block.mjs:119; tests). - Claim: the
screen-queryandchart-sizewarnings say what an interactive file does: verified (render-page.mjs:1130-1170; tests). - Claim: esbuild is an optional peer of any version, loaded by dynamic import only for
--interactive, so a CLI install neither grows nor adds or moves a project's esbuild: verified (package.json,page-worker.mjs:1355, static-render test, manifest test). - Claim: the render checks
>=0.25.0 <1.0.0itself, looks in the page's folder then beside the CLI through the shared lookup, and names the install command in the project's package manager: verified (esbuild-peer.mjs:29-80; tests). - Claim: still one file, with no network request and no
evaladded by the render, so it runs in a sandboxed frame that allows inline scripts: verified for the render output and in Chromium with no request or console error; the description's viewer-policy run was not reproduced. - Claim:
--reversegives the source back byte for byte, and--interactivewith--reverseisERR_INVALID_ARGUMENT: verified (render.mjs:58; tests). - Claim: the JSON gains
interactive,scriptBytes,scriptModules(andinteractiveon a reverse), and the text prints the same keys: verified (tests, parity case). - Claim: a page whose script needs Node stops with
ERR_RENDER_INTERACTIVEnaming the module; a missing or old esbuild isERR_RENDER_MISSING_DEPENDENCYwith the install command: verified (tests). - Claim: the record gains an optional
interactiveand the render format stays 1: verified (source-block.mjs). - Claim: a render without
--interactiveis unchanged byte for byte: verified (static-render test; first paint identical in Chromium). - Claim: doctor never mentions esbuild: verified (test).
- Claim: released CLIs reverse an interactive file exactly: not reproduced; consistent with the reverse reader, which stops at the embedded source.
- Claim: the template sweep, the browser sandbox checks and the file sizes: not reproduced; a counter page measured 496.6 KB, 412.6 KB of it script.
- Claim: the copy-button errors are fixed in Core by the clipboard fallback pull request: verified, it is merged.
- Claim: the listed tests and checks pass: verified for the render, docs, response, CLI test folder and npm manifest suites, and Lint passes in CI; the typecheck, README and structure checks were not reproduced, and CI has not run them on this head.
- Files:
.changeset/render-interactive.mdclear;api/render/_adapter.mjsclear;api/render/render.doc.mjsclear;api/render/render.interactive-missing.test.mjsclear;api/render/render.interactive.test.mjsclear;api/render/render.mjsclear;api/render/render.type.mjsclear;assets/docs/tree/render-pages.doc.mjsclear (repeated passage fixed);assets/docs/tree/share-a-page.doc.mjsclear;commands/experimental-render.doc.mjsclear;commands/experimental/render.mjsclear;commands/text-json-parity.test.mjsclear;doc-compiler/doc-loads.test.mjsclear;foundation/render/client-bundle.mjsclear;foundation/render/esbuild-peer.mjsclear;foundation/render/file-header.mjsclear;foundation/render/page-worker.mjsclear;foundation/render/render-page.mjsclear;foundation/render/source-block.mjsclear;response/error-codes.doc.mjsclear;response/error-codes.mjsclear;packages/cli/package.jsonclear;pnpm-lock.yamlclear;scripts/npm/published-manifests.test.mjsclear (expects both optional peers).
The page's script is always in the file: no --static or --interactive. esbuild becomes a dependency of the CLI, loaded only inside render. In a viewer's sandboxed frame, a link out of the file opens in a new tab and a form submits through its submit event, which the file fires itself. A page whose script cannot be built is refused with ERR_RENDER_SCRIPT. A browser check compares every interaction in the file against the same page built as a Vite app.
…er carries the script
…lways in the file now, and to drop the flag
|
Owner decision (engineering owner, covering this pull request): every |
|
/approve-spec 5483d54 |
# Conflicts: # packages/cli/api/theme-edit/_parts.mjs # packages/cli/foundation/render/render-page.mjs
|
/approve-spec 700caaa |
|
/approve-spec 8676817 |
There was a problem hiding this comment.
Changes requested: the rendered file works as a live app for ordinary pages, but three defects need fixing first.
- A page whose script throws in a sandboxed viewer frame loses its first paint and shows an empty page, because
createRootclears the markup and an uncaught error unmounts the root (client-bundle.mjs:156), so keep the first paint when the script fails (an error boundary oronUncaughtErrorthat restores the saved markup), add a test for a page that writeslocalStoragein an effect, and name storage among what a frame blocks in the render guide. --staticand--interactiveare refused withERR_INVALID_ARGUMENT, while every other option the command does not take answersERR_INVALID_OPTION, so answerERR_INVALID_OPTION(experimental/render.mjs:49) and agents that branch on the code treat them like any unknown flag.- Miss: a syntax error in a module the page loads lazily comes back as
ERR_RENDER_SCRIPTwith the author's absolute path, the importer's line and, in a terminal or CI, a coloured code frame, while the same error in a static import isERR_RENDER_COMPILEnaming the file and line, so report it the way the server render does (client-bundle.mjs:243).
Non-blocking: response-types.doc.mjs does not list scriptBytes and scriptModules, and some test descriptions still describe the opt-in design. CI has passed so far on this head, with four test shards still running.
Claims and files checked
Review mode: incremental; reason: none
Changed rules (0): none
Claims:
- Changeset: the file is the page as a live app and its controls work as in the app: verified for ordinary pages (button and form cases in render.interactive.test.mjs pass); false for a page whose script throws in a sandboxed frame (first blocking finding)
- Changeset: the script is inline after the embedded source, bundled by esbuild: verified (render-page.mjs:1378 and :1454; render.notes.test.mjs)
- Changeset: the file paints its markup first, then the script draws over it: verified (client-bundle.mjs:156; jsdom case)
- Changeset: one file, no network request and no eval added, so it works in a sandboxed frame that allows scripts: one file and no request verified (render.test.mjs); works in the frame is false for pages that touch storage (first blocking finding)
- Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (markup stays in the body; reverse cases in render.interactive.test.mjs)
- Changeset: a link out opens a new tab and a form submits through its submit event: verified (render-page.mjs:705; client-bundle.mjs:33-71; jsdom form case)
- Changeset: a page whose script cannot be built is refused with ERR_RENDER_SCRIPT naming the module: verified for a module that needs Node (node:fs case); a lazily loaded module's syntax error gets that code with a machine path (third blocking finding)
- Changeset: esbuild is a new CLI dependency that only the render loads: verified (package.json:137 from the catalog's ^0.28.2; lazy-dependencies.test.mjs)
- Changeset: the JSON adds scriptBytes and scriptModules: verified (_adapter.mjs:526-527; render.mjs:85-86)
- Changeset: the credit line names the author: verified
- Description: the file shows the same as the app after the same clicks, keys and typing in a sandboxed frame: verified for the parity page (the parity browser step passed in CI at this head)
- Description: the page's files compile as the server compiled them, a lazily loaded module is styled, a package's browser map and an installed stand-in work: verified (cases in render.interactive.test.mjs)
- Description: the stylesheet keeps the rules for class names the script holds: verified (render-page.mjs:1080)
- Description: the note and the screen-query and chart-size warnings describe the script: verified (file-header.mjs; render-page.mjs:1177, :1197, :1214; warning tests)
- Description: there is no option to leave the script out: verified; the removed flags answer the wrong error code (second blocking finding)
- Description: the theme editor stays markup-only and the docsite previews drop the script: verified (theme-edit/_parts.mjs:653; generate-landing-template-previews.mjs:153, :192)
- Description: render format stays 1 and the record gains no field: verified (record fields unchanged; only the hashed markup includes the wrapper)
- Description: the template sweep, file sizes, first-run install cost and released-CLI reverses: not reproduced
- Description: copy buttons were since fixed in Core by a clipboard fallback: verified on main (useClipboard.ts); not part of this branch
Files:
- packages/cli/foundation/render/client-bundle.mjs: first and third blocking findings; link-out pattern duplicated (non-blocking)
- packages/cli/clients/cli/commands/experimental/render.mjs: second blocking finding
- packages/cli/foundation/render/page-worker.mjs: third blocking finding (the error is passed on as it is); merge resolution clear
- packages/cli/foundation/render/render-page.mjs: clear (link-out pattern duplicated, non-blocking); merge resolution clear
- packages/cli/foundation/render/esbuild-dependency.mjs: clear
- packages/cli/foundation/render/file-header.mjs: clear
- packages/cli/api/render/_adapter.mjs: clear
- packages/cli/api/render/render.doc.mjs: clear
- packages/cli/api/render/render.type.mjs: clear
- packages/cli/clients/cli/commands/experimental-render.doc.mjs: clear
- packages/cli/foundation/response/error-codes.mjs: clear
- packages/cli/foundation/response/error-codes.doc.mjs: clear
- packages/cli/api/theme-edit/_parts.mjs: clear; merge resolution keeps both options
- apps/docsite/scripts/generate-landing-template-previews.mjs: clear
- packages/cli/assets/docs/tree/render-pages.doc.mjs: should name storage among what a frame blocks (part of the first finding)
- packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear
- .changeset/render-interactive.md: claim narrowed by the first finding; credit line clear
- packages/cli/package.json: clear
- pnpm-lock.yaml: clear
- .github/workflows/ci.yml: clear
- .github/scripts/render-interaction-parity.browser.test.mjs: clear
- packages/cli/api/render/render.interactive.test.mjs: stale header text (non-blocking); the refusal test needs the new code
- packages/cli/api/render/render.interactive-missing.test.mjs: clear
- packages/cli/api/render/render.notes.test.mjs: clear
- packages/cli/api/render/render.test.mjs: clear
- packages/cli/foundation/render/render.test.mjs: clear
- packages/cli/foundation/doc-compiler/doc-loads.test.mjs: stale runner descriptions (non-blocking)
- packages/cli/test/lazy-dependencies.test.mjs: clear
…nt, string-path images keep showing, and a lazy module's compile error names its file
|
/approve-spec f346546 |
There was a problem hiding this comment.
Changes requested: the three issues from the last review are fixed at this head, but the required Node test legs fail.
- Regression: every
test-nodeleg fails with "Node legs over budget", becauserender.interactive.test.mjs,render.interactive-missing.test.mjsandrender-interaction-parity.browser.test.mjshave no recorded time inscripts/vitest-node-durations.json, so the planner books each at 12.9 s and the longest of the 8 legs plans 1389.1 s against the 1386.7 s budget (main alone plans 1384.4 s); record their times there (the parity file is skipped in the Node legs and the missing-esbuild case takes milliseconds) or speed up the render tests, then rerun CI.
Non-blocking: withCarriedPaths also rewrites a string shown as text when it equals an inlined image path, so a caption that names ./photo.png turns into the image's data URI once the script runs; and doc-loads.test.mjs:441 and :453 still describe the opt-in design. The rest of CI passed at this head, the parity browser step included.
Claims and files checked
Review mode: incremental; reason: none
Changed rules (0): none
Claims:
- Changeset: the file is the page as a live app and its controls work as in the app: verified (counter and form cases in
render.interactive.test.mjs; two clicks count to 2 in Chromium in a sandboxed frame) - Changeset: the script is inline after the embedded source, bundled by esbuild: verified (
render-page.mjs:1486;client-bundle.mjs) - Changeset: the file paints its markup first, then the script draws over it: verified (
client-bundle.mjs:162-169; jsdom case) - Changeset: one file, no network request and no eval added, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts: verified (
render.test.mjsone-file case; Chromium under the parity test's policy) - Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (markup stays in the body; reverse cases)
- Changeset: a link out opens a new tab and a form submits through its submit event: verified (
render-page.mjs:705;client-bundle.mjs:37; jsdom form case) - Changeset: a page whose script cannot be built is refused with ERR_RENDER_SCRIPT naming the module: verified (
node:fscase) - Changeset: esbuild is a new CLI dependency that only the render loads: verified (packed manifest
esbuild: ^0.28.2;lazy-dependencies.test.mjs) - Changeset: the JSON adds scriptBytes and scriptModules: verified (
_adapter.mjs:526-527;render.mjs:85-86) - Changeset: a page whose script throws in its render or an effect keeps its first paint: verified (storage case in jsdom; a storage effect and a render throw in Chromium)
- Changeset: an image named by a string path keeps showing once the script draws, and a srcSet image is carried: verified (image case; the first paint now inlines React's
srcSet); the rewrite also changes equal strings shown as text (non-blocking) - Changeset: a lazily loaded page file that does not compile is refused as a static import is, with ERR_RENDER_COMPILE naming the file and line: verified (lazy case; the CLI with CI set prints no colour and no machine path)
- Changeset: the credit line names the author: verified
- Description: the page's files are compiled as the server compiled them, so the browser draws the same page: verified for the compile (
page-worker.mjs,compilePageModule(…, true)); see the non-blocking rewrite note - Description: a lazily loaded module is styled, a package's browser map and an installed stand-in work: verified (cases in
render.interactive.test.mjs) - Description: the stylesheet keeps the rules for class names the script holds: verified (
render-page.mjs:1112) - Description: Enter in a form's only text field submits, and a form aimed at another site submits natively: verified (
client-bundle.mjs:37-75; jsdom Enter case) - Description: there is no option to leave the script out, and the removed flags are refused: verified (
--staticand--interactiveanswer ERR_INVALID_OPTION, as an unknown option does) - Description: the note and the screen-query and chart-size warnings describe the script: verified (
file-header.mjs:67;render-page.mjs:1208,:1228,:1245; warning tests) - Description: the theme editor stays markup-only and the docsite previews drop the script: verified (
theme-edit/_parts.mjs:653;generate-landing-template-previews.mjs:153,:192) - Description: render format stays 1 and released CLIs reverse a file with a script: the record gains no field and the base reader stops the markup at the embedded source (
source-block.mjs:262-267); the released CLIs were not run - Description: stable commands and doctor are unchanged: verified (doctor case; only render paths change)
- Description: the template sweep, file sizes and first-run install cost: not reproduced (a one-button page measured 513 KB here)
- Description: interaction parity with the app in a sandboxed frame: verified (the parity browser step passed in CI at this head)
- Description: copy buttons were since fixed in Core by a clipboard fallback: verified on main (
useClipboard.ts); not part of this branch
Files:
packages/cli/api/render/render.interactive.test.mjs: blocking finding (no recorded time; Node leg plan over budget)packages/cli/api/render/render.interactive-missing.test.mjs: blocking finding (same).github/scripts/render-interaction-parity.browser.test.mjs: blocking finding (same)packages/cli/foundation/render/render-page.mjs: non-blocking (the image path rewrite reaches strings shown as text)packages/cli/foundation/doc-compiler/doc-loads.test.mjs: non-blocking (opt-in wording)packages/cli/foundation/render/client-bundle.mjs: clearpackages/cli/foundation/render/page-worker.mjs: clearpackages/cli/foundation/render/esbuild-dependency.mjs: clearpackages/cli/foundation/render/file-header.mjs: clearpackages/cli/foundation/render/render.test.mjs: clearpackages/cli/clients/cli/commands/experimental/render.mjs: clearpackages/cli/clients/cli/commands/experimental-render.doc.mjs: clearpackages/cli/api/render/_adapter.mjs: clearpackages/cli/api/render/render.doc.mjs: clearpackages/cli/api/render/render.type.mjs: clearpackages/cli/api/render/render.notes.test.mjs: clearpackages/cli/api/render/render.test.mjs: clearpackages/cli/api/theme-edit/_parts.mjs: clearpackages/cli/assets/docs/tree/render-pages.doc.mjs: clearpackages/cli/assets/docs/tree/share-a-page.doc.mjs: clearpackages/cli/foundation/response/error-codes.mjs: clearpackages/cli/foundation/response/error-codes.doc.mjs: clearpackages/cli/foundation/response/response-types.doc.mjs: clearpackages/cli/package.json: clearpackages/cli/test/lazy-dependencies.test.mjs: clearpnpm-lock.yaml: clear.github/workflows/ci.yml: clearapps/docsite/scripts/generate-landing-template-previews.mjs: clear.changeset/render-interactive.md: clear
| * @param {Map<string, string>} rewrites | ||
| * @returns {string} | ||
| */ | ||
| export function withCarriedPaths(script, rewrites) { |
There was a problem hiding this comment.
Non-blocking: this rewrites every string in the bundle that equals an inlined image path, not only the ones that reach an image. files.map(f => <figure><img src={f} /><figcaption>{f}</figcaption></figure>) with './photo.png' paints the caption ./photo.png, then the script draws the image's whole data URI as the caption. Mapping the value only where it reaches src, srcset or poster (for example when React sets the attribute) keeps text as the page wrote it.
…on answer, recorded test times - The page's script build sends only the page's own files and the mount through esbuild's plugin; esbuild resolves and loads every package file itself (about 1.2 s to 0.3 s for a small page). - --static and --interactive are answered by the unknown-option path (ERR_INVALID_OPTION, with what to do), not hidden options, so the command's options match its doc. - withCarriedPaths leaves text the page shows (children) as written. - Recorded Node times for the render's new test files.
# Conflicts: # packages/cli/clients/cli/commands/experimental-render.doc.mjs
|
/approve-spec 236ff3e |
There was a problem hiding this comment.
Changes requested: the unrecorded test times from the last review are fixed at this head, but the reworked script build breaks how a refused script names its file.
ERR_RENDER_SCRIPTnow names the page's file as../astryx-page:<absolute path>/src/page.tsx:1:(client-bundle.mjs:320-334), because the page's files moved into esbuild'sastryx-pagenamespace and that prefix is resolved as a path; strip theastryx-page:/astryx-mount:prefix beforedescribe(path.resolve(…)), and assert inrender.interactive.test.mjsthat thenode:fsrefusal and a lazy missing import name no absolute path.
The required test-node legs still fail at this head, but on main's own leg plan (main alone plans its longest Node leg at 1394 s against the 1387 s budget), not because of this pull request. Non-blocking: the image-path rewrite still turns a caption into the image's data URI when the path reaches text through a variable, as in files.map(f => <figcaption>{f}</figcaption>). The parity browser step passed at this head.
Claims and files checked
Review mode: full; reason: merge-touches-pr-files
Changed rules (0): none
Claims:
- Changeset: the file is the page as a live app and its controls work as in the app: verified (a tabs-and-button page switches tabs and counts clicks in Chromium in a sandboxed frame; the parity browser step passed in CI at this head)
- Changeset: the script is inline after the embedded source, bundled by esbuild: verified (
render-page.mjs:1493;client-bundle.mjs) - Changeset: the file paints its markup first, then the script draws the live page over it: verified (
client-bundle.mjsmount withcreateRooton#astryx-render-root) - Changeset: one file, no network request and no eval added, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts: verified (one-file case in
render.test.mjs; Chromium under the parity test's policy with every other request blocked) - Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (markup stays in the body; reverse cases in
render.interactive.test.mjs) - Changeset: a link out opens a new tab and a form submits through its submit event: verified (
render-page.mjs:1013; the viewer script inclient-bundle.mjs; jsdom form case) - Changeset: a page whose script cannot be built is refused with the new error code, which names the module: false at this head (refused, but the message names the file through the bundler's namespace and its absolute path; blocking)
- Changeset: esbuild is a new CLI dependency that only the render loads: verified (
package.jsoncatalog entry;lazy-dependencies.test.mjs) - Changeset: the JSON adds
scriptBytesandscriptModules: verified (_adapter.mjs:542-543;experimental/render.mjs:89-90) - Changeset: a page whose script throws in its render or an effect keeps its first paint: verified (error boundary in
client-bundle.mjs; jsdom storage case) - Changeset: an image named by a string path in
srcorsrcSetkeeps showing once the script draws, andsrcSetis carried: verified (image case); the rewrite still changes some equal strings shown as text (non-blocking) - Changeset: a lazily loaded page file that does not compile is refused as a static import is, naming its file and line: verified (lazy compile case)
- Changeset: the credit line names the author: verified
- Description: the page's own files are compiled as the server compiled them: verified (
compilePageModule(…, true)inpage-worker.mjs) - Description: a lazily loaded module is bundled and styled; a package's browser map and an installed stand-in work: verified (cases in
render.interactive.test.mjs) - Description: drawing with
createRootinstead of hydrating, and a viewer that blocks scripts shows the markup: verified - Description: the stylesheet keeps the rules for class names the script holds: verified (
render-page.mjs:1119) - Description: Enter in a form's only text field submits, and a form aimed at another site submits natively: verified (the viewer script's keydown handler and its other-site check)
- Description: there is no option to leave the script out, and a refusal writes nothing: verified; that the refusal names the module: false (as above)
- Description: the note and the screen-query and chart-size warnings describe the script: verified (
file-header.mjs;render-page.mjs:1215,:1235,:1252; warning tests) - Description: only the page's files and the mount go through esbuild's plugin, and a package file returns to it only for a single-copy import or a Node module: verified (
client-bundle.mjs:253-262) - Description: the script build takes about 0.3 s and a whole render about 0.9 s warm: not reproduced
- Description: the removed flags are answered through the unknown-option path with what to do and the same command without the flag: verified (
stray-option.mjs:286-331; CLI run) - Description: esbuild
^0.28.2is a CLI dependency loaded only in the page's worker, so startup is unchanged: dependency verified (workspace catalog); the startup timings not reproduced - Description: the theme editor stays markup-only and the docsite previews drop the script: verified (
theme-edit/_parts.mjs;generate-landing-template-previews.mjs) - Description: render format stays 1 and released CLIs reverse a file with a script: the record gains no field and the reader stops the markup at the embedded source (
source-block.mjs:262-267); the released CLIs were not run - Description: stable commands and doctor are unchanged: verified (doctor case; only render paths change)
- Description: the template sweep, file sizes and first-run install cost: not reproduced (a tabs-and-button page measured 547 KB here)
- Description: interaction parity with the app in a sandboxed frame: verified (the parity browser step passed 2/2 in CI at this head)
Files:
packages/cli/foundation/render/client-bundle.mjs: blocking finding (the refused script's message and module name carry the bundler namespace and an absolute path)packages/cli/foundation/render/render-page.mjs: non-blocking (the image-path rewrite still reaches some text)packages/cli/api/render/render.interactive.test.mjs: clear (the Node-module case checks only the readable part of the message; part of the fix)packages/cli/foundation/render/page-worker.mjs: clearpackages/cli/foundation/render/esbuild-dependency.mjs: clearpackages/cli/foundation/render/file-header.mjs: clearpackages/cli/foundation/render/render.test.mjs: clearpackages/cli/clients/cli/commands/experimental/render.mjs: clearpackages/cli/clients/cli/lib/stray-option.mjs: clearpackages/cli/clients/cli/commands/experimental-render.doc.mjs: clearpackages/cli/api/render/_adapter.mjs: clearpackages/cli/api/render/render.doc.mjs: clearpackages/cli/api/render/render.type.mjs: clearpackages/cli/api/render/render.notes.test.mjs: clearpackages/cli/api/render/render.test.mjs: clearpackages/cli/api/render/render.interactive-missing.test.mjs: clearpackages/cli/api/theme-edit/_parts.mjs: clearpackages/cli/assets/docs/tree/render-pages.doc.mjs: clearpackages/cli/assets/docs/tree/share-a-page.doc.mjs: clearpackages/cli/foundation/doc-compiler/doc-loads.test.mjs: clearpackages/cli/foundation/response/error-codes.mjs: clearpackages/cli/foundation/response/error-codes.doc.mjs: clearpackages/cli/foundation/response/response-types.doc.mjs: clearpackages/cli/package.json: clearpackages/cli/test/lazy-dependencies.test.mjs: clearpnpm-lock.yaml: clearscripts/vitest-node-durations.json: clear.github/workflows/ci.yml: clear.github/scripts/render-interaction-parity.browser.test.mjs: clearapps/docsite/scripts/generate-landing-template-previews.mjs: clear.changeset/render-interactive.md: clear
esbuild names a page file with its build namespace (astryx-page:/…); the message now strips it, and the mount, the render's own module, names no file. Tests: the node:fs refusal and a lazily loaded missing module name no machine path and no namespace.
|
/approve-spec 036d91c |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. Its run found no room under the CI ceiling and was cancelled, so the CI workflow needs a re-run that passes before this merges.
The refused-script message now names the page's file without a machine path or the bundler's namespace, and the new tests for the node:fs refusal and a missing lazy import cover it. Non-blocking: the image-path rewrite still turns a caption into the image's data URI when the path reaches text through a variable, as in files.map(f => <figcaption>{f}</figcaption>).
Claims and files checked
Review mode: incremental; reason: none
Changed rules (0): none
Claims:
- Changeset: the file is the page as a live app and its controls work as in the app: verified (in Chromium in a sandboxed frame at this head, the tab switches and the button counts; jsdom cases in
render.interactive.test.mjs) - Changeset: the script is inline after the embedded source, bundled by esbuild: verified (
render-page.mjs:1493;client-bundle.mjs) - Changeset: the file paints its markup first, then the script draws the live page over it: verified (
createRooton#astryx-render-root,client-bundle.mjs:216) - Changeset: one file, with no network request and no eval added, so it works in a sandboxed frame that allows scripts under a policy that allows inline scripts: verified (one-file case in
render.test.mjs; Chromium under the parity test's policy with every other request blocked) - Changeset: a frame that blocks scripts shows the markup, and reverse gives the page back byte for byte: verified (the markup stays in the body; reverse cases in
render.interactive.test.mjs) - Changeset: a link out opens a new tab, and a form submits through its submit event: verified (
render-page.mjs:705; the viewer script inclient-bundle.mjs; jsdom form case) - Changeset: a page whose script cannot be built is refused with the new error code, which names the module: verified (the
node:fsand missing-lazy-import cases name the page's file; both tests fail on the last reviewed code and pass here) - Changeset: esbuild is a new CLI dependency that only the render loads: verified (
package.json;lazy-dependencies.test.mjs) - Changeset: the JSON adds
scriptBytesandscriptModules: verified (_adapter.mjs:542-543;experimental/render.mjs:89-90) - Changeset: a page whose script throws in its render or an effect keeps its first paint: verified (error boundary in
client-bundle.mjs; jsdom storage case) - Changeset: an image named by a string path in
srcorsrcSetkeeps showing once the script draws, andsrcSetis carried: verified (image case); the rewrite still changes some equal strings shown as text (non-blocking) - Changeset: a lazily loaded page file that does not compile is refused as a static import is, naming its file and line: verified (lazy compile case)
- Changeset: the credit line names the author: verified
- Description: the page's own files are compiled as the server compiled them: verified (
compilePageModule(…, true)inpage-worker.mjs) - Description: a lazily loaded module is bundled and styled, and a package's browser map and an installed stand-in work: verified (cases in
render.interactive.test.mjs) - Description: the page is drawn with
createRootinstead of hydrated, and a viewer that blocks scripts shows the markup: verified - Description: the stylesheet keeps the rules for class names the script holds: verified (
render-page.mjs:1119) - Description: Enter in a form's only text field submits, and a form aimed at another site submits natively: verified (the viewer script's keydown handler and its other-site check)
- Description: there is no option to leave the script out, and a refusal writes nothing and names the module: verified
- Description: the note and the screen-query and chart-size warnings describe the script: verified (
file-header.mjs; the warning cases) - Description: only the page's files and the mount go through esbuild's plugin: verified (
client-bundle.mjs:266-299) - Description: a whole render takes about 0.9 s warm, against 0.7 s for the markup alone: consistent (a tabs-and-button page renders in about 0.9 s on the head and 0.75 s on the base); the 0.3 s script build alone was not measured
- Description: the image-path rewrite touches only the exact path and never
children, and a path that reaches text through a variable is a known limit: verified (withCarriedPathsand its unit test; the limit reproduces) - Description: the removed flags get an answer that says what to do, with the same command without the flag: verified (
stray-option.mjs:286-331; CLI case) - Description: esbuild
^0.28.2is a regular dependency loaded only by dynamic import in the page's worker, so startup is unchanged: dependency and dynamic import verified; the startup timings were not reproduced - Description: the theme editor stays markup-only and the docsite previews drop the script: verified (
theme-edit/_parts.mjs;generate-landing-template-previews.mjs) - Description: a missing esbuild install is refused as a missing dependency: verified (
render.interactive-missing.test.mjsand theesbuildFromcase) - Description: render format stays 1, and released CLIs reverse a file that carries a script exactly: verified for 0.7.10 and 0.7.15 (exact, source byte-identical); 0.7.12 was not run
- Description: stable commands and doctor are unchanged: verified (doctor case; only render paths change)
- Description: files grow to a median of 564 KB and at most 2.4 MB: consistent (547 KB for a tabs-and-button page); the template sweep was not reproduced
- Description: the interaction parity browser check passes: it passed in CI at the previous revision, and this push does not change what it exercises; CI has not run it at this head
- Description: public text and artifacts carry no internal context: verified
- Description: the blind check, the template sweep and the first-run install cost: run outside the repository and not reproduced
Files:
packages/cli/foundation/render/client-bundle.mjs: clear (the error now names the page's file)packages/cli/api/render/render.interactive.test.mjs: clear (the new assertions fail on the last reviewed code)packages/cli/foundation/render/render-page.mjs: non-blocking (the image-path rewrite still reaches some text)packages/cli/foundation/render/page-worker.mjs: clearpackages/cli/foundation/render/esbuild-dependency.mjs: clearpackages/cli/foundation/render/file-header.mjs: clearpackages/cli/foundation/render/render.test.mjs: clearpackages/cli/clients/cli/commands/experimental/render.mjs: clearpackages/cli/clients/cli/lib/stray-option.mjs: clearpackages/cli/clients/cli/commands/experimental-render.doc.mjs: clearpackages/cli/api/render/_adapter.mjs: clearpackages/cli/api/render/render.doc.mjs: clearpackages/cli/api/render/render.type.mjs: clearpackages/cli/api/render/render.notes.test.mjs: clearpackages/cli/api/render/render.test.mjs: clearpackages/cli/api/render/render.interactive-missing.test.mjs: clearpackages/cli/api/theme-edit/_parts.mjs: clearpackages/cli/assets/docs/tree/render-pages.doc.mjs: clearpackages/cli/assets/docs/tree/share-a-page.doc.mjs: clearpackages/cli/foundation/doc-compiler/doc-loads.test.mjs: clearpackages/cli/foundation/response/error-codes.mjs: clearpackages/cli/foundation/response/error-codes.doc.mjs: clearpackages/cli/foundation/response/response-types.doc.mjs: clearpackages/cli/package.json: clearpackages/cli/test/lazy-dependencies.test.mjs: clearpnpm-lock.yaml: clearscripts/vitest-node-durations.json: clear.github/workflows/ci.yml: clear.github/scripts/render-interaction-parity.browser.test.mjs: clearapps/docsite/scripts/generate-landing-template-previews.mjs: clear.changeset/render-interactive.md: clear
User need
A page made with
astryx experimental renderwas one HTML file that ran no script: a picture of the page. A shared page needs its controls: tabs that switch, a popover or a menu that opens, a dialog, a form, a copy button, a layout that fits the reader's phone (useMediaQuery). In a picture those show and do nothing, and authors either hand-write a separate page (no Astryx, no way back to source) or accept a dead page.Now the rendered file is the page as a live app, in one file: it carries the page's own script, so every control works as in the app. Everything else render promises stays: still one file, the render adds no network request and no
eval, it works in a sandboxed artifact viewer whose frame allows scripts and whose content security policy allows inline scripts (the policy tested below), and--reversegives the source back byte for byte.Problem and solution fit
?raw/?inlineimports), so the browser draws the same page. A module the page loads lazily (lazy(() => import('./panel'))) is compiled with the bundle, and its styles join the stylesheet. Imports resolve the way esbuild resolves them for the browser first, so a package'sbrowserfield ("fs": false) and an installed stand-in for a Node module (events) work.#astryx-render-root,display: contents, so it takes no box), and the script draws the live page into it with React'screateRoot, so state, effects and event handlers work. Drawing rather than hydrating keeps time-dependent output, charts drawn after the server render, and server-only answers (useMediaQueryreturns false) from producing hydration mismatches. A viewer that blocks scripts shows the markup.target="_blank" rel="noopener noreferrer"), in the first paint and once the script runs, since the frame cannot follow it; a link the page handles itself, or that names a target, keeps its way. A form submits through its submit event, which the file fires itself: a frame withoutallow-formsblocks the browser's own submission before the page'sonSubmitruns, and a file has no server to send a form to. A click on a submit button, or Enter in a form's only text field, submits as a browser does; a form whose action is another site's address submits as the browser submits it.node:fs) is refused withERR_RENDER_SCRIPT, which names the module, and nothing is written.screen-query) is answered by the server for the first paint and asked again when the script runs, and a chart the render could not draw (chart-size) is painted empty and drawn by the script; a viewer that blocks scripts keeps the first paint, so folding a layout with CSS is still the advice.children). A path that reaches the page's text through a variable (files.map(f => <figcaption>{f}</figcaption>)) is a known limit: such a caption shows the data: URI once the script draws the page.--staticand--interactive, which older docs and agents pass, are answered by the unknown-option path with what to do: " is no longer an option: every render carries the page's script now. Drop the flag and run the command again." (ERR_INVALID_OPTION), with the same command without the flag as the suggestion.^0.28.2). Onlyexperimental renderloads it, by dynamic import inside the page's worker, so no other command loads it and startup time is unchanged (lazy-dependencies.test.mjschecks that importing the API loads no esbuild).Current specification
astryx experimental renderis experimental (spec:AST-017FR27): its options, output file and JSON may change in a patch release. The maintainers chose the page's script in every render, with no option to leave it out, and esbuild as a regular dependency of the CLI, loaded only insideexperimental render.Public delta and caller burden
render.pageJSON: newscriptBytesandscriptModules; the text output prints the same keys.esbuild(^0.28.2).ERR_RENDER_SCRIPT(experimental): a module the page's script loads needs Node (node:fs), or cannot be found or compiled for the browser; the message names the module. An install that left esbuild out isERR_RENDER_MISSING_DEPENDENCY.Design and alternatives
--interactive(most renders would keep dead controls), and a--staticoption or a fallback to a file with no script (a rendered page must work as the app works; a page whose script cannot be built is an error to fix, not a picture to ship).allow-formsit never fires a form's submit, so the reader sees a link or a form that does nothing).createRoot(chosen) rather thanhydrateRoot: hydration needsrenderToStringmarkup and fails on every legitimate difference between the server and the browser (relative times, charts drawn after the server render,useMediaQuery), and React then client-renders the whole root anyway, logging recoverable errors.</script,<!--and the embedded block's type name are escaped inside the script (\x3C,\x2d, which mean the same in strings, template literals and regular expressions), and the script is parsed before it is written.Evidence
Interaction parity with the app (
.github/scripts/render-interaction-parity.browser.test.mjs, new CI step): one page with tabs, a popover, a menu, a dialog and a form is built into a Vite app with@astryxdesign/build's Vite plugin, and rendered to one file. Chromium takes the same ten steps in both (click a tab, open the popover, Escape, open the menu, pick an item, open the dialog, Escape, type a name, flip a switch, submit), the file inside asandbox="allow-scripts"srcdoc frame underdefault-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; font-src data: blob:. After every step both show the same thing, the app shows what the step does, and neither logs an error. A second case opens the file in a frame that allows tabs (allow-popups): the link opens a new tab, and the frame keeps the page. Both pass.A blind check: an agent with no context built its own page with tabs, a popover, a menu, a dialog and a form, ran it as a Vite app, rendered it, and compared every interaction in Chromium at 1280 px and 390 px, the file inside the same frame and policy. Every step matched except submitting the form, which the frame's sandbox blocked before the page's handler ran; the file now fires the submit itself, and the parity check covers it (a click on the submit button and Enter in a field).
Every template the CLI ships (794: page templates and component blocks), rendered in a project, then opened the way an artifact viewer opens HTML, under the same frame and policy:
alert(), and focus moved before the reader acts.(The sweep ran on the same bundling code before the script became the default.)
First-run cost of the new dependency (Linux x64, npm 11.17, Node 24.22; each run with an empty npm cache):
npx: 3 alternating runs ofnpx -p @astryxdesign/cli@<canary> [-p [email protected]] astryx --version. The npm cache grows from 167.5 MB to 179.2 MB (+11.7 MB: the 4.7 MB compressed Linux x64 binary package, esbuild itself, and the metadata npm reads for esbuild's platform packages); the install grows from 81.7 MB to 93.2 MB (+11.6 MB). First run: 10.9 s, 10.7 s, 17.2 s before; 8.8 s, 11.5 s, 9.9 s after, which is within the network's noise. After install, startup does not change:astryx --version89 ms → 90 ms (median of 6),astryx docs principles233 ms → 230 ms.Scope
Components:
astryx experimental render(foundation/render,api/render, the command, docs and error codes); its two markup-only callers (the theme editor's page renders, the docsite's landing previews); a CI step for the parity check.Testing
pnpm exec vitest run --project node packages/cli/api/render packages/cli/foundation/render packages/cli/clients/cli/commands/text-json-parity.test.mjs packages/cli/foundation/doc-compiler packages/cli/assets/docs packages/cli/test/runner-commands.test.mjs packages/cli/test/packed-manifest.test.mjs packages/cli/test/lazy-dependencies.test.mjs packages/cli/foundation/response scripts/npm/published-manifests.test.mjs—render.interactive.test.mjs: report, file structure, note, no machine paths, same bytes, exact reverse and its "Render it again", the file running in jsdom (the button works; a link out opens in a new tab, in the markup and once clicked; a form submits on a click and on Enter), CLI text keys and no option to leave the script out,--title, a package'sbrowsermap and an installedeventsstand-in, a lazily loaded module styled, a Node-only module refused, esbuild a dependency that resolves beside the CLI, a refusal when the install left it out (also throughrender()inrender.interactive-missing.test.mjs), doctor never mentions it, a markup-only render never looks for it.ASTRYX_RENDER_PARITY_BROWSER=1 pnpm exec vitest run .github/scripts/render-interaction-parity.browser.test.mjsafterpnpm -F @astryxdesign/build build.