@sentry/profiling-node 8.48.0 → 8.49.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/lib/cjs/index.js +47 -33
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +47 -49
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +1 -1
- package/lib/sentry_cpu_profiler-darwin-arm64-108.node +0 -0
- package/lib/sentry_cpu_profiler-darwin-arm64-115.node +0 -0
- package/lib/sentry_cpu_profiler-darwin-arm64-127.node +0 -0
- package/lib/sentry_cpu_profiler-darwin-arm64-93.node +0 -0
- package/lib/sentry_cpu_profiler-darwin-x64-108.node +0 -0
- package/lib/sentry_cpu_profiler-darwin-x64-115.node +0 -0
- package/lib/sentry_cpu_profiler-darwin-x64-127.node +0 -0
- package/lib/sentry_cpu_profiler-darwin-x64-93.node +0 -0
- package/lib/sentry_cpu_profiler-win32-x64-108.node +0 -0
- package/lib/sentry_cpu_profiler-win32-x64-115.node +0 -0
- package/lib/sentry_cpu_profiler-win32-x64-127.node +0 -0
- package/lib/sentry_cpu_profiler-win32-x64-93.node +0 -0
- package/lib/types/cpu_profiler.d.ts.map +1 -1
- package/package.json +4 -3
package/lib/esm/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { _nullishCoalesce, _optionalChain, _optionalChainDelete } from '@sentry/core';
|
|
2
2
|
import { logger, GLOBAL_OBJ, parseSemver, forEachEnvelopeItem, createEnvelope, getDebugImagesForResources, uuid4, dsnToString, spanIsSampled, spanToJSON, LRUMap, defineIntegration, consoleSandbox, getRootSpan, getIsolationScope, getCurrentScope, getGlobalScope } from '@sentry/core';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
3
4
|
import { platform as platform$1, arch as arch$1 } from 'node:os';
|
|
4
|
-
import
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
6
|
import { versions, env } from 'node:process';
|
|
7
|
+
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
6
8
|
import { threadId } from 'node:worker_threads';
|
|
7
9
|
import { familySync } from 'detect-libc';
|
|
8
10
|
import { getAbi } from 'node-abi';
|
|
9
|
-
import cjsUrl from 'node:url';
|
|
10
|
-
import cjsModule from 'node:module';
|
|
11
11
|
import * as os from 'os';
|
|
12
12
|
import { versions as versions$1, env as env$1 } from 'process';
|
|
13
13
|
import { threadId as threadId$1, isMainThread } from 'worker_threads';
|
|
@@ -19,42 +19,38 @@ import { threadId as threadId$1, isMainThread } from 'worker_threads';
|
|
|
19
19
|
*/
|
|
20
20
|
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
21
21
|
|
|
22
|
-
if(typeof __filename === 'undefined'){
|
|
23
|
-
globalThis.__filename = cjsUrl.fileURLToPath(import.meta.url);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if(typeof __dirname === 'undefined'){
|
|
27
|
-
globalThis.__dirname = cjsPath.dirname(__filename);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if(typeof require === 'undefined'){
|
|
31
|
-
globalThis.require = cjsModule.createRequire(import.meta.url);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
22
|
const stdlib = familySync();
|
|
36
23
|
const platform = process.env['BUILD_PLATFORM'] || platform$1();
|
|
37
24
|
const arch = process.env['BUILD_ARCH'] || arch$1();
|
|
38
25
|
const abi = getAbi(versions.node, 'node');
|
|
39
26
|
const identifier = [platform, arch, stdlib, abi].filter(c => c !== undefined && c !== null).join('-');
|
|
40
27
|
|
|
41
|
-
const built_from_source_path = resolve(__dirname, '..', `./sentry_cpu_profiler-${identifier}`);
|
|
42
|
-
|
|
43
28
|
/**
|
|
44
29
|
* Imports cpp bindings based on the current platform and architecture.
|
|
45
30
|
*/
|
|
46
31
|
// eslint-disable-next-line complexity
|
|
47
32
|
function importCppBindingsModule() {
|
|
33
|
+
// We need to work around using import.meta.url directly with import.meta.url because jest complains about it.
|
|
34
|
+
const importMetaUrl =
|
|
35
|
+
typeof import.meta.url !== 'undefined'
|
|
36
|
+
? // This case is always hit when the SDK is built
|
|
37
|
+
import.meta.url
|
|
38
|
+
: // This case is hit when the tests are run
|
|
39
|
+
pathToFileURL(__filename).href;
|
|
40
|
+
|
|
41
|
+
const createdRequire = createRequire(importMetaUrl);
|
|
42
|
+
const esmCompatibleDirname = dirname(fileURLToPath(importMetaUrl));
|
|
43
|
+
|
|
48
44
|
// If a binary path is specified, use that.
|
|
49
45
|
if (env['SENTRY_PROFILER_BINARY_PATH']) {
|
|
50
46
|
const envPath = env['SENTRY_PROFILER_BINARY_PATH'];
|
|
51
|
-
return
|
|
47
|
+
return createdRequire(envPath);
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
// If a user specifies a different binary dir, they are in control of the binaries being moved there
|
|
55
51
|
if (env['SENTRY_PROFILER_BINARY_DIR']) {
|
|
56
52
|
const binaryPath = join(resolve(env['SENTRY_PROFILER_BINARY_DIR']), `sentry_cpu_profiler-${identifier}`);
|
|
57
|
-
return
|
|
53
|
+
return createdRequire(`${binaryPath}.node`);
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
// We need the fallthrough so that in the end, we can fallback to the dynamic require.
|
|
@@ -62,31 +58,31 @@ function importCppBindingsModule() {
|
|
|
62
58
|
if (platform === 'darwin') {
|
|
63
59
|
if (arch === 'x64') {
|
|
64
60
|
if (abi === '93') {
|
|
65
|
-
return
|
|
61
|
+
return createdRequire('../sentry_cpu_profiler-darwin-x64-93.node');
|
|
66
62
|
}
|
|
67
63
|
if (abi === '108') {
|
|
68
|
-
return
|
|
64
|
+
return createdRequire('../sentry_cpu_profiler-darwin-x64-108.node');
|
|
69
65
|
}
|
|
70
66
|
if (abi === '115') {
|
|
71
|
-
return
|
|
67
|
+
return createdRequire('../sentry_cpu_profiler-darwin-x64-115.node');
|
|
72
68
|
}
|
|
73
69
|
if (abi === '127') {
|
|
74
|
-
return
|
|
70
|
+
return createdRequire('../sentry_cpu_profiler-darwin-x64-127.node');
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
|
|
78
74
|
if (arch === 'arm64') {
|
|
79
75
|
if (abi === '93') {
|
|
80
|
-
return
|
|
76
|
+
return createdRequire('../sentry_cpu_profiler-darwin-arm64-93.node');
|
|
81
77
|
}
|
|
82
78
|
if (abi === '108') {
|
|
83
|
-
return
|
|
79
|
+
return createdRequire('../sentry_cpu_profiler-darwin-arm64-108.node');
|
|
84
80
|
}
|
|
85
81
|
if (abi === '115') {
|
|
86
|
-
return
|
|
82
|
+
return createdRequire('../sentry_cpu_profiler-darwin-arm64-115.node');
|
|
87
83
|
}
|
|
88
84
|
if (abi === '127') {
|
|
89
|
-
return
|
|
85
|
+
return createdRequire('../sentry_cpu_profiler-darwin-arm64-127.node');
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
88
|
}
|
|
@@ -94,16 +90,16 @@ function importCppBindingsModule() {
|
|
|
94
90
|
if (platform === 'win32') {
|
|
95
91
|
if (arch === 'x64') {
|
|
96
92
|
if (abi === '93') {
|
|
97
|
-
return
|
|
93
|
+
return createdRequire('../sentry_cpu_profiler-win32-x64-93.node');
|
|
98
94
|
}
|
|
99
95
|
if (abi === '108') {
|
|
100
|
-
return
|
|
96
|
+
return createdRequire('../sentry_cpu_profiler-win32-x64-108.node');
|
|
101
97
|
}
|
|
102
98
|
if (abi === '115') {
|
|
103
|
-
return
|
|
99
|
+
return createdRequire('../sentry_cpu_profiler-win32-x64-115.node');
|
|
104
100
|
}
|
|
105
101
|
if (abi === '127') {
|
|
106
|
-
return
|
|
102
|
+
return createdRequire('../sentry_cpu_profiler-win32-x64-127.node');
|
|
107
103
|
}
|
|
108
104
|
}
|
|
109
105
|
}
|
|
@@ -112,66 +108,68 @@ function importCppBindingsModule() {
|
|
|
112
108
|
if (arch === 'x64') {
|
|
113
109
|
if (stdlib === 'musl') {
|
|
114
110
|
if (abi === '93') {
|
|
115
|
-
return
|
|
111
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-93.node');
|
|
116
112
|
}
|
|
117
113
|
if (abi === '108') {
|
|
118
|
-
return
|
|
114
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-108.node');
|
|
119
115
|
}
|
|
120
116
|
if (abi === '115') {
|
|
121
|
-
return
|
|
117
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-115.node');
|
|
122
118
|
}
|
|
123
119
|
if (abi === '127') {
|
|
124
|
-
return
|
|
120
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-127.node');
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
if (stdlib === 'glibc') {
|
|
128
124
|
if (abi === '93') {
|
|
129
|
-
return
|
|
125
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-93.node');
|
|
130
126
|
}
|
|
131
127
|
if (abi === '108') {
|
|
132
|
-
return
|
|
128
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-108.node');
|
|
133
129
|
}
|
|
134
130
|
if (abi === '115') {
|
|
135
|
-
return
|
|
131
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-115.node');
|
|
136
132
|
}
|
|
137
133
|
if (abi === '127') {
|
|
138
|
-
return
|
|
134
|
+
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-127.node');
|
|
139
135
|
}
|
|
140
136
|
}
|
|
141
137
|
}
|
|
142
138
|
if (arch === 'arm64') {
|
|
143
139
|
if (stdlib === 'musl') {
|
|
144
140
|
if (abi === '93') {
|
|
145
|
-
return
|
|
141
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-93.node');
|
|
146
142
|
}
|
|
147
143
|
if (abi === '108') {
|
|
148
|
-
return
|
|
144
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-108.node');
|
|
149
145
|
}
|
|
150
146
|
if (abi === '115') {
|
|
151
|
-
return
|
|
147
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-115.node');
|
|
152
148
|
}
|
|
153
149
|
if (abi === '127') {
|
|
154
|
-
return
|
|
150
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-127.node');
|
|
155
151
|
}
|
|
156
152
|
}
|
|
157
153
|
|
|
158
154
|
if (stdlib === 'glibc') {
|
|
159
155
|
if (abi === '93') {
|
|
160
|
-
return
|
|
156
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-93.node');
|
|
161
157
|
}
|
|
162
158
|
if (abi === '108') {
|
|
163
|
-
return
|
|
159
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-108.node');
|
|
164
160
|
}
|
|
165
161
|
if (abi === '115') {
|
|
166
|
-
return
|
|
162
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-115.node');
|
|
167
163
|
}
|
|
168
164
|
if (abi === '127') {
|
|
169
|
-
return
|
|
165
|
+
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-127.node');
|
|
170
166
|
}
|
|
171
167
|
}
|
|
172
168
|
}
|
|
173
169
|
}
|
|
174
|
-
|
|
170
|
+
|
|
171
|
+
const built_from_source_path = resolve(esmCompatibleDirname, '..', `sentry_cpu_profiler-${identifier}`);
|
|
172
|
+
return createdRequire(`${built_from_source_path}.node`);
|
|
175
173
|
}
|
|
176
174
|
|
|
177
175
|
const PrivateCpuProfilerBindings = importCppBindingsModule();
|