@tanstack/react-start 1.131.6 → 1.132.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import { TanStackStartInputConfig } from '@tanstack/start-plugin-core';
2
+ import { PluginOption } from 'vite';
3
+ export declare function tanstackStart(options?: TanStackStartInputConfig): Array<PluginOption>;
@@ -0,0 +1,72 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { TanStackStartVitePluginCore } from "@tanstack/start-plugin-core";
3
+ import path from "pathe";
4
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
5
+ const defaultEntryDir = path.resolve(
6
+ currentDir,
7
+ "..",
8
+ "..",
9
+ "plugin",
10
+ "default-entry"
11
+ );
12
+ const defaultEntryPaths = {
13
+ client: path.resolve(defaultEntryDir, "client"),
14
+ server: path.resolve(defaultEntryDir, "server")
15
+ };
16
+ const isInsideRouterMonoRepo = path.basename(path.resolve(currentDir, "../../../../")) === "packages";
17
+ function hasRootExport(exportsField) {
18
+ if (!exportsField) return false;
19
+ if (typeof exportsField === "string") {
20
+ return true;
21
+ }
22
+ if (typeof exportsField === "object") {
23
+ return "." in exportsField;
24
+ }
25
+ return false;
26
+ }
27
+ function tanstackStart(options) {
28
+ return [
29
+ {
30
+ name: "tanstack-react-start:config",
31
+ configEnvironment() {
32
+ return {
33
+ resolve: {
34
+ dedupe: ["react", "react-dom", "@tanstack/react-router"],
35
+ external: isInsideRouterMonoRepo ? ["@tanstack/react-router", "@tanstack/react-router-devtools"] : void 0
36
+ },
37
+ optimizeDeps: {
38
+ exclude: ["@tanstack/react-router-devtools"],
39
+ include: [
40
+ "react",
41
+ "react/jsx-runtime",
42
+ "react/jsx-dev-runtime",
43
+ "react-dom",
44
+ "react-dom/client",
45
+ "@tanstack/react-router"
46
+ ]
47
+ }
48
+ };
49
+ }
50
+ },
51
+ TanStackStartVitePluginCore(
52
+ {
53
+ framework: "react",
54
+ defaultEntryPaths,
55
+ crawlPackages(opts) {
56
+ if (opts.name === "@tanstack/react-router-devtools") {
57
+ return "exclude";
58
+ }
59
+ if (hasRootExport(opts.exports) && "react" in opts.peerDependencies) {
60
+ return "include";
61
+ }
62
+ return void 0;
63
+ }
64
+ },
65
+ options
66
+ )
67
+ ];
68
+ }
69
+ export {
70
+ tanstackStart
71
+ };
72
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.js","sources":["../../../src/plugin/vite.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url'\nimport { TanStackStartVitePluginCore } from '@tanstack/start-plugin-core'\nimport path from 'pathe'\nimport type { TanStackStartInputConfig } from '@tanstack/start-plugin-core'\nimport type { PluginOption } from 'vite'\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url))\nconst defaultEntryDir = path.resolve(\n currentDir,\n '..',\n '..',\n 'plugin',\n 'default-entry',\n)\nconst defaultEntryPaths = {\n client: path.resolve(defaultEntryDir, 'client'),\n server: path.resolve(defaultEntryDir, 'server'),\n}\n\nconst isInsideRouterMonoRepo =\n path.basename(path.resolve(currentDir, '../../../../')) === 'packages'\n\nfunction hasRootExport(\n exportsField?: Record<string, unknown> | string,\n): boolean {\n if (!exportsField) return false\n\n if (typeof exportsField === 'string') {\n // shorthand form: \"exports\": \"./index.js\"\n return true\n }\n\n if (typeof exportsField === 'object') {\n return '.' in exportsField\n }\n\n return false\n}\n\nexport function tanstackStart(\n options?: TanStackStartInputConfig,\n): Array<PluginOption> {\n return [\n {\n name: 'tanstack-react-start:config',\n configEnvironment() {\n return {\n resolve: {\n dedupe: ['react', 'react-dom', '@tanstack/react-router'],\n\n external: isInsideRouterMonoRepo\n ? ['@tanstack/react-router', '@tanstack/react-router-devtools']\n : undefined,\n },\n\n optimizeDeps: {\n exclude: ['@tanstack/react-router-devtools'],\n include: [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n 'react-dom/client',\n '@tanstack/react-router',\n ],\n },\n }\n },\n },\n TanStackStartVitePluginCore(\n {\n framework: 'react',\n defaultEntryPaths,\n crawlPackages(opts) {\n if (opts.name === '@tanstack/react-router-devtools') {\n return 'exclude'\n }\n if (hasRootExport(opts.exports) && 'react' in opts.peerDependencies) {\n return 'include'\n }\n return undefined\n },\n },\n options,\n ),\n ]\n}\n"],"names":[],"mappings":";;;AAMA,MAAM,aAAa,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC9D,MAAM,kBAAkB,KAAK;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,oBAAoB;AAAA,EACxB,QAAQ,KAAK,QAAQ,iBAAiB,QAAQ;AAAA,EAC9C,QAAQ,KAAK,QAAQ,iBAAiB,QAAQ;AAChD;AAEA,MAAM,yBACJ,KAAK,SAAS,KAAK,QAAQ,YAAY,cAAc,CAAC,MAAM;AAE9D,SAAS,cACP,cACS;AACT,MAAI,CAAC,aAAc,QAAO;AAE1B,MAAI,OAAO,iBAAiB,UAAU;AAEpC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,iBAAiB,UAAU;AACpC,WAAO,OAAO;AAAA,EAChB;AAEA,SAAO;AACT;AAEO,SAAS,cACd,SACqB;AACrB,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,oBAAoB;AAClB,eAAO;AAAA,UACL,SAAS;AAAA,YACP,QAAQ,CAAC,SAAS,aAAa,wBAAwB;AAAA,YAEvD,UAAU,yBACN,CAAC,0BAA0B,iCAAiC,IAC5D;AAAA,UAAA;AAAA,UAGN,cAAc;AAAA,YACZ,SAAS,CAAC,iCAAiC;AAAA,YAC3C,SAAS;AAAA,cACP;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,UACF;AAAA,QACF;AAAA,MAEJ;AAAA,IAAA;AAAA,IAEF;AAAA,MACE;AAAA,QACE,WAAW;AAAA,QACX;AAAA,QACA,cAAc,MAAM;AAClB,cAAI,KAAK,SAAS,mCAAmC;AACnD,mBAAO;AAAA,UACT;AACA,cAAI,cAAc,KAAK,OAAO,KAAK,WAAW,KAAK,kBAAkB;AACnE,mBAAO;AAAA,UACT;AACA,iBAAO;AAAA,QACT;AAAA,MAAA;AAAA,MAEF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -0,0 +1,15 @@
1
+ import { StrictMode, startTransition } from 'react'
2
+ import { hydrateRoot } from 'react-dom/client'
3
+ import { StartClient } from '@tanstack/react-start'
4
+ import { createRouter } from '#tanstack-start-router-entry'
5
+
6
+ const router = createRouter()
7
+
8
+ startTransition(() => {
9
+ hydrateRoot(
10
+ document,
11
+ <StrictMode>
12
+ <StartClient router={router} />
13
+ </StrictMode>,
14
+ )
15
+ })
@@ -0,0 +1,14 @@
1
+ import {
2
+ createStartHandler,
3
+ defaultStreamHandler,
4
+ } from '@tanstack/react-start/server'
5
+
6
+ import { createRouter } from '#tanstack-start-router-entry'
7
+
8
+ const fetch = createStartHandler({
9
+ createRouter,
10
+ })(defaultStreamHandler)
11
+
12
+ export default {
13
+ fetch,
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-start",
3
- "version": "1.131.6",
3
+ "version": "1.132.0-alpha.0",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -30,60 +30,36 @@
30
30
  "import": {
31
31
  "types": "./dist/esm/client.d.ts",
32
32
  "default": "./dist/esm/client.js"
33
- },
34
- "require": {
35
- "types": "./dist/cjs/client.d.cts",
36
- "default": "./dist/cjs/client.cjs"
37
33
  }
38
34
  },
