@tracewayapp/vue 0.2.0 → 1.0.0
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 +34 -19
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,54 +1,69 @@
|
|
|
1
1
|
# @tracewayapp/vue
|
|
2
2
|
|
|
3
|
-
Vue
|
|
3
|
+
Vue 3 integration for Traceway. Provides a plugin with automatic error handling and a composable.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tracewayapp/vue
|
|
9
|
+
```
|
|
4
10
|
|
|
5
11
|
## Setup
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
Install the Traceway plugin in your Vue application:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
8
16
|
import { createApp } from "vue";
|
|
9
17
|
import { createTracewayPlugin } from "@tracewayapp/vue";
|
|
10
18
|
import App from "./App.vue";
|
|
11
19
|
|
|
12
20
|
const app = createApp(App);
|
|
13
21
|
|
|
14
|
-
app.use(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
options: { debug: true }, // optional
|
|
18
|
-
})
|
|
19
|
-
);
|
|
22
|
+
app.use(createTracewayPlugin({
|
|
23
|
+
connectionString: "your-token@https://traceway.example.com/api/report",
|
|
24
|
+
}));
|
|
20
25
|
|
|
21
26
|
app.mount("#app");
|
|
22
27
|
```
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
The plugin automatically installs a global error handler (`app.config.errorHandler`) that captures all Vue component errors and reports them to Traceway.
|
|
29
|
+
The plugin automatically installs a global error handler that captures uncaught errors.
|
|
27
30
|
|
|
28
31
|
## useTraceway Composable
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
Use the `useTraceway` composable to capture errors in components:
|
|
31
34
|
|
|
32
35
|
```vue
|
|
33
|
-
<script setup
|
|
36
|
+
<script setup>
|
|
34
37
|
import { useTraceway } from "@tracewayapp/vue";
|
|
35
38
|
|
|
36
|
-
const { captureException
|
|
39
|
+
const { captureException } = useTraceway();
|
|
37
40
|
|
|
38
|
-
function
|
|
41
|
+
async function handleSubmit() {
|
|
39
42
|
try {
|
|
40
|
-
|
|
41
|
-
} catch (
|
|
42
|
-
captureException(
|
|
43
|
+
await submitForm();
|
|
44
|
+
} catch (error) {
|
|
45
|
+
captureException(error);
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
</script>
|
|
46
49
|
|
|
47
50
|
<template>
|
|
48
|
-
<button @click="
|
|
51
|
+
<button @click="handleSubmit">Submit</button>
|
|
49
52
|
</template>
|
|
50
53
|
```
|
|
51
54
|
|
|
55
|
+
## With Options
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
app.use(createTracewayPlugin({
|
|
59
|
+
connectionString: "your-token@https://traceway.example.com/api/report",
|
|
60
|
+
options: {
|
|
61
|
+
debug: true,
|
|
62
|
+
version: "1.0.0",
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
65
|
+
```
|
|
66
|
+
|
|
52
67
|
## API
|
|
53
68
|
|
|
54
69
|
### createTracewayPlugin(options)
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tracewayapp/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Traceway Vue.js integration with plugin and composable",
|
|
5
|
-
"main": "./dist/index.
|
|
6
|
-
"module": "./dist/index.
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.
|
|
12
|
-
"require": "./dist/index.
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dev": "tsup --watch"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tracewayapp/frontend": "0.
|
|
26
|
+
"@tracewayapp/frontend": "1.0.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vue": ">=3.3.0"
|