@maple-dev/browser 0.13.0 → 0.14.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.
@@ -1,5 +1,5 @@
1
1
  import { E as ingestHeaders, H as consentAllowedSince, K as onConsentChange, M as sdkHint, P as selectorOf, U as consentRevokedAt, W as hasConsent, X as scrubUrl, Z as mayUseStorage, l as onSessionEvent } from "./sink-Ji0J42ul.mjs";
2
- import { _ as Severity, a as attachLogSink, c as liveMapleTracer, d as SDK_VERSION, f as OtlpExporter, g as onErrorRecorded, h as claimPageSignal, i as onDocumentPageload, l as resourceAttributes, m as attachSpanStash, o as detachLogSink, p as newestFirstOnExit, r as navigationSpanAt, s as emitLog, u as SDK_NAME, v as severityOf } from "./src-JUynR8Jc.mjs";
2
+ import { _ as Severity, a as attachLogSink, c as liveMapleTracer, d as SDK_VERSION, f as OtlpExporter, g as onErrorRecorded, h as claimPageSignal, i as onDocumentPageload, l as resourceAttributes, m as attachSpanStash, o as detachLogSink, p as newestFirstOnExit, r as navigationSpanAt, s as emitLog, u as SDK_NAME, v as severityOf } from "./src-B3Giah8c.mjs";
3
3
  import { t as installConsoleCapture } from "./console-iNhlufZV.mjs";
4
4
  import { ROOT_CONTEXT, TraceFlags, context, trace } from "@opentelemetry/api";
5
5
  import { JsonLogsSerializer, JsonTraceSerializer } from "@opentelemetry/otlp-transformer";
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as MapleBrowser } from "./src-JUynR8Jc.mjs";
1
+ import { t as MapleBrowser } from "./src-B3Giah8c.mjs";
2
2
  export { MapleBrowser };
package/dist/react.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as interruptNavigation, t as MapleBrowser } from "./src-JUynR8Jc.mjs";
1
+ import { n as interruptNavigation, t as MapleBrowser } from "./src-B3Giah8c.mjs";
2
2
  import { Component } from "react";
3
3
  //#region src/react.ts
4
4
  /** Component stacks can run to hundreds of lines; the top of it names the failing tree. */
@@ -1,5 +1,5 @@
1
1
  import { B as withStartedTraceId, F as BLOCK_SELECTOR, I as safeEmit, L as truncateText, N as warnDropped, O as postSessionBlob, R as activeTraceId, T as gzipStored, U as consentRevokedAt, X as scrubUrl, Y as isJsonObject, Z as mayUseStorage, _ as markReplayTriggered, b as patchMethod, d as startEventSink, g as markReplayHalted, h as markActivity, j as reserveKeepalive, k as postSessionMeta, m as isReplayHalted, n as getObservedTraceIds, o as startSessionLifecycle, r as publishSessionSink, v as nextChunkSeq, w as gzip } from "./sink-Ji0J42ul.mjs";
2
- import { b as clearPendingChunk, y as PENDING_CHUNK_KEY } from "./src-JUynR8Jc.mjs";
2
+ import { b as clearPendingChunk, y as PENDING_CHUNK_KEY } from "./src-B3Giah8c.mjs";
3
3
  import { t as installConsoleCapture } from "./console-iNhlufZV.mjs";
4
4
  import { record } from "rrweb";
5
5
  //#region ../browser-session/src/replay/capture/network.ts
@@ -1,12 +1,12 @@
1
1
  import { A as postToIngest, C as OTLP_UNLOAD_TAIL_BYTES, D as otlpKeepaliveRoom, E as ingestHeaders, G as mayPersistIdentifier, H as consentAllowedSince, J as setVisitorTracking, K as onConsentChange, L as truncateText, M as sdkHint, S as isLikelyBot, V as configurePrivacy, W as hasConsent, X as scrubUrl, a as recordTraceId, c as getActiveSink, d as startEventSink, f as claimReplayMode, i as readSessionSink, n as getObservedTraceIds, o as startSessionLifecycle, p as getSession, q as setConsent, r as publishSessionSink, s as clearPendingEvents, t as clearSessionSink, u as queuePending, x as postSessionMetaRow, y as rotateSession, z as setActiveTraceIdProvider } from "./sink-Ji0J42ul.mjs";
