Move runtime type generation to dedicated internal package#14589
Move runtime type generation to dedicated internal package#14589jamesopstad wants to merge 3 commits into
Conversation
|
|
Review posted to PR #14589. Summary of what I found:
The core refactor is behavior-preserving: nodejs_compat filtering, ENOENT-tolerant caching, the spy-friendly local adapter module, and external |
@cloudflare/autoconfig
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
635580a to
6fcaf2b
Compare
6fcaf2b to
c140741
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
There was a problem hiding this comment.
🔍 Pre-existing: checkTypesDiff writes regenerated file without RUNTIME_TYPES_MARKER, breaking cache on next run
In packages/wrangler/src/type-generation/helpers.ts:371-376, when checkTypesDiff auto-regenerates the types file during wrangler dev, it assembles the file as [newEnvHeader, runtimeHeader, newEnvTypes, runtimeTypes].join("\n") — without inserting the RUNTIME_TYPES_MARKER ("// Begin runtime types") line between the header and the runtime types content. This means the next time the cache check runs (now in @cloudflare/runtime-types' generateRuntimeTypes at packages/runtime-types/src/runtime.ts:63-64), it won't find the marker line and will always regenerate types, defeating the cache. This is a pre-existing issue (the old code had the same pattern), but it becomes more visible now that the caching logic is extracted into a shared package with explicit tests for the marker. Compare with packages/wrangler/src/type-generation/index.ts:533 which correctly includes the marker.
(Refers to lines 371-376)
Was this helpful? React with 👍 or 👎 to provide feedback.
Move runtime type generation to dedicated internal package.
This is a precursor to supporting the runtime type generation with the new config.
A picture of a cute animal (not mandatory, but encouraged)