Skip to content

Commit a9dbeb7

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix/buildlocation-href-rewrite
- Typecheck: `tsc -b`
2 parents 2b831cf + 0babe5d commit a9dbeb7

182 files changed

Lines changed: 810 additions & 427 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/router/framework/react/routing/installation-with-router-cli.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To use file-based routing with the TanStack Router CLI, you'll need to install t
1111
npm install -D @tanstack/router-cli
1212
```
1313

14-
Once installed, you'll need to amend your your scripts in your `package.json` for the CLI to `watch` and `generate` files.
14+
Once installed, you'll need to amend your scripts in your `package.json` for the CLI to `watch` and `generate` files.
1515

1616
```json
1717
{

‎docs/start/framework/react/build-from-scratch.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ from the default [preloading functionality](/router/latest/docs/framework/react/
137137
> You won't have a `routeTree.gen.ts` file yet. This file will be generated when you run TanStack Start for the first time.
138138
139139
```tsx
140-
// src/start.tsx
140+
// src/router.tsx
141141
import { createRouter } from '@tanstack/react-router'
142142
import { routeTree } from './routeTree.gen'
143143

‎docs/start/framework/react/environment-functions.md‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ title: Environment Functions
77

88
Environment functions are utilities designed to define and control function execution based on the runtime environment—whether the code is running on the client or the server. These utilities help ensure that environment-specific logic is executed safely and intentionally, preventing runtime errors and improving maintainability in fullstack or isomorphic applications.
99

10-
Start provide three core environment functions:
10+
Start provides three core environment functions:
1111

1212
- `createIsomorphicFn`: Compose a single function that adapts to both client and server environments.
13-
- `serverOnly`: Ensures a function can only run on the server.
14-
- `clientOnly`: Ensures a function can only run on the client.
13+
- `createServerOnlyFn`: Create a function that can only run on the server.
14+
- `createClientOnlyFn`: Create a function that can only run on the client.
1515

1616
---
1717

@@ -87,28 +87,28 @@ function noop() {}
8787

8888
## `env`Only Functions
8989

90-
The `serverOnly` and `clientOnly` helpers enforce strict environment-bound execution. They ensure the decorated function is only callable in the correct runtime context. If misused, they throw descriptive runtime errors to prevent unintentional logic execution.
90+
The `createServerOnlyFn` and `createClientOnlyFn` helpers enforce strict environment-bound execution. They ensure the returned function is only callable in the correct runtime context. If misused, they throw descriptive runtime errors to prevent unintentional logic execution.
9191

92-
### `serverOnly`
92+
### `createServerOnlyFn`
9393

9494
```tsx
95-
import { serverOnly } from '@tanstack/react-start'
95+
import { createServerOnlyFn } from '@tanstack/react-start'
9696

97-
const foo = serverOnly(() => 'bar')
97+
const foo = createServerOnlyFn(() => 'bar')
9898

9999
foo() // ✅ On server: returns "bar"
100-
// ❌ On client: throws "serverOnly() functions can only be called on the server!"
100+
// ❌ On client: throws "createServerOnlyFn() functions can only be called on the server!"
101101
```
102102

103-
### `clientOnly`
103+
### `createClientOnlyFn`
104104

105105
```tsx
106-
import { clientOnly } from '@tanstack/react-start'
106+
import { createClientOnlyFn } from '@tanstack/react-start'
107107

108-
const foo = clientOnly(() => 'bar')
108+
const foo = createClientOnlyFn(() => 'bar')
109109

110110
foo() // ✅ On client: returns "bar"
111-
// ❌ On server: throws "clientOnly() functions can only be called on the client!"
111+
// ❌ On server: throws "createClientOnlyFn() functions can only be called on the client!"
112112
```
113113

114114
> [!NOTE]
@@ -120,4 +120,4 @@ Environment functions are tree-shaken based on the environment for each bundle p
120120

121121
Functions created using `createIsomorphicFn()` are tree-shaken. All codes inside `.client()` are not included in server bundle, and vice-versa.
122122

123-
On the server, implementation of `clientOnly` functions are replaced with a function that throws an `Error`. The reverse is true for `serverOnly` functions on the client.
123+
On the server, functions created using `createClientOnlyFn()` are replaced with a function that throws an `Error` on the server. The reverse is true for `createServerOnlyFn` functions on the client.

‎docs/start/framework/react/hosting.md‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ import { cloudflare } from '@cloudflare/vite-plugin'
5353
import viteReact from '@vitejs/plugin-react'
5454

5555
export default defineConfig({
56-
plugins: [tanstackStart(), cloudflare(), viteReact()],
56+
plugins: [
57+
cloudflare({ viteEnvironment: { name: 'ssr' } }),
58+
tanstackStart(),
59+
viteReact(),
60+
],
5761
})
5862
```
5963

@@ -114,13 +118,15 @@ Deploy your application using their one-click deployment process, and you're rea
114118

115119
**⚠️ During TanStack Start 1.0 release candidate phase, we currently recommend using:**
116120

117-
- [@tanstack/tanstack-nitro-v2-vite-plugin (Temporary Compatibility Plugin)](https://www.npmjs.com/package/@tanstack/tanstack-nitro-v2-vite-plugin) - A temporary compatibility plugin for using Nitro v2 as the underlying build tool for TanStack Start.
121+
- [@tanstack/nitro-v2-vite-plugin (Temporary Compatibility Plugin)](https://www.npmjs.com/package/@tanstack/nitro-v2-vite-plugin) - A temporary compatibility plugin for using Nitro v2 as the underlying build tool for TanStack Start.
118122
- [Nitro v3's Vite Plugin (BETA)](https://www.npmjs.com/package/nitro-vite) - A **BETA** plugin for officially using Nitro v3 as the underlying build tool for TanStack Start.
119123

120124
#### Using Nitro v2
121125

122126
**⚠️ `@tanstack/nitro-v2-vite-plugin` is a temporary compatibility plugin for using Nitro v2 as the underlying build tool for TanStack Start. Use this plugin if you experience issues with the Nitro v3 plugin. It does not support all of Nitro v3's features and is limited in it's dev server capabilities, but should work as a safe fallback, even for production deployments for those who were using TanStack Start's alpha/beta versions.**
123127

128+
If you want to use this plugin with bun please make sure to use [isolated installs](https://bun.com/docs/install/isolated#using-isolated-installs).
129+
124130
```tsx
125131
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
126132
import { defineConfig } from 'vite'
@@ -132,15 +138,21 @@ export default defineConfig({
132138
plugins: [
133139
tsConfigPaths({ projects: ['./tsconfig.json'] }),
134140
tanstackStart(),
135-
nitro(),
141+
nitroV2Plugin(),
136142
viteReact(),
137143
],
138144
})
139145
```
140146

141147
#### Using Nitro v3 (BETA)
142148

143-
**⚠️ The `nitro/vite` plugin is an official **BETA** plugin from the Nitro team for using Nitro v3 as the underlying build tool for TanStack Start. It is still in development and is receiving regular updates.**
149+
**⚠️ The `nitro` vite plugin is an official **BETA** plugin from the Nitro team for using Nitro v3 as the underlying build tool for TanStack Start. It is still in development and is receiving regular updates.**
150+
151+
This package needs to be installed as follows:
152+
153+
```
154+
"nitro": "npm:nitro-nightly",
155+
```
144156

145157
```tsx
146158
import { tanstackStart } from '@tanstack/react-start/plugin/vite'

‎docs/start/framework/react/server-functions.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Call server functions from:
4949
- **Other server functions** - Compose server logic
5050
- **Event handlers** - Handle form submissions, clicks, etc.
5151

52-
````tsx
52+
```tsx
5353
// In a route loader
5454
export const Route = createFileRoute('/posts')({
5555
loader: () => getPosts(),
@@ -64,6 +64,7 @@ function PostList() {
6464
queryFn: () => getPosts(),
6565
})
6666
}
67+
```
6768

6869
## Parameters & Validation
6970

@@ -81,7 +82,7 @@ export const greetUser = createServerFn({ method: 'GET' })
8182
})
8283

8384
await greetUser({ data: { name: 'John' } })
84-
````
85+
```
8586

8687
### Validation with Zod
8788

‎docs/start/framework/solid/build-from-scratch.md‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@ ref: docs/start/framework/react/build-from-scratch.md
33
replace:
44
{
55
'@tanstack/react-start': '@tanstack/solid-start',
6-
'React': 'SolidJS',
76
'react-router': 'solid-router',
7+
'react react-dom': 'solid-js',
8+
"Alternatively, you can also use `@vitejs/plugin-react-oxc` or `@vitejs/plugin-react-swc`.\n": '',
9+
'@vitejs/plugin-react': 'vite-plugin-solid',
10+
'@types/react @types/react-dom ': '',
11+
'"jsx": "react-jsx"': "\"jsx\": \"preserve\",\n \"jsxImportSource\": \"solid-js\"",
12+
'import viteReact': 'import viteSolid',
13+
"viteReact\\(\\)": 'viteSolid({ssr:true})',
14+
"type { ReactNode } from 'react'": "type * as Solid from 'solid-js'",
15+
'ReactNode': 'Solid.JSX.Element',
16+
'{state}': '{state()}',
17+
" <html>\n <head>\n <HeadContent />\n </head>\n <body>\n {children}\n <Scripts />\n </body>\n </html>": " <>\n <HeadContent />\n {children}\n <Scripts />\n </>",
18+
"react's": "solid's",
19+
'React': 'SolidJS',
820
}
921
---

‎e2e/react-start/basic-auth/src/routeTree.gen.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ import type { getRouter } from './router.tsx'
219219
import type { createStart } from '@tanstack/react-start'
220220
declare module '@tanstack/react-start' {
221221
interface Register {
222+
ssr: true
222223
router: Awaited<ReturnType<typeof getRouter>>
223224
}
224225
}

‎e2e/react-start/basic-react-query/src/routeTree.gen.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ import type { getRouter } from './router.tsx'
412412
import type { createStart } from '@tanstack/react-start'
413413
declare module '@tanstack/react-start' {
414414
interface Register {
415+
ssr: true
415416
router: Awaited<ReturnType<typeof getRouter>>
416417
}
417418
}

‎e2e/react-start/basic-tsr-config/src/routeTree.gen.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import type { getRouter } from './router.tsx'
6262
import type { createStart } from '@tanstack/react-start'
6363
declare module '@tanstack/react-start' {
6464
interface Register {
65+
ssr: true
6566
router: Awaited<ReturnType<typeof getRouter>>
6667
}
6768
}

‎e2e/react-start/basic/src/routeTree.gen.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,7 @@ import type { getRouter } from './router.tsx'
15891589
import type { createStart } from '@tanstack/react-start'
15901590
declare module '@tanstack/react-start' {
15911591
interface Register {
1592+
ssr: true
15921593
router: Awaited<ReturnType<typeof getRouter>>
15931594
}
15941595
}

0 commit comments

Comments
 (0)