@watchupltd/svelte 0.1.9
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/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -0
- package/src/index.ts +50 -0
- package/tsconfig.json +9 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { initBrowserWatchUp, BrowserWatchUpOptions } from "@watchup/browser";
|
|
2
|
+
import { WatchUpClient } from "@watchup/core";
|
|
3
|
+
export * from "@watchup/core";
|
|
4
|
+
export { initBrowserWatchUp };
|
|
5
|
+
export interface ReadableWatchUpStore {
|
|
6
|
+
subscribe(run: (client: WatchUpClient | null) => void): () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function initSvelteWatchUp(options: BrowserWatchUpOptions): WatchUpClient;
|
|
9
|
+
export declare function getSvelteWatchUp(): WatchUpClient;
|
|
10
|
+
export declare function watchUpStore(): ReadableWatchUpStore;
|
|
11
|
+
export declare function captureSvelteError(error: unknown, metadata?: Record<string, unknown>): void;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACpE;AAKD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,aAAa,CAI/E;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAKhD;AAED,wBAAgB,YAAY,IAAI,oBAAoB,CAUnD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAQ3F"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { initBrowserWatchUp } from "@watchup/browser";
|
|
2
|
+
export * from "@watchup/core";
|
|
3
|
+
export { initBrowserWatchUp };
|
|
4
|
+
let client = null;
|
|
5
|
+
const subscribers = new Set();
|
|
6
|
+
export function initSvelteWatchUp(options) {
|
|
7
|
+
client = initBrowserWatchUp(options);
|
|
8
|
+
notify();
|
|
9
|
+
return client;
|
|
10
|
+
}
|
|
11
|
+
export function getSvelteWatchUp() {
|
|
12
|
+
if (!client) {
|
|
13
|
+
throw new Error("WatchUp Svelte client has not been initialized");
|
|
14
|
+
}
|
|
15
|
+
return client;
|
|
16
|
+
}
|
|
17
|
+
export function watchUpStore() {
|
|
18
|
+
return {
|
|
19
|
+
subscribe(run) {
|
|
20
|
+
subscribers.add(run);
|
|
21
|
+
run(client);
|
|
22
|
+
return () => {
|
|
23
|
+
subscribers.delete(run);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function captureSvelteError(error, metadata) {
|
|
29
|
+
if (!client) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
void client.captureException(error, {
|
|
33
|
+
service: "svelte",
|
|
34
|
+
metadata
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function notify() {
|
|
38
|
+
subscribers.forEach((run) => run(client));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAA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
"version": "0.1.9",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.json"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@watchupltd/browser": "0.1.9",
|
|
18
|
+
"@watchupltd/core": "0.1.9"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"svelte": ">=4"
|
|
22
|
+
},
|
|
23
|
+
"peerDependenciesMeta": {
|
|
24
|
+
"svelte": {
|
|
25
|
+
"optional": true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { initBrowserWatchUp, BrowserWatchUpOptions } from "@watchup/browser";
|
|
2
|
+
import { WatchUpClient } from "@watchup/core";
|
|
3
|
+
export * from "@watchup/core";
|
|
4
|
+
export { initBrowserWatchUp };
|
|
5
|
+
|
|
6
|
+
export interface ReadableWatchUpStore {
|
|
7
|
+
subscribe(run: (client: WatchUpClient | null) => void): () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let client: WatchUpClient | null = null;
|
|
11
|
+
const subscribers = new Set<(client: WatchUpClient | null) => void>();
|
|
12
|
+
|
|
13
|
+
export function initSvelteWatchUp(options: BrowserWatchUpOptions): WatchUpClient {
|
|
14
|
+
client = initBrowserWatchUp(options);
|
|
15
|
+
notify();
|
|
16
|
+
return client;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getSvelteWatchUp(): WatchUpClient {
|
|
20
|
+
if (!client) {
|
|
21
|
+
throw new Error("WatchUp Svelte client has not been initialized");
|
|
22
|
+
}
|
|
23
|
+
return client;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function watchUpStore(): ReadableWatchUpStore {
|
|
27
|
+
return {
|
|
28
|
+
subscribe(run) {
|
|
29
|
+
subscribers.add(run);
|
|
30
|
+
run(client);
|
|
31
|
+
return () => {
|
|
32
|
+
subscribers.delete(run);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function captureSvelteError(error: unknown, metadata?: Record<string, unknown>): void {
|
|
39
|
+
if (!client) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
void client.captureException(error, {
|
|
43
|
+
service: "svelte",
|
|
44
|
+
metadata
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function notify(): void {
|
|
49
|
+
subscribers.forEach((run) => run(client));
|
|
50
|
+
}
|