diff --git a/packages/node-core/src/common-exports.ts b/packages/node-core/src/common-exports.ts index a3f9c1f0d725..258504040ec3 100644 --- a/packages/node-core/src/common-exports.ts +++ b/packages/node-core/src/common-exports.ts @@ -34,7 +34,7 @@ export { getSentryRelease, defaultStackParser } from './sdk/api'; export { createGetModuleFromFilename } from './utils/module'; export { addOriginToSpan } from './utils/addOriginToSpan'; export { initializeEsmLoader } from './sdk/esmLoader'; -export { isCjs } from './utils/detection'; +export { isCjs } from './utils/isCjs'; export { createMissingInstrumentationContext } from './utils/createMissingInstrumentationContext'; export { makeNodeTransport, type NodeTransportOptions } from './transports'; export type { HTTPModuleRequestIncomingMessage } from './transports/http-module'; diff --git a/packages/node-core/src/integrations/modules.ts b/packages/node-core/src/integrations/modules.ts index f7d37b6337a6..93653599f5bc 100644 --- a/packages/node-core/src/integrations/modules.ts +++ b/packages/node-core/src/integrations/modules.ts @@ -1,7 +1,7 @@ import { existsSync, readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { GLOBAL_OBJ, type IntegrationFn } from '@sentry/core'; -import { isCjs } from '../utils/detection'; +import { isCjs } from '../utils/isCjs'; type ModuleInfo = Record; diff --git a/packages/node-core/src/light/sdk.ts b/packages/node-core/src/light/sdk.ts index 74564859f129..f9e9a2f13b65 100644 --- a/packages/node-core/src/light/sdk.ts +++ b/packages/node-core/src/light/sdk.ts @@ -28,7 +28,7 @@ import { systemErrorIntegration } from '../integrations/systemError'; import { defaultStackParser, getSentryRelease } from '../sdk/api'; import { makeNodeTransport } from '../transports'; import type { NodeClientOptions, NodeOptions } from '../types'; -import { isCjs } from '../utils/detection'; +import { isCjs } from '../utils/isCjs'; import { getSpotlightConfig } from '../utils/spotlight'; import { setAsyncLocalStorageAsyncContextStrategy } from './asyncLocalStorageStrategy'; import { LightNodeClient } from './client'; diff --git a/packages/node-core/src/sdk/index.ts b/packages/node-core/src/sdk/index.ts index 20c6de9dc367..623bf7f9bf56 100644 --- a/packages/node-core/src/sdk/index.ts +++ b/packages/node-core/src/sdk/index.ts @@ -37,7 +37,7 @@ import { consoleIntegration } from '../integrations/console'; import { systemErrorIntegration } from '../integrations/systemError'; import { makeNodeTransport } from '../transports'; import type { NodeClientOptions, NodeOptions } from '../types'; -import { isCjs } from '../utils/detection'; +import { isCjs } from '../utils/isCjs'; import { getSpotlightConfig } from '../utils/spotlight'; import { defaultStackParser, getSentryRelease } from './api'; import { NodeClient } from './client'; diff --git a/packages/node-core/src/utils/createMissingInstrumentationContext.ts b/packages/node-core/src/utils/createMissingInstrumentationContext.ts index 3af8dc9e176a..f0112d0e6952 100644 --- a/packages/node-core/src/utils/createMissingInstrumentationContext.ts +++ b/packages/node-core/src/utils/createMissingInstrumentationContext.ts @@ -1,5 +1,5 @@ import type { MissingInstrumentationContext } from '@sentry/core'; -import { isCjs } from './detection'; +import { isCjs } from './isCjs'; export const createMissingInstrumentationContext = (pkg: string): MissingInstrumentationContext => ({ package: pkg, diff --git a/packages/node-core/src/utils/detection.ts b/packages/node-core/src/utils/detection.ts index de823e6843a0..e102012317a1 100644 --- a/packages/node-core/src/utils/detection.ts +++ b/packages/node-core/src/utils/detection.ts @@ -1,16 +1,6 @@ import { consoleSandbox } from '@sentry/core'; import { NODE_MAJOR, NODE_MINOR } from '../nodeVersion'; - -/** Detect CommonJS. */ -export function isCjs(): boolean { - /*! rollup-include-cjs-only */ - return true; - /*! rollup-include-cjs-only-end */ - - /*! rollup-include-esm-only */ - return false; - /*! rollup-include-esm-only-end */ -} +import { isCjs } from './isCjs'; let hasWarnedAboutNodeVersion: boolean | undefined; diff --git a/packages/node-core/src/utils/ensureIsWrapped.ts b/packages/node-core/src/utils/ensureIsWrapped.ts index 7c10c1c9cfe7..f5dba62959af 100644 --- a/packages/node-core/src/utils/ensureIsWrapped.ts +++ b/packages/node-core/src/utils/ensureIsWrapped.ts @@ -10,7 +10,7 @@ import { } from '@sentry/core'; import type { NodeClient } from '../sdk/client'; import { createMissingInstrumentationContext } from './createMissingInstrumentationContext'; -import { isCjs } from './detection'; +import { isCjs } from './isCjs'; /** * Checks and warns if a framework isn't wrapped by opentelemetry. diff --git a/packages/node-core/src/utils/isCjs.ts b/packages/node-core/src/utils/isCjs.ts new file mode 100644 index 000000000000..0c0444e5f2fc --- /dev/null +++ b/packages/node-core/src/utils/isCjs.ts @@ -0,0 +1,10 @@ +/** Detect CommonJS. */ +export function isCjs(): boolean { + /*! rollup-include-cjs-only */ + return true; + /*! rollup-include-cjs-only-end */ + + /*! rollup-include-esm-only */ + return false; + /*! rollup-include-esm-only-end */ +}