Repository navigation
refactor(start): hide undocumented internals from the published types - #9036
schiller-manuel wants to merge 9 commits into
Conversation
…and hydration strategies and hide their fields `HydrationStrategy` gets a required, type-only `'~types'` property, and the runtime fields `_t`, `_d`, `_s`, `_o`, `_a` and `_h` are tagged `@internal`. Without the brand the published type would have no required member left and accept any object. The strategy factories assert the branded type on the objects they return, so the emitted JavaScript is unchanged. `InternalHydrateProps` and solid-start-client's `GenericHydrate`, which only package code uses, are tagged as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hed types A name is public when the Start docs document it for any framework, or when a framework package re-exports it under a documented name. The other exports of the Start packages are tagged `@internal`, with split export statements where an entry mixes public and hidden names. They stay in `dist-ts` for the workspace, and the emitted JavaScript is unchanged. This covers the undocumented request and response helpers on `/server`, `RawStream`, `getRouterInstance`, `configureHydrationSuppressions`, every export of `/client-rpc`, `/server-rpc` and `/ssr-rpc`, the CSRF and serialization internals, the `TSS_*` constants, all of start-storage-context and start-plugin-core except the two plugin input config types that `tanstackStart` uses, and the members `__executeServer`, `method` and `options` of server functions, builders and middleware, the `extractedFn` and `serverFn` option fields and `createMiddleware` on the start instance. Exported types that no public declaration reaches any more are hidden too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orts `RawStream`, `hydrate`, `json`, `mergeHeaders`, `defaultSerovalDeserializerPlugins`, `attachRouterServerSsrUtils`, `transformReadableStreamWithRouter` and `transformPipeableStreamWithRouter` stayed public because the Start packages' published declarations re-exported them. With those re-exports hidden they are tagged `@internal`, together with the types only they used: `OnRawStreamCallback`, `JsonResponse`, `TsrSsrGlobal` and `TransformStreamWithRouterOptions`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aths `paths` does not merge across `extends`, so an e2e project with its own `~/*` alias that extends `packages/tsconfig.paths.json` loses the map. The generator now writes the map into every tsconfig under `e2e/` and `benchmarks/` that extends the map file and defines `paths`, as it already does for package tsconfigs, and keeps the file's own entries. The Playwright plugin adds `^compile` to the build targets of a project whose tsconfig extends the map, since those builds run `tsc` against `dist-ts`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`getRequestHeaders`, `getRequestUrl` and `getCookies` are no longer in the published types. Examples and e2e routes use `getRequest().headers` and `new URL(getRequest().url)`. The Supabase examples parse the cookie header with `parseCookieHeader` from `@supabase/ssr`, since their `getAll` needs every cookie and the documented `getCookie` reads one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ernal types These projects test names that left the published types: the response helpers (response-reconciliation, session-handling), `RawStream` (the basic projects, serialization-adapters, static-server-functions and the server-fn-transport benchmarks), `getRouterInstance` (the basic and server-functions projects) and `configureHydrationSuppressions` (vue-start basic). Their tsconfigs extend `packages/tsconfig.paths.json`; the e2e projects keep their `~/*` alias, so the generator writes the map into their `paths`. Their type checks now depend on `compile`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… types Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
🦋 Changeset detectedLatest commit: 92c9b39 The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 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 |
|
View your CI Pipeline Execution ↗ for commit 92c9b39
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview21 package(s) bumped directly, 8 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better. |
Merging this PR will degrade performance by 4.4%Warning TanStack has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 13, 2026 to keep using CodSpeed. 2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
🎯 Changes
Stacked on #9035.
The same rule for the Start packages: a name that
docs/does not document leaves the declarations users install and stays typed for workspace packages throughdist-ts. Emitted JavaScript is byte-identical (930 files).In the implementation packages (
start-client-core,start-server-core,start-plugin-core,start-storage-context, the-client/-serverpackages,react-start-rsc) a name is public only when a framework package re-exports it under a documented name. There are no Vue Start docs, so a name documented for one framework is public in all three./server(usegetRequest()),getRouterInstance,RawStream,json,configureHydrationSuppressions, everything on/client-rpc,/server-rpcand/ssr-rpc,__executeServer, the CSRF internals, theTSS_*constants, and all of start-plugin-core except the two plugin input config types.'~types'brand, so_t,_d,_s,_o,_aand_hcan be hidden withoutHydrationStrategyaccepting any object. Strategies fromvisible(),idle()and so on stay assignable;{}is rejected.RawStream,hydrate,json,mergeHeaders,defaultSerovalDeserializerPlugins,attachRouterServerSsrUtilsand the two stream transforms.RegisterandStartInstance.getOptions(the route tree footer), theserverroute option augmentations, and the types docs and user code import (CustomFetch,HydrateOptions,RequestHandler,ServerEntry,TransformAssets,TransformAssetsFn,RequestHeaderName,AnyCompositeComponent).Outside
packages/:getRequestHeaderstogetRequest(), 3 fromgetRequestUrl. The two Supabase examples read all cookies withparseCookieHeaderfrom@supabase/ssrin place ofgetCookies.server-fn-transportbenchmarks test hidden APIs and opt into the internal types. They define their own~/*alias, andpathsdoes not merge acrossextends, soscripts/internal-types-config.mjsnow writes the map into opted-in tsconfigs as it does for packages, and the Playwright Nx plugin adds^compileto their mode builds.Open questions, kept public until decided:
urlon server functions (<form action={fn.url}>in 10 e2e files).serverFnMetain middleware and handler contexts (10 e2e and example files).serializationAdaptersoncreateStart.createFromFetch/createFromReadableStreamon/rsbuild/*-decode, an entry only virtual modules use.Validated locally for
packages/*without the Nx cache:build,compile,test:types,test:unit,test:eslint,test:build(231 tasks);tscover 422 example, e2e and benchmark tsconfigs with the same results before and after;build:vite:ssrandbuild:rsbuild:ssrfor the React, Solid and Vue basic e2e projects. Not run: the Playwright e2e suites. Draft because it inherits the redtest:buildof #9032 until TanStack/config#443 is released.Written with AI assistance (Claude Code).
✅ Checklist
🚀 Release Impact
🤖 Generated with Claude Code