@query-key-gen/used-generator 0.10.0 → 0.11.2

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/.ultra.cache.json CHANGED
@@ -1 +1 @@
1
- {"files":{"lib":"1743989874967.1023","node_modules":"1743989863848.9805","CHANGELOG.md":"87d4de2cc3a3c2761b2220eb1c1018ae15c4ff70","README.md":"9b9a57ac93cd2ca4cee91be46336b1e13b90fdc1","package.json":"6d26adfe789ad69dc9c2abc0a352e62d3de36f4f","src/core/QueryKeyUsedInfoGenerator.ts":"8d8e3b1d3cf68275d75d9c67210a3f8e05c27c87","src/core/index.ts":"64830ff2a399328aba05be5df1b64acf3865b36b","src/index.ts":"7fe960b4c559fd488bc6b5958c8422c02fe910b4","src/queryFinder/QueryKeyUsedFinder.ts":"9dd9ef30b3993be5f6bc3867086fe58bfd657725","src/queryFinder/index.ts":"4af4bb7c48579683e1bbe6e341f1a5806e67563a","src/types/config.ts":"1cde955b78ae7be37fd7f629ce7459560dd85cd2","src/types/index.ts":"f03c2281a9140975800795ec2a68bf8c53273244","src/utils/index.ts":"0ada954b3e9c1d296418c15769351fd3d4f2b93a","tsconfig.json":"41db3a2a30dd2a76788252c579552e7049c2118d","tsup.config.ts":"99c48d132d7fa99eca2ea5d9f87c38ca955386bd"},"deps":{"@query-key-gen/generator-common":0}}
1
+ {"files":{"lib":"1744001810797.136","node_modules":"1744001799814.1516","CHANGELOG.md":"eb0fd1aa764dad6a5a187a23ccf25036bdfd2308","README.md":"c7a9a849c0ec55c1c2bab2288cdd9db59c19777d","package.json":"95340fa3f6bcc9d08b91414465c2b2cc5c1a6ae0","src/core/QueryKeyUsedInfoGenerator.ts":"8d8e3b1d3cf68275d75d9c67210a3f8e05c27c87","src/core/index.ts":"64830ff2a399328aba05be5df1b64acf3865b36b","src/index.ts":"7fe960b4c559fd488bc6b5958c8422c02fe910b4","src/queryFinder/QueryKeyUsedFinder.ts":"9dd9ef30b3993be5f6bc3867086fe58bfd657725","src/queryFinder/index.ts":"4af4bb7c48579683e1bbe6e341f1a5806e67563a","src/types/config.ts":"1cde955b78ae7be37fd7f629ce7459560dd85cd2","src/types/index.ts":"f03c2281a9140975800795ec2a68bf8c53273244","src/utils/index.ts":"0ada954b3e9c1d296418c15769351fd3d4f2b93a","tsconfig.json":"41db3a2a30dd2a76788252c579552e7049c2118d","tsup.config.ts":"99c48d132d7fa99eca2ea5d9f87c38ca955386bd"},"deps":{"@query-key-gen/generator-common":0}}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @query-key-gen/used-generator
2
2
 
3
+ ## 0.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 6f41f60: update readme.md
8
+
9
+ ## 0.11.0
10
+
11
+ ### Minor Changes
12
+
13
+ - b7cccac: update
14
+
3
15
  ## 0.10.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1,3 +1,116 @@
1
- # Query key used generator
1
+ # 🔍 Query Key Used Generator
2
2
 
