@sentry/profiling-node
Advanced tools
Comparing version
@@ -10,5 +10,7 @@ var { | ||
const core = require('@sentry/core'); | ||
const node_module = require('node:module'); | ||
const node_os = require('node:os'); | ||
const node_path = require('node:path'); | ||
const node_process = require('node:process'); | ||
const node_url = require('node:url'); | ||
const node_worker_threads = require('node:worker_threads'); | ||
@@ -21,2 +23,3 @@ const detectLibc = require('detect-libc'); | ||
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; | ||
/** | ||
@@ -35,4 +38,2 @@ * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code. | ||
const built_from_source_path = node_path.resolve(__dirname, '..', `./sentry_cpu_profiler-${identifier}`); | ||
/** | ||
@@ -43,6 +44,17 @@ * Imports cpp bindings based on the current platform and architecture. | ||
function importCppBindingsModule() { | ||
// We need to work around using import.meta.url directly with import.meta.url because jest complains about it. | ||
const importMetaUrl = | ||
typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) !== 'undefined' | ||
? // This case is always hit when the SDK is built | ||
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) | ||
: // This case is hit when the tests are run | ||
node_url.pathToFileURL(__filename).href; | ||
const createdRequire = node_module.createRequire(importMetaUrl); | ||
const esmCompatibleDirname = node_path.dirname(node_url.fileURLToPath(importMetaUrl)); | ||
// If a binary path is specified, use that. | ||
if (node_process.env['SENTRY_PROFILER_BINARY_PATH']) { | ||
const envPath = node_process.env['SENTRY_PROFILER_BINARY_PATH']; | ||
return require(envPath); | ||
return createdRequire(envPath); | ||
} | ||
@@ -53,3 +65,3 @@ | ||
const binaryPath = node_path.join(node_path.resolve(node_process.env['SENTRY_PROFILER_BINARY_DIR']), `sentry_cpu_profiler-${identifier}`); | ||
return require(`${binaryPath}.node`); | ||
return createdRequire(`${binaryPath}.node`); | ||
} | ||
@@ -62,12 +74,12 @@ | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-darwin-x64-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-darwin-x64-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-darwin-x64-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-darwin-x64-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-127.node'); | ||
} | ||
@@ -78,12 +90,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-127.node'); | ||
} | ||
@@ -96,12 +108,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-win32-x64-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-win32-x64-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-win32-x64-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-win32-x64-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-127.node'); | ||
} | ||
@@ -115,12 +127,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-127.node'); | ||
} | ||
@@ -130,12 +142,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-127.node'); | ||
} | ||
@@ -147,12 +159,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-127.node'); | ||
} | ||
@@ -163,12 +175,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-127.node'); | ||
} | ||
@@ -178,3 +190,5 @@ } | ||
} | ||
return require(`${built_from_source_path}.node`); | ||
const built_from_source_path = node_path.resolve(esmCompatibleDirname, '..', `sentry_cpu_profiler-${identifier}`); | ||
return createdRequire(`${built_from_source_path}.node`); | ||
} | ||
@@ -181,0 +195,0 @@ |
import { _nullishCoalesce, _optionalChain, _optionalChainDelete } from '@sentry/core'; | ||
import { logger, GLOBAL_OBJ, parseSemver, forEachEnvelopeItem, createEnvelope, getDebugImagesForResources, uuid4, dsnToString, spanIsSampled, spanToJSON, LRUMap, defineIntegration, consoleSandbox, getRootSpan, getIsolationScope, getCurrentScope, getGlobalScope } from '@sentry/core'; | ||
import { createRequire } from 'node:module'; | ||
import { platform as platform$1, arch as arch$1 } from 'node:os'; | ||
import cjsPath, { resolve, join } from 'node:path'; | ||
import { dirname, join, resolve } from 'node:path'; | ||
import { versions, env } from 'node:process'; | ||
import { pathToFileURL, fileURLToPath } from 'node:url'; | ||
import { threadId } from 'node:worker_threads'; | ||
import { familySync } from 'detect-libc'; | ||
import { getAbi } from 'node-abi'; | ||
import cjsUrl from 'node:url'; | ||
import cjsModule from 'node:module'; | ||
import * as os from 'os'; | ||
@@ -22,15 +22,2 @@ import { versions as versions$1, env as env$1 } from 'process'; | ||
if(typeof __filename === 'undefined'){ | ||
globalThis.__filename = cjsUrl.fileURLToPath(import.meta.url); | ||
} | ||
if(typeof __dirname === 'undefined'){ | ||
globalThis.__dirname = cjsPath.dirname(__filename); | ||
} | ||
if(typeof require === 'undefined'){ | ||
globalThis.require = cjsModule.createRequire(import.meta.url); | ||
} | ||
const stdlib = familySync(); | ||
@@ -42,4 +29,2 @@ const platform = process.env['BUILD_PLATFORM'] || platform$1(); | ||
const built_from_source_path = resolve(__dirname, '..', `./sentry_cpu_profiler-${identifier}`); | ||
/** | ||
@@ -50,6 +35,17 @@ * Imports cpp bindings based on the current platform and architecture. | ||
function importCppBindingsModule() { | ||
// We need to work around using import.meta.url directly with import.meta.url because jest complains about it. | ||
const importMetaUrl = | ||
typeof import.meta.url !== 'undefined' | ||
? // This case is always hit when the SDK is built | ||
import.meta.url | ||
: // This case is hit when the tests are run | ||
pathToFileURL(__filename).href; | ||
const createdRequire = createRequire(importMetaUrl); | ||
const esmCompatibleDirname = dirname(fileURLToPath(importMetaUrl)); | ||
// If a binary path is specified, use that. | ||
if (env['SENTRY_PROFILER_BINARY_PATH']) { | ||
const envPath = env['SENTRY_PROFILER_BINARY_PATH']; | ||
return require(envPath); | ||
return createdRequire(envPath); | ||
} | ||
@@ -60,3 +56,3 @@ | ||
const binaryPath = join(resolve(env['SENTRY_PROFILER_BINARY_DIR']), `sentry_cpu_profiler-${identifier}`); | ||
return require(`${binaryPath}.node`); | ||
return createdRequire(`${binaryPath}.node`); | ||
} | ||
@@ -69,12 +65,12 @@ | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-darwin-x64-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-darwin-x64-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-darwin-x64-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-darwin-x64-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-x64-127.node'); | ||
} | ||
@@ -85,12 +81,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-darwin-arm64-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-darwin-arm64-127.node'); | ||
} | ||
@@ -103,12 +99,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-win32-x64-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-win32-x64-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-win32-x64-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-win32-x64-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-win32-x64-127.node'); | ||
} | ||
@@ -122,12 +118,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-x64-musl-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-musl-127.node'); | ||
} | ||
@@ -137,12 +133,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-x64-glibc-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-x64-glibc-127.node'); | ||
} | ||
@@ -154,12 +150,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-arm64-musl-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-musl-127.node'); | ||
} | ||
@@ -170,12 +166,12 @@ } | ||
if (abi === '93') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-93.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-93.node'); | ||
} | ||
if (abi === '108') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-108.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-108.node'); | ||
} | ||
if (abi === '115') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-115.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-115.node'); | ||
} | ||
if (abi === '127') { | ||
return require('../sentry_cpu_profiler-linux-arm64-glibc-127.node'); | ||
return createdRequire('../sentry_cpu_profiler-linux-arm64-glibc-127.node'); | ||
} | ||
@@ -185,3 +181,5 @@ } | ||
} | ||
return require(`${built_from_source_path}.node`); | ||
const built_from_source_path = resolve(esmCompatibleDirname, '..', `sentry_cpu_profiler-${identifier}`); | ||
return createdRequire(`${built_from_source_path}.node`); | ||
} | ||
@@ -188,0 +186,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"type":"module","version":"8.48.0","sideEffects":false} | ||
{"type":"module","version":"8.49.0","sideEffects":false} |
{ | ||
"name": "@sentry/profiling-node", | ||
"version": "8.48.0", | ||
"version": "8.49.0", | ||
"description": "Official Sentry SDK for Node.js Profiling", | ||
@@ -10,2 +10,3 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/esm/index.js", | ||
"types": "lib/types/index.d.ts", | ||
@@ -79,4 +80,4 @@ "exports": { | ||
"dependencies": { | ||
"@sentry/core": "8.48.0", | ||
"@sentry/node": "8.48.0", | ||
"@sentry/core": "8.49.0", | ||
"@sentry/node": "8.49.0", | ||
"detect-libc": "^2.0.2", | ||
@@ -83,0 +84,0 @@ "node-abi": "^3.61.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
3472037
11.64%2752
0.44%16
-20%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated