Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .changeset/hide-start-internals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
'@tanstack/start-client-core': patch
'@tanstack/start-server-core': patch
'@tanstack/start-plugin-core': patch
'@tanstack/start-storage-context': patch
'@tanstack/react-start': patch
'@tanstack/solid-start': patch
'@tanstack/vue-start': patch
'@tanstack/react-start-client': patch
'@tanstack/solid-start-client': patch
'@tanstack/vue-start-client': patch
'@tanstack/react-start-rsc': patch
'@tanstack/router-core': patch
---

Remove undocumented internals of TanStack Start from the published type declarations. Runtime behaviour is unchanged: every value is still exported from the same entry points and every property still exists at runtime. Only the types no longer name them. Code that used one of these names gets a type error and needs a cast. They are internal and can change in any release.

Request and response helpers on `@tanstack/{react,solid,vue}-start/server`: `getRequestHeaders`, `getRequestUrl`, `getRequestHost`, `getRequestIP`, `getRequestProtocol`, `getCookies`, `getResponseHeader`, `getResponseHeaders`, `getResponseStatus`, `clearResponseHeaders`, `removeResponseHeader`, `appendResponseHeader` and `createServerEntry` (the documented `createServerEntry` is the one on `/server-entry`). Use `getRequest()` instead: `getRequest().headers` for the headers, `new URL(getRequest().url)` for the URL, and `getCookie(name)` for a cookie. Also hidden there: `attachRouterServerSsrUtils`, `transformReadableStreamWithRouter`, `transformPipeableStreamWithRouter`, `HEADERS`, `VIRTUAL_MODULES` and the `ReadonlyResponseHeaders` type.

Root of `@tanstack/{react,solid,vue}-start`: `RawStream`, `json`, `hydrate`, `mergeHeaders`, `defaultSerovalDeserializerPlugins`, `getRouterInstance`, `execValidator`, `flattenMiddlewares`, `executeMiddleware`, `csrfSymbol`, `getCsrfRequestValidationResult`, `isCsrfRequestAllowed`, `TSS_FORMDATA_CONTEXT`, `TSS_SERVER_FUNCTION`, `TSS_CONTENT_TYPE_FRAMED`, `TSS_CONTENT_TYPE_FRAMED_VERSIONED`, `TSS_FRAMED_PROTOCOL_VERSION`, `FRAME_HEADER_SIZE`, `X_TSS_SERIALIZED`, `X_TSS_RAW_RESPONSE`, `X_TSS_CONTEXT`, `getDefaultSerovalPlugins`, `getSerovalPlugins`, `getGlobalStartContext`, `safeObjectMerge`, `createNullProtoObject` and `trackPostProcessPromise`, and the types `JsonResponse`, `OnRawStreamCallback`, `ClientFnMeta`, `ServerFnMeta`, `RequestMiddlewareOptions`, `CompiledFetcherFn`, `CompiledFetcherFnOptions`, `RscStream`, `MiddlewareFn`, `NextFn`, `ServerFnMiddlewareOptions`, `ServerFnMiddlewareResult`, `AnyStartInstance`, `AnyStartInstanceOptions`, `StartEntry` and `RouterEntry`.

Members: `__executeServer` and `method` on server functions, `options` on server function builders and middleware, the `extractedFn` and `serverFn` fields of the server function options, and `createMiddleware` on the instance that `createStart` returns. Hydration strategies lose `_t`, `_d`, `_s`, `_o`, `_a` and `_h`; in their place `HydrationStrategy` has a required, type-only `'~types'` property, so only the strategies that `visible()`, `idle()`, `interaction()`, `media()`, `load()`, `condition()` and `never()` return are accepted where a strategy is expected.

`@tanstack/vue-start/client`: `configureHydrationSuppressions`. Every export of `@tanstack/{react,solid,vue}-start/client-rpc`, `/server-rpc` and `/ssr-rpc` (`createClientRpc`, `createServerRpc`, `createSsrRpc` and the frame constants), which only compiled server function code imports. `@tanstack/react-start/rsc/serialization/client` and `/rsc/serialization/server`: `rscSerializationAdapter`. `@tanstack/react-start/rsc`: `SERVER_COMPONENT_CSS_HREFS`. `@tanstack/react-start/rsbuild/ssr-decode`: `setOnClientReference`. The `InternalHydrateProps` type of `@tanstack/react-start-client/Hydrate` and `@tanstack/solid-start-client/Hydrate`.

