koguma 2.2.1 → 2.2.2
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/cli/wrangler.ts +39 -2
- package/package.json +1 -1
- package/src/admin/_bundle.ts +1 -1
package/cli/wrangler.ts
CHANGED
|
@@ -320,12 +320,36 @@ export function wranglerDev(
|
|
|
320
320
|
/^✘\s+/, // npm dep install error lines (let warn() handle these)
|
|
321
321
|
/^▲\s+/, // npm dep install warning lines
|
|
322
322
|
/^>\s+/, // npm progress lines
|
|
323
|
-
/^\s
|
|
323
|
+
/^\s*$/, // blank lines
|
|
324
|
+
/Reloading local server/, // wrangler dev reload spam
|
|
325
|
+
/Local server updated/, // wrangler dev reload (handled as status line)
|
|
326
|
+
/Unable to find and open the program executable/ // benign diagnostic
|
|
324
327
|
];
|
|
325
328
|
|
|
326
329
|
const shouldSuppress = (line: string): boolean =>
|
|
327
330
|
suppressPatterns.some(p => p.test(line));
|
|
328
331
|
|
|
332
|
+
// ── In-place status line for transient events ──
|
|
333
|
+
let reloadCount = 0;
|
|
334
|
+
let hasStatusLine = false;
|
|
335
|
+
const isTTY = process.stdout.isTTY;
|
|
336
|
+
|
|
337
|
+
/** Write a transient status that overwrites itself on the next call */
|
|
338
|
+
const writeStatus = (text: string) => {
|
|
339
|
+
if (isTTY) {
|
|
340
|
+
process.stdout.write(`\r\x1b[K ⟳ ${text}`);
|
|
341
|
+
hasStatusLine = true;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/** Clear the status line before printing a permanent line */
|
|
346
|
+
const clearStatus = () => {
|
|
347
|
+
if (hasStatusLine && isTTY) {
|
|
348
|
+
process.stdout.write('\r\x1b[K');
|
|
349
|
+
hasStatusLine = false;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
329
353
|
const handleOutput = (data: Buffer, isErr: boolean) => {
|
|
330
354
|
const text = data.toString();
|
|
331
355
|
for (const line of text.split('\n')) {
|
|
@@ -336,16 +360,29 @@ export function wranglerDev(
|
|
|
336
360
|
if (trimmed.includes('Ready on http')) {
|
|
337
361
|
const urlMatch = trimmed.match(/(https?:\/\/[^\s]+)/);
|
|
338
362
|
const url = urlMatch?.[1] ?? 'http://localhost:8787';
|
|
363
|
+
clearStatus();
|
|
339
364
|
ok(`Server ready → ${url}`);
|
|
340
365
|
continue;
|
|
341
366
|
}
|
|
342
367
|
|
|
368
|
+
// Reload events → transient status line (overwrites in place)
|
|
369
|
+
if (/Reloading local server/.test(trimmed)) {
|
|
370
|
+
reloadCount++;
|
|
371
|
+
writeStatus(`reload #${reloadCount}`);
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
if (/Local server updated/.test(trimmed)) {
|
|
375
|
+
writeStatus(`reload #${reloadCount} ✓`);
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
|
|
343
379
|
if (shouldSuppress(line)) continue;
|
|
344
380
|
|
|
345
381
|
if (trimmed.includes('Starting local server')) continue;
|
|
346
382
|
if (trimmed.includes('Shutting down')) continue;
|
|
347
383
|
|
|
348
|
-
//
|
|
384
|
+
// Permanent line — clear status first
|
|
385
|
+
clearStatus();
|
|
349
386
|
if (isErr) {
|
|
350
387
|
warn(trimmed);
|
|
351
388
|
} else {
|