@naturalcycles/nodejs-lib 12.48.2 → 12.49.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/dist/colors/colors.d.ts
CHANGED
package/dist/colors/colors.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasColors = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.hasColors = hasColors;
|
|
4
|
+
const tty = require("tty");
|
|
5
|
+
/**
|
|
6
|
+
* Based on: https://github.com/sindresorhus/yoctocolors/pull/5
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
exports.hasColors = !process.env['NO_COLOR'] && tty.WriteStream.prototype.hasColors();
|
|
@@ -8,7 +8,7 @@ const time_lib_1 = require("@naturalcycles/time-lib");
|
|
|
8
8
|
const colors_1 = require("../../colors");
|
|
9
9
|
const colors_2 = require("../../colors/colors");
|
|
10
10
|
const inspectOpt = {
|
|
11
|
-
colors:
|
|
11
|
+
colors: colors_2.hasColors,
|
|
12
12
|
breakLength: 300,
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
@@ -46,14 +46,14 @@ function transformLogProgress(opt = {}) {
|
|
|
46
46
|
return;
|
|
47
47
|
const mem = process.memoryUsage();
|
|
48
48
|
const now = Date.now();
|
|
49
|
-
const
|
|
50
|
-
const
|
|
49
|
+
const batchedProgress = progress * batchSize;
|
|
50
|
+
const lastRPS = (processedLastSecond * batchedProgress) / ((now - lastSecondStarted) / 1000) || 0;
|
|
51
|
+
const rpsTotal = Math.round(batchedProgress / ((now - started) / 1000)) || 0;
|
|
51
52
|
lastSecondStarted = now;
|
|
52
53
|
processedLastSecond = 0;
|
|
53
54
|
const rps10 = Math.round(sma.push(lastRPS));
|
|
54
55
|
if (mem.rss > peakRSS)
|
|
55
56
|
peakRSS = mem.rss;
|
|
56
|
-
const batchedProgress = progress * batchSize;
|
|
57
57
|
console.log((0, util_1.inspect)({
|
|
58
58
|
[final ? `${metric}_final` : metric]: batchedProgress,
|
|
59
59
|
...(extra ? extra(chunk, progress) : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/nodejs-lib",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.49.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"docs-serve": "vuepress dev docs",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"move-file": "^2.0.0",
|
|
38
38
|
"nanoid": "^3.0.0",
|
|
39
39
|
"sanitize-html": "^2.5.2",
|
|
40
|
-
"supports-color": "^8.0.0",
|
|
41
40
|
"through2-concurrent": "^2.0.0",
|
|
42
41
|
"yargs": "^17.0.0"
|
|
43
42
|
},
|
package/src/colors/colors.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import * as tty from 'tty'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Based on: https://github.com/sindresorhus/yoctocolors/pull/5
|
|
5
|
+
*
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
export const hasColors = !process.env['NO_COLOR'] && tty.WriteStream.prototype.hasColors()
|
|
@@ -104,7 +104,7 @@ export interface TransformLogProgressOptions<IN = any> extends TransformOptions
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const inspectOpt: InspectOptions = {
|
|
107
|
-
colors: hasColors
|
|
107
|
+
colors: hasColors,
|
|
108
108
|
breakLength: 300,
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -163,16 +163,16 @@ export function transformLogProgress<IN = any>(
|
|
|
163
163
|
const mem = process.memoryUsage()
|
|
164
164
|
|
|
165
165
|
const now = Date.now()
|
|
166
|
-
const
|
|
167
|
-
const
|
|
166
|
+
const batchedProgress = progress * batchSize
|
|
167
|
+
const lastRPS =
|
|
168
|
+
(processedLastSecond * batchedProgress) / ((now - lastSecondStarted) / 1000) || 0
|
|
169
|
+
const rpsTotal = Math.round(batchedProgress / ((now - started) / 1000)) || 0
|
|
168
170
|
lastSecondStarted = now
|
|
169
171
|
processedLastSecond = 0
|
|
170
172
|
|
|
171
173
|
const rps10 = Math.round(sma.push(lastRPS))
|
|
172
174
|
if (mem.rss > peakRSS) peakRSS = mem.rss
|
|
173
175
|
|
|
174
|
-
const batchedProgress = progress * batchSize
|
|
175
|
-
|
|
176
176
|
console.log(
|
|
177
177
|
inspect(
|
|
178
178
|
{
|