Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e3f4d73
feat(void): add next/og-compatible ImageResponse in void/og
ogawa0071 Oct 16, 2026
8ea9a10
test(void): type the Miniflare runtime in the void/og integration test
ogawa0071 Oct 16, 2026
a853132
fix(void): draw CJK and accented Latin text in void/og images
ogawa0071 Oct 16, 2026
cda8090
Cite upstream sources in void/og and isolate fonts per image
ogawa0071 Oct 18, 2026
47eb7a9
Fix void/og review findings
ogawa0071 Oct 19, 2026
3d84392
Cover void/og's documented failure paths and fix the guide
ogawa0071 Oct 22, 2026
a906fe6
Keep Latin text on Geist and cache emoji in void/og
ogawa0071 Oct 27, 2026
9f88e2d
Fetch images once per void/og render and hash each font buffer once
ogawa0071 Oct 27, 2026
606696c
Show void/og in a .tsx route now that routes accept JSX
ogawa0071 Nov 3, 2026
0e26ffe
Move void/og to takumi-js ~2.18.2
ogawa0071 Nov 3, 2026
a960d91
Test the ~ range in void/og's Node.js check and note how to verify a fix
ogawa0071 Nov 3, 2026
23902f0
Use measured CPU figures in the void/og guide
ogawa0071 Nov 3, 2026
f6097e6
fix(void): find void's package.json without assuming the module's depth
yangshun Nov 11, 2026
263e627
docs(og): note the renderer's Worker size on Cloudflare
yangshun Nov 11, 2026
7287876
fix(og): let lang choose the Chinese, Japanese or Korean font before …
yangshun Nov 11, 2026
53cd805
fix(og): drop only the fallback font files that fail to download
yangshun Nov 11, 2026
7cb852b
fix(og): draw bold fallback text with the fonts' weight axis
yangshun Nov 11, 2026
15e8faa
docs(og): describe void/og on its own
yangshun Nov 11, 2026
5815770
chore(og): upgrade takumi-js to 2.20
yangshun Nov 12, 2026
b269286
refactor(og): declare ImageResponseOptions instead of passing Takumi'…
yangshun Nov 12, 2026
8e9fa01
docs(og): explain void/og behavior without citing other libraries
yangshun Nov 12, 2026
f294c72
fix(og): accept any font weight from 1 to 1000
yangshun Nov 12, 2026
3342934
fix(og): draw ・ and ー with the Japanese fallback family
yangshun Nov 12, 2026
abe758f
refactor(og): move font handling into og-fonts.ts
yangshun Nov 12, 2026
d414528
perf(og): ask Google Fonts for only the characters in the image
yangshun Nov 12, 2026
3261d90
feat(og): add fallbackFonts to turn off Google Fonts downloads
yangshun Nov 12, 2026
e4d5874
docs(og): note font memory growth in the Node.js, Bun and Deno section
yangshun Nov 12, 2026
491949a
fix(og): send one Cache-Control header in development and builds
yangshun Nov 12, 2026
64f4c4d
docs(og): trim the void/og notes in the package AGENTS.md
yangshun Nov 12, 2026
c0e90de
docs(og): describe the renderer's size without Cloudflare's limits
yangshun Nov 12, 2026
031bfa3
fix(og): keep Han characters when Korean text also has Hangul
yangshun Nov 12, 2026
b073c1c
docs(og): load the example font from Google Fonts
yangshun Nov 12, 2026
184a1a7
docs(og): say which fonts draw text and name the Noto fallback
yangshun Nov 12, 2026
fdad9d1
chore: add ImageResponse playground
kossnocorp Nov 12, 2026
619925b
chore: expose `renderImage`'s options type
kossnocorp Nov 12, 2026
f3e3798
feat: move ImageResponse to void/image, add OgImageResponse
kossnocorp Nov 12, 2026
de90b1b
chore: get rid of installing takumi-js requirement
kossnocorp Nov 13, 2026
2f642db
chore: make Inter the default font in ImageResponse
kossnocorp Nov 13, 2026
bd51c37
chore: make ImageResponse & OgImageResponse only accept sanitized str…
kossnocorp Nov 13, 2026
42cf84e
chore: don't set headers in ImageResponse, cache agressively in OgIma…
kossnocorp Nov 13, 2026
c458cb8
chore: add ImageResponse memory test playground
kossnocorp Nov 13, 2026
4ed9c5b
feat: add `preset` option to `OgImageResponse` with common image sizes
kossnocorp Nov 13, 2026
d8a9b21
chore: implement custom fonts caching for ImageResponse
kossnocorp Nov 13, 2026
3c31a20
chore: cut down `ImageResponse`-related AGENTS.md fluff
kossnocorp Nov 13, 2026
8a293fa
chore: extract void/image + void/og -> @void/image/generate
kossnocorp Nov 17, 2026
9fe2864
chore: set up build + deployment + latency benchmark suite
kossnocorp Nov 17, 2026
3c1b386
chore: add compare report for image response benchmark
kossnocorp Nov 17, 2026
ce16bfa
chore: fix all jsDelivr images detected as emojis, prevent custom fam…
kossnocorp Nov 17, 2026
f6c4c64
chore: remove direct dependence on Takumi types
kossnocorp Nov 17, 2026
3e0eccf
chore: make image response classes lazy, add `renderImage` and `rende…
kossnocorp Nov 17, 2026
0edacf6
chore: get rid of OgImageResponse presets in favor of docs
kossnocorp Nov 17, 2026
3876cc5
chore: clean up image response code
kossnocorp Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 79 additions & 7 deletions .github/scripts/packed-consumer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,41 @@ async function run(command, args, cwd, env = environment) {
}
}

const packedOgRoute = `import { html } from 'void/html';
import { OgImageResponse } from '@void/image/generate';
import { defineHandler } from 'void';
export const GET = defineHandler((c) => new OgImageResponse(html\`<div style="display:flex;width:100%;height:100%;background:#000;color:#fff">\${Promise.resolve('Packed <OG> Привет Ελληνικά Łódź')}</div>\`, { fallbackFonts: false, defaultFont: c.req.query('font') === 'Geist' ? 'Geist' : 'Inter' }));
`;
const packedImageRoute = `import { html } from 'void/html';
import { ImageResponse } from '@void/image/generate';
import { defineHandler } from 'void';
export const GET = defineHandler((c) => new ImageResponse(html\`<div style="display:flex;width:100%;height:100%;background:#000;color:#fff">\${'Packed <image> Привет Ελληνικά Łódź'}</div>\`, { width: 600, height: 600, fallbackFonts: false, defaultFont: c.req.query('font') === 'Geist' ? 'Geist' : 'Inter' }));
`;

/** Fetches an image route and checks its PNG signature and dimensions. */
async function assertPackedImage(url, dimensions, failure) {
const inter = await readPackedImage(url, dimensions, failure);
const geist = await readPackedImage(`${url}?font=Geist`, dimensions, failure);
assert(!Buffer.from(inter).equals(Buffer.from(geist)), 'Inter and Geist must render differently');
const again = await readPackedImage(url, dimensions, failure);
assert(
Buffer.from(inter).equals(Buffer.from(again)),
'Font selection must not leak across renders',
);
}

async function readPackedImage(url, dimensions, failure) {
const response = await fetch(url);
assert.equal(response.status, 200, failure());
assert.equal(response.headers.get('content-type'), 'image/png', failure());
// A render error arrives after the status, as a failed body.
const bytes = new Uint8Array(await response.arrayBuffer());
assert.deepEqual([...bytes.subarray(0, 8)], [137, 80, 78, 71, 13, 10, 26, 10], failure());
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
assert.deepEqual([view.getUint32(16), view.getUint32(20)], dimensions, failure());
return bytes;
}

const packages = [];
for (const entry of readdirSync(join(root, 'packages'), { withFileTypes: true })) {
if (!entry.isDirectory()) {
Expand Down Expand Up @@ -146,7 +181,9 @@ writeFileSync(
environment.npm_config_registry = registry.origin;
environment.NPM_CONFIG_REGISTRY = registry.origin;
environment.PNPM_CONFIG_REGISTRY = registry.origin;
const version = packages.find((pkg) => pkg.manifest.name === 'void').manifest.version;
const voidManifest = packages.find((pkg) => pkg.manifest.name === 'void').manifest;
const version = voidManifest.version;
const imageVersion = packages.find((pkg) => pkg.manifest.name === '@void/image').manifest.version;
const managers = process.env.VOID_PACKED_PM ? [process.env.VOID_PACKED_PM] : ['npm', 'pnpm'];
assert(managers.every((manager) => ['npm', 'pnpm'].includes(manager)));
const frameworks = process.env.VOID_PACKED_FRAMEWORK
Expand Down Expand Up @@ -251,6 +288,35 @@ try {
);
const cli = join(fixture, 'node_modules/void/dist/cli/cli.mjs');
await run(process.execPath, [cli, '--help'], fixture);
await run(
manager,
manager === 'npm'
? ['install', `@void/image@${imageVersion}`]
: ['add', `@void/image@${imageVersion}`],
fixture,
);
assert(existsSync(join(fixture, 'node_modules/@void/image/licenses/Inter.txt')));
writeFileSync(
join(fixture, 'check-image.mjs'),
`import assert from 'node:assert/strict';
import { ImageResponse, OgImageResponse } from '@void/image/generate';
import { html } from 'void/html';
await assert.rejects(import('@void/image'));
for (const path of ['void/image', 'void/og']) await assert.rejects(import(path));
for (const response of [
new ImageResponse(html\`<div>Hello</div>\`, { width: 320, height: 168, fallbackFonts: false }),
new OgImageResponse(html\`<div>Hello</div>\`, { fallbackFonts: false }),
]) {
const bytes = new Uint8Array(await response.arrayBuffer());
assert.equal(response.headers.get('content-type'), 'image/png');
assert.deepEqual([...bytes.slice(0, 8)], [137, 80, 78, 71, 13, 10, 26, 10]);
}
`,
);
await run(process.execPath, ['check-image.mjs'], fixture);
if (process.env.CI || spawnSync('bun', ['--version']).status === 0) {
await run('bun', ['check-image.mjs'], fixture);
}
if (full && framework === 'react') {
await run(
manager,
Expand Down Expand Up @@ -341,6 +407,9 @@ try {
join(fixture, 'routes/api/packed-email.ts'),
`import { defineHandler } from 'void';\nimport { sendEmail } from 'void/email';\nexport const GET = defineHandler(async () => { return sendEmail({ from: 'packed@example.com', to: 'inbox@example.com', subject: 'Packed', text: 'ok' }); });\n`,
);
// Both response classes use the generate subpath and React only when the app has it.
writeFileSync(join(fixture, 'routes/api/packed-og.ts'), packedOgRoute);
writeFileSync(join(fixture, 'routes/api/packed-image.ts'), packedImageRoute);
mkdirSync(join(fixture, 'public'), { recursive: true });
writeFileSync(join(fixture, 'public/packed.txt'), label);
const vite = join(
Expand Down Expand Up @@ -433,6 +502,8 @@ if (runtime.manifest.platformVersion !== ${JSON.stringify(version)}) throw new E
} else {
assert.equal(email.error?.code, 'BINDING_MISSING', emailBody);
}
await assertPackedImage(`${base}/api/packed-og`, [1200, 630], task.failure);
await assertPackedImage(`${base}/api/packed-image`, [600, 600], task.failure);
if (full && framework === 'react') {
const markdown = await fetch(`${base}/markdown`);
assert.equal(markdown.status, 200, task.failure());
Expand Down Expand Up @@ -475,17 +546,16 @@ if (runtime.manifest.platformVersion !== ${JSON.stringify(version)}) throw new E
if (framework === 'react') {
// The Node target bundles the installed void into its build, so a ValidationError from
// void/handler is the class that page actions check, as in dev.
await run(
manager,
manager === 'npm' ? ['install', '@hono/node-server'] : ['add', '@hono/node-server'],
fixture,
);
await run(manager, [manager === 'npm' ? 'install' : 'add', '@hono/node-server'], fixture);
writeFileSync(
join(fixture, 'void.config.ts'),
"import { defineConfig } from 'void/config';\nexport default defineConfig({ target: 'node' });\n",
);
// KV and email are Cloudflare bindings.
rmSync(join(fixture, 'routes'), { recursive: true });
mkdirSync(join(fixture, 'routes/api'), { recursive: true });
writeFileSync(join(fixture, 'routes/api/packed-og.ts'), packedOgRoute);
writeFileSync(join(fixture, 'routes/api/packed-image.ts'), packedImageRoute);
writeFileSync(
join(fixture, 'pages/form.tsx'),
'export default function Form() {\n return <h1>Form</h1>;\n}\n',
Expand Down Expand Up @@ -519,12 +589,14 @@ if (runtime.manifest.platformVersion !== ${JSON.stringify(version)}) throw new E
const body = await response.text();
assert.equal(response.status, 200, `${body}\n${task.failure()}`);
assert(body.includes('Email already taken'), body);
await assertPackedImage(`${base}/api/packed-og`, [1200, 630], task.failure);
await assertPackedImage(`${base}/api/packed-image`, [600, 600], task.failure);
} finally {
await task.stop();
}
}
console.log(
`Passed packed ${label} (${suite}): init, frozen install, ${useVitePlus ? 'Vite+ build/typecheck/test' : 'public Vite build/typecheck'}, assets, KV, email, runtime integrity${full ? ', dev/preview, hydration/navigation' : ', dev HTTP'}${framework === 'react' ? ', Node target' : ''}`,
`Passed packed ${label} (${suite}): init, frozen install, ${useVitePlus ? 'Vite+ build/typecheck/test' : 'public Vite build/typecheck'}, assets, KV, email, OG/image rendering, runtime integrity${full ? ', dev/preview, hydration/navigation' : ', dev HTTP'}${framework === 'react' ? ', Node target' : ''}`,
);
} catch (error) {
failures.push({ fixture: label, error: String(error.stack ?? error) });
Expand Down
18 changes: 18 additions & 0 deletions .github/scripts/packed-registry.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export function inspectPackage(tarball) {
assert(isHttpsUrl(manifest.homepage), `${manifest.name}: homepage must be an HTTPS URL`);
assert(isHttpsUrl(manifest.bugs?.url), `${manifest.name}: bugs.url must be an HTTPS URL`);
assert(files.has('package/LICENSE'), `${manifest.name}: missing packaged LICENSE`);

if (manifest.name === 'void') {
assert.equal(manifest.dependencies?.['takumi-js'], undefined);
assert.equal(manifest.exports['./image'], undefined);
assert.equal(manifest.exports['./og'], undefined);
for (const file of [
'docs/guide/quickstart.md',
'docs/reference/cli.md',
Expand All @@ -43,6 +47,20 @@ export function inspectPackage(tarball) {
'void: docs must be bundled at the package root',
);
}

if (manifest.name === '@void/image') {
assert(files.has('package/licenses/Inter.txt'), '@void/image: missing Inter license');
assert.equal(manifest.exports['.'], undefined, '@void/image: root must not export generation');
assert(manifest.exports['./generate'], '@void/image: missing generate export');
assert(manifest.peerDependencies?.void, '@void/image: missing void peer dependency');
assert(manifest.dependencies?.['takumi-js'], '@void/image: missing Takumi dependency');
const output = execFileSync('tar', ['-xOf', tarball, 'package/dist/generate.mjs'], {
encoding: 'utf8',
});
assert.match(output, /from ["']takumi-js["']/, '@void/image: Takumi must stay external');
assert.match(output, /import\(["']takumi-js\/wasm["']\)/);
}

for (const field of [
'dependencies',
'optionalDependencies',
Expand Down
44 changes: 42 additions & 2 deletions .github/scripts/packed-registry.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import assert from 'node:assert/strict';
import { execFileSync } from 'node:child_process';
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path/posix';
import { dirname, join } from 'node:path/posix';
import { test } from 'node:test';
import { inspectPackage } from './packed-registry.mjs';

function createPackage(t, overrides = {}, includeLicense = true) {
function createPackage(t, overrides = {}, includeLicense = true, extraFiles = {}) {
const root = mkdtempSync(join(tmpdir(), 'void-packed-metadata-'));
t.after(() => rmSync(root, { recursive: true, force: true }));
const directory = join(root, 'package');
Expand All @@ -26,6 +26,11 @@ function createPackage(t, overrides = {}, includeLicense = true) {
if (includeLicense) {
writeFileSync(join(directory, 'LICENSE'), 'MIT License\n');
}
for (const [path, content] of Object.entries(extraFiles)) {
const file = join(directory, path);
mkdirSync(dirname(file), { recursive: true });
writeFileSync(file, content);
}
const tarball = join(root, 'package.tgz');
execFileSync('tar', ['-czf', tarball, '-C', root, 'package']);
return tarball;
Expand Down Expand Up @@ -62,3 +67,38 @@ void test('rejects blank descriptions and invalid package links', (t) => {
void test('requires the license file as well as its manifest field', (t) => {
assert.throws(() => inspectPackage(createPackage(t, {}, false)), /missing packaged LICENSE/);
});

const imageManifest = {
name: '@void/image',
exports: { './generate': './dist/generate.mjs' },
dependencies: { 'takumi-js': '~2.20.0' },
peerDependencies: { void: '^1.8.0' },
};
const imageFiles = {
'dist/generate.mjs': 'import { render } from "takumi-js";\nimport("takumi-js/wasm");\n',
'licenses/Inter.txt': 'SIL Open Font License\n',
};

void test('accepts the image subpath with external Takumi and its font license', (t) => {
inspectPackage(createPackage(t, imageManifest, true, imageFiles));
});

void test('rejects image packages that expose the root or omit the void peer', (t) => {
for (const overrides of [
{ exports: { ...imageManifest.exports, '.': './dist/generate.mjs' } },
{ peerDependencies: {} },
]) {
assert.throws(() =>
inspectPackage(createPackage(t, { ...imageManifest, ...overrides }, true, imageFiles)),
);
}
});

void test('rejects image packages that omit the font license or bundle Takumi', (t) => {
for (const files of [
{ 'dist/generate.mjs': imageFiles['dist/generate.mjs'] },
{ ...imageFiles, 'dist/generate.mjs': 'export class ImageResponse {}\n' },
]) {
assert.throws(() => inspectPackage(createPackage(t, imageManifest, true, files)));
}
});
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ jobs:
- run: vp run build
if: ${{ matrix.shard != 'unit' }}

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
if: ${{ matrix.shard != 'unit' }}
with:
bun-version: '1.4.4'

- run: vp test run --project parallel-integration --shard=${{ matrix.shard }}
if: ${{ matrix.shard != 'unit' }}

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/prepublish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ jobs:
with:
node-version-file: .node-version
cache: true
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: '1.4.4'
# The npm bundled with Node can lag behind fixes that fresh installs need.
- run: npm i -g npm && npm --version
if: ${{ matrix.pm == 'npm' }}
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pnpm workspaces managed through Vite+. Shared dependency versions use the **pnpm
| [`packages/deploy-cloudflare`](./packages/deploy-cloudflare) | `@void/deploy-cloudflare` | Direct Cloudflare config and verified upload primitives |
| [`packages/edge`](./packages/edge) | `@void/edge` | Shared routing, headers, and static edge runtime |
| [`packages/isr`](./packages/isr) | `@void/isr` | Shared ISR protocol, core logic, and direct runtime |
| [`packages/image`](./packages/image) | `@void/image` | Image generation and Open Graph image responses |
| [`packages/platform`](./packages/platform/README.md) | `@void/platform` | Self-hosted installation contracts and packaged platform runtime |
| [`packages/void`](./packages/void/AGENTS.md) | `void` | Core Vite plugin — routing, inference, migrations, CLI |
| [`packages/react`](./packages/react/README.md) | `@void/react` | React framework adapter for Pages mode (SSR, Link, useForm) |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Read the [Void documentation](https://void.cloud) online or use the Markdown gui

- [Server routes](https://void.cloud/guide/server-routing), [pages](https://void.cloud/guide/pages-routing/overview), and [error components](https://void.cloud/guide/pages-routing/errors)
- [Database](https://void.cloud/guide/database) and [type safety](https://void.cloud/guide/type-safety)
- [Image generation](https://void.cloud/guide/image-generation) and [Open Graph images](https://void.cloud/guide/og-images) with `@void/image`
- [Deployment](https://void.cloud/guide/deployment)
- [Framework integrations](https://void.cloud/integrations/frameworks/overview)
- [API](https://void.cloud/reference/api) and [CLI](https://void.cloud/reference/cli) reference
Expand Down
4 changes: 3 additions & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ workspace links can hide. They do not publish packages or deploy applications.

Smoke coverage checks package contents and exports, real initialization, CLI help, a frozen
reinstall, public Vite builds, TypeScript, and development HTTP requests for pages, assets, and
KV. It uses no browser. Full coverage adds Vue, Svelte, Solid, Markdown, production preview,
KV. It also renders images through the installed `@void/image/generate` module on Node.js and,
when available locally, Bun. CI installs Bun and requires both runtimes. It uses no browser.
Full coverage adds Vue, Svelte, Solid, Markdown, production preview,
and browser hydration/navigation. Superseded PR/main runs are cancelled; release runs are not.

The selector reads all PR file pages or the complete pushed commit range. Renames consider both
Expand Down
1 change: 1 addition & 0 deletions benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/artifacts/
Loading