putout 41.1.2 → 41.1.3

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,14 @@
1
+ 2025.12.30, v41.1.3
2
+
3
+ fix:
4
+ - fb4ff3ca0 @putout/engine-reporter: get rid of cjs
5
+
6
+ feature:
7
+ - 1d1490153 putout: @putout/engine-reporter v8.0.2
8
+ - a849259bd @putout/test: initReport from @putout/engine-reporter
9
+ - d529678b3 @putout/engine-reporter: formatter: migrate to ESM
10
+ - 74b5650d0 @putout/plugin-esm: apply-namespace-import-to-file: improve errors handling
11
+
1
12
  2025.12.29, v41.1.2
2
13
 
3
14
  feature:
@@ -1,4 +1,4 @@
1
- import chalk from '../lib/cli/chalk.mjs';
1
+ import {bgBlueBright} from '../lib/cli/chalk.mjs';
2
2
 
3
3
  export const onDebuggerExit = ({log, process, inspector}) => {
4
4
  const {pid} = process;
@@ -11,7 +11,7 @@ export const onDebuggerExit = ({log, process, inspector}) => {
11
11
  return;
12
12
 
13
13
  inspector.close();
14
- log(chalk.bgBlueBright(`node --inspect: 'kill ${pid}'`));
14
+ log(bgBlueBright(`node --inspect: 'kill ${pid}'`));
15
15
  process.kill(pid);
16
16
  });
17
17
  };
package/lib/cli/chalk.mjs CHANGED
@@ -1,12 +1,4 @@
1
1
  import {styleText} from 'node:util';
2
2
 
3
- const red = (a) => styleText('red', a);
4
-
5
- const bgBlueBright = (a) => styleText('bgBlueBright', a);
6
-
7
- const chalk = {
8
- red,
9
- bgBlueBright,
10
- };
11
-
12
- export default chalk;
3
+ export const red = (a) => styleText('red', a);
4
+ export const bgBlueBright = (a) => styleText('bgBlueBright', a);
package/lib/cli/exit.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import chalk from './chalk.mjs';
2
-
3
- const {red} = chalk;
1
+ import {red} from './chalk.mjs';
4
2
 
