redlint 3.6.2 → 3.7.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/ChangeLog CHANGED
@@ -1,3 +1,16 @@
1
+ 2023.12.27, v3.7.0
2
+
3
+ fix:
4
+ - c4e4770 slave
5
+
6
+ feature:
7
+ - a4eb21d redlint: improve progress support
8
+
9
+ 2023.12.27, v3.6.3
10
+
11
+ fix:
12
+ - 4d12f30 menu: pack
13
+
1
14
  2023.12.27, v3.6.2
2
15
 
3
16
  fix:
package/lib/lint/slave.js CHANGED
@@ -3,32 +3,20 @@ import {
3
3
  workerData,
4
4
  } from 'node:worker_threads';
5
5
  import {lint} from './lint.js';
6
+ import {createSlave} from '../slave.js';
6
7
  import {createProgress} from '@putout/engine-runner/progress';
7
8
 
8
9
  const {fix, filesystem} = workerData;
9
10
  const progress = createProgress();
10
11
 
11
- progress.on('start', ({rule}) => {
12
- parentPort.postMessage(['rule:start', rule]);
13
- });
14
-
15
- progress.on('push', ({rule}) => {
16
- parentPort.postMessage(['rule:push', rule]);
17
- });
18
-
19
- progress.on('end', ({rule}) => {
20
- parentPort.postMessage(['rule:end', rule]);
21
- });
22
-
23
- progress.on('file', ({rule, i, n}) => {
24
- parentPort.postMessage(['file', {
25
- rule,
26
- i,
27
- n,
28
- }]);
12
+ await createSlave(runLint, {
13
+ progress,
14
+ parentPort,
29
15
  });
30
16
 
31
- parentPort.postMessage(['end', await lint(filesystem, {
32
- fix,
33
- progress,
34
- })]);
17
+ function runLint() {
18
+ return lint(filesystem, {
19
+ fix,
20
+ progress,
21
+ });
22
+ }
package/lib/menu.js CHANGED
@@ -18,7 +18,7 @@ export const isScan = (a) => a === SCAN || a === 'scan';
18
18
  export const isScanDebug = (a) => a === SCAN_DEBUG || a === 'scan:debug';
19
19
  export const isFix = (a) => a === FIX || a === 'fix';
20
20
  export const isFixDebug = (a) => a === FIX_DEBUG || a === 'fix:debug';
21
- export const isPack = (a) => a === PACK || a === 'debug';
21
+ export const isPack = (a) => a === PACK || a === 'pack';
22
22
  export const isPackDebug = (a) => a === PACK_DEBUG || a === 'pack:debug';
23
23
  export const isExtract = (a) => a === EXTRACT || a === 'extract';
24
24
  export const isExtractDebug = (a) => a === EXTRACT_DEBUG || a === 'extract:debug';
package/lib/pack/slave.js CHANGED
@@ -4,30 +4,18 @@ import {
4
4
  } from 'node:worker_threads';
5
5
  import {createProgress} from '@putout/engine-runner/progress';
6
6
  import {pack} from './pack.js';
7
+ import {createSlave} from '../slave.js';
7
8
 
8
9
  const {filesystem, cwd} = workerData;
9
10
  const progress = createProgress();
10
11
 
11
- progress.on('start', ({rule}) => {
12
- parentPort.postMessage(['rule:start', rule]);
13
- });
14
-
15
- progress.on('push', ({rule}) => {
16
- parentPort.postMessage(['rule:push', rule]);
17
- });
18
-
19
- progress.on('end', ({rule}) => {
20
- parentPort.postMessage(['rule:end', rule]);
21
- });
22
-
23
- progress.on('file', ({rule, i, n}) => {
24
- parentPort.postMessage(['file', {
25
- i,
26
- n,
27
- rule,
28
- }]);
12
+ await createSlave(runPack, {
13
+ progress,
14
+ parentPort,
29
15
  });
30
16
 
31
- parentPort.postMessage(['end', pack(cwd, filesystem, {
32
- progress,
33
- })]);
17
+ async function runPack() {
18
+ return await pack(cwd, filesystem, {
19
+ progress,
20
+ });
21
+ }
package/lib/slave.js ADDED
@@ -0,0 +1,24 @@
1
+ export const createSlave = async (fn, {parentPort, progress}) => {
2
+ progress.on('start', ({rule}) => {
3
+ parentPort.postMessage(['rule:start', rule]);
4
+ });
5
+
6
+ progress.on('push', ({rule}) => {
7
+ parentPort.postMessage(['rule:push', rule]);
8
+ });
9
+
10
+ progress.on('end', ({rule}) => {
11
+ parentPort.postMessage(['rule:end', rule]);
12
+ });
13
+
14
+ progress.on('file', ({rule, i, n, percent}) => {
15
+ parentPort.postMessage(['file', {
16
+ rule,
17
+ i,
18
+ n,
19
+ percent,
20
+ }]);
21
+ });
22
+
23
+ parentPort.postMessage(['end', await fn()]);
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redlint",
3
- "version": "3.6.2",
3
+ "version": "3.7.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Lint Filesystem with 🐊Putout",