@sentry/bundler-plugin-core 5.1.0 → 5.2.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.
@@ -19,7 +19,6 @@ import { createGzip } from "node:zlib";
19
19
  import * as url from "url";
20
20
  import * as util from "util";
21
21
  import { promisify } from "util";
22
-
23
22
  //#region node_modules/@sentry/utils/build/esm/is.js
24
23
  const objectToString = Object.prototype.toString;
25
24
  /**
@@ -158,7 +157,6 @@ function isInstanceOf(wat, base) {
158
157
  function isVueViewModel(wat) {
159
158
  return !!(typeof wat === "object" && wat !== null && (wat.__isVue || wat._isVue));
160
159
  }
161
-
162
160
  //#endregion
163
161
  //#region node_modules/@sentry/utils/build/esm/string.js
164
162
  /**
@@ -172,11 +170,9 @@ function truncate(str, max = 0) {
172
170
  if (typeof str !== "string" || max === 0) return str;
173
171
  return str.length <= max ? str : `${str.slice(0, max)}...`;
174
172
  }
175
-
176
173
  //#endregion
177
174
  //#region node_modules/@sentry/utils/build/esm/version.js
178
175
  const SDK_VERSION = "8.30.0";
179
-
180
176
  //#endregion
181
177
  //#region node_modules/@sentry/utils/build/esm/worldwide.js
182
178
  /** Get's the global object for the current JavaScript runtime */
@@ -195,10 +191,9 @@ const GLOBAL_OBJ = globalThis;
195
191
  function getGlobalSingleton(name, creator, obj) {
196
192
  const gbl = obj || GLOBAL_OBJ;
197
193
  const __SENTRY__ = gbl.__SENTRY__ = gbl.__SENTRY__ || {};
198
- const versionedCarrier = __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {};
194
+ const versionedCarrier = __SENTRY__[SDK_VERSION] = __SENTRY__["8.30.0"] || {};
199
195
  return versionedCarrier[name] || (versionedCarrier[name] = creator());
200
196
  }
201
-
202
197
  //#endregion
203
198
  //#region node_modules/@sentry/utils/build/esm/browser.js
204
199
  const WINDOW = GLOBAL_OBJ;
@@ -274,7 +269,6 @@ function _htmlElementAsString(el, keyAttrs) {
274
269
  }
275
270
  return out.join("");
276
271
  }
277
-
278
272
  //#endregion
279
273
  //#region node_modules/@sentry/utils/build/esm/debug-build.js
280
274
  /**
@@ -283,7 +277,6 @@ function _htmlElementAsString(el, keyAttrs) {
283
277
  * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
284
278
  */
285
279
  const DEBUG_BUILD$1 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
286
-
287
280
  //#endregion
288
281
  //#region node_modules/@sentry/utils/build/esm/logger.js
289
282
  /** Prefix for logging strings */
@@ -352,7 +345,6 @@ function makeLogger() {
352
345
  * The logger is a singleton on the carrier, to ensure that a consistent logger is used throughout the SDK.
353
346
  */
354
347
  const logger = getGlobalSingleton("logger", makeLogger);
355
-
356
348
  //#endregion
357
349
  //#region node_modules/@sentry/utils/build/esm/dsn.js
358
350
  /** Regular expression used to parse a Dsn. */
@@ -458,7 +450,6 @@ function makeDsn(from) {
458
450
  if (!components || !validateDsn(components)) return;
459
451
  return components;
460
452
  }
461
-
462
453
  //#endregion
463
454
  //#region node_modules/@sentry/utils/build/esm/error.js
464
455
  /** An error emitted by Sentry SDKs and related utilities. */
@@ -472,7 +463,6 @@ var SentryError = class extends Error {
472
463
  this.logLevel = logLevel;
473
464
  }
474
465
  };
475
-
476
466
  //#endregion
477
467
  //#region node_modules/@sentry/utils/build/esm/object.js
478
468
  /**
@@ -602,11 +592,9 @@ function isPojo(input) {
602
592
  return true;
603
593
  }
604
594
  }
605
-
606
595
  //#endregion
607
596
  //#region node_modules/@sentry/utils/build/esm/stacktrace.js
608
597
  const STACKTRACE_FRAME_LIMIT = 50;
609
- const UNKNOWN_FUNCTION = "?";
610
598
  const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
611
599
  const STRIP_FRAME_REGEXP = /captureMessage|captureException/;
612
600
  /**
@@ -656,7 +644,7 @@ function stripSentryFramesAndReverse(stack) {
656
644
  return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => ({
657
645
  ...frame,
658
646
  filename: frame.filename || getLastStackFrame(localStack).filename,
659
- function: frame.function || UNKNOWN_FUNCTION
647
+ function: frame.function || "?"
660
648
  }));
661
649
  }
662
650
  function getLastStackFrame(arr) {
@@ -674,7 +662,6 @@ function getFunctionName(fn) {
674
662
  return defaultFunctionName;
675
663
  }
676
664
  }
677
-
678
665
  //#endregion
679
666
  //#region node_modules/@sentry/utils/build/esm/instrument/handlers.js
680
667
  const handlers = {};
@@ -701,7 +688,6 @@ function triggerHandlers(type, data) {
701
688
  DEBUG_BUILD$1 && logger.error(`Error while triggering instrumentation handler.\nType: ${type}\nName: ${getFunctionName(handler)}\nError:`, e);
702
689
  }
703
690
  }
704
-
705
691
  //#endregion
706
692
  //#region node_modules/@sentry/utils/build/esm/time.js
707
693
  const ONE_SECOND_IN_MS = 1e3;
@@ -742,20 +728,9 @@ function createUnixTimestampInSecondsFunc() {
742
728
  * See https://github.com/getsentry/sentry-javascript/issues/2590.
743
729
  */