39
35
  "./client": {
40
36
  "import": {
41
37
  "types": "./dist/esm/client.d.ts",
42
38
  "default": "./dist/esm/client.js"
43
- },
44
- "require": {
45
- "types": "./dist/cjs/client.d.cts",
46
- "default": "./dist/cjs/client.cjs"
47
39
  }
48
40
  },
49
41
  "./server": {
50
42
  "import": {
51
43
  "types": "./dist/esm/server.d.ts",
52
44
  "default": "./dist/esm/server.js"
53
- },
54
- "require": {
55
- "types": "./dist/cjs/server.d.cts",
56
- "default": "./dist/cjs/server.cjs"
57
45
  }
58
46
  },
59
47
  "./plugin/vite": {
60
48
  "import": {
61
- "types": "./dist/esm/plugin-vite.d.ts",
62
- "default": "./dist/esm/plugin-vite.js"
63
- },
64
- "require": {
65
- "types": "./dist/cjs/plugin-vite.d.cts",
66
- "default": "./dist/cjs/plugin-vite.cjs"
49
+ "types": "./dist/esm/plugin/vite.d.ts",
50
+ "default": "./dist/esm/plugin/vite.js"
67
51
  }
68
52
  },
69
53
  "./server-functions-client": {
70
54
  "import": {
71
55
  "types": "./dist/esm/server-functions-client.d.ts",
72
56
  "default": "./dist/esm/server-functions-client.js"
73
- },
74
- "require": {
75
- "types": "./dist/cjs/server-functions-client.d.cts",
76
- "default": "./dist/cjs/server-functions-client.cjs"
77
57
  }
78
58
  },
