@tanstack/react-start 1.167.42 → 1.167.44
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/esm/plugin/rsbuild.d.ts +7 -0
- package/dist/esm/plugin/rsbuild.js +53 -0
- package/dist/esm/plugin/rsbuild.js.map +1 -0
- package/dist/esm/plugin/shared.js +1 -1
- package/dist/esm/plugin/vite.d.ts +1 -1
- package/dist/esm/plugin/vite.js +2 -2
- package/dist/esm/plugin/vite.js.map +1 -1
- package/dist/esm/rsbuild/browser-decode.d.ts +1 -0
- package/dist/esm/rsbuild/browser-decode.js +1 -0
- package/dist/esm/rsbuild/ssr-decode.d.ts +1 -0
- package/dist/esm/rsbuild/ssr-decode.js +1 -0
- package/package.json +31 -5
- package/src/plugin/rsbuild.ts +68 -0
- package/src/plugin/vite.ts +2 -2
- package/src/rsbuild/browser-decode.ts +1 -0
- package/src/rsbuild/ssr-decode.ts +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TanStackStartRsbuildInputConfig } from '@tanstack/start-plugin-core/rsbuild';
|
|
2
|
+
import { RsbuildPlugin } from '@rsbuild/core';
|
|
3
|
+
export declare function tanstackStart(options?: TanStackStartRsbuildInputConfig & {
|
|
4
|
+
rsc?: {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
}): RsbuildPlugin;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { reactStartDefaultEntryPaths } from "./shared.js";
|
|
2
|
+
import { RSBUILD_ENVIRONMENT_NAMES, tanStackStartRsbuild } from "@tanstack/start-plugin-core/rsbuild";
|
|
3
|
+
//#region src/plugin/rsbuild.ts
|
|
4
|
+
function tanstackStart(options) {
|
|
5
|
+
const rscEnabled = options?.rsc?.enabled ?? false;
|
|
6
|
+
let corePluginOpts = {
|
|
7
|
+
framework: "react",
|
|
8
|
+
defaultEntryPaths: reactStartDefaultEntryPaths,
|
|
9
|
+
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
|
|
10
|
+
ssrIsProvider: true
|
|
11
|
+
};
|
|
12
|
+
if (rscEnabled) {
|
|
13
|
+
const rscConfig = configureRscRsbuild();
|
|
14
|
+
corePluginOpts = {
|
|
15
|
+
...corePluginOpts,
|
|
16
|
+
providerEnvironmentName: rscConfig.providerEnvironmentName,
|
|
17
|
+
ssrIsProvider: false,
|
|
18
|
+
serializationAdapters: rscConfig.serializationAdapters,
|
|
19
|
+
rsc: true
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return tanStackStartRsbuild(corePluginOpts, options);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Configure RSC options for the rsbuild adapter.
|
|
26
|
+
*
|
|
27
|
+
* Returns provider env, serialization adapters, and core RSC options.
|
|
28
|
+
*
|
|
29
|
+
* The SSR resolver strategy is intentionally NOT changed from 'default' —
|
|
30
|
+
* in the rspack layered model, SSR and RSC live in the same
|
|
31
|
+
* compilation so they share the same resolver file. No forwarding needed.
|
|
32
|
+
*/
|
|
33
|
+
function configureRscRsbuild() {
|
|
34
|
+
return {
|
|
35
|
+
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
|
|
36
|
+
serializationAdapters: [{
|
|
37
|
+
client: {
|
|
38
|
+
module: "@tanstack/react-start/rsc/serialization/client",
|
|
39
|
+
export: "rscSerializationAdapter",
|
|
40
|
+
isFactory: true
|
|
41
|
+
},
|
|
42
|
+
server: {
|
|
43
|
+
module: "@tanstack/react-start/rsc/serialization/server",
|
|
44
|
+
export: "rscSerializationAdapter",
|
|
45
|
+
isFactory: true
|
|
46
|
+
}
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { tanstackStart };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=rsbuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsbuild.js","names":[],"sources":["../../../src/plugin/rsbuild.ts"],"sourcesContent":["import {\n RSBUILD_ENVIRONMENT_NAMES,\n tanStackStartRsbuild,\n} from '@tanstack/start-plugin-core/rsbuild'\nimport { reactStartDefaultEntryPaths } from './shared'\nimport type {\n TanStackStartRsbuildInputConfig,\n TanStackStartRsbuildPluginCoreOptions,\n} from '@tanstack/start-plugin-core/rsbuild'\nimport type { RsbuildPlugin } from '@rsbuild/core'\n\nexport function tanstackStart(\n options?: TanStackStartRsbuildInputConfig & { rsc?: { enabled?: boolean } },\n): RsbuildPlugin {\n const rscEnabled = options?.rsc?.enabled ?? false\n\n let corePluginOpts: TanStackStartRsbuildPluginCoreOptions = {\n framework: 'react',\n defaultEntryPaths: reactStartDefaultEntryPaths,\n providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,\n ssrIsProvider: true,\n }\n\n if (rscEnabled) {\n const rscConfig = configureRscRsbuild()\n corePluginOpts = {\n ...corePluginOpts,\n providerEnvironmentName: rscConfig.providerEnvironmentName,\n ssrIsProvider: false,\n serializationAdapters: rscConfig.serializationAdapters,\n rsc: true,\n }\n }\n\n return tanStackStartRsbuild(corePluginOpts, options)\n}\n\n/**\n * Configure RSC options for the rsbuild adapter.\n *\n * Returns provider env, serialization adapters, and core RSC options.\n *\n * The SSR resolver strategy is intentionally NOT changed from 'default' —\n * in the rspack layered model, SSR and RSC live in the same\n * compilation so they share the same resolver file. No forwarding needed.\n */\nfunction configureRscRsbuild(): {\n providerEnvironmentName: TanStackStartRsbuildPluginCoreOptions['providerEnvironmentName']\n serializationAdapters: TanStackStartRsbuildPluginCoreOptions['serializationAdapters']\n} {\n return {\n providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,\n serializationAdapters: [\n {\n client: {\n module: '@tanstack/react-start/rsc/serialization/client',\n export: 'rscSerializationAdapter',\n isFactory: true,\n },\n server: {\n module: '@tanstack/react-start/rsc/serialization/server',\n export: 'rscSerializationAdapter',\n isFactory: true,\n },\n },\n ],\n }\n}\n"],"mappings":";;;AAWA,SAAgB,cACd,SACe;CACf,MAAM,aAAa,SAAS,KAAK,WAAW;CAE5C,IAAI,iBAAwD;EAC1D,WAAW;EACX,mBAAmB;EACnB,yBAAyB,0BAA0B;EACnD,eAAe;EAChB;AAED,KAAI,YAAY;EACd,MAAM,YAAY,qBAAqB;AACvC,mBAAiB;GACf,GAAG;GACH,yBAAyB,UAAU;GACnC,eAAe;GACf,uBAAuB,UAAU;GACjC,KAAK;GACN;;AAGH,QAAO,qBAAqB,gBAAgB,QAAQ;;;;;;;;;;;AAYtD,SAAS,sBAGP;AACA,QAAO;EACL,yBAAyB,0BAA0B;EACnD,uBAAuB,CACrB;GACE,QAAQ;IACN,QAAQ;IACR,QAAQ;IACR,WAAW;IACZ;GACD,QAAQ;IACN,QAAQ;IACR,QAAQ;IACR,WAAW;IACZ;GACF,CACF;EACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TanStackStartViteInputConfig } from '@tanstack/start-plugin-core';
|
|
1
|
+
import { TanStackStartViteInputConfig } from '@tanstack/start-plugin-core/vite';
|
|
2
2
|
import { PluginOption } from 'vite';
|
|
3
3
|
export declare function tanstackStart(options?: TanStackStartViteInputConfig & {
|
|
4
4
|
rsc?: {
|
package/dist/esm/plugin/vite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { reactStartDefaultEntryPaths, reactStartPluginDir } from "./shared.js";
|
|
2
|
-
import { START_ENVIRONMENT_NAMES, tanStackStartVite } from "@tanstack/start-plugin-core";
|
|
3
|
-
import { configureRsc, reactStartRscVitePlugin } from "@tanstack/react-start-rsc/plugin/vite";
|
|
4
2
|
import path from "pathe";
|
|
3
|
+
import { START_ENVIRONMENT_NAMES, tanStackStartVite } from "@tanstack/start-plugin-core/vite";
|
|
4
|
+
import { configureRsc, reactStartRscVitePlugin } from "@tanstack/react-start-rsc/plugin/vite";
|
|
5
5
|
//#region src/plugin/vite.ts
|
|
6
6
|
var isInsideRouterMonoRepo = path.basename(path.resolve(reactStartPluginDir, "../../../../")) === "packages";
|
|
7
7
|
function tanstackStart(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":[],"sources":["../../../src/plugin/vite.ts"],"sourcesContent":["import {\n START_ENVIRONMENT_NAMES,\n tanStackStartVite,\n} from '@tanstack/start-plugin-core'\nimport type {\n TanStackStartViteInputConfig,\n TanStackStartVitePluginCoreOptions,\n} from '@tanstack/start-plugin-core'\nimport {\n configureRsc,\n reactStartRscVitePlugin,\n} from '@tanstack/react-start-rsc/plugin/vite'\nimport path from 'pathe'\nimport { reactStartDefaultEntryPaths, reactStartPluginDir } from './shared'\nimport type { PluginOption } from 'vite'\n\nconst isInsideRouterMonoRepo =\n path.basename(path.resolve(reactStartPluginDir, '../../../../')) ===\n 'packages'\n\nexport function tanstackStart(\n options?: TanStackStartViteInputConfig & { rsc?: { enabled?: boolean } },\n): Array<PluginOption> {\n const rscEnabled = options?.rsc?.enabled ?? false\n const rscConfig = rscEnabled ? configureRsc() : undefined\n let corePluginOpts: TanStackStartVitePluginCoreOptions = {\n framework: 'react',\n defaultEntryPaths: reactStartDefaultEntryPaths,\n providerEnvironmentName: START_ENVIRONMENT_NAMES.server,\n ssrIsProvider: true,\n ssrResolverStrategy: {\n type: 'default',\n },\n }\n\n const serverEnvironments: Array<string> = [\n START_ENVIRONMENT_NAMES.server,\n ...(rscConfig ? [rscConfig.envName] : []),\n ]\n\n if (rscConfig) {\n corePluginOpts = {\n ...corePluginOpts,\n providerEnvironmentName: rscConfig.providerEnvironmentName,\n ssrIsProvider: false,\n ssrResolverStrategy: rscConfig.ssrResolverStrategy,\n serializationAdapters: rscConfig.serializationAdapters,\n }\n }\n return [\n {\n name: 'tanstack-react-start:config',\n configEnvironment(environmentName, options) {\n const needsOptimizeDeps =\n environmentName === START_ENVIRONMENT_NAMES.client ||\n (serverEnvironments.includes(environmentName) &&\n // This indicates that the server environment has opted in to dependency optimization\n options.optimizeDeps?.noDiscovery === false)\n\n // Check if @tanstack/react-router is in noExternal (as array)\n const reactRouterInNoExternal =\n Array.isArray(options.resolve?.noExternal) &&\n options.resolve.noExternal.some(\n (pattern) =>\n pattern === '@tanstack/react-router' ||\n (typeof pattern === 'string' && pattern.includes('react-router')),\n )\n\n return {\n resolve: {\n dedupe: [\n 'react',\n 'react-dom',\n '@tanstack/react-start',\n '@tanstack/react-router',\n ],\n // Don't mark react-router as external if:\n // 1. noExternal is true (bundle everything)\n // 2. We're not in the router monorepo\n // 3. react-router is explicitly in noExternal for this environment\n external:\n options.resolve?.noExternal === true ||\n !isInsideRouterMonoRepo ||\n reactRouterInNoExternal\n ? undefined\n : ['@tanstack/react-router', '@tanstack/react-router-devtools'],\n },\n optimizeDeps: needsOptimizeDeps\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 '@tanstack/start-static-server-functions',\n ],\n include: [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n ...(environmentName === START_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 be included so that it is converted to ESM.\n '@tanstack/react-router > @tanstack/react-store',\n ...(options.optimizeDeps?.exclude?.find(\n (x) => x === '@tanstack/react-form',\n )\n ? ['@tanstack/react-form > @tanstack/react-store']\n : []),\n ],\n }\n : undefined,\n }\n },\n },\n rscConfig ? reactStartRscVitePlugin() : null,\n tanStackStartVite(corePluginOpts, options),\n ]\n}\n"],"mappings":";;;;;AAgBA,IAAM,yBACJ,KAAK,SAAS,KAAK,QAAQ,qBAAqB,eAAe,CAAC,KAChE;AAEF,SAAgB,cACd,SACqB;CAErB,MAAM,YADa,SAAS,KAAK,WAAW,QACb,cAAc,GAAG,KAAA;CAChD,IAAI,iBAAqD;EACvD,WAAW;EACX,mBAAmB;EACnB,yBAAyB,wBAAwB;EACjD,eAAe;EACf,qBAAqB,EACnB,MAAM,WACP;EACF;CAED,MAAM,qBAAoC,CACxC,wBAAwB,QACxB,GAAI,YAAY,CAAC,UAAU,QAAQ,GAAG,EAAE,CACzC;AAED,KAAI,UACF,kBAAiB;EACf,GAAG;EACH,yBAAyB,UAAU;EACnC,eAAe;EACf,qBAAqB,UAAU;EAC/B,uBAAuB,UAAU;EAClC;AAEH,QAAO;EACL;GACE,MAAM;GACN,kBAAkB,iBAAiB,SAAS;IAC1C,MAAM,oBACJ,oBAAoB,wBAAwB,UAC3C,mBAAmB,SAAS,gBAAgB,IAE3C,QAAQ,cAAc,gBAAgB;IAG1C,MAAM,0BACJ,MAAM,QAAQ,QAAQ,SAAS,WAAW,IAC1C,QAAQ,QAAQ,WAAW,MACxB,YACC,YAAY,4BACX,OAAO,YAAY,YAAY,QAAQ,SAAS,eAAe,CACnE;AAEH,WAAO;KACL,SAAS;MACP,QAAQ;OACN;OACA;OACA;OACA;OACD;MAKD,UACE,QAAQ,SAAS,eAAe,QAChC,CAAC,0BACD,0BACI,KAAA,IACA,CAAC,0BAA0B,kCAAkC;MACpE;KACD,cAAc,oBACV;MAEE,SAAS;OACP;OACA;OACA;OACA;OACD;MACD,SAAS;OACP;OACA;OACA;OACA;OACA,GAAI,oBAAoB,wBAAwB,SAC5C,CAAC,mBAAmB,GACpB,CAAC,mBAAmB;OAGxB;OACA,GAAI,QAAQ,cAAc,SAAS,MAChC,MAAM,MAAM,uBACd,GACG,CAAC,+CAA+C,GAChD,EAAE;OACP;MACF,GACD,KAAA;KACL;;GAEJ;EACD,YAAY,yBAAyB,GAAG;EACxC,kBAAkB,gBAAgB,QAAQ;EAC3C"}
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../../../src/plugin/vite.ts"],"sourcesContent":["import {\n START_ENVIRONMENT_NAMES,\n tanStackStartVite,\n} from '@tanstack/start-plugin-core/vite'\nimport type {\n TanStackStartViteInputConfig,\n TanStackStartVitePluginCoreOptions,\n} from '@tanstack/start-plugin-core/vite'\nimport {\n configureRsc,\n reactStartRscVitePlugin,\n} from '@tanstack/react-start-rsc/plugin/vite'\nimport path from 'pathe'\nimport { reactStartDefaultEntryPaths, reactStartPluginDir } from './shared'\nimport type { PluginOption } from 'vite'\n\nconst isInsideRouterMonoRepo =\n path.basename(path.resolve(reactStartPluginDir, '../../../../')) ===\n 'packages'\n\nexport function tanstackStart(\n options?: TanStackStartViteInputConfig & { rsc?: { enabled?: boolean } },\n): Array<PluginOption> {\n const rscEnabled = options?.rsc?.enabled ?? false\n const rscConfig = rscEnabled ? configureRsc() : undefined\n let corePluginOpts: TanStackStartVitePluginCoreOptions = {\n framework: 'react',\n defaultEntryPaths: reactStartDefaultEntryPaths,\n providerEnvironmentName: START_ENVIRONMENT_NAMES.server,\n ssrIsProvider: true,\n ssrResolverStrategy: {\n type: 'default',\n },\n }\n\n const serverEnvironments: Array<string> = [\n START_ENVIRONMENT_NAMES.server,\n ...(rscConfig ? [rscConfig.envName] : []),\n ]\n\n if (rscConfig) {\n corePluginOpts = {\n ...corePluginOpts,\n providerEnvironmentName: rscConfig.providerEnvironmentName,\n ssrIsProvider: false,\n ssrResolverStrategy: rscConfig.ssrResolverStrategy,\n serializationAdapters: rscConfig.serializationAdapters,\n }\n }\n return [\n {\n name: 'tanstack-react-start:config',\n configEnvironment(environmentName, options) {\n const needsOptimizeDeps =\n environmentName === START_ENVIRONMENT_NAMES.client ||\n (serverEnvironments.includes(environmentName) &&\n // This indicates that the server environment has opted in to dependency optimization\n options.optimizeDeps?.noDiscovery === false)\n\n // Check if @tanstack/react-router is in noExternal (as array)\n const reactRouterInNoExternal =\n Array.isArray(options.resolve?.noExternal) &&\n options.resolve.noExternal.some(\n (pattern) =>\n pattern === '@tanstack/react-router' ||\n (typeof pattern === 'string' && pattern.includes('react-router')),\n )\n\n return {\n resolve: {\n dedupe: [\n 'react',\n 'react-dom',\n '@tanstack/react-start',\n '@tanstack/react-router',\n ],\n // Don't mark react-router as external if:\n // 1. noExternal is true (bundle everything)\n // 2. We're not in the router monorepo\n // 3. react-router is explicitly in noExternal for this environment\n external:\n options.resolve?.noExternal === true ||\n !isInsideRouterMonoRepo ||\n reactRouterInNoExternal\n ? undefined\n : ['@tanstack/react-router', '@tanstack/react-router-devtools'],\n },\n optimizeDeps: needsOptimizeDeps\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 '@tanstack/start-static-server-functions',\n ],\n include: [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n ...(environmentName === START_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 be included so that it is converted to ESM.\n '@tanstack/react-router > @tanstack/react-store',\n ...(options.optimizeDeps?.exclude?.find(\n (x) => x === '@tanstack/react-form',\n )\n ? ['@tanstack/react-form > @tanstack/react-store']\n : []),\n ],\n }\n : undefined,\n }\n },\n },\n rscConfig ? reactStartRscVitePlugin() : null,\n tanStackStartVite(corePluginOpts, options),\n ]\n}\n"],"mappings":";;;;;AAgBA,IAAM,yBACJ,KAAK,SAAS,KAAK,QAAQ,qBAAqB,eAAe,CAAC,KAChE;AAEF,SAAgB,cACd,SACqB;CAErB,MAAM,YADa,SAAS,KAAK,WAAW,QACb,cAAc,GAAG,KAAA;CAChD,IAAI,iBAAqD;EACvD,WAAW;EACX,mBAAmB;EACnB,yBAAyB,wBAAwB;EACjD,eAAe;EACf,qBAAqB,EACnB,MAAM,WACP;EACF;CAED,MAAM,qBAAoC,CACxC,wBAAwB,QACxB,GAAI,YAAY,CAAC,UAAU,QAAQ,GAAG,EAAE,CACzC;AAED,KAAI,UACF,kBAAiB;EACf,GAAG;EACH,yBAAyB,UAAU;EACnC,eAAe;EACf,qBAAqB,UAAU;EAC/B,uBAAuB,UAAU;EAClC;AAEH,QAAO;EACL;GACE,MAAM;GACN,kBAAkB,iBAAiB,SAAS;IAC1C,MAAM,oBACJ,oBAAoB,wBAAwB,UAC3C,mBAAmB,SAAS,gBAAgB,IAE3C,QAAQ,cAAc,gBAAgB;IAG1C,MAAM,0BACJ,MAAM,QAAQ,QAAQ,SAAS,WAAW,IAC1C,QAAQ,QAAQ,WAAW,MACxB,YACC,YAAY,4BACX,OAAO,YAAY,YAAY,QAAQ,SAAS,eAAe,CACnE;AAEH,WAAO;KACL,SAAS;MACP,QAAQ;OACN;OACA;OACA;OACA;OACD;MAKD,UACE,QAAQ,SAAS,eAAe,QAChC,CAAC,0BACD,0BACI,KAAA,IACA,CAAC,0BAA0B,kCAAkC;MACpE;KACD,cAAc,oBACV;MAEE,SAAS;OACP;OACA;OACA;OACA;OACD;MACD,SAAS;OACP;OACA;OACA;OACA;OACA,GAAI,oBAAoB,wBAAwB,SAC5C,CAAC,mBAAmB,GACpB,CAAC,mBAAmB;OAGxB;OACA,GAAI,QAAQ,cAAc,SAAS,MAChC,MAAM,MAAM,uBACd,GACG,CAAC,+CAA+C,GAChD,EAAE;OACP;MACF,GACD,KAAA;KACL;;GAEJ;EACD,YAAY,yBAAyB,GAAG;EACxC,kBAAkB,gBAAgB,QAAQ;EAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/react-start-rsc/rsbuild/browser-decode';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@tanstack/react-start-rsc/rsbuild/browser-decode";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/react-start-rsc/rsbuild/ssr-decode';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@tanstack/react-start-rsc/rsbuild/ssr-decode";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-start",
|
|
3
|
-
"version": "1.167.
|
|
3
|
+
"version": "1.167.44",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,6 +76,12 @@
|
|
|
76
76
|
"default": "./dist/esm/plugin/vite.js"
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
+
"./plugin/rsbuild": {
|
|
80
|
+
"import": {
|
|
81
|
+
"types": "./dist/esm/plugin/rsbuild.d.ts",
|
|
82
|
+
"default": "./dist/esm/plugin/rsbuild.js"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
79
85
|
"./server-entry": {
|
|
80
86
|
"import": {
|
|
81
87
|
"types": "./dist/default-entry/esm/server.d.ts",
|
|
@@ -104,6 +110,18 @@
|
|
|
104
110
|
"default": "./dist/esm/rsc/serialization/client.js"
|
|
105
111
|
}
|
|
106
112
|
},
|
|
113
|
+
"./rsbuild/browser-decode": {
|
|
114
|
+
"import": {
|
|
115
|
+
"types": "./dist/esm/rsbuild/browser-decode.d.ts",
|
|
116
|
+
"default": "./dist/esm/rsbuild/browser-decode.js"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"./rsbuild/ssr-decode": {
|
|
120
|
+
"import": {
|
|
121
|
+
"types": "./dist/esm/rsbuild/ssr-decode.d.ts",
|
|
122
|
+
"default": "./dist/esm/rsbuild/ssr-decode.js"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
107
125
|
"./server-only": {
|
|
108
126
|
"import": {
|
|
109
127
|
"types": "./dist/esm/server-only.d.ts",
|
|
@@ -131,26 +149,34 @@
|
|
|
131
149
|
},
|
|
132
150
|
"dependencies": {
|
|
133
151
|
"pathe": "^2.0.3",
|
|
152
|
+
"@tanstack/react-router": "1.168.23",
|
|
134
153
|
"@tanstack/react-start-client": "1.166.40",
|
|
135
|
-
"@tanstack/react-start-rsc": "0.0.
|
|
154
|
+
"@tanstack/react-start-rsc": "0.0.23",
|
|
136
155
|
"@tanstack/react-start-server": "1.166.41",
|
|
137
|
-
"@tanstack/router-utils": "
|
|
138
|
-
"@tanstack/start-plugin-core": "1.167.35",
|
|
139
|
-
"@tanstack/react-router": "1.168.23",
|
|
156
|
+
"@tanstack/router-utils": "1.161.7",
|
|
140
157
|
"@tanstack/start-client-core": "1.167.17",
|
|
158
|
+
"@tanstack/start-plugin-core": "1.169.0",
|
|
141
159
|
"@tanstack/start-server-core": "1.167.19"
|
|
142
160
|
},
|
|
143
161
|
"peerDependencies": {
|
|
162
|
+
"@rsbuild/core": "^2.0.0",
|
|
144
163
|
"react": ">=18.0.0 || >=19.0.0",
|
|
145
164
|
"react-dom": ">=18.0.0 || >=19.0.0",
|
|
146
165
|
"vite": ">=7.0.0"
|
|
147
166
|
},
|
|
148
167
|
"peerDependenciesMeta": {
|
|
168
|
+
"@rsbuild/core": {
|
|
169
|
+
"optional": true
|
|
170
|
+
},
|
|
149
171
|
"@vitejs/plugin-rsc": {
|
|
150
172
|
"optional": true
|
|
173
|
+
},
|
|
174
|
+
"vite": {
|
|
175
|
+
"optional": true
|
|
151
176
|
}
|
|
152
177
|
},
|
|
153
178
|
"devDependencies": {
|
|
179
|
+
"@rsbuild/core": "^2.0.0",
|
|
154
180
|
"@tanstack/intent": "^0.0.14",
|
|
155
181
|
"@types/node": ">=20"
|
|
156
182
|
},
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RSBUILD_ENVIRONMENT_NAMES,
|
|
3
|
+
tanStackStartRsbuild,
|
|
4
|
+
} from '@tanstack/start-plugin-core/rsbuild'
|
|
5
|
+
import { reactStartDefaultEntryPaths } from './shared'
|
|
6
|
+
import type {
|
|
7
|
+
TanStackStartRsbuildInputConfig,
|
|
8
|
+
TanStackStartRsbuildPluginCoreOptions,
|
|
9
|
+
} from '@tanstack/start-plugin-core/rsbuild'
|
|
10
|
+
import type { RsbuildPlugin } from '@rsbuild/core'
|
|
11
|
+
|
|
12
|
+
export function tanstackStart(
|
|
13
|
+
options?: TanStackStartRsbuildInputConfig & { rsc?: { enabled?: boolean } },
|
|
14
|
+
): RsbuildPlugin {
|
|
15
|
+
const rscEnabled = options?.rsc?.enabled ?? false
|
|
16
|
+
|
|
17
|
+
let corePluginOpts: TanStackStartRsbuildPluginCoreOptions = {
|
|
18
|
+
framework: 'react',
|
|
19
|
+
defaultEntryPaths: reactStartDefaultEntryPaths,
|
|
20
|
+
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
|
|
21
|
+
ssrIsProvider: true,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (rscEnabled) {
|
|
25
|
+
const rscConfig = configureRscRsbuild()
|
|
26
|
+
corePluginOpts = {
|
|
27
|
+
...corePluginOpts,
|
|
28
|
+
providerEnvironmentName: rscConfig.providerEnvironmentName,
|
|
29
|
+
ssrIsProvider: false,
|
|
30
|
+
serializationAdapters: rscConfig.serializationAdapters,
|
|
31
|
+
rsc: true,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return tanStackStartRsbuild(corePluginOpts, options)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Configure RSC options for the rsbuild adapter.
|
|
40
|
+
*
|
|
41
|
+
* Returns provider env, serialization adapters, and core RSC options.
|
|
42
|
+
*
|
|
43
|
+
* The SSR resolver strategy is intentionally NOT changed from 'default' —
|
|
44
|
+
* in the rspack layered model, SSR and RSC live in the same
|
|
45
|
+
* compilation so they share the same resolver file. No forwarding needed.
|
|
46
|
+
*/
|
|
47
|
+
function configureRscRsbuild(): {
|
|
48
|
+
providerEnvironmentName: TanStackStartRsbuildPluginCoreOptions['providerEnvironmentName']
|
|
49
|
+
serializationAdapters: TanStackStartRsbuildPluginCoreOptions['serializationAdapters']
|
|
50
|
+
} {
|
|
51
|
+
return {
|
|
52
|
+
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
|
|
53
|
+
serializationAdapters: [
|
|
54
|
+
{
|
|
55
|
+
client: {
|
|
56
|
+
module: '@tanstack/react-start/rsc/serialization/client',
|
|
57
|
+
export: 'rscSerializationAdapter',
|
|
58
|
+
isFactory: true,
|
|
59
|
+
},
|
|
60
|
+
server: {
|
|
61
|
+
module: '@tanstack/react-start/rsc/serialization/server',
|
|
62
|
+
export: 'rscSerializationAdapter',
|
|
63
|
+
isFactory: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/plugin/vite.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
START_ENVIRONMENT_NAMES,
|
|
3
3
|
tanStackStartVite,
|
|
4
|
-
} from '@tanstack/start-plugin-core'
|
|
4
|
+
} from '@tanstack/start-plugin-core/vite'
|
|
5
5
|
import type {
|
|
6
6
|
TanStackStartViteInputConfig,
|
|
7
7
|
TanStackStartVitePluginCoreOptions,
|
|
8
|
-
} from '@tanstack/start-plugin-core'
|
|
8
|
+
} from '@tanstack/start-plugin-core/vite'
|
|
9
9
|
import {
|
|
10
10
|
configureRsc,
|
|
11
11
|
reactStartRscVitePlugin,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/react-start-rsc/rsbuild/browser-decode'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/react-start-rsc/rsbuild/ssr-decode'
|