@koderlabs/tasks-sdk-vue 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 +77 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,9 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @koderlabs/tasks-sdk-vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Runtime: browser DOM with Vue **3** only. Vue 2 is not supported.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Vue 3 plugin for the InstantTasks SDK. Initialises the core client at `app.use(...)` and wires `app.config.errorHandler` so unhandled Vue render errors are reported. Provides the client to the entire component tree via Vue's `provide` / `inject`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @koderlabs/tasks-sdk @koderlabs/tasks-sdk-vue
|
|
11
|
+
# plus integrations as needed:
|
|
12
|
+
pnpm add @koderlabs/tasks-sdk-web-errors @koderlabs/tasks-sdk-web-network @koderlabs/tasks-sdk-web-reporter
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Peer: `vue: ^3`.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// main.ts
|
|
21
|
+
import { createApp } from 'vue';
|
|
22
|
+
import App from './App.vue';
|
|
23
|
+
import { createInstantTasksPlugin } from '@koderlabs/tasks-sdk-vue';
|
|
24
|
+
import { errorsIntegration } from '@koderlabs/tasks-sdk-web-errors';
|
|
25
|
+
import { reporterIntegration } from '@koderlabs/tasks-sdk-web-reporter';
|
|
26
|
+
|
|
27
|
+
createApp(App)
|
|
28
|
+
.use(
|
|
29
|
+
createInstantTasksPlugin({
|
|
30
|
+
projectId: 'FE',
|
|
31
|
+
accessKey: import.meta.env.VITE_IT_ACCESS_KEY,
|
|
32
|
+
integrations: [errorsIntegration(), reporterIntegration()],
|
|
33
|
+
}),
|
|
34
|
+
)
|
|
35
|
+
.mount('#app');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Inside any component (Composition API):
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { injectInstantTasks } from '@koderlabs/tasks-sdk-vue';
|
|
42
|
+
|
|
43
|
+
const client = injectInstantTasks();
|
|
44
|
+
(client as any).errors?.notify(new Error('oops'));
|
|
45
|
+
(client as any).reporter?.show();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
| Export | Purpose |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `createInstantTasksPlugin(opts: InitOptions)` | Factory returning a Vue 3 Plugin. Pass `app.use(...)`. |
|
|
53
|
+
| `injectInstantTasks(): Client` | Composition-API helper. Throws if called outside `setup()` or when the plugin is not installed. |
|
|
54
|
+
| `installInstantTasks(app, opts)` | Lower-level installer that returns `{ client, uninstall }`. Used by the plugin internally; call directly if you need an explicit teardown handle (Vite HMR / tests). |
|
|
55
|
+
| `INSTANTTASKS_KEY` | Vue injection key (rarely needed). |
|
|
56
|
+
|
|
57
|
+
## Error-handler chain
|
|
58
|
+
|
|
59
|
+
`installInstantTasks` wraps any pre-existing `app.config.errorHandler` so the **host's handler runs first**, then the SDK observes/reports. This matches the framework-first convention used by Pinia, Vue Router, and vue-i18n.
|
|
60
|
+
|
|
61
|
+
On `uninstall()`, the original handler is restored — calling install/uninstall repeatedly does not stack wrappers.
|
|
62
|
+
|
|
63
|
+
## Caveats
|
|
64
|
+
|
|
65
|
+
- Vue 2 is **not** supported. Peer dependency pins `vue: ^3`.
|
|
66
|
+
- `app.use(plugin)` is idempotent in Vue but `init()` itself is also idempotent — a re-mount tears down the prior client cleanly.
|
|
67
|
+
- `injectInstantTasks()` throws when called outside `setup()` (e.g. at module top-level) or when the plugin wasn't installed on the active app. Catch in tests if you need to.
|
|
68
|
+
- Vue has no first-class "App unmount" event; if you need clean teardown (Vite HMR, tests), use `installInstantTasks(app, opts)` and call the returned `uninstall()` yourself.
|
|
69
|
+
- The plugin only catches errors that go through `app.config.errorHandler` — unhandled promise rejections and global `window.onerror` need `@koderlabs/tasks-sdk-web-errors`.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Suite overview
|
|
74
|
+
|
|
75
|
+
Full SDK suite map + platform availability matrix: [docs/sdk/overview.md](https://github.com/jawaidgadiwala/instant-tasks/blob/main/docs/sdk/overview.md).
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
KoderLabs proprietary. See [`LICENSE`](./LICENSE) for terms. Use of this package requires a separate signed written agreement with KoderLabs; access alone confers no rights.
|
|
8
80
|
|
|
9
81
|
Licensing inquiries: jawaidgadiwala@gmail.com
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koderlabs/tasks-sdk-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vue 3 plugin for the InstantTasks SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"instanttasks",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
],
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@koderlabs/tasks-sdk": "0.1.
|
|
42
|
+
"@koderlabs/tasks-sdk": "0.1.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vue": "^3"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"node": ">=20"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
|
-
"access": "
|
|
59
|
+
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsup",
|