Skip to content

Better organize runtime modules - #841

Merged
cpojer merged 2 commits into
mainfrom
codex/organize-runtime-modules
Nov 16, 2026
Merged

cpojer merged 2 commits into
mainfrom
codex/organize-runtime-modules

Conversation

@yangshun

@yangshun yangshun commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Group the mostly flat runtime helpers into feature directories. The runtime root now contains only directories, with standalone public features using <feature>/index.ts. Retain descriptive engine, handler, and client/server roles in filenames. Update imports, generated-code paths, build entries, package exports and tests while preserving public void/* import names.

Before: 76 direct files and 3 directories under packages/void/src/runtime/. Filename patterns below summarize related files.

runtime/
├── ai*.ts
├── auth*.ts, better-auth*.ts
├── client*.ts, fetch*.ts
├── db*.ts, pg.ts, seed.ts
├── schema*.ts, drizzle*.ts
├── migration*.ts, mysql-migration-sql.ts
├── env*.ts
├── handler*.ts, response.ts, validator.ts
├── routing*.ts, route-url.ts, prerender-path.ts, static-asset-marker.ts
├── live*.ts
├── sandbox*.ts
├── sse*.ts
├── ws*.ts
├── durable.ts, isr.ts, kv.ts, limits.ts, log.ts, queues.ts, storage.ts
├── email.ts, email-protocol.ts
├── base64.ts
├── email/
├── error-pages/
└── remote/

After: Feature directories.

runtime/
├── ai/
├── auth/                 # index.ts, better-auth-*, client*, migrations, response
├── client/               # index.ts, framework clients, fetch helpers
├── db/
│   ├── migrations/       # *-handler, mysql-lock, mysql-sql
│   ├── schema/
│   ├── validators/       # drizzle-*
│   └── index.ts, postgres.ts, mysql.ts, pgpass.ts, seed.ts
├── durable/              # index.ts
├── email/                # index.ts, protocol.ts, testing.ts, existing helpers
├── env/                  # runtime, public, public-client, helpers, raw
├── handler/              # index.ts, composition, response, validator
├── isr/                  # index.ts
├── kv/                   # index.ts
├── limits/               # index.ts
├── live/
├── log/                  # index.ts
├── queues/               # index.ts
├── remote/
├── routing/
│   └── error-pages/
├── sandbox/
├── sse/
├── storage/              # index.ts
└── ws/

I think some files could be better categorized but I didn't want to make that many changes yet, mainly focused on organization of the runtime directory. Feel free to move more files.

Keep the email protocol beside its runtime in email/protocol.ts, and move the cross-feature base64 helper to src/shared/base64.ts. Extract email pattern compilation and dispatch ordering into src/shared/email-pattern.ts. The file scanner and runtime email test harness share this dependency-free module, removing filesystem discovery from the harness dependency graph.

Notes

  • All 57 existing package export paths and their conditions are preserved.
  • No new behavior, simply moving files around for better scannability.

Validation

  • Package/playground builds, artifact checks, formatting, lint and vp run check.
  • CI=true vp run test: full 811-file selection, with 17,326 passing tests (35 skipped).
  • Full packed-consumer acceptance with npm and pnpm across React, Vue, Svelte and Solid.
  • Email test harness bundles with filesystem imports rejected.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://codex-organize-runtime-modules-void-cloud.voidzero-docs.workers.dev (commit db1a52c)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://03a974d2-void-cloud.voidzero-docs.workers.dev db1a52c 2026-11-16T03:49:39.127Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://beb32ab9-void-cloud.voidzero-docs.workers.dev 3e60005 2026-11-16T03:34:31.003Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c7963d28-void-cloud.voidzero-docs.workers.dev 966fd65 2026-11-16T03:04:48.922Z Visit the dashboard ↗

Move runtime files with git mv without changing their contents. Keep import
and packaging updates in the following commit so small entry files retain
a clear rename history.
Update imports, generated-code paths, package exports, build entries and
tests for the feature directories while preserving public import names.
Share pure email pattern compilation and ordering between the filesystem
scanner and runtime email test harness, and retain descriptive role names.
@yangshun
yangshun force-pushed the codex/organize-runtime-modules branch from 3e60005 to db1a52c Compare November 16, 2026 03:47
@yangshun
yangshun marked this pull request as ready for review November 16, 2026 04:05
@yangshun
yangshun requested a review from a team as a code owner November 16, 2026 04:05
@yangshun yangshun changed the title Organize runtime modules by feature Organize runtime modules Nov 16, 2026
@yangshun yangshun changed the title Organize runtime modules Better organize runtime modules Nov 16, 2026

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanups!

@cpojer
cpojer merged commit 38db82c into main Nov 16, 2026
19 checks passed
@cpojer
cpojer deleted the codex/organize-runtime-modules branch November 16, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants