@glasstrace/sdk 1.3.5 → 1.3.6

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.
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  registerGlasstrace,
13
13
  waitForReady,
14
14
  withGlasstraceConfig
15
- } from "./chunk-EK6MYHR2.js";
15
+ } from "./chunk-IY6A6EXS.js";
16
16
  import {
17
17
  GlasstraceSpanProcessor,
18
18
  SdkError,
@@ -22502,19 +22502,19 @@ function stopHeartbeat() {
22502
22502
  }
22503
22503
  }
22504
22504
  function checkShutdownMarker(projectRoot) {
22505
- let fsSync2 = null;
22506
- let pathSync = null;
22505
+ let fsSync3 = null;
22506
+ let pathSync2 = null;
22507
22507
  try {
22508
- fsSync2 = require("node:fs");
22509
- pathSync = require("node:path");
22508
+ fsSync3 = require("node:fs");
22509
+ pathSync2 = require("node:path");
22510
22510
  } catch {
22511
22511
  return { triggered: false };
22512
22512
  }
22513
22513
  const root = projectRoot ?? (typeof process !== "undefined" ? process.cwd() : ".");
22514
- const markerPath = pathSync.join(root, SHUTDOWN_MARKER_RELPATH);
22515
- if (!fsSync2.existsSync(markerPath)) return { triggered: false };
22514
+ const markerPath = pathSync2.join(root, SHUTDOWN_MARKER_RELPATH);
22515
+ if (!fsSync3.existsSync(markerPath)) return { triggered: false };
22516
22516
  try {
22517
- fsSync2.unlinkSync(markerPath);
22517
+ fsSync3.unlinkSync(markerPath);
22518
22518
  } catch {
22519
22519
  }
22520
22520
  const shutdown = executeShutdown().catch(() => {
@@ -22594,9 +22594,16 @@ function registerHeartbeatShutdownHook(config2, anonKey, sdkVersion) {
22594
22594
  }
22595
22595
 
22596
22596
  // src/runtime-state.ts
22597
- var import_node_fs = require("node:fs");
22598
- var import_node_path = require("node:path");
22599
22597
  init_console_capture();
22598
+ var fsSync = null;
22599
+ var pathSync = null;
22600
+ try {
22601
+ fsSync = require("node:fs");
22602
+ pathSync = require("node:path");
22603
+ } catch {
22604
+ fsSync = null;
22605
+ pathSync = null;
22606
+ }
22600
22607
  var _projectRoot = null;
22601
22608
  var _sdkVersion = "unknown";
22602
22609
  var _lastScenario;
@@ -22605,7 +22612,7 @@ var _debounceTimer = null;
22605
22612
  var _started = false;
22606
22613
  function startRuntimeStateWriter(options) {
22607
22614
  if (_started) return;
22608
- if (!isSyncFsAvailable()) {
22615
+ if (!isSyncFsAvailable() || fsSync === null || pathSync === null) {
22609
22616
  _started = true;
22610
22617
  return;
22611
22618
  }
@@ -22657,9 +22664,9 @@ function writeStateNow() {
22657
22664
  if (_lastError) {
22658
22665
  runtimeState.lastError = _lastError;
22659
22666
  }
22660
- const dir = (0, import_node_path.join)(_projectRoot, ".glasstrace");
22661
- const filePath = (0, import_node_path.join)(dir, "runtime-state.json");
22662
- (0, import_node_fs.mkdirSync)(dir, { recursive: true, mode: 448 });
22667
+ const dir = pathSync.join(_projectRoot, ".glasstrace");
22668
+ const filePath = pathSync.join(dir, "runtime-state.json");
22669
+ fsSync.mkdirSync(dir, { recursive: true, mode: 448 });
22663
22670
  atomicWriteFileSync(filePath, JSON.stringify(runtimeState, null, 2) + "\n", {
22664
22671
  mode: 384
22665
22672
  });
@@ -22701,7 +22708,7 @@ function registerGlasstrace(options) {
22701
22708
  setCoreState(CoreState.REGISTERING);
22702
22709
  startRuntimeStateWriter({
22703
22710
  projectRoot: process.cwd(),
22704
- sdkVersion: "1.3.5"
22711
+ sdkVersion: "1.3.6"
22705
22712
  });
22706
22713
  const config2 = resolveConfig(options);
22707
22714
  if (config2.verbose) {
@@ -22868,8 +22875,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
22868
22875
  if (config2.verbose) {
22869
22876
  console.info("[glasstrace] Background init firing.");
22870
22877
  }
22871
- const healthReport = collectHealthReport("1.3.5");
22872
- const initResult = await performInit(config2, anonKeyForInit, "1.3.5", healthReport);
22878
+ const healthReport = collectHealthReport("1.3.6");
22879
+ const initResult = await performInit(config2, anonKeyForInit, "1.3.6", healthReport);
22873
22880
  if (generation !== registrationGeneration) return;
22874
22881
  const currentState = getCoreState();
22875
22882
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -22892,7 +22899,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
22892
22899
  }
22893
22900
  maybeInstallConsoleCapture();
22894
22901
  if (didLastInitSucceed()) {
22895
- startHeartbeat(config2, anonKeyForInit, "1.3.5", generation, (newApiKey, accountId) => {
22902
+ startHeartbeat(config2, anonKeyForInit, "1.3.6", generation, (newApiKey, accountId) => {
22896
22903
  setAuthState(AuthState.CLAIMING);
22897
22904
  emitLifecycleEvent("auth:claim_started", { accountId });
22898
22905
  setResolvedApiKey(newApiKey);
@@ -23127,7 +23134,7 @@ init_source_map_uploader();
23127
23134
 
23128
23135
  // src/import-graph.ts
23129
23136
  var fs3 = __toESM(require("node:fs/promises"), 1);
23130
- var fsSync = __toESM(require("node:fs"), 1);
23137
+ var fsSync2 = __toESM(require("node:fs"), 1);
23131
23138
  var path3 = __toESM(require("node:path"), 1);
23132
23139
  var crypto3 = __toESM(require("node:crypto"), 1);
23133
23140
  init_dist();
@@ -23161,7 +23168,7 @@ function loadCustomTestPatterns(projectRoot) {
23161
23168
  const configPath = path3.join(projectRoot, name);
23162
23169
  let content;
23163
23170
  try {
23164
- content = fsSync.readFileSync(configPath, "utf-8");
23171
+ content = fsSync2.readFileSync(configPath, "utf-8");
23165
23172
  } catch {
23166
23173
  continue;
23167
23174
  }