hyperframes 0.8.111 → 0.8.113

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 (189) hide show
  1. package/dist/{add-M5WN2AM2.js → add-ILIGSLV4.js} +15 -15
  2. package/dist/{agentPromptGenerator-QL2KAWEP.js → agentPromptGenerator-VIIPZCJ3.js} +1 -1
  3. package/dist/{animatedGifPrep-NMGFOSIL.js → animatedGifPrep-U7FMC7DB.js} +6 -6
  4. package/dist/{asset-GUASPIKN.js → asset-OFDEIAGM.js} +2 -2
  5. package/dist/{assetCataloger-FXEHOUA3.js → assetCataloger-5LCGR5XU.js} +2 -2
  6. package/dist/{auth-3YMEVUKJ.js → auth-5JDDEX2M.js} +2 -2
  7. package/dist/{autoUpdate-FYCGHBPC.js → autoUpdate-JXVZVJCV.js} +2 -2
  8. package/dist/{backgroundChecks-ZLYIRMTS.js → backgroundChecks-BBWGY3V6.js} +3 -3
  9. package/dist/backgroundChecksWorker.js +3 -3
  10. package/dist/{batchRender-ZTHFMHZY.js → batchRender-QVJ7NEUH.js} +3 -3
  11. package/dist/{beats-GXY5ZBPB.js → beats-YEYVQMX6.js} +11 -11
  12. package/dist/{benchmark-MJFVBVNW.js → benchmark-J2V46VWI.js} +12 -12
  13. package/dist/{browser-ZDI7IX6H.js → browser-XBWASLD2.js} +11 -11
  14. package/dist/{bundleWithLocalizedFonts-4Q3ETTHW.js → bundleWithLocalizedFonts-4CVITCYK.js} +2 -2
  15. package/dist/{capture-4OPH4PMK.js → capture-F2Y7TIHU.js} +41 -43
  16. package/dist/{capture-OG6532RA.js → capture-GLHK4ST7.js} +3 -3
  17. package/dist/{captureFile-JOPOCRU7.js → captureFile-LYOJOUIE.js} +3 -1
  18. package/dist/{catalog-23DP7KCW.js → catalog-3QDMTDK2.js} +15 -15
  19. package/dist/{check-5X6BJA2P.js → check-O3RR4NWI.js} +52 -40
  20. package/dist/{checkBrowser-3QHBTMYM.js → checkBrowser-K36DAG4S.js} +32 -31
  21. package/dist/{chunk-NIGUNLOO.js → chunk-2DBYGR4N.js} +10 -9
  22. package/dist/{chunk-TIZQC44K.js → chunk-3IUSKIZW.js} +1 -1
  23. package/dist/{chunk-YLOSZHA2.js → chunk-3XPZJUKM.js} +2 -2
  24. package/dist/{chunk-32P7FTFC.js → chunk-4KGMIOMY.js} +9 -8
  25. package/dist/{chunk-N34BYX3E.js → chunk-4PFZPP2N.js} +54 -30
  26. package/dist/{chunk-JTTAS7N6.js → chunk-7543YIMQ.js} +1 -1
  27. package/dist/{chunk-AMSBTN6L.js → chunk-7CGIICLA.js} +3 -3
  28. package/dist/{chunk-LAQEZHOH.js → chunk-BOUDTDBQ.js} +1 -1
  29. package/dist/chunk-C6AIZOQN.js +3541 -0
  30. package/dist/{chunk-EE6SV6KW.js → chunk-DDK22K3I.js} +3 -3
  31. package/dist/{chunk-QXERSWXX.js → chunk-DQBY7FRR.js} +123 -3
  32. package/dist/{chunk-HQGJLZB6.js → chunk-DR7QW6C5.js} +2 -2
  33. package/dist/{chunk-E4AYSXMS.js → chunk-E52XEEAA.js} +3 -3
  34. package/dist/{chunk-J4RPT4QW.js → chunk-E6RPWJVC.js} +1 -1
  35. package/dist/{chunk-QMAXDSCH.js → chunk-EMZF2TPA.js} +2 -2
  36. package/dist/{chunk-XYVFPDNU.js → chunk-ENHAGQEP.js} +1 -1
  37. package/dist/{chunk-B25H4M4V.js → chunk-FCEFKWPM.js} +1 -1
  38. package/dist/{chunk-BQYGGX3B.js → chunk-FW7K32YT.js} +1 -1
  39. package/dist/{chunk-6CI65KCP.js → chunk-FXHVADV6.js} +1 -1
  40. package/dist/{chunk-OF3RKOPU.js → chunk-G2T2X6FZ.js} +189 -111
  41. package/dist/{chunk-5ON5GH3X.js → chunk-GDJ74GHW.js} +4 -3
  42. package/dist/{chunk-I5WWEBDG.js → chunk-HTQR7SUZ.js} +1 -1
  43. package/dist/{chunk-TQKKC4MB.js → chunk-HYXL3VJA.js} +5 -5
  44. package/dist/{chunk-AWUZ3AUD.js → chunk-IP3XINRB.js} +1 -1
  45. package/dist/{chunk-HPEHQUJX.js → chunk-IRJBTYJF.js} +1 -1
  46. package/dist/chunk-K4WKGXRC.js +18 -0
  47. package/dist/{chunk-CQRF7VU3.js → chunk-L5QASNBN.js} +1 -1
  48. package/dist/{chunk-ITBEN3QD.js → chunk-L5SYYW2P.js} +2 -2
  49. package/dist/{chunk-MGFVNTIB.js → chunk-LMC46FK5.js} +2 -2
  50. package/dist/chunk-MRF4AMKD.js +104 -0
  51. package/dist/{chunk-U4TDAJZE.js → chunk-OCNCK5FQ.js} +2 -2
  52. package/dist/{chunk-JWPSBANO.js → chunk-OEA2J2TF.js} +3 -3
  53. package/dist/{chunk-N32ITJ7L.js → chunk-P3FGUSFK.js} +15 -12
  54. package/dist/{chunk-2JXJ5SGK.js → chunk-QPR4N2D4.js} +6 -6
  55. package/dist/{chunk-LFUXJBYA.js → chunk-R4NWAW35.js} +7 -7
  56. package/dist/{chunk-C4TZBEHY.js → chunk-SIN32SJB.js} +2 -2
  57. package/dist/{chunk-M224DAMG.js → chunk-T3NMEYGM.js} +1 -1
  58. package/dist/{chunk-Q2QNAFQV.js → chunk-U4VSY56O.js} +1 -1
  59. package/dist/{chunk-NH75EKOP.js → chunk-VFCKXTBB.js} +6 -3
  60. package/dist/{chunk-V4HKT2LV.js → chunk-VIJ35BJ6.js} +10 -10
  61. package/dist/{chunk-5ER3PYYP.js → chunk-VLC7JS4K.js} +1 -1
  62. package/dist/{chunk-MR2LOG32.js → chunk-VTP4VSRP.js} +8 -8
  63. package/dist/{chunk-ZU54D6MI.js → chunk-XFJXFNJF.js} +3 -3
  64. package/dist/{chunk-YIXEH4TF.js → chunk-XXKBPGPJ.js} +2 -2
  65. package/dist/{chunk-JUP65S7D.js → chunk-XZM2I47O.js} +3 -3
  66. package/dist/{chunk-BAVM2XBR.js → chunk-YJEGT5L6.js} +209 -33
  67. package/dist/{chunk-CFC3EEDQ.js → chunk-ZMMSMDCA.js} +1 -1
  68. package/dist/{chunk-PFEKMIN5.js → chunk-ZYSS3JED.js} +1 -1
  69. package/dist/{chunk-ZXSNGIYS.js → chunk-ZZIXIOK2.js} +4 -4
  70. package/dist/{clean-ATMEGSGP.js → clean-RPB34TT6.js} +16 -16
  71. package/dist/cli.js +122 -54
  72. package/dist/{cloud-ZFGUHACY.js → cloud-QECFFPKC.js} +4 -4
  73. package/dist/{cloudrun-LVZ4OPPC.js → cloudrun-BML6ZG7K.js} +3 -3
  74. package/dist/commands/layout-audit.browser.js +178 -202
  75. package/dist/commands/motion-sample.browser.js +24 -71
  76. package/dist/commands/motion-signature.browser.js +374 -0
  77. package/dist/{compare-55LEUY7M.js → compare-PF6WHQ4T.js} +26 -26
  78. package/dist/{compiler-C32VXLE2.js → compiler-ZHVIEP26.js} +3 -3
  79. package/dist/{component-3EDFANIC.js → component-4ENCNLED.js} +3 -3
  80. package/dist/{compositions-OPU6U6GM.js → compositions-5UA33RSG.js} +11 -11
  81. package/dist/{contactSheet-54AJDSR5.js → contactSheet-27SRU7A4.js} +2 -2
  82. package/dist/{delete-PJE4P3HH.js → delete-SARS5LIK.js} +2 -2
  83. package/dist/{deploy-4T3RMA5G.js → deploy-MX76RZ36.js} +1 -1
  84. package/dist/{destroy-EYDBVHGF.js → destroy-H2TZBYHH.js} +1 -1
  85. package/dist/{dist-FMHQMEMX.js → dist-HRBNHR4M.js} +1 -1
  86. package/dist/{dist-YUIPB7OX.js → dist-OKRUIHYU.js} +2 -2
  87. package/dist/docker/Dockerfile.render +1 -1
  88. package/dist/{doctor-EIVBJJAF.js → doctor-TSAQGYP4.js} +11 -11
  89. package/dist/{events-NP666TF4.js → events-3HUO73ZE.js} +9 -9
  90. package/dist/{events-ISMT4RDW.js → events-SZ5NWYWD.js} +8 -8
  91. package/dist/{feedback-4OSLMKBW.js → feedback-42OTOFC6.js} +10 -10
  92. package/dist/{figma-Y7ZHFCOU.js → figma-RYNFCYXB.js} +3 -3
  93. package/dist/fontLocalizeCli.js +8 -8
  94. package/dist/{get-E4GBRHQK.js → get-IRHLG5OQ.js} +2 -2
  95. package/dist/{gpuPolicy-CA6KRFQQ.js → gpuPolicy-LRMOZXFU.js} +6 -6
  96. package/dist/{grade-compare-B2EHEOLR.js → grade-compare-KGJP5HV7.js} +24 -24
  97. package/dist/{help-ISGUWGOR.js → help-C5HS56RZ.js} +1 -1
  98. package/dist/{history-FNRU3TL4.js → history-DFJNDM2T.js} +16 -17
  99. package/dist/hyperframe-runtime.js +54 -54
  100. package/dist/hyperframe.manifest.json +1 -1
  101. package/dist/hyperframe.runtime.iife.js +54 -54
  102. package/dist/hyperframes-player.global.js +1 -1
  103. package/dist/{info-FO7VR5NC.js → info-26GTDTKN.js} +11 -11
  104. package/dist/{init-IGW4DTVC.js → init-RXA6NI73.js} +25 -24
  105. package/dist/{inspect-D4GUGDW7.js → inspect-2S5GAZYC.js} +25 -25
  106. package/dist/{installer-NBEN3ZIP.js → installer-DGYYDGWJ.js} +4 -4
  107. package/dist/{keyframes-CXZLEC3R.js → keyframes-WBMAX7XZ.js} +12 -12
  108. package/dist/{lambda-BFHJMMCG.js → lambda-OQBFCEFA.js} +6 -6
  109. package/dist/{layout-XEDEOLAH.js → layout-ZRU7PXBG.js} +25 -25
  110. package/dist/{lint-LLGMCVZ5.js → lint-ATVNZ6FG.js} +12 -12
  111. package/dist/{lintProject-X7L7EZWZ.js → lintProject-TOLC6HDS.js} +1 -1
  112. package/dist/{list-LUCWSLK6.js → list-E2GHYPCQ.js} +2 -2
  113. package/dist/{login-SMWYXJWJ.js → login-LOC4KA7H.js} +4 -4
  114. package/dist/{manager-NEVLEZK3.js → manager-CT3D67CG.js} +1 -1
  115. package/dist/{media-treatment-OYTNU6PX.js → media-treatment-L43MVH2V.js} +15 -14
  116. package/dist/{models-RILNQV3Z.js → models-JF5OOZ5A.js} +7 -7
  117. package/dist/{motionShot-5F4DCMWC.js → motionShot-BJ5CLYMN.js} +12 -12
  118. package/dist/{normalize-audio-4LHYKFON.js → normalize-audio-K33FKGAF.js} +11 -11
  119. package/dist/{pipeline-5UY45ELH.js → pipeline-IWPF5ZMK.js} +6 -6
  120. package/dist/{play-D4AHRZQD.js → play-PHHXYCQI.js} +20 -20
  121. package/dist/{preflight-3V5IHGWQ.js → preflight-2GH2Z4GZ.js} +8 -8
  122. package/dist/{present-VUH7PLOO.js → present-KBFK2YVB.js} +16 -16
  123. package/dist/{preview-NCFC65VR.js → preview-T3E5TFDC.js} +159 -87
  124. package/dist/{producer-7JGAPEAF.js → producer-SL66UNEP.js} +1 -1
  125. package/dist/{projectConfig-JHEWPAA5.js → projectConfig-7AKXZNNR.js} +6 -6
  126. package/dist/{publication-7XA2H7UB.js → publication-B2OERUY7.js} +2 -2
  127. package/dist/{publish-257VZMWI.js → publish-ZGKT7KED.js} +8 -8
  128. package/dist/{remove-background-EV6XVADN.js → remove-background-4LRTT6YL.js} +7 -7
  129. package/dist/{render-DHCMWKFV.js → render-H6RSJF2V.js} +12 -12
  130. package/dist/{render-DKXGFQVW.js → render-OKNPNMFS.js} +23 -23
  131. package/dist/{render-4C3YKVZI.js → render-TGCDBKMP.js} +3 -3
  132. package/dist/{render-batch-AFDBPDMM.js → render-batch-WRQFW4UC.js} +3 -3
  133. package/dist/{renderCancellation-VIZELWDD.js → renderCancellation-BFCQYGVV.js} +6 -6
  134. package/dist/renderSetupWorker.js +2 -2
  135. package/dist/{resolver-S72XBTEQ.js → resolver-37UOGAMT.js} +4 -4
  136. package/dist/{screenshotCapture-FA5HPN7Q.js → screenshotCapture-ECBTLCU6.js} +3 -3
  137. package/dist/{sherpa-BAADWCHB.js → sherpa-SDVKYXCX.js} +7 -7
  138. package/dist/skills/hyperframes/references/frame-worker-core.md +2 -2
  139. package/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +2 -2
  140. package/dist/skills/media-use/audio/references/bgm.md +1 -1
  141. package/dist/skills/media-use/audio/references/tts.md +1 -1
  142. package/dist/skills/media-use/audio/scripts/lib/python.mjs +19 -5
  143. package/dist/skills/media-use/audio/scripts/lib/python.test.mjs +69 -1
  144. package/dist/{skills-2BGFBUR6.js → skills-O25ZTFTO.js} +40 -14
  145. package/dist/{skillsUpdateCheck-5LYFYHUF.js → skillsUpdateCheck-Y2V4OMMT.js} +3 -3
  146. package/dist/{snapshot-Z37DZL4T.js → snapshot-KGM2HZIC.js} +52 -31
  147. package/dist/{src-GD7RGV5U.js → src-PJJ6NISA.js} +5 -5
  148. package/dist/{src-GRC63B6L.js → src-PLWCT745.js} +7 -7
  149. package/dist/{staticProjectServer-SFINO3DE.js → staticProjectServer-OCE7GU5S.js} +14 -14
  150. package/dist/{status-LXQL3L3H.js → status-LENRPQS5.js} +6 -6
  151. package/dist/studio/assets/{hyperframes-player-DvJeHBHi.js → hyperframes-player-DzJbtQVO.js} +1 -1
  152. package/dist/studio/assets/{index-SFktf7O1.js → index-DRhF3v4Z.js} +194 -194
  153. package/dist/studio/assets/{index-C7apTvpr.css → index-DbfKVTId.css} +1 -1
  154. package/dist/studio/assets/{index--G6c4Q_x.js → index-DgwDQK5G.js} +1 -1
  155. package/dist/studio/assets/{index-Bt4vDkfw.js → index-n5FUn1xv.js} +1 -1
  156. package/dist/studio/{chunk-PQFEBX32.js → chunk-BIUXP3PG.js} +2 -2
  157. package/dist/studio/{chunk-6LUNLTHR.js → chunk-K47E2ZJA.js} +13 -8
  158. package/dist/studio/chunk-K47E2ZJA.js.map +1 -0
  159. package/dist/studio/{chunk-QUXZVHOJ.js → chunk-VWT7STY3.js} +2 -2
  160. package/dist/studio/{domEditingLayers-JQPQGGT7.js → domEditingLayers-V67MS4WP.js} +3 -3
  161. package/dist/studio/index.d.ts +80 -46
  162. package/dist/studio/index.html +2 -2
  163. package/dist/studio/index.js +7294 -6844
  164. package/dist/studio/index.js.map +1 -1
  165. package/dist/studio/player.js +2 -2
  166. package/dist/studio/styles.css +1 -1
  167. package/dist/{studio-api-WRSCXPWS.js → studio-api-IEQ5BIHT.js} +8 -8
  168. package/dist/{studioSelectionClient-A6JCWRRW.js → studioSelectionClient-IUUPKUHZ.js} +1 -2
  169. package/dist/{studioServer-HTLRGC5G.js → studioServer-LXJ34MGN.js} +43 -43
  170. package/dist/{system-EEWYEHYX.js → system-4KRSV2B7.js} +6 -6
  171. package/dist/{telemetry-NLEEMXO2.js → telemetry-R3BPD6VK.js} +9 -9
  172. package/dist/{timeline-7C4KM3KD.js → timeline-N5UKVS2S.js} +15 -15
  173. package/dist/{tokens-QQLJXW4G.js → tokens-774UBF2R.js} +2 -2
  174. package/dist/{transcribe-GCKJF5A6.js → transcribe-3UXXEDXX.js} +7 -7
  175. package/dist/{transcribe-TGR5CTA7.js → transcribe-IP74EZLM.js} +12 -12
  176. package/dist/{tts-DO2W6NLB.js → tts-P3LIPIL5.js} +13 -6
  177. package/dist/{updateCheck-73JM5QR3.js → updateCheck-EXHNAPKI.js} +2 -2
  178. package/dist/{upgrade-V6E5P53C.js → upgrade-A4M3O2F2.js} +2 -2
  179. package/dist/{urlDownloader-NYXPEBUN.js → urlDownloader-4KNER64L.js} +5 -5
  180. package/dist/{validate-INP7WJAK.js → validate-DV75GM6J.js} +15 -15
  181. package/dist/{video-KWQ5TSVD.js → video-GINAMW5I.js} +17 -9
  182. package/package.json +1 -1
  183. package/dist/chunk-5GQAJ43Q.js +0 -31
  184. package/dist/chunk-VWA4HODG.js +0 -129
  185. package/dist/chunk-YLVI7VL5.js +0 -3541
  186. package/dist/studio/chunk-6LUNLTHR.js.map +0 -1
  187. /package/dist/studio/{chunk-PQFEBX32.js.map → chunk-BIUXP3PG.js.map} +0 -0
  188. /package/dist/studio/{chunk-QUXZVHOJ.js.map → chunk-VWT7STY3.js.map} +0 -0
  189. /package/dist/studio/{domEditingLayers-JQPQGGT7.js.map → domEditingLayers-V67MS4WP.js.map} +0 -0
@@ -23,14 +23,14 @@ import {
23
23
  mkdirSync,
24
24
  readFileSync,
25
25
  readdirSync,
26
+ renameSync,
26
27
  rmSync,
27
28
  statSync,
28
29
  utimesSync,
29
30
  writeFileSync
30
31
  } from "fs";
31
- import { basename } from "path";
32
32
  import { homedir } from "os";
33
- import { join } from "path";
33
+ import { basename, dirname, join, relative } from "path";
34
34
  async function loadPuppeteerBrowsers() {
35
35
  try {
36
36
  return await import("@puppeteer/browsers");
@@ -172,9 +172,6 @@ function releaseBrowserInstallLock(ownerToken) {
172
172
  }
173
173
  rmSync(INSTALL_LOCK_DIR, { recursive: true, force: true });
174
174
  }
175
- function purgeStaleInstall(installPath) {
176
- rmSync(installPath, { recursive: true, force: true });
177
- }
178
175
  var SYSTEM_CHROME_PATHS = process.platform === "darwin" ? ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"] : process.platform === "win32" ? [
179
176
  join(
180
177
  process.env["ProgramW6432"] ?? process.env["PROGRAMFILES"] ?? "C:\\Program Files",
@@ -241,7 +238,7 @@ async function findFromHyperframesCache() {
241
238
  return { result: { executablePath: match.executablePath, source: "cache" } };
242
239
  }
243
240
  if (match) {
244
- return { staleHyperframesCachePath: match.executablePath, staleInstallPath: match.path };
241
+ return { staleHyperframesCachePath: match.executablePath };
245
242
  }
246
243
  return {};
247
244
  }
@@ -351,10 +348,7 @@ async function findBrowser() {
351
348
  `[browser] Cached binary missing at ${fromCache.staleHyperframesCachePath} \u2014 re-downloading...`
352
349
  );
353
350
  try {
354
- return await withInstallLock(async () => {
355
- if (fromCache.staleInstallPath) purgeStaleInstall(fromCache.staleInstallPath);
356
- return downloadBrowser();
357
- });
351
+ return await withInstallLock(() => downloadBrowser());
358
352
  } catch (err) {
359
353
  const cause = normalizeErrorMessage(err);
360
354
  throw new Error(
@@ -422,10 +416,7 @@ async function ensureBrowserInCurrentProcess(options) {
422
416
  console.warn(
423
417
  `[browser] Cached binary missing at ${fromCache.staleHyperframesCachePath} \u2014 re-downloading...`
424
418
  );
425
- return withInstallLock(async () => {
426
- if (fromCache.staleInstallPath) purgeStaleInstall(fromCache.staleInstallPath);
427
- return downloadBrowser(options);
428
- });
419
+ return withInstallLock(() => downloadBrowser(options));
429
420
  }
430
421
  if (!options?.preferManagedChrome) {
431
422
  const fromSystem = findSystemBrowser();
@@ -436,13 +427,9 @@ async function ensureBrowserInCurrentProcess(options) {
436
427
  }
437
428
  }
438
429
  return withInstallLock(async () => {
439
- if (options?.force) {
440
- clearBrowser();
441
- }
442
430
  if (!options?.force) {
443
431
  const afterLock = await (options?.preferManagedChrome ? findFromHyperframesCache() : findFromCache());
444
432
  if (afterLock.result) return afterLock.result;
445
- if (afterLock.staleInstallPath) purgeStaleInstall(afterLock.staleInstallPath);
446
433
  }
447
434
  return downloadBrowser(options);
448
435
  });
@@ -512,34 +499,71 @@ async function downloadBrowser(options) {
512
499
  if (!platform) {
513
500
  throw new Error(`Unsupported platform: ${process.platform} ${process.arch}`);
514
501
  }
502
+ removeInstallLeftovers();
503
+ const stagingDir = join(CACHE_ROOT_DIR, `${STAGING_PREFIX}${randomUUID()}`);
504
+ const clearStaging = () => rmSync(stagingDir, { recursive: true, force: true });
515
505
  const runInstall = () => install({
516
- cacheDir: CACHE_DIR,
506
+ cacheDir: stagingDir,
517
507
  browser: Browser.CHROMEHEADLESSSHELL,
518
508
  buildId: managedChromeVersion(),
519
509
  platform,
520
510
  downloadProgressCallback: options?.onProgress
521
511
  });
522
- let installed;
523
512
  try {
524
- installed = await installWithCorruptArchiveRecovery(
513
+ const staged = await installWithCorruptArchiveRecovery(
525
514
  runInstall,
526
- () => {
527
- rmSync(CACHE_DIR, { recursive: true, force: true });
528
- mkdirSync(CACHE_DIR, { recursive: true });
529
- },
515
+ clearStaging,
530
516
  (err) => console.warn(
531
- `[hyperframes] Cached browser archive was corrupt (${normalizeErrorMessage(err)}); clearing the cache and re-downloading.`
517
+ `[hyperframes] Downloaded browser archive was corrupt (${normalizeErrorMessage(err)}); re-downloading.`
532
518
  )
533
519
  );
520
+ return { executablePath: moveStagedInstallIntoCache(stagingDir, staged), source: "download" };
534
521
  } catch (err) {
535
522
  throw wrapDownloadFailureWithBrowserPathHint(err);
523
+ } finally {
524
+ clearStaging();
536
525
  }
537
- return { executablePath: installed.executablePath, source: "download" };
538
526
  }
539
- function clearBrowser() {
540
- if (!existsSync(CACHE_DIR)) {
541
- return false;
527
+ function moveStagedInstallIntoCache(stagingDir, staged) {
528
+ const target = join(CACHE_DIR, relative(stagingDir, staged.path));
529
+ const aside = join(CACHE_ROOT_DIR, `${REPLACED_PREFIX}${randomUUID()}`);
530
+ mkdirSync(dirname(target), { recursive: true });
531
+ let replaced = false;
532
+ try {
533
+ renameSync(target, aside);
534
+ replaced = true;
535
+ } catch (err) {
536
+ if (!isErrno(err, "ENOENT")) throw err;
542
537
  }
538
+ try {
539
+ renameSync(staged.path, target);
540
+ } catch (err) {
541
+ if (replaced) renameSync(aside, target);
542
+ throw err;
543
+ }
544
+ if (replaced) rmSync(aside, { recursive: true, force: true });
545
+ return join(target, relative(staged.path, staged.executablePath));
546
+ }
547
+ var STAGING_PREFIX = ".chrome-staging-";
548
+ var REPLACED_PREFIX = ".chrome-replaced-";
549
+ function removeInstallLeftovers() {
550
+ let names;
551
+ try {
552
+ names = readdirSync(CACHE_ROOT_DIR);
553
+ } catch (err) {
554
+ if (isErrno(err, "ENOENT")) return false;
555
+ throw err;
556
+ }
557
+ const leftovers = names.filter(
558
+ (name) => name.startsWith(STAGING_PREFIX) || name.startsWith(REPLACED_PREFIX)
559
+ );
560
+ for (const name of leftovers)
561
+ rmSync(join(CACHE_ROOT_DIR, name), { recursive: true, force: true });
562
+ return leftovers.length > 0;
563
+ }
564
+ function clearBrowser() {
565
+ const removedLeftovers = removeInstallLeftovers();
566
+ if (!existsSync(CACHE_DIR)) return removedLeftovers;
543
567
  rmSync(CACHE_DIR, { recursive: true, force: true });
544
568
  return true;
545
569
  }
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  setHostHandlesSigint
9
- } from "./chunk-OF3RKOPU.js";
9
+ } from "./chunk-G2T2X6FZ.js";
10
10
  import {
11
11
  processAncestorSnapshot,
12
12
  processIdentity,
@@ -8,16 +8,16 @@ import {
8
8
  flush,
9
9
  shouldTrack,
10
10
  trackEvent
11
- } from "./chunk-EE6SV6KW.js";
11
+ } from "./chunk-DDK22K3I.js";
12
12
  import {
13
13
  getPowerState
14
- } from "./chunk-CQRF7VU3.js";
14
+ } from "./chunk-L5QASNBN.js";
15
15
  import {
16
16
  CliRuntimeError
17
17
  } from "./chunk-PBN6GBJE.js";
18
18
  import {
19
19
  redactTelemetryString
20
- } from "./chunk-B25H4M4V.js";
20
+ } from "./chunk-FCEFKWPM.js";
21
21
  import {
22
22
  readConfig
23
23
  } from "./chunk-XUXGIA7H.js";
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-HVW7ABXD.js";
13
13
  import {
14
14
  DEFAULT_REGISTRY_URL
15
- } from "./chunk-AWUZ3AUD.js";
15
+ } from "./chunk-IP3XINRB.js";
16
16
 
17
17
  // src/utils/projectConfig.ts
18
18
  import { readFileSync, writeFileSync } from "fs";