744
730
  const timestampInSeconds = createUnixTimestampInSecondsFunc();
745
- /**
746
- * Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.
747
- */
748
- let _browserPerformanceTimeOriginMode;
749
- /**
750
- * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the
751
- * performance API is available.
752
- */
753
- const browserPerformanceTimeOrigin = (() => {
731
+ (() => {
754
732
  const { performance } = GLOBAL_OBJ;
755
- if (!performance || !performance.now) {
756
- _browserPerformanceTimeOriginMode = "none";
757
- return;
758
- }
733
+ if (!performance || !performance.now) return;
759
734
  const threshold = 3600 * 1e3;
760
735
  const performanceNow = performance.now();
761
736
  const dateNow = Date.now();
@@ -763,17 +738,10 @@ const browserPerformanceTimeOrigin = (() => {
763
738
  const timeOriginIsReliable = timeOriginDelta < threshold;
764
739
  const navigationStart = performance.timing && performance.timing.navigationStart;
765
740
  const navigationStartDelta = typeof navigationStart === "number" ? Math.abs(navigationStart + performanceNow - dateNow) : threshold;
766
- if (timeOriginIsReliable || navigationStartDelta < threshold) if (timeOriginDelta <= navigationStartDelta) {
767
- _browserPerformanceTimeOriginMode = "timeOrigin";
768
- return performance.timeOrigin;
769
- } else {
770
- _browserPerformanceTimeOriginMode = "navigationStart";
771
- return navigationStart;
772
- }
773
- _browserPerformanceTimeOriginMode = "dateNow";
741
+ if (timeOriginIsReliable || navigationStartDelta < threshold) if (timeOriginDelta <= navigationStartDelta) return performance.timeOrigin;
742
+ else return navigationStart;
774
743
  return dateNow;
775
744
  })();
776
-
777
745
  //#endregion
778
746
  //#region node_modules/@sentry/utils/build/esm/instrument/globalError.js
779
747
  let _oldOnErrorHandler = null;
@@ -803,7 +771,6 @@ function instrumentError() {
803
771
  };
804
772
  GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;
805
773
  }
806
-
807
774
  //#endregion
808
775
  //#region node_modules/@sentry/utils/build/esm/instrument/globalUnhandledRejection.js
809
776
  let _oldOnUnhandledRejectionHandler = null;
@@ -827,7 +794,6 @@ function instrumentUnhandledRejection() {
827
794
  };
828
795
  GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
829
796
  }
830
-
831
797
  //#endregion
832
798
  //#region node_modules/@sentry/utils/build/esm/memo.js
833
799
  /**
@@ -855,7 +821,6 @@ function memoBuilder() {
855
821
  }
856
822
  return [memoize, unmemoize];
857
823
  }
858
-
859
824
  //#endregion
860
825
  //#region node_modules/@sentry/utils/build/esm/misc.js
861
826
  /**
@@ -959,7 +924,6 @@ function checkOrSetAlreadyCaught(exception) {
959
924
  function arrayify$1(maybeArray) {
960
925
  return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
961
926
  }
962
-
963
927
  //#endregion
964
928
  //#region node_modules/@sentry/utils/build/esm/normalize.js
965
929
  /**
@@ -1077,7 +1041,6 @@ function utf8Length(value) {
1077
1041
  function jsonSize(value) {
1078
1042
  return utf8Length(JSON.stringify(value));
1079
1043
  }
1080
-
1081
1044
  //#endregion
1082
1045
  //#region node_modules/@sentry/utils/build/esm/syncpromise.js
1083
1046
  /** SyncPromise internal states */
@@ -1224,7 +1187,6 @@ var SyncPromise = class SyncPromise {
1224
1187
  };
1225
1188
  }
1226
1189
  };
1227
-
1228
1190
  //#endregion
1229
1191
  //#region node_modules/@sentry/utils/build/esm/promisebuffer.js
1230
1192
  /**
@@ -1294,7 +1256,6 @@ function makePromiseBuffer(limit) {
1294
1256
  drain
1295
1257
  };
1296
1258
  }
1297
-
1298
1259
  //#endregion
1299
1260
  //#region node_modules/@sentry/utils/build/esm/node-stack-trace.js
1300
1261
  /**
@@ -1339,7 +1300,7 @@ function node(getModule) {
1339
1300
  functionName = void 0;
1340
1301
  }
1341
1302
  if (functionName === void 0) {
1342
- methodName = methodName || UNKNOWN_FUNCTION;
1303
+ methodName = methodName || "?";
1343
1304
  functionName = typeName ? `${typeName}.${methodName}` : methodName;
1344
1305
  }
1345
1306
  let filename = lineMatch[2] && lineMatch[2].startsWith("file://") ? lineMatch[2].slice(7) : lineMatch[2];
@@ -1370,18 +1331,11 @@ function nodeStackLineParser(getModule) {
1370
1331
  function _parseIntOrUndefined(input) {
1371
1332
  return parseInt(input || "", 10) || void 0;
1372
1333
  }
1373
-
1374
1334
  //#endregion
1375
1335
  //#region node_modules/@sentry/utils/build/esm/baggage.js
1376
1336
  const SENTRY_BAGGAGE_KEY_PREFIX = "sentry-";
1377
1337
  const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/;
1378
1338
  /**
1379
- * Max length of a serialized baggage string
1380
- *
1381
- * https://www.w3.org/TR/baggage/#limits
1382
- */
1383
- const MAX_BAGGAGE_STRING_LENGTH = 8192;
1384
- /**
1385
1339
  * Takes a baggage header and turns it into Dynamic Sampling Context, by extracting all the "sentry-" prefixed values
1386
1340
  * from it.
1387
1341
  *
@@ -1455,16 +1409,15 @@ function objectToBaggageHeader(object) {
1455
1409
  return Object.entries(object).reduce((baggageHeader, [objectKey, objectValue], currentIndex) => {
1456
1410
  const baggageEntry = `${encodeURIComponent(objectKey)}=${encodeURIComponent(objectValue)}`;
1457
1411
  const newBaggageHeader = currentIndex === 0 ? baggageEntry : `${baggageHeader},${baggageEntry}`;
1458
- if (newBaggageHeader.length > MAX_BAGGAGE_STRING_LENGTH) {
1412
+ if (newBaggageHeader.length > 8192) {
1459
1413
  DEBUG_BUILD$1 && logger.warn(`Not adding key: ${objectKey} with val: ${objectValue} to baggage header due to exceeding baggage size limits.`);
1460
1414
  return baggageHeader;
1461
1415
  } else return newBaggageHeader;
1462
1416
  }, "");
1463
1417
  }
1464
-
1465
1418
  //#endregion
1466
1419
  //#region node_modules/@sentry/utils/build/esm/tracing.js
1467
- const TRACEPARENT_REGEXP = new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");
1420
+ const TRACEPARENT_REGEXP = /* @__PURE__ */ new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");
1468
1421
  /**
1469
1422
  * Create sentry-trace header from span context values.
1470
1423
  */
@@ -1473,7 +1426,6 @@ function generateSentryTraceHeader(traceId = uuid4(), spanId = uuid4().substring
1473
1426
  if (sampled !== void 0) sampledString = sampled ? "-1" : "-0";
1474
1427
  return `${traceId}-${spanId}${sampledString}`;
1475
1428
  }
1476
-
1477
1429
  //#endregion
1478
1430
  //#region node_modules/@sentry/utils/build/esm/envelope.js
1479
1431
  /**
@@ -1614,7 +1566,6 @@ function createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn) {
1614
1566
  ...dynamicSamplingContext && { trace: dropUndefinedKeys({ ...dynamicSamplingContext }) }
1615
1567
  };
1616
1568
  }
1617
-
1618
1569
  //#endregion
1619
1570
  //#region node_modules/@sentry/utils/build/esm/clientreport.js
1620
1571
  /**
@@ -1629,7 +1580,6 @@ function createClientReportEnvelope(discarded_events, dsn, timestamp) {
1629
1580
  }];
1630
1581
  return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);
1631
1582
  }
1632
-
1633
1583
  //#endregion
1634
1584
  //#region node_modules/@sentry/utils/build/esm/ratelimit.js
1635
1585
  const DEFAULT_RETRY_AFTER = 60 * 1e3;
@@ -1699,7 +1649,6 @@ function updateRateLimits(limits, { statusCode, headers }, now = Date.now()) {
1699
1649
  else if (statusCode === 429) updatedRateLimits.all = now + 60 * 1e3;
1700
1650
  return updatedRateLimits;
1701
1651
  }
1702
-
1703
1652
  //#endregion
1704
1653
  //#region node_modules/@sentry/utils/build/esm/eventbuilder.js
1705
1654
  /**
@@ -1807,7 +1756,6 @@ function eventFromMessage(stackParser, message, level = "info", hint, attachStac
1807
1756
  event.message = message;
1808
1757
  return event;
1809
1758
  }
1810
-
1811
1759
  //#endregion
1812
1760
  //#region node_modules/@sentry/utils/build/esm/propagationContext.js
1813
1761
  /**
@@ -1819,7 +1767,6 @@ function generatePropagationContext() {
1819
1767
  spanId: uuid4().substring(16)
1820
1768
  };
1821
1769
  }
1822
-
1823
1770
  //#endregion
1824
1771
  //#region src/utils.ts
1825
1772
  /**
@@ -2031,7 +1978,6 @@ var CodeInjection = class CodeInjection {
2031
1978
  return new CodeInjection(this.body);
2032
1979
  }
2033
1980
  };
2034
-
2035
1981
  //#endregion
2036
1982
  //#region src/glob.ts
2037
1983
  function globFiles(patterns, options) {
@@ -2041,7 +1987,6 @@ function globFiles(patterns, options) {
2041
1987
  ...options
2042
1988
  });
2043
1989
  }
2044
-
2045
1990
  //#endregion
2046
1991
  //#region node_modules/@sentry/core/build/esm/debug-build.js
2047
1992
  /**
@@ -2050,7 +1995,6 @@ function globFiles(patterns, options) {
2050
1995
  * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
2051
1996
  */
2052
1997
  const DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
