Open History to see the last commit
1import { EventClient } from '@tanstack/devtools-event-client'
2β
3export interface PackageJson {
4 name?: string
5 version?: string
6 description?: string
7 author?: string
8 license?: string
9 scripts?: Record<string, string>
10 keywords?: Array<string>
11 homepage?: string
12 repository?:
13 | string
14 | {
15 type: string
16 url: string
17 }
18 bugs?:
19 | string
20 | {
21 url?: string
22 email?: string
23 }
24 readme?: string
25 packageManager?: string
26 engines?: Record<string, string>
27 private?: boolean
28 type?: 'module' | 'commonjs'
29 overrides?: Record<string, string>
30 dependencies?: Record<string, string>
31 devDependencies?: Record<string, string>
32 peerDependencies?: Record<string, string>
33 [key: string]: any
34}
35β
36export interface OutdatedDeps {
37 [key: string]: {
38 current: string
39 wanted: string
40 latest: string
41 dependent: string
42 location: string
43 }
44}
45β
46export interface PluginInjection {
47 packageName: string
48 pluginName: string
49 pluginImport?: {
50 importName: string
51 type: 'jsx' | 'function'
52 }
53}
54β
55interface EventMap {
56 ready: {
57 packageJson: PackageJson | null
58 outdatedDeps: OutdatedDeps | null
59 }
60 'outdated-deps-read': {
61 outdatedDeps: OutdatedDeps | null
62 }
63 'package-json-read': {
64 packageJson: PackageJson | null
65 }
66 mounted: void
67 'install-devtools': PluginInjection
68 'devtools-installed': {
69 packageName: string
70 success: boolean
71 error?: string
72 }
73 'add-plugin-to-devtools': PluginInjection
74 'plugin-added': {
75 packageName: string
76 success: boolean
77 error?: string
78 }
79 'bump-package-version': PluginInjection & {
80 devtoolsPackage: string
81 minVersion?: string
82 }
83 'package-json-updated': {
84 packageJson: PackageJson | null
85 }
86 'trigger-toggled': {
87 isOpen: boolean
88 }
89}
90β
91export class DevtoolsEventClient extends EventClient<EventMap> {
92 constructor() {
93 super({
94 pluginId: 'tanstack-devtools-core',
95 })
96 }
97}
98β
99const devtoolsEventClient = new DevtoolsEventClient()
100β
101export { devtoolsEventClient }