Skip to content

Metaplate v0.9.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 08:39
d55f450

Metaplate v0.9.0

Metaplate 0.9.0 is the Cloudflare Workers release. The experimental metaplate/takumi entry renders cards on a Worker with Takumi's precompiled WebAssembly. For Next.js on Workers through OpenNext, the new definePlate lets pages import a plate's URL contract without its renderer, while the build prerenders the cards. metaplate render can now write the social tags into static HTML pages. metaplate verify-page can treat a staging site's robots block as expected. fetchImageLoader loads per-page images safely on any Fetch runtime. Two new render guards, fontFallback and lineClamp, catch text Satori draws in the wrong font or without the clamp you asked for.

Upgrade recommendation: Recommended for everyone, and worth a look if you deploy to Cloudflare Workers or an edge runtime. There is no runtime migration. TypeScript code that switches exhaustively over RenderGuardIssue["guard"] needs "fontFallback" and "lineClamp" cases. Scripts that parse the text output of verify-page for robots lines should read its --json output instead.

Why upgrade

  • Cards on Cloudflare Workers. metaplate/edge cannot start on Workers. Satori's bundled HarfBuzz compiles its WebAssembly at run time, which Workers forbid. metaplate/takumi renders there through a precompiled module, with the same plate surface as createEdgeOg.
  • Safe remote images on edge runtimes. remoteImageLoader needs Node's DNS and sockets, so edge plates had to hand-write their own fetch. fetchImageLoader brings the same allowlist, redirect, byte, and time limits to the Fetch API.
  • Next.js on Workers without drift. Pages on a Worker must not import the renderer, so they rebuilt image metadata by hand and restated the plate's imagePath, version, and revision. definePlate is the plate's contract with no renderer attached. Pages and the build share it, so their URLs cannot drift apart.
  • Silent rendering mistakes are caught. A typo in fontFamily, a weight the family lacks, or a lineClamp on a flex column used to render with no error. The fontFallback and lineClamp guards report them.

Highlights

Rendering on Cloudflare Workers (experimental)

  • createTakumiOg from metaplate/takumi renders plates with Takumi (takumi-js, a new optional peer, >=2.22.1 <3). It supports variants, handlers, fetchableFrom, ETags, output encoders, languageFonts, and every render guard except avoid. Emoji come from the plate's own emoji loader and never from a CDN. Takumi itself fetches nothing: an image src or CSS url() that is not a data: URI fails the render before any request, so remote images go through fetchImageLoader with its allowlist. Fonts must be TrueType, OpenType, or WOFF2. See Takumi.
  • Takumi lays out like a browser in a few places where Satori does not. It defaults to box-sizing: border-box, keeps an image's width in a flex row, and fails on a truncated image instead of drawing part of it. The guide lists every difference and shows how to compare a plate with compareImages before switching.
  • On the Workers Free plan, a warm render measured about 13 ms of CPU, against the documented 10 ms limit. Serve cards with long-lived Cache-Control and an ETag, put them behind the Cache API, or render at build time. The Paid plan fits uncached rendering easily. The entry is not hosted-certified: the evidence is a spike Worker in production and a test that bundles the entry with Wrangler's workerd conditions and checks that it carries Takumi's WebAssembly module and no Node built-ins.
  • A new parity suite renders 16 plates through both metaplate/node and metaplate/takumi and holds each to its own pixel budget. A takumi-js or satori update that moves layout fails before it merges.

Next.js on Cloudflare Workers, and static pages

  • definePlate in the root metaplate entry returns a plate's URL and metadata contract (alt, size, variants, imagePath, basePath, origin, version, revision, contentType) with the plate's metadata, signedMetadata, image, sitePath, and variant members. It imports no renderer. Spread it into createNodeOg, createEdgeOg, createTakumiOg, createSvgOg, or createNextOg and add fonts and component. Both sides run the same metadata code, and a test compares them across 288 option combinations. A factory throws when the contract's contentType is not what it serves. See A contract without a renderer.
  • A new guide, Next.js on Cloudflare Workers, covers the hybrid setup for @opennextjs/cloudflare. Cards are rendered into public/ before the build and served as Workers static assets. Pages import only the contract, and verify-page checks the result after deploying.
  • A metaplate render page can name an html file and its page-level tags. The command then writes the plate's social <meta> tags between <!-- metaplate:social --> markers, or before </head> the first time. og:image carries the same ?v= URL the render recorded. Re-running writes the same bytes, and a page is written atomically and only after all of its images succeed. Malformed markers, a missing </head>, or a hand-written og:image outside the block fail the run before anything renders. See Writing tags into static HTML.