2053
-
2054
1998
  //#endregion
2055
1999
  //#region node_modules/@sentry/core/build/esm/carrier.js
2056
2000
  /**
@@ -2071,10 +2015,9 @@ function getMainCarrier() {
2071
2015
  /** Will either get the existing sentry carrier, or create a new one. */
2072
2016
  function getSentryCarrier(carrier) {
2073
2017
  const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {};
2074
- __SENTRY__.version = __SENTRY__.version || SDK_VERSION;
2075
- return __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {};
2018
+ __SENTRY__.version = __SENTRY__.version || "8.30.0";
2019
+ return __SENTRY__[SDK_VERSION] = __SENTRY__["8.30.0"] || {};
2076
2020
  }
2077
-
2078
2021
  //#endregion
2079
2022
  //#region node_modules/@sentry/core/build/esm/session.js
2080
2023
  /**
@@ -2182,7 +2125,6 @@ function sessionToJSON(session) {
2182
2125
  }
2183
2126
  });
2184
2127
  }
2185
-
2186
2128
  //#endregion
2187
2129
  //#region node_modules/@sentry/core/build/esm/utils/spanOnScope.js
2188
2130
  const SCOPE_SPAN_FIELD = "_sentrySpan";
@@ -2201,7 +2143,6 @@ function _setSpanForScope(scope, span) {
2201
2143
  function _getSpanForScope(scope) {
2202
2144
  return scope[SCOPE_SPAN_FIELD];
2203
2145
  }
2204
-
2205
2146
  //#endregion
2206
2147
  //#region node_modules/@sentry/core/build/esm/scope.js
2207
2148
  /**
@@ -2211,7 +2152,7 @@ const DEFAULT_MAX_BREADCRUMBS = 100;
2211
2152
  /**
2212
2153
  * Holds additional event information.
2213
2154
  */
2214
- var ScopeClass = class ScopeClass {
2155
+ const Scope = class ScopeClass {
2215
2156
  /** Flag if notifying is happening. */
2216
2157
  /** Callback for client to receive scope changes. */
2217
2158
  /** Callback list that will be called during event processing. */
@@ -2633,11 +2574,6 @@ var ScopeClass = class ScopeClass {
2633
2574
  }
2634
2575
  }
2635
2576
  };
2636
- /**
2637
- * Holds additional event information.
2638
- */
2639
- const Scope = ScopeClass;
2640
-
2641
2577
  //#endregion
2642
2578
  //#region node_modules/@sentry/core/build/esm/defaultScopes.js
2643
2579
  /** Get the default current scope. */
@@ -2648,7 +2584,6 @@ function getDefaultCurrentScope() {
2648
2584
  function getDefaultIsolationScope() {
2649
2585
  return getGlobalSingleton("defaultIsolationScope", () => new Scope());
2650
2586
  }
2651
-
2652
2587
  //#endregion
2653
2588
  //#region node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js
2654
2589
  /**
@@ -2768,7 +2703,6 @@ function getStackAsyncContextStrategy() {
2768
2703
  getIsolationScope: () => getAsyncContextStack().getIsolationScope()
2769
2704
  };
2770
2705
  }
2771
-
2772
2706
  //#endregion
2773
2707
  //#region node_modules/@sentry/core/build/esm/asyncContext/index.js
2774
2708
  /**
@@ -2780,7 +2714,6 @@ function getAsyncContextStrategy(carrier) {
2780
2714
  if (sentry.acs) return sentry.acs;
2781
2715
  return getStackAsyncContextStrategy();
2782
2716
  }
2783
-
2784
2717
  //#endregion
2785
2718
  //#region node_modules/@sentry/core/build/esm/currentScopes.js
2786
2719
  /**
@@ -2826,7 +2759,6 @@ function withScope(...rest) {
2826
2759
  function getClient() {
2827
2760
  return getCurrentScope().getClient();
2828
2761
  }
2829
-
2830
2762
  //#endregion
2831
2763
  //#region node_modules/@sentry/core/build/esm/metrics/metric-summary.js
2832
2764
  /**
@@ -2844,7 +2776,6 @@ function getMetricSummaryJsonForSpan(span) {
2844
2776
  for (const [, [exportKey, summary]] of storage) (output[exportKey] || (output[exportKey] = [])).push(dropUndefinedKeys(summary));
2845
2777
  return output;
2846
2778
  }
2847
-
2848
2779
  //#endregion
2849
2780
  //#region node_modules/@sentry/core/build/esm/semanticAttributes.js
2850
2781
  /**
@@ -2874,17 +2805,6 @@ const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = "sentry.measurement_value";
2874
2805
  */
2875
2806
  const SEMANTIC_ATTRIBUTE_PROFILE_ID = "sentry.profile_id";
2876
2807
  const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = "sentry.exclusive_time";
2877
-
2878
- //#endregion
2879
- //#region node_modules/@sentry/core/build/esm/tracing/spanstatus.js
2880
- const SPAN_STATUS_UNSET = 0;
2881
- const SPAN_STATUS_OK = 1;
2882
- const SPAN_STATUS_ERROR = 2;
2883
-
2884
- //#endregion
2885
- //#region node_modules/@sentry/core/build/esm/utils/spanUtils.js
2886
- const TRACE_FLAG_NONE = 0;
2887
- const TRACE_FLAG_SAMPLED = 1;
2888
2808
  /**
2889
2809
  * Convert a span to a trace context, which can be sent as the `trace` context in an event.
2890
2810
  * By default, this will only include trace_id, span_id & parent_span_id.
@@ -2988,12 +2908,12 @@ function spanIsSentrySpan(span) {
2988
2908
  */
2989
2909
  function spanIsSampled(span) {
2990
2910
  const { traceFlags } = span.spanContext();
2991
- return traceFlags === TRACE_FLAG_SAMPLED;
2911
+ return traceFlags === 1;
2992
2912
  }
2993
2913
  /** Get the status message to use for a JSON representation of a span. */
2994
2914
  function getStatusMessage(status) {
2995
- if (!status || status.code === SPAN_STATUS_UNSET) return;
2996
- if (status.code === SPAN_STATUS_OK) return "ok";
2915
+ if (!status || status.code === 0) return;
2916
+ if (status.code === 1) return "ok";
2997
2917
  return status.message || "unknown_error";
2998
2918
  }
2999
2919
  const CHILD_SPANS_FIELD = "_sentryChildSpans";
@@ -3036,7 +2956,6 @@ function getActiveSpan() {
3036
2956
  if (acs.getActiveSpan) return acs.getActiveSpan();
3037
2957
  return _getSpanForScope(getCurrentScope());
3038
2958
  }
3039
-
3040
2959
  //#endregion
3041
2960
  //#region node_modules/@sentry/core/build/esm/tracing/errors.js
3042
2961
  let errorsInstrumented = false;
@@ -3059,13 +2978,12 @@ function errorCallback() {
3059
2978
  const message = "internal_error";
3060
2979
  DEBUG_BUILD && logger.log(`[Tracing] Root span: ${message} -> Global error occured`);
3061
2980
  rootSpan.setStatus({
3062
- code: SPAN_STATUS_ERROR,
2981
+ code: 2,
3063
2982
  message
3064
2983
  });
3065
2984
  }
3066
2985
  }
