@kaynooo/cli-docker 0.8.0 → 0.8.1

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/dx-cli.js CHANGED
@@ -1878,14 +1878,24 @@ function up(lines) {
1878
1878
  return lines > 0 ? `\x1B[${lines}A` : "";
1879
1879
  }
1880
1880
  function openTerminal() {
1881
- let input;
1881
+ let mode;
1882
1882
  try {
1883
- input = new tty.ReadStream(openSync("/dev/tty", "r"));
1883
+ mode = new tty.ReadStream(openSync("/dev/tty", "r"));
1884
1884
  } catch {
1885
1885
  return fail("no terminal to read keys from (/dev/tty)");
1886
1886
  }
1887
+ const keys = Bun.file("/dev/tty").stream().getReader();
1887
1888
  const out = process14.stderr;
1888
1889
  let resize;
1890
+ async function read(onChunk) {
1891
+ const decoder = new TextDecoder;
1892
+ try {
1893
+ for (let chunk = await keys.read();!chunk.done; chunk = await keys.read())
1894
+ onChunk(decoder.decode(chunk.value, { stream: true }));
1895
+ } catch {
1896
+ onChunk("\x03");
1897
+ }
1898
+ }
1889
1899
  return {
1890
1900
  get columns() {
1891
1901
  return out.columns || 80;
@@ -1897,17 +1907,18 @@ function openTerminal() {
1897
1907
  write: (text) => void out.write(text),
1898
1908
  listen(onChunk, onResize) {
1899
1909
  resize = onResize;
1900
- input.setRawMode(true);
1910
+ mode.setRawMode(true);
1901
1911
  out.on("resize", onResize);
1902
- input.on("data", (chunk) => onChunk(chunk.toString()));
1912
+ read(onChunk);
1903
1913
  },
1904
1914
  close() {
1905
1915
  if (resize !== undefined)
1906
1916
  out.off("resize", resize);
1907
1917
  try {
1908
- input.setRawMode(false);
1918
+ mode.setRawMode(false);
1909
1919
  } finally {
1910
- input.destroy();
1920
+ mode.destroy();
1921
+ keys.cancel();
1911
1922
  }
1912
1923
  }
1913
1924
  };
package/dist/sf-cli.js CHANGED
@@ -1531,14 +1531,24 @@ function up(lines) {
1531
1531
  return lines > 0 ? `\x1B[${lines}A` : "";
1532
1532
  }
1533
1533
  function openTerminal() {
1534
- let input;
1534
+ let mode;
1535
1535
  try {
1536
- input = new tty.ReadStream(openSync("/dev/tty", "r"));
1536
+ mode = new tty.ReadStream(openSync("/dev/tty", "r"));
1537
1537
  } catch {
1538
1538
  return fail("no terminal to read keys from (/dev/tty)");
1539
1539
  }
1540
+ const keys = Bun.file("/dev/tty").stream().getReader();
1540
1541
  const out = process14.stderr;
1541
1542
  let resize;
1543
+ async function read(onChunk) {
1544
+ const decoder = new TextDecoder;
1545
+ try {
1546
+ for (let chunk = await keys.read();!chunk.done; chunk = await keys.read())
1547
+ onChunk(decoder.decode(chunk.value, { stream: true }));
1548
+ } catch {
1549
+ onChunk("\x03");
1550
+ }
1551
+ }
1542
1552
  return {
1543
1553
  get columns() {
1544
1554
  return out.columns || 80;
@@ -1550,17 +1560,18 @@ function openTerminal() {
1550
1560
  write: (text) => void out.write(text),
1551
1561
  listen(onChunk, onResize) {
1552
1562
  resize = onResize;
1553
- input.setRawMode(true);
1563
+ mode.setRawMode(true);
1554
1564
  out.on("resize", onResize);
1555
- input.on("data", (chunk) => onChunk(chunk.toString()));
1565
+ read(onChunk);
1556
1566
  },
1557
1567
  close() {
1558
1568
  if (resize !== undefined)
1559
1569
  out.off("resize", resize);
1560
1570
  try {
1561
- input.setRawMode(false);
1571
+ mode.setRawMode(false);
1562
1572
  } finally {
1563
- input.destroy();
1573
+ mode.destroy();
1574
+ keys.cancel();
1564
1575
  }
1565
1576
  }
1566
1577
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-docker",
3
3
  "type": "module",
4
- "version": "0.8.0",
4
+ "version": "0.8.1",
5
5
  "description": "dc, dx, dlog and sf: docker compose on the stack found here, including one only its containers tell of, a compose service's shell, logs, restart, stop or rebuild, every service's health and recent errors in one call, and a Symfony console command picked and run.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
@@ -38,6 +38,6 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@kaynooo/cli-env": "0.12.0",
41
- "@kaynooo/cli-kit": "0.26.0"
41
+ "@kaynooo/cli-kit": "0.27.1"
42
42
  }
43
43
  }