@putout/formatter-memory 3.1.3 → 4.0.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.
Files changed (2) hide show
  1. package/lib/memory.js +9 -7
  2. package/package.json +10 -11
package/lib/memory.js CHANGED
@@ -1,6 +1,5 @@
1
- import {Writable} from 'stream';
2
- import {hrtime} from 'process';
3
-
1
+ import {Writable} from 'node:stream';
2
+ import process, {hrtime} from 'node:process';
4
3
  import dump from '@putout/formatter-dump';
5
4
  import cliProgress from 'cli-progress';
6
5
  import chalk from 'chalk';
@@ -12,15 +11,18 @@ const start = once(() => hrtime.bigint());
12
11
  const end = once(() => hrtime.bigint());
13
12
 
14
13
  const OK = '👌';
14
+
15
15
  const {
16
16
  green,
17
17
  yellow,
18
18
  red,
19
19
  blueBright,
20
20
  } = chalk;
21
+
21
22
  const formatErrorsCount = (a) => a ? red(a) : OK;
22
23
 
23
24
  const {stderr} = process;
25
+
24
26
  const {
25
27
  PUTOUT_PROGRESS_BAR = '1',
26
28
  TEST = 0,
@@ -29,10 +31,7 @@ const {
29
31
  export default ({name, options, places, index, count, filesCount, errorsCount}) => {
30
32
  start();
31
33
 
32
- const {
33
- color = '#ea4336',
34
- minCount = 0,
35
- } = options;
34
+ const {color = '#ea4336', minCount = 0} = options;
36
35
 
37
36
  const memory = process.memoryUsage();
38
37
 
@@ -41,6 +40,7 @@ export default ({name, options, places, index, count, filesCount, errorsCount})
41
40
  const heapTotal = format.size(memory.heapTotal);
42
41
 
43
42
  const naturalIndex = index + 1;
43
+
44
44
  const result = dump({
45
45
  name,
46
46
  places,
@@ -87,6 +87,7 @@ export const _getStream = () => PUTOUT_PROGRESS_BAR !== '1' ? new Writable() : s
87
87
 
88
88
  const createProgress = once(({count, color, rss}) => {
89
89
  const colorFn = getColorFn(color);
90
+
90
91
  const bar = new cliProgress.SingleBar({
91
92
  format: `${colorFn('{bar}')} {percentage}% | {errorsCount} | {value}/{total} | {rss}`,
92
93
  barCompleteChar: '\u2588',
@@ -131,6 +132,7 @@ function getInfo(memory) {
131
132
  rss: ${red(rss)}
132
133
  time: ${blueBright(calcTime())}
133
134
 
135
+
134
136
  `;
135
137
  }
136
138
 
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@putout/formatter-memory",
3
- "version": "3.1.3",
3
+ "version": "4.0.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "🐊Putout formatter shows memory usage",
6
6
  "homepage": "https://github.com/coderaiser/putout/tree/master/packages/formatter-memory#readme",
7
7
  "main": "lib/memory.js",
8
- "commitType": "colon",
9
8
  "release": false,
10
9
  "tag": false,
11
10
  "changelog": false,
@@ -28,7 +27,7 @@
28
27
  },
29
28
  "dependencies": {
30
29
  "@putout/formatter-dump": "^4.0.0",
31
- "chalk": "^4.0.0",
30
+ "chalk": "^5.3.0",
32
31
  "cli-progress": "^3.8.2",
33
32
  "format-io": "^2.0.0",
34
33
  "montag": "^1.1.0",
@@ -42,20 +41,20 @@
42
41
  ],
43
42
  "devDependencies": {
44
43
  "@putout/plugin-remove-unused-variables": "*",
45
- "@putout/test": "^5.0.0",
46
- "c8": "^7.5.0",
47
- "eslint": "^8.0.1",
48
- "eslint-plugin-n": "^15.2.4",
49
- "eslint-plugin-putout": "^16.0.0",
50
- "madrun": "^9.0.0",
44
+ "@putout/test": "^9.0.0",
45
+ "c8": "^9.0.0",
46
+ "eslint": "^9.0.0-alpha.0",
47
+ "eslint-plugin-n": "^17.0.0-0",
48
+ "eslint-plugin-putout": "^22.0.0",
49
+ "madrun": "^10.0.0",
51
50
  "mock-require": "^3.0.3"
52
51
  },
53
52
  "peerDependencies": {
54
- "putout": ">=25"
53
+ "putout": ">=35"
55
54
  },
56
55
  "license": "MIT",
57
56
  "engines": {
58
- "node": ">=16"
57
+ "node": ">=18"
59
58
  },
60
59
  "publishConfig": {
61
60
  "access": "public"