@tanstack/start-plugin-core 1.167.18 → 1.167.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.
Files changed (184) hide show
  1. package/dist/esm/config-context.d.ts +26 -0
  2. package/dist/esm/config-context.js +81 -0
  3. package/dist/esm/config-context.js.map +1 -0
  4. package/dist/esm/constants.d.ts +6 -1
  5. package/dist/esm/constants.js +3 -2
  6. package/dist/esm/constants.js.map +1 -1
  7. package/dist/esm/import-protection-plugin/extensionlessAbsoluteIdResolver.js +1 -1
  8. package/dist/esm/import-protection-plugin/plugin.js +1 -1
  9. package/dist/esm/import-protection-plugin/virtualModules.js +1 -1
  10. package/dist/esm/index.d.ts +5 -3
  11. package/dist/esm/index.js +3 -4
  12. package/dist/esm/planning.d.ts +40 -0
  13. package/dist/esm/planning.js +107 -0
  14. package/dist/esm/planning.js.map +1 -0
  15. package/dist/esm/schema.d.ts +3093 -44
  16. package/dist/esm/schema.js +5 -5
  17. package/dist/esm/schema.js.map +1 -1
  18. package/dist/esm/serialization-adapters-module.d.ts +17 -0
  19. package/dist/esm/serialization-adapters-module.js +39 -0
  20. package/dist/esm/serialization-adapters-module.js.map +1 -0
  21. package/dist/esm/{start-compiler-plugin → start-compiler}/compiler.d.ts +2 -3
  22. package/dist/esm/{start-compiler-plugin → start-compiler}/compiler.js +17 -16
  23. package/dist/esm/start-compiler/compiler.js.map +1 -0
  24. package/dist/esm/start-compiler/config.d.ts +4 -0
  25. package/dist/esm/start-compiler/config.js +54 -0
  26. package/dist/esm/start-compiler/config.js.map +1 -0
  27. package/dist/esm/{start-compiler-plugin → start-compiler}/handleClientOnlyJSX.js +1 -1
  28. package/dist/esm/start-compiler/handleClientOnlyJSX.js.map +1 -0
  29. package/dist/esm/{start-compiler-plugin → start-compiler}/handleCreateIsomorphicFn.js +1 -1
  30. package/dist/esm/start-compiler/handleCreateIsomorphicFn.js.map +1 -0
  31. package/dist/esm/{start-compiler-plugin → start-compiler}/handleCreateMiddleware.js +1 -1
  32. package/dist/esm/start-compiler/handleCreateMiddleware.js.map +1 -0
  33. package/dist/esm/{start-compiler-plugin → start-compiler}/handleCreateServerFn.js +6 -17
  34. package/dist/esm/start-compiler/handleCreateServerFn.js.map +1 -0
  35. package/dist/esm/{start-compiler-plugin → start-compiler}/handleEnvOnly.js +1 -1
  36. package/dist/esm/start-compiler/handleEnvOnly.js.map +1 -0
  37. package/dist/esm/start-compiler/host.d.ts +20 -0
  38. package/dist/esm/start-compiler/host.js +38 -0
  39. package/dist/esm/start-compiler/host.js.map +1 -0
  40. package/dist/esm/start-compiler/load-module.d.ts +14 -0
  41. package/dist/esm/start-compiler/load-module.js +18 -0
  42. package/dist/esm/start-compiler/load-module.js.map +1 -0
  43. package/dist/esm/start-compiler/server-fn-resolver-module.d.ts +8 -0
  44. package/dist/esm/start-compiler/server-fn-resolver-module.js +77 -0
  45. package/dist/esm/start-compiler/server-fn-resolver-module.js.map +1 -0
  46. package/dist/esm/{start-compiler-plugin → start-compiler}/types.d.ts +4 -0
  47. package/dist/esm/{start-compiler-plugin → start-compiler}/utils.js +1 -1
  48. package/dist/esm/start-compiler/utils.js.map +1 -0
  49. package/dist/esm/start-manifest-plugin/manifestBuilder.d.ts +16 -16
  50. package/dist/esm/start-manifest-plugin/manifestBuilder.js +14 -45
  51. package/dist/esm/start-manifest-plugin/manifestBuilder.js.map +1 -1
  52. package/dist/esm/start-router-plugin/route-tree-footer.d.ts +6 -0
  53. package/dist/esm/start-router-plugin/route-tree-footer.js +44 -0
  54. package/dist/esm/start-router-plugin/route-tree-footer.js.map +1 -0
  55. package/dist/esm/types.d.ts +44 -10
  56. package/dist/esm/{dev-server-plugin → vite/dev-server-plugin}/dev-styles.js +1 -1
  57. package/dist/esm/vite/dev-server-plugin/dev-styles.js.map +1 -0
  58. package/dist/esm/{dev-server-plugin → vite/dev-server-plugin}/extract-html-scripts.js +1 -1
  59. package/dist/esm/vite/dev-server-plugin/extract-html-scripts.js.map +1 -0
  60. package/dist/esm/vite/dev-server-plugin/plugin.d.ts +7 -0
  61. package/dist/esm/{dev-server-plugin → vite/dev-server-plugin}/plugin.js +5 -6
  62. package/dist/esm/vite/dev-server-plugin/plugin.js.map +1 -0
  63. package/dist/esm/{load-env-plugin → vite/load-env-plugin}/plugin.js +1 -1
  64. package/dist/esm/vite/load-env-plugin/plugin.js.map +1 -0
  65. package/dist/esm/{output-directory.js → vite/output-directory.js} +2 -2
  66. package/dist/esm/vite/output-directory.js.map +1 -0
  67. package/dist/esm/vite/planning.d.ts +105 -0
  68. package/dist/esm/vite/planning.js +116 -0
  69. package/dist/esm/vite/planning.js.map +1 -0
  70. package/dist/esm/vite/plugin.d.ts +4 -0
  71. package/dist/esm/vite/plugin.js +169 -0
  72. package/dist/esm/vite/plugin.js.map +1 -0
  73. package/dist/esm/vite/plugins.d.ts +17 -0
  74. package/dist/esm/vite/plugins.js +50 -0
  75. package/dist/esm/vite/plugins.js.map +1 -0
  76. package/dist/esm/{post-server-build.d.ts → vite/post-server-build.d.ts} +1 -1
  77. package/dist/esm/{post-server-build.js → vite/post-server-build.js} +4 -4
  78. package/dist/esm/vite/post-server-build.js.map +1 -0
  79. package/dist/esm/{prerender.d.ts → vite/prerender.d.ts} +1 -1
  80. package/dist/esm/{prerender.js → vite/prerender.js} +5 -10
  81. package/dist/esm/vite/prerender.js.map +1 -0
  82. package/dist/esm/{preview-server-plugin → vite/preview-server-plugin}/plugin.js +4 -4
  83. package/dist/esm/vite/preview-server-plugin/plugin.js.map +1 -0
  84. package/dist/esm/vite/schema.d.ts +3373 -0
  85. package/dist/esm/vite/schema.js +12 -0
  86. package/dist/esm/vite/schema.js.map +1 -0
  87. package/dist/esm/vite/serialization-adapters-plugin.d.ts +5 -0
  88. package/dist/esm/vite/serialization-adapters-plugin.js +42 -0
  89. package/dist/esm/vite/serialization-adapters-plugin.js.map +1 -0
  90. package/dist/esm/vite/start-compiler-plugin/module-specifier.d.ts +3 -0
  91. package/dist/esm/vite/start-compiler-plugin/module-specifier.js +19 -0
  92. package/dist/esm/vite/start-compiler-plugin/module-specifier.js.map +1 -0
  93. package/dist/esm/{start-compiler-plugin → vite/start-compiler-plugin}/plugin.d.ts +4 -3
  94. package/dist/esm/vite/start-compiler-plugin/plugin.js +202 -0
  95. package/dist/esm/vite/start-compiler-plugin/plugin.js.map +1 -0
  96. package/dist/esm/vite/start-manifest-plugin/normalized-client-build.d.ts +6 -0
  97. package/dist/esm/vite/start-manifest-plugin/normalized-client-build.js +81 -0
  98. package/dist/esm/vite/start-manifest-plugin/normalized-client-build.js.map +1 -0
  99. package/dist/esm/vite/start-manifest-plugin/plugin.d.ts +6 -0
  100. package/dist/esm/{start-manifest-plugin → vite/start-manifest-plugin}/plugin.js +14 -9
  101. package/dist/esm/vite/start-manifest-plugin/plugin.js.map +1 -0
  102. package/dist/esm/{start-router-plugin → vite/start-router-plugin}/plugin.d.ts +3 -2
  103. package/dist/esm/{start-router-plugin → vite/start-router-plugin}/plugin.js +14 -37
  104. package/dist/esm/vite/start-router-plugin/plugin.js.map +1 -0
  105. package/dist/esm/vite/types.d.ts +15 -0
  106. package/package.json +36 -25
  107. package/src/config-context.ts +138 -0
  108. package/src/constants.ts +7 -3
  109. package/src/index.ts +5 -5
  110. package/src/planning.ts +151 -0
  111. package/src/schema.ts +93 -93
  112. package/src/serialization-adapters-module.ts +82 -0
  113. package/src/{start-compiler-plugin → start-compiler}/compiler.ts +67 -61
  114. package/src/start-compiler/config.ts +73 -0
  115. package/src/{start-compiler-plugin → start-compiler}/handleCreateServerFn.ts +14 -41
  116. package/src/start-compiler/host.ts +80 -0
  117. package/src/start-compiler/load-module.ts +31 -0
  118. package/src/start-compiler/server-fn-resolver-module.ts +129 -0
  119. package/src/{start-compiler-plugin → start-compiler}/types.ts +5 -0
  120. package/src/start-manifest-plugin/manifestBuilder.ts +65 -107
  121. package/src/start-router-plugin/route-tree-footer.ts +99 -0
  122. package/src/types.ts +53 -10
  123. package/src/{dev-server-plugin → vite/dev-server-plugin}/plugin.ts +7 -6
  124. package/src/{output-directory.ts → vite/output-directory.ts} +2 -2
  125. package/src/vite/planning.ts +234 -0
  126. package/src/vite/plugin.ts +276 -0
  127. package/src/vite/plugins.ts +81 -0
  128. package/src/{post-server-build.ts → vite/post-server-build.ts} +4 -6
  129. package/src/{prerender.ts → vite/prerender.ts} +21 -46
  130. package/src/{preview-server-plugin → vite/preview-server-plugin}/plugin.ts +2 -2
  131. package/src/vite/schema.ts +30 -0
  132. package/src/vite/serialization-adapters-plugin.ts +69 -0
  133. package/src/vite/start-compiler-plugin/module-specifier.ts +31 -0
  134. package/src/vite/start-compiler-plugin/plugin.ts +345 -0
  135. package/src/vite/start-manifest-plugin/normalized-client-build.ts +131 -0
  136. package/src/{start-manifest-plugin → vite/start-manifest-plugin}/plugin.ts +21 -13
  137. package/src/{start-router-plugin → vite/start-router-plugin}/plugin.ts +14 -80
  138. package/src/vite/types.ts +18 -0
  139. package/LICENSE +0 -21
  140. package/dist/esm/dev-server-plugin/dev-styles.js.map +0 -1
  141. package/dist/esm/dev-server-plugin/extract-html-scripts.js.map +0 -1
  142. package/dist/esm/dev-server-plugin/plugin.d.ts +0 -6
  143. package/dist/esm/dev-server-plugin/plugin.js.map +0 -1
  144. package/dist/esm/load-env-plugin/plugin.js.map +0 -1
  145. package/dist/esm/output-directory.js.map +0 -1
  146. package/dist/esm/plugin.d.ts +0 -4
  147. package/dist/esm/plugin.js +0 -301
  148. package/dist/esm/plugin.js.map +0 -1
  149. package/dist/esm/post-server-build.js.map +0 -1
  150. package/dist/esm/prerender.js.map +0 -1
  151. package/dist/esm/preview-server-plugin/plugin.js.map +0 -1
  152. package/dist/esm/start-compiler-plugin/compiler.js.map +0 -1
  153. package/dist/esm/start-compiler-plugin/handleClientOnlyJSX.js.map +0 -1
  154. package/dist/esm/start-compiler-plugin/handleCreateIsomorphicFn.js.map +0 -1
  155. package/dist/esm/start-compiler-plugin/handleCreateMiddleware.js.map +0 -1
  156. package/dist/esm/start-compiler-plugin/handleCreateServerFn.js.map +0 -1
  157. package/dist/esm/start-compiler-plugin/handleEnvOnly.js.map +0 -1
  158. package/dist/esm/start-compiler-plugin/plugin.js +0 -297
  159. package/dist/esm/start-compiler-plugin/plugin.js.map +0 -1
  160. package/dist/esm/start-compiler-plugin/utils.js.map +0 -1
  161. package/dist/esm/start-manifest-plugin/plugin.d.ts +0 -6
  162. package/dist/esm/start-manifest-plugin/plugin.js.map +0 -1
  163. package/dist/esm/start-router-plugin/plugin.js.map +0 -1
  164. package/src/plugin.ts +0 -471
  165. package/src/start-compiler-plugin/plugin.ts +0 -478
  166. /package/dist/esm/{start-compiler-plugin → start-compiler}/handleClientOnlyJSX.d.ts +0 -0
  167. /package/dist/esm/{start-compiler-plugin → start-compiler}/handleCreateIsomorphicFn.d.ts +0 -0
  168. /package/dist/esm/{start-compiler-plugin → start-compiler}/handleCreateMiddleware.d.ts +0 -0
  169. /package/dist/esm/{start-compiler-plugin → start-compiler}/handleCreateServerFn.d.ts +0 -0
  170. /package/dist/esm/{start-compiler-plugin → start-compiler}/handleEnvOnly.d.ts +0 -0
  171. /package/dist/esm/{start-compiler-plugin → start-compiler}/utils.d.ts +0 -0
  172. /package/dist/esm/{dev-server-plugin → vite/dev-server-plugin}/dev-styles.d.ts +0 -0
  173. /package/dist/esm/{dev-server-plugin → vite/dev-server-plugin}/extract-html-scripts.d.ts +0 -0
  174. /package/dist/esm/{load-env-plugin → vite/load-env-plugin}/plugin.d.ts +0 -0
  175. /package/dist/esm/{output-directory.d.ts → vite/output-directory.d.ts} +0 -0
  176. /package/dist/esm/{preview-server-plugin → vite/preview-server-plugin}/plugin.d.ts +0 -0
  177. /package/src/{start-compiler-plugin → start-compiler}/handleClientOnlyJSX.ts +0 -0
  178. /package/src/{start-compiler-plugin → start-compiler}/handleCreateIsomorphicFn.ts +0 -0
  179. /package/src/{start-compiler-plugin → start-compiler}/handleCreateMiddleware.ts +0 -0
  180. /package/src/{start-compiler-plugin → start-compiler}/handleEnvOnly.ts +0 -0
  181. /package/src/{start-compiler-plugin → start-compiler}/utils.ts +0 -0
  182. /package/src/{dev-server-plugin → vite/dev-server-plugin}/dev-styles.ts +0 -0
  183. /package/src/{dev-server-plugin → vite/dev-server-plugin}/extract-html-scripts.ts +0 -0
  184. /package/src/{load-env-plugin → vite/load-env-plugin}/plugin.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","names":[],"sources":["../../../../src/vite/start-router-plugin/plugin.ts"],"sourcesContent":["import {\n tanStackRouterCodeSplitter,\n tanstackRouterAutoImport,\n tanstackRouterGenerator,\n} from '@tanstack/router-plugin/vite'\nimport path from 'pathe'\nimport { normalizePath } from 'vite'\nimport { VITE_ENVIRONMENT_NAMES } from '../../constants'\nimport { routesManifestPlugin } from '../../start-router-plugin/generator-plugins/routes-manifest-plugin'\nimport { prerenderRoutesPlugin } from '../../start-router-plugin/generator-plugins/prerender-routes-plugin'\nimport { buildRouteTreeFileFooterFromConfig } from '../../start-router-plugin/route-tree-footer'\nimport { pruneServerOnlySubtrees } from '../../start-router-plugin/pruneServerOnlySubtrees'\nimport { SERVER_PROP } from '../../start-router-plugin/constants'\nimport type { GetConfigFn } from '../../types'\nimport type { TanStackStartVitePluginCoreOptions } from '../types'\nimport type {\n Generator,\n GeneratorPlugin,\n RouteNode,\n} from '@tanstack/router-generator'\nimport type { DevEnvironment, Plugin, PluginOption } from 'vite'\nimport type { TanStackStartInputConfig } from '../../schema'\n\nfunction isServerOnlyNode(node: RouteNode | undefined) {\n if (!node?.createFileRouteProps) {\n return false\n }\n return (\n node.createFileRouteProps.has(SERVER_PROP) &&\n node.createFileRouteProps.size === 1\n )\n}\n\nexport function tanStackStartRouter(\n startPluginOpts: TanStackStartInputConfig,\n getConfig: GetConfigFn,\n corePluginOpts: TanStackStartVitePluginCoreOptions,\n): Array<PluginOption> {\n const getGeneratedRouteTreePath = () => {\n const { startConfig } = getConfig()\n return path.resolve(startConfig.router.generatedRouteTree)\n }\n\n let clientEnvironment: DevEnvironment | null = null\n function invalidate() {\n if (!clientEnvironment) {\n return\n }\n\n const mod = clientEnvironment.moduleGraph.getModuleById(\n getGeneratedRouteTreePath(),\n )\n if (mod) {\n clientEnvironment.moduleGraph.invalidateModule(mod)\n }\n clientEnvironment.hot.send({ type: 'full-reload', path: '*' })\n }\n\n let generatorInstance: Generator | null = null\n\n const clientTreeGeneratorPlugin: GeneratorPlugin = {\n name: 'start-client-tree-plugin',\n init({ generator }) {\n generatorInstance = generator\n },\n afterTransform({ node, prevNode }) {\n if (isServerOnlyNode(node) !== isServerOnlyNode(prevNode)) {\n invalidate()\n }\n },\n }\n\n let routeTreeFileFooter: Array<string> | null = null\n\n function getRouteTreeFileFooter() {\n if (routeTreeFileFooter) {\n return routeTreeFileFooter\n }\n routeTreeFileFooter = [\n ...buildRouteTreeFileFooterFromConfig({\n generatedRouteTreePath: getGeneratedRouteTreePath(),\n getConfig,\n corePluginOpts,\n }),\n ]\n return routeTreeFileFooter\n }\n\n let resolvedGeneratedRouteTreePath: string | null = null\n const clientTreePlugin: Plugin = {\n name: 'tanstack-start:route-tree-client-plugin',\n enforce: 'pre',\n applyToEnvironment: (env) => env.name === VITE_ENVIRONMENT_NAMES.client,\n configureServer(server) {\n clientEnvironment = server.environments[VITE_ENVIRONMENT_NAMES.client]\n },\n config() {\n type LoadObjectHook = Extract<\n typeof clientTreePlugin.load,\n { filter?: unknown }\n >\n resolvedGeneratedRouteTreePath = normalizePath(\n getGeneratedRouteTreePath(),\n )\n ;(clientTreePlugin.load as LoadObjectHook).filter = {\n id: { include: new RegExp(resolvedGeneratedRouteTreePath) },\n }\n },\n\n load: {\n filter: {\n // this will be set in the config hook above since it relies on `config` hook being called first\n },\n async handler() {\n if (!generatorInstance) {\n throw new Error('Generator instance not initialized')\n }\n const crawlingResult = await generatorInstance.getCrawlingResult()\n if (!crawlingResult) {\n throw new Error('Crawling result not available')\n }\n const prunedAcc = pruneServerOnlySubtrees(crawlingResult)\n const acc = {\n ...crawlingResult.acc,\n ...prunedAcc,\n }\n const buildResult = generatorInstance.buildRouteTree({\n ...crawlingResult,\n acc,\n config: {\n // importRoutesUsingAbsolutePaths: true,\n // addExtensions: true,\n disableTypes: true,\n enableRouteTreeFormatting: false,\n routeTreeFileHeader: [],\n routeTreeFileFooter: [],\n },\n })\n return { code: buildResult.routeTreeContent, map: null }\n },\n },\n }\n return [\n clientTreePlugin,\n tanstackRouterGenerator(() => {\n const routerConfig = getConfig().startConfig.router\n const plugins = [clientTreeGeneratorPlugin, routesManifestPlugin()]\n if (startPluginOpts.prerender?.enabled === true) {\n plugins.push(prerenderRoutesPlugin())\n }\n return {\n ...routerConfig,\n target: corePluginOpts.framework,\n routeTreeFileFooter: getRouteTreeFileFooter,\n plugins,\n }\n }),\n tanStackRouterCodeSplitter(() => {\n const routerConfig = getConfig().startConfig.router\n return {\n ...routerConfig,\n codeSplittingOptions: {\n ...routerConfig.codeSplittingOptions,\n deleteNodes: ['ssr', 'server', 'headers'],\n addHmr: true,\n },\n plugin: {\n vite: { environmentName: VITE_ENVIRONMENT_NAMES.client },\n },\n }\n }),\n tanStackRouterCodeSplitter(() => {\n const routerConfig = getConfig().startConfig.router\n return {\n ...routerConfig,\n codeSplittingOptions: {\n ...routerConfig.codeSplittingOptions,\n addHmr: false,\n },\n plugin: {\n vite: { environmentName: VITE_ENVIRONMENT_NAMES.server },\n },\n }\n }),\n tanstackRouterAutoImport(startPluginOpts.router),\n ]\n}\n"],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ import { TanStackStartCoreOptions } from '../types.js';
2
+ export interface ViteRscForwardSsrResolverStrategy {
3
+ type: 'vite-rsc-forward';
4
+ sourceEnvironmentName: string;
5
+ sourceEntry: string;
6
+ exportName: 'getServerFnById';
7
+ }
8
+ export type SsrResolverStrategy = {
9
+ type: 'default';
10
+ } | ViteRscForwardSsrResolverStrategy;
11
+ export type TanStackStartVitePluginCoreOptions = TanStackStartCoreOptions & {
12
+ providerEnvironmentName: string;
13
+ ssrIsProvider: boolean;
14
+ ssrResolverStrategy: SsrResolverStrategy;
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/start-plugin-core",
3
- "version": "1.167.18",
3
+ "version": "1.167.20",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -24,6 +24,22 @@
24
24
  "async router",
25
25
  "typescript"
26
26
  ],
27
+ "scripts": {
28
+ "clean": "rimraf ./dist && rimraf ./coverage",
29
+ "clean:snapshots": "rimraf **/*snapshot* --glob",
30
+ "test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
31
+ "test:unit": "vitest",
32
+ "test:eslint": "eslint ./src",
33
+ "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
34
+ "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
35
+ "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
36
+ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
37
+ "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
38
+ "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js",
39
+ "test:types:ts60": "tsc",
40
+ "test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
41
+ "build": "vite build"
42
+ },
27
43
  "type": "module",
28
44
  "types": "dist/esm/index.d.ts",
29
45
  "module": "dist/esm/index.js",
@@ -34,6 +50,17 @@
34
50
  "default": "./dist/esm/index.js"
35
51
  }
36
52
  },
53
+ "./utils": {
54
+ "import": {
55
+ "types": "./dist/esm/utils.d.ts",
56
+ "default": "./dist/esm/utils.js"
57
+ }
58
+ },
59
+ "./vite/types": {
60
+ "import": {
61
+ "types": "./dist/esm/vite/types.d.ts"
62
+ }
63
+ },
37
64
  "./package.json": "./package.json"
38
65
  },
39
66
  "sideEffects": false,
@@ -49,6 +76,12 @@
49
76
  "@babel/core": "^7.28.5",
50
77
  "@babel/types": "^7.28.5",
51
78
  "@rolldown/pluginutils": "1.0.0-beta.40",
79
+ "@tanstack/router-core": "1.168.9",
80
+ "@tanstack/router-generator": "1.166.24",
81
+ "@tanstack/router-plugin": "1.167.12",
82
+ "@tanstack/router-utils": "1.161.6",
83
+ "@tanstack/start-client-core": "1.167.10",
84
+ "@tanstack/start-server-core": "1.167.11",
52
85
  "cheerio": "^1.0.0",
53
86
  "exsolve": "^1.0.7",
54
87
  "pathe": "^2.0.3",
@@ -59,13 +92,7 @@
59
92
  "ufo": "^1.5.4",
60
93
  "vitefu": "^1.1.1",
61
94
  "xmlbuilder2": "^4.0.3",
62
- "zod": "^3.24.2",
63
- "@tanstack/router-core": "1.168.9",
64
- "@tanstack/router-generator": "1.166.24",
65
- "@tanstack/router-plugin": "1.167.12",
66
- "@tanstack/router-utils": "1.161.6",
67
- "@tanstack/start-client-core": "1.167.10",
68
- "@tanstack/start-server-core": "1.167.10"
95
+ "zod": "^3.24.2"
69
96
  },
