@tanstack/react-start 1.132.0-alpha.2 → 1.132.0-alpha.20
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.
- package/dist/default-entry/esm/server.d.ts +5 -0
- package/dist/default-entry/esm/server.js +12 -0
- package/dist/default-entry/esm/server.js.map +1 -0
- package/dist/esm/plugin/vite.js +22 -29
- package/dist/esm/plugin/vite.js.map +1 -1
- package/dist/plugin/default-entry/server.ts +3 -1
- package/package.json +9 -17
- package/src/default-entry/server.ts +16 -0
- package/src/plugin/vite.ts +33 -27
- package/dist/esm/server-functions-client.d.ts +0 -1
- package/dist/esm/server-functions-client.js +0 -2
- package/dist/esm/server-functions-client.js.map +0 -1
- package/dist/esm/server-functions-server.d.ts +0 -1
- package/dist/esm/server-functions-server.js +0 -2
- package/dist/esm/server-functions-server.js.map +0 -1
- package/src/plugin/default-entry/server.ts +0 -14
- package/src/server-functions-client.tsx +0 -1
- package/src/server-functions-server.tsx +0 -1
- /package/src/{plugin/default-entry → default-entry}/client.tsx +0 -0
- /package/src/{plugin/default-entry → default-entry}/router-entry.d.ts +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createStartHandler, defaultStreamHandler } from "@tanstack/react-start/server";
|
|
2
|
+
import { createRouter } from "#tanstack-start-router-entry";
|
|
3
|
+
const fetch = createStartHandler({
|
|
4
|
+
createRouter
|
|
5
|
+
})(defaultStreamHandler);
|
|
6
|
+
const server = {
|
|
7
|
+
fetch
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
server as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../src/default-entry/server.ts"],"sourcesContent":["import {\n createStartHandler,\n defaultStreamHandler,\n} from '@tanstack/react-start/server'\nimport type { RequestHandler } from '@tanstack/react-start/server'\n\nimport { createRouter } from '#tanstack-start-router-entry'\n\n// Providing `RequestHandler` from `@tanstack/react-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`\nconst fetch: RequestHandler = createStartHandler({\n createRouter,\n})(defaultStreamHandler)\n\nexport default {\n fetch,\n}\n"],"names":[],"mappings":";;AASA,MAAM,QAAwB,mBAAmB;AAAA,EAC/C;AACF,CAAC,EAAE,oBAAoB;AAEvB,MAAA,SAAe;AAAA,EACb;AACF;"}
|
package/dist/esm/plugin/vite.js
CHANGED
|
@@ -14,54 +14,47 @@ const defaultEntryPaths = {
|
|
|
14
14
|
server: path.resolve(defaultEntryDir, "server")
|
|
15
15
|
};
|
|
16
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
17
|
function tanstackStart(options) {
|
|
28
18
|
return [
|
|
29
19
|
{
|
|
30
20
|
name: "tanstack-react-start:config",
|
|
31
|
-
configEnvironment(
|
|
21
|
+
configEnvironment(environmentName, options2) {
|
|
32
22
|
return {
|
|
33
23
|
resolve: {
|
|
34
|
-
dedupe: [
|
|
35
|
-
|
|
24
|
+
dedupe: [
|
|
25
|
+
"react",
|
|
26
|
+
"react-dom",
|
|
27
|
+
"@tanstack/react-start",
|
|
28
|
+
"@tanstack/react-router"
|
|
29
|
+
],
|
|
30
|
+
external: options2.resolve?.noExternal === true || !isInsideRouterMonoRepo ? void 0 : ["@tanstack/react-router", "@tanstack/react-router-devtools"]
|
|
36
31
|
},
|
|
37
|
-
optimizeDeps:
|
|
38
|
-
|
|
32
|
+
optimizeDeps: environmentName === VITE_ENVIRONMENT_NAMES.client || environmentName === VITE_ENVIRONMENT_NAMES.server && // This indicates that the server environment has opted in to dependency optimization
|
|
33
|
+
options2.optimizeDeps?.noDiscovery === false ? {
|
|
34
|
+
// As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.
|
|
35
|
+
exclude: [
|
|
36
|
+
"@tanstack/react-start",
|
|
37
|
+
"@tanstack/react-router",
|
|
38
|
+
"@tanstack/react-router-devtools"
|
|
39
|
+
],
|
|
39
40
|
include: [
|
|
40
41
|
"react",
|
|
41
42
|
"react/jsx-runtime",
|
|
42
43
|
"react/jsx-dev-runtime",
|
|
43
44
|
"react-dom",
|
|
44
|
-
"react-dom/client",
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
...environmentName === VITE_ENVIRONMENT_NAMES.client ? ["react-dom/client"] : ["react-dom/server"],
|
|
46
|
+
// `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.
|
|
47
|
+
// It therefore needs to included so that it is converted to ESM.
|
|
48
|
+
"@tanstack/react-router > @tanstack/react-store"
|
|
47
49
|
]
|
|
48
|
-
}
|
|
50
|
+
} : void 0
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
},
|
|
52
54
|
TanStackStartVitePluginCore(
|
|
53
55
|
{
|
|
54
56
|
framework: "react",
|
|
55
|
-
defaultEntryPaths
|
|
56
|
-
crawlPackages(opts) {
|
|
57
|
-
if (opts.name === "@tanstack/react-router-devtools") {
|
|
58
|
-
return "exclude";
|
|
59
|
-
}
|
|
60
|
-
if (hasRootExport(opts.exports) && "react" in opts.peerDependencies) {
|
|
61
|
-
return "include";
|
|
62
|
-
}
|
|
63
|
-
return void 0;
|
|
64
|
-
}
|
|
57
|
+
defaultEntryPaths
|
|
65
58
|
},
|
|
66
59
|
options
|
|
67
60
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sources":["../../../src/plugin/vite.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url'\nimport {\n TanStackStartVitePluginCore,\n VITE_ENVIRONMENT_NAMES,\n} 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(
|
|
1
|
+
{"version":3,"file":"vite.js","sources":["../../../src/plugin/vite.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url'\nimport {\n TanStackStartVitePluginCore,\n VITE_ENVIRONMENT_NAMES,\n} 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(environmentName, options) {\n return {\n resolve: {\n dedupe: [\n 'react',\n 'react-dom',\n '@tanstack/react-start',\n '@tanstack/react-router',\n ],\n external:\n options.resolve?.noExternal === true || !isInsideRouterMonoRepo\n ? undefined\n : ['@tanstack/react-router', '@tanstack/react-router-devtools'],\n },\n optimizeDeps:\n environmentName === VITE_ENVIRONMENT_NAMES.client ||\n (environmentName === VITE_ENVIRONMENT_NAMES.server &&\n // This indicates that the server environment has opted in to dependency optimization\n options.optimizeDeps?.noDiscovery === false)\n ? {\n // As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.\n exclude: [\n '@tanstack/react-start',\n '@tanstack/react-router',\n '@tanstack/react-router-devtools',\n ],\n include: [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n ...(environmentName === VITE_ENVIRONMENT_NAMES.client\n ? ['react-dom/client']\n : ['react-dom/server']),\n // `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.\n // It therefore needs to included so that it is converted to ESM.\n '@tanstack/react-router > @tanstack/react-store',\n ],\n }\n : undefined,\n }\n },\n },\n TanStackStartVitePluginCore(\n {\n framework: 'react',\n defaultEntryPaths,\n },\n options,\n ),\n ]\n}\n"],"names":["options"],"mappings":";;;AASA,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;AAmBvD,SAAS,cACd,SACqB;AACrB,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,kBAAkB,iBAAiBA,UAAS;AAC1C,eAAO;AAAA,UACL,SAAS;AAAA,YACP,QAAQ;AAAA,cACN;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,YAEF,UACEA,SAAQ,SAAS,eAAe,QAAQ,CAAC,yBACrC,SACA,CAAC,0BAA0B,iCAAiC;AAAA,UAAA;AAAA,UAEpE,cACE,oBAAoB,uBAAuB,UAC1C,oBAAoB,uBAAuB;AAAA,UAE1CA,SAAQ,cAAc,gBAAgB,QACpC;AAAA;AAAA,YAEE,SAAS;AAAA,cACP;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,YAEF,SAAS;AAAA,cACP;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,GAAI,oBAAoB,uBAAuB,SAC3C,CAAC,kBAAkB,IACnB,CAAC,kBAAkB;AAAA;AAAA;AAAA,cAGvB;AAAA,YAAA;AAAA,UACF,IAEF;AAAA,QAAA;AAAA,MAEV;AAAA,IAAA;AAAA,IAEF;AAAA,MACE;AAAA,QACE,WAAW;AAAA,QACX;AAAA,MAAA;AAAA,MAEF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -2,10 +2,12 @@ import {
|
|
|
2
2
|
createStartHandler,
|
|
3
3
|
defaultStreamHandler,
|
|
4
4
|
} from '@tanstack/react-start/server'
|
|
5
|
+
import type { RequestHandler } from '@tanstack/react-start/server'
|
|
5
6
|
|
|
6
7
|
import { createRouter } from '#tanstack-start-router-entry'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
// Providing `RequestHandler` from `@tanstack/react-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`
|
|
10
|
+
const fetch: RequestHandler = createStartHandler({
|
|
9
11
|
createRouter,
|
|
10
12
|
})(defaultStreamHandler)
|
|
11
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-start",
|
|
3
|
-
"version": "1.132.0-alpha.
|
|
3
|
+
"version": "1.132.0-alpha.20",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,16 +50,10 @@
|
|
|
50
50
|
"default": "./dist/esm/plugin/vite.js"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"./server-
|
|
53
|
+
"./server-entry": {
|
|
54
54
|
"import": {
|
|
55
|
-
"types": "./dist/esm/server
|
|
56
|
-
"default": "./dist/esm/server
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"./server-functions-server": {
|
|
60
|
-
"import": {
|
|
61
|
-
"types": "./dist/esm/server-functions-server.d.ts",
|
|
62
|
-
"default": "./dist/esm/server-functions-server.js"
|
|
55
|
+
"types": "./dist/default-entry/esm/server.d.ts",
|
|
56
|
+
"default": "./dist/default-entry/esm/server.js"
|
|
63
57
|
}
|
|
64
58
|
},
|
|
65
59
|
"./package.json": "./package.json"
|
|
@@ -70,16 +64,14 @@
|
|
|
70
64
|
"src"
|
|
71
65
|
],
|
|
72
66
|
"engines": {
|
|
73
|
-
"node": ">=12"
|
|
67
|
+
"node": ">=22.12.0"
|
|
74
68
|
},
|
|
75
69
|
"dependencies": {
|
|
76
70
|
"pathe": "^2.0.3",
|
|
77
|
-
"@tanstack/react-start-client": "1.132.0-alpha.
|
|
78
|
-
"@tanstack/
|
|
79
|
-
"@tanstack/
|
|
80
|
-
"@tanstack/start-server
|
|
81
|
-
"@tanstack/router-utils": "^1.132.0-alpha.1",
|
|
82
|
-
"@tanstack/start-plugin-core": "1.132.0-alpha.2"
|
|
71
|
+
"@tanstack/react-start-client": "1.132.0-alpha.20",
|
|
72
|
+
"@tanstack/start-plugin-core": "1.132.0-alpha.20",
|
|
73
|
+
"@tanstack/router-utils": "^1.132.0-alpha.9",
|
|
74
|
+
"@tanstack/react-start-server": "1.132.0-alpha.20"
|
|
83
75
|
},
|
|
84
76
|
"peerDependencies": {
|
|
85
77
|
"react": ">=18.0.0 || >=19.0.0",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createStartHandler,
|
|
3
|
+
defaultStreamHandler,
|
|
4
|
+
} from '@tanstack/react-start/server'
|
|
5
|
+
import type { RequestHandler } from '@tanstack/react-start/server'
|
|
6
|
+
|
|
7
|
+
import { createRouter } from '#tanstack-start-router-entry'
|
|
8
|
+
|
|
9
|
+
// Providing `RequestHandler` from `@tanstack/react-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`
|
|
10
|
+
const fetch: RequestHandler = createStartHandler({
|
|
11
|
+
createRouter,
|
|
12
|
+
})(defaultStreamHandler)
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
fetch,
|
|
16
|
+
}
|
package/src/plugin/vite.ts
CHANGED
|
@@ -46,31 +46,46 @@ export function tanstackStart(
|
|
|
46
46
|
return [
|
|
47
47
|
{
|
|
48
48
|
name: 'tanstack-react-start:config',
|
|
49
|
-
configEnvironment(
|
|
49
|
+
configEnvironment(environmentName, options) {
|
|
50
50
|
return {
|
|
51
51
|
resolve: {
|
|
52
|
-
dedupe: [
|
|
53
|
-
|
|
54
|
-
external:
|
|
55
|
-
userConfig.resolve?.noExternal === true || !isInsideRouterMonoRepo
|
|
56
|
-
? undefined
|
|
57
|
-
: ['@tanstack/react-router', '@tanstack/react-router-devtools'],
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
optimizeDeps: {
|
|
61
|
-
exclude: ['@tanstack/react-router-devtools'],
|
|
62
|
-
include: [
|
|
52
|
+
dedupe: [
|
|
63
53
|
'react',
|
|
64
|
-
'react/jsx-runtime',
|
|
65
|
-
'react/jsx-dev-runtime',
|
|
66
54
|
'react-dom',
|
|
67
|
-
'react-
|
|
55
|
+
'@tanstack/react-start',
|
|
68
56
|
'@tanstack/react-router',
|
|
69
|
-
...(env === VITE_ENVIRONMENT_NAMES.server
|
|
70
|
-
? ['react-dom/server']
|
|
71
|
-
: []),
|
|
72
57
|
],
|
|
58
|
+
external:
|
|
59
|
+
options.resolve?.noExternal === true || !isInsideRouterMonoRepo
|
|
60
|
+
? undefined
|
|
61
|
+
: ['@tanstack/react-router', '@tanstack/react-router-devtools'],
|
|
73
62
|
},
|
|
63
|
+
optimizeDeps:
|
|
64
|
+
environmentName === VITE_ENVIRONMENT_NAMES.client ||
|
|
65
|
+
(environmentName === VITE_ENVIRONMENT_NAMES.server &&
|
|
66
|
+
// This indicates that the server environment has opted in to dependency optimization
|
|
67
|
+
options.optimizeDeps?.noDiscovery === false)
|
|
68
|
+
? {
|
|
69
|
+
// As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.
|
|
70
|
+
exclude: [
|
|
71
|
+
'@tanstack/react-start',
|
|
72
|
+
'@tanstack/react-router',
|
|
73
|
+
'@tanstack/react-router-devtools',
|
|
74
|
+
],
|
|
75
|
+
include: [
|
|
76
|
+
'react',
|
|
77
|
+
'react/jsx-runtime',
|
|
78
|
+
'react/jsx-dev-runtime',
|
|
79
|
+
'react-dom',
|
|
80
|
+
...(environmentName === VITE_ENVIRONMENT_NAMES.client
|
|
81
|
+
? ['react-dom/client']
|
|
82
|
+
: ['react-dom/server']),
|
|
83
|
+
// `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.
|
|
84
|
+
// It therefore needs to included so that it is converted to ESM.
|
|
85
|
+
'@tanstack/react-router > @tanstack/react-store',
|
|
86
|
+
],
|
|
87
|
+
}
|
|
88
|
+
: undefined,
|
|
74
89
|
}
|
|
75
90
|
},
|
|
76
91
|
},
|
|
@@ -78,15 +93,6 @@ export function tanstackStart(
|
|
|
78
93
|
{
|
|
79
94
|
framework: 'react',
|
|
80
95
|
defaultEntryPaths,
|
|
81
|
-
crawlPackages(opts) {
|
|
82
|
-
if (opts.name === '@tanstack/react-router-devtools') {
|
|
83
|
-
return 'exclude'
|
|
84
|
-
}
|
|
85
|
-
if (hasRootExport(opts.exports) && 'react' in opts.peerDependencies) {
|
|
86
|
-
return 'include'
|
|
87
|
-
}
|
|
88
|
-
return undefined
|
|
89
|
-
},
|
|
90
96
|
},
|
|
91
97
|
options,
|
|
92
98
|
),
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@tanstack/start-server-functions-client';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-functions-client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@tanstack/start-server-functions-server';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-functions-server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@tanstack/start-server-functions-client'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@tanstack/start-server-functions-server'
|
|
File without changes
|
|
File without changes
|