79
59
  "./server-functions-server": {
80
60
  "import": {
81
61
  "types": "./dist/esm/server-functions-server.d.ts",
82
62
  "default": "./dist/esm/server-functions-server.js"
83
- },
84
- "require": {
85
- "types": "./dist/cjs/server-functions-server.d.cts",
86
- "default": "./dist/cjs/server-functions-server.cjs"
87
63
  }
88
64
  },
89
65
  "./package.json": "./package.json"
@@ -97,20 +73,18 @@
97
73
  "node": ">=12"
98
74
  },
99
75
  "dependencies": {
100
- "@tanstack/react-start-client": "1.131.6",
101
- "@tanstack/react-start-server": "1.131.6",
102
- "@tanstack/start-server-functions-client": "1.131.6",
103
- "@tanstack/start-server-functions-server": "1.131.2",
104
- "@tanstack/react-start-plugin": "1.131.6"
76
+ "pathe": "^2.0.3",
77
+ "@tanstack/react-start-server": "1.132.0-alpha.0",
78
+ "@tanstack/start-server-functions-client": "1.132.0-alpha.0",
79
+ "@tanstack/start-server-functions-server": "1.132.0-alpha.0",
80
+ "@tanstack/router-utils": "^1.132.0-alpha.0",
81
+ "@tanstack/react-start-client": "1.132.0-alpha.0",
82
+ "@tanstack/start-plugin-core": "1.132.0-alpha.0"
105
83
  },
106
84
  "peerDependencies": {
107
- "@vitejs/plugin-react": ">=4.3.4",
108
85
  "react": ">=18.0.0 || >=19.0.0",
109
86
  "react-dom": ">=18.0.0 || >=19.0.0",
110
- "vite": ">=6.0.0"
111
- },
112
- "devDependencies": {
113
- "esbuild": "^0.25.0"
87
+ "vite": ">=7.0.0"
114
88
  },
115
89
  "scripts": {}
116
90
  }
