@tanstack/solid-start 2.0.0-beta.20 → 2.0.0-beta.21
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.js.map +1 -1
- package/dist/esm/hydration.d.ts +2 -0
- package/dist/esm/hydration.js +2 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/plugin/rsbuild.d.ts +3 -0
- package/dist/esm/plugin/rsbuild.js +44 -0
- package/dist/esm/plugin/rsbuild.js.map +1 -0
- package/dist/esm/plugin/shared.d.ts +5 -0
- package/dist/esm/plugin/shared.js +14 -0
- package/dist/esm/plugin/shared.js.map +1 -0
- package/dist/esm/plugin/vite.d.ts +2 -2
- package/dist/esm/plugin/vite.js +20 -18
- package/dist/esm/plugin/vite.js.map +1 -1
- package/dist/esm/useServerFn.js +1 -1
- package/dist/esm/useServerFn.js.map +1 -1
- package/package.json +30 -12
- package/src/hydration.ts +18 -0
- package/src/index.ts +32 -0
- package/src/plugin/rsbuild.ts +81 -0
- package/src/plugin/shared.ts +17 -0
- package/src/plugin/vite.ts +29 -30
- package/src/useServerFn.ts +1 -1
- package/bin/intent.js +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":[],"sources":["../../../src/default-entry/server.ts"],"sourcesContent":["import {\n createStartHandler,\n defaultStreamHandler,\n} from '@tanstack/solid-start/server'\nimport type { Register } from '@tanstack/solid-router'\nimport type { RequestHandler } from '@tanstack/solid-start/server'\n\nconst fetch = createStartHandler(defaultStreamHandler)\n\n// Providing `RequestHandler` from `@tanstack/solid-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`\nexport type ServerEntry = { fetch: RequestHandler<Register> }\n\nexport function createServerEntry(entry: ServerEntry): ServerEntry {\n return {\n async fetch(...args) {\n return await entry.fetch(...args)\n },\n }\n}\n\nexport default createServerEntry({ fetch })\n"],"mappings":";;AAOA,IAAM,QAAQ,mBAAmB,
|
|
1
|
+
{"version":3,"file":"server.js","names":[],"sources":["../../../src/default-entry/server.ts"],"sourcesContent":["import {\n createStartHandler,\n defaultStreamHandler,\n} from '@tanstack/solid-start/server'\nimport type { Register } from '@tanstack/solid-router'\nimport type { RequestHandler } from '@tanstack/solid-start/server'\n\nconst fetch = createStartHandler(defaultStreamHandler)\n\n// Providing `RequestHandler` from `@tanstack/solid-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`\nexport type ServerEntry = { fetch: RequestHandler<Register> }\n\nexport function createServerEntry(entry: ServerEntry): ServerEntry {\n return {\n async fetch(...args) {\n return await entry.fetch(...args)\n },\n }\n}\n\nexport default createServerEntry({ fetch })\n"],"mappings":";;AAOA,IAAM,QAAQ,mBAAmB,oBAAoB;AAKrD,SAAgB,kBAAkB,OAAiC;CACjE,OAAO,EACL,MAAM,MAAM,GAAG,MAAM;EACnB,OAAO,MAAM,MAAM,MAAM,GAAG,IAAI;CAClC,EACF;AACF;AAEA,IAAA,iBAAe,kBAAkB,EAAE,MAAM,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { condition, idle, interaction, load, media, never, visible, } from '@tanstack/solid-start-client/hydration';
|
|
2
|
+
export type { HydrationCondition, HydrationInteractionEvent, HydrationInteractionEvents, HydrationPrefetchStrategy, HydrationStrategy, HydrationWhen, VisibleHydrationOptions, } from '@tanstack/solid-start-client/hydration';
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { useServerFn } from './useServerFn.js';
|
|
2
2
|
export * from '@tanstack/start-client-core';
|
|
3
|
+
export { createClientOnlyFn, createCsrfMiddleware, createIsomorphicFn, createMiddleware, createServerFn, createServerOnlyFn, createStart, } from '@tanstack/start-client-core';
|
|
4
|
+
export { Hydrate } from '@tanstack/solid-start-client/Hydrate';
|
|
5
|
+
export type { HydrateOptions, HydrateProps, HydrationInteractionEvent, HydrationInteractionEvents, HydrationPrefetchStrategy, HydrationStrategy, HydrationWhen, } from '@tanstack/solid-start-client/Hydrate';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { useServerFn } from "./useServerFn.js";
|
|
2
|
+
import { createClientOnlyFn, createCsrfMiddleware, createIsomorphicFn, createMiddleware, createServerFn, createServerOnlyFn, createStart } from "@tanstack/start-client-core";
|
|
3
|
+
import { Hydrate } from "@tanstack/solid-start-client/Hydrate";
|
|
2
4
|
export * from "@tanstack/start-client-core";
|
|
3
|
-
export { useServerFn };
|
|
5
|
+
export { Hydrate, createClientOnlyFn, createCsrfMiddleware, createIsomorphicFn, createMiddleware, createServerFn, createServerOnlyFn, createStart, useServerFn };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { solidStartDefaultEntryPaths } 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 basePlugin = tanStackStartRsbuild({
|
|
6
|
+
framework: "solid",
|
|
7
|
+
defaultEntryPaths: solidStartDefaultEntryPaths,
|
|
8
|
+
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
|
|
9
|
+
ssrIsProvider: true,
|
|
10
|
+
rsbuild: { environments: { all: { resolve: { conditionNames: ["solid", "..."] } } } }
|
|
11
|
+
}, options);
|
|
12
|
+
return {
|
|
13
|
+
name: "tanstack-solid-start-rsbuild",
|
|
14
|
+
setup(api) {
|
|
15
|
+
basePlugin.setup(api);
|
|
16
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {
|
|
17
|
+
for (const ruleId of [
|
|
18
|
+
CHAIN_ID.RULE.JS,
|
|
19
|
+
CHAIN_ID.RULE.JS_DATA_URI,
|
|
20
|
+
"babel-js"
|
|
21
|
+
]) {
|
|
22
|
+
if (!chain.module.rules.has(ruleId)) continue;
|
|
23
|
+
const rule = chain.module.rule(ruleId);
|
|
24
|
+
if (!rule.uses.has(CHAIN_ID.USE.BABEL)) continue;
|
|
25
|
+
rule.use(CHAIN_ID.USE.BABEL).tap((babelOptions) => {
|
|
26
|
+
babelOptions.presets = (babelOptions.presets ?? []).map((preset) => {
|
|
27
|
+
if (Array.isArray(preset) && typeof preset[0] === "string" && preset[0].includes("babel-preset-solid")) return [preset[0], {
|
|
28
|
+
...preset[1] ?? {},
|
|
29
|
+
hydratable: true,
|
|
30
|
+
generate: target === "node" ? "ssr" : "dom"
|
|
31
|
+
}];
|
|
32
|
+
return preset;
|
|
33
|
+
});
|
|
34
|
+
return babelOptions;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { tanstackStart };
|
|
43
|
+
|
|
44
|
+
//# 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 { solidStartDefaultEntryPaths } 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,\n): RsbuildPlugin {\n const corePluginOpts: TanStackStartRsbuildPluginCoreOptions = {\n framework: 'solid',\n defaultEntryPaths: solidStartDefaultEntryPaths,\n providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,\n ssrIsProvider: true,\n rsbuild: {\n environments: {\n all: {\n resolve: {\n conditionNames: ['solid', '...'],\n },\n },\n },\n },\n }\n\n const basePlugin = tanStackStartRsbuild(corePluginOpts, options)\n\n return {\n name: 'tanstack-solid-start-rsbuild',\n setup(api) {\n basePlugin.setup(api)\n\n api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {\n for (const ruleId of [\n CHAIN_ID.RULE.JS,\n CHAIN_ID.RULE.JS_DATA_URI,\n 'babel-js',\n ]) {\n if (!chain.module.rules.has(ruleId)) {\n continue\n }\n\n const rule = chain.module.rule(ruleId)\n if (!rule.uses.has(CHAIN_ID.USE.BABEL)) {\n continue\n }\n\n rule.use(CHAIN_ID.USE.BABEL).tap((babelOptions) => {\n babelOptions.presets = (babelOptions.presets ?? []).map(\n (preset: unknown) => {\n if (\n Array.isArray(preset) &&\n typeof preset[0] === 'string' &&\n preset[0].includes('babel-preset-solid')\n ) {\n return [\n preset[0],\n {\n ...(preset[1] ?? {}),\n hydratable: true,\n generate: target === 'node' ? 'ssr' : 'dom',\n },\n ]\n }\n\n return preset\n },\n )\n\n return babelOptions\n })\n }\n })\n },\n }\n}\n"],"mappings":";;;AAWA,SAAgB,cACd,SACe;CAiBf,MAAM,aAAa,qBAAqB;EAftC,WAAW;EACX,mBAAmB;EACnB,yBAAyB,0BAA0B;EACnD,eAAe;EACf,SAAS,EACP,cAAc,EACZ,KAAK,EACH,SAAS,EACP,gBAAgB,CAAC,SAAS,KAAK,EACjC,EACF,EACF,EACF;CAGsC,GAAgB,OAAO;CAE/D,OAAO;EACL,MAAM;EACN,MAAM,KAAK;GACT,WAAW,MAAM,GAAG;GAEpB,IAAI,mBAAmB,OAAO,OAAO,EAAE,UAAU,aAAa;IAC5D,KAAK,MAAM,UAAU;KACnB,SAAS,KAAK;KACd,SAAS,KAAK;KACd;IACF,GAAG;KACD,IAAI,CAAC,MAAM,OAAO,MAAM,IAAI,MAAM,GAChC;KAGF,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM;KACrC,IAAI,CAAC,KAAK,KAAK,IAAI,SAAS,IAAI,KAAK,GACnC;KAGF,KAAK,IAAI,SAAS,IAAI,KAAK,EAAE,KAAK,iBAAiB;MACjD,aAAa,WAAW,aAAa,WAAW,CAAC,GAAG,KACjD,WAAoB;OACnB,IACE,MAAM,QAAQ,MAAM,KACpB,OAAO,OAAO,OAAO,YACrB,OAAO,GAAG,SAAS,oBAAoB,GAEvC,OAAO,CACL,OAAO,IACP;QACE,GAAI,OAAO,MAAM,CAAC;QAClB,YAAY;QACZ,UAAU,WAAW,SAAS,QAAQ;OACxC,CACF;OAGF,OAAO;MACT,CACF;MAEA,OAAO;KACT,CAAC;IACH;GACF,CAAC;EACH;CACF;AACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import path from "pathe";
|
|
3
|
+
//#region src/plugin/shared.ts
|
|
4
|
+
var currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
var defaultEntryDir = path.resolve(currentDir, "..", "..", "plugin", "default-entry");
|
|
6
|
+
var solidStartDefaultEntryPaths = {
|
|
7
|
+
client: path.resolve(defaultEntryDir, "client.tsx"),
|
|
8
|
+
server: path.resolve(defaultEntryDir, "server.ts"),
|
|
9
|
+
start: path.resolve(defaultEntryDir, "start.ts")
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { solidStartDefaultEntryPaths };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","names":[],"sources":["../../../src/plugin/shared.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url'\nimport path from 'pathe'\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url))\nconst defaultEntryDir = path.resolve(\n currentDir,\n '..',\n '..',\n 'plugin',\n 'default-entry',\n)\n\nexport const solidStartDefaultEntryPaths = {\n client: path.resolve(defaultEntryDir, 'client.tsx'),\n server: path.resolve(defaultEntryDir, 'server.ts'),\n start: path.resolve(defaultEntryDir, 'start.ts'),\n}\n"],"mappings":";;;AAGA,IAAM,aAAa,KAAK,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC;AAC9D,IAAM,kBAAkB,KAAK,QAC3B,YACA,MACA,MACA,UACA,eACF;AAEA,IAAa,8BAA8B;CACzC,QAAQ,KAAK,QAAQ,iBAAiB,YAAY;CAClD,QAAQ,KAAK,QAAQ,iBAAiB,WAAW;CACjD,OAAO,KAAK,QAAQ,iBAAiB,UAAU;AACjD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TanStackStartViteInputConfig } from '@tanstack/start-plugin-core/vite';
|
|
2
2
|
import { PluginOption } from 'vite';
|
|
3
|
-
export declare function tanstackStart(options?:
|
|
3
|
+
export declare function tanstackStart(options?: TanStackStartViteInputConfig): Array<PluginOption>;
|
package/dist/esm/plugin/vite.js
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import path from "pathe";
|
|
1
|
+
import { solidStartDefaultEntryPaths } from "./shared.js";
|
|
2
|
+
import { START_ENVIRONMENT_NAMES, tanStackStartVite } from "@tanstack/start-plugin-core/vite";
|
|
4
3
|
//#region src/plugin/vite.ts
|
|
5
|
-
var currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
var defaultEntryDir = path.resolve(currentDir, "..", "..", "plugin", "default-entry");
|
|
7
|
-
var defaultEntryPaths = {
|
|
8
|
-
client: path.resolve(defaultEntryDir, "client.tsx"),
|
|
9
|
-
server: path.resolve(defaultEntryDir, "server.ts"),
|
|
10
|
-
start: path.resolve(defaultEntryDir, "start.ts")
|
|
11
|
-
};
|
|
12
4
|
function tanstackStart(options) {
|
|
13
5
|
return [{
|
|
14
6
|
name: "tanstack-solid-start:config",
|
|
15
7
|
config() {
|
|
16
|
-
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
return {
|
|
9
|
+
resolve: { dedupe: [
|
|
10
|
+
"solid-js",
|
|
11
|
+
"@solidjs/web",
|
|
12
|
+
"@solidjs/signals"
|
|
13
|
+
] },
|
|
14
|
+
ssr: { noExternal: [
|
|
15
|
+
"@tanstack/solid-router-ssr-query",
|
|
16
|
+
"@tanstack/solid-query",
|
|
17
|
+
"@tanstack/solid-query-devtools"
|
|
18
|
+
] }
|
|
19
|
+
};
|
|
21
20
|
},
|
|
22
21
|
configEnvironment(environmentName, options) {
|
|
23
|
-
return { optimizeDeps: environmentName ===
|
|
22
|
+
return { optimizeDeps: environmentName === START_ENVIRONMENT_NAMES.client || environmentName === START_ENVIRONMENT_NAMES.server && options.optimizeDeps?.noDiscovery === false ? { exclude: [
|
|
24
23
|
"@tanstack/solid-start",
|
|
25
24
|
"@tanstack/solid-router",
|
|
26
25
|
"@tanstack/start-static-server-functions"
|
|
27
26
|
] } : void 0 };
|
|
28
27
|
}
|
|
29
|
-
},
|
|
28
|
+
}, tanStackStartVite({
|
|
30
29
|
framework: "solid",
|
|
31
|
-
defaultEntryPaths
|
|
30
|
+
defaultEntryPaths: solidStartDefaultEntryPaths,
|
|
31
|
+
providerEnvironmentName: START_ENVIRONMENT_NAMES.server,
|
|
32
|
+
ssrIsProvider: true,
|
|
33
|
+
ssrResolverStrategy: { type: "default" }
|
|
32
34
|
}, options)];
|
|
33
35
|
}
|
|
34
36
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":[],"sources":["../../../src/plugin/vite.ts"],"sourcesContent":["import {
|
|
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 { solidStartDefaultEntryPaths } from './shared'\nimport type { PluginOption } from 'vite'\n\nexport function tanstackStart(\n options?: TanStackStartViteInputConfig,\n): Array<PluginOption> {\n const corePluginOpts: TanStackStartVitePluginCoreOptions = {\n framework: 'solid',\n defaultEntryPaths: solidStartDefaultEntryPaths,\n providerEnvironmentName: START_ENVIRONMENT_NAMES.server,\n ssrIsProvider: true,\n ssrResolverStrategy: {\n type: 'default',\n },\n }\n\n return [\n {\n name: 'tanstack-solid-start:config',\n config() {\n // Ensure a single copy of Solid runtime packages is used across the\n // app, the router, and the auto-injected default client/server entries.\n // Without this, mixed pnpm resolutions (e.g. `@solidjs/web` beta.6\n // linked into `@tanstack/solid-start`'s node_modules vs. beta.7 in the\n // user's project) cause two parallel runtimes to be bundled. Two\n // `_$HY.done` setters then race, causing `hydrate()` to early-return\n // into non-hydrating render mode and breaking client interactivity.\n return {\n resolve: {\n dedupe: ['solid-js', '@solidjs/web', '@solidjs/signals'],\n },\n ssr: {\n noExternal: [\n '@tanstack/solid-router-ssr-query',\n '@tanstack/solid-query',\n '@tanstack/solid-query-devtools',\n ],\n },\n }\n },\n configEnvironment(environmentName, options) {\n return {\n optimizeDeps:\n environmentName === START_ENVIRONMENT_NAMES.client ||\n (environmentName === START_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/solid-start` depends on `@tanstack/solid-router`, we should exclude both.\n exclude: [\n '@tanstack/solid-start',\n '@tanstack/solid-router',\n '@tanstack/start-static-server-functions',\n ],\n }\n : undefined,\n }\n },\n },\n tanStackStartVite(corePluginOpts, options),\n ]\n}\n"],"mappings":";;;AAWA,SAAgB,cACd,SACqB;CAWrB,OAAO,CACL;EACE,MAAM;EACN,SAAS;GAQP,OAAO;IACL,SAAS,EACP,QAAQ;KAAC;KAAY;KAAgB;IAAkB,EACzD;IACA,KAAK,EACH,YAAY;KACV;KACA;KACA;IACF,EACF;GACF;EACF;EACA,kBAAkB,iBAAiB,SAAS;GAC1C,OAAO,EACL,cACE,oBAAoB,wBAAwB,UAC3C,oBAAoB,wBAAwB,UAE3C,QAAQ,cAAc,gBAAgB,QACpC,EAEE,SAAS;IACP;IACA;IACA;GACF,EACF,IACA,KAAA,EACR;EACF;CACF,GACA,kBAAkB;EApDlB,WAAW;EACX,mBAAmB;EACnB,yBAAyB,wBAAwB;EACjD,eAAe;EACf,qBAAqB,EACnB,MAAM,UACR;CA8CkB,GAAgB,OAAO,CAC3C;AACF"}
|
package/dist/esm/useServerFn.js
CHANGED
|
@@ -9,7 +9,7 @@ function useServerFn(serverFn) {
|
|
|
9
9
|
return res;
|
|
10
10
|
} catch (err) {
|
|
11
11
|
if (isRedirect(err)) {
|
|
12
|
-
err.options._fromLocation = router.stores.location.
|
|
12
|
+
err.options._fromLocation = router.stores.location.get();
|
|
13
13
|
return router.navigate(router.resolveRedirect(err).options);
|
|
14
14
|
}
|
|
15
15
|
throw err;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useServerFn.js","names":[],"sources":["../../src/useServerFn.ts"],"sourcesContent":["import { isRedirect, useRouter } from '@tanstack/solid-router'\n\nexport function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(\n serverFn: T,\n): (...args: Parameters<T>) => ReturnType<T> {\n const router = useRouter()\n\n return (async (...args: Array<any>) => {\n try {\n const res = await serverFn(...args)\n\n if (isRedirect(res)) {\n throw res\n }\n\n return res\n } catch (err) {\n if (isRedirect(err)) {\n err.options._fromLocation = router.stores.location.
|
|
1
|
+
{"version":3,"file":"useServerFn.js","names":[],"sources":["../../src/useServerFn.ts"],"sourcesContent":["import { isRedirect, useRouter } from '@tanstack/solid-router'\n\nexport function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(\n serverFn: T,\n): (...args: Parameters<T>) => ReturnType<T> {\n const router = useRouter()\n\n return (async (...args: Array<any>) => {\n try {\n const res = await serverFn(...args)\n\n if (isRedirect(res)) {\n throw res\n }\n\n return res\n } catch (err) {\n if (isRedirect(err)) {\n err.options._fromLocation = router.stores.location.get()\n return router.navigate(router.resolveRedirect(err).options)\n }\n\n throw err\n }\n }) as any\n}\n"],"mappings":";;AAEA,SAAgB,YACd,UAC2C;CAC3C,MAAM,SAAS,UAAU;CAEzB,QAAQ,OAAO,GAAG,SAAqB;EACrC,IAAI;GACF,MAAM,MAAM,MAAM,SAAS,GAAG,IAAI;GAElC,IAAI,WAAW,GAAG,GAChB,MAAM;GAGR,OAAO;EACT,SAAS,KAAK;GACZ,IAAI,WAAW,GAAG,GAAG;IACnB,IAAI,QAAQ,gBAAgB,OAAO,OAAO,SAAS,IAAI;IACvD,OAAO,OAAO,SAAS,OAAO,gBAAgB,GAAG,EAAE,OAAO;GAC5D;GAEA,MAAM;EACR;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-start",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.21",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,6 +38,12 @@
|
|
|
38
38
|
"default": "./dist/esm/client.js"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
+
"./hydration": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/esm/hydration.d.ts",
|
|
44
|
+
"default": "./dist/esm/hydration.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
41
47
|
"./client-rpc": {
|
|
42
48
|
"import": {
|
|
43
49
|
"types": "./dist/esm/client-rpc.d.ts",
|
|
@@ -68,6 +74,12 @@
|
|
|
68
74
|
"default": "./dist/esm/plugin/vite.js"
|
|
69
75
|
}
|
|
70
76
|
},
|
|
77
|
+
"./plugin/rsbuild": {
|
|
78
|
+
"import": {
|
|
79
|
+
"types": "./dist/esm/plugin/rsbuild.d.ts",
|
|
80
|
+
"default": "./dist/esm/plugin/rsbuild.js"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
71
83
|
"./server-entry": {
|
|
72
84
|
"import": {
|
|
73
85
|
"types": "./dist/default-entry/esm/server.d.ts",
|
|
@@ -101,28 +113,34 @@
|
|
|
101
113
|
},
|
|
102
114
|
"dependencies": {
|
|
103
115
|
"pathe": "^2.0.3",
|
|
104
|
-
"@tanstack/solid-
|
|
105
|
-
"@tanstack/solid-
|
|
106
|
-
"@tanstack/solid-start-server": "2.0.0-beta.
|
|
107
|
-
"@tanstack/start-client-core": "1.
|
|
108
|
-
"@tanstack/start-plugin-core": "1.
|
|
109
|
-
"@tanstack/start-server-core": "1.
|
|
116
|
+
"@tanstack/solid-router": "2.0.0-beta.20",
|
|
117
|
+
"@tanstack/solid-start-client": "2.0.0-beta.20",
|
|
118
|
+
"@tanstack/solid-start-server": "2.0.0-beta.20",
|
|
119
|
+
"@tanstack/start-client-core": "1.170.6",
|
|
120
|
+
"@tanstack/start-plugin-core": "1.171.10",
|
|
121
|
+
"@tanstack/start-server-core": "1.169.8"
|
|
110
122
|
},
|
|
111
123
|
"devDependencies": {
|
|
124
|
+
"@rsbuild/core": "^2.0.8",
|
|
112
125
|
"@solidjs/web": "2.0.0-beta.14",
|
|
113
|
-
"@tanstack/intent": "^0.0.14",
|
|
114
126
|
"@types/node": ">=20",
|
|
115
127
|
"solid-js": "2.0.0-beta.14",
|
|
116
128
|
"vite": "*",
|
|
117
|
-
"@tanstack/router-utils": "1.
|
|
129
|
+
"@tanstack/router-utils": "1.162.1"
|
|
118
130
|
},
|
|
119
131
|
"peerDependencies": {
|
|
120
132
|
"@solidjs/web": ">=2.0.0-0 <3.0.0",
|
|
121
133
|
"solid-js": ">=2.0.0-0 <3.0.0",
|
|
122
|
-
"vite": ">=7.0.0"
|
|
134
|
+
"vite": ">=7.0.0",
|
|
135
|
+
"@rsbuild/core": "^2.0.0"
|
|
123
136
|
},
|
|
124
|
-
"
|
|
125
|
-
"
|
|
137
|
+
"peerDependenciesMeta": {
|
|
138
|
+
"@rsbuild/core": {
|
|
139
|
+
"optional": true
|
|
140
|
+
},
|
|
141
|
+
"vite": {
|
|
142
|
+
"optional": true
|
|
143
|
+
}
|
|
126
144
|
},
|
|
127
145
|
"scripts": {
|
|
128
146
|
"clean": "rimraf ./dist && rimraf ./coverage",
|
package/src/hydration.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export {
|
|
2
|
+
condition,
|
|
3
|
+
idle,
|
|
4
|
+
interaction,
|
|
5
|
+
load,
|
|
6
|
+
media,
|
|
7
|
+
never,
|
|
8
|
+
visible,
|
|
9
|
+
} from '@tanstack/solid-start-client/hydration'
|
|
10
|
+
export type {
|
|
11
|
+
HydrationCondition,
|
|
12
|
+
HydrationInteractionEvent,
|
|
13
|
+
HydrationInteractionEvents,
|
|
14
|
+
HydrationPrefetchStrategy,
|
|
15
|
+
HydrationStrategy,
|
|
16
|
+
HydrationWhen,
|
|
17
|
+
VisibleHydrationOptions,
|
|
18
|
+
} from '@tanstack/solid-start-client/hydration'
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,34 @@
|
|
|
1
1
|
export { useServerFn } from './useServerFn'
|
|
2
2
|
export * from '@tanstack/start-client-core'
|
|
3
|
+
// Explicit re-exports shadow `export *` above so these public-API names are
|
|
4
|
+
// registered on the namespace at link time (via Vite SSR's `defineExport`
|
|
5
|
+
// at fileStartIndex), surviving the cold-start SSR cycle through user
|
|
6
|
+
// middleware. See vitejs/vite#22491 / #22493. Trim list to genuine public
|
|
7
|
+
// API only; internals fall through `export *` and are safe because they
|
|
8
|
+
// aren't imported at top level in the cycle path.
|
|
9
|
+
export {
|
|
10
|
+
createClientOnlyFn,
|
|
11
|
+
createCsrfMiddleware,
|
|
12
|
+
createIsomorphicFn,
|
|
13
|
+
createMiddleware,
|
|
14
|
+
createServerFn,
|
|
15
|
+
createServerOnlyFn,
|
|
16
|
+
createStart,
|
|
17
|
+
} from '@tanstack/start-client-core'
|
|
18
|
+
|
|
19
|
+
// Keep root `@tanstack/solid-start` imports from evaluating the client barrel.
|
|
20
|
+
// The barrel also exports `hydrateStart`, which imports the virtual client
|
|
21
|
+
// entry. That virtual entry imports the user's router module, so route modules
|
|
22
|
+
// that import the root package can be pulled back into the same graph and
|
|
23
|
+
// create circular HMR updates. Re-exporting from the Hydrate-only subpath
|
|
24
|
+
// preserves the public API without introducing that import edge.
|
|
25
|
+
export { Hydrate } from '@tanstack/solid-start-client/Hydrate'
|
|
26
|
+
export type {
|
|
27
|
+
HydrateOptions,
|
|
28
|
+
HydrateProps,
|
|
29
|
+
HydrationInteractionEvent,
|
|
30
|
+
HydrationInteractionEvents,
|
|
31
|
+
HydrationPrefetchStrategy,
|
|
32
|
+
HydrationStrategy,
|
|
33
|
+
HydrationWhen,
|
|
34
|
+
} from '@tanstack/solid-start-client/Hydrate'
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RSBUILD_ENVIRONMENT_NAMES,
|
|
3
|
+
tanStackStartRsbuild,
|
|
4
|
+
} from '@tanstack/start-plugin-core/rsbuild'
|
|
5
|
+
import { solidStartDefaultEntryPaths } 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,
|
|
14
|
+
): RsbuildPlugin {
|
|
15
|
+
const corePluginOpts: TanStackStartRsbuildPluginCoreOptions = {
|
|
16
|
+
framework: 'solid',
|
|
17
|
+
defaultEntryPaths: solidStartDefaultEntryPaths,
|
|
18
|
+
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
|
|
19
|
+
ssrIsProvider: true,
|
|
20
|
+
rsbuild: {
|
|
21
|
+
environments: {
|
|
22
|
+
all: {
|
|
23
|
+
resolve: {
|
|
24
|
+
conditionNames: ['solid', '...'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const basePlugin = tanStackStartRsbuild(corePluginOpts, options)
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
name: 'tanstack-solid-start-rsbuild',
|
|
35
|
+
setup(api) {
|
|
36
|
+
basePlugin.setup(api)
|
|
37
|
+
|
|
38
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {
|
|
39
|
+
for (const ruleId of [
|
|
40
|
+
CHAIN_ID.RULE.JS,
|
|
41
|
+
CHAIN_ID.RULE.JS_DATA_URI,
|
|
42
|
+
'babel-js',
|
|
43
|
+
]) {
|
|
44
|
+
if (!chain.module.rules.has(ruleId)) {
|
|
45
|
+
continue
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const rule = chain.module.rule(ruleId)
|
|
49
|
+
if (!rule.uses.has(CHAIN_ID.USE.BABEL)) {
|
|
50
|
+
continue
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
rule.use(CHAIN_ID.USE.BABEL).tap((babelOptions) => {
|
|
54
|
+
babelOptions.presets = (babelOptions.presets ?? []).map(
|
|
55
|
+
(preset: unknown) => {
|
|
56
|
+
if (
|
|
57
|
+
Array.isArray(preset) &&
|
|
58
|
+
typeof preset[0] === 'string' &&
|
|
59
|
+
preset[0].includes('babel-preset-solid')
|
|
60
|
+
) {
|
|
61
|
+
return [
|
|
62
|
+
preset[0],
|
|
63
|
+
{
|
|
64
|
+
...(preset[1] ?? {}),
|
|
65
|
+
hydratable: true,
|
|
66
|
+
generate: target === 'node' ? 'ssr' : 'dom',
|
|
67
|
+
},
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return preset
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
return babelOptions
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import path from 'pathe'
|
|
3
|
+
|
|
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
|
+
|
|
13
|
+
export const solidStartDefaultEntryPaths = {
|
|
14
|
+
client: path.resolve(defaultEntryDir, 'client.tsx'),
|
|
15
|
+
server: path.resolve(defaultEntryDir, 'server.ts'),
|
|
16
|
+
start: path.resolve(defaultEntryDir, 'start.ts'),
|
|
17
|
+
}
|
package/src/plugin/vite.ts
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url'
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from '@tanstack/start-plugin-core'
|
|
6
|
-
import
|
|
7
|
-
|
|
2
|
+
START_ENVIRONMENT_NAMES,
|
|
3
|
+
tanStackStartVite,
|
|
4
|
+
} from '@tanstack/start-plugin-core/vite'
|
|
5
|
+
import type {
|
|
6
|
+
TanStackStartViteInputConfig,
|
|
7
|
+
TanStackStartVitePluginCoreOptions,
|
|
8
|
+
} from '@tanstack/start-plugin-core/vite'
|
|
9
|
+
import { solidStartDefaultEntryPaths } from './shared'
|
|
8
10
|
import type { PluginOption } from 'vite'
|
|
9
11
|
|
|
10
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
|
11
|
-
const defaultEntryDir = path.resolve(
|
|
12
|
-
currentDir,
|
|
13
|
-
'..',
|
|
14
|
-
'..',
|
|
15
|
-
'plugin',
|
|
16
|
-
'default-entry',
|
|
17
|
-
)
|
|
18
|
-
const defaultEntryPaths = {
|
|
19
|
-
client: path.resolve(defaultEntryDir, 'client.tsx'),
|
|
20
|
-
server: path.resolve(defaultEntryDir, 'server.ts'),
|
|
21
|
-
start: path.resolve(defaultEntryDir, 'start.ts'),
|
|
22
|
-
}
|
|
23
|
-
|
|
24
12
|
export function tanstackStart(
|
|
25
|
-
options?:
|
|
13
|
+
options?: TanStackStartViteInputConfig,
|
|
26
14
|
): Array<PluginOption> {
|
|
15
|
+
const corePluginOpts: TanStackStartVitePluginCoreOptions = {
|
|
16
|
+
framework: 'solid',
|
|
17
|
+
defaultEntryPaths: solidStartDefaultEntryPaths,
|
|
18
|
+
providerEnvironmentName: START_ENVIRONMENT_NAMES.server,
|
|
19
|
+
ssrIsProvider: true,
|
|
20
|
+
ssrResolverStrategy: {
|
|
21
|
+
type: 'default',
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
27
25
|
return [
|
|
28
26
|
{
|
|
29
27
|
name: 'tanstack-solid-start:config',
|
|
@@ -39,13 +37,20 @@ export function tanstackStart(
|
|
|
39
37
|
resolve: {
|
|
40
38
|
dedupe: ['solid-js', '@solidjs/web', '@solidjs/signals'],
|
|
41
39
|
},
|
|
40
|
+
ssr: {
|
|
41
|
+
noExternal: [
|
|
42
|
+
'@tanstack/solid-router-ssr-query',
|
|
43
|
+
'@tanstack/solid-query',
|
|
44
|
+
'@tanstack/solid-query-devtools',
|
|
45
|
+
],
|
|
46
|
+
},
|
|
42
47
|
}
|
|
43
48
|
},
|
|
44
49
|
configEnvironment(environmentName, options) {
|
|
45
50
|
return {
|
|
46
51
|
optimizeDeps:
|
|
47
|
-
environmentName ===
|
|
48
|
-
(environmentName ===
|
|
52
|
+
environmentName === START_ENVIRONMENT_NAMES.client ||
|
|
53
|
+
(environmentName === START_ENVIRONMENT_NAMES.server &&
|
|
49
54
|
// This indicates that the server environment has opted in to dependency optimization
|
|
50
55
|
options.optimizeDeps?.noDiscovery === false)
|
|
51
56
|
? {
|
|
@@ -60,12 +65,6 @@ export function tanstackStart(
|
|
|
60
65
|
}
|
|
61
66
|
},
|
|
62
67
|
},
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
framework: 'solid',
|
|
66
|
-
defaultEntryPaths,
|
|
67
|
-
},
|
|
68
|
-
options,
|
|
69
|
-
),
|
|
68
|
+
tanStackStartVite(corePluginOpts, options),
|
|
70
69
|
]
|
|
71
70
|
}
|
package/src/useServerFn.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(
|
|
|
16
16
|
return res
|
|
17
17
|
} catch (err) {
|
|
18
18
|
if (isRedirect(err)) {
|
|
19
|
-
err.options._fromLocation = router.stores.location.
|
|
19
|
+
err.options._fromLocation = router.stores.location.get()
|
|
20
20
|
return router.navigate(router.resolveRedirect(err).options)
|
|
21
21
|
}
|
|
22
22
|
|
package/bin/intent.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Auto-generated by @tanstack/intent setup
|
|
3
|
-
// Exposes the intent end-user CLI for consumers of this library.
|
|
4
|
-
// Commit this file, then add to your package.json:
|
|
5
|
-
// "bin": { "intent": "./bin/intent.js" }
|
|
6
|
-
try {
|
|
7
|
-
await import('@tanstack/intent/intent-library')
|
|
8
|
-
} catch (e) {
|
|
9
|
-
const isModuleNotFound =
|
|
10
|
-
e?.code === 'ERR_MODULE_NOT_FOUND' || e?.code === 'MODULE_NOT_FOUND'
|
|
11
|
-
const missingIntentLibrary =
|
|
12
|
-
typeof e?.message === 'string' && e.message.includes('@tanstack/intent')
|
|
13
|
-
|
|
14
|
-
if (isModuleNotFound && missingIntentLibrary) {
|
|
15
|
-
console.error('@tanstack/intent is not installed.')
|
|
16
|
-
console.error('')
|
|
17
|
-
console.error('Install it as a dev dependency:')
|
|
18
|
-
console.error(' npm add -D @tanstack/intent')
|
|
19
|
-
console.error('')
|
|
20
|
-
console.error('Or run directly:')
|
|
21
|
-
console.error(' npx @tanstack/intent@latest list')
|
|
22
|
-
process.exit(1)
|
|
23
|
-
}
|
|
24
|
-
throw e
|
|
25
|
-
}
|