noninteractive 0.3.19 → 0.3.21
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/bin/noninteractive.js +29 -9
- package/package.json +1 -1
package/bin/noninteractive.js
CHANGED
|
@@ -168,13 +168,22 @@ function runDaemon(sessionName, executable, args) {
|
|
|
168
168
|
const detectedUrls = new Set;
|
|
169
169
|
const reportedUrls = new Set;
|
|
170
170
|
const waiters = [];
|
|
171
|
+
let notifyDebounce = null;
|
|
172
|
+
const NOTIFY_SETTLE_MS = 50;
|
|
171
173
|
function notifyWaiters() {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
if (waiters.length === 0)
|
|
175
|
+
return;
|
|
176
|
+
if (notifyDebounce)
|
|
177
|
+
clearTimeout(notifyDebounce);
|
|
178
|
+
notifyDebounce = setTimeout(() => {
|
|
179
|
+
notifyDebounce = null;
|
|
180
|
+
let w = waiters.shift();
|
|
181
|
+
while (w) {
|
|
182
|
+
clearTimeout(w.timer);
|
|
183
|
+
w.resolve(outputBuffer);
|
|
184
|
+
w = waiters.shift();
|
|
185
|
+
}
|
|
186
|
+
}, NOTIFY_SETTLE_MS);
|
|
178
187
|
}
|
|
179
188
|
const binDir = sessionBinDir2(sessionName);
|
|
180
189
|
const ptyBridge = getPtyBridge();
|
|
@@ -227,7 +236,15 @@ function runDaemon(sessionName, executable, args) {
|
|
|
227
236
|
exitCode = code;
|
|
228
237
|
outputBuffer += `
|
|
229
238
|
[exited ${code}]`;
|
|
230
|
-
|
|
239
|
+
if (notifyDebounce)
|
|
240
|
+
clearTimeout(notifyDebounce);
|
|
241
|
+
notifyDebounce = null;
|
|
242
|
+
let w = waiters.shift();
|
|
243
|
+
while (w) {
|
|
244
|
+
clearTimeout(w.timer);
|
|
245
|
+
w.resolve(outputBuffer);
|
|
246
|
+
w = waiters.shift();
|
|
247
|
+
}
|
|
231
248
|
setTimeout(() => {
|
|
232
249
|
server.close();
|
|
233
250
|
try {
|
|
@@ -347,7 +364,7 @@ var init_daemon = __esm(() => {
|
|
|
347
364
|
var require_package = __commonJS((exports, module) => {
|
|
348
365
|
module.exports = {
|
|
349
366
|
name: "noninteractive",
|
|
350
|
-
version: "0.3.
|
|
367
|
+
version: "0.3.21",
|
|
351
368
|
type: "module",
|
|
352
369
|
bin: {
|
|
353
370
|
noninteractive: "./bin/noninteractive.js"
|
|
@@ -471,7 +488,10 @@ more examples:
|
|
|
471
488
|
npx noninteractive vercel # session "vercel"
|
|
472
489
|
npx noninteractive supabase init # session "supabase"
|
|
473
490
|
npx noninteractive start vercel login # explicit start for non-npx commands`;
|
|
474
|
-
var stripAnsi = (s) => s.replace(/\x1b\[[
|
|
491
|
+
var stripAnsi = (s) => s.replace(/\x1b\[[012]?K/g, `
|
|
492
|
+
`).replace(/\x1b\[[\x20-\x3f]*[\x40-\x7e]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[()][A-Z0-9]|\x1b[\x20-\x2f]*[\x30-\x7e]|\x07/g, "").replace(/\r\n?/g, `
|
|
493
|
+
`).replace(/\n{3,}/g, `
|
|
494
|
+
|
|
475
495
|
`);
|
|
476
496
|
var seenUrls = new Set;
|
|
477
497
|
function openUrl(url) {
|