@vingy/vuebugger 0.1.0 → 0.1.1
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/README.md +47 -2
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Vuebugger
|
|
2
2
|
|
|
3
|
-
Vue devtools for
|
|
3
|
+
Vue devtools provide an easy way to inspect component state. But when having something like a composable, you actually need to catch all the returned values in order for them to show up in the devtools. This is where this package can come in handy.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Debug composables and reactive state easily
|
|
8
|
+
- Tree-shakable with zero runtime overhead
|
|
9
|
+
- Simple API: just call `debug(name, state)`
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add -D @vingy/vuebugger
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Register the plugin in your app:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import Vuebugger from '@vingy/vuebugger'
|
|
21
|
+
|
|
22
|
+
createApp(App).use(Vuebugger)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
`debug()` registers values from composables so they show up in Vue Devtools.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { debug } from '@vingy/vuebugger'
|
|
31
|
+
|
|
32
|
+
export const useFoo = (initial: number) => {
|
|
33
|
+
const multiplier = ref(1) // not easy to debug if something goes wrong
|
|
34
|
+
|
|
35
|
+
const inc = () => multiplier.value++
|
|
36
|
+
const dec = () => multiplier.value--
|
|
37
|
+
|
|
38
|
+
const value = computed(() => initial * multiplier)
|
|
39
|
+
|
|
40
|
+
debug('useFoo', { multiplier }) // now visible in devtools
|
|
41
|
+
|
|
42
|
+
return { value, inc, dec }
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
See the demo app in [demo/](demo).
|
|
47
|
+
|
|
48
|
+
> **Note:** This plugin is tree-shakable and has zero runtime overhead when `debug()` calls are not used.
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vingy/vuebugger",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vue devtools plugin to debug anything.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"composable",
|
|
7
|
+
"composition-api",
|
|
8
|
+
"debugging",
|
|
6
9
|
"devtools",
|
|
10
|
+
"plugin",
|
|
11
|
+
"state",
|
|
7
12
|
"vue"
|
|
8
13
|
],
|
|
9
14
|
"license": "MIT",
|
|
10
15
|
"author": "vingy",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/vinpogo/vuebugger"
|
|
19
|
+
},
|
|
11
20
|
"files": [
|
|
12
21
|
"dist"
|
|
13
22
|
],
|