effective-progress 0.7.0 → 0.8.0
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/README.md +4 -4
- package/dist/index.mjs +4 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ Support for `either`/`validate` modes of `Effect.all` and render the amount of s
|
|
|
90
90
|
- `examples/simpleExample.ts` - low-boilerplate real-world flow
|
|
91
91
|
- `examples/advancedExample.ts` - full API usage and manual task control
|
|
92
92
|
- `examples/mixedOutcomes.ts` - fail-fast vs `either`/`validate` with mixed success/failure counters
|
|
93
|
-
- `examples/cliProgressSemantics.ts` - zero totals, negative totals, overflow counts, and empty `all` / `forEach`
|
|
93
|
+
- `examples/cliProgressSemantics.ts` - zero totals, negative totals clearing to unknown totals, overflow counts, and empty `all` / `forEach`
|
|
94
94
|
- `examples/unknownTotalCounting.ts` - count successes/failures without a known total and render `processed/?`
|
|
95
95
|
- `examples/showcase.ts` - nested concurrent tasks, spinner workloads, and mixed Effect/Console logging
|
|
96
96
|
- `examples/performance.ts` - stress-style run with high log volume and deeply nested progress updates
|
|
@@ -136,10 +136,10 @@ const program = Progress.task(
|
|
|
136
136
|
);
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
Manual total behavior
|
|
139
|
+
Manual total behavior:
|
|
140
140
|
|
|
141
|
-
- negative totals on task creation
|
|
142
|
-
- negative totals on later `updateTask` calls
|
|
141
|
+
- negative totals on task creation clear the total and switch to indeterminate rendering
|
|
142
|
+
- negative totals on later `updateTask` calls also clear the total
|
|
143
143
|
- explicit `total: undefined` on `updateTask` clears the total and switches back to indeterminate rendering
|
|
144
144
|
|
|
145
145
|
## Column customization
|
package/dist/index.mjs
CHANGED
|
@@ -113,14 +113,13 @@ const toRenderSnapshot = (store) => {
|
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/ink-renderer/store.ts
|
|
115
115
|
const hasExplicitTotal = (options) => Object.prototype.hasOwnProperty.call(options, "total");
|
|
116
|
-
const DEFAULT_TOTAL = 100;
|
|
117
116
|
const sanitizeTotalOnAdd = (total) => {
|
|
118
117
|
if (total === void 0) return;
|
|
119
|
-
return total < 0 ?
|
|
118
|
+
return total < 0 ? void 0 : total;
|
|
120
119
|
};
|
|
121
|
-
const sanitizeTotalOnUpdate = (
|
|
120
|
+
const sanitizeTotalOnUpdate = (nextTotal) => {
|
|
122
121
|
if (nextTotal === void 0) return;
|
|
123
|
-
return nextTotal < 0 ?
|
|
122
|
+
return nextTotal < 0 ? void 0 : nextTotal;
|
|
124
123
|
};
|
|
125
124
|
const normalizeUnits = (counts) => {
|
|
126
125
|
const succeeded = Math.max(0, counts.succeeded);
|
|
@@ -141,7 +140,7 @@ const updatedSnapshot = (snapshot, options) => {
|
|
|
141
140
|
const units = options.succeeded === void 0 && options.failed === void 0 && options.total === void 0 && !hasExplicitTotal(options) ? currentUnits : normalizeUnits({
|
|
142
141
|
succeeded: options.succeeded ?? currentUnits.succeeded,
|
|
143
142
|
failed: options.failed ?? currentUnits.failed,
|
|
144
|
-
total: hasExplicitTotal(options) ? sanitizeTotalOnUpdate(
|
|
143
|
+
total: hasExplicitTotal(options) ? sanitizeTotalOnUpdate(options.total) : currentUnits.total
|
|
145
144
|
});
|
|
146
145
|
return new TaskSnapshot({
|
|
147
146
|
id: snapshot.id,
|
package/package.json
CHANGED