@tanstack/vue-start 0.0.1 → 1.141.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/default-entry/esm/server.d.ts +8 -0
- package/dist/default-entry/esm/server.js +15 -0
- package/dist/default-entry/esm/server.js.map +1 -0
- package/dist/default-entry/esm/start.d.ts +1 -0
- package/dist/esm/client-rpc.d.ts +1 -0
- package/dist/esm/client-rpc.js +2 -0
- package/dist/esm/client-rpc.js.map +1 -0
- package/dist/esm/client.d.ts +1 -0
- package/dist/esm/client.js +2 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/plugin/vite.d.ts +3 -0
- package/dist/esm/plugin/vite.js +47 -0
- package/dist/esm/plugin/vite.js.map +1 -0
- package/dist/esm/server-rpc.d.ts +1 -0
- package/dist/esm/server-rpc.js +5 -0
- package/dist/esm/server-rpc.js.map +1 -0
- package/dist/esm/server.d.ts +1 -0
- package/dist/esm/server.js +2 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/esm/ssr-rpc.d.ts +1 -0
- package/dist/esm/ssr-rpc.js +5 -0
- package/dist/esm/ssr-rpc.js.map +1 -0
- package/dist/esm/useServerFn.d.ts +1 -0
- package/dist/esm/useServerFn.js +23 -0
- package/dist/esm/useServerFn.js.map +1 -0
- package/dist/plugin/default-entry/client.tsx +16 -0
- package/dist/plugin/default-entry/server.ts +21 -0
- package/dist/plugin/default-entry/start.ts +1 -0
- package/package.json +109 -7
- package/src/client-rpc.ts +1 -0
- package/src/client.tsx +1 -0
- package/src/default-entry/client.tsx +16 -0
- package/src/default-entry/server.ts +21 -0
- package/src/default-entry/start.ts +1 -0
- package/src/index.ts +2 -0
- package/src/plugin/vite.ts +57 -0
- package/src/server-rpc.ts +1 -0
- package/src/server.tsx +1 -0
- package/src/ssr-rpc.ts +1 -0
- package/src/useServerFn.ts +26 -0
- package/README.md +0 -45
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Register } from '@tanstack/vue-router';
|
|
2
|
+
import { RequestHandler } from '@tanstack/vue-start/server';
|
|
3
|
+
export type ServerEntry = {
|
|
4
|
+
fetch: RequestHandler<Register>;
|
|
5
|
+
};
|
|
6
|
+
export declare function createServerEntry(entry: ServerEntry): ServerEntry;
|
|
7
|
+
declare const _default: ServerEntry;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createStartHandler, defaultStreamHandler } from "@tanstack/vue-start/server";
|
|
2
|
+
const fetch = createStartHandler(defaultStreamHandler);
|
|
3
|
+
function createServerEntry(entry) {
|
|
4
|
+
return {
|
|
5
|
+
async fetch(...args) {
|
|
6
|
+
return await entry.fetch(...args);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
const server = createServerEntry({ fetch });
|
|
11
|
+
export {
|
|
12
|
+
createServerEntry,
|
|
13
|
+
server as default
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../src/default-entry/server.ts"],"sourcesContent":["import {\n createStartHandler,\n defaultStreamHandler,\n} from '@tanstack/vue-start/server'\nimport type { Register } from '@tanstack/vue-router'\nimport type { RequestHandler } from '@tanstack/vue-start/server'\n\nconst fetch = createStartHandler(defaultStreamHandler)\n\n// Providing `RequestHandler` from `@tanstack/vue-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"],"names":[],"mappings":";AAOA,MAAM,QAAQ,mBAAmB,oBAAoB;AAK9C,SAAS,kBAAkB,OAAiC;AACjE,SAAO;AAAA,IACL,MAAM,SAAS,MAAM;AACnB,aAAO,MAAM,MAAM,MAAM,GAAG,IAAI;AAAA,IAClC;AAAA,EAAA;AAEJ;AAEA,MAAA,SAAe,kBAAkB,EAAE,OAAO;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const startInstance: undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/start-client-core/client-rpc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-rpc.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/vue-start-client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { TanStackStartVitePluginCore, VITE_ENVIRONMENT_NAMES } from "@tanstack/start-plugin-core";
|
|
3
|
+
import path from "pathe";
|
|
4
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
const defaultEntryDir = path.resolve(
|
|
6
|
+
currentDir,
|
|
7
|
+
"..",
|
|
8
|
+
"..",
|
|
9
|
+
"plugin",
|
|
10
|
+
"default-entry"
|
|
11
|
+
);
|
|
12
|
+
const defaultEntryPaths = {
|
|
13
|
+
client: path.resolve(defaultEntryDir, "client.tsx"),
|
|
14
|
+
server: path.resolve(defaultEntryDir, "server.ts"),
|
|
15
|
+
start: path.resolve(defaultEntryDir, "start.ts")
|
|
16
|
+
};
|
|
17
|
+
function tanstackStart(options) {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
name: "tanstack-vue-start:config",
|
|
21
|
+
configEnvironment(environmentName, options2) {
|
|
22
|
+
return {
|
|
23
|
+
optimizeDeps: environmentName === VITE_ENVIRONMENT_NAMES.client || environmentName === VITE_ENVIRONMENT_NAMES.server && // This indicates that the server environment has opted in to dependency optimization
|
|
24
|
+
options2.optimizeDeps?.noDiscovery === false ? {
|
|
25
|
+
// As `@tanstack/vue-start` depends on `@tanstack/vue-router`, we should exclude both.
|
|
26
|
+
exclude: [
|
|
27
|
+
"@tanstack/vue-start",
|
|
28
|
+
"@tanstack/vue-router",
|
|
29
|
+
"@tanstack/start-static-server-functions"
|
|
30
|
+
]
|
|
31
|
+
} : void 0
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
TanStackStartVitePluginCore(
|
|
36
|
+
{
|
|
37
|
+
framework: "vue",
|
|
38
|
+
defaultEntryPaths
|
|
39
|
+
},
|
|
40
|
+
options
|
|
41
|
+
)
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
tanstackStart
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=vite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.js","sources":["../../../src/plugin/vite.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url'\nimport {\n TanStackStartVitePluginCore,\n VITE_ENVIRONMENT_NAMES,\n} from '@tanstack/start-plugin-core'\nimport path from 'pathe'\nimport type { TanStackStartInputConfig } from '@tanstack/start-plugin-core'\nimport type { PluginOption } from 'vite'\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url))\nconst defaultEntryDir = path.resolve(\n currentDir,\n '..',\n '..',\n 'plugin',\n 'default-entry',\n)\nconst defaultEntryPaths = {\n client: path.resolve(defaultEntryDir, 'client.tsx'),\n server: path.resolve(defaultEntryDir, 'server.ts'),\n start: path.resolve(defaultEntryDir, 'start.ts'),\n}\n\nexport function tanstackStart(\n options?: TanStackStartInputConfig,\n): Array<PluginOption> {\n return [\n {\n name: 'tanstack-vue-start:config',\n configEnvironment(environmentName, options) {\n return {\n optimizeDeps:\n environmentName === VITE_ENVIRONMENT_NAMES.client ||\n (environmentName === VITE_ENVIRONMENT_NAMES.server &&\n // This indicates that the server environment has opted in to dependency optimization\n options.optimizeDeps?.noDiscovery === false)\n ? {\n // As `@tanstack/vue-start` depends on `@tanstack/vue-router`, we should exclude both.\n exclude: [\n '@tanstack/vue-start',\n '@tanstack/vue-router',\n '@tanstack/start-static-server-functions',\n ],\n }\n : undefined,\n }\n },\n },\n TanStackStartVitePluginCore(\n {\n framework: 'vue',\n defaultEntryPaths,\n },\n options,\n ),\n ]\n}\n"],"names":["options"],"mappings":";;;AASA,MAAM,aAAa,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC9D,MAAM,kBAAkB,KAAK;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,oBAAoB;AAAA,EACxB,QAAQ,KAAK,QAAQ,iBAAiB,YAAY;AAAA,EAClD,QAAQ,KAAK,QAAQ,iBAAiB,WAAW;AAAA,EACjD,OAAO,KAAK,QAAQ,iBAAiB,UAAU;AACjD;AAEO,SAAS,cACd,SACqB;AACrB,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,kBAAkB,iBAAiBA,UAAS;AAC1C,eAAO;AAAA,UACL,cACE,oBAAoB,uBAAuB,UAC1C,oBAAoB,uBAAuB;AAAA,UAE1CA,SAAQ,cAAc,gBAAgB,QACpC;AAAA;AAAA,YAEE,SAAS;AAAA,cACP;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,UACF,IAEF;AAAA,QAAA;AAAA,MAEV;AAAA,IAAA;AAAA,IAEF;AAAA,MACE;AAAA,QACE,WAAW;AAAA,QACX;AAAA,MAAA;AAAA,MAEF;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createServerRpc } from '@tanstack/start-server-core/createServerRpc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-rpc.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/vue-start-server';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSsrRpc } from '@tanstack/start-server-core/createSsrRpc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-rpc.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(serverFn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRouter, isRedirect } from "@tanstack/vue-router";
|
|
2
|
+
function useServerFn(serverFn) {
|
|
3
|
+
const router = useRouter();
|
|
4
|
+
return (async (...args) => {
|
|
5
|
+
try {
|
|
6
|
+
const res = await serverFn(...args);
|
|
7
|
+
if (isRedirect(res)) {
|
|
8
|
+
throw res;
|
|
9
|
+
}
|
|
10
|
+
return res;
|
|
11
|
+
} catch (err) {
|
|
12
|
+
if (isRedirect(err)) {
|
|
13
|
+
err.options._fromLocation = router.state.location;
|
|
14
|
+
return router.navigate(router.resolveRedirect(err).options);
|
|
15
|
+
}
|
|
16
|
+
throw err;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
useServerFn
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useServerFn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useServerFn.js","sources":["../../src/useServerFn.ts"],"sourcesContent":["import { isRedirect, useRouter } from '@tanstack/vue-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.state.location\n return router.navigate(router.resolveRedirect(err).options)\n }\n\n throw err\n }\n }) as any\n}\n"],"names":[],"mappings":";AAEO,SAAS,YACd,UAC2C;AAC3C,QAAM,SAAS,UAAA;AAEf,UAAQ,UAAU,SAAqB;AACrC,QAAI;AACF,YAAM,MAAM,MAAM,SAAS,GAAG,IAAI;AAElC,UAAI,WAAW,GAAG,GAAG;AACnB,cAAM;AAAA,MACR;AAEA,aAAO;AAAA,IACT,SAAS,KAAK;AACZ,UAAI,WAAW,GAAG,GAAG;AACnB,YAAI,QAAQ,gBAAgB,OAAO,MAAM;AACzC,eAAO,OAAO,SAAS,OAAO,gBAAgB,GAAG,EAAE,OAAO;AAAA,MAC5D;AAEA,YAAM;AAAA,IACR;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createSSRApp } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
StartClient,
|
|
4
|
+
configureHydrationSuppressions,
|
|
5
|
+
hydrateStart,
|
|
6
|
+
} from '@tanstack/vue-start/client'
|
|
7
|
+
|
|
8
|
+
hydrateStart().then((router) => {
|
|
9
|
+
const app = createSSRApp(StartClient, { router })
|
|
10
|
+
// Suppress expected hydration mismatch warnings for routes with ssr: false or 'data-only'
|
|
11
|
+
// Must be called before mount() - this uses Vue's warnHandler for dev mode warnings
|
|
12
|
+
configureHydrationSuppressions(app, router)
|
|
13
|
+
// Mount to #__app wrapper div for proper Vue hydration
|
|
14
|
+
// The Body component creates this wrapper on the server
|
|
15
|
+
app.mount('#__app')
|
|
16
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createStartHandler,
|
|
3
|
+
defaultStreamHandler,
|
|
4
|
+
} from '@tanstack/vue-start/server'
|
|
5
|
+
import type { Register } from '@tanstack/vue-router'
|
|
6
|
+
import type { RequestHandler } from '@tanstack/vue-start/server'
|
|
7
|
+
|
|
8
|
+
const fetch = createStartHandler(defaultStreamHandler)
|
|
9
|
+
|
|
10
|
+
// Providing `RequestHandler` from `@tanstack/vue-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`
|
|
11
|
+
export type ServerEntry = { fetch: RequestHandler<Register> }
|
|
12
|
+
|
|
13
|
+
export function createServerEntry(entry: ServerEntry): ServerEntry {
|
|
14
|
+
return {
|
|
15
|
+
async fetch(...args) {
|
|
16
|
+
return await entry.fetch(...args)
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default createServerEntry({ fetch })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const startInstance = undefined
|
package/package.json
CHANGED
|
@@ -1,10 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-start",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.141.0",
|
|
4
|
+
"description": "Modern and scalable routing for Vue applications",
|
|
5
|
+
"author": "Tanner Linsley",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/TanStack/router.git",
|
|
10
|
+
"directory": "packages/vue-start"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://tanstack.com/start",
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "github",
|
|
15
|
+
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
|
+
},
|
|
5
17
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
"vue",
|
|
19
|
+
"location",
|
|
20
|
+
"router",
|
|
21
|
+
"routing",
|
|
22
|
+
"async",
|
|
23
|
+
"async router",
|
|
24
|
+
"typescript"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"types": "dist/esm/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/esm/index.d.ts",
|
|
32
|
+
"default": "./dist/esm/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"./client": {
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/esm/client.d.ts",
|
|
38
|
+
"default": "./dist/esm/client.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./client-rpc": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/esm/client-rpc.d.ts",
|
|
44
|
+
"default": "./dist/esm/client-rpc.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"./server-rpc": {
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./dist/esm/server-rpc.d.ts",
|
|
50
|
+
"default": "./dist/esm/server-rpc.js"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"./ssr-rpc": {
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./dist/esm/ssr-rpc.d.ts",
|
|
56
|
+
"default": "./dist/esm/ssr-rpc.js"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"./server": {
|
|
60
|
+
"import": {
|
|
61
|
+
"types": "./dist/esm/server.d.ts",
|
|
62
|
+
"default": "./dist/esm/server.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"./plugin/vite": {
|
|
66
|
+
"import": {
|
|
67
|
+
"types": "./dist/esm/plugin/vite.d.ts",
|
|
68
|
+
"default": "./dist/esm/plugin/vite.js"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"./server-entry": {
|
|
72
|
+
"import": {
|
|
73
|
+
"types": "./dist/default-entry/esm/server.d.ts",
|
|
74
|
+
"default": "./dist/default-entry/esm/server.js"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"./package.json": "./package.json"
|
|
78
|
+
},
|
|
79
|
+
"sideEffects": false,
|
|
80
|
+
"files": [
|
|
81
|
+
"dist",
|
|
82
|
+
"src"
|
|
83
|
+
],
|
|
84
|
+
"engines": {
|
|
85
|
+
"node": ">=22.12.0"
|
|
86
|
+
},
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"pathe": "^2.0.3",
|
|
89
|
+
"@tanstack/vue-start-client": "1.141.0",
|
|
90
|
+
"@tanstack/start-plugin-core": "1.141.0",
|
|
91
|
+
"@tanstack/vue-start-server": "1.141.0",
|
|
92
|
+
"@tanstack/vue-router": "1.141.0",
|
|
93
|
+
"@tanstack/start-client-core": "1.141.0",
|
|
94
|
+
"@tanstack/start-server-core": "1.141.0"
|
|
95
|
+
},
|
|
96
|
+
"devDependencies": {
|
|
97
|
+
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
|
98
|
+
"vite": "^7.1.7",
|
|
99
|
+
"vue": "^3.5.25",
|
|
100
|
+
"@tanstack/router-utils": "1.141.0"
|
|
101
|
+
},
|
|
102
|
+
"peerDependencies": {
|
|
103
|
+
"vue": "^3.3.0",
|
|
104
|
+
"vite": ">=7.0.0"
|
|
105
|
+
},
|
|
106
|
+
"scripts": {
|
|
107
|
+
"clean": "rimraf ./dist && rimraf ./coverage",
|
|
108
|
+
"test": "pnpm test:build",
|
|
109
|
+
"test:build": "exit 0; vitest",
|
|
110
|
+
"build": "vite build && vite build -c vite.config.server-entry.ts"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/start-client-core/client-rpc'
|
package/src/client.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/vue-start-client'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createSSRApp } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
StartClient,
|
|
4
|
+
configureHydrationSuppressions,
|
|
5
|
+
hydrateStart,
|
|
6
|
+
} from '@tanstack/vue-start/client'
|
|
7
|
+
|
|
8
|
+
hydrateStart().then((router) => {
|
|
9
|
+
const app = createSSRApp(StartClient, { router })
|
|
10
|
+
// Suppress expected hydration mismatch warnings for routes with ssr: false or 'data-only'
|
|
11
|
+
// Must be called before mount() - this uses Vue's warnHandler for dev mode warnings
|
|
12
|
+
configureHydrationSuppressions(app, router)
|
|
13
|
+
// Mount to #__app wrapper div for proper Vue hydration
|
|
14
|
+
// The Body component creates this wrapper on the server
|
|
15
|
+
app.mount('#__app')
|
|
16
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createStartHandler,
|
|
3
|
+
defaultStreamHandler,
|
|
4
|
+
} from '@tanstack/vue-start/server'
|
|
5
|
+
import type { Register } from '@tanstack/vue-router'
|
|
6
|
+
import type { RequestHandler } from '@tanstack/vue-start/server'
|
|
7
|
+
|
|
8
|
+
const fetch = createStartHandler(defaultStreamHandler)
|
|
9
|
+
|
|
10
|
+
// Providing `RequestHandler` from `@tanstack/vue-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`
|
|
11
|
+
export type ServerEntry = { fetch: RequestHandler<Register> }
|
|
12
|
+
|
|
13
|
+
export function createServerEntry(entry: ServerEntry): ServerEntry {
|
|
14
|
+
return {
|
|
15
|
+
async fetch(...args) {
|
|
16
|
+
return await entry.fetch(...args)
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default createServerEntry({ fetch })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const startInstance = undefined
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import {
|
|
3
|
+
TanStackStartVitePluginCore,
|
|
4
|
+
VITE_ENVIRONMENT_NAMES,
|
|
5
|
+
} from '@tanstack/start-plugin-core'
|
|
6
|
+
import path from 'pathe'
|
|
7
|
+
import type { TanStackStartInputConfig } from '@tanstack/start-plugin-core'
|
|
8
|
+
import type { PluginOption } from 'vite'
|
|
9
|
+
|
|
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
|
+
export function tanstackStart(
|
|
25
|
+
options?: TanStackStartInputConfig,
|
|
26
|
+
): Array<PluginOption> {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
name: 'tanstack-vue-start:config',
|
|
30
|
+
configEnvironment(environmentName, options) {
|
|
31
|
+
return {
|
|
32
|
+
optimizeDeps:
|
|
33
|
+
environmentName === VITE_ENVIRONMENT_NAMES.client ||
|
|
34
|
+
(environmentName === VITE_ENVIRONMENT_NAMES.server &&
|
|
35
|
+
// This indicates that the server environment has opted in to dependency optimization
|
|
36
|
+
options.optimizeDeps?.noDiscovery === false)
|
|
37
|
+
? {
|
|
38
|
+
// As `@tanstack/vue-start` depends on `@tanstack/vue-router`, we should exclude both.
|
|
39
|
+
exclude: [
|
|
40
|
+
'@tanstack/vue-start',
|
|
41
|
+
'@tanstack/vue-router',
|
|
42
|
+
'@tanstack/start-static-server-functions',
|
|
43
|
+
],
|
|
44
|
+
}
|
|
45
|
+
: undefined,
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
TanStackStartVitePluginCore(
|
|
50
|
+
{
|
|
51
|
+
framework: 'vue',
|
|
52
|
+
defaultEntryPaths,
|
|
53
|
+
},
|
|
54
|
+
options,
|
|
55
|
+
),
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createServerRpc } from '@tanstack/start-server-core/createServerRpc'
|
package/src/server.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/vue-start-server'
|
package/src/ssr-rpc.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSsrRpc } from '@tanstack/start-server-core/createSsrRpc'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isRedirect, useRouter } from '@tanstack/vue-router'
|
|
2
|
+
|
|
3
|
+
export function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(
|
|
4
|
+
serverFn: T,
|
|
5
|
+
): (...args: Parameters<T>) => ReturnType<T> {
|
|
6
|
+
const router = useRouter()
|
|
7
|
+
|
|
8
|
+
return (async (...args: Array<any>) => {
|
|
9
|
+
try {
|
|
10
|
+
const res = await serverFn(...args)
|
|
11
|
+
|
|
12
|
+
if (isRedirect(res)) {
|
|
13
|
+
throw res
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return res
|
|
17
|
+
} catch (err) {
|
|
18
|
+
if (isRedirect(err)) {
|
|
19
|
+
err.options._fromLocation = router.state.location
|
|
20
|
+
return router.navigate(router.resolveRedirect(err).options)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
throw err
|
|
24
|
+
}
|
|
25
|
+
}) as any
|
|
26
|
+
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @tanstack/vue-start
|
|
2
|
-
|
|
3
|
-
## ⚠️ IMPORTANT NOTICE ⚠️
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@tanstack/vue-start`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|