hyperframes 0.7.47 → 0.7.48

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/cli.js CHANGED
@@ -50,7 +50,7 @@ var VERSION;
50
50
  var init_version = __esm({
51
51
  "src/version.ts"() {
52
52
  "use strict";
53
- VERSION = true ? "0.7.47" : "0.0.0-dev";
53
+ VERSION = true ? "0.7.48" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -114888,7 +114888,7 @@ __export(manager_exports2, {
114888
114888
  withInstallLock: () => withInstallLock
114889
114889
  });
114890
114890
  import { execSync as execSync5, spawnSync as spawnSync3 } from "child_process";
114891
- import { existsSync as existsSync53, mkdirSync as mkdirSync29, readdirSync as readdirSync20, rmSync as rmSync18, statSync as statSync17 } from "fs";
114891
+ import { existsSync as existsSync53, mkdirSync as mkdirSync29, readdirSync as readdirSync20, rmSync as rmSync18, statSync as statSync17, utimesSync as utimesSync2 } from "fs";
114892
114892
  import { basename as basename7 } from "path";
114893
114893
  import { homedir as homedir11 } from "os";
114894
114894
  import { join as join63 } from "path";
@@ -114931,28 +114931,47 @@ function reclaimStaleInstallLock(timeoutMs) {
114931
114931
  rmSync18(INSTALL_RECLAIM_LOCK_DIR, { recursive: true, force: true });
114932
114932
  }
114933
114933
  }
114934
- async function withInstallLock(fn, timeoutMs = INSTALL_LOCK_TIMEOUT_MS, pollMs = INSTALL_LOCK_POLL_MS) {
114934
+ function touchInstallLock() {
114935
+ try {
114936
+ const now = /* @__PURE__ */ new Date();
114937
+ utimesSync2(INSTALL_LOCK_DIR, now, now);
114938
+ } catch {
114939
+ }
114940
+ }
114941
+ async function withInstallLock(fn, timings = INSTALL_LOCK_TIMINGS) {
114935
114942
  if (!existsSync53(CACHE_ROOT_DIR)) mkdirSync29(CACHE_ROOT_DIR, { recursive: true });
114936
- let deadline = Date.now() + timeoutMs;
114943
+ let deadline = Date.now() + timings.staleMs;
114944
+ const waitStart = Date.now();
114945
+ let lastNoticeMs = 0;
114937
114946
  for (; ; ) {
114938
114947
  if (existsSync53(INSTALL_RECLAIM_LOCK_DIR)) {
114939
- await sleep(pollMs);
114948
+ await sleep(timings.pollMs);
114940
114949
  continue;
114941
114950
  }
114942
114951
  if (tryAcquireDirLock(INSTALL_LOCK_DIR)) {
114943
114952
  rmSync18(INSTALL_RECLAIM_LOCK_DIR, { recursive: true, force: true });
114944
114953
  break;
114945
114954
  }
114955
+ const waitedMs = Date.now() - waitStart;
114956
+ if (waitedMs - lastNoticeMs >= timings.waitNoticeMs) {
114957
+ lastNoticeMs = waitedMs;
114958
+ console.warn(
114959
+ `[browser] Waiting for another hyperframes process to finish installing chrome-headless-shell (${Math.round(waitedMs / 1e3)}s elapsed)...`
114960
+ );
114961
+ }
114946
114962
  if (Date.now() > deadline) {
114947
- reclaimStaleInstallLock(timeoutMs);
114948
- deadline = Date.now() + timeoutMs;
114963
+ reclaimStaleInstallLock(timings.staleMs);
114964
+ deadline = Date.now() + timings.staleMs;
114949
114965
  continue;
114950
114966
  }
114951
- await sleep(pollMs);
114967
+ await sleep(timings.pollMs);
114952
114968
  }
114969
+ const heartbeat = setInterval(touchInstallLock, timings.heartbeatMs);
114970
+ if (typeof heartbeat.unref === "function") heartbeat.unref();
114953
114971
  try {
114954
114972
  return await fn();
114955
114973
  } finally {
114974
+ clearInterval(heartbeat);
114956
114975
  rmSync18(INSTALL_LOCK_DIR, { recursive: true, force: true });
114957
114976
  }
114958
114977
  }
@@ -115257,7 +115276,7 @@ function clearBrowser() {
115257
115276
  function isLinuxArm() {
115258
115277
  return process.platform === "linux" && process.arch === "arm64";
115259
115278
  }
115260
- var CHROME_VERSION, CACHE_ROOT_DIR, CACHE_DIR2, PUPPETEER_CACHE_DIR, INSTALL_LOCK_DIR, INSTALL_RECLAIM_LOCK_DIR, INSTALL_LOCK_TIMEOUT_MS, INSTALL_LOCK_POLL_MS, SYSTEM_CHROME_PATHS, _warnedSystemFallback;
115279
+ var CHROME_VERSION, CACHE_ROOT_DIR, CACHE_DIR2, PUPPETEER_CACHE_DIR, INSTALL_LOCK_DIR, INSTALL_RECLAIM_LOCK_DIR, INSTALL_LOCK_TIMINGS, SYSTEM_CHROME_PATHS, _warnedSystemFallback;
115261
115280
  var init_manager2 = __esm({
115262
115281
  "src/browser/manager.ts"() {
115263
115282
  "use strict";
@@ -115268,8 +115287,12 @@ var init_manager2 = __esm({
115268
115287
  PUPPETEER_CACHE_DIR = join63(homedir11(), ".cache", "puppeteer", "chrome-headless-shell");
115269
115288
  INSTALL_LOCK_DIR = join63(CACHE_ROOT_DIR, ".chrome.install.lock");
115270
115289
  INSTALL_RECLAIM_LOCK_DIR = join63(CACHE_ROOT_DIR, ".chrome.install.reclaim.lock");
115271
- INSTALL_LOCK_TIMEOUT_MS = 12e4;
115272
- INSTALL_LOCK_POLL_MS = 200;
115290
+ INSTALL_LOCK_TIMINGS = {
115291
+ staleMs: 12e4,
115292
+ pollMs: 200,
115293
+ heartbeatMs: 15e3,
115294
+ waitNoticeMs: 1e4
115295
+ };
115273
115296
  SYSTEM_CHROME_PATHS = process.platform === "darwin" ? ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"] : [
115274
115297
  "/usr/bin/google-chrome",
115275
115298
  "/usr/bin/google-chrome-stable",
@@ -127875,6 +127898,10 @@ var init_tts = __esm({
127875
127898
  description: "Text to speak, or path to a .txt file",
127876
127899
  required: false
127877
127900
  },
127901
+ "text-file": {
127902
+ type: "string",
127903
+ description: "Read text from a .txt file (compatibility alias)"
127904
+ },
127878
127905
  output: {
127879
127906
  type: "string",
127880
127907
  description: "Output file path (default: speech.wav in current directory)",
@@ -127911,12 +127938,13 @@ var init_tts = __esm({
127911
127938
  if (args.list) {
127912
127939
  return listVoices(args.json);
127913
127940
  }
127914
- if (!args.input) {
127941
+ const input2 = args["text-file"] ?? args.input;
127942
+ if (!input2) {
127915
127943
  console.error(c.error("Provide text to speak, or use --list to see available voices."));
127916
127944
  process.exit(1);
127917
127945
  }
127918
127946
  let text2;
127919
- const maybeFile = resolve52(args.input);
127947
+ const maybeFile = resolve52(input2);
127920
127948
  if (existsSync80(maybeFile) && extname14(maybeFile).toLowerCase() === ".txt") {
127921
127949
  text2 = readFileSync54(maybeFile, "utf-8").trim();
127922
127950
  if (!text2) {
@@ -127924,7 +127952,7 @@ var init_tts = __esm({
127924
127952
  process.exit(1);
127925
127953
  }
127926
127954
  } else {
127927
- text2 = args.input;
127955
+ text2 = input2;
127928
127956
  }
127929
127957
  if (!text2.trim()) {
127930
127958
  console.error(c.error("No text provided."));
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-VsAbY3rl.js";/*!
1
+ import{n as Qi}from"./index-DX02Q1Yl.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public