@@ -0,0 +1,15 @@
1
+ import { StrictMode, startTransition } from 'react'
2
+ import { hydrateRoot } from 'react-dom/client'
3
+ import { StartClient } from '@tanstack/react-start'
4
+ import { createRouter } from '#tanstack-start-router-entry'
5
+
6
+ const router = createRouter()
7
+
8
+ startTransition(() => {
9
+ hydrateRoot(
10
+ document,
11
+ <StrictMode>
12
+ <StartClient router={router} />
13
+ </StrictMode>,
14
+ )
15
+ })
@@ -0,0 +1,4 @@
1
+ declare module '#tanstack-start-router-entry' {
2
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
3
+ export const createRouter: () => import('@tanstack/router-core').AnyRouter
4
+ }
@@ -0,0 +1,14 @@
1
+ import {
2
+ createStartHandler,
3
+ defaultStreamHandler,
4
+ } from '@tanstack/react-start/server'
5
+
6
+ import { createRouter } from '#tanstack-start-router-entry'
7
+
8
+ const fetch = createStartHandler({
9
+ createRouter,
10
+ })(defaultStreamHandler)
11
+
12
+ export default {
13
+ fetch,
14
+ }
@@ -0,0 +1,87 @@
1
+ import { fileURLToPath } from 'node:url'
2
+ import { TanStackStartVitePluginCore } from '@tanstack/start-plugin-core'
3
+ import path from 'pathe'
4
+ import type { TanStackStartInputConfig } from '@tanstack/start-plugin-core'
5
+ import type { PluginOption } from 'vite'
6
+
7
+ const currentDir = path.dirname(fileURLToPath(import.meta.url))
8
+ const defaultEntryDir = path.resolve(
9
+ currentDir,
10
+ '..',
11
+ '..',
12
+ 'plugin',
13
+ 'default-entry',
14
+ )
15
+ const defaultEntryPaths = {
16
+ client: path.resolve(defaultEntryDir, 'client'),
17
+ server: path.resolve(defaultEntryDir, 'server'),
18
+ }
19
+
20
+ const isInsideRouterMonoRepo =
21
+ path.basename(path.resolve(currentDir, '../../../../')) === 'packages'
22
+
23
+ function hasRootExport(
24
+ exportsField?: Record<string, unknown> | string,
25
+ ): boolean {
26
+ if (!exportsField) return false
27
+
28
+ if (typeof exportsField === 'string') {
29
+ // shorthand form: "exports": "./index.js"
30
+ return true
31
+ }
32
+
33
+ if (typeof exportsField === 'object') {
34
+ return '.' in exportsField
35
+ }
36
+
37
+ return false
38
+ }
39
+
40
+ export function tanstackStart(
41
+ options?: TanStackStartInputConfig,
42
+ ): Array<PluginOption> {
43
+ return [
44
+ {
45
+ name: 'tanstack-react-start:config',
46
+ configEnvironment() {
47
+ return {
48
+ resolve: {
49
+ dedupe: ['react', 'react-dom', '@tanstack/react-router'],
50
+
51
+ external: isInsideRouterMonoRepo
52
+ ? ['@tanstack/react-router', '@tanstack/react-router-devtools']
53
+ : undefined,
54
+ },
55
+
56
+ optimizeDeps: {
57
+ exclude: ['@tanstack/react-router-devtools'],
58
+ include: [
59
+ 'react',
60
+ 'react/jsx-runtime',
61
+ 'react/jsx-dev-runtime',
62
+ 'react-dom',
63
+ 'react-dom/client',
64
+ '@tanstack/react-router',
65
+ ],
66
+ },
67
+ }
68
+ },
69
+ },
70
+ TanStackStartVitePluginCore(
71
+ {
72
+ framework: 'react',
73
+ defaultEntryPaths,
74
+ crawlPackages(opts) {
75
+ if (opts.name === '@tanstack/react-router-devtools') {
76
+ return 'exclude'
77
+ }
78
+ if (hasRootExport(opts.exports) && 'react' in opts.peerDependencies) {
79
+ return 'include'
80
+ }
81
+ return undefined
82
+ },
83
+ },
84
+ options,
85
+ ),
86
+ ]
87
+ }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactStartClient = require("@tanstack/react-start-client");
4
- Object.keys(reactStartClient).forEach((k) => {
5
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
- enumerable: true,
7
- get: () => reactStartClient[k]
8
- });
9
- });
10
- //# sourceMappingURL=client.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1 +0,0 @@
1
- export * from '@tanstack/react-start-client';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactStartPlugin = require("@tanstack/react-start-plugin");
4
- Object.keys(reactStartPlugin).forEach((k) => {
5
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
- enumerable: true,
7
- get: () => reactStartPlugin[k]
8
- });
9
- });
10
- //# sourceMappingURL=plugin-vite.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-vite.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1 +0,0 @@
1
- export * from '@tanstack/react-start-plugin';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const startServerFunctionsClient = require("@tanstack/start-server-functions-client");
4
- Object.keys(startServerFunctionsClient).forEach((k) => {
5
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
- enumerable: true,
7
- get: () => startServerFunctionsClient[k]
8
- });
9
- });
10
- //# sourceMappingURL=server-functions-client.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-functions-client.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1 +0,0 @@
1
- export * from '@tanstack/start-server-functions-client';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const startServerFunctionsServer = require("@tanstack/start-server-functions-server");
4
- Object.keys(startServerFunctionsServer).forEach((k) => {
5
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
- enumerable: true,
7
- get: () => startServerFunctionsServer[k]
8
- });
9
- });
10
- //# sourceMappingURL=server-functions-server.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-functions-server.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1 +0,0 @@
1
- export * from '@tanstack/start-server-functions-server';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactStartServer = require("@tanstack/react-start-server");
4
- Object.keys(reactStartServer).forEach((k) => {
5
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
- enumerable: true,
7
- get: () => reactStartServer[k]
8
- });
9
- });
10
- //# sourceMappingURL=server.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1 +0,0 @@
1
- export * from '@tanstack/react-start-server';
@@ -1 +0,0 @@
1
- export * from '@tanstack/react-start-plugin';
@@ -1,2 +0,0 @@
1
- export * from "@tanstack/react-start-plugin";
2
- //# sourceMappingURL=plugin-vite.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-vite.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1 +0,0 @@
1
- export * from '@tanstack/react-start-plugin'