@tanstack/vue-start-client 0.0.1 → 1.141.1
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/esm/StartClient.d.ts +21 -0
- package/dist/esm/StartClient.js +26 -0
- package/dist/esm/StartClient.js.map +1 -0
- package/dist/esm/hydrateStart.d.ts +19 -0
- package/dist/esm/hydrateStart.js +44 -0
- package/dist/esm/hydrateStart.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +74 -7
- package/src/StartClient.tsx +34 -0
- package/src/hydrateStart.ts +97 -0
- package/src/index.tsx +2 -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,21 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/router-core';
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
$_TSR?: {
|
|
6
|
+
cleanup?: () => void;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare const StartClient: Vue.DefineComponent<Vue.ExtractPropTypes<{
|
|
12
|
+
router: {
|
|
13
|
+
type: () => AnyRouter;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin, {}, string, Vue.PublicProps, Readonly<Vue.ExtractPropTypes<{
|
|
17
|
+
router: {
|
|
18
|
+
type: () => AnyRouter;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Vue from "vue";
|
|
2
|
+
import { createVNode } from "vue";
|
|
3
|
+
import { RouterProvider } from "@tanstack/vue-router";
|
|
4
|
+
const StartClient = Vue.defineComponent({
|
|
5
|
+
name: "StartClient",
|
|
6
|
+
props: {
|
|
7
|
+
router: {
|
|
8
|
+
type: Object,
|
|
9
|
+
required: true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
setup(props) {
|
|
13
|
+
Vue.onMounted(() => {
|
|
14
|
+
Vue.nextTick(() => {
|
|
15
|
+
window.$_TSR?.cleanup?.();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
return () => createVNode(RouterProvider, {
|
|
19
|
+
"router": props.router
|
|
20
|
+
}, null);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
StartClient
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=StartClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StartClient.js","sources":["../../src/StartClient.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { RouterProvider } from '@tanstack/vue-router'\nimport type { AnyRouter } from '@tanstack/router-core'\n\ndeclare global {\n interface Window {\n $_TSR?: {\n cleanup?: () => void\n [key: string]: unknown\n }\n }\n}\n\nexport const StartClient = Vue.defineComponent({\n name: 'StartClient',\n props: {\n router: {\n type: Object as () => AnyRouter,\n required: true,\n },\n },\n setup(props) {\n // After Vue hydration is complete, trigger cleanup of $tsr scripts\n // Use nextTick to ensure all child component onMounted hooks have completed\n // This prevents removing scripts before components have finished transitioning\n Vue.onMounted(() => {\n Vue.nextTick(() => {\n window.$_TSR?.cleanup?.()\n })\n })\n\n return () => <RouterProvider router={props.router} />\n },\n})\n"],"names":["StartClient","Vue","defineComponent","name","props","router","type","Object","required","setup","onMounted","nextTick","window","$_TSR","cleanup","_createVNode","RouterProvider"],"mappings":";;;MAaaA,cAAcC,IAAIC,gBAAgB;AAAA,EAC7CC,MAAM;AAAA,EACNC,OAAO;AAAA,IACLC,QAAQ;AAAA,MACNC,MAAMC;AAAAA,MACNC,UAAU;AAAA,IACZ;AAAA;EAEFC,MAAML,OAAO;AAIXH,QAAIS,UAAU,MAAM;AAClBT,UAAIU,SAAS,MAAM;AACjBC,eAAOC,OAAOC,UAAO;AAAA,MACvB,CAAC;AAAA,IACH,CAAC;AAED,WAAO,MAAAC,YAAAC,gBAAA;AAAA,MAAA,UAA8BZ,MAAMC;AAAAA,OAAM,IAAA;AAAA,EACnD;AACF,CAAC;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AnyRouter } from '@tanstack/router-core';
|
|
2
|
+
import { App } from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* Configure a Vue app to suppress expected hydration mismatch warnings
|
|
5
|
+
* for routes with ssr: false or ssr: 'data-only'
|
|
6
|
+
* Call this after createSSRApp and before app.mount()
|
|
7
|
+
*
|
|
8
|
+
* Note: We always suppress hydration warnings in Vue Start apps because:
|
|
9
|
+
* 1. Routes with ssr: 'data-only' or ssr: false cause expected mismatches
|
|
10
|
+
* 2. The ssr option is not reliably accessible from route.options for file-based routes
|
|
11
|
+
* 3. DevTools components also cause expected mismatches in development
|
|
12
|
+
* 4. In production builds, Vue strips these warnings anyway
|
|
13
|
+
*/
|
|
14
|
+
export declare function configureHydrationSuppressions(app: App, _router: AnyRouter): void;
|
|
15
|
+
/**
|
|
16
|
+
* Vue-specific wrapper for hydrateStart that installs hydration mismatch
|
|
17
|
+
* suppression for routes with ssr: false or ssr: 'data-only' before returning
|
|
18
|
+
*/
|
|
19
|
+
export declare function hydrateStart(): Promise<AnyRouter>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { hydrateStart as hydrateStart$1 } from "@tanstack/start-client-core/client";
|
|
2
|
+
function suppressSsrHydrationMismatches(_router) {
|
|
3
|
+
const originalWarn = console.warn;
|
|
4
|
+
const originalError = console.error;
|
|
5
|
+
const isHydrationMismatchMessage = (args) => {
|
|
6
|
+
for (const arg of args) {
|
|
7
|
+
if (typeof arg !== "string") continue;
|
|
8
|
+
if (arg.includes("Hydration completed but contains mismatches") || arg.includes("Hydration node mismatch") || arg.includes("Hydration text mismatch") || arg.includes("Hydration children mismatch") || arg.includes("Hydration class mismatch") || arg.includes("Hydration style mismatch") || arg.includes("Hydration attribute mismatch")) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
console.warn = (...args) => {
|
|
15
|
+
if (isHydrationMismatchMessage(args)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
originalWarn.apply(console, args);
|
|
19
|
+
};
|
|
20
|
+
console.error = (...args) => {
|
|
21
|
+
if (isHydrationMismatchMessage(args)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
originalError.apply(console, args);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function configureHydrationSuppressions(app, _router) {
|
|
28
|
+
app.config.warnHandler = (msg, _instance, _trace) => {
|
|
29
|
+
if (msg.includes("Hydration node mismatch") || msg.includes("Hydration text mismatch") || msg.includes("Hydration children mismatch") || msg.includes("Hydration class mismatch") || msg.includes("Hydration style mismatch") || msg.includes("Hydration attribute mismatch")) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.warn(`[Vue warn]: ${msg}`);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async function hydrateStart() {
|
|
36
|
+
const router = await hydrateStart$1();
|
|
37
|
+
suppressSsrHydrationMismatches();
|
|
38
|
+
return router;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
configureHydrationSuppressions,
|
|
42
|
+
hydrateStart
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=hydrateStart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrateStart.js","sources":["../../src/hydrateStart.ts"],"sourcesContent":["import { hydrateStart as coreHydrateStart } from '@tanstack/start-client-core/client'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type { App } from 'vue'\n\n/**\n * Suppress expected hydration mismatch warnings for routes with ssr: 'data-only' or ssr: false\n * These routes intentionally render different content on server vs client.\n *\n * Note: We always suppress hydration warnings in Vue Start apps because:\n * 1. Routes with ssr: 'data-only' or ssr: false cause expected mismatches\n * 2. The ssr option is not reliably accessible from route.options for file-based routes\n * 3. DevTools components also cause expected mismatches in development\n * 4. In production builds, Vue strips these warnings anyway\n */\nfunction suppressSsrHydrationMismatches(_router: AnyRouter): void {\n const originalWarn = console.warn\n const originalError = console.error\n\n const isHydrationMismatchMessage = (args: Array<unknown>): boolean => {\n // Check all args since Vue may pass message in different positions\n for (const arg of args) {\n if (typeof arg !== 'string') continue\n if (\n arg.includes('Hydration completed but contains mismatches') ||\n arg.includes('Hydration node mismatch') ||\n arg.includes('Hydration text mismatch') ||\n arg.includes('Hydration children mismatch') ||\n arg.includes('Hydration class mismatch') ||\n arg.includes('Hydration style mismatch') ||\n arg.includes('Hydration attribute mismatch')\n ) {\n return true\n }\n }\n return false\n }\n\n console.warn = (...args) => {\n if (isHydrationMismatchMessage(args)) {\n return // Suppress hydration warnings\n }\n originalWarn.apply(console, args)\n }\n\n console.error = (...args) => {\n if (isHydrationMismatchMessage(args)) {\n return // Suppress hydration warnings\n }\n originalError.apply(console, args)\n }\n}\n\n/**\n * Configure a Vue app to suppress expected hydration mismatch warnings\n * for routes with ssr: false or ssr: 'data-only'\n * Call this after createSSRApp and before app.mount()\n *\n * Note: We always suppress hydration warnings in Vue Start apps because:\n * 1. Routes with ssr: 'data-only' or ssr: false cause expected mismatches\n * 2. The ssr option is not reliably accessible from route.options for file-based routes\n * 3. DevTools components also cause expected mismatches in development\n * 4. In production builds, Vue strips these warnings anyway\n */\nexport function configureHydrationSuppressions(\n app: App,\n _router: AnyRouter,\n): void {\n // Always install the warnHandler to suppress hydration warnings\n // Vue's app.config.warnHandler intercepts dev warnings BEFORE console.warn\n app.config.warnHandler = (msg, _instance, _trace) => {\n // Suppress hydration mismatch warnings\n if (\n msg.includes('Hydration node mismatch') ||\n msg.includes('Hydration text mismatch') ||\n msg.includes('Hydration children mismatch') ||\n msg.includes('Hydration class mismatch') ||\n msg.includes('Hydration style mismatch') ||\n msg.includes('Hydration attribute mismatch')\n ) {\n return // Suppress the warning\n }\n // Let other warnings through to console\n console.warn(`[Vue warn]: ${msg}`)\n }\n}\n\n/**\n * Vue-specific wrapper for hydrateStart that installs hydration mismatch\n * suppression for routes with ssr: false or ssr: 'data-only' before returning\n */\nexport async function hydrateStart(): Promise<AnyRouter> {\n const router = await coreHydrateStart()\n // Install console suppression before app.mount() is called\n // This catches the \"Hydration completed but contains mismatches\" error\n suppressSsrHydrationMismatches(router)\n return router\n}\n"],"names":["coreHydrateStart"],"mappings":";AAcA,SAAS,+BAA+B,SAA0B;AAChE,QAAM,eAAe,QAAQ;AAC7B,QAAM,gBAAgB,QAAQ;AAE9B,QAAM,6BAA6B,CAAC,SAAkC;AAEpE,eAAW,OAAO,MAAM;AACtB,UAAI,OAAO,QAAQ,SAAU;AAC7B,UACE,IAAI,SAAS,6CAA6C,KAC1D,IAAI,SAAS,yBAAyB,KACtC,IAAI,SAAS,yBAAyB,KACtC,IAAI,SAAS,6BAA6B,KAC1C,IAAI,SAAS,0BAA0B,KACvC,IAAI,SAAS,0BAA0B,KACvC,IAAI,SAAS,8BAA8B,GAC3C;AACA,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAEA,UAAQ,OAAO,IAAI,SAAS;AAC1B,QAAI,2BAA2B,IAAI,GAAG;AACpC;AAAA,IACF;AACA,iBAAa,MAAM,SAAS,IAAI;AAAA,EAClC;AAEA,UAAQ,QAAQ,IAAI,SAAS;AAC3B,QAAI,2BAA2B,IAAI,GAAG;AACpC;AAAA,IACF;AACA,kBAAc,MAAM,SAAS,IAAI;AAAA,EACnC;AACF;AAaO,SAAS,+BACd,KACA,SACM;AAGN,MAAI,OAAO,cAAc,CAAC,KAAK,WAAW,WAAW;AAEnD,QACE,IAAI,SAAS,yBAAyB,KACtC,IAAI,SAAS,yBAAyB,KACtC,IAAI,SAAS,6BAA6B,KAC1C,IAAI,SAAS,0BAA0B,KACvC,IAAI,SAAS,0BAA0B,KACvC,IAAI,SAAS,8BAA8B,GAC3C;AACA;AAAA,IACF;AAEA,YAAQ,KAAK,eAAe,GAAG,EAAE;AAAA,EACnC;AACF;AAMA,eAAsB,eAAmC;AACvD,QAAM,SAAS,MAAMA,eAAA;AAGrB,iCAAqC;AACrC,SAAO;AACT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-start-client",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.141.1",
|
|
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-client"
|
|
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
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"sideEffects": false,
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"src"
|
|
41
|
+
],
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=22.12.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"tiny-invariant": "^1.3.3",
|
|
47
|
+
"tiny-warning": "^1.0.3",
|
|
48
|
+
"@tanstack/router-core": "1.141.1",
|
|
49
|
+
"@tanstack/start-client-core": "1.141.1",
|
|
50
|
+
"@tanstack/vue-router": "1.141.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@testing-library/vue": "^8.1.0",
|
|
54
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
55
|
+
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
|
56
|
+
"vue": "^3.5.25"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"vue": "^3.3.0"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"clean": "rimraf ./dist && rimraf ./coverage",
|
|
63
|
+
"test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
|
|
64
|
+
"test:unit": "exit 0; vitest",
|
|
65
|
+
"test:unit:dev": "vitest --watch",
|
|
66
|
+
"test:eslint": "eslint ./src",
|
|
67
|
+
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
|
|
68
|
+
"test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
|
|
69
|
+
"test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
|
|
70
|
+
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
|
|
71
|
+
"test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
|
|
72
|
+
"test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
|
|
73
|
+
"test:types:ts59": "tsc",
|
|
74
|
+
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
|
|
75
|
+
"build": "vite build"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as Vue from 'vue'
|
|
2
|
+
import { RouterProvider } from '@tanstack/vue-router'
|
|
3
|
+
import type { AnyRouter } from '@tanstack/router-core'
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
$_TSR?: {
|
|
8
|
+
cleanup?: () => void
|
|
9
|
+
[key: string]: unknown
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const StartClient = Vue.defineComponent({
|
|
15
|
+
name: 'StartClient',
|
|
16
|
+
props: {
|
|
17
|
+
router: {
|
|
18
|
+
type: Object as () => AnyRouter,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
setup(props) {
|
|
23
|
+
// After Vue hydration is complete, trigger cleanup of $tsr scripts
|
|
24
|
+
// Use nextTick to ensure all child component onMounted hooks have completed
|
|
25
|
+
// This prevents removing scripts before components have finished transitioning
|
|
26
|
+
Vue.onMounted(() => {
|
|
27
|
+
Vue.nextTick(() => {
|
|
28
|
+
window.$_TSR?.cleanup?.()
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return () => <RouterProvider router={props.router} />
|
|
33
|
+
},
|
|
34
|
+
})
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { hydrateStart as coreHydrateStart } from '@tanstack/start-client-core/client'
|
|
2
|
+
import type { AnyRouter } from '@tanstack/router-core'
|
|
3
|
+
import type { App } from 'vue'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Suppress expected hydration mismatch warnings for routes with ssr: 'data-only' or ssr: false
|
|
7
|
+
* These routes intentionally render different content on server vs client.
|
|
8
|
+
*
|
|
9
|
+
* Note: We always suppress hydration warnings in Vue Start apps because:
|
|
10
|
+
* 1. Routes with ssr: 'data-only' or ssr: false cause expected mismatches
|
|
11
|
+
* 2. The ssr option is not reliably accessible from route.options for file-based routes
|
|
12
|
+
* 3. DevTools components also cause expected mismatches in development
|
|
13
|
+
* 4. In production builds, Vue strips these warnings anyway
|
|
14
|
+
*/
|
|
15
|
+
function suppressSsrHydrationMismatches(_router: AnyRouter): void {
|
|
16
|
+
const originalWarn = console.warn
|
|
17
|
+
const originalError = console.error
|
|
18
|
+
|
|
19
|
+
const isHydrationMismatchMessage = (args: Array<unknown>): boolean => {
|
|
20
|
+
// Check all args since Vue may pass message in different positions
|
|
21
|
+
for (const arg of args) {
|
|
22
|
+
if (typeof arg !== 'string') continue
|
|
23
|
+
if (
|
|
24
|
+
arg.includes('Hydration completed but contains mismatches') ||
|
|
25
|
+
arg.includes('Hydration node mismatch') ||
|
|
26
|
+
arg.includes('Hydration text mismatch') ||
|
|
27
|
+
arg.includes('Hydration children mismatch') ||
|
|
28
|
+
arg.includes('Hydration class mismatch') ||
|
|
29
|
+
arg.includes('Hydration style mismatch') ||
|
|
30
|
+
arg.includes('Hydration attribute mismatch')
|
|
31
|
+
) {
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
console.warn = (...args) => {
|
|
39
|
+
if (isHydrationMismatchMessage(args)) {
|
|
40
|
+
return // Suppress hydration warnings
|
|
41
|
+
}
|
|
42
|
+
originalWarn.apply(console, args)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.error = (...args) => {
|
|
46
|
+
if (isHydrationMismatchMessage(args)) {
|
|
47
|
+
return // Suppress hydration warnings
|
|
48
|
+
}
|
|
49
|
+
originalError.apply(console, args)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Configure a Vue app to suppress expected hydration mismatch warnings
|
|
55
|
+
* for routes with ssr: false or ssr: 'data-only'
|
|
56
|
+
* Call this after createSSRApp and before app.mount()
|
|
57
|
+
*
|
|
58
|
+
* Note: We always suppress hydration warnings in Vue Start apps because:
|
|
59
|
+
* 1. Routes with ssr: 'data-only' or ssr: false cause expected mismatches
|
|
60
|
+
* 2. The ssr option is not reliably accessible from route.options for file-based routes
|
|
61
|
+
* 3. DevTools components also cause expected mismatches in development
|
|
62
|
+
* 4. In production builds, Vue strips these warnings anyway
|
|
63
|
+
*/
|
|
64
|
+
export function configureHydrationSuppressions(
|
|
65
|
+
app: App,
|
|
66
|
+
_router: AnyRouter,
|
|
67
|
+
): void {
|
|
68
|
+
// Always install the warnHandler to suppress hydration warnings
|
|
69
|
+
// Vue's app.config.warnHandler intercepts dev warnings BEFORE console.warn
|
|
70
|
+
app.config.warnHandler = (msg, _instance, _trace) => {
|
|
71
|
+
// Suppress hydration mismatch warnings
|
|
72
|
+
if (
|
|
73
|
+
msg.includes('Hydration node mismatch') ||
|
|
74
|
+
msg.includes('Hydration text mismatch') ||
|
|
75
|
+
msg.includes('Hydration children mismatch') ||
|
|
76
|
+
msg.includes('Hydration class mismatch') ||
|
|
77
|
+
msg.includes('Hydration style mismatch') ||
|
|
78
|
+
msg.includes('Hydration attribute mismatch')
|
|
79
|
+
) {
|
|
80
|
+
return // Suppress the warning
|
|
81
|
+
}
|
|
82
|
+
// Let other warnings through to console
|
|
83
|
+
console.warn(`[Vue warn]: ${msg}`)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Vue-specific wrapper for hydrateStart that installs hydration mismatch
|
|
89
|
+
* suppression for routes with ssr: false or ssr: 'data-only' before returning
|
|
90
|
+
*/
|
|
91
|
+
export async function hydrateStart(): Promise<AnyRouter> {
|
|
92
|
+
const router = await coreHydrateStart()
|
|
93
|
+
// Install console suppression before app.mount() is called
|
|
94
|
+
// This catches the "Hydration completed but contains mismatches" error
|
|
95
|
+
suppressSsrHydrationMismatches(router)
|
|
96
|
+
return router
|
|
97
|
+
}
|
package/src/index.tsx
ADDED
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @tanstack/vue-start-client
|
|
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-client`
|
|
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**
|