@blipit/react-native 0.1.0 → 0.2.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/CHANGELOG.md +3 -0
- package/README.md +1 -1
- package/dist/index.cjs +13 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -4
- package/package.json +10 -9
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Blipit.init({ key: "<public key>", project: <project id>, environment: "producti
|
|
|
23
23
|
export default Blipit.wrap(App);
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Both values are on the project's Keys page at app.blipit.io. Unhandled JavaScript errors and native crashes are reported on their own.
|
|
26
|
+
Both values are on the project's Keys page at app.blipit.io. If the key or project id is empty, `init` logs a warning, returns `false` and Blipit stays off; it never throws, so a missing key cannot crash the app at launch. Unhandled JavaScript errors and native crashes are reported on their own.
|
|
27
27
|
|
|
28
28
|
## Manual capture
|
|
29
29
|
|
package/dist/index.cjs
CHANGED
|
@@ -51,17 +51,26 @@ function dsn(key, project, endpoint = DEFAULT_ENDPOINT) {
|
|
|
51
51
|
const scheme = endpoint.startsWith("http://") ? "http" : "https";
|
|
52
52
|
return `${scheme}://${key}@${host}/${project}`;
|
|
53
53
|
}
|
|
54
|
+
var MISSING_KEY = "[blipit] Blipit.init got no key, so Blipit is off and nothing is sent. Pass the project's public key (app.blipit.io, Keys); with Expo, check that EXPO_PUBLIC_BLIPIT_KEY is set at build time.";
|
|
55
|
+
var MISSING_PROJECT = "[blipit] Blipit.init got no project id, so Blipit is off and nothing is sent. Pass project with the id from the project's Keys page at app.blipit.io.";
|
|
54
56
|
function init2(options) {
|
|
55
|
-
const { key, publicKey, project, endpoint, ...rest } = options;
|
|
56
|
-
const k = key ?? publicKey;
|
|
57
|
-
if (!k)
|
|
58
|
-
|
|
57
|
+
const { key, publicKey, project, endpoint, ...rest } = options ?? {};
|
|
58
|
+
const k = (key ?? publicKey ?? "").trim();
|
|
59
|
+
if (!k) {
|
|
60
|
+
console.warn(MISSING_KEY);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (project === void 0 || project === null || String(project).trim() === "") {
|
|
64
|
+
console.warn(MISSING_PROJECT);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
59
67
|
Sentry.init({
|
|
60
68
|
dsn: dsn(k, project, endpoint),
|
|
61
69
|
sendDefaultPii: false,
|
|
62
70
|
tracesSampleRate: 0,
|
|
63
71
|
...rest
|
|
64
72
|
});
|
|
73
|
+
return true;
|
|
65
74
|
}
|
|
66
75
|
function captureSecurity(kind, actor, details = {}) {
|
|
67
76
|
const context = { kind, actor };
|
package/dist/index.d.cts
CHANGED
|
@@ -16,7 +16,7 @@ interface SecurityDetails {
|
|
|
16
16
|
target?: string;
|
|
17
17
|
}
|
|
18
18
|
declare function dsn(key: string, project: string | number, endpoint?: string): string;
|
|
19
|
-
declare function init(options: BlipitOptions):
|
|
19
|
+
declare function init(options: BlipitOptions): boolean;
|
|
20
20
|
declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
|
|
21
21
|
|
|
22
22
|
export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, captureSecurity, dsn, init };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ interface SecurityDetails {
|
|
|
16
16
|
target?: string;
|
|
17
17
|
}
|
|
18
18
|
declare function dsn(key: string, project: string | number, endpoint?: string): string;
|
|
19
|
-
declare function init(options: BlipitOptions):
|
|
19
|
+
declare function init(options: BlipitOptions): boolean;
|
|
20
20
|
declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
|
|
21
21
|
|
|
22
22
|
export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, captureSecurity, dsn, init };
|
package/dist/index.js
CHANGED
|
@@ -7,17 +7,26 @@ function dsn(key, project, endpoint = DEFAULT_ENDPOINT) {
|
|
|
7
7
|
const scheme = endpoint.startsWith("http://") ? "http" : "https";
|
|
8
8
|
return `${scheme}://${key}@${host}/${project}`;
|
|
9
9
|
}
|
|
10
|
+
var MISSING_KEY = "[blipit] Blipit.init got no key, so Blipit is off and nothing is sent. Pass the project's public key (app.blipit.io, Keys); with Expo, check that EXPO_PUBLIC_BLIPIT_KEY is set at build time.";
|
|
11
|
+
var MISSING_PROJECT = "[blipit] Blipit.init got no project id, so Blipit is off and nothing is sent. Pass project with the id from the project's Keys page at app.blipit.io.";
|
|
10
12
|
function init2(options) {
|
|
11
|
-
const { key, publicKey, project, endpoint, ...rest } = options;
|
|
12
|
-
const k = key ?? publicKey;
|
|
13
|
-
if (!k)
|
|
14
|
-
|
|
13
|
+
const { key, publicKey, project, endpoint, ...rest } = options ?? {};
|
|
14
|
+
const k = (key ?? publicKey ?? "").trim();
|
|
15
|
+
if (!k) {
|
|
16
|
+
console.warn(MISSING_KEY);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (project === void 0 || project === null || String(project).trim() === "") {
|
|
20
|
+
console.warn(MISSING_PROJECT);
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
15
23
|
Sentry.init({
|
|
16
24
|
dsn: dsn(k, project, endpoint),
|
|
17
25
|
sendDefaultPii: false,
|
|
18
26
|
tracesSampleRate: 0,
|
|
19
27
|
...rest
|
|
20
28
|
});
|
|
29
|
+
return true;
|
|
21
30
|
}
|
|
22
31
|
function captureSecurity(kind, actor, details = {}) {
|
|
23
32
|
const context = { kind, actor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blipit/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Blipit error monitoring for React Native and Expo. Know your app broke before your users tell you.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,14 +15,10 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"CHANGELOG.md"
|
|
19
20
|
],
|
|
20
21
|
"sideEffects": false,
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
23
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
24
|
-
"test": "node --experimental-strip-types --experimental-test-module-mocks --test test/init.test.ts"
|
|
25
|
-
},
|
|
26
22
|
"peerDependencies": {
|
|
27
23
|
"@sentry/react-native": ">=6"
|
|
28
24
|
},
|
|
@@ -53,5 +49,10 @@
|
|
|
53
49
|
"expo",
|
|
54
50
|
"error-monitoring",
|
|
55
51
|
"blipit"
|
|
56
|
-
]
|
|
57
|
-
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
55
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
56
|
+
"test": "node --experimental-strip-types --experimental-test-module-mocks --test test/init.test.ts"
|
|
57
|
+
}
|
|
58
|
+
}
|