3067
2986
  errorCallback.tag = "sentry_tracingErrorCallback";
3068
-
3069
2987
  //#endregion
3070
2988
  //#region node_modules/@sentry/core/build/esm/tracing/utils.js
3071
2989
  const SCOPE_ON_START_SPAN_FIELD = "_sentryScope";
@@ -3086,7 +3004,6 @@ function getCapturedScopesOnSpan(span) {
3086
3004
  isolationScope: span[ISOLATION_SCOPE_ON_START_SPAN_FIELD]
3087
3005
  };
3088
3006
  }
3089
-
3090
3007
  //#endregion
3091
3008
  //#region node_modules/@sentry/core/build/esm/utils/hasTracingEnabled.js
3092
3009
  /**
@@ -3100,7 +3017,6 @@ function hasTracingEnabled(maybeOptions) {
3100
3017
  const options = maybeOptions || client && client.getOptions();
3101
3018
  return !!options && (options.enableTracing || "tracesSampleRate" in options || "tracesSampler" in options);
3102
3019
  }
3103
-
3104
3020
  //#endregion
3105
3021
  //#region node_modules/@sentry/core/build/esm/tracing/sentryNonRecordingSpan.js
3106
3022
  /**
@@ -3116,7 +3032,7 @@ var SentryNonRecordingSpan = class {
3116
3032
  return {
3117
3033
  spanId: this._spanId,
3118
3034
  traceId: this._traceId,
3119
- traceFlags: TRACE_FLAG_NONE
3035
+ traceFlags: 0
3120
3036
  };
3121
3037
  }
3122
3038
  /** @inheritdoc */
@@ -3174,7 +3090,6 @@ var SentryNonRecordingSpan = class {
3174
3090
  */
3175
3091
  recordException(_exception, _time) {}
3176
3092
  };
3177
-
3178
3093
  //#endregion
3179
3094
  //#region node_modules/@sentry/core/build/esm/utils/handleCallbackErrors.js
