fix(core): avoid optional dialect export warnings#2082
Conversation
🦋 Changeset detectedLatest commit: b470f6e The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
This is the right fix for the right problem. Moving from a namespace import that probes a possibly-missing export to an explicit supportsCoalescing capability flag matches EmDash’s existing supportsRequestScope pattern, keeps the virtual-module generation deterministic, and avoids bundler warnings for adapters that never implemented cold-start coalescing. The change is additive on DatabaseDescriptor, defaults to false, and only D1 and Durable Objects opt in — exactly the two adapters that export createCoalescingDialect.
What I checked:
- Traced
generateDialectModulecallers: onlyvite-config.tsand unit tests invoke it; all have been updated to passsupportsCoalescing. - Verified the generated output for both flag states and both request-scope settings: no syntax/ordering issues, the old
_dialectModule.createCoalescingDialectnamespace access is gone. - Confirmed D1 (
packages/cloudflare/src/db/d1.ts) and DO SQL (packages/cloudflare/src/db/do-sql.ts) exportcreateCoalescingDialect; other adapters (SQLite, libSQL, Postgres, Hyperdrive, preview/playground DO) do not, and none are flagged. - Confirmed the runtime already treats
createCoalescingDialectas optional and just falls back to the singleton when it isundefined. - Checked that
DatabaseDescriptorflows throughEmDashConfigand the serialized virtual config without any transform stripping the new field. - The changeset correctly lists both affected packages as patch bumps and describes the user-visible effect.
No AGENTS.md convention violations surfaced, and the targeted test coverage (enabled and fallback module generation, plus Cloudflare descriptor tests) looks adequate. This PR is clean.
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
What does this PR do?
Makes cold-start query coalescing an explicit database-adapter capability.
The cold-start batching change in #1617 reads
createCoalescingDialectthrough a namespace import. Bundlers can still statically inspect that property access and warn when the configured SQLite, libSQL, PostgreSQL, or third-party adapter does not export it.This change adds an optional
supportsCoalescingdescriptor flag, enables it for the Cloudflare D1 and Durable Objects adapters that provide the export, and emitsundefinedfor every other adapter without probing a missing export. The runtime fallback behavior is unchanged.Type of change
Checklist
pnpm lintpasses (changed files pass; the full run currently reports an unrelated existing diagnostic inpackages/registry-verification/src/records.ts:276)Test output
emdashtypecheck: passed@emdash-cms/cloudflaretypecheck: passed