Repository navigation
feat(flame): add experimental.pages to bring your own landing page - #461
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
ℹ️ No critical issues. Two rough edges worth a look, both inline.
Reviewed changes
Reviewed in senior mode, because the PR touches the flame build/render pipeline, hydration and deploy. It covers the full experimental.pages feature plus the stricter meta.basePath validation. Verdict: READY WITH MINOR FIXES. Top priorities: (1) the docs/404.mdx override under the flag, (2) the public AssetManifest.home type change.
experimental.pagesflag: newExperimentalConfig, schema entry with a draft-07if/thenrule against a root basePath, and pure helpers inexperimental.tsre-exported frompaths.ts.- Output layout under the flag: the landing page and the
home-cliententry are dropped, the 404 moves to<basePath>/404.html, and bundles, manifest and search index move to<basePath>/_flame/(ASSETS_DIRis now derived frombundlePath()). - Mirrored build entries:
build.tsandbuild.impl.tsgate the landing page, clean stale root and prefixed output, and write the standalone root redirect and 404 underFLAME_STANDALONE=1. - Client and HTML shells:
bundlePathis threaded throughhtmlShell,client-routes.tsand both virtual modules.Search.tsxfetches the index from the moved tree. Flag-off output stays byte-identical. - Dev and preview servers:
/is routed throughresolveRootRoute, and preview falls back to the prefixed 404. - Deploy: nginx gets a relative root redirect and a prefixed
error_page,_headersfollows the bundle path, and keptnginx.confand workflow files get staleness warnings. - Plugin API:
onEndgainsassetsDir. - Validation: a whitespace-only
meta.basePathis now a build error. - Cache: the flag is folded into
basePathStamp(), andexperimental.tsis added to the render sources.
I checked these and found no problem: the dev server serves /docs/_flame/* and the moved search index through serveStatic. The location, return and error_page values that now use basePath without the guard stay valid nginx, because the canonical basePath charset is [a-z0-9-._~/]. redirectHtml interpolation is safe for the same reason. Runtime parity between the Bun and Node/Deno pairs holds.
claude-opus-5-5 | 𝕏
With `experimental.pages: true` in docu.json, flame keeps everything it
builds under `meta.basePath`, so the docs can share an origin with the
project's own app (React, or anything else):
- no landing page and no landing bundle; `home` is ignored with a warning
- the 404 page stays flame's and moves to `<basePath>/404.html`; an
authored docs/404.mdx takes its place with root-absolute assets
- hashed bundles, manifest.json and search-index.json move from the
dist-root `assets/` to `<basePath>/_flame/`
- stale output from a build with the other setting is cleaned up, and the
flag is part of the build cache key
Dev and preview redirect `/` to the docs prefix; at a root deployment the
docs index owns `/`. `flame deploy --docker` writes an nginx config that
redirects `/` and serves the prefixed 404. The GitHub Pages workflow builds
with FLAME_STANDALONE=1, which adds a root redirect and 404 to the artifact.
Both deploy flows warn when a kept nginx.conf or workflow predates the flag.
A root basePath ("" or "/") next to the flag warns in the build and dev
server, and the schema flags it, because the docs would own `/`.
Independently of the flag, a whitespace-only basePath is now a build error
instead of being read as the deployment root.
Plugins get the bundle directory as `assetsDir` in the onEnd context.
`AssetManifest.home` is now optional in the published types, since no
landing bundle is built under the flag.
With the flag off, output layout and page content are unchanged; only the
client bundle hashes change once.
75a5be7 to
6e2e347
Compare
There was a problem hiding this comment.
✅ No new issues found. Both findings from the previous review are fixed, and their threads are resolved.
Reviewed changes
Reviewed in senior mode (flame build pipeline). This review covers the 6e2e347 amend relative to 75a5be7. Verdict: READY.
- Authored
docs/404.mdxunder the flag: both build entries now render the404slug withabsoluteAssets: trueanddeployPath()whenownPages()is set. The page loads its CSS, JS and favicon from any request depth, the same way the generated 404 does. - Standalone root 404: when the docs page owns the 404,
FLAME_STANDALONE=1now copies<basePath>/404.htmlto the root instead of deleting the root404.html. This works for cached pages too, because the prefixed file is still on disk. - Parity test:
experimental.test.tsnow checks both changes in the mirroredbuild.ts/build.impl.tspair. AssetManifest.hometype change: the changeset and aplugins.mdxwarning callout now document it, with ahome?.cssexample.
build.ts and build.impl.ts are both listed in RENDER_SOURCE_FILES, so cached 404 docs pages from an earlier build are invalidated and re-rendered with the new asset URLs.
claude-opus-5-5 | 𝕏

Why
Projects that already have a site, for example a React + Tailwind + daisyUI app at the repository root, want flame to build only their docs. Today flame also writes the landing page at
/, a root404.htmland its bundles in the dist-rootassets/. Those collide with the app's ownindex.html,404.htmland Vite's/assets/, so the two cannot share an origin cleanly.experimental.pagesis an opt-in flag that keeps everything flame builds undermeta.basePath. One route rule for the docs prefix is then enough to serve the docs next to any app, by merging the outputs or through a host rewrite. With the flag off, nothing changes for existing projects.Changes
Build output with
experimental.pages: truehomein docu.json is ignored with a warning.<basePath>/404.html, so it never replaces the app's root 404. An authoreddocs/404.mdxtakes its place and is rendered with root-absolute assets, like the generated one, so it works at any request depth.manifest.jsonandsearch-index.jsonmove fromassets/to<basePath>/_flame/. Pages link them relatively, the 404 page root-absolutely, and the search modal fetches the index from the new path.Commands
flame devandflame previewredirect/to the docs prefix. At a root deployment the docs index owns/.flame deploy --docker: the nginx config redirects/to<basePath>/with a relativeLocation, sends 404s to<basePath>/404.htmland caches<basePath>/_flame/as immutable.flame deployfor GitHub Pages: the generated workflow builds withFLAME_STANDALONE=1, which adds a rootindex.htmlthat redirects to the docs and a root copy of the 404, generated or authored. A plainflame buildnever writes either. The env var is a no-op without the flag.nginx.confor workflow predates the flag. A hand-edited config does not warn while the flag is off.Validation
meta.basePath(""or"/") warns in the build and dev server, because the docs would own/,index.htmland404.html. A docs-only site without a landing page still builds. The schema flags the combination through a draft-07if/thenrule.meta.basePathsuch as" "is now a build error instead of being read as the deployment root.Plugin API
onEndcontext gainsassetsDir, the absolute bundle directory. Plugins should resolveassetManifestentries against it rather than a hard-codedoutDir/assets.AssetManifest.homeis now optional, because no landing bundle is built under the flag. TypeScript plugins that readassetManifest.home.cssmust null-check it understrictNullChecks, even with the flag off. The changeset andplugins.mdxcall this out.Docs
base-path.mdxhas a new "Bring your own pages" section: the output layout,vercel.jsonexamples for merged output and for a rewrite between two deployments, the Netlify and nginx equivalents, and a table of what each command does.configuration.mdx,deployment.mdxandplugins.mdxare updated to match.Bun and Node/Deno entries are changed in mirrored pairs:
build,hydrate,server,previewanddeploy.Behavior with the flag off
Built the template with
mainand with this branch, on Bun and Node, for basePath"/"," "(onmain) and"docs":bundlePathconstant that is still/assets. Bundle hashes therefore change once, as with any release that touches client code._headersare byte-identical for five basePath variants.Verification
vitest: 727 tests pass across 36 files, including a newexperimental.test.ts. It covers runtime parity between the mirrored entries, root bundle cleanup on temp directories (incl. basePath/assets, which a mutation check confirmed is caught), redirect HTML, nginx and_headersgeneration, and the warnings.tsc,oxlint,prettierandtest:release-planare clean. The pre-push hook passed."/"," "→ now an error, and"docs", plain and standalone builds: every relative link resolves, and Bun/Node output is identical after normalization. Remaining CSS hash and search-record order differences also exist onmain.flame devandflame previewprobed on both runtimes:/redirect, docs pages, moved search index, 404 page.docs/404.mdxunder the flag: served fromnginx:alpineand loaded in Chromium at/docs/guide/missing,/docs/a/b/c/missingand/docs/missing. Each returns the authored page with status 404, the stylesheet applied and no failed requests. Before the review fix, nested misses loaded the JS from/docs/docs/_flame/…and rendered unstyled. Standalone builds ship it as the root404.html.nginx.confpassesnginx -tinnginx:alpine. A port-mapped container serves the redirect, pages, cache headers and 404 correctly; this caught and fixed an absolute redirect that dropped the mapped port.scripts/flame-browser-smoke.mjspasses on flame's own docs built with the flag and merged into a stub React app with its ownindex.html,404.htmland/assets/, with no file collisions. It also passes on the default build.Notes
@docubook/flame.""or"/".