5
3
  export const createExit = ({halt, raw, logError}) => (code, e) => {
6
4
  if (!code)
@@ -8,17 +8,22 @@ const _parseOptions = require('../parse-options');
8
8
 
9
9
  const {assign} = Object;
10
10
  const {env} = process;
11
- const {PUTOUT_CONFIG_FILE} = env;
12
11
 
13
- const maybeConfig = {
14
- plugins: [],
12
+ const getMaybeConfig = () => {
13
+ const config = {
14
+ plugins: [],
15
+ };
16
+
17
+ const {PUTOUT_CONFIG_FILE} = env;
18
+
19
+ PUTOUT_CONFIG_FILE && assign(config, require(join(
20
+ process.cwd(),
21
+ PUTOUT_CONFIG_FILE,
22
+ )));
23
+
24
+ return config;
15
25
  };
16
26
 
17
- PUTOUT_CONFIG_FILE && assign(maybeConfig, require(join(
18
- process.cwd(),
19
- PUTOUT_CONFIG_FILE,
20
- )));
21
-
22
27
  module.exports = (overrides = {}) => {
23
28
  const {
24
29
  noConfig,
@@ -30,6 +35,7 @@ module.exports = (overrides = {}) => {
30
35
  } = overrides;
31
36
 
32
37
  const transformPlugins = buildPlugins(transform);
38
+ const maybeConfig = getMaybeConfig();
33
39
 
34
40
  if (noConfig)
35
41
  return {
package/lib/cli/index.js CHANGED
@@ -11,12 +11,13 @@ const fullstore = require('fullstore');
11
11
  const _cliStaged = require('@putout/cli-staged');
12
12
 
13
13
  const {
14
- getFilePatterns,
15
- getProcessorRunners,
14
+ runProcessors: _runProcessors,
15
+ getFilePatterns: _getFilePatterns,
16
+ getProcessorRunners: _getProcessorRunners,
16
17
  defaultProcessors,
17
18
  } = require('@putout/engine-processor');
18
19
 
19
- const _initReport = require('@putout/engine-reporter/report');
20
+ const {initReport: _initReport} = require('@putout/engine-reporter/report');
20
21
  const {keypress: _keypress} = require('@putout/cli-keypress');
21
22
 
22
23
  const supportedFiles = require('./supported-files');
@@ -88,6 +89,7 @@ module.exports = async (overrides = {}) => {
88
89
  getFormatter = _getFormatter,
89
90
  isCI = _isCI,
90
91
  simpleImport = _simpleImport,
92
+ processor = {},
91
93
  } = overrides;
92
94
 
93
95
  const isStop = parseIsStop(overrides.isStop || noop, {
@@ -211,6 +213,12 @@ module.exports = async (overrides = {}) => {
211
213
  processors = defaultProcessors,
212
214
  } = config;
213
215
 
216
+ const {
217
+ runProcessors = _runProcessors,
218
+ getFilePatterns = _getFilePatterns,
219
+ getProcessorRunners = _getProcessorRunners,
220
+ } = processor;
221
+
214
222
  const [currentFormat, formatterOptions] = await getFormatter(newFormatter || format || formatter, exit);
215
223
  const [error, processorRunners] = await tryToCatch(getProcessorRunners, processors, simpleImport);
216
224
 
@@ -311,6 +319,7 @@ module.exports = async (overrides = {}) => {
311
319
  transform,
312
320
  initProcessFile,
313
321
  getOptions,
322
+ runProcessors,
314
323
  });
315
324
 
316
325
  if (exited)
@@ -1,13 +1,26 @@
1
1
  'use strict';
2
2
 
3
3
  const tryToCatch = require('try-to-catch');
4
- const {runProcessors} = require('@putout/engine-processor');
4
+ const {runProcessors: _runProcessors} = require('@putout/engine-processor');
5
5
 
6
6
  const parseError = require('../../parse-error.js');
7
7
  const {simpleImport} = require('../simple-import');
8
8
  const ignores = require('../../ignores.js');
9
9
 
10
- module.exports.runReader = async ({raw, log, dir, resolvedName, options, readFile, fix, processFile, processorRunners}) => {
10
+ module.exports.runReader = async (overrides) => {
11
+ const {
12
+ raw,
13
+ log,
14
+ dir,
15
+ resolvedName,
16
+ options,
17
+ readFile,
18
+ fix,
19
+ processFile,
20
+ processorRunners,
21
+ runProcessors = _runProcessors,
22
+ } = overrides;
23
+
11
24
  let isProcessed = true;
12
25
  let places = [];
13
26
  let rawSource = '';
@@ -28,6 +28,7 @@ module.exports.run = async (overrides) => {
28
28
  initProcessFile = _initProcessFile,
29
29
  report,
30
30
  getOptions,
31
+ runProcessors,
31
32
  } = overrides;
32
33
 
33
34
  const processFile = initProcessFile(options);
@@ -66,6 +67,7 @@ module.exports.run = async (overrides) => {
66
67
  transform,
67
68
  trace,
68
69
  getOptions,
70
+ runProcessors,
69
71
  });
70
72
 
71
73
  places.push(...currentPlaces);
@@ -57,6 +57,7 @@ module.exports.runWriter = async (overrides = {}) => {
57
57
  count,
58
58
  trace,
59
59
  getOptions = _getOptions,
60
+ runProcessors,
60
61
  } = overrides;
61
62
 
62
63
  const resolvedName = resolve(name).replace(/^\./, cwd);
@@ -107,6 +108,7 @@ module.exports.runWriter = async (overrides = {}) => {
107
108
  readFile,
108
109
  processFile,
109
110
  resolvedName,
111
+ runProcessors,
110
112
  });
111
113
 
112
114
  const line = await report(currentFormat, {
@@ -4,6 +4,7 @@ const {normalize} = require('node:path');
4
4
  const picomatch = require('picomatch');
5
5
  const fullstore = require('fullstore');
6
6
 
7
+ const noop = () => {};
7
8
  const isMatchStore = fullstore();
8
9
 
9
10
  let patterns = [];
@@ -26,6 +27,11 @@ module.exports.isSupported = (name) => {
26
27
  return isMatch(name);
27
28
  };
28
29
 
30
+ module.exports.clear = () => {
31
+ isMatchStore(noop);
32
+ patterns = [];
33
+ };
34
+
29
35
  module.exports.getSupportedGlob = (file) => normalize(`${file}/**/{${patterns.join(',')}}`);
30
36
 
31
37
  module.exports.getPatterns = () => patterns;
package/lib/putout.js CHANGED
@@ -115,7 +115,6 @@ module.exports.traverse = traverse;
115
115
  module.exports.types = types;
116
116
  module.exports.template = template;
117
117
  module.exports.generate = generate;
118
- module.exports.initReport = require('@putout/engine-reporter/report');
119
118
 
120
119
  module.exports.operator = {
121
120
  ...require('@putout/operate'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "41.1.2",
3
+ "version": "41.1.3",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json",
@@ -15,8 +15,10 @@
15
15
  "./parse-options": "./lib/parse-options/index.js",
16
16
  "./parse-match": "./lib/parse-options/parse-match.js",
17
17
  "./merge-options": "./lib/parse-options/merge-options.js",
18
- "./exit-codes": "./lib/cli/exit-codes.mjs",
19
- "./exit-codes/cjs": "./lib/cli/exit-codes.js",
18
+ "./exit-codes": {
19
+ "import": "./lib/cli/exit-codes.mjs",
20
+ "require": "./lib/cli/exit-codes.js"
21
+ },
20
22
  "./cli": "./lib/cli/index.js",
21
23
  "./cli/get-options": "./lib/cli/get-options.js",
22
24
  "./package.json": "./package.json",
@@ -64,7 +66,7 @@
64
66
  "@putout/engine-loader": "^17.0.0",
65
67
  "@putout/engine-parser": "^15.0.1",
66
68
  "@putout/engine-processor": "^15.0.0",
67
- "@putout/engine-reporter": "^7.0.1",
69
+ "@putout/engine-reporter": "^8.0.2",
68
70
  "@putout/engine-runner": "^26.0.0",
69
71
  "@putout/formatter-codeframe": "^10.0.0",
70
72
  "@putout/formatter-dump": "^6.0.0",