Repository navigation
perf: narrow generated SDK runtime error imports - #23
Open
petebacondarwin wants to merge 1 commit into
Open
petebacondarwin wants to merge 1 commit into
petebacondarwin wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated TypeScript SDK clients import the full API barrel to construct HTTP errors, pulling request and resource barrels into consumers' runtime import graphs. Make the API namespace type-only and import the existing error constructors from the narrow errors barrel instead. This upstreams the SDK normalization introduced in cloudflare/cf#160.
Apply one shared normalization to standalone TypeScript SDK generation and the SDK transformer, including freshly generated SDKs and copied packaged baselines. Bundle the normalization entry point with the transformer. Use the existing TypeScript dependency to distinguish runtime references from types and edit syntax without changing comments or literals; preserve unfamiliar runtime uses. Error implementations, class identity, response data, and public SDK barrels stay unchanged. No new dependencies are required.
Validation:
pnpm check,pnpm typecheck, andpnpm testpass, including 20 new normalization regression tests.After cf re-vendors this transformer and regenerates its SDK, it can remove its local normalizer and generation hook. Its direct client/environment imports and consumer regression test should remain.