@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.
@@ -4092,19 +4092,19 @@ function stopHeartbeat() {
4092
4092
  }
4093
4093
  }
4094
4094
  function checkShutdownMarker(projectRoot) {
4095
- let fsSync = null;
4096
- let pathSync = null;
4095
+ let fsSync2 = null;
4096
+ let pathSync2 = null;
4097
4097
  try {
4098
- fsSync = __require("node:fs");
4099
- pathSync = __require("node:path");
4098
+ fsSync2 = __require("node:fs");
4099
+ pathSync2 = __require("node:path");
4100
4100
  } catch {
4101
4101
  return { triggered: false };
4102
4102
  }
4103
4103
  const root = projectRoot ?? (typeof process !== "undefined" ? process.cwd() : ".");
4104
- const markerPath = pathSync.join(root, SHUTDOWN_MARKER_RELPATH);
4105
- if (!fsSync.existsSync(markerPath)) return { triggered: false };
4104
+ const markerPath = pathSync2.join(root, SHUTDOWN_MARKER_RELPATH);
4105
+ if (!fsSync2.existsSync(markerPath)) return { triggered: false };
4106
4106
  try {
4107
- fsSync.unlinkSync(markerPath);
4107
+ fsSync2.unlinkSync(markerPath);
4108
4108
  } catch {
4109
4109
  }
4110
4110
  const shutdown = executeShutdown().catch(() => {
@@ -4184,8 +4184,15 @@ function registerHeartbeatShutdownHook(config, anonKey, sdkVersion) {
4184
4184
  }
4185
4185
 
4186
4186
  // src/runtime-state.ts
4187
- import { mkdirSync } from "node:fs";
4188
- import { join } from "node:path";
4187
+ var fsSync = null;
4188
+ var pathSync = null;
4189
+ try {
4190
+ fsSync = __require("node:fs");
4191
+ pathSync = __require("node:path");
4192
+ } catch {
4193
+ fsSync = null;
4194
+ pathSync = null;
4195
+ }
4189
4196
  var _projectRoot = null;
4190
4197
  var _sdkVersion = "unknown";
4191
4198
  var _lastScenario;
@@ -4194,7 +4201,7 @@ var _debounceTimer = null;
4194
4201
  var _started = false;
4195
4202
  function startRuntimeStateWriter(options) {
4196
4203
  if (_started) return;
4197
- if (!isSyncFsAvailable()) {
4204
+ if (!isSyncFsAvailable() || fsSync === null || pathSync === null) {
4198
4205
  _started = true;
4199
4206
  return;
4200
4207
  }
@@ -4246,9 +4253,9 @@ function writeStateNow() {
4246
4253
  if (_lastError) {
4247
4254
  runtimeState.lastError = _lastError;
4248
4255
  }
4249
- const dir = join(_projectRoot, ".glasstrace");
4250
- const filePath = join(dir, "runtime-state.json");
4251
- mkdirSync(dir, { recursive: true, mode: 448 });
4256
+ const dir = pathSync.join(_projectRoot, ".glasstrace");
4257
+ const filePath = pathSync.join(dir, "runtime-state.json");
4258
+ fsSync.mkdirSync(dir, { recursive: true, mode: 448 });
4252
4259
  atomicWriteFileSync(filePath, JSON.stringify(runtimeState, null, 2) + "\n", {
4253
4260
  mode: 384
4254
4261
  });
@@ -4290,7 +4297,7 @@ function registerGlasstrace(options) {
4290
4297
  setCoreState(CoreState.REGISTERING);
4291
4298
  startRuntimeStateWriter({
4292
4299
  projectRoot: process.cwd(),
4293
- sdkVersion: "1.3.5"
4300
+ sdkVersion: "1.3.6"
4294
4301
  });
4295
4302
  const config = resolveConfig(options);
4296
4303
  if (config.verbose) {
@@ -4457,8 +4464,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4457
4464
  if (config.verbose) {
4458
4465
  console.info("[glasstrace] Background init firing.");
4459
4466
  }
4460
- const healthReport = collectHealthReport("1.3.5");
4461
- const initResult = await performInit(config, anonKeyForInit, "1.3.5", healthReport);
4467
+ const healthReport = collectHealthReport("1.3.6");
4468
+ const initResult = await performInit(config, anonKeyForInit, "1.3.6", healthReport);
4462
4469
  if (generation !== registrationGeneration) return;
4463
4470
  const currentState = getCoreState();
4464
4471
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -4481,7 +4488,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4481
4488
  }
4482
4489
  maybeInstallConsoleCapture();
4483
4490
  if (didLastInitSucceed()) {
4484
- startHeartbeat(config, anonKeyForInit, "1.3.5", generation, (newApiKey, accountId) => {
4491
+ startHeartbeat(config, anonKeyForInit, "1.3.6", generation, (newApiKey, accountId) => {
4485
4492
  setAuthState(AuthState.CLAIMING);
4486
4493
  emitLifecycleEvent("auth:claim_started", { accountId });
4487
4494
  setResolvedApiKey(newApiKey);
@@ -4881,4 +4888,4 @@ export {
4881
4888
  withGlasstraceConfig,
4882
4889
  captureError
4883
4890
  };
4884
- //# sourceMappingURL=chunk-EK6MYHR2.js.map
4891
+ //# sourceMappingURL=chunk-IY6A6EXS.js.map