Staging checks with verify-page

  • metaplate verify-page prints one robots.txt line per crawler, listing the page and image URLs it blocks. It used to print the same block up to once per target and image.
  • --expect-robots-block (expectRobotsBlock in verifyRemotePage) is for sites that block crawlers on purpose. A block is reported as expected, and the run fails when a crawler can fetch the page. --json adds a crawler field to robots issues, a per-crawler expectation, and a robots-not-blocked issue code; no field is removed. See Sites that block crawlers on purpose.

Remote images on Fetch runtimes

  • fetchImageLoader in metaplate/image is remoteImageLoader built on the Fetch API, for Cloudflare Workers (with metaplate/takumi), Netlify Edge, Deno, and Vercel Edge. It keeps the required origins allowlist, the URL, scheme, credential, and port checks, redirects re-checked on every hop, a byte cap enforced from Content-Length and while streaming, one time budget, and the bounded cache. It reports the same RemoteImageError codes, which metaplate/image now also exports. Fetch runtimes hide DNS, so it refuses only hosts written as non-public IP addresses or localhost names, and the allowlist is the boundary. See Edge runtimes.

Reliability

  • The fontFallback guard, for createSvgOg, createNodeOg, createEdgeOg, and createTakumiOg, reports each font request that no loaded face satisfies, as missing: "family" or missing: "face", with the loaded faces listed. It follows inline styles down the tree, calls nested function components, and counts faces from languageFonts as loaded. Like every guard, it is off by default. See Render guards.
  • The lineClamp guard reports a clamp or ellipsis that Satori ignores and draws in full: lineClamp on an element whose display is not block, WebkitLineClamp without -webkit-box, textOverflow: "ellipsis" without overflow: "hidden" and a non-wrapping whiteSpace, and a clamp whose text sits inside a child element. A test renders every case through Satori, so a Satori update that changes these rules fails it. On Takumi, which clamps more cases, the guard applies Satori's rules so a plate stays portable.
  • The rendering guide said plates have no stylesheet. Custom properties declared in the plate resolve in every adapter, and <style> elements apply in createSvgOg, createNodeOg, and createEdgeOg on Satori 0.51.0 or later. Only the site's own CSS is out of reach. createNextOg is the exception, and tests now pin each behavior.

Breaking changes

None at run time. Two changes may need attention:

  • RenderGuardName gains "fontFallback" and "lineClamp", and RenderGuardIssue gains a member for each. TypeScript code with an exhaustiveness check over issue.guard needs a case for each. Both guards are off by default.
  • The text output of metaplate verify-page shows each robots.txt block once per crawler, with only the deciding rule. Scripts that parse those lines should read --json, which only gains fields. Its RobotsIssueCode type gains "robots-not-blocked", so an exhaustive switch over issue codes needs a case for it.

The existing peer ranges are unchanged. See Upgrading.

Install or upgrade

npm install metaplate@0.9.0

That single command still includes the framework-neutral SVG and PNG renderer: npm 7+ and pnpm 8+ install the satori, @resvg/resvg-js, and react peers. Yarn needs them added explicitly. Node.js 20 or newer is required. takumi-js is optional and is only needed for metaplate/takumi. Add it with npm install takumi-js when you use that entry.

Verification

  • npm run check passes: lint, the duplication scan, workflow pin policy, dependency inventory and Socket disposition policy, deployment evidence policy, release-note validation, source and example type checks, the full test suite, the build, and the package dry run. npm run check:package installs the packed tarball into fresh consumers and builds and serves the Next.js, Astro, React Router, SvelteKit, Express, and edge fixtures from it.
  • metaplate/takumi is tested on Node.js through Takumi's native addon on Linux, Windows, and macOS, and as a Workers bundle built with Wrangler's import conditions. The Takumi spike found Takumi's Wasm and native outputs pixel-identical on all 19 of its fixtures.
  • Socket baseline. It is the Socket CLI deep score of the published metaplate@0.8.4, captured 2026-11-25. The package scores 80 overall, and its own alerts are recentlyPublished and unpopularPackage (medium) and urlStrings (low). Two high dependency alerts carry time-bounded dispositions that expire 2027-04-30. string.prototype.codepointat, under the Satori peer, carries over. obfuscatedFile on caniuse-lite@1.0.30001828 is new and is reached only through the optional next peer and development tooling. A tarball diff shows it is that release's new packed data format, with no dynamic code, network, or filesystem access, and it was published with SLSA provenance. The tslib ownership alert no longer appears. There are no critical alerts. Because the baseline scores the published 0.8.4, it does not yet cover the new optional takumi-js peer (a native addon and a WebAssembly build, mostly from one maintainer). The 0.9.0 package's own score will.
  • npm registry signature and SLSA provenance verification run after publication, against the published artifact.

Documentation and support

Full changelog