3
- ## using
3
+ Vite plugin that scans your project and tracks where `queryKey` values from `globalQueryKeys` are used — useful for dead query analysis, usage stats, or documentation.
4
+
5
+ > 📦 Compatible with [`@query-key-gen/generator`](https://npmjs.com/package/@query-key-gen/generator)
6
+ > 🛠 Designed for use with [React Query](https://tanstack.com/query)
7
+
8
+ ---
9
+
10
+ ## 🚀 1. Installation
11
+
12
+ ```bash
13
+ pnpm add @query-key-gen/used-generator
14
+ ```
15
+
16
+ ---
17
+
18
+ ## ⚙️ 2. Setup
19
+
20
+ ```ts
21
+ // vite.config.ts
22
+ import { defineConfig } from 'vite';
23
+ import react from '@vitejs/plugin-react';
24
+ import QueryKeyUsedPlugin from '@query-key-gen/used-generator';
25
+
26
+ export default defineConfig({
27
+ plugins: [react(), QueryKeyUsedPlugin()]
28
+ });
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 📘 Configuration Guide
34
+
35
+ All options are **optional**. If not specified, default values will be used.
36
+
37
+ | Option | Type | Default | Required | Description |
38
+ | -------------------- | ---------- | ------------------------------------- | -------- | ----------------------------------------------------------------- |
39
+ | `output` | `string` | `'./src/query-key-used-info.ts'` | ❌ | Path to the file where usage info will be written |
40
+ | `globalQueryKeyName` | `string` | `'globalQueryKeys'` | ❌ | The variable name of the generated global query key object |
41
+ | `ignoreFiles` | `string[]` | `['.d.ts', 'query-key-used-info.ts']` | ❌ | Files to exclude from analysis (e.g., generated files, type defs) |
42
+
43
+ ---
44
+
45
+ ## ⚠️ Caution: Using with `@query-key-gen/generator`
46
+
47
+ If you're using [`@query-key-gen/generator`](https://npmjs.com/package/@query-key-gen/generator) together with this plugin, **make sure to exclude its output file** in the `ignoreFiles` array to prevent circular analysis or unnecessary tracking.
48
+
49
+ ### ✅ Example
50
+
51
+ ```ts
52
+ // @query-key-gen/generator output path add
53
+ QueryKeyUsedPlugin({
54
+ ignoreFiles: ['./src/queryKeys.ts']
55
+ });
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 🛠 Full Example
61
+
62
+ ```ts
63
+ // vite.config.ts
64
+ import { defineConfig } from 'vite';
65
+ import react from '@vitejs/plugin-react';
66
+ import QueryKeyUsedPlugin from '@query-key-gen/used-generator';
67
+
68
+ export default defineConfig({
69
+ plugins: [
70
+ react(),
71
+ QueryKeyUsedPlugin({
72
+ output: './src/query-key-used-info.ts',
73
+ globalQueryKeyName: 'globalQueryKeys',
74
+ ignoreFiles: ['**/test/**', 'legacy.ts', './src/queryKeys.ts']
75
+ })
76
+ ]
77
+ });
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 📄 Generated Output Format
83
+
84
+ The plugin will generate a file like `query-key-used-info.ts` containing an array of usage entries:
85
+
86
+ ```ts
87
+ interface QueryKeyUsedInfo {
88
+ sourceFile: {
89
+ name: string;
90
+ };
91
+ ['query-key']: {
92
+ name: string;
93
+ pos: number;
94
+ end: number;
95
+ };
96
+ func: {
97
+ name: string;
98
+ pos: number;
99
+ end: number;
100
+ };
101
+ }
102
+
103
+ export const queryKeyUsedInfo: QueryKeyUsedInfo[] = [
104
+ {
105
+ sourceFile: { name: 'service/mutation.ts' },
106
+ 'query-key': { name: "globalQueryKeys.post['def']", pos: 384, end: 412 },
107
+ func: { name: 'useExampleMutation', pos: 130, end: 436 }
108
+ }
109
+ ];
110
+ ```
111
+
112
+ ### 💡 Uses
113
+
114
+ - Analyze which `queryKey`s are actively used
115
+ - Clean up unused keys
116
+ - Visualize usage map of data dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@query-key-gen/used-generator",
3
- "version": "0.10.0",
3
+ "version": "0.11.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {