Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

knip.ts

31 lines991 Bytes

1// These aren't actual compilers, but performant & avoids root dependencies
2const svelteCompiler = (text: string) => text.matchAll(/import[^]*?'.*?'\n/gs)
3const vueCompiler = /<script\b[^>]*>([\s\S]*?)<\/script>/gm
4​
5export default {
6 $schema: 'https://unpkg.com/knip@2/schema.json',
7 ignoreWorkspaces: ['examples/**'],
8 ignore: ['**/react-app-env.d.ts', '**/vite-env.d.ts'],
9 workspaces: {
10 'packages/codemods': {
11 entry: ['src/v4/*.js', 'src/v5/*/*.js'],
12 ignore: ['**/__testfixtures__/**'],
13 },
14 'packages/vue-query': {
15 ignore: ['**/__mocks__/**'],
16 ignoreDependencies: ['vue2', 'vue2.7'],
17 },
18 'integrations/angular-cli-standalone-17': {
19 entry: ['src/main.ts'],
20 },
21 },
22 compilers: {
23 svelte: (text: string) => [...svelteCompiler(text)].join('\n'),
24 vue: (text: string) => {
25 const scripts = []
26 let match
27 while ((match = vueCompiler.exec(text))) scripts.push(match[1])
28 return scripts.join(';')
29 },
30 },