2
2
  import { INVALID_SPAN_CONTEXT, ProxyTracerProvider, SpanKind, SpanStatusCode, TraceFlags, context, createContextKey, createTraceState, isSpanContextValid, propagation, trace } from "@opentelemetry/api";
3
- import { BatchSpanProcessor, SamplingDecision } from "@opentelemetry/sdk-trace-base";
3
+ import { BatchSpanProcessor, SamplingDecision, StackContextManager, TracerProvider } from "@opentelemetry/sdk-trace";
4
+ import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } from "@opentelemetry/core";
4
5
  import { registerInstrumentations } from "@opentelemetry/instrumentation";
5
6
  import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
6
7
  import { XMLHttpRequestInstrumentation } from "@opentelemetry/instrumentation-xml-http-request";
7
8
  import { JsonTraceSerializer } from "@opentelemetry/otlp-transformer";
8
9
  import { resourceFromAttributes } from "@opentelemetry/resources";
9
- import { WebTracerProvider } from "@opentelemetry/sdk-trace-web";
10
10
  import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, ATTR_TELEMETRY_SDK_LANGUAGE, ATTR_TELEMETRY_SDK_NAME, ATTR_TELEMETRY_SDK_VERSION, TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS } from "@opentelemetry/semantic-conventions";
11
11
  //#region ../browser-session/src/events/props.ts
12
12
  const MAX_PROPS = 32;
@@ -907,7 +907,10 @@ var HttpStatusExporter = class {
907
907
  this.captureStatus = captureStatus;
908
908
  }
909
909
  apply(span) {
910
- const read = (key) => span.attributes[key];
910
+ const read = (key) => {
911
+ const value = span.attributes[key];
912
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : void 0;
913
+ };
911
914
  const status = responseStatus(read);
912
915
  if (span.kind === SpanKind.CLIENT && status !== void 0 && inStatusRanges(status, this.captureStatus)) {
913
916
  if (span.events.some((event) => event.name === "exception")) return span;
@@ -1110,7 +1113,7 @@ function newestFirstOnExit(inner, serializer, olderReserve = 0, leaving = () =>
1110
1113
  }
1111
1114
  //#endregion
1112
1115
  //#region src/version.ts
1113
- const SDK_VERSION = "0.13.0";
1116
+ const SDK_VERSION = "0.14.0";
1114
1117
  /** The `x-maple-sdk` value this build sends. */
1115
1118
  const SDK_NAME = "maple-browser";
1116
1119
  //#endregion
@@ -1258,7 +1261,7 @@ function setupTracing(config) {
1258
1261
  return atStart !== void 0 && atStart !== connectionLosses ? lastLossReason : void 0;
1259
1262
  };
1260
1263
  const lostXhrSpans = /* @__PURE__ */ new WeakSet();
1261
- const provider = new WebTracerProvider({
1264
+ const provider = new TracerProvider({
1262
1265
  resource: resourceFromAttributes(resourceAttributes(config)),
1263
1266
  sampler: new SessionSampler(config.tracingSampleRate),
1264
1267
  spanProcessors: [
@@ -1277,10 +1280,15 @@ function setupTracing(config) {
1277
1280
  forceFlush: () => Promise.resolve(),
1278
1281
  shutdown: () => Promise.resolve()
1279
1282
  },
1280
- new BatchSpanProcessor(exporter, { scheduledDelayMillis: EXPORT_INTERVAL_MS })
1283
+ new BatchSpanProcessor({
1284
+ exporter,
1285
+ scheduledDelayMillis: EXPORT_INTERVAL_MS
1286
+ })
1281
1287
  ]
1282
1288
  });
1283
- provider.register();
1289
+ trace.setGlobalTracerProvider(provider);
1290
+ propagation.setGlobalPropagator(new CompositePropagator({ propagators: [new W3CTraceContextPropagator(), new W3CBaggagePropagator()] }));
1291
+ context.setGlobalContextManager(new StackContextManager().enable());
1284
1292
  mapleProvider = provider;
1285
1293
  const globalProvider = trace.getTracerProvider();
1286
1294
  const ownsGlobals = globalProvider === provider || globalProvider instanceof ProxyTracerProvider && globalProvider.getDelegate() === provider;
@@ -1445,7 +1453,7 @@ let pending = [];
1445
1453
  */
1446
1454
  function captureException(error, options = {}) {
1447
1455
  if (typeof window === "undefined") return;
1448
- if (!accepting && !liveMapleTracer("maple-browser", "0.13.0")) {
1456
+ if (!accepting && !liveMapleTracer("maple-browser", "0.14.0")) {
1449
1457
  pending.push({
1450
1458
  error,
1451
1459
  options,
@@ -1919,7 +1927,7 @@ function init(rawConfig) {
1919
1927
  }, session.id);
1920
1928
  if (!deferredPending) {
1921
1929
  setLogIdentity(() => config.identity?.id);
1922
- deferredPending = import("./deferred-Dr2AmxSU.mjs").then(({ startDeferred }) => {
1930
+ deferredPending = import("./deferred-BcyLmMyV.mjs").then(({ startDeferred }) => {
1923
1931
  stopDeferred = startDeferred(config);
1924
1932
  }).catch(() => {});
1925
1933
  }
@@ -1953,7 +1961,7 @@ function init(rawConfig) {
1953
1961
  runtime = next;
1954
1962
  const ownGeneration = ++generation;
1955
1963
  const stale = () => stopped || !hasConsent() || generation !== ownGeneration || runtime !== next;
1956
- next.replayPending = import("./replay-session-BuUOwHnI.mjs").then(({ startReplaySession }) => {
1964
+ next.replayPending = import("./replay-session-DFPRE4Ee.mjs").then(({ startReplaySession }) => {
1957
1965
  if (stale()) return;
1958
1966
  next.replay = startReplaySession({
1959
1967
  ...shared,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maple-dev/browser",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Maple browser SDK — OpenTelemetry tracing and rrweb session replay in one package. Every span and replay event shares a session id for trace↔replay correlation.",
5
5
  "keywords": [
6
6
  "maple",
@@ -47,16 +47,16 @@
47
47
  "size": "bun scripts/size.ts"
48
48
  },
49
49
  "dependencies": {
50
- "@opentelemetry/api": "^1.9.0",
51
- "@opentelemetry/instrumentation": "^0.222.0",
52
- "@opentelemetry/instrumentation-fetch": "^0.222.0",
53
- "@opentelemetry/instrumentation-xml-http-request": "^0.222.0",
54
- "@opentelemetry/otlp-transformer": "^0.222.0",
55
- "@opentelemetry/resources": "^2.10.0",
56
- "@opentelemetry/sdk-logs": "^0.222.0",
57
- "@opentelemetry/sdk-trace-base": "^2.10.0",
58
- "@opentelemetry/sdk-trace-web": "^2.10.0",
59
- "@opentelemetry/semantic-conventions": "^1.43.0",
50
+ "@opentelemetry/api": "^1.10.0",
51
+ "@opentelemetry/core": "^3.0.0",
52
+ "@opentelemetry/instrumentation": "^0.300.0",
53
+ "@opentelemetry/instrumentation-fetch": "^0.300.0",
54
+ "@opentelemetry/instrumentation-xml-http-request": "^0.300.0",
55
+ "@opentelemetry/otlp-transformer": "^0.300.0",
56
+ "@opentelemetry/resources": "^3.0.0",
57
+ "@opentelemetry/sdk-logs": "^3.0.0",
58
+ "@opentelemetry/sdk-trace": "^3.0.0",
59
+ "@opentelemetry/semantic-conventions": "^1.44.0",
60
60
  "rrweb": "^2.0.0-alpha.18",
61
61
  "web-vitals": "^6.2.2"
62
62
  },
@@ -65,7 +65,7 @@
65
65
  "@maple/sdk-core": "0.1.0",
66
66
  "@types/react": "^19.3.0",
67
67
  "@types/react-dom": "^19.3.0",
68
- "@vitest/browser-playwright": "^5.0.5",
68
+ "@vitest/browser-playwright": "^5.1.0",
69
69
  "fast-check": "^4.10.2",
70
70
  "playwright": "^1.64.1",
71
71
  "react": "^19.3.1",
@@ -73,7 +73,7 @@
73
73
  "tsdown": "^0.23.0",
74
74
  "typescript": "^7.0.2",
75
75
  "vite": "^8.3.5",
76
- "vitest": "^5.0.5"
76
+ "vitest": "^5.1.0"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "react": ">=18"