snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
3
packages/svelte-query-devtools/.attw.json
Normal file
3
packages/svelte-query-devtools/.attw.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ignoreRules": ["cjs-resolves-to-esm", "internal-resolution-error"]
|
||||
}
|
||||
390
packages/svelte-query-devtools/CHANGELOG.md
Normal file
390
packages/svelte-query-devtools/CHANGELOG.md
Normal file
@@ -0,0 +1,390 @@
|
||||
# @tanstack/svelte-query-devtools
|
||||
|
||||
## 6.1.48
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.102.8
|
||||
- @tanstack/svelte-query@6.1.48
|
||||
|
||||
## 6.1.47
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.102.7
|
||||
- @tanstack/svelte-query@6.1.47
|
||||
|
||||
## 6.1.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.102.6
|
||||
- @tanstack/svelte-query@6.1.46
|
||||
|
||||
## 6.1.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ef1eff1`](https://github.com/TanStack/query/commit/ef1eff1b62a657d6ff6f2af819c1cb8b73ad2af5)]:
|
||||
- @tanstack/query-devtools@5.102.5
|
||||
- @tanstack/svelte-query@6.1.45
|
||||
|
||||
## 6.1.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.102.4
|
||||
- @tanstack/svelte-query@6.1.44
|
||||
|
||||
## 6.1.43
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.102.3
|
||||
- @tanstack/svelte-query@6.1.43
|
||||
|
||||
## 6.1.42
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`cafd540`](https://github.com/TanStack/query/commit/cafd540c02f78be260198c4e84d054390c02c6b8), [`320ed25`](https://github.com/TanStack/query/commit/320ed25caca4e219b53f778c59cbb380543a21f4), [`250050d`](https://github.com/TanStack/query/commit/250050d863d33fbc881c6e342c104d510403a9e1)]:
|
||||
- @tanstack/svelte-query@6.1.42
|
||||
|
||||
## 6.1.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.102.2
|
||||
- @tanstack/svelte-query@6.1.41
|
||||
|
||||
## 6.1.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.102.1
|
||||
- @tanstack/svelte-query@6.1.40
|
||||
|
||||
## 6.1.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6e3d521`](https://github.com/TanStack/query/commit/6e3d521fe54f78624e53c1c6f9cadd678504bee8), [`294d4e6`](https://github.com/TanStack/query/commit/294d4e62c4f7d674574a4903eef2a1bc3dd1413b), [`2215bb0`](https://github.com/TanStack/query/commit/2215bb031139cdc8a84751b37a485c38ca9d2b6e), [`1ef4208`](https://github.com/TanStack/query/commit/1ef42087c9a266c2137d2ef645cbcc662f60ac93)]:
|
||||
- @tanstack/svelte-query@6.1.39
|
||||
- @tanstack/query-devtools@5.102.0
|
||||
|
||||
## 6.1.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.101.4
|
||||
- @tanstack/svelte-query@6.1.38
|
||||
|
||||
## 6.1.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.101.3
|
||||
- @tanstack/svelte-query@6.1.37
|
||||
|
||||
## 6.1.36
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`f5bf180`](https://github.com/TanStack/query/commit/f5bf180d933d8b8d9d9e7b845e55b26a3a413b07), [`25cdd97`](https://github.com/TanStack/query/commit/25cdd975fed4703d2ca5b600ca5ccd2b600b3dd8), [`ecd89c8`](https://github.com/TanStack/query/commit/ecd89c8faf7acc226f00633ea3a761d3ab842c1d), [`01c7634`](https://github.com/TanStack/query/commit/01c763444e3cf3dfa9744f13911aa1533cac3c29), [`49012db`](https://github.com/TanStack/query/commit/49012dbd5192dfe483d3b108b72ffaa7f2849e0f)]:
|
||||
- @tanstack/query-devtools@5.101.2
|
||||
- @tanstack/svelte-query@6.1.36
|
||||
|
||||
## 6.1.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.101.1
|
||||
- @tanstack/svelte-query@6.1.35
|
||||
|
||||
## 6.1.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`3042860`](https://github.com/TanStack/query/commit/3042860e3c8731c94ca4dec0e277e415d0484fce), [`e631dc3`](https://github.com/TanStack/query/commit/e631dc3fa17bff71f413246b7a770a730016d346)]:
|
||||
- @tanstack/query-devtools@5.101.0
|
||||
- @tanstack/svelte-query@6.1.34
|
||||
|
||||
## 6.1.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.14
|
||||
- @tanstack/svelte-query@6.1.33
|
||||
|
||||
## 6.1.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.13
|
||||
- @tanstack/svelte-query@6.1.32
|
||||
|
||||
## 6.1.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.12
|
||||
- @tanstack/svelte-query@6.1.31
|
||||
|
||||
## 6.1.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.11
|
||||
- @tanstack/svelte-query@6.1.30
|
||||
|
||||
## 6.1.29
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`4d130b9`](https://github.com/TanStack/query/commit/4d130b992d2ac396d75f921bfc530dd3a9d50577)]:
|
||||
- @tanstack/query-devtools@5.100.10
|
||||
- @tanstack/svelte-query@6.1.29
|
||||
|
||||
## 6.1.28
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`3d21cac`](https://github.com/TanStack/query/commit/3d21cacdec3028b700c4c2e3e0ff8dbe7a235e8c)]:
|
||||
- @tanstack/query-devtools@5.100.9
|
||||
- @tanstack/svelte-query@6.1.28
|
||||
|
||||
## 6.1.27
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.8
|
||||
- @tanstack/svelte-query@6.1.27
|
||||
|
||||
## 6.1.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- docs(devtools): align logo, panel, and 'buttonPosition' union descriptions across docs and JSDoc ([#10617](https://github.com/TanStack/query/pull/10617))
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.7
|
||||
- @tanstack/svelte-query@6.1.26
|
||||
|
||||
## 6.1.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.6
|
||||
- @tanstack/svelte-query@6.1.25
|
||||
|
||||
## 6.1.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.5
|
||||
- @tanstack/svelte-query@6.1.24
|
||||
|
||||
## 6.1.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`3d1a62e`](https://github.com/TanStack/query/commit/3d1a62e63bd864359e369bb21356fa80d043f2ba)]:
|
||||
- @tanstack/query-devtools@5.100.4
|
||||
- @tanstack/svelte-query@6.1.23
|
||||
|
||||
## 6.1.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.3
|
||||
- @tanstack/svelte-query@6.1.22
|
||||
|
||||
## 6.1.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.2
|
||||
- @tanstack/svelte-query@6.1.21
|
||||
|
||||
## 6.1.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.1
|
||||
- @tanstack/svelte-query@6.1.20
|
||||
|
||||
## 6.1.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.100.0
|
||||
- @tanstack/svelte-query@6.1.19
|
||||
|
||||
## 6.1.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.99.2
|
||||
- @tanstack/svelte-query@6.1.18
|
||||
|
||||
## 6.1.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.99.1
|
||||
- @tanstack/svelte-query@6.1.17
|
||||
|
||||
## 6.1.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.99.0
|
||||
- @tanstack/svelte-query@6.1.16
|
||||
|
||||
## 6.1.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.98.0
|
||||
- @tanstack/svelte-query@6.1.15
|
||||
|
||||
## 6.1.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.97.0
|
||||
- @tanstack/svelte-query@6.1.14
|
||||
|
||||
## 6.1.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.96.2
|
||||
- @tanstack/svelte-query@6.1.13
|
||||
|
||||
## 6.1.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.96.1
|
||||
- @tanstack/svelte-query@6.1.12
|
||||
|
||||
## 6.1.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.96.0
|
||||
- @tanstack/svelte-query@6.1.11
|
||||
|
||||
## 6.1.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.95.2
|
||||
- @tanstack/svelte-query@6.1.10
|
||||
|
||||
## 6.1.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.95.1
|
||||
- @tanstack/svelte-query@6.1.9
|
||||
|
||||
## 6.1.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @tanstack/query-devtools@5.95.0
|
||||
- @tanstack/svelte-query@6.1.8
|
||||
|
||||
## 6.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fix(\*): resolve issue about excluded build directory ([#10312](https://github.com/TanStack/query/pull/10312))
|
||||
|
||||
- Updated dependencies [[`4b6536d`](https://github.com/TanStack/query/commit/4b6536dfce99036f4e37f52943c6fed3ad0e0a18)]:
|
||||
- @tanstack/query-devtools@5.94.5
|
||||
- @tanstack/svelte-query@6.1.7
|
||||
|
||||
## 6.1.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- chore: fixed version ([#10064](https://github.com/TanStack/query/pull/10064))
|
||||
|
||||
- Updated dependencies [[`4c75210`](https://github.com/TanStack/query/commit/4c75210ce8235fe3d39b67e1029eff11278927cc)]:
|
||||
- @tanstack/query-devtools@5.94.4
|
||||
- @tanstack/svelte-query@6.1.6
|
||||
|
||||
## 6.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`83366c4`](https://github.com/TanStack/query/commit/83366c46a6825b5c591399c705d8128743c527dd)]:
|
||||
- @tanstack/query-devtools@5.93.0
|
||||
|
||||
## 6.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`f9fc56a`](https://github.com/TanStack/query/commit/f9fc56a9b8724bcfae46f8f6cb229123478eb4db), [`0b29b6f`](https://github.com/TanStack/query/commit/0b29b6f877d4b3a6d05b1c85fb9cb1e6ea736291)]:
|
||||
- @tanstack/query-devtools@5.92.0
|
||||
- @tanstack/svelte-query@6.0.12
|
||||
|
||||
## 6.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`b261b6f`](https://github.com/TanStack/query/commit/b261b6f29eee2a9bdbe1bc20035fe9b83b15376b)]:
|
||||
- @tanstack/query-devtools@5.91.1
|
||||
|
||||
## 6.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`0e9d5b5`](https://github.com/TanStack/query/commit/0e9d5b565276f0de2a1a14ffbb079b5988581c27)]:
|
||||
- @tanstack/query-devtools@5.91.0
|
||||
|
||||
## 6.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- BREAKING: Migrate to svelte runes (signals). Requires [Svelte v5.25.0](https://github.com/sveltejs/svelte/releases/tag/svelte%405.25.0) or newer. Please see the [migration guide](https://tanstack.com/query/latest/docs/framework/svelte/migrate-from-v5-to-v6). ([#9694](https://github.com/TanStack/query/pull/9694))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`1056ba6`](https://github.com/TanStack/query/commit/1056ba63b30b9d9a66fa813c7d7fb1395e377c55)]:
|
||||
- @tanstack/svelte-query@6.0.0
|
||||
28
packages/svelte-query-devtools/eslint.config.js
Normal file
28
packages/svelte-query-devtools/eslint.config.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// @ts-check
|
||||
|
||||
import tsParser from '@typescript-eslint/parser'
|
||||
import pluginSvelte from 'eslint-plugin-svelte'
|
||||
import rootConfig from './root.eslint.config.js'
|
||||
import svelteConfig from './svelte.config.js'
|
||||
|
||||
export default [
|
||||
...rootConfig,
|
||||
...pluginSvelte.configs['recommended'],
|
||||
{
|
||||
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
parser: tsParser,
|
||||
extraFileExtensions: ['.svelte'],
|
||||
svelteConfig,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'svelte/block-lang': ['error', { script: ['ts'] }],
|
||||
'svelte/no-svelte-internal': 'error',
|
||||
'svelte/valid-compile': 'off',
|
||||
},
|
||||
},
|
||||
]
|
||||
69
packages/svelte-query-devtools/package.json
Normal file
69
packages/svelte-query-devtools/package.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "@tanstack/svelte-query-devtools",
|
||||
"version": "6.1.48",
|
||||
"description": "Developer tools to interact with and visualize the TanStack/svelte-query cache",
|
||||
"author": "Lachlan Collins",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/TanStack/query.git",
|
||||
"directory": "packages/svelte-query-devtools"
|
||||
},
|
||||
"homepage": "https://tanstack.com/query",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
},
|
||||
"keywords": [
|
||||
"tanstack",
|
||||
"query",
|
||||
"svelte"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "premove ./dist ./coverage ./.svelte-kit ./dist-ts",
|
||||
"compile": "tsc --project tsconfig.json",
|
||||
"test:types": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"test:eslint": "eslint --concurrency=auto ./src",
|
||||
"test:lib": "vitest",
|
||||
"test:lib:dev": "pnpm run test:lib --watch",
|
||||
"test:build": "publint --strict && attw --pack",
|
||||
"build": "svelte-package --input ./src --output ./dist"
|
||||
},
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
"module": "dist/index.js",
|
||||
"svelte": "./dist/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"@tanstack/custom-condition": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"svelte": "./dist/index.js",
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src",
|
||||
"!src/__tests__"
|
||||
],
|
||||
"dependencies": {
|
||||
"@tanstack/query-devtools": "workspace:*",
|
||||
"esm-env": "^1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/package": "^2.5.8",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.1.1",
|
||||
"@tanstack/svelte-query": "workspace:*",
|
||||
"@testing-library/svelte": "^5.2.8",
|
||||
"@typescript-eslint/parser": "^8.48.0",
|
||||
"eslint-plugin-svelte": "^3.11.0",
|
||||
"svelte": "^5.39.3",
|
||||
"svelte-check": "^4.4.5",
|
||||
"typescript": "5.9.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tanstack/svelte-query": "workspace:^",
|
||||
"svelte": "^5.25.0"
|
||||
}
|
||||
}
|
||||
1
packages/svelte-query-devtools/root.eslint.config.js
Symbolic link
1
packages/svelte-query-devtools/root.eslint.config.js
Symbolic link
@@ -0,0 +1 @@
|
||||
../../eslint.config.js
|
||||
108
packages/svelte-query-devtools/src/Devtools.svelte
Normal file
108
packages/svelte-query-devtools/src/Devtools.svelte
Normal file
@@ -0,0 +1,108 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import { BROWSER, DEV } from 'esm-env'
|
||||
import { onlineManager, useQueryClient } from '@tanstack/svelte-query'
|
||||
import type { QueryClient } from '@tanstack/svelte-query'
|
||||
import type {
|
||||
DevtoolsButtonPosition,
|
||||
DevtoolsErrorType,
|
||||
DevtoolsPosition,
|
||||
TanstackQueryDevtools,
|
||||
} from '@tanstack/query-devtools'
|
||||
|
||||
interface DevtoolsOptions {
|
||||
/**
|
||||
* Set this true if you want the dev tools to default to being open
|
||||
*/
|
||||
initialIsOpen?: boolean
|
||||
/**
|
||||
* The position of the TanStack logo to open and close the devtools panel.
|
||||
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
|
||||
* Defaults to 'bottom-right'.
|
||||
*/
|
||||
buttonPosition?: DevtoolsButtonPosition
|
||||
/**
|
||||
* The position of the Svelte Query devtools panel.
|
||||
* 'top' | 'bottom' | 'left' | 'right'
|
||||
* Defaults to 'bottom'.
|
||||
*/
|
||||
position?: DevtoolsPosition
|
||||
/**
|
||||
* Custom instance of QueryClient
|
||||
*/
|
||||
client?: QueryClient
|
||||
/**
|
||||
* Use this so you can define custom errors that can be shown in the devtools.
|
||||
*/
|
||||
errorTypes?: Array<DevtoolsErrorType>
|
||||
/**
|
||||
* Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
|
||||
*/
|
||||
styleNonce?: string
|
||||
/**
|
||||
* Use this so you can attach the devtool's styles to specific element in the DOM.
|
||||
*/
|
||||
shadowDOMTarget?: ShadowRoot
|
||||
/**
|
||||
* Set this to true to hide disabled queries from the devtools panel.
|
||||
*/
|
||||
hideDisabledQueries?: boolean
|
||||
}
|
||||
|
||||
let {
|
||||
initialIsOpen = false,
|
||||
buttonPosition = 'bottom-right',
|
||||
position = 'bottom',
|
||||
client = useQueryClient(),
|
||||
errorTypes = [],
|
||||
styleNonce = undefined,
|
||||
shadowDOMTarget = undefined,
|
||||
hideDisabledQueries = false,
|
||||
}: DevtoolsOptions = $props()
|
||||
|
||||
let ref: HTMLDivElement
|
||||
let devtools: TanstackQueryDevtools | undefined
|
||||
|
||||
if (DEV && BROWSER) {
|
||||
onMount(() => {
|
||||
import('@tanstack/query-devtools').then((m) => {
|
||||
const QueryDevtools = m.TanstackQueryDevtools
|
||||
|
||||
devtools = new QueryDevtools({
|
||||
client,
|
||||
queryFlavor: 'Svelte Query',
|
||||
version: '5',
|
||||
onlineManager,
|
||||
buttonPosition,
|
||||
position,
|
||||
initialIsOpen,
|
||||
errorTypes,
|
||||
styleNonce,
|
||||
shadowDOMTarget,
|
||||
hideDisabledQueries,
|
||||
})
|
||||
|
||||
devtools.mount(ref)
|
||||
})
|
||||
return () => devtools?.unmount()
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
devtools?.setButtonPosition(buttonPosition)
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
devtools?.setPosition(position)
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
devtools?.setInitialIsOpen(initialIsOpen)
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
devtools?.setErrorTypes(errorTypes)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="tsqd-parent-container" bind:this={ref}></div>
|
||||
1
packages/svelte-query-devtools/src/index.ts
Normal file
1
packages/svelte-query-devtools/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as SvelteQueryDevtools } from './Devtools.svelte'
|
||||
10
packages/svelte-query-devtools/svelte.config.js
Normal file
10
packages/svelte-query-devtools/svelte.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
||||
|
||||
const config = {
|
||||
preprocess: vitePreprocess(),
|
||||
compilerOptions: {
|
||||
runes: true,
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
39
packages/svelte-query-devtools/tests/Devtools.svelte.test.ts
Normal file
39
packages/svelte-query-devtools/tests/Devtools.svelte.test.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { render } from '@testing-library/svelte'
|
||||
import { QueryClient } from '@tanstack/svelte-query'
|
||||
import SvelteQueryDevtools from '../src/Devtools.svelte'
|
||||
import Wrapper from './Wrapper.svelte'
|
||||
|
||||
describe('SvelteQueryDevtools', () => {
|
||||
it('should render the parent container without throwing in non-development environments', () => {
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
const { container } = render(SvelteQueryDevtools, {
|
||||
props: { client: queryClient },
|
||||
})
|
||||
|
||||
expect(
|
||||
container.querySelector('.tsqd-parent-container'),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('should throw an error if no query client has been set', () => {
|
||||
expect(() => render(SvelteQueryDevtools)).toThrow(
|
||||
'No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?',
|
||||
)
|
||||
})
|
||||
|
||||
it('should not throw an error if query client is provided via context', () => {
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
expect(() => render(Wrapper, { props: { queryClient } })).not.toThrow()
|
||||
})
|
||||
|
||||
it('should not throw an error if query client is provided via props', () => {
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
expect(() =>
|
||||
render(SvelteQueryDevtools, { props: { client: queryClient } }),
|
||||
).not.toThrow()
|
||||
})
|
||||
})
|
||||
15
packages/svelte-query-devtools/tests/Wrapper.svelte
Normal file
15
packages/svelte-query-devtools/tests/Wrapper.svelte
Normal file
@@ -0,0 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { QueryClientProvider } from '@tanstack/svelte-query'
|
||||
import SvelteQueryDevtools from '../src/Devtools.svelte'
|
||||
import type { QueryClient } from '@tanstack/svelte-query'
|
||||
|
||||
type Props = {
|
||||
queryClient: QueryClient
|
||||
}
|
||||
|
||||
let { queryClient }: Props = $props()
|
||||
</script>
|
||||
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SvelteQueryDevtools />
|
||||
</QueryClientProvider>
|
||||
1
packages/svelte-query-devtools/tests/test-setup.ts
Normal file
1
packages/svelte-query-devtools/tests/test-setup.ts
Normal file
@@ -0,0 +1 @@
|
||||
import '@testing-library/jest-dom/vitest'
|
||||
9
packages/svelte-query-devtools/tsconfig.json
Normal file
9
packages/svelte-query-devtools/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist-ts",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["src", "tests", "*.config.ts", "*.config.js", "package.json"],
|
||||
"references": [{ "path": "../query-devtools" }, { "path": "../svelte-query" }]
|
||||
}
|
||||
33
packages/svelte-query-devtools/vite.config.ts
Normal file
33
packages/svelte-query-devtools/vite.config.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import { svelteTesting } from '@testing-library/svelte/vite'
|
||||
|
||||
import packageJson from './package.json'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [svelte(), svelteTesting()],
|
||||
// fix from https://github.com/vitest-dev/vitest/issues/6992#issuecomment-2509408660
|
||||
resolve: {
|
||||
conditions: ['@tanstack/custom-condition'],
|
||||
},
|
||||
environments: {
|
||||
ssr: {
|
||||
resolve: {
|
||||
conditions: ['@tanstack/custom-condition'],
|
||||
},
|
||||
},
|
||||
},
|
||||
test: {
|
||||
name: packageJson.name,
|
||||
dir: './tests',
|
||||
watch: false,
|
||||
environment: 'jsdom',
|
||||
setupFiles: ['./tests/test-setup.ts'],
|
||||
coverage: {
|
||||
enabled: !!process.env.CI,
|
||||
provider: 'istanbul',
|
||||
include: ['src/**/*'],
|
||||
},
|
||||
typecheck: { enabled: true },
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user