@pdfvector/util 0.0.5

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.
@@ -0,0 +1,10 @@
1
+ export declare const isCI: boolean;
2
+ export declare const isLocal: boolean;
3
+ export declare const isLive: boolean;
4
+ export declare const instancePort = 34000;
5
+ export declare const productTitle = "PDF Vector";
6
+ export interface ErrorService {
7
+ captureError: (error: unknown) => void;
8
+ }
9
+ export declare const errorService: ErrorService;
10
+ export declare function captureError(error: unknown): void;
@@ -0,0 +1,66 @@
1
+ function getCIWithBun() {
2
+ try {
3
+ return Bun.env.CI;
4
+ }
5
+ catch { }
6
+ }
7
+ function getCIWithNode() {
8
+ try {
9
+ return process.env.CI;
10
+ }
11
+ catch { }
12
+ }
13
+ function getCIWithNext() {
14
+ try {
15
+ return process.env.NEXT_PUBLIC_CI;
16
+ }
17
+ catch { }
18
+ }
19
+ function getCIWithVite() {
20
+ try {
21
+ return import.meta.env.VITE_CI;
22
+ }
23
+ catch { }
24
+ }
25
+ function getLocalWithBun() {
26
+ try {
27
+ return Bun.env.PDFVECTOR_LOCAL;
28
+ }
29
+ catch { }
30
+ }
31
+ function getLocalWithNode() {
32
+ try {
33
+ return process.env.PDFVECTOR_LOCAL;
34
+ }
35
+ catch { }
36
+ }
37
+ function getLocalWithNext() {
38
+ try {
39
+ return process.env.NEXT_PUBLIC_PDFVECTOR_LOCAL;
40
+ }
41
+ catch { }
42
+ }
43
+ function getLocalWithVite() {
44
+ try {
45
+ return import.meta.env.VITE_PDFVECTOR_LOCAL;
46
+ }
47
+ catch { }
48
+ }
49
+ const envCI = getCIWithBun() ?? getCIWithNode() ?? getCIWithNext() ?? getCIWithVite();
50
+ const envLocal = getLocalWithBun() ??
51
+ getLocalWithNode() ??
52
+ getLocalWithNext() ??
53
+ getLocalWithVite();
54
+ export const isCI = envCI === "1" || envCI === "true";
55
+ export const isLocal = envLocal === "1" || envLocal === "true";
56
+ export const isLive = !isLocal;
57
+ export const instancePort = 34000;
58
+ export const productTitle = "PDF Vector";
59
+ export const errorService = {
60
+ captureError: (error) => {
61
+ console.error(error);
62
+ },
63
+ };
64
+ export function captureError(error) {
65
+ errorService.captureError(error);
66
+ }
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@pdfvector/util",
3
+ "version": "0.0.5",
4
+ "type": "module",
5
+ "main": ".tsc/lib/index.js",
6
+ "scripts": {
7
+ "transpile": "tsc --build --emitDeclarationOnly false"
8
+ },
9
+ "files": [
10
+ ".tsc",
11
+ "!.tsc/**/*.tsbuildinfo"
12
+ ]
13
+ }