From 9f61522c6d4298b4883e80987ed1c7ea4a0487cf Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Sat, 9 Mar 2024 15:17:00 +0100 Subject: [PATCH] Switch to @lydell/node-pty --- README.md | 3 +- package-lock.json | 97 +++++++++++++++++++++++++++++++++++++------- package.json | 2 +- run-pty.js | 6 +-- test/run-pty.test.js | 2 +- 5 files changed, 90 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 6c4b7d3..48950e0 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ If you want a shell, you could do something like this: `run-pty % bash -c 'npm i ## Credits -- [microsoft/node-pty] does all the heavy lifting of running the commands. +- [microsoft/node-pty] does all the heavy lifting of running the commands. But it’s actually the fork [@lydell/node-pty] that is used. The only difference is that it has prebuilt binaries. - [apiel/run-screen] was the inspiration for this tool. ## iTerm2 flicker @@ -230,6 +230,7 @@ run-pty tries to avoid clearing the screen and only redraw lines that have chang [MIT](LICENSE). +[@lydell/node-pty]: https://github.com/lydell/node-pty [apiel/run-screen]: https://github.com/apiel/run-screen [concurrently]: https://github.com/kimmobrunfeldt/concurrently [gnu parallel]: https://www.gnu.org/software/parallel/ diff --git a/package-lock.json b/package-lock.json index dbf941e..8119102 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,11 @@ "version": "4.1.0", "license": "MIT", "dependencies": { - "node-pty": "^1.0.0", + "@lydell/node-pty": "^1.0.0", "tiny-decoders": "^23.0.0" }, "bin": { - "run-pty": "run-pty.js" + "run-pty": "run-pty-bin.js" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "6.9.1", @@ -493,6 +493,81 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, + "node_modules/@lydell/node-pty": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lydell/node-pty/-/node-pty-1.0.0.tgz", + "integrity": "sha512-6pSnNuyQY/e+gMSRloC1GbsEeNHLqqAajRvCpzWnuSIcFyJbx/a1hSK8cFQI6CeFp+ml4kavyb+82Ej/f4ceXw==", + "dependencies": { + "node-addon-api": "^7.1.0" + }, + "optionalDependencies": { + "@lydell/node-pty-darwin-arm64": "1.0.0", + "@lydell/node-pty-darwin-x64": "1.0.0", + "@lydell/node-pty-linux-x64": "1.0.0", + "@lydell/node-pty-win32-arm64": "1.0.0", + "@lydell/node-pty-win32-x64": "1.0.0" + } + }, + "node_modules/@lydell/node-pty-darwin-arm64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lydell/node-pty-darwin-arm64/-/node-pty-darwin-arm64-1.0.0.tgz", + "integrity": "sha512-uTlUer/qRlARbLoSc8u86m+xsxuQ4oTwCODIvLCBp0jjiOqUhYOlMgYVmSWPYVCH1sjXqqoqpRFOsNrAMgywqw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@lydell/node-pty-darwin-x64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lydell/node-pty-darwin-x64/-/node-pty-darwin-x64-1.0.0.tgz", + "integrity": "sha512-awLJi5vY7DxXN9ct1f4bSY5kQM6kRJtCFSYCxOazabpgBElThKnGDfuAWMx9FLVN79u28LHeOWQGTexyknEIWw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@lydell/node-pty-linux-x64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lydell/node-pty-linux-x64/-/node-pty-linux-x64-1.0.0.tgz", + "integrity": "sha512-66rcvDZAq1TZTz/C0hkVh7snf9X7BGm3pGLWZ6xFDGlyLQf2FQFU/FeiPzoMBHcMSA9bo73IZKRE+QShtIUf+w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@lydell/node-pty-win32-arm64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lydell/node-pty-win32-arm64/-/node-pty-win32-arm64-1.0.0.tgz", + "integrity": "sha512-k2b0KR3jigpE6m0iWJ8XFWBdzCrjuPHXIQkbm74HEsKizDRxTLg6OIXkY4AVRS3etHGRZ9bc2eixt0mFfpvLCw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@lydell/node-pty-win32-x64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lydell/node-pty-win32-x64/-/node-pty-win32-x64-1.0.0.tgz", + "integrity": "sha512-1ihNj36XUVqVZrjY+ILhnrhkB+8hkAjJsC5q6+DQS9j/zRjFjE99/tN5KTOfjgEvLYKhTL6+NXixhmlogGd78g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1836,11 +1911,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" - }, "node_modules/nanoid": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", @@ -1865,13 +1935,12 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/node-pty": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-pty/-/node-pty-1.0.0.tgz", - "integrity": "sha512-wtBMWWS7dFZm/VgqElrTvtfMq4GzJ6+edFI0Y0zyzygUSZMgZdraDUMUhCIvkjhJjme15qWmbyJbtAx4ot4uZA==", - "hasInstallScript": true, - "dependencies": { - "nan": "^2.17.0" + "node_modules/node-addon-api": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz", + "integrity": "sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==", + "engines": { + "node": "^16 || ^18 || >= 20" } }, "node_modules/once": { diff --git a/package.json b/package.json index 96f2960..3911860 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "xterm" ], "dependencies": { - "node-pty": "^1.0.0", + "@lydell/node-pty": "^1.0.0", "tiny-decoders": "^23.0.0" }, "devDependencies": { diff --git a/run-pty.js b/run-pty.js index 1eca74d..5cda4bf 100755 --- a/run-pty.js +++ b/run-pty.js @@ -5,14 +5,14 @@ const fs = require("fs"); const path = require("path"); const os = require("os"); -const pty = require("node-pty"); +const pty = require("@lydell/node-pty"); const Codec = require("tiny-decoders"); /** * @typedef { | { tag: "Waiting" } - | { tag: "Running", terminal: import("node-pty").IPty } - | { tag: "Killing", terminal: import("node-pty").IPty, slow: boolean, lastKillPress: number | undefined, restartAfterKill: boolean } + | { tag: "Running", terminal: import("@lydell/node-pty").IPty } + | { tag: "Killing", terminal: import("@lydell/node-pty").IPty, slow: boolean, lastKillPress: number | undefined, restartAfterKill: boolean } | { tag: "Exit", exitCode: number, wasKilled: boolean } } Status * diff --git a/test/run-pty.test.js b/test/run-pty.test.js index fb6b3c7..3dfd04c 100644 --- a/test/run-pty.test.js +++ b/test/run-pty.test.js @@ -27,7 +27,7 @@ const { /** * @param {{ pid: number }} init - * @returns {import("node-pty").IPty} + * @returns {import("@lydell/node-pty").IPty} */ function fakeTerminal({ pid }) { return {