3180
3095
  /**
@@ -3217,11 +3132,9 @@ function maybeHandlePromiseRejection(value, onError, onFinally) {
3217
3132
  onFinally();
3218
3133
  return value;
3219
3134
  }
3220
-
3221
3135
  //#endregion
3222
3136
  //#region node_modules/@sentry/core/build/esm/constants.js
3223
3137
  const DEFAULT_ENVIRONMENT = "production";
3224
-
3225
3138
  //#endregion
3226
3139
  //#region node_modules/@sentry/core/build/esm/tracing/dynamicSamplingContext.js
3227
3140
  /**
@@ -3244,7 +3157,7 @@ function getDynamicSamplingContextFromClient(trace_id, client) {
3244
3157
  const options = client.getOptions();
3245
3158
  const { publicKey: public_key } = client.getDsn() || {};
3246
3159
  const dsc = dropUndefinedKeys({
3247
- environment: options.environment || DEFAULT_ENVIRONMENT,
3160
+ environment: options.environment || "production",
3248
3161
  release: options.release,
3249
3162
  public_key,
3250
3163
  trace_id
@@ -3281,7 +3194,6 @@ function getDynamicSamplingContextFromSpan(span) {
3281
3194
  client.emit("createDsc", dsc, rootSpan);
3282
3195
  return dsc;
3283
3196
  }
3284
-
3285
3197
  //#endregion
3286
3198
  //#region node_modules/@sentry/core/build/esm/tracing/logSpans.js
3287
3199
  /**
@@ -3320,7 +3232,6 @@ function logSpanEnd(span) {
3320
3232
  const msg = `[Tracing] Finishing "${op}" ${getRootSpan(span) === span ? "root " : ""}span "${description}" with ID ${spanId}`;
3321
3233
  logger.log(msg);
3322
3234
  }
3323
-
3324
3235
  //#endregion
3325
3236
  //#region node_modules/@sentry/core/build/esm/utils/parseSampleRate.js
3326
3237
  /**
@@ -3339,7 +3250,6 @@ function parseSampleRate(sampleRate) {
3339
3250
  }
3340
3251
  return rate;
3341
3252
  }
3342
-
3343
3253
  //#endregion
3344
3254
  //#region node_modules/@sentry/core/build/esm/tracing/sampling.js
3345
3255
  /**
@@ -3370,7 +3280,6 @@ function sampleSpan(options, samplingContext) {
3370
3280
  }
3371
3281
  return [true, parsedSampleRate];
3372
3282
  }
3373
-
3374
3283
  //#endregion
3375
3284
  //#region node_modules/@sentry/core/build/esm/envelope.js
3376
3285
  /**
@@ -3432,7 +3341,6 @@ function createSpanEnvelope(spans, client) {
3432
3341
  }
3433
3342
  return createEnvelope(headers, items);
3434
3343
  }
3435
-
3436
3344
  //#endregion
3437
3345
  //#region node_modules/@sentry/core/build/esm/tracing/measurement.js
3438
3346
  /**
@@ -3463,7 +3371,6 @@ function timedEventsToMeasurements(events) {
3463
3371
  });
3464
3372
  return measurements;
3465
3373
  }
3466
-
3467
3374
  //#endregion
3468
3375
  //#region node_modules/@sentry/core/build/esm/tracing/sentrySpan.js
3469
3376
  const MAX_SPAN_COUNT = 1e3;
@@ -3535,7 +3442,7 @@ var SentrySpan = class {
3535
3442
  return {
3536
3443
  spanId,
3537
3444
  traceId,
3538
- traceFlags: sampled ? TRACE_FLAG_SAMPLED : TRACE_FLAG_NONE
3445
+ traceFlags: sampled ? 1 : 0
3539
3446
  };
3540
3447
  }
3541
3448
  /** @inheritdoc */
@@ -3725,7 +3632,6 @@ function sendSpanEnvelope(envelope) {
3725
3632
  DEBUG_BUILD && logger.error("Error while sending span:", reason);
3726
3633
  });
3727
3634
  }
3728
-
3729
3635
  //#endregion
3730
3636
  //#region node_modules/@sentry/core/build/esm/tracing/trace.js
3731
3637
  const SUPPRESS_TRACING_KEY = "__SENTRY_SUPPRESS_TRACING__";
@@ -3758,7 +3664,7 @@ function startSpan(options, callback) {
3758
3664
  return handleCallbackErrors(() => callback(activeSpan), () => {
3759
3665
  const { status } = spanToJSON(activeSpan);
3760
3666
  if (activeSpan.isRecording() && (!status || status === "ok")) activeSpan.setStatus({
3761
- code: SPAN_STATUS_ERROR,
3667
+ code: 2,
3762
3668
  message: "internal_error"
3763
3669
  });
3764
3670
  }, () => activeSpan.end());
@@ -3903,7 +3809,6 @@ function getActiveSpanWrapper(parentSpan) {
3903
3809
  return withActiveSpan(parentSpan, callback);
3904
3810
  } : (callback) => callback();
3905
3811
  }
3906
-
3907
3812
  //#endregion
3908
3813
  //#region node_modules/@sentry/core/build/esm/eventProcessors.js
