All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.build.esm.utils.sdkMetadata.js Maven / Gradle / Ivy

There is a newer version: 8.39.0
Show newest version
import { SDK_VERSION } from '@sentry/utils';

/**
 * A builder for the SDK metadata in the options for the SDK initialization.
 *
 * Note: This function is identical to `buildMetadata` in Remix and NextJS and SvelteKit.
 * We don't extract it for bundle size reasons.
 * @see https://github.com/getsentry/sentry-javascript/pull/7404
 * @see https://github.com/getsentry/sentry-javascript/pull/4196
 *
 * If you make changes to this function consider updating the others as well.
 *
 * @param options SDK options object that gets mutated
 * @param names list of package names
 */
function applySdkMetadata(options, name, names = [name], source = 'npm') {
  const metadata = options._metadata || {};

  if (!metadata.sdk) {
    metadata.sdk = {
      name: `sentry.javascript.${name}`,
      packages: names.map(name => ({
        name: `${source}:@sentry/${name}`,
        version: SDK_VERSION,
      })),
      version: SDK_VERSION,
    };
  }

  options._metadata = metadata;
}

export { applySdkMetadata };
//# sourceMappingURL=sdkMetadata.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy