snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
24
integrations/svelte-vite/.gitignore
vendored
Normal file
24
integrations/svelte-vite/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
11
integrations/svelte-vite/index.html
Normal file
11
integrations/svelte-vite/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Vite + Svelte</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
15
integrations/svelte-vite/package.json
Normal file
15
integrations/svelte-vite/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "svelte-vite",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^5.1.1",
|
||||
"@tanstack/svelte-query": "workspace:*",
|
||||
"@tanstack/svelte-query-devtools": "workspace:*",
|
||||
"svelte": "^5.39.3",
|
||||
"vite": "^6.4.1"
|
||||
}
|
||||
}
|
||||
12
integrations/svelte-vite/src/App.svelte
Normal file
12
integrations/svelte-vite/src/App.svelte
Normal file
@@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { QueryClientProvider, QueryClient } from '@tanstack/svelte-query'
|
||||
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
|
||||
import Simple from './Simple.svelte'
|
||||
|
||||
const queryClient = new QueryClient()
|
||||
</script>
|
||||
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Simple />
|
||||
<SvelteQueryDevtools />
|
||||
</QueryClientProvider>
|
||||
19
integrations/svelte-vite/src/Simple.svelte
Normal file
19
integrations/svelte-vite/src/Simple.svelte
Normal file
@@ -0,0 +1,19 @@
|
||||
<script>
|
||||
import { createQuery } from '@tanstack/svelte-query'
|
||||
|
||||
const query = createQuery({
|
||||
queryKey: ['test'],
|
||||
queryFn: async () => {
|
||||
await new Promise((r) => setTimeout(r, 1000))
|
||||
return 'Success'
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if $query.isPending}
|
||||
<div>Loading...</div>
|
||||
{:else if $query.error}
|
||||
<div>An error has occurred!</div>
|
||||
{:else}
|
||||
<div>{$query.data}</div>
|
||||
{/if}
|
||||
7
integrations/svelte-vite/src/main.js
Normal file
7
integrations/svelte-vite/src/main.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import App from './App.svelte'
|
||||
|
||||
const app = new App({
|
||||
target: document.getElementById('app'),
|
||||
})
|
||||
|
||||
export default app
|
||||
2
integrations/svelte-vite/src/vite-env.d.ts
vendored
Normal file
2
integrations/svelte-vite/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference types="svelte" />
|
||||
/// <reference types="vite/client" />
|
||||
5
integrations/svelte-vite/svelte.config.js
Normal file
5
integrations/svelte-vite/svelte.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
||||
|
||||
export default {
|
||||
preprocess: vitePreprocess(),
|
||||
}
|
||||
6
integrations/svelte-vite/vite.config.js
Normal file
6
integrations/svelte-vite/vite.config.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [svelte()],
|
||||
})
|
||||
Reference in New Issue
Block a user