-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathworldwide.ts
More file actions
109 lines (105 loc) · 4.54 KB
/
Copy pathworldwide.ts
File metadata and controls
109 lines (105 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
* you must either a) use `console.log` rather than the `debug` singleton, or b) put your function elsewhere.
*
* Note: This file was originally called `global.ts`, but was changed to unblock users which might be doing
* string replaces with bundlers like Vite for `global` (would break imports that rely on importing from utils/src/global).
*
* Why worldwide?
*
* Why not?
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { Integration } from '../types/integration';
import type { Carrier } from '../carrier';
import type { SdkSource } from './env';
/** Internal global with common properties and Sentry extensions */
export type InternalGlobal = {
navigator?: { userAgent?: string; maxTouchPoints?: number };
console: Console;
PerformanceObserver?: any;
Sentry?: any;
onerror?: {
(event: object | string, source?: string, lineno?: number, colno?: number, error?: Error): any;
__SENTRY_INSTRUMENTED__?: true;
};
onunhandledrejection?: {
(event: unknown): boolean;
__SENTRY_INSTRUMENTED__?: true;
};
SENTRY_ENVIRONMENT?: string;
SENTRY_DSN?: string;
SENTRY_RELEASE?: {
id?: string;
};
SENTRY_SDK_SOURCE?: SdkSource;
/**
* Debug IDs are indirectly injected by Sentry CLI or bundler plugins to directly reference a particular source map
* for resolving of a source file. The injected code will place an entry into the record for each loaded bundle/JS
* file.
*/
_sentryDebugIds?: Record<string, string>;
/**
* Native debug IDs implementation (e.g., from Vercel).
* This uses the same format as _sentryDebugIds but with a different global name.
* Keys are `error.stack` strings, values are debug IDs.
*/
_debugIds?: Record<string, string>;
/**
* Raw module metadata that is injected by bundler plugins.
*
* Keys are `error.stack` strings, values are the metadata.
*/
_sentryModuleMetadata?: Record<string, any>;
_sentryWrappedDepth?: number;
/**
* Bundler and runtime instrumentation detection.
*/
__SENTRY_ORCHESTRION__?: {
/** Empty array signifies runtime hooked */
runtime?: string[];
/**
* The resolved `file:` URL of a transformed file for each runtime-injected
* module, keyed by module name (e.g. `@mastra/core`). Lets an integration
* anchor `createRequire` on the app's actual copy of a dependency without
* relying on `process.cwd()` or the CJS `require.cache` — the latter is
* always empty for ESM-loaded modules. Only the runtime `--import`/hook path
* populates this; the bundler path inlines modules and records none.
*/
runtimeFiles?: Record<string, string>;
/**
* Module names recorded as each bundler-transformed module loads (the
* injected snippet calls `orchestrionModuleInjected`). The bundler plugin's
* entry banner ensures an empty `Set` at boot, so a defined set — even
* empty — signifies the plugin ran.
*/
bundler?: Set<string>;
/**
* Channel-subscriber integration factories stored by the snippet the
* bundler transform splices into each instrumented module, keyed by module
* name. A factory shared by several packages (e.g. pg/pg-pool) appears
* under several keys; integration-name deduplication collapses them at
* setup. A bundler-only SDK (e.g. `@sentry/cloudflare`) reads these at
* `init()` and instantiates them.
*/
integrations?: Map<string, () => Integration>;
/**
* Set once `registerDiagnosticsChannelInjection()` has run but could not
* install the runtime module hooks — most commonly because
* `@sentry/server-runtime-injection` was bundled into the app (which strips its vendored
* code transformer) or the Node runtime lacks the required module-hook API.
* Dedupes the one-time warning and short-circuits repeat calls.
*/
runtimeUnavailable?: boolean;
/**
* Module namespaces stashed by build-time provider imports, keyed by module
* name (e.g. `@mastra/observability`). A bundler plugin can splice a static
* `import * as ns from '<pkg>'` into an integration and record `ns` here, so
* the integration can read a bundled peer dependency it cannot `createRequire`
* in a bundled runtime such as Cloudflare Workers.
*/
providedModules?: Record<string, Record<string, unknown>>;
};
} & Carrier;
/** Get's the global object for the current JavaScript runtime */
export const GLOBAL_OBJ = globalThis as unknown as InternalGlobal;