3909
3814
  /**
@@ -3921,7 +3826,6 @@ function notifyEventProcessors(processors, event, hint, index = 0) {
3921
3826
  }
3922
3827
  });
3923
3828
  }
3924
-
3925
3829
  //#endregion
3926
3830
  //#region node_modules/@sentry/core/build/esm/utils/applyScopeDataToEvent.js
3927
3831
  /**
@@ -4021,7 +3925,6 @@ function applyFingerprintToEvent(event, fingerprint) {
4021
3925
  if (fingerprint) event.fingerprint = event.fingerprint.concat(fingerprint);
4022
3926
  if (event.fingerprint && !event.fingerprint.length) delete event.fingerprint;
4023
3927
  }
4024
-
4025
3928
  //#endregion
4026
3929
  //#region node_modules/@sentry/core/build/esm/utils/prepareEvent.js
4027
3930
  /**
@@ -4205,7 +4108,6 @@ function getFinalScope(scope, captureContext) {
4205
4108
  finalScope.update(captureContext);
4206
4109
  return finalScope;
4207
4110
  }
4208
-
4209
4111
  //#endregion
4210
4112
  //#region node_modules/@sentry/core/build/esm/sessionflusher.js
4211
4113
  /**
@@ -4280,7 +4182,6 @@ var SessionFlusher = class {
4280
4182
  }
4281
4183
  }
4282
4184
  };
4283
-
4284
4185
  //#endregion
4285
4186
  //#region node_modules/@sentry/core/build/esm/api.js
4286
4187
  const SENTRY_API_VERSION = "7";
@@ -4310,7 +4211,6 @@ function _encodedAuth(dsn, sdkInfo) {
4310
4211
  function getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) {
4311
4212
  return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;
4312
4213
  }
4313
-
4314
4214
  //#endregion
4315
4215
  //#region node_modules/@sentry/core/build/esm/integration.js
4316
4216
  const installedIntegrations = [];
@@ -4356,7 +4256,6 @@ function setupIntegration(client, integration, integrationIndex) {
4356
4256
  }
4357
4257
  DEBUG_BUILD && logger.log(`Integration installed: ${integration.name}`);
4358
4258
  }
4359
-
4360
4259
  //#endregion
4361
4260
  //#region node_modules/@sentry/core/build/esm/baseclient.js
4362
4261
  const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
@@ -4896,7 +4795,6 @@ function isErrorEvent(event) {
4896
4795
  function isTransactionEvent(event) {
4897
4796
  return event.type === "transaction";
4898
4797
  }
4899
-
4900
4798
  //#endregion
4901
4799
  //#region node_modules/@sentry/core/build/esm/checkin.js
4902
4800
  /**
@@ -4915,7 +4813,6 @@ function createCheckInEnvelope(checkIn, dynamicSamplingContext, metadata, tunnel
4915
4813
  function createCheckInEnvelopeItem(checkIn) {
4916
4814
  return [{ type: "check_in" }, checkIn];
4917
4815
  }
4918
-
4919
4816
  //#endregion
4920
4817
  //#region node_modules/@sentry/core/build/esm/server-runtime-client.js
4921
4818
  /**
@@ -5056,17 +4953,13 @@ var ServerRuntimeClient = class extends BaseClient {
5056
4953
  return [getDynamicSamplingContextFromClient(traceId, this), traceContext];
5057
4954
  }
5058
4955
  };
5059
-
5060
- //#endregion
5061
- //#region node_modules/@sentry/core/build/esm/transports/base.js
5062
- const DEFAULT_TRANSPORT_BUFFER_SIZE = 64;
5063
4956
  /**
5064
4957
  * Creates an instance of a Sentry `Transport`
5065
4958
  *
5066
4959
  * @param options
5067
4960
  * @param makeRequest
5068
4961
  */
