@glasstrace/sdk 0.10.0 → 0.12.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.
Files changed (48) hide show
  1. package/dist/adapters/drizzle.js +1 -1
  2. package/dist/{chunk-ZRNG36LU.js → chunk-6GRNJ722.js} +38 -17
  3. package/dist/chunk-6GRNJ722.js.map +1 -0
  4. package/dist/chunk-IPGOKORJ.js +580 -0
  5. package/dist/chunk-IPGOKORJ.js.map +1 -0
  6. package/dist/{chunk-5MAHIPFH.js → chunk-LW7DPKBA.js} +2 -2
  7. package/dist/{chunk-KOYJ2UQE.js → chunk-MSMOH6IH.js} +108 -38
  8. package/dist/chunk-MSMOH6IH.js.map +1 -0
  9. package/dist/chunk-NSBPE2FW.js +17 -0
  10. package/dist/{chunk-O3Y45VGV.js → chunk-OKIP4SRG.js} +5 -3
  11. package/dist/{chunk-O3Y45VGV.js.map → chunk-OKIP4SRG.js.map} +1 -1
  12. package/dist/cli/init.cjs +457 -330
  13. package/dist/cli/init.cjs.map +1 -1
  14. package/dist/cli/init.d.cts +25 -1
  15. package/dist/cli/init.d.ts +25 -1
  16. package/dist/cli/init.js +114 -4
  17. package/dist/cli/init.js.map +1 -1
  18. package/dist/cli/mcp-add.cjs +63 -47
  19. package/dist/cli/mcp-add.cjs.map +1 -1
  20. package/dist/cli/mcp-add.js +3 -3
  21. package/dist/cli/uninit.js +15 -564
  22. package/dist/cli/uninit.js.map +1 -1
  23. package/dist/{esm-POMEQPKL.js → esm-KBPHCVB4.js} +2 -2
  24. package/dist/{getMachineId-bsd-TC3JSTY5.js → getMachineId-bsd-345PYXFX.js} +2 -2
  25. package/dist/{getMachineId-darwin-2SUKQCE6.js → getMachineId-darwin-5L2D25AD.js} +2 -2
  26. package/dist/{getMachineId-linux-PNAFHLXH.js → getMachineId-linux-KJR4P5HN.js} +2 -2
  27. package/dist/{getMachineId-unsupported-L2MNYW3W.js → getMachineId-unsupported-NDNXDYDY.js} +2 -2
  28. package/dist/{getMachineId-win-D6D42WOQ.js → getMachineId-win-T7PJNJXG.js} +2 -2
  29. package/dist/index.cjs +327 -159
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +75 -11
  32. package/dist/index.d.ts +75 -11
  33. package/dist/index.js +159 -82
  34. package/dist/index.js.map +1 -1
  35. package/dist/{source-map-uploader-OA5NCDOK.js → source-map-uploader-ZFCYOURS.js} +6 -4
  36. package/package.json +1 -1
  37. package/dist/chunk-KOYJ2UQE.js.map +0 -1
  38. package/dist/chunk-PZ5AY32C.js +0 -10
  39. package/dist/chunk-ZRNG36LU.js.map +0 -1
  40. /package/dist/{chunk-5MAHIPFH.js.map → chunk-LW7DPKBA.js.map} +0 -0
  41. /package/dist/{chunk-PZ5AY32C.js.map → chunk-NSBPE2FW.js.map} +0 -0
  42. /package/dist/{esm-POMEQPKL.js.map → esm-KBPHCVB4.js.map} +0 -0
  43. /package/dist/{getMachineId-bsd-TC3JSTY5.js.map → getMachineId-bsd-345PYXFX.js.map} +0 -0
  44. /package/dist/{getMachineId-darwin-2SUKQCE6.js.map → getMachineId-darwin-5L2D25AD.js.map} +0 -0
  45. /package/dist/{getMachineId-linux-PNAFHLXH.js.map → getMachineId-linux-KJR4P5HN.js.map} +0 -0
  46. /package/dist/{getMachineId-unsupported-L2MNYW3W.js.map → getMachineId-unsupported-NDNXDYDY.js.map} +0 -0
  47. /package/dist/{getMachineId-win-D6D42WOQ.js.map → getMachineId-win-T7PJNJXG.js.map} +0 -0
  48. /package/dist/{source-map-uploader-OA5NCDOK.js.map → source-map-uploader-ZFCYOURS.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -14571,7 +14571,9 @@ var init_dist = __esm({
14571
14571
  });
14572
14572
  DiscoveryResponseSchema = external_exports.object({
14573
14573
  key: AnonApiKeySchema,
14574
- sessionId: SessionIdSchema
14574
+ sessionId: SessionIdSchema,
14575
+ claimed: external_exports.boolean().optional(),
14576
+ accountHint: external_exports.string().optional()
14575
14577
  });
14576
14578
  SourceMapUploadResponseSchema = external_exports.object({
14577
14579
  success: external_exports.literal(true),
@@ -16250,6 +16252,16 @@ var init_esm = __esm({
16250
16252
  function sanitize(input) {
16251
16253
  return input.replace(/[\x00-\x1f\x7f]/g, "");
16252
16254
  }
16255
+ function markerFileExists() {
16256
+ try {
16257
+ const fs4 = require("fs");
16258
+ const path4 = require("path");
16259
+ const markerPath = path4.join(process.cwd(), ".glasstrace", "mcp-connected");
16260
+ return fs4.existsSync(markerPath);
16261
+ } catch {
16262
+ return false;
16263
+ }
16264
+ }
16253
16265
  function maybeShowMcpNudge(errorSummary) {
16254
16266
  if (hasFired) {
16255
16267
  return;
@@ -16259,14 +16271,7 @@ function maybeShowMcpNudge(errorSummary) {
16259
16271
  hasFired = true;
16260
16272
  return;
16261
16273
  }
16262
- let markerExists = false;
16263
- try {
16264
- const markerPath = (0, import_node_path3.join)(process.cwd(), ".glasstrace", "mcp-connected");
16265
- markerExists = (0, import_node_fs2.existsSync)(markerPath);
16266
- } catch {
16267
- markerExists = false;
16268
- }
16269
- if (markerExists) {
16274
+ if (markerFileExists()) {
16270
16275
  hasFired = true;
16271
16276
  return;
16272
16277
  }
@@ -16279,12 +16284,10 @@ function maybeShowMcpNudge(errorSummary) {
16279
16284
  `
16280
16285
  );
16281
16286
  }
16282
- var import_node_fs2, import_node_path3, hasFired;
16287
+ var hasFired;
16283
16288
  var init_error_nudge = __esm({
16284
16289
  "src/nudge/error-nudge.ts"() {
16285
16290
  "use strict";
16286
- import_node_fs2 = require("fs");
16287
- import_node_path3 = require("path");
16288
16291
  init_env_detection();
16289
16292
  hasFired = false;
16290
16293
  }
@@ -16372,6 +16375,7 @@ __export(source_map_uploader_exports, {
16372
16375
  PRESIGNED_THRESHOLD_BYTES: () => PRESIGNED_THRESHOLD_BYTES,
16373
16376
  collectSourceMaps: () => collectSourceMaps,
16374
16377
  computeBuildHash: () => computeBuildHash,
16378
+ discoverSourceMapFiles: () => discoverSourceMapFiles,
16375
16379
  requestPresignedTokens: () => requestPresignedTokens,
16376
16380
  submitManifest: () => submitManifest,
16377
16381
  uploadSourceMaps: () => uploadSourceMaps,
@@ -16379,16 +16383,26 @@ __export(source_map_uploader_exports, {
16379
16383
  uploadSourceMapsPresigned: () => uploadSourceMapsPresigned,
16380
16384
  uploadToBlob: () => uploadToBlob
16381
16385
  });
16382
- async function collectSourceMaps(buildDir) {
16386
+ async function discoverSourceMapFiles(buildDir) {
16387
+ const resolvedDir = path2.resolve(buildDir);
16383
16388
  const results = [];
16384
16389
  try {
16385
- await walkDir(buildDir, buildDir, results);
16390
+ await walkDirMetadata(resolvedDir, resolvedDir, results);
16386
16391
  } catch {
16387
16392
  return [];
16388
16393
  }
16394
+ for (const file2 of results) {
16395
+ if (file2.sizeBytes >= LARGE_FILE_WARNING_BYTES) {
16396
+ const sizeMB = (file2.sizeBytes / (1024 * 1024)).toFixed(1);
16397
+ sdkLog(
16398
+ "warn",
16399
+ `[glasstrace] Large source map detected: ${file2.filePath} (${sizeMB}MB). Consider enabling source map compression.`
16400
+ );
16401
+ }
16402
+ }
16389
16403
  return results;
16390
16404
  }
16391
- async function walkDir(baseDir, currentDir, results) {
16405
+ async function walkDirMetadata(baseDir, currentDir, results) {
16392
16406
  let entries;
16393
16407
  try {
16394
16408
  entries = await fs2.readdir(currentDir, { withFileTypes: true });
@@ -16398,18 +16412,37 @@ async function walkDir(baseDir, currentDir, results) {
16398
16412
  for (const entry of entries) {
16399
16413
  const fullPath = path2.join(currentDir, entry.name);
16400
16414
  if (entry.isDirectory()) {
16401
- await walkDir(baseDir, fullPath, results);
16415
+ await walkDirMetadata(baseDir, fullPath, results);
16402
16416
  } else if (entry.isFile() && entry.name.endsWith(".map")) {
16403
16417
  try {
16404
- const content = await fs2.readFile(fullPath, "utf-8");
16418
+ const stat2 = await fs2.stat(fullPath);
16405
16419
  const relativePath = path2.relative(baseDir, fullPath).replace(/\\/g, "/");
16406
16420
  const compiledPath = relativePath.replace(/\.map$/, "");
16407
- results.push({ filePath: compiledPath, content });
16421
+ results.push({
16422
+ filePath: compiledPath,
16423
+ absolutePath: fullPath,
16424
+ sizeBytes: stat2.size
16425
+ });
16408
16426
  } catch {
16409
16427
  }
16410
16428
  }
16411
16429
  }
16412
16430
  }
16431
+ async function readSourceMapContent(absolutePath) {
16432
+ return fs2.readFile(absolutePath, "utf-8");
16433
+ }
16434
+ async function collectSourceMaps(buildDir) {
16435
+ const fileInfos = await discoverSourceMapFiles(buildDir);
16436
+ const results = [];
16437
+ for (const info of fileInfos) {
16438
+ try {
16439
+ const content = await readSourceMapContent(info.absolutePath);
16440
+ results.push({ filePath: info.filePath, content });
16441
+ } catch {
16442
+ }
16443
+ }
16444
+ return results;
16445
+ }
16413
16446
  async function computeBuildHash(maps) {
16414
16447
  try {
16415
16448
  const sha = (0, import_node_child_process.execFileSync)("git", ["rev-parse", "HEAD"], { encoding: "utf-8" }).trim();
@@ -16421,20 +16454,38 @@ async function computeBuildHash(maps) {
16421
16454
  const sortedMaps = [...maps ?? []].sort(
16422
16455
  (a, b) => a.filePath.localeCompare(b.filePath)
16423
16456
  );
16424
- const hashInput = sortedMaps.map((m) => `${m.filePath}
16425
- ${m.content.length}
16426
- ${m.content}`).join("");
16427
- const hash2 = crypto2.createHash("sha256").update(hashInput).digest("hex");
16428
- return hash2;
16457
+ const hash2 = crypto2.createHash("sha256");
16458
+ for (const m of sortedMaps) {
16459
+ let content;
16460
+ if ("content" in m) {
16461
+ content = m.content;
16462
+ } else {
16463
+ try {
16464
+ content = await readSourceMapContent(m.absolutePath);
16465
+ } catch {
16466
+ continue;
16467
+ }
16468
+ }
16469
+ hash2.update(`${m.filePath}
16470
+ ${content.length}
16471
+ ${content}`);
16472
+ }
16473
+ return hash2.digest("hex");
16429
16474
  }
16430
16475
  async function uploadSourceMaps(apiKey, endpoint, buildHash, maps) {
16476
+ const files = [];
16477
+ for (const m of maps) {
16478
+ try {
16479
+ const content = "content" in m ? m.content : await readSourceMapContent(m.absolutePath);
16480
+ files.push({ filePath: m.filePath, sourceMap: content });
16481
+ } catch {
16482
+ sdkLog("warn", `[glasstrace] Skipping unreadable source map: ${m.filePath}`);
16483
+ }
16484
+ }
16431
16485
  const body = {
16432
16486
  apiKey,
16433
16487
  buildHash,
16434
- files: maps.map((m) => ({
16435
- filePath: m.filePath,
16436
- sourceMap: m.content
16437
- }))
16488
+ files
16438
16489
  };
16439
16490
  const baseUrl = stripTrailingSlashes(endpoint);
16440
16491
  const response = await fetch(`${baseUrl}/v1/source-maps`, {
@@ -16531,14 +16582,15 @@ async function uploadSourceMapsPresigned(apiKey, endpoint, buildHash, maps, blob
16531
16582
  if (maps.length === 0) {
16532
16583
  throw new Error("No source maps to upload");
16533
16584
  }
16585
+ const fileMetadata = maps.map((m) => ({
16586
+ filePath: m.filePath,
16587
+ sizeBytes: "content" in m ? Buffer.byteLength(m.content, "utf-8") : m.sizeBytes
16588
+ }));
16534
16589
  const presigned = await requestPresignedTokens(
16535
16590
  apiKey,
16536
16591
  endpoint,
16537
16592
  buildHash,
16538
- maps.map((m) => ({
16539
- filePath: m.filePath,
16540
- sizeBytes: Buffer.byteLength(m.content, "utf-8")
16541
- }))
16593
+ fileMetadata
16542
16594
  );
16543
16595
  const mapsByPath = new Map(maps.map((m) => [m.filePath, m]));
16544
16596
  if (mapsByPath.size !== maps.length) {
@@ -16558,7 +16610,18 @@ async function uploadSourceMapsPresigned(apiKey, endpoint, buildHash, maps, blob
16558
16610
  const chunkResults = await Promise.all(
16559
16611
  chunk.map(async (token) => {
16560
16612
  const entry = mapsByPath.get(token.filePath);
16561
- const result = await blobUploader(token.clientToken, token.pathname, entry.content);
16613
+ let content;
16614
+ if ("content" in entry) {
16615
+ content = entry.content;
16616
+ } else {
16617
+ try {
16618
+ content = await readSourceMapContent(entry.absolutePath);
16619
+ } catch {
16620
+ sdkLog("warn", `[glasstrace] Skipping unreadable source map: ${token.filePath}`);
16621
+ return null;
16622
+ }
16623
+ }
16624
+ const result = await blobUploader(token.clientToken, token.pathname, content);
16562
16625
  return {
16563
16626
  filePath: token.filePath,
16564
16627
  sizeBytes: result.size,
@@ -16566,7 +16629,11 @@ async function uploadSourceMapsPresigned(apiKey, endpoint, buildHash, maps, blob
16566
16629
  };
16567
16630
  })
16568
16631
  );
16569
- uploadResults.push(...chunkResults);
16632
+ for (const r of chunkResults) {
16633
+ if (r !== null) {
16634
+ uploadResults.push(r);
16635
+ }
16636
+ }
16570
16637
  }
16571
16638
  return submitManifest(apiKey, endpoint, presigned.uploadId, buildHash, uploadResults);
16572
16639
  }
@@ -16575,7 +16642,10 @@ async function uploadSourceMapsAuto(apiKey, endpoint, buildHash, maps, options)
16575
16642
  throw new Error("No source maps to upload");
16576
16643
  }
16577
16644
  const totalBytes = maps.reduce(
16578
- (sum, m) => sum + Buffer.byteLength(m.content, "utf-8"),
16645
+ (sum, m) => {
16646
+ const bytes = "content" in m ? Buffer.byteLength(m.content, "utf-8") : m.sizeBytes;
16647
+ return sum + bytes;
16648
+ },
16579
16649
  0
16580
16650
  );
16581
16651
  if (totalBytes < PRESIGNED_THRESHOLD_BYTES) {
@@ -16601,11 +16671,11 @@ async function uploadSourceMapsAuto(apiKey, endpoint, buildHash, maps, options)
16601
16671
  }
16602
16672
  sdkLog(
16603
16673
  "warn",
16604
- `[glasstrace] Build exceeds 4.5MB (${totalBytes} bytes). Install @vercel/blob for presigned uploads to avoid serverless body size limits. Falling back to legacy upload.`
16674
+ `[glasstrace] Build exceeds 4.5MB (${String(totalBytes)} bytes). Install @vercel/blob for presigned uploads to avoid serverless body size limits. Falling back to legacy upload.`
16605
16675
  );
16606
16676
  return uploadSourceMaps(apiKey, endpoint, buildHash, maps);
16607
16677
  }
16608
- var fs2, path2, crypto2, import_node_child_process, PRESIGNED_THRESHOLD_BYTES;
16678
+ var fs2, path2, crypto2, import_node_child_process, LARGE_FILE_WARNING_BYTES, PRESIGNED_THRESHOLD_BYTES;
16609
16679
  var init_source_map_uploader = __esm({
16610
16680
  "src/source-map-uploader.ts"() {
16611
16681
  "use strict";
@@ -16615,6 +16685,7 @@ var init_source_map_uploader = __esm({
16615
16685
  import_node_child_process = require("child_process");
16616
16686
  init_console_capture();
16617
16687
  init_dist();
16688
+ LARGE_FILE_WARNING_BYTES = 50 * 1024 * 1024;
16618
16689
  PRESIGNED_THRESHOLD_BYTES = 45e5;
16619
16690
  }
16620
16691
  });
@@ -16634,11 +16705,13 @@ __export(src_exports, {
16634
16705
  computeBuildHash: () => computeBuildHash,
16635
16706
  createDiscoveryHandler: () => createDiscoveryHandler,
16636
16707
  deriveSessionId: () => deriveSessionId,
16708
+ discoverSourceMapFiles: () => discoverSourceMapFiles,
16637
16709
  discoverTestFiles: () => discoverTestFiles,
16638
16710
  extractImports: () => extractImports,
16639
16711
  getActiveConfig: () => getActiveConfig,
16640
16712
  getDateString: () => getDateString,
16641
16713
  getDiscoveryHandler: () => getDiscoveryHandler,
16714
+ getLinkedAccountId: () => getLinkedAccountId,
16642
16715
  getOrCreateAnonKey: () => getOrCreateAnonKey,
16643
16716
  getOrigin: () => getOrigin,
16644
16717
  isAnonymousMode: () => isAnonymousMode,
@@ -16672,14 +16745,37 @@ var SdkError = class extends Error {
16672
16745
  init_env_detection();
16673
16746
 
16674
16747
  // src/session.ts
16675
- var import_node_crypto = require("crypto");
16676
16748
  init_dist();
16677
16749
  var FOUR_HOURS_MS = 4 * 60 * 60 * 1e3;
16750
+ var hashFn = null;
16751
+ function fnv1aHash(input) {
16752
+ let hash2 = 2166136261;
16753
+ for (let i = 0; i < input.length; i++) {
16754
+ hash2 ^= input.charCodeAt(i);
16755
+ hash2 = Math.imul(hash2, 16777619);
16756
+ hash2 >>>= 0;
16757
+ }
16758
+ return hash2.toString(16).padStart(8, "0");
16759
+ }
16760
+ function getHashFn() {
16761
+ if (hashFn) return hashFn;
16762
+ try {
16763
+ const { createHash: createHash3 } = require("crypto");
16764
+ hashFn = (input) => createHash3("sha256").update(input).digest("hex").slice(0, 16);
16765
+ } catch {
16766
+ hashFn = (input) => {
16767
+ const h1 = fnv1aHash(input);
16768
+ const h2 = fnv1aHash(input + "\0");
16769
+ return (h1 + h2).slice(0, 16);
16770
+ };
16771
+ }
16772
+ return hashFn;
16773
+ }
16678
16774
  var cachedGlasstraceEnv = process.env.GLASSTRACE_ENV;
16679
16775
  var cachedPort = process.env.PORT ?? "3000";
16680
16776
  function deriveSessionId(apiKey, origin, date5, windowIndex) {
16681
16777
  const input = JSON.stringify([apiKey, origin, date5, windowIndex]);
16682
- const hash2 = (0, import_node_crypto.createHash)("sha256").update(input).digest("hex").slice(0, 16);
16778
+ const hash2 = getHashFn()(input);
16683
16779
  return SessionIdSchema.parse(hash2);
16684
16780
  }
16685
16781
  function getOrigin() {
@@ -16765,22 +16861,38 @@ function classifyFetchTarget(url2) {
16765
16861
  }
16766
16862
 
16767
16863
  // src/anon-key.ts
16768
- var import_promises = require("fs/promises");
16769
- var import_node_path = require("path");
16770
16864
  init_dist();
16771
16865
  var GLASSTRACE_DIR = ".glasstrace";
16772
16866
  var ANON_KEY_FILE = "anon_key";
16867
+ var fsPathCache;
16868
+ async function loadFsPath() {
16869
+ if (fsPathCache !== void 0) return fsPathCache;
16870
+ try {
16871
+ const [fs4, path4] = await Promise.all([
16872
+ import("fs/promises"),
16873
+ import("path")
16874
+ ]);
16875
+ fsPathCache = { fs: fs4, path: path4 };
16876
+ return fsPathCache;
16877
+ } catch {
16878
+ fsPathCache = null;
16879
+ return null;
16880
+ }
16881
+ }
16773
16882
  var ephemeralKeyCache = /* @__PURE__ */ new Map();
16774
16883
  async function readAnonKey(projectRoot) {
16775
16884
  const root = projectRoot ?? process.cwd();
16776
- const keyPath = (0, import_node_path.join)(root, GLASSTRACE_DIR, ANON_KEY_FILE);
16777
- try {
16778
- const content = await (0, import_promises.readFile)(keyPath, "utf-8");
16779
- const result = AnonApiKeySchema.safeParse(content);
16780
- if (result.success) {
16781
- return result.data;
16885
+ const modules = await loadFsPath();
16886
+ if (modules) {
16887
+ const keyPath = modules.path.join(root, GLASSTRACE_DIR, ANON_KEY_FILE);
16888
+ try {
16889
+ const content = await modules.fs.readFile(keyPath, "utf-8");
16890
+ const result = AnonApiKeySchema.safeParse(content);
16891
+ if (result.success) {
16892
+ return result.data;
16893
+ }
16894
+ } catch {
16782
16895
  }
16783
- } catch {
16784
16896
  }
16785
16897
  const cached2 = ephemeralKeyCache.get(root);
16786
16898
  if (cached2 !== void 0) {
@@ -16790,8 +16902,6 @@ async function readAnonKey(projectRoot) {
16790
16902
  }
16791
16903
  async function getOrCreateAnonKey(projectRoot) {
16792
16904
  const root = projectRoot ?? process.cwd();
16793
- const dirPath = (0, import_node_path.join)(root, GLASSTRACE_DIR);
16794
- const keyPath = (0, import_node_path.join)(dirPath, ANON_KEY_FILE);
16795
16905
  const existingKey = await readAnonKey(root);
16796
16906
  if (existingKey !== null) {
16797
16907
  return existingKey;
@@ -16801,9 +16911,16 @@ async function getOrCreateAnonKey(projectRoot) {
16801
16911
  return cached2;
16802
16912
  }
16803
16913
  const newKey = createAnonApiKey();
16914
+ const modules = await loadFsPath();
16915
+ if (!modules) {
16916
+ ephemeralKeyCache.set(root, newKey);
16917
+ return newKey;
16918
+ }
16919
+ const dirPath = modules.path.join(root, GLASSTRACE_DIR);
16920
+ const keyPath = modules.path.join(dirPath, ANON_KEY_FILE);
16804
16921
  try {
16805
- await (0, import_promises.mkdir)(dirPath, { recursive: true, mode: 448 });
16806
- await (0, import_promises.writeFile)(keyPath, newKey, { flag: "wx", mode: 384 });
16922
+ await modules.fs.mkdir(dirPath, { recursive: true, mode: 448 });
16923
+ await modules.fs.writeFile(keyPath, newKey, { flag: "wx", mode: 384 });
16807
16924
  return newKey;
16808
16925
  } catch (err) {
16809
16926
  const code = err.code;
@@ -16814,12 +16931,12 @@ async function getOrCreateAnonKey(projectRoot) {
16814
16931
  return winnerKey;
16815
16932
  }
16816
16933
  if (attempt < 2) {
16817
- await new Promise((resolve2) => setTimeout(resolve2, 50));
16934
+ await new Promise((resolve3) => setTimeout(resolve3, 50));
16818
16935
  }
16819
16936
  }
16820
16937
  try {
16821
- await (0, import_promises.writeFile)(keyPath, newKey, { mode: 384 });
16822
- await (0, import_promises.chmod)(keyPath, 384);
16938
+ await modules.fs.writeFile(keyPath, newKey, { mode: 384 });
16939
+ await modules.fs.chmod(keyPath, 384);
16823
16940
  return newKey;
16824
16941
  } catch {
16825
16942
  }
@@ -16833,22 +16950,45 @@ async function getOrCreateAnonKey(projectRoot) {
16833
16950
  }
16834
16951
 
16835
16952
  // src/init-client.ts
16836
- var import_node_fs = require("fs");
16837
- var import_promises2 = require("fs/promises");
16838
- var import_node_path2 = require("path");
16839
16953
  init_dist();
16840
16954
  var GLASSTRACE_DIR2 = ".glasstrace";
16841
16955
  var CONFIG_FILE = "config";
16842
16956
  var TWENTY_FOUR_HOURS_MS = 24 * 60 * 60 * 1e3;
16843
16957
  var INIT_TIMEOUT_MS = 1e4;
16958
+ var fsPathAsyncCache;
16959
+ async function loadFsPathAsync() {
16960
+ if (fsPathAsyncCache !== void 0) return fsPathAsyncCache;
16961
+ try {
16962
+ const [fs4, path4] = await Promise.all([
16963
+ import("fs/promises"),
16964
+ import("path")
16965
+ ]);
16966
+ fsPathAsyncCache = { fs: fs4, path: path4 };
16967
+ return fsPathAsyncCache;
16968
+ } catch {
16969
+ fsPathAsyncCache = null;
16970
+ return null;
16971
+ }
16972
+ }
16973
+ function loadFsSyncOrNull() {
16974
+ try {
16975
+ const fs4 = require("fs");
16976
+ const path4 = require("path");
16977
+ return { readFileSync: fs4.readFileSync, join: path4.join };
16978
+ } catch {
16979
+ return null;
16980
+ }
16981
+ }
16844
16982
  var currentConfig = null;
16845
16983
  var configCacheChecked = false;
16846
16984
  var rateLimitBackoff = false;
16847
16985
  function loadCachedConfig(projectRoot) {
16986
+ const modules = loadFsSyncOrNull();
16987
+ if (!modules) return null;
16848
16988
  const root = projectRoot ?? process.cwd();
16849
- const configPath = (0, import_node_path2.join)(root, GLASSTRACE_DIR2, CONFIG_FILE);
16989
+ const configPath = modules.join(root, GLASSTRACE_DIR2, CONFIG_FILE);
16850
16990
  try {
16851
- const content = (0, import_node_fs.readFileSync)(configPath, "utf-8");
16991
+ const content = modules.readFileSync(configPath, "utf-8");
16852
16992
  const parsed = JSON.parse(content);
16853
16993
  const cached2 = SdkCachedConfigSchema.parse(parsed);
16854
16994
  const age = Date.now() - cached2.cachedAt;
@@ -16868,18 +17008,20 @@ function loadCachedConfig(projectRoot) {
16868
17008
  }
16869
17009
  }
16870
17010
  async function saveCachedConfig(response, projectRoot) {
17011
+ const modules = await loadFsPathAsync();
17012
+ if (!modules) return;
16871
17013
  const root = projectRoot ?? process.cwd();
16872
- const dirPath = (0, import_node_path2.join)(root, GLASSTRACE_DIR2);
16873
- const configPath = (0, import_node_path2.join)(dirPath, CONFIG_FILE);
17014
+ const dirPath = modules.path.join(root, GLASSTRACE_DIR2);
17015
+ const configPath = modules.path.join(dirPath, CONFIG_FILE);
16874
17016
  try {
16875
- await (0, import_promises2.mkdir)(dirPath, { recursive: true, mode: 448 });
16876
- await (0, import_promises2.chmod)(dirPath, 448);
17017
+ await modules.fs.mkdir(dirPath, { recursive: true, mode: 448 });
17018
+ await modules.fs.chmod(dirPath, 448);
16877
17019
  const cached2 = {
16878
17020
  response,
16879
17021
  cachedAt: Date.now()
16880
17022
  };
16881
- await (0, import_promises2.writeFile)(configPath, JSON.stringify(cached2), { encoding: "utf-8", mode: 384 });
16882
- await (0, import_promises2.chmod)(configPath, 384);
17023
+ await modules.fs.writeFile(configPath, JSON.stringify(cached2), { encoding: "utf-8", mode: 384 });
17024
+ await modules.fs.chmod(configPath, 384);
16883
17025
  } catch (err) {
16884
17026
  console.warn(
16885
17027
  `[glasstrace] Failed to cache config to ${configPath}: ${err instanceof Error ? err.message : String(err)}`
@@ -16933,69 +17075,72 @@ async function sendInitRequest(config2, anonKey, sdkVersion, importGraph, health
16933
17075
  return SdkInitResponseSchema.parse(body);
16934
17076
  }
16935
17077
  async function writeClaimedKey(newApiKey, projectRoot) {
16936
- const root = projectRoot ?? process.cwd();
16937
- const envLocalPath = (0, import_node_path2.join)(root, ".env.local");
16938
- let envLocalWritten = false;
16939
- try {
16940
- let content;
17078
+ const modules = await loadFsPathAsync();
17079
+ if (modules) {
17080
+ const root = projectRoot ?? process.cwd();
17081
+ const envLocalPath = modules.path.join(root, ".env.local");
17082
+ let envLocalWritten = false;
16941
17083
  try {
16942
- content = await (0, import_promises2.readFile)(envLocalPath, "utf-8");
16943
- if (/^GLASSTRACE_API_KEY=.*/m.test(content)) {
16944
- content = content.replace(
16945
- /^GLASSTRACE_API_KEY=.*$/gm,
16946
- `GLASSTRACE_API_KEY=${newApiKey}`
16947
- );
16948
- } else {
16949
- if (content.length > 0 && !content.endsWith("\n")) {
16950
- content += "\n";
17084
+ let content;
17085
+ try {
17086
+ content = await modules.fs.readFile(envLocalPath, "utf-8");
17087
+ if (/^GLASSTRACE_API_KEY=.*/m.test(content)) {
17088
+ content = content.replace(
17089
+ /^GLASSTRACE_API_KEY=.*$/gm,
17090
+ `GLASSTRACE_API_KEY=${newApiKey}`
17091
+ );
17092
+ } else {
17093
+ if (content.length > 0 && !content.endsWith("\n")) {
17094
+ content += "\n";
17095
+ }
17096
+ content += `GLASSTRACE_API_KEY=${newApiKey}
17097
+ `;
17098
+ }
17099
+ } catch (readErr) {
17100
+ const code = readErr instanceof Error ? readErr.code : void 0;
17101
+ if (code !== "ENOENT") {
17102
+ throw readErr;
16951
17103
  }
16952
- content += `GLASSTRACE_API_KEY=${newApiKey}
17104
+ content = `GLASSTRACE_API_KEY=${newApiKey}
16953
17105
  `;
16954
17106
  }
16955
- } catch (readErr) {
16956
- const code = readErr instanceof Error ? readErr.code : void 0;
16957
- if (code !== "ENOENT") {
16958
- throw readErr;
17107
+ await modules.fs.writeFile(envLocalPath, content, { encoding: "utf-8", mode: 384 });
17108
+ await modules.fs.chmod(envLocalPath, 384);
17109
+ envLocalWritten = true;
17110
+ } catch {
17111
+ }
17112
+ if (envLocalWritten) {
17113
+ try {
17114
+ process.stderr.write(
17115
+ "[glasstrace] Account claimed! API key written to .env.local. Restart your dev server to use it.\n"
17116
+ );
17117
+ } catch {
16959
17118
  }
16960
- content = `GLASSTRACE_API_KEY=${newApiKey}
16961
- `;
17119
+ return;
16962
17120
  }
16963
- await (0, import_promises2.writeFile)(envLocalPath, content, { encoding: "utf-8", mode: 384 });
16964
- await (0, import_promises2.chmod)(envLocalPath, 384);
16965
- envLocalWritten = true;
16966
- } catch {
16967
- }
16968
- if (envLocalWritten) {
17121
+ let claimedKeyWritten = false;
16969
17122
  try {
16970
- process.stderr.write(
16971
- "[glasstrace] Account claimed! API key written to .env.local. Restart your dev server to use it.\n"
16972
- );
17123
+ const dirPath = modules.path.join(root, GLASSTRACE_DIR2);
17124
+ await modules.fs.mkdir(dirPath, { recursive: true, mode: 448 });
17125
+ await modules.fs.chmod(dirPath, 448);
17126
+ const claimedKeyPath = modules.path.join(dirPath, "claimed-key");
17127
+ await modules.fs.writeFile(claimedKeyPath, newApiKey, {
17128
+ encoding: "utf-8",
17129
+ mode: 384
17130
+ });
17131
+ await modules.fs.chmod(claimedKeyPath, 384);
17132
+ claimedKeyWritten = true;
16973
17133
  } catch {
16974
17134
  }
16975
- return;
16976
- }
16977
- let claimedKeyWritten = false;
16978
- try {
16979
- const dirPath = (0, import_node_path2.join)(root, GLASSTRACE_DIR2);
16980
- await (0, import_promises2.mkdir)(dirPath, { recursive: true, mode: 448 });
16981
- await (0, import_promises2.chmod)(dirPath, 448);
16982
- const claimedKeyPath = (0, import_node_path2.join)(dirPath, "claimed-key");
16983
- await (0, import_promises2.writeFile)(claimedKeyPath, newApiKey, {
16984
- encoding: "utf-8",
16985
- mode: 384
16986
- });
16987
- await (0, import_promises2.chmod)(claimedKeyPath, 384);
16988
- claimedKeyWritten = true;
16989
- } catch {
16990
- }
16991
- if (claimedKeyWritten) {
16992
- try {
16993
- process.stderr.write(
16994
- "[glasstrace] Account claimed! API key written to .glasstrace/claimed-key. Copy it to your .env.local file.\n"
16995
- );
16996
- } catch {
17135
+ if (claimedKeyWritten) {
17136
+ try {
17137
+ process.stderr.write(
17138
+ "[glasstrace] Account claimed! API key written to .glasstrace/claimed-key. Copy it to your .env.local file.\n"
17139
+ );
17140
+ } catch {
17141
+ }
17142
+ return;
16997
17143
  }
16998
- return;
16999
17144
  }
17000
17145
  try {
17001
17146
  process.stderr.write(
@@ -17094,6 +17239,12 @@ function getActiveConfig() {
17094
17239
  }
17095
17240
  return { ...DEFAULT_CAPTURE_CONFIG };
17096
17241
  }
17242
+ function getLinkedAccountId() {
17243
+ return currentConfig?.linkedAccountId;
17244
+ }
17245
+ function getClaimResult() {
17246
+ return currentConfig?.claimResult;
17247
+ }
17097
17248
  function _setCurrentConfig(config2) {
17098
17249
  currentConfig = config2;
17099
17250
  }
@@ -17407,7 +17558,7 @@ function buildCorsHeaders(origin) {
17407
17558
  }
17408
17559
  return headers;
17409
17560
  }
17410
- function createDiscoveryHandler(getAnonKey, getSessionId) {
17561
+ function createDiscoveryHandler(getAnonKey, getSessionId, getClaimState) {
17411
17562
  return async (request) => {
17412
17563
  let url2;
17413
17564
  try {
@@ -17451,8 +17602,16 @@ function createDiscoveryHandler(getAnonKey, getSessionId) {
17451
17602
  );
17452
17603
  }
17453
17604
  const sessionId = getSessionId();
17605
+ const responseBody = { key: anonKey, sessionId };
17606
+ const claimState = getClaimState?.();
17607
+ if (claimState?.claimed) {
17608
+ responseBody.claimed = true;
17609
+ if (claimState.accountHint) {
17610
+ responseBody.accountHint = claimState.accountHint;
17611
+ }
17612
+ }
17454
17613
  return new Response(
17455
- JSON.stringify({ key: anonKey, sessionId }),
17614
+ JSON.stringify(responseBody),
17456
17615
  {
17457
17616
  status: 200,
17458
17617
  headers: corsHeaders
@@ -18000,8 +18159,8 @@ var Deferred = class {
18000
18159
  _resolve;
18001
18160
  _reject;
18002
18161
  constructor() {
18003
- this._promise = new Promise((resolve2, reject) => {
18004
- this._resolve = resolve2;
18162
+ this._promise = new Promise((resolve3, reject) => {
18163
+ this._resolve = resolve3;
18005
18164
  this._reject = reject;
18006
18165
  });
18007
18166
  }
@@ -18619,7 +18778,7 @@ var VERSION3 = "0.214.0";
18619
18778
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
18620
18779
  var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION3}`;
18621
18780
  function sendWithHttp(request, url2, headers, compression, userAgent, agent, data, timeoutMillis) {
18622
- return new Promise((resolve2) => {
18781
+ return new Promise((resolve3) => {
18623
18782
  const parsedUrl = new URL(url2);
18624
18783
  if (userAgent) {
18625
18784
  headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
@@ -18639,18 +18798,18 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
18639
18798
  res.on("data", (chunk) => responseData.push(chunk));
18640
18799
  res.on("end", () => {
18641
18800
  if (res.statusCode && res.statusCode <= 299) {
18642
- resolve2({
18801
+ resolve3({
18643
18802
  status: "success",
18644
18803
  data: Buffer.concat(responseData)
18645
18804
  });
18646
18805
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
18647
- resolve2({
18806
+ resolve3({
18648
18807
  status: "retryable",
18649
18808
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
18650
18809
  });
18651
18810
  } else {
18652
18811
  const error48 = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
18653
- resolve2({
18812
+ resolve3({
18654
18813
  status: "failure",
18655
18814
  error: error48
18656
18815
  });
@@ -18658,17 +18817,17 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
18658
18817
  });
18659
18818
  res.on("error", (error48) => {
18660
18819
  if (res.statusCode && res.statusCode <= 299) {
18661
- resolve2({
18820
+ resolve3({
18662
18821
  status: "success"
18663
18822
  });
18664
18823
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
18665
- resolve2({
18824
+ resolve3({
18666
18825
  status: "retryable",
18667
18826
  error: error48,
18668
18827
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
18669
18828
  });
18670
18829
  } else {
18671
- resolve2({
18830
+ resolve3({
18672
18831
  status: "failure",
18673
18832
  error: error48
18674
18833
  });
@@ -18677,26 +18836,26 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
18677
18836
  });
18678
18837
  req.setTimeout(timeoutMillis, () => {
18679
18838
  req.destroy();
18680
- resolve2({
18839
+ resolve3({
18681
18840
  status: "retryable",
18682
18841
  error: new Error("Request timed out")
18683
18842
  });
18684
18843
  });
18685
18844
  req.on("error", (error48) => {
18686
18845
  if (isHttpTransportNetworkErrorRetryable(error48)) {
18687
- resolve2({
18846
+ resolve3({
18688
18847
  status: "retryable",
18689
18848
  error: error48
18690
18849
  });
18691
18850
  } else {
18692
- resolve2({
18851
+ resolve3({
18693
18852
  status: "failure",
18694
18853
  error: error48
18695
18854
  });
18696
18855
  }
18697
18856
  });
18698
18857
  compressAndSend(req, compression, data, (error48) => {
18699
- resolve2({
18858
+ resolve3({
18700
18859
  status: "failure",
18701
18860
  error: error48
18702
18861
  });
@@ -18786,9 +18945,9 @@ var RetryingTransport = class {
18786
18945
  this._transport = transport;
18787
18946
  }
18788
18947
  retry(data, timeoutMillis, inMillis) {
18789
- return new Promise((resolve2, reject) => {
18948
+ return new Promise((resolve3, reject) => {
18790
18949
  setTimeout(() => {
18791
- this._transport.send(data, timeoutMillis).then(resolve2, reject);
18950
+ this._transport.send(data, timeoutMillis).then(resolve3, reject);
18792
18951
  }, inMillis);
18793
18952
  });
18794
18953
  }
@@ -19652,14 +19811,14 @@ var BatchSpanProcessorBase = class {
19652
19811
  * for all other cases _flush should be used
19653
19812
  * */
19654
19813
  _flushAll() {
19655
- return new Promise((resolve2, reject) => {
19814
+ return new Promise((resolve3, reject) => {
19656
19815
  const promises = [];
19657
19816
  const count = Math.ceil(this._finishedSpans.length / this._maxExportBatchSize);
19658
19817
  for (let i = 0, j = count; i < j; i++) {
19659
19818
  promises.push(this._flushOneBatch());
19660
19819
  }
19661
19820
  Promise.all(promises).then(() => {
19662
- resolve2();
19821
+ resolve3();
19663
19822
  }).catch(reject);
19664
19823
  });
19665
19824
  }
@@ -19668,7 +19827,7 @@ var BatchSpanProcessorBase = class {
19668
19827
  if (this._finishedSpans.length === 0) {
19669
19828
  return Promise.resolve();
19670
19829
  }
19671
- return new Promise((resolve2, reject) => {
19830
+ return new Promise((resolve3, reject) => {
19672
19831
  const timer = setTimeout(() => {
19673
19832
  reject(new Error("Timeout"));
19674
19833
  }, this._exportTimeoutMillis);
@@ -19683,7 +19842,7 @@ var BatchSpanProcessorBase = class {
19683
19842
  const doExport = () => this._exporter.export(spans, (result) => {
19684
19843
  clearTimeout(timer);
19685
19844
  if (result.code === ExportResultCode.SUCCESS) {
19686
- resolve2();
19845
+ resolve3();
19687
19846
  } else {
19688
19847
  reject(result.error ?? new Error("BatchSpanProcessor: span export failed"));
19689
19848
  }
@@ -19970,12 +20129,12 @@ var MultiSpanProcessor = class {
19970
20129
  for (const spanProcessor of this._spanProcessors) {
19971
20130
  promises.push(spanProcessor.forceFlush());
19972
20131
  }
19973
- return new Promise((resolve2) => {
20132
+ return new Promise((resolve3) => {
19974
20133
  Promise.all(promises).then(() => {
19975
- resolve2();
20134
+ resolve3();
19976
20135
  }).catch((error48) => {
19977
20136
  globalErrorHandler(error48 || new Error("MultiSpanProcessor: forceFlush failed"));
19978
- resolve2();
20137
+ resolve3();
19979
20138
  });
19980
20139
  });
19981
20140
  }
@@ -20001,9 +20160,9 @@ var MultiSpanProcessor = class {
20001
20160
  for (const spanProcessor of this._spanProcessors) {
20002
20161
  promises.push(spanProcessor.shutdown());
20003
20162
  }
20004
- return new Promise((resolve2, reject) => {
20163
+ return new Promise((resolve3, reject) => {
20005
20164
  Promise.all(promises).then(() => {
20006
- resolve2();
20165
+ resolve3();
20007
20166
  }, reject);
20008
20167
  });
20009
20168
  }
@@ -20044,32 +20203,32 @@ var BasicTracerProvider = class {
20044
20203
  forceFlush() {
20045
20204
  const timeout = this._config.forceFlushTimeoutMillis;
20046
20205
  const promises = this._activeSpanProcessor["_spanProcessors"].map((spanProcessor) => {
20047
- return new Promise((resolve2) => {
20206
+ return new Promise((resolve3) => {
20048
20207
  let state;
20049
20208
  const timeoutInterval = setTimeout(() => {
20050
- resolve2(new Error(`Span processor did not completed within timeout period of ${timeout} ms`));
20209
+ resolve3(new Error(`Span processor did not completed within timeout period of ${timeout} ms`));
20051
20210
  state = ForceFlushState.timeout;
20052
20211
  }, timeout);
20053
20212
  spanProcessor.forceFlush().then(() => {
20054
20213
  clearTimeout(timeoutInterval);
20055
20214
  if (state !== ForceFlushState.timeout) {
20056
20215
  state = ForceFlushState.resolved;
20057
- resolve2(state);
20216
+ resolve3(state);
20058
20217
  }
20059
20218
  }).catch((error48) => {
20060
20219
  clearTimeout(timeoutInterval);
20061
20220
  state = ForceFlushState.error;
20062
- resolve2(error48);
20221
+ resolve3(error48);
20063
20222
  });
20064
20223
  });
20065
20224
  });
20066
- return new Promise((resolve2, reject) => {
20225
+ return new Promise((resolve3, reject) => {
20067
20226
  Promise.all(promises).then((results) => {
20068
20227
  const errors = results.filter((result) => result !== ForceFlushState.resolved);
20069
20228
  if (errors.length > 0) {
20070
20229
  reject(errors);
20071
20230
  } else {
20072
- resolve2();
20231
+ resolve3();
20073
20232
  }
20074
20233
  }).catch((error48) => reject([error48]));
20075
20234
  });
@@ -20244,9 +20403,15 @@ function registerGlasstrace(options) {
20244
20403
  if (isDiscoveryEnabled(config2)) {
20245
20404
  let resolvedAnonKey = null;
20246
20405
  const anonKeyPromise = getOrCreateAnonKey();
20406
+ const getClaimState = () => {
20407
+ if (getLinkedAccountId()) return { claimed: true };
20408
+ if (getClaimResult()) return { claimed: true };
20409
+ return null;
20410
+ };
20247
20411
  discoveryHandler = createDiscoveryHandler(
20248
20412
  async () => resolvedAnonKey,
20249
- () => sessionManager.getSessionId(getResolvedApiKey())
20413
+ () => sessionManager.getSessionId(getResolvedApiKey()),
20414
+ getClaimState
20250
20415
  );
20251
20416
  if (config2.verbose) {
20252
20417
  console.info("[glasstrace] Discovery endpoint registered (key pending).");
@@ -20262,7 +20427,8 @@ function registerGlasstrace(options) {
20262
20427
  if (currentGeneration !== registrationGeneration) return;
20263
20428
  discoveryHandler = createDiscoveryHandler(
20264
20429
  () => Promise.resolve(anonKey),
20265
- () => sessionManager.getSessionId(getResolvedApiKey())
20430
+ () => sessionManager.getSessionId(getResolvedApiKey()),
20431
+ getClaimState
20266
20432
  );
20267
20433
  await backgroundInit(config2, anonKey, currentGeneration);
20268
20434
  } catch (err) {
@@ -20319,7 +20485,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
20319
20485
  if (config2.verbose) {
20320
20486
  console.info("[glasstrace] Background init firing.");
20321
20487
  }
20322
- const initResult = await performInit(config2, anonKeyForInit, "0.10.0");
20488
+ const initResult = await performInit(config2, anonKeyForInit, "0.12.0");
20323
20489
  if (generation !== registrationGeneration) return;
20324
20490
  if (initResult?.claimResult) {
20325
20491
  setResolvedApiKey(initResult.claimResult.newApiKey);
@@ -20393,16 +20559,16 @@ async function handleSourceMapUpload(distDir) {
20393
20559
  );
20394
20560
  return;
20395
20561
  }
20396
- const { collectSourceMaps: collectSourceMaps2, computeBuildHash: computeBuildHash2, uploadSourceMaps: uploadSourceMaps2 } = await Promise.resolve().then(() => (init_source_map_uploader(), source_map_uploader_exports));
20397
- const maps = await collectSourceMaps2(distDir);
20398
- if (maps.length === 0) {
20562
+ const { discoverSourceMapFiles: discoverSourceMapFiles2, computeBuildHash: computeBuildHash2, uploadSourceMaps: uploadSourceMaps2 } = await Promise.resolve().then(() => (init_source_map_uploader(), source_map_uploader_exports));
20563
+ const files = await discoverSourceMapFiles2(distDir);
20564
+ if (files.length === 0) {
20399
20565
  console.info("[glasstrace] No source map files found. Skipping upload.");
20400
20566
  return;
20401
20567
  }
20402
- const buildHash = await computeBuildHash2(maps);
20403
- await uploadSourceMaps2(apiKey, endpoint, buildHash, maps);
20568
+ const buildHash = await computeBuildHash2(files);
20569
+ await uploadSourceMaps2(apiKey, endpoint, buildHash, files);
20404
20570
  console.info(
20405
- `[glasstrace] Uploaded ${String(maps.length)} source map(s) for build ${buildHash}.`
20571
+ `[glasstrace] Uploaded ${String(files.length)} source map(s) for build ${buildHash}.`
20406
20572
  );
20407
20573
  } catch (error48) {
20408
20574
  const message = error48 instanceof Error ? error48.message : "Unknown error";
@@ -20619,11 +20785,13 @@ async function buildImportGraph(projectRoot) {
20619
20785
  computeBuildHash,
20620
20786
  createDiscoveryHandler,
20621
20787
  deriveSessionId,
20788
+ discoverSourceMapFiles,
20622
20789
  discoverTestFiles,
20623
20790
  extractImports,
20624
20791
  getActiveConfig,
20625
20792
  getDateString,
20626
20793
  getDiscoveryHandler,
20794
+ getLinkedAccountId,
20627
20795
  getOrCreateAnonKey,
20628
20796
  getOrigin,
20629
20797
  isAnonymousMode,