diff --git a/astro/package.json b/astro/package.json index fc14e5e..123010b 100644 --- a/astro/package.json +++ b/astro/package.json @@ -12,6 +12,7 @@ "@astrojs/check": "^0.9.4", "@sanity/client": "^6.22.5", "astro": "^5.0.0-beta.8", + "groq": "^3.64.2", "typescript": "^5.6.3" } } diff --git a/next-13/package.json b/next-13/package.json index 5328e40..f989d27 100644 --- a/next-13/package.json +++ b/next-13/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@sanity/client": "^6.22.5", + "groq": "^3.64.2", "next": "13.5.7", "react": "^18", "react-dom": "^18" diff --git a/next-14/package.json b/next-14/package.json index 1beadaa..e564f1a 100644 --- a/next-14/package.json +++ b/next-14/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@sanity/client": "^6.22.5", + "groq": "^3.64.2", "next": "14.2.18", "react": "^18", "react-dom": "^18" diff --git a/next-14/src/app/layout.tsx b/next-14/src/app/layout.tsx index a36cde0..f4445ff 100644 --- a/next-14/src/app/layout.tsx +++ b/next-14/src/app/layout.tsx @@ -1,35 +1,31 @@ -import type { Metadata } from "next"; -import localFont from "next/font/local"; -import "./globals.css"; +import type {Metadata} from 'next' +import localFont from 'next/font/local' +import './globals.css' const geistSans = localFont({ - src: "./fonts/GeistVF.woff", - variable: "--font-geist-sans", - weight: "100 900", -}); + src: './fonts/GeistVF.woff', + variable: '--font-geist-sans', + weight: '100 900', +}) const geistMono = localFont({ - src: "./fonts/GeistMonoVF.woff", - variable: "--font-geist-mono", - weight: "100 900", -}); + src: './fonts/GeistMonoVF.woff', + variable: '--font-geist-mono', + weight: '100 900', +}) export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", -}; + title: 'Create Next App', + description: 'Generated by create next app', +} export default function RootLayout({ children, }: Readonly<{ - children: React.ReactNode; + children: React.ReactNode }>) { return ( -
- {children} - + {children} - ); + ) } diff --git a/next-15/package.json b/next-15/package.json index de6e627..65cf06c 100644 --- a/next-15/package.json +++ b/next-15/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@sanity/client": "^6.22.5", + "groq": "^3.64.2", "next": "15.0.3", "react": "rc", "react-dom": "rc" @@ -23,9 +24,5 @@ "postcss": "^8.4.49", "tailwindcss": "^3.4.15", "typescript": "^5.6.3" - }, - "overrides": { - "@types/react": "npm:types-react@rc", - "@types/react-dom": "npm:types-react-dom@rc" } } diff --git a/next-canary/package.json b/next-canary/package.json index c6b6179..5a6711c 100644 --- a/next-canary/package.json +++ b/next-canary/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@sanity/client": "^6.22.5", + "groq": "^3.64.2", "next": "canary", "react": "rc", "react-dom": "rc" @@ -23,9 +24,5 @@ "postcss": "^8.4.49", "tailwindcss": "^3.4.15", "typescript": "^5.6.3" - }, - "overrides": { - "@types/react": "npm:types-react@rc", - "@types/react-dom": "npm:types-react-dom@rc" } } diff --git a/nuxt/package.json b/nuxt/package.json index 86419ce..bd3ab86 100644 --- a/nuxt/package.json +++ b/nuxt/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@sanity/client": "^6.22.5", + "groq": "^3.64.2", "nuxt": "^3.14.159", "vue": "latest", "vue-router": "latest" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f1dd02..3e083b9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,6 +60,9 @@ importers: astro: specifier: ^5.0.0-beta.8 version: 5.0.0-beta.8(@types/node@22.9.1)(jiti@2.4.0)(rollup@4.27.3)(terser@5.36.0)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.1) + groq: + specifier: ^3.64.2 + version: 3.64.2 typescript: specifier: ^5.6.3 version: 5.6.3 @@ -69,6 +72,9 @@ importers: '@sanity/client': specifier: ^6.22.5 version: 6.22.5(debug@4.3.7) + groq: + specifier: ^3.64.2 + version: 3.64.2 next: specifier: 13.5.7 version: 13.5.7(@babel/core@7.26.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -112,6 +118,9 @@ importers: '@sanity/client': specifier: ^6.22.5 version: 6.22.5(debug@4.3.7) + groq: + specifier: ^3.64.2 + version: 3.64.2 next: specifier: 14.2.18 version: 14.2.18(@babel/core@7.26.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -152,6 +161,9 @@ importers: '@sanity/client': specifier: ^6.22.5 version: 6.22.5(debug@4.3.7) + groq: + specifier: ^3.64.2 + version: 3.64.2 next: specifier: 15.0.3 version: 15.0.3(@babel/core@7.26.0)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) @@ -192,9 +204,12 @@ importers: '@sanity/client': specifier: ^6.22.5 version: 6.22.5(debug@4.3.7) + groq: + specifier: ^3.64.2 + version: 3.64.2 next: specifier: canary - version: 15.0.4-canary.20(@babel/core@7.26.0)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) + version: 15.0.4-canary.21(@babel/core@7.26.0)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) react: specifier: rc version: 19.0.0-rc.1 @@ -216,7 +231,7 @@ importers: version: 9.15.0(jiti@2.4.0) eslint-config-next: specifier: canary - version: 15.0.4-canary.20(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3) + version: 15.0.4-canary.21(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3) postcss: specifier: ^8.4.49 version: 8.4.49 @@ -232,6 +247,9 @@ importers: '@sanity/client': specifier: ^6.22.5 version: 6.22.5(debug@4.3.7) + groq: + specifier: ^3.64.2 + version: 3.64.2 nuxt: specifier: ^3.14.159 version: 3.14.1592(@parcel/watcher@2.5.0)(@types/node@22.9.1)(eslint@9.15.0(jiti@2.4.0))(ioredis@5.4.1)(magicast@0.3.5)(meow@9.0.0)(optionator@0.9.4)(rollup@4.27.3)(terser@5.36.0)(typescript@5.6.3)(vite@5.4.11(@types/node@22.9.1)(terser@5.36.0)) @@ -287,6 +305,9 @@ importers: '@sanity/client': specifier: ^6.22.5 version: 6.22.5(debug@4.3.7) + groq: + specifier: ^3.64.2 + version: 3.64.2 devDependencies: '@sveltejs/adapter-auto': specifier: ^3.3.1 @@ -350,29 +371,41 @@ importers: version: 6.22.5(debug@4.3.7) '@tanstack/react-router': specifier: ^1.82.1 - version: 1.82.1(@tanstack/router-generator@1.81.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) '@tanstack/router-devtools': specifier: ^1.82.1 - version: 1.82.1(@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(csstype@3.1.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 1.82.1(@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1))(csstype@3.1.3)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) '@tanstack/start': specifier: ^1.82.1 - version: 1.82.1(@types/node@22.9.1)(ioredis@5.4.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(terser@5.36.0)(typescript@5.6.3)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) + version: 1.82.1(@types/node@22.9.1)(ioredis@5.4.1)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)(terser@5.36.0)(typescript@5.6.3)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) + '@tanstack/zod-adapter': + specifier: ^1.82.1 + version: 1.82.1(@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1))(zod@3.23.8) + groq: + specifier: ^3.64.2 + version: 3.64.2 react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: 19.0.0-rc.1 + version: 19.0.0-rc.1 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: 19.0.0-rc.1 + version: 19.0.0-rc.1(react@19.0.0-rc.1) + use-effect-event: + specifier: ^1.0.2 + version: 1.0.2(react@19.0.0-rc.1) vinxi: specifier: ^0.4.3 version: 0.4.3(@types/node@22.9.1)(ioredis@5.4.1)(terser@5.36.0)(typescript@5.6.3) + zod: + specifier: ^3.23.8 + version: 3.23.8 devDependencies: '@types/react': - specifier: ^18.3.12 - version: 18.3.12 + specifier: npm:types-react@rc + version: types-react@19.0.0-rc.1 '@types/react-dom': - specifier: ^18.3.1 - version: 18.3.1 + specifier: npm:types-react-dom@rc + version: types-react-dom@19.0.0-rc.1 '@vitejs/plugin-react': specifier: ^4.3.3 version: 4.3.3(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) @@ -2142,8 +2175,8 @@ packages: '@next/env@15.0.3': resolution: {integrity: sha512-t9Xy32pjNOvVn2AS+Utt6VmyrshbpfUMhIjFO60gI58deSo/KgLOp31XZ4O+kY/Is8WAGYwA5gR7kOb1eORDBA==} - '@next/env@15.0.4-canary.20': - resolution: {integrity: sha512-0gxXJoDer+xbTm8ffgha1cwvmMyLltQXrlvnQLR2RoufehgNDbL2vxTEPY97qF3lQ/zrtUB6kIuAiNK7Z+CUkg==} + '@next/env@15.0.4-canary.21': + resolution: {integrity: sha512-xKz75Fc/A1VXlW3veA4oaWpoYrv9Cbpr4fVwU5DMDJEABuWKh0UWUR9fKzSrd3ZPwyLx31MipVdHEeeaPBSZEw==} '@next/eslint-plugin-next@13.5.7': resolution: {integrity: sha512-c4vuEOOXeib4js5gDq+zFqAAdRGXX6T0d+zFETiQkRwy7vyj5lBov1dW0Z09nDst2lvxo7VEcKrQMUBH5Vgx7Q==} @@ -2154,8 +2187,8 @@ packages: '@next/eslint-plugin-next@15.0.3': resolution: {integrity: sha512-3Ln/nHq2V+v8uIaxCR6YfYo7ceRgZNXfTd3yW1ukTaFbO+/I8jNakrjYWODvG9BuR2v5kgVtH/C8r0i11quOgw==} - '@next/eslint-plugin-next@15.0.4-canary.20': - resolution: {integrity: sha512-5TReXfEb7afB0g6BQEX+1sZ15jGab9o4DsvSm+sU7bRiaC8X9H2tW6DjPgW/07oao3L12uE3DwSlRCIkQcNW5A==} + '@next/eslint-plugin-next@15.0.4-canary.21': + resolution: {integrity: sha512-eZxh4Vd5pVqIFiVBWWjwZJT0XfTSI0gguz486cK/ro2FtONiVpPeMivPKotFG95sEyyeSHK7LyJM6qEUhTkr9g==} '@next/swc-darwin-arm64@13.5.7': resolution: {integrity: sha512-7SxmxMex45FvKtRoP18eftrDCMyL6WQVYJSEE/s7A1AW/fCkznxjEShKet2iVVzf89gWp8HbXGaL4hCaseux6g==} @@ -2175,8 +2208,8 @@ packages: cpu: [arm64] os: [darwin] - '@next/swc-darwin-arm64@15.0.4-canary.20': - resolution: {integrity: sha512-ABITn7jKwKiqMMtv6u5bdgZ7zq/uzVk7URwhTSI19YDquT41MFeGQgUwGoEF4Vm00R2TVXDFZjyuHlkaAX6y9g==} + '@next/swc-darwin-arm64@15.0.4-canary.21': + resolution: {integrity: sha512-+7aEpsrgI/2hkRdRKt7AFAwsy1cPEhDbiEbT0PvfYQKl/+aWHQG4mOZ8Rfn5r8ToQ+x2FZ16bdYe2mBBsjRFQQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -2199,8 +2232,8 @@ packages: cpu: [x64] os: [darwin] - '@next/swc-darwin-x64@15.0.4-canary.20': - resolution: {integrity: sha512-HmiOHejzoh2F96WPwPHDadKBdmS0kCfW/CIvevHlCFJB7MoEHgne70YlHmwnIIjQZ+xEJgQkxJd3+A6wgP5nqA==} + '@next/swc-darwin-x64@15.0.4-canary.21': + resolution: {integrity: sha512-PtZmQxnrIay5sdG0HAw9MjoQJyoYPgbHcgKotqQnJexpTZIlJxX/gq/HsntRphi8jReYGKMg3BiKQ9CnF/vdfw==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -2223,8 +2256,8 @@ packages: cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-gnu@15.0.4-canary.20': - resolution: {integrity: sha512-+AZChfg9o9EewHNa5odG2hekWUIj8UT0Sjh1xR+xrGnJP3xY4vRuWzDUNqXYVDLgPt3swiX9zKIZsEBWU+7xeg==} + '@next/swc-linux-arm64-gnu@15.0.4-canary.21': + resolution: {integrity: sha512-BAR1v+Kn/8MRG3RZDAqUJAJhRLpwAW6paZBCfsW/RpFRHOpE3WB8NpsRN3YeYjnVDFC4BE8n0wxsofN8Bk2QsA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -2247,8 +2280,8 @@ packages: cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@15.0.4-canary.20': - resolution: {integrity: sha512-AxMITAEYYKssZd2Vj9xjpBN8mG1GTs1+IU82mXBl+gOF/zmW6ncmqkp+7coNGNiW6M5HXBGUH5yLym8j36swtw==} + '@next/swc-linux-arm64-musl@15.0.4-canary.21': + resolution: {integrity: sha512-MNqTNEMSKCgPxPtNU6GfR4CRlYloTjrquzkuUPtg2xCA+G0Fd8dpK2yNdQTayTr60KV8rTE0v8NBzXNLWBjXbg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -2271,8 +2304,8 @@ packages: cpu: [x64] os: [linux] - '@next/swc-linux-x64-gnu@15.0.4-canary.20': - resolution: {integrity: sha512-X4xs1z8DHHZMNXz8HozYBCEPlkv2QWbMsGeBZYQOjO7FhPGXQBJ2XNSp18mLkNdavsxQlC4AeMF/gdrVYIhfrg==} + '@next/swc-linux-x64-gnu@15.0.4-canary.21': + resolution: {integrity: sha512-lDjKq/SjUGBgRu3kCbI775VXr8u7SGgVqgx8Z0pGX2QdSS1inj74cC9pYLeyih8z9BX11V9+mV4dX86/t7RZsg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -2295,8 +2328,8 @@ packages: cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@15.0.4-canary.20': - resolution: {integrity: sha512-6gdMN4kc1hqybgZUKlMNCgt8CI2rUlGqmP54IFelJRJIVUmaGYDAt4OI8lEf2pZCOzMo2n0OSbO2YwOy7ZETsQ==} + '@next/swc-linux-x64-musl@15.0.4-canary.21': + resolution: {integrity: sha512-6stvVNyEmgsK4tqNrULHTEgreVTi6ooiTzOTMio6I9v+UrQVuf2m0hgT7iFcs6bwHety/GZbgILL4igeONuJMw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -2319,8 +2352,8 @@ packages: cpu: [arm64] os: [win32] - '@next/swc-win32-arm64-msvc@15.0.4-canary.20': - resolution: {integrity: sha512-H7LUxO6T4F9YJQk9dp2LgFexl0HwMGayPa91SgkwCfAGflHy8LDJSDfbDgIN99J89ZRy+WYAsfqhOkGZgFEE9g==} + '@next/swc-win32-arm64-msvc@15.0.4-canary.21': + resolution: {integrity: sha512-VkKFukhDRyNSSSQuW4GRBzeaoo2SVsMV/u7ulvGSdL07+T7zHxnCe1yyIE7ugP0aClIfCXSkxPdG5SkZppKxuA==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -2355,8 +2388,8 @@ packages: cpu: [x64] os: [win32] - '@next/swc-win32-x64-msvc@15.0.4-canary.20': - resolution: {integrity: sha512-/0RCXmohjv2tifKSswl94/Pbu8Zrre4o7M80E3UzZLfPFgDQP6jEJQwIG5zSpHcLBbX4rMTFDrswOxpX9F5Veg==} + '@next/swc-win32-x64-msvc@15.0.4-canary.21': + resolution: {integrity: sha512-ir5/qHJCTNhDQNur3RN8U2hI1eKhrAiYiOjUiuWe4BiBkMgvZe3p0sjzxxy4QRYmBCtqCnUhHmaMoNcp1rB3PQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -3086,6 +3119,13 @@ packages: resolution: {integrity: sha512-jV5mWJrsh3QXHpb/by6udSqwva0qK50uYHpIXvKsLaxnlbjbLfflfPjFyRWXbMtZsnzCjSUqp5pm5/p+Wpaerg==} engines: {node: '>=12'} + '@tanstack/zod-adapter@1.82.1': + resolution: {integrity: sha512-ru8/lDRh2bFIOokxnNJ20edM7UqN6wZmsPVL/QIq/Veha/UZ7bkPT91wgw/+fummPgOcRcV6sDubAIRpB+7Gag==} + engines: {node: '>=12'} + peerDependencies: + '@tanstack/react-router': '>=1.43.2' + zod: ^3.23.8 + '@trysound/sax@0.2.0': resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} @@ -4802,8 +4842,8 @@ packages: typescript: optional: true - eslint-config-next@15.0.4-canary.20: - resolution: {integrity: sha512-HANE8BIIfm5/dLus6sFg+ncABUnDP8VdSxs0eI2nVNGS8c2rtWxV/osp1mgTryPjBpeVsRiLxOSE+t0IRjh8ZA==} + eslint-config-next@15.0.4-canary.21: + resolution: {integrity: sha512-1ApsIGNHChhGjX9DSSwvmvPa4bRCghqYE8Pxj3TxKduyini3eAN5yxjdkiZkQo5xT1ulzE+5zmgti/TEuTE86Q==} peerDependencies: eslint: ^7.23.0 || ^8.0.0 || ^9.0.0 typescript: '>=3.3.1' @@ -6570,8 +6610,8 @@ packages: sass: optional: true - next@15.0.4-canary.20: - resolution: {integrity: sha512-+1OeBMDyPwRL545bsPvIY+KAeFFmaLarnSu36HpO6gZD3eh53DvBH0dxGtooewDzpEvdUmWoq4bm7de2/XrpiQ==} + next@15.0.4-canary.21: + resolution: {integrity: sha512-z8SQxKGonrQ/FdtGzTIvmwHHjSm824FabdlJrP8h9ZvkrjlpNi2ABSikOZXeEG4VAgT9qqQg0zPykBRdrstU9g==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} hasBin: true peerDependencies: @@ -11027,7 +11067,7 @@ snapshots: '@next/env@15.0.3': {} - '@next/env@15.0.4-canary.20': {} + '@next/env@15.0.4-canary.21': {} '@next/eslint-plugin-next@13.5.7': dependencies: @@ -11041,7 +11081,7 @@ snapshots: dependencies: fast-glob: 3.3.1 - '@next/eslint-plugin-next@15.0.4-canary.20': + '@next/eslint-plugin-next@15.0.4-canary.21': dependencies: fast-glob: 3.3.1 @@ -11054,7 +11094,7 @@ snapshots: '@next/swc-darwin-arm64@15.0.3': optional: true - '@next/swc-darwin-arm64@15.0.4-canary.20': + '@next/swc-darwin-arm64@15.0.4-canary.21': optional: true '@next/swc-darwin-x64@13.5.7': @@ -11066,7 +11106,7 @@ snapshots: '@next/swc-darwin-x64@15.0.3': optional: true - '@next/swc-darwin-x64@15.0.4-canary.20': + '@next/swc-darwin-x64@15.0.4-canary.21': optional: true '@next/swc-linux-arm64-gnu@13.5.7': @@ -11078,7 +11118,7 @@ snapshots: '@next/swc-linux-arm64-gnu@15.0.3': optional: true - '@next/swc-linux-arm64-gnu@15.0.4-canary.20': + '@next/swc-linux-arm64-gnu@15.0.4-canary.21': optional: true '@next/swc-linux-arm64-musl@13.5.7': @@ -11090,7 +11130,7 @@ snapshots: '@next/swc-linux-arm64-musl@15.0.3': optional: true - '@next/swc-linux-arm64-musl@15.0.4-canary.20': + '@next/swc-linux-arm64-musl@15.0.4-canary.21': optional: true '@next/swc-linux-x64-gnu@13.5.7': @@ -11102,7 +11142,7 @@ snapshots: '@next/swc-linux-x64-gnu@15.0.3': optional: true - '@next/swc-linux-x64-gnu@15.0.4-canary.20': + '@next/swc-linux-x64-gnu@15.0.4-canary.21': optional: true '@next/swc-linux-x64-musl@13.5.7': @@ -11114,7 +11154,7 @@ snapshots: '@next/swc-linux-x64-musl@15.0.3': optional: true - '@next/swc-linux-x64-musl@15.0.4-canary.20': + '@next/swc-linux-x64-musl@15.0.4-canary.21': optional: true '@next/swc-win32-arm64-msvc@13.5.7': @@ -11126,7 +11166,7 @@ snapshots: '@next/swc-win32-arm64-msvc@15.0.3': optional: true - '@next/swc-win32-arm64-msvc@15.0.4-canary.20': + '@next/swc-win32-arm64-msvc@15.0.4-canary.21': optional: true '@next/swc-win32-ia32-msvc@13.5.7': @@ -11144,7 +11184,7 @@ snapshots: '@next/swc-win32-x64-msvc@15.0.3': optional: true - '@next/swc-win32-x64-msvc@15.0.4-canary.20': + '@next/swc-win32-x64-msvc@15.0.4-canary.21': optional: true '@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1': @@ -12301,29 +12341,29 @@ snapshots: '@tanstack/history@1.81.9': {} - '@tanstack/react-cross-context@1.81.9(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@tanstack/react-cross-context@1.81.9(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)': dependencies: - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) + react: 19.0.0-rc.1 + react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) - '@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)': dependencies: '@tanstack/history': 1.81.9 - '@tanstack/react-store': 0.5.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tanstack/react-store': 0.5.6(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) jsesc: 3.0.2 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) + react: 19.0.0-rc.1 + react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) tiny-invariant: 1.3.3 tiny-warning: 1.0.3 optionalDependencies: '@tanstack/router-generator': 1.81.9 - '@tanstack/react-store@0.5.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@tanstack/react-store@0.5.6(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)': dependencies: '@tanstack/store': 0.5.5 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - use-sync-external-store: 1.2.2(react@18.3.1) + react: 19.0.0-rc.1 + react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) + use-sync-external-store: 1.2.2(react@19.0.0-rc.1) '@tanstack/react-table@8.20.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: @@ -12347,13 +12387,13 @@ snapshots: '@tanstack/virtual-core': 3.0.0-beta.54 react: 19.0.0-rc.1 - '@tanstack/router-devtools@1.82.1(@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(csstype@3.1.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@tanstack/router-devtools@1.82.1(@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1))(csstype@3.1.3)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)': dependencies: - '@tanstack/react-router': 1.82.1(@tanstack/router-generator@1.81.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tanstack/react-router': 1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) clsx: 2.1.1 goober: 2.1.16(csstype@3.1.3) - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) + react: 19.0.0-rc.1 + react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) transitivePeerDependencies: - csstype @@ -12410,23 +12450,23 @@ snapshots: transitivePeerDependencies: - supports-color - '@tanstack/start@1.82.1(@types/node@22.9.1)(ioredis@5.4.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(terser@5.36.0)(typescript@5.6.3)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1))': + '@tanstack/start@1.82.1(@types/node@22.9.1)(ioredis@5.4.1)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)(terser@5.36.0)(typescript@5.6.3)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1))': dependencies: - '@tanstack/react-cross-context': 1.81.9(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@tanstack/react-router': 1.82.1(@tanstack/router-generator@1.81.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tanstack/react-cross-context': 1.81.9(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) + '@tanstack/react-router': 1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) '@tanstack/router-generator': 1.81.9 '@tanstack/router-plugin': 1.81.9(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) '@tanstack/start-vite-plugin': 1.81.9 '@vinxi/react': 0.2.5 - '@vinxi/react-server-dom': 0.0.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) + '@vinxi/react-server-dom': 0.0.3(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) '@vinxi/server-components': 0.4.3(vinxi@0.4.3(@types/node@22.9.1)(ioredis@5.4.1)(terser@5.36.0)(typescript@5.6.3)) '@vinxi/server-functions': 0.4.3(vinxi@0.4.3(@types/node@22.9.1)(ioredis@5.4.1)(terser@5.36.0)(typescript@5.6.3)) '@vitejs/plugin-react': 4.3.3(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1)) import-meta-resolve: 4.1.0 isbot: 5.1.17 jsesc: 3.0.2 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) + react: 19.0.0-rc.1 + react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) tiny-invariant: 1.3.3 vinxi: 0.4.3(@types/node@22.9.1)(ioredis@5.4.1)(terser@5.36.0)(typescript@5.6.3) zod: 3.23.8 @@ -12475,6 +12515,11 @@ snapshots: '@tanstack/virtual-file-routes@1.81.9': {} + '@tanstack/zod-adapter@1.82.1(@tanstack/react-router@1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1))(zod@3.23.8)': + dependencies: + '@tanstack/react-router': 1.82.1(@tanstack/router-generator@1.81.9)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) + zod: 3.23.8 + '@trysound/sax@0.2.0': {} '@tsconfig/node10@1.0.11': @@ -13002,11 +13047,11 @@ snapshots: tslib: 2.8.1 vinxi: 0.4.3(@types/node@22.9.1)(ioredis@5.4.1)(terser@5.36.0)(typescript@5.6.3) - '@vinxi/react-server-dom@0.0.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1))': + '@vinxi/react-server-dom@0.0.3(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1)(vite@6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1))': dependencies: acorn-loose: 8.4.0 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) + react: 19.0.0-rc.1 + react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) vite: 6.0.0-beta.6(@types/node@22.9.1)(jiti@2.4.0)(terser@5.36.0)(tsx@4.19.2)(yaml@2.6.1) '@vinxi/react@0.2.5': {} @@ -14752,9 +14797,9 @@ snapshots: - eslint-plugin-import-x - supports-color - eslint-config-next@15.0.4-canary.20(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3): + eslint-config-next@15.0.4-canary.21(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3): dependencies: - '@next/eslint-plugin-next': 15.0.4-canary.20 + '@next/eslint-plugin-next': 15.0.4-canary.21 '@rushstack/eslint-patch': 1.10.4 '@typescript-eslint/eslint-plugin': 8.15.0(@typescript-eslint/parser@8.15.0(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3))(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3) '@typescript-eslint/parser': 8.15.0(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3) @@ -17089,9 +17134,9 @@ snapshots: - '@babel/core' - babel-plugin-macros - next@15.0.4-canary.20(@babel/core@7.26.0)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1): + next@15.0.4-canary.21(@babel/core@7.26.0)(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1): dependencies: - '@next/env': 15.0.4-canary.20 + '@next/env': 15.0.4-canary.21 '@swc/counter': 0.1.3 '@swc/helpers': 0.5.13 busboy: 1.6.0 @@ -17101,14 +17146,14 @@ snapshots: react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) styled-jsx: 5.1.6(@babel/core@7.26.0)(react@19.0.0-rc.1) optionalDependencies: - '@next/swc-darwin-arm64': 15.0.4-canary.20 - '@next/swc-darwin-x64': 15.0.4-canary.20 - '@next/swc-linux-arm64-gnu': 15.0.4-canary.20 - '@next/swc-linux-arm64-musl': 15.0.4-canary.20 - '@next/swc-linux-x64-gnu': 15.0.4-canary.20 - '@next/swc-linux-x64-musl': 15.0.4-canary.20 - '@next/swc-win32-arm64-msvc': 15.0.4-canary.20 - '@next/swc-win32-x64-msvc': 15.0.4-canary.20 + '@next/swc-darwin-arm64': 15.0.4-canary.21 + '@next/swc-darwin-x64': 15.0.4-canary.21 + '@next/swc-linux-arm64-gnu': 15.0.4-canary.21 + '@next/swc-linux-arm64-musl': 15.0.4-canary.21 + '@next/swc-linux-x64-gnu': 15.0.4-canary.21 + '@next/swc-linux-x64-musl': 15.0.4-canary.21 + '@next/swc-win32-arm64-msvc': 15.0.4-canary.21 + '@next/swc-win32-x64-msvc': 15.0.4-canary.21 sharp: 0.33.5 transitivePeerDependencies: - '@babel/core' diff --git a/sveltekit/package.json b/sveltekit/package.json index f13c9d8..da62876 100644 --- a/sveltekit/package.json +++ b/sveltekit/package.json @@ -32,6 +32,7 @@ "vite": "^5.4.11" }, "dependencies": { - "@sanity/client": "^6.22.5" + "@sanity/client": "^6.22.5", + "groq": "^3.64.2" } } diff --git a/tanstack-start/app/components/SanityLive.tsx b/tanstack-start/app/components/SanityLive.tsx new file mode 100644 index 0000000..d2453cf --- /dev/null +++ b/tanstack-start/app/components/SanityLive.tsx @@ -0,0 +1,66 @@ +import type {LiveEventMessage, LiveEventRestart, LiveEventWelcome} from '@sanity/client' +import {CorsOriginError} from '@sanity/client' +import {useNavigate, useRouter, useRouterState, useSearch} from '@tanstack/react-router' +import {useEffect} from 'react' +import {useEffectEvent} from 'use-effect-event' +import {client} from '../utils/sanity' + +export function SanityLive() { + const selected = useRouterState({select: (state) => state.matches}) + const lastLiveEventId = useSearch({from: '__root__', select: (state) => state.lastLiveEventId}) + const navigate = useNavigate({from: '/'}) + const allTags = selected.flatMap((match) => { + if ( + typeof match.loaderData === 'object' && + match.loaderData !== null && + 'tags' in match.loaderData + ) { + return match.loaderData.tags + } + return [] + }) + + const router = useRouter() + const handleLiveEvent = useEffectEvent( + (event: LiveEventMessage | LiveEventRestart | LiveEventWelcome) => { + if (event.type === 'welcome') { + console.info('Sanity is live with automatic invalidation of published content') + } else if (event.type === 'message') { + if (event.tags.some((tag) => allTags.includes(tag))) { + navigate({search: (prev) => ({...prev, lastLiveEventId: event.id}), replace: true}) + } else { + console.log('no match', event.tags, {allTags}) + } + } else if (event.type === 'restart') { + if (lastLiveEventId) { + navigate({search: (prev) => ({...prev, lastLiveEventId: undefined}), replace: true}) + } else { + router.invalidate() + } + } + }, + ) + useEffect(() => { + const subscription = client.live.events().subscribe({ + next: (event) => { + if (event.type === 'message' || event.type === 'restart' || event.type === 'welcome') { + handleLiveEvent(event) + } + }, + error: (error: unknown) => { + if (error instanceof CorsOriginError) { + console.warn( + `Sanity Live is unable to connect to the Sanity API as the current origin - ${window.origin} - is not in the list of allowed CORS origins for this Sanity Project.`, + error.addOriginUrl && `Add it here:`, + error.addOriginUrl?.toString(), + ) + } else { + console.error(error) + } + }, + }) + return () => subscription.unsubscribe() + }, []) + + return null +} diff --git a/tanstack-start/app/components/ThemeButton.tsx b/tanstack-start/app/components/ThemeButton.tsx new file mode 100644 index 0000000..1e96d99 --- /dev/null +++ b/tanstack-start/app/components/ThemeButton.tsx @@ -0,0 +1,26 @@ +import {createServerFn} from '@tanstack/start' +import {useTransition} from 'react' + +const randomColorTheme = createServerFn().handler(async () => { + const res = await fetch('https://lcapi-examples-api.sanity.dev/api/random-color-theme', { + method: 'PUT', + }) + return res.json() +}) + +export function ThemeButton() { + const [pending, startTransition] = useTransition() + return ( + + ) +} diff --git a/tanstack-start/app/routes/__root.tsx b/tanstack-start/app/routes/__root.tsx index 32a3102..4543d4f 100644 --- a/tanstack-start/app/routes/__root.tsx +++ b/tanstack-start/app/routes/__root.tsx @@ -1,22 +1,43 @@ -import {createRootRoute, Outlet, ScrollRestoration} from '@tanstack/react-router' +import {createRootRoute, Outlet, ScrollRestoration, useRouterState} from '@tanstack/react-router' import {TanStackRouterDevtools} from '@tanstack/router-devtools' -import {Meta, Scripts} from '@tanstack/start' -import type {ReactNode} from 'react' +import {createServerFn, Meta, Scripts} from '@tanstack/start' +import {zodValidator} from '@tanstack/zod-adapter' +import {defineQuery} from 'groq' +import {type ReactNode} from 'react' +import {z} from 'zod' +import {SanityLive} from '../components/SanityLive' +import {ThemeButton} from '../components/ThemeButton' import appCss from '../styles/app.css?url' +import {sanityFetch} from '../utils/sanity' + +const THEME_QUERY = defineQuery(`*[_id == "theme"][0]{background,text}`) + +const getTheme = createServerFn({ + method: 'GET', +}) + .validator( + z.object({ + lastLiveEventId: z.string().optional(), + }), + ) + .handler(({data: {lastLiveEventId}}) => { + return sanityFetch({query: THEME_QUERY, lastLiveEventId}) + }) export const Route = createRootRoute({ - head: () => ({ + validateSearch: zodValidator( + z.object({ + lastLiveEventId: z.string().optional(), + }), + ), + loaderDeps: ({search: {lastLiveEventId}}) => ({lastLiveEventId}), + loader: ({deps}) => getTheme({data: deps}), + head: ({loaderData}) => ({ meta: [ - { - charSet: 'utf-8', - }, - { - name: 'viewport', - content: 'width=device-width, initial-scale=1', - }, - { - title: 'TanStack Start Starter', - }, + {charSet: 'utf-8'}, + {name: 'viewport', content: 'width=device-width, initial-scale=1'}, + {title: 'TanStack Start Starter'}, + {name: 'theme-color', content: loaderData?.data?.background || '#000'}, ], links: [ {rel: 'stylesheet', href: appCss}, @@ -29,22 +50,34 @@ export const Route = createRootRoute({ function RootComponent() { return (