5069
- function createTransport(options, makeRequest, buffer = makePromiseBuffer(options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE)) {
4962
+ function createTransport(options, makeRequest, buffer = makePromiseBuffer(options.bufferSize || 64)) {
5070
4963
  let rateLimits = {};
5071
4964
  const flush = (timeout) => buffer.drain(timeout);
5072
4965
  function send(envelope) {
@@ -5111,7 +5004,6 @@ function getEventForEnvelopeItem(item, type) {
5111
5004
  if (type !== "event" && type !== "transaction") return;
5112
5005
  return Array.isArray(item) ? item[1] : void 0;
5113
5006
  }
5114
-
5115
5007
  //#endregion
5116
5008
  //#region node_modules/@sentry/core/build/esm/utils/sdkMetadata.js
5117
5009
  /**
@@ -5139,7 +5031,6 @@ function applySdkMetadata(options, name, names = [name], source = "npm") {
5139
5031
  };
5140
5032
  options._metadata = metadata;
5141
5033
  }
5142
-
5143
5034
  //#endregion
5144
5035
  //#region node_modules/@sentry/core/build/esm/utils/traceData.js
5145
5036
  /**
@@ -5189,16 +5080,12 @@ function isValidBaggageString(baggage) {
5189
5080
  const spaces = "\\s*";
5190
5081
  return new RegExp(`^${keyRegex}${spaces}=${spaces}${valueRegex}(${spaces},${spaces}${keyRegex}${spaces}=${spaces}${valueRegex})*$`).test(baggage);
5191
5082
  }
5192
-
5193
- //#endregion
5194
- //#region src/options-mapping.ts
5195
- const SENTRY_SAAS_URL = "https://sentry.io";
5196
5083
  function normalizeUserOptions(userOptions) {
5197
5084
  const options = {
5198
5085
  org: userOptions.org ?? process.env["SENTRY_ORG"],
5199
5086
  project: userOptions.project ?? (process.env["SENTRY_PROJECT"]?.includes(",") ? process.env["SENTRY_PROJECT"].split(",").map((p) => p.trim()) : process.env["SENTRY_PROJECT"]),
5200
5087
  authToken: userOptions.authToken ?? process.env["SENTRY_AUTH_TOKEN"],
5201
- url: userOptions.url ?? process.env["SENTRY_URL"] ?? SENTRY_SAAS_URL,
5088
+ url: userOptions.url ?? process.env["SENTRY_URL"] ?? "https://sentry.io",
5202
5089
  headers: userOptions.headers,
5203
5090
  debug: userOptions.debug ?? false,
5204
5091
  silent: userOptions.silent ?? false,
@@ -5282,7 +5169,6 @@ function validateOptions(options, logger) {
5282
5169
  }
5283
5170
  return true;
5284
5171
  }
5285
-
5286
5172
  //#endregion
5287
5173
  //#region src/logger.ts
5288
5174
  function createLogger(options) {
@@ -5301,7 +5187,6 @@ function createLogger(options) {
5301
5187
  }
5302
5188
  };
5303
5189
  }
5304
-
5305
5190
  //#endregion
5306
5191
  //#region src/sentry/transports.ts
5307
5192
  /**
@@ -5377,17 +5262,23 @@ function makeOptionallyEnabledNodeTransport(shouldSendTelemetry) {
5377
5262
  global.__SENTRY_INTERCEPT_TRANSPORT__.push(request);
5378
5263
  return { statusCode: 200 };
5379
5264
  }
5380
- if (await shouldSendTelemetry) return nodeTransport.send(request);
5265
+ if (await shouldSendTelemetry) {
5266
+ if (process.env["SENTRY_TEST_OUT_DIR"]) {
5267
+ const { join } = await import("node:path");
5268
+ const { appendFileSync } = await import("node:fs");
5269
+ appendFileSync(join(process.env["SENTRY_TEST_OUT_DIR"], "sentry-telemetry.json"), JSON.stringify(request) + ",\n");
5270
+ return { statusCode: 200 };
5271
+ }
5272
+ return nodeTransport.send(request);
5273
+ }
5381
5274
  return { statusCode: 200 };
5382
5275
  }
5383
5276
  };
5384
5277
  };
5385
5278
  }
5386
-
5387
5279
  //#endregion
5388
5280
  //#region src/version.ts
5389
- const LIB_VERSION = "5.1.0";
5390
-
5281
+ const LIB_VERSION = "5.2.0";
5391
5282
  //#endregion
5392
5283
  //#region src/sentry/telemetry.ts
5393
5284
  const SENTRY_SAAS_HOSTNAME = "sentry.io";
@@ -5460,7 +5351,7 @@ function setTelemetryDataOnScope(options, scope, buildTool, buildToolMajorVersio
5460
5351
  async function allowedToSendTelemetry(options) {
5461
5352
  const { silent, org, project, authToken, url, headers, telemetry, release } = options;
5462
5353
  if (telemetry === false) return false;
5463
- if (url === SENTRY_SAAS_URL) return true;
5354
+ if (url === "https://sentry.io") return true;
5464
5355
  const cli = new SentryCli(null, {
5465
5356
  url,
5466
5357
  authToken,
@@ -5488,7 +5379,6 @@ async function safeFlushTelemetry(sentryClient) {
5488
5379
  await sentryClient.flush(2e3);
5489
5380
  } catch {}
5490
5381
  }
5491
-
5492
5382
  //#endregion
5493
5383
  //#region src/debug-id-upload.ts
5494
5384
  function createDebugIdUploadFunction({ sentryBuildPluginManager }) {
@@ -5590,7 +5480,10 @@ async function prepareSourceMapForDebugIdUpload(sourceMapPath, targetPath, debug
5590
5480
  logger.error(`Failed to parse source map for debug ID upload: ${sourceMapPath}`);
5591
5481
  return;
5592
5482
  }
5593
- if (map["sources"] && Array.isArray(map["sources"])) map["sources"] = map["sources"].map((source) => rewriteSourcesHook(source, map));
5483
+ if (map["sources"] && Array.isArray(map["sources"])) {
5484
+ const mapDir = path.dirname(sourceMapPath);
5485
+ map["sources"] = map["sources"].map((source) => rewriteSourcesHook(source, map, { mapDir }));
5486
+ }
5594
5487
  try {
5595
5488
  await util.promisify(fs.writeFile)(targetPath, JSON.stringify(map), { encoding: "utf8" });
5596
5489
  } catch (e) {
@@ -5603,7 +5496,6 @@ function defaultRewriteSourcesHook(source) {
5603
5496
  if (source.match(PROTOCOL_REGEX)) return source.replace(PROTOCOL_REGEX, "");
5604
5497
  else return path.relative(process.cwd(), path.normalize(source));
5605
5498
  }
5606
-
5607
5499
  //#endregion
5608
5500
  //#region src/build-plugin-manager.ts
5609
5501
  const _deployedReleases = /* @__PURE__ */ new Set();
@@ -5616,7 +5508,7 @@ function createCliInstance(options) {
5616
5508
  url: options.url,
5617
5509
  vcsRemote: options.release.vcsRemote,
5618
5510
  headers: {
5619
- ...getTraceData(),
5511
+ ...options.telemetry ? getTraceData() : {},
5620
5512
  ...options.headers
5621
5513
  }
5622
5514
  });
@@ -6034,7 +5926,6 @@ function canUploadSourceMaps(options, logger, isDevMode) {
6034
5926
  }
6035
5927
  return true;
6036
5928
  }
6037
-
6038
5929
  //#endregion
6039
5930
  //#region src/index.ts
6040
5931
  /**
@@ -6111,7 +6002,7 @@ function createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml) {
6111
6002
  function getDebugIdSnippet(debugId) {
6112
6003
  return new CodeInjection(`var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="${debugId}",e._sentryDebugIdIdentifier="sentry-dbid-${debugId}");`);
6113
6004
  }
6114
-
6115
6005
  //#endregion
6116
6006
  export { COMMENT_USE_STRICT_REGEX, CodeInjection, createComponentNameAnnotateHooks, createDebugIdUploadFunction, createSentryBuildPluginManager, generateModuleMetadataInjectorCode, generateReleaseInjectorCode, getDebugIdSnippet, globFiles, isJsFile, replaceBooleanFlagsInCode, sentryCliBinaryExists, shouldSkipCodeInjection, stringToUUID };
6007
+
6117
6008
  //# sourceMappingURL=index.mjs.map