Repository navigation
refactor!: stop exporting internal-only APIs before v2 stable - #2326
Conversation
Helpers that only exist to support each package's own implementation are no longer exported from its entry points, so they can change freely after v2 is stable. Each symbol was checked to have no use in other workspace packages, docs, playgrounds, e2e tests or benches. Removed exports: - @orpc/server: augmentRouter, augmentImplementedRouter (+ options types), createRouterImplementer, decorateMiddleware, createGuardedProcedureLazy, createContractProcedure, withHiddenRouterContract, getHiddenRouterContract, and the cloneORPCError / reconcileORPCError re-exports - @orpc/server/standard: CompositeStandardHandlerPlugin, TracingHandlerPlugin - @orpc/client: resolveFriendlyClientOptions - @orpc/client/standard: CompositeStandardLinkPlugin - @orpc/contract: augmentContractRouter, HIDDEN_META_PLUGINS_SYMBOL, getAsyncIteratorObjectSchemaDetails (+ AsyncIteratorObjectSchemaDetails) - @orpc/shared: AsyncIdQueue, startSpan, setSpanAttributeIfDefined, runInSpanContext - @orpc/openapi: isBodylessMethod, DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, DEFAULT_OPENAPI_INPUT_STRUCTURE, DEFAULT_OPENAPI_OUTPUT_STRUCTURE - @orpc/openapi/standard: serializeHeaders - @orpc/tanstack-query, @orpc/pinia-colada: generateOperationKey, isProcedureUtilsOptions, CompositeRouterUtilsPlugin, serializableStreamedQuery (and liveQuery in Pinia Colada) - @orpc/swr: generateOperationKey, isSubsetOf Now type-only exports, because they appear in public inferred types but are only constructed internally: SharedRouterImplementer (@orpc/server), ProcedureUtils and SharedUtils (TanStack Query, Pinia Colada, SWR), and HTTPProcedureUtils (@orpc/msw). Kept on purpose: adapter building blocks (StandardHandler, RPCMatcher, createStandardPeerRequestHandler, WebSocketHandler, ...), the @orpc/json-schema toolkit, meta readers (getMcpToolMeta, ...), mergeProcedureUtilsOptions for RouterUtilsPlugin authors, unique-symbol context keys that appear in public types, and deprecated aliases. Index tests now assert the internals are not exported. The OpenAPI matcher test builds its contract-first router with implement(contract).router() instead of withHiddenRouterContract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U63hBfpeESmJiHXznRFzjN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U63hBfpeESmJiHXznRFzjN
SharedRouterImplementer, ProcedureUtils, SharedUtils and HTTPProcedureUtils were switched to `export type`, but the bundled .d.mts drops the type-only modifier and still lists them as values. A consumer could import them without `type` (or use them with instanceof) and pass type-checking, then fail at load time because the runtime module no longer exports them. Export them as values again, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U63hBfpeESmJiHXznRFzjN
Restore `export * from './queue'` and `export * from './tracing'` so AsyncIdQueue, AsyncIdQueueCloseOptions, startSpan, setSpanAttributeIfDefined and runInSpanContext stay exported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U63hBfpeESmJiHXznRFzjN
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
orpc | 613df85 | Commit Preview URL Branch Preview URL |
Oct 24 2026, 01:49 PM |
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This PR removes 36 previously importable symbols from multiple package entrypoints before v2 stability; while production request behavior is unchanged, external consumers may face compile-time or runtime import breaks. The breadth and explicitly breaking API surface warrants human review. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-lock
@orpc/mcp
@orpc/msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Removed 36 internal-only exports from
@orpc/server,@orpc/server/standard,@orpc/client,@orpc/client/standard,@orpc/contract,@orpc/openapi,@orpc/openapi/standard,@orpc/tanstack-query,@orpc/pinia-colada, and@orpc/swr. - Explicit
export {}/export type {}lists replaceexport *in the many modules that mixed public and internal symbols, so a new internal helper no longer becomes public by default. - Dropped barrels entirely for
router-hidden(server),utils(openapi/standard,swr), andlive-query(pinia-colada). - Public-typed classes stay value exports (
SharedRouterImplementer,ProcedureUtils,SharedUtils,HTTPProcedureUtils). - Test updates drop assertions for now-removed symbols; the OpenAPI matcher test now builds its contract-first router via
implement(contract).router(...).
I traced each new explicit list back to its module and confirmed every retained symbol was previously reachable through the old export * (no accidental additions), that every removed symbol is still exported by its defining module for the intra-package relative imports that use it (@orpc/mcp keeps working because the plural getAsyncIteratorObjectSchemasDetails stays public), and that no cross-package import of a removed symbol exists. The only runtime files touched merely drop an export keyword, so there is no behavior change, and the OpenAPI matcher test refactor is semantically equivalent to the old withHiddenRouterContract call.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Removes internal-only helpers from the package entry points, so they can change freely after v2 is stable. Each removed symbol was checked to have no use in another workspace package, the docs, playgrounds,
tests/orbenches/.Removed exports (36)
@orpc/serveraugmentRouter,AugmentRouterOptions(type),augmentImplementedRouter,AugmentImplementedRouterOptions(type),createRouterImplementer,decorateMiddleware,createGuardedProcedureLazy,createContractProcedure,withHiddenRouterContract,getHiddenRouterContract,cloneORPCError,reconcileORPCError@orpc/server/standardCompositeStandardHandlerPlugin,TracingHandlerPlugin@orpc/clientresolveFriendlyClientOptions@orpc/client/standardCompositeStandardLinkPlugin@orpc/contractaugmentContractRouter,HIDDEN_META_PLUGINS_SYMBOL,getAsyncIteratorObjectSchemaDetails,AsyncIteratorObjectSchemaDetails(type)@orpc/openapiisBodylessMethod,DEFAULT_OPENAPI_SUCCESS_DESCRIPTION,DEFAULT_OPENAPI_INPUT_STRUCTURE,DEFAULT_OPENAPI_OUTPUT_STRUCTURE@orpc/openapi/standardserializeHeaders@orpc/tanstack-querygenerateOperationKey,isProcedureUtilsOptions,CompositeRouterUtilsPlugin,serializableStreamedQuery@orpc/pinia-coladagenerateOperationKey,isProcedureUtilsOptions,CompositeRouterUtilsPlugin,serializableStreamedQuery,liveQuery@orpc/swrgenerateOperationKey,isSubsetOfcloneORPCErrorandreconcileORPCErrorare only dropped from@orpc/server's re-exports. Other packages import them from@orpc/clientand@orpc/contract, so they stay exported there. Nothing new is exported, and no export changed between value and type-only.@orpc/sharedis unchanged.How it's done
index.tsinstead ofexport *. A new export added to one of these modules has to be added to itsindex.tslist to become public:@orpc/server: implementer-router, middleware-decorated, procedure-utils, router-utils@orpc/server/standard,@orpc/client/standard: plugin@orpc/client: utils@orpc/contract: router-utils, schema-built-in@orpc/openapi: constants, utils@orpc/tanstack-query,@orpc/pinia-colada: key, plugin, procedure-utils, shared-utils, stream-query@orpc/swr: key, procedure-utils, shared-utils@orpc/msw: http-procedure-utilsrouter-hidden(server),utils(@orpc/openapi/standardand@orpc/swr),live-query(pinia-colada).TracingHandlerPlugin,HIDDEN_META_PLUGINS_SYMBOL,AugmentRouterOptionsandAugmentImplementedRouterOptionsare only used in their own file, so they lost theexportkeyword there.implement(contract).router()instead of importingwithHiddenRouterContract.@orpc/effectindex test no longer asserts that internal helpers are not exported.Kept on purpose
StandardHandler,RPCMatcher,createStandardPeerRequestHandler,WebSocketHandler,WebSocketLinkTransport, …@orpc/json-schemautilities and the meta readers (getMcpToolMeta,getTanstackQueryMeta, …).mergeProcedureUtilsOptions, forRouterUtilsPluginauthors.SharedRouterImplementer,ProcedureUtils/SharedUtilsandHTTPProcedureUtils, stay value exports. The bundled.d.mtsdeclares them as values even when the source saysexport type, so a type-only export would type-check and then crash at load.Breaking changes
The 36 symbols above can no longer be imported from the listed entry points.
Verification
main(72feedb, which includes feat(effect)!: promote to stable as @orpc/effect #2321 and fix!: only accept jsonified client factories in createContractJsonifiedUtilsFactory #2328).pnpm lint,pnpm type:check(including@orpc/nest), the rootpnpm vitest run, the@orpc/cloudflareand@orpc/buntest suites, andpnpm docs:validate.mainis exactly the 36 removals, with nothing added and no export switched between value and type-only.23fc494):composite: trueand exercise documented patterns, including values passed between entry points..d.tsis re-checked withskipLibCheck: false..d.ts/.jsare byte-identical to that base..d.mts, re-run after mergingmainatb3945c9:.d.mtsfile of a package.🤖 Generated with Claude Code
https://claude.ai/code/session_01U63hBfpeESmJiHXznRFzjN