@theholocron/kyber 5.0.0-alpha.381 → 5.0.0-alpha.382
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/ui.d.mts +8 -4
- package/dist/ui.mjs +6 -5
- package/package.json +8 -8
package/dist/ui.d.mts
CHANGED
|
@@ -150,8 +150,12 @@ export declare function printCheckRows(rows: readonly CheckRow[], print: (line:
|
|
|
150
150
|
export declare function printCheckSummary(summary: CheckSummary, print: (line: string) => void): void;
|
|
151
151
|
/** A spinner for one step at a time, which the step can print through without breaking it. */
|
|
152
152
|
interface Progress {
|
|
153
|
-
/**
|
|
154
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Run `fn` under a spinner named `label`. The spinner is cleared, not kept, so the step's own result line stands alone.
|
|
155
|
+
* `fn` is given `update(text)`, which changes the spinner's text while it runs, such as a counter; it does nothing
|
|
156
|
+
* when no spinner is drawn, and a `fn` that ignores it is unaffected.
|
|
157
|
+
*/
|
|
158
|
+
run<T>(label: string, fn: (update: (text: string) => void) => Promise<T>): Promise<T>;
|
|
155
159
|
/** Print a line without breaking the spinner: it is cleared, the line printed, and the spinner drawn again. */
|
|
156
160
|
print(line: string): void;
|
|
157
161
|
}
|
|
@@ -187,8 +191,8 @@ export declare function progressEnabled(env?: Record<string, string | undefined>
|
|
|
187
191
|
* a request is being sent again.
|
|
188
192
|
*/
|
|
189
193
|
export declare function createProgress(print: (line: string) => void, enabled?: () => boolean, listen?: ProgressListener): Progress;
|
|
190
|
-
/** `fn` under a cleared-when-done spinner named `label`, on a terminal only. */
|
|
191
|
-
export declare function withProgress<T>(label: string, fn: () => Promise<T>, listen?: ProgressListener): Promise<T>;
|
|
194
|
+
/** `fn` under a cleared-when-done spinner named `label`, on a terminal only. `fn` is given `update` to change the text. */
|
|
195
|
+
export declare function withProgress<T>(label: string, fn: (update: (text: string) => void) => Promise<T>, listen?: ProgressListener): Promise<T>;
|
|
192
196
|
/** What {@link createRetryNotice} reads from one retry. Structurally compatible with `@theholocron/http-client`'s `RetryEvent`. */
|
|
193
197
|
interface RetryNoticeEvent {
|
|
194
198
|
/** The service being called, when the client knows it. */
|
package/dist/ui.mjs
CHANGED
|
@@ -406,18 +406,19 @@ function createProgress(print, enabled = () => progressEnabled(), listen) {
|
|
|
406
406
|
let active;
|
|
407
407
|
return {
|
|
408
408
|
async run(label, fn) {
|
|
409
|
-
if (!enabled()) return fn();
|
|
409
|
+
if (!enabled()) return fn(() => {});
|
|
410
410
|
const spinner = ora({
|
|
411
411
|
text: label,
|
|
412
412
|
stream: process.stderr,
|
|
413
413
|
discardStdin: false
|
|
414
414
|
}).start();
|
|
415
415
|
active = spinner;
|
|
416
|
-
const
|
|
416
|
+
const update = (text) => {
|
|
417
417
|
spinner.text = text;
|
|
418
|
-
}
|
|
418
|
+
};
|
|
419
|
+
const stopListening = (listen ?? defaultListener)?.(label, update);
|
|
419
420
|
try {
|
|
420
|
-
return await fn();
|
|
421
|
+
return await fn(update);
|
|
421
422
|
} finally {
|
|
422
423
|
stopListening?.();
|
|
423
424
|
spinner.stop();
|
|
@@ -433,7 +434,7 @@ function createProgress(print, enabled = () => progressEnabled(), listen) {
|
|
|
433
434
|
}
|
|
434
435
|
};
|
|
435
436
|
}
|
|
436
|
-
/** `fn` under a cleared-when-done spinner named `label`, on a terminal only. */
|
|
437
|
+
/** `fn` under a cleared-when-done spinner named `label`, on a terminal only. `fn` is given `update` to change the text. */
|
|
437
438
|
function withProgress(label, fn, listen) {
|
|
438
439
|
return createProgress(() => {}, progressEnabled, listen).run(label, fn);
|
|
439
440
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/kyber",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.382",
|
|
4
4
|
"description": "The reusable parts of a command-line tool: terminal output, prompts, the interactive menu, the update notifier, safe handling of tokens, a test harness and the global flags.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"typescript": "^5.9.3",
|
|
106
106
|
"vitest": "^5.1.0",
|
|
107
107
|
"yargs": "^18.1.0",
|
|
108
|
-
"@theholocron/
|
|
109
|
-
"@theholocron/
|
|
110
|
-
"@theholocron/
|
|
111
|
-
"@theholocron/
|
|
112
|
-
"@theholocron/
|
|
113
|
-
"@theholocron/
|
|
108
|
+
"@theholocron/datapad": "5.0.0-alpha.382",
|
|
109
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.13",
|
|
110
|
+
"@theholocron/observability": "0.7.0-alpha.2",
|
|
111
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.13",
|
|
112
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.13",
|
|
113
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.13"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"@inquirer/prompts": "^8.0.0",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"ora": "^9.0.0",
|
|
123
123
|
"yargs": "^18.0.0",
|
|
124
124
|
"@theholocron/observability": "^0.7.0-alpha.2",
|
|
125
|
-
"@theholocron/datapad": "^5.0.0-alpha.
|
|
125
|
+
"@theholocron/datapad": "^5.0.0-alpha.382"
|
|
126
126
|
},
|
|
127
127
|
"peerDependenciesMeta": {
|
|
128
128
|
"@inquirer/prompts": {
|