70
97
  "devDependencies": {
71
98
  "@types/babel__code-frame": "^7.0.6",
@@ -76,21 +103,5 @@
76
103
  },
77
104
  "peerDependencies": {
78
105
  "vite": ">=7.0.0"
79
- },
80
- "scripts": {
81
- "clean": "rimraf ./dist && rimraf ./coverage",
82
- "clean:snapshots": "rimraf **/*snapshot* --glob",
83
- "test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
84
- "test:unit": "vitest",
85
- "test:eslint": "eslint ./src",
86
- "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
87
- "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
88
- "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
89
- "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
90
- "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
91
- "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js",
92
- "test:types:ts60": "tsc",
93
- "test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
94
- "build": "vite build"
95
106
  }
96
- }
107
+ }
@@ -0,0 +1,138 @@
1
+ import {
2
+ createNormalizedBasePaths,
3
+ createNormalizedOutputDirectories,
4
+ deriveRouterBasepath,
5
+ resolveStartEntryPlan,
6
+ } from './planning'
7
+ import type { TanStackStartOutputConfig } from './schema'
8
+ import type {
9
+ GetConfigFn,
10
+ ResolvedStartConfig,
11
+ TanStackStartCoreOptions,
12
+ } from './types'
13
+
14
+ export interface StartConfigContext {
15
+ resolvedStartConfig: ResolvedStartConfig
16
+ getConfig: GetConfigFn
17
+ resolveEntries: () => ReturnType<typeof resolveStartEntryPlan>
18
+ }
19
+
20
+ export function createStartConfigContext<TInputConfig>(opts: {
21
+ corePluginOpts: TanStackStartCoreOptions
22
+ startPluginOpts: TInputConfig | undefined
23
+ parseConfig: (
24
+ opts: TInputConfig | undefined,
25
+ core: { framework: TanStackStartCoreOptions['framework'] },
26
+ root: string,
27
+ ) => TanStackStartOutputConfig
28
+ }): StartConfigContext {
29
+ const resolvedStartConfig: ResolvedStartConfig = {
30
+ root: '',
31
+ startFilePath: undefined,
32
+ routerFilePath: '',
33
+ srcDirectory: '',
34
+ basePaths: {
35
+ publicBase: '',
36
+ assetBase: {
37
+ dev: '',
38
+ build: '',
39
+ },
40
+ },
41
+ outputDirectories: {
42
+ client: '',
43
+ server: '',
44
+ },
45
+ }
46
+
47
+ let startConfig: TanStackStartOutputConfig | null = null
48
+ let resolvedEntryPlanCache:
49
+ | ReturnType<typeof resolveStartEntryPlan>
50
+ | undefined
51
+
52
+ function requireRoot(): string {
53
+ if (!resolvedStartConfig.root) {
54
+ throw new Error(`Cannot get config before root is resolved`)
55
+ }
56
+
57
+ return resolvedStartConfig.root
58
+ }
59
+
60
+ function getStartConfig(): TanStackStartOutputConfig {
61
+ if (!startConfig) {
62
+ startConfig = opts.parseConfig(
63
+ opts.startPluginOpts,
64
+ { framework: opts.corePluginOpts.framework },
65
+ requireRoot(),
66
+ )
67
+ }
68
+
69
+ return startConfig
70
+ }
71
+
72
+ function getResolvedEntryPlan() {
73
+ if (resolvedEntryPlanCache) {
74
+ return resolvedEntryPlanCache
75
+ }
76
+
77
+ resolvedEntryPlanCache = resolveStartEntryPlan({
78
+ root: requireRoot(),
79
+ startConfig: getStartConfig(),
80
+ defaultEntryPaths: opts.corePluginOpts.defaultEntryPaths,
81
+ })
82
+
83
+ Object.assign(resolvedStartConfig, {
84
+ srcDirectory: resolvedEntryPlanCache.srcDirectory,
85
+ startFilePath: resolvedEntryPlanCache.startFilePath,
86
+ routerFilePath: resolvedEntryPlanCache.routerFilePath,
87
+ })
88
+
89
+ return resolvedEntryPlanCache
90
+ }
91
+
92
+ const getConfig: GetConfigFn = () => {
93
+ const startConfig = getStartConfig()
94
+ getResolvedEntryPlan()
95
+
96
+ return { startConfig, resolvedStartConfig }
97
+ }
98
+
99
+ function resolveEntries() {
100
+ return getResolvedEntryPlan()
101
+ }
102
+
103
+ return {
104
+ resolvedStartConfig,
105
+ getConfig,
106
+ resolveEntries,
107
+ }
108
+ }
109
+
110
+ export function applyResolvedBaseAndOutput(opts: {
111
+ resolvedStartConfig: ResolvedStartConfig
112
+ root: string
113
+ publicBase: string
114
+ clientOutputDirectory: string
115
+ serverOutputDirectory: string
116
+ }): void {
117
+ opts.resolvedStartConfig.root = opts.root
118
+ opts.resolvedStartConfig.basePaths = createNormalizedBasePaths({
119
+ publicBase: opts.publicBase,
120
+ })
121
+ opts.resolvedStartConfig.outputDirectories =
122
+ createNormalizedOutputDirectories({
123
+ client: opts.clientOutputDirectory,
124
+ server: opts.serverOutputDirectory,
125
+ })
126
+ }
127
+
128
+ export function applyResolvedRouterBasepath(opts: {
129
+ resolvedStartConfig: ResolvedStartConfig
130
+ startConfig: TanStackStartOutputConfig
131
+ }): string {
132
+ const routerBasepath = deriveRouterBasepath({
133
+ configuredBasepath: opts.startConfig.router.basepath,
134
+ publicBase: opts.resolvedStartConfig.basePaths.publicBase,
135
+ })
136
+ opts.startConfig.router.basepath = routerBasepath
137
+ return routerBasepath
138
+ }
package/src/constants.ts CHANGED
@@ -1,12 +1,16 @@
1
- export const VITE_ENVIRONMENT_NAMES = {
1
+ export const START_ENVIRONMENT_NAMES = {
2
2
  // 'ssr' is chosen as the name for the server environment to ensure backwards compatibility
3
3
  // with vite plugins that are not compatible with the new vite environment API (e.g. tailwindcss)
4
4
  server: 'ssr',
5
5
  client: 'client',
6
6
  } as const
7
7
 
8
- export type ViteEnvironmentNames =
9
- (typeof VITE_ENVIRONMENT_NAMES)[keyof typeof VITE_ENVIRONMENT_NAMES]
8
+ export type StartEnvironmentName =
9
+ (typeof START_ENVIRONMENT_NAMES)[keyof typeof START_ENVIRONMENT_NAMES]
10
+
11
+ export const VITE_ENVIRONMENT_NAMES = START_ENVIRONMENT_NAMES
12
+
13
+ export type ViteEnvironmentNames = StartEnvironmentName
10
14
 
11
15
  // for client and router:
12
16
  // if a user has a custom server/client entry point file, resolve.alias will point to this
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { TanStackStartInputConfig } from './schema'
2
-
3
- export { TanStackStartVitePluginCore } from './plugin'
4
- export { resolveViteId } from './utils'
5
-
6
- export { VITE_ENVIRONMENT_NAMES } from './constants'
2
+ export type { TanStackStartCoreOptions } from './types'
3
+ export type { TanStackStartVitePluginCoreOptions } from './vite/types'
4
+ export type { TanStackStartViteInputConfig } from './vite/schema'
5
+ export { START_ENVIRONMENT_NAMES, VITE_ENVIRONMENT_NAMES } from './constants'
6
+ export { tanStackStartVite } from './vite/plugin'
@@ -0,0 +1,151 @@
1
+ import { joinPaths } from '@tanstack/router-core'
2
+ import { join } from 'pathe'
3
+ import { resolveEntry } from './resolve-entries'
4
+ import type { TanStackStartOutputConfig } from './schema'
5
+ import type {
6
+ NormalizedBasePaths,
7
+ NormalizedOutputDirectories,
8
+ TanStackStartCoreOptions,
9
+ } from './types'
10
+
11
+ export interface ResolvedStartEntryPlan {
12
+ srcDirectory: string
13
+ startFilePath: string | undefined
14
+ routerFilePath: string
15
+ entryPaths: {
16
+ client: string
17
+ server: string
18
+ start: string
19
+ router: string
20
+ }
21
+ }
22
+
23
+ export function normalizePublicBase(base: string | undefined): string {
24
+ const resolvedBase = base ?? '/'
25
+
26
+ if (isFullUrl(resolvedBase)) {
27
+ return resolvedBase
28
+ }
29
+
30
+ return joinPaths(['/', resolvedBase, '/'])
31
+ }
32
+
33
+ export function deriveRouterBasepath(opts: {
34
+ configuredBasepath: string | undefined
35
+ publicBase: string
36
+ }): string {
37
+ if (opts.configuredBasepath !== undefined) {
38
+ return opts.configuredBasepath
39
+ }
40
+
41
+ if (isFullUrl(opts.publicBase)) {
42
+ return '/'
43
+ }
44
+
45
+ return opts.publicBase.replace(/^\/|\/$/g, '')
46
+ }
47
+
48
+ export function shouldRewriteDevBasepath(opts: {
49
+ command: 'serve' | 'build'
50
+ middlewareMode: boolean | undefined
51
+ routerBasepath: string
52
+ publicBase: string
53
+ }): boolean {
54
+ if (opts.command !== 'serve' || opts.middlewareMode) {
55
+ return false
56
+ }
57
+
58
+ return !joinPaths(['/', opts.routerBasepath, '/']).startsWith(
59
+ joinPaths(['/', opts.publicBase, '/']),
60
+ )
61
+ }
62
+
63
+ export function createNormalizedBasePaths(opts: {
64
+ publicBase: string
65
+ }): NormalizedBasePaths {
66
+ return {
67
+ publicBase: opts.publicBase,
68
+ assetBase: {
69
+ dev: opts.publicBase,
70
+ build: opts.publicBase,
71
+ },
72
+ }
73
+ }
74
+
75
+ export function createNormalizedOutputDirectories(opts: {
76
+ client: string
77
+ server: string
78
+ }): NormalizedOutputDirectories {
79
+ return {
80
+ client: opts.client,
81
+ server: opts.server,
82
+ }
83
+ }
84
+
85
+ export function createServerFnBasePath(opts: {
86
+ routerBasepath: string
87
+ serverFnBase: string
88
+ }): string {
89
+ return joinPaths(['/', opts.routerBasepath, opts.serverFnBase, '/'])
90
+ }
91
+
92
+ export function resolveStartEntryPlan(opts: {
93
+ root: string
94
+ startConfig: TanStackStartOutputConfig
95
+ defaultEntryPaths: TanStackStartCoreOptions['defaultEntryPaths']
96
+ }): ResolvedStartEntryPlan {
97
+ const srcDirectory = join(opts.root, opts.startConfig.srcDirectory)
98
+
99
+ const startFilePath = resolveEntry({
100
+ type: 'start entry',
101
+ configuredEntry: opts.startConfig.start.entry,
102
+ defaultEntry: 'start',
103
+ resolvedSrcDirectory: srcDirectory,
104
+ required: false,
105
+ })
106
+
107
+ const routerFilePath = resolveEntry({
108
+ type: 'router entry',
109
+ configuredEntry: opts.startConfig.router.entry,
110
+ defaultEntry: 'router',
111
+ resolvedSrcDirectory: srcDirectory,
112
+ required: true,
113
+ })
114
+
115
+ const clientEntryPath = resolveEntry({
116
+ type: 'client entry',
117
+ configuredEntry: opts.startConfig.client.entry,
118
+ defaultEntry: 'client',
119
+ resolvedSrcDirectory: srcDirectory,
120
+ required: false,
121
+ })
122
+
123
+ const serverEntryPath = resolveEntry({
124
+ type: 'server entry',
125
+ configuredEntry: opts.startConfig.server.entry,
126
+ defaultEntry: 'server',
127
+ resolvedSrcDirectory: srcDirectory,
128
+ required: false,
129
+ })
130
+
131
+ return {
132
+ srcDirectory,
133
+ startFilePath,
134
+ routerFilePath,
135
+ entryPaths: {
136
+ client: clientEntryPath ?? opts.defaultEntryPaths.client,
137
+ server: serverEntryPath ?? opts.defaultEntryPaths.server,
138
+ start: startFilePath ?? opts.defaultEntryPaths.start,
139
+ router: routerFilePath,
140
+ },
141
+ }
142
+ }
143
+
144
+ function isFullUrl(str: string): boolean {
145
+ try {
146
+ new URL(str)
147
+ return true
148
+ } catch {
149
+ return false
150
+ }
151
+ }
package/src/schema.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import path from 'node:path'
2
2
  import { z } from 'zod'
3
3
  import { configSchema, getConfig } from '@tanstack/router-plugin'
4
- import type { TanStackStartVitePluginCoreOptions } from './types'
4
+ import type { CompileStartFrameworkOptions } from './types'
5
5
 
6
6
  const tsrConfig = configSchema
7
7
  .omit({ autoCodeSplitting: true, target: true, verboseFileRoutes: true })
@@ -63,7 +63,7 @@ const importProtectionOptionsSchema = z
63
63
 
64
64
  export function parseStartConfig(
65
65
  opts: z.input<typeof tanstackStartOptionsSchema>,
66
- corePluginOpts: TanStackStartVitePluginCoreOptions,
66
+ corePluginOpts: { framework: CompileStartFrameworkOptions },
67
67
  root: string,
68
68
  ) {
69
69
  const options = tanstackStartOptionsSchema.parse(opts)
@@ -180,103 +180,103 @@ const pageSchema = pageBaseSchema.extend({
180
180
  prerender: pagePrerenderOptionsSchema.optional(),
181
181
  })
182
182
 
183
- const tanstackStartOptionsSchema = z
184
- .object({
185
- srcDirectory: z.string().optional().default('src'),
186
- start: z
187
- .object({
188
- entry: z.string().optional(),
189
- })
190
- .optional()
191
- .default({}),
192
- router: z
193
- .object({
194
- entry: z.string().optional(),
195
- basepath: z.string().optional(),
196
- })
197
- .and(tsrConfig.optional().default({}))
198
- .optional()
199
- .default({}),
200
- client: z
201
- .object({
202
- entry: z.string().optional(),
203
- base: z.string().optional().default('/_build'),
204
- })
205
- .optional()
206
- .default({}),
207
- server: z
208
- .object({
209
- entry: z.string().optional(),
210
- build: z
211
- .object({
212
- staticNodeEnv: z.boolean().optional().default(true),
213
- })
214
- .optional()
215
- .default({}),
216
- })
217
- .optional()
218
- .default({}),
219
- serverFns: z
220
- .object({
221
- base: z.string().optional().default('/_serverFn'),
222
- generateFunctionId: z
223
- .function()
224
- .args(
225
- z.object({
226
- filename: z.string(),
227
- functionName: z.string(),
228
- }),
229
- )
230
- .returns(z.string().optional())
231
- .optional(),
232
- })
233
- .optional()
234
- .default({}),
235
- pages: z.array(pageSchema).optional().default([]),
236
- sitemap: z
237
- .object({
238
- enabled: z.boolean().optional().default(true),
239
- host: z.string().optional(),
240
- outputPath: z.string().optional().default('sitemap.xml'),
241
- })
242
- .optional(),
243
- prerender: z
244
- .object({
245
- enabled: z.boolean().optional(),
246
- concurrency: z.number().optional(),
247
- filter: z.function().args(pageSchema).returns(z.any()).optional(),
248
- failOnError: z.boolean().optional(),
249
- autoStaticPathsDiscovery: z.boolean().optional(),
250
- maxRedirects: z.number().min(0).optional(),
251
- })
252
- .and(pagePrerenderOptionsSchema.optional())
253
- .optional(),
254
- dev: z
255
- .object({
256
- ssrStyles: z
257
- .object({
258
- enabled: z.boolean().optional().default(true),
259
- basepath: z.string().optional(),
260
- })
261
- .optional()
262
- .default({}),
263
- })
264
- .optional()
265
- .default({}),
266
- spa: spaSchema.optional(),
267
- vite: z
268
- .object({ installDevServerMiddleware: z.boolean().optional() })
269
- .optional(),
270
- importProtection: importProtectionOptionsSchema,
271
- })
183
+ export const tanstackStartOptionsObjectSchema = z.object({
184
+ srcDirectory: z.string().optional().default('src'),
185
+ start: z
186
+ .object({
187
+ entry: z.string().optional(),
188
+ })
189
+ .optional()
190
+ .default({}),
191
+ router: z
192
+ .object({
193
+ entry: z.string().optional(),
194
+ basepath: z.string().optional(),
195
+ })
196
+ .and(tsrConfig.optional().default({}))
197
+ .optional()
198
+ .default({}),
199
+ client: z
200
+ .object({
201
+ entry: z.string().optional(),
202
+ base: z.string().optional().default('/_build'),
203
+ })
204
+ .optional()
205
+ .default({}),
206
+ server: z
207
+ .object({
208
+ entry: z.string().optional(),
209
+ build: z
210
+ .object({
211
+ staticNodeEnv: z.boolean().optional().default(true),
212
+ })
213
+ .optional()
214
+ .default({}),
215
+ })
216
+ .optional()
217
+ .default({}),
218
+ serverFns: z
219
+ .object({
220
+ base: z.string().optional().default('/_serverFn'),
221
+ generateFunctionId: z
222
+ .function()
223
+ .args(
224
+ z.object({
225
+ filename: z.string(),
226
+ functionName: z.string(),
227
+ }),
228
+ )
229
+ .returns(z.string().optional())
230
+ .optional(),
231
+ })
232
+ .optional()
233
+ .default({}),
234
+ pages: z.array(pageSchema).optional().default([]),
235
+ sitemap: z
236
+ .object({
237
+ enabled: z.boolean().optional().default(true),
238
+ host: z.string().optional(),
239
+ outputPath: z.string().optional().default('sitemap.xml'),
240
+ })
241
+ .optional(),
242
+ prerender: z
243
+ .object({
244
+ enabled: z.boolean().optional(),
245
+ concurrency: z.number().optional(),
246
+ filter: z.function().args(pageSchema).returns(z.any()).optional(),
247
+ failOnError: z.boolean().optional(),
248
+ autoStaticPathsDiscovery: z.boolean().optional(),
249
+ maxRedirects: z.number().min(0).optional(),
250
+ })
251
+ .and(pagePrerenderOptionsSchema.optional())
252
+ .optional(),
253
+ dev: z
254
+ .object({
255
+ ssrStyles: z
256
+ .object({
257
+ enabled: z.boolean().optional().default(true),
258
+ basepath: z.string().optional(),
259
+ })
260
+ .optional()
261
+ .default({}),
262
+ })
263
+ .optional()
264
+ .default({}),
265
+ spa: spaSchema.optional(),
266
+ importProtection: importProtectionOptionsSchema,
267
+ })
268
+
269
+ export const tanstackStartOptionsSchema = tanstackStartOptionsObjectSchema
272
270
  .optional()
273
271
  .default({})
274
272
 
275
273
  export type Page = z.infer<typeof pageSchema>
276
274
 
277
- export type TanStackStartInputConfig = z.input<
278
- typeof tanstackStartOptionsSchema
275
+ type TanStackStartOptionsInput = NonNullable<
276
+ z.input<typeof tanstackStartOptionsSchema>
279
277
  >
278
+
279
+ export type TanStackStartInputConfig = TanStackStartOptionsInput
280
280
  export type TanStackStartOutputConfig = ReturnType<typeof parseStartConfig>
281
281
 
282
282
  export type ImportProtectionBehavior = z.infer<