Implementation packages, which the docs never import from: in `@tanstack/start-client-core`, the hydration runtime on `/hydration` (`hydrateIdAttribute`, `hydrateIdSelector`, `hydrateInteractionEventsAttribute`, `hydrateWhenAttribute`, `clearResolvedGateIdsInMarker`, `createResolvedGate`, `getFallbackHtml`, `getMarkerGate`, `getOrCreateGate`, `onGateResolve`, `releaseGate`, `resolveHydrationMarker`, `runHydrationStrategyCleanup`, `saveFallbackHtml`, `waitForHydrationPrefetchStrategy`, `withHydrationRenderer`, `listenForDelegatedHydrationIntent` and the types `HydrationGateRecord`, `HydrationStrategyWithRenderer`, `HydrationMarkerAttributes`, `HydrationRuntimeContext` and `HydrationRuntimeGate`), everything on `/hydration/constants`, `/hydration/runtime`, `/client` and `/client-rpc`; in `@tanstack/start-server-core`, everything on `/createServerRpc`, `/createSsrRpc`, `/constants` and `/virtual-modules`; everything in `@tanstack/start-storage-context` (`getStartContext`, `runWithStartContext`, `StartStorageContext`, `StartHandlerType`); everything in `@tanstack/start-plugin-core` except `TanStackStartViteInputConfig` on `/vite` and `TanStackStartRsbuildInputConfig` on `/rsbuild`, which the `tanstackStart` plugin options use; and in `@tanstack/react-start-rsc`, `configureRsc`, `reactStartRscVitePlugin`, `createRscCssCompilerTransforms`, `rscSerializationAdapter`, `setOnClientReference` and `SERVER_COMPONENT_CSS_HREFS`.

`@tanstack/router-core`: `RawStream` and the `OnRawStreamCallback` type; on `/ssr/client`, `hydrate`, `json`, `mergeHeaders`, `defaultSerovalDeserializerPlugins` and the types `JsonResponse` and `TsrSsrGlobal` (with them the `Window` augmentation for `$_TSR`); on `/ssr/server`, `attachRouterServerSsrUtils`, `transformReadableStreamWithRouter`, `transformPipeableStreamWithRouter` and the `TransformStreamWithRouterOptions` type. `@tanstack/{react,solid,vue}-router/ssr/client` and `/ssr/server` re-export these entries, so the names leave there too.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
{
"projects": ["@tanstack/react-start"],
"target": "build"
},
{
"projects": ["@tanstack/react-start"],
"target": "compile"
}
],
"options": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../../../../tsconfig.json",
"extends": [
"../../../../../tsconfig.json",
"../../../../../packages/tsconfig.paths.json"
],
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
{
"projects": ["@tanstack/solid-start"],
"target": "build"
},
{
"projects": ["@tanstack/solid-start"],
"target": "compile"
}
],
"options": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../../../../tsconfig.json",
"extends": [
"../../../../../tsconfig.json",
"../../../../../packages/tsconfig.paths.json"
],
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "solid-js",
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/ssr/scenarios/server-fn-transport/vue/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
{
"projects": ["@tanstack/vue-start"],
"target": "build"
},
{
"projects": ["@tanstack/vue-start"],
"target": "compile"
}
],
"options": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../../../../tsconfig.json",
"extends": [
"../../../../../tsconfig.json",
"../../../../../packages/tsconfig.paths.json"
],
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "vue",
Expand Down
4 changes: 2 additions & 2 deletions e2e/react-start/basic-react-query/src/utils/users.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { queryOptions } from '@tanstack/react-query'
import { createIsomorphicFn } from '@tanstack/react-start'
import { getRequestUrl } from '@tanstack/react-start/server'
import { getRequest } from '@tanstack/react-start/server'
import axios from 'redaxios'

export type User = {
Expand All @@ -10,7 +10,7 @@ export type User = {
}

const getOrigin = createIsomorphicFn()
.server(() => getRequestUrl().origin)
.server(() => new URL(getRequest().url).origin)
.client(() => window.location.origin)

export const usersQueryOptions = () =>
Expand Down
6 changes: 6 additions & 0 deletions e2e/react-start/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
"dependsOn": [
"^build"
]
},
"build": {
"dependsOn": [
"^build",
"^compile"
]
}
},
"metadata": {
Expand Down
Loading
Loading