putout 42.0.9 → 42.0.11

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,35 @@
1
+ 2026.02.20, v42.0.11
2
+
3
+ fix:
4
+ - 9ef96fa12 @putout/engine-runner: validate: returns -> does not return
5
+
6
+ feature:
7
+ - 262c69cb1 putout: @putout/operator-add-args v15.0.0
8
+ - fa6e0f1c7 @putout/operator-add-args: drop support of 🐊 < 42
9
+ - bf961e9ef @putout/plugin-operator-add-args: config: add
10
+ - 3dfa8fce8 @putout/plugin-putout: add-path-arg-to-match: filter: exclude
11
+ - 9933c6e4e @putout/plugin-putotu-config: remove-empty: match support
12
+ - 7d6b6c75e @putout/engine-runner: include: returns: not array
13
+ - c1d9dd533 @putout/plugin-putout: remove-useless-source-argument: transformAsync
14
+
15
+ 2026.02.19, v42.0.10
16
+
17
+ fix:
18
+ - 572465bac @putout/plugin-putout-config: apply-esm: apply-index-to-import -> add-index-to-import
19
+
20
+ feature:
21
+ - 76f6fa08c putout: @putout/plugin-package-json v11.0.0
22
+ - d0765fcc8 @putout/plugin-package-json: drop support of 🐊 < 42
23
+ - 90ae95984 putout: @putout/plugin-nodejs v21.0.0
24
+ - 2953e36e1 @putout/plugin-nodejs: drop support of 🐊 < 42
25
+ - 1cc1b5b5c putout: @putout/operator-match-files v12.0.0
26
+ - 4a07f3532 @putout/operator-match-files: drop support of 🐊 < 42
27
+ - e0cdbb3dc babel-plugin-putout: drop support of 🐊 < 42
28
+ - c54aa78f0 @putout/plugin-putout: remove-useless-source-argument
29
+ - f550defa0 @putout/engine-runner: get rid of shebang
30
+ - 1ceeb58ff @putout/operator-sort-ignore: property not array
31
+ - 6d57e7663 @putout/plugin-putout-config: apply-coverage: add
32
+
1
33
  2026.02.19, v42.0.9
2
34
 
3
35
  feature:
@@ -1,14 +1,14 @@
1
1
  import {transform, transformAsync} from './transform.js';
2
2
 
3
- export const findPlaces = (ast, source, opts) => {
4
- return transform(ast, source, {
3
+ export const findPlaces = (ast, opts) => {
4
+ return transform(ast, {
5
5
  ...opts,
6
6
  fix: false,
7
7
  });
8
8
  };
9
9
 
10
- export const findPlacesAsync = async (ast, source, opts) => {
11
- return await transformAsync(ast, source, {
10
+ export const findPlacesAsync = async (ast, opts) => {
11
+ return await transformAsync(ast, {
12
12
  ...opts,
13
13
  fix: false,
14
14
  });
package/lib/putout.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import {parse, print} from '@putout/engine-parser';
2
- import {cutShebang, mergeShebang} from './shebang.js';
3
2
  import {defaultOptions} from './default-options.js';
4
3
  import {transform, transformAsync} from './transform.js';
5
4
 
@@ -14,16 +13,14 @@ export const putout = (source, opts) => {
14
13
  printer,
15
14
  } = opts;
16
15
 
17
- const [clearSource, shebang] = cutShebang(source);
18
-
19
- const ast = parse(clearSource, {
16
+ const ast = parse(source, {
20
17
  parser,
21
18
  isTS,
22
19
  isJSX,
23
20
  printer,
24
21
  });
25
22
 
26
- const places = transform(ast, source, opts);
23
+ const places = transform(ast, opts);
27
24
 
28
25
  if (!opts.fix)
29
26
  return {
@@ -31,13 +28,11 @@ export const putout = (source, opts) => {
31
28
  places,
32
29
  };
33
30
 
34
- const printed = print(ast, {
31
+ const code = print(ast, {
35
32
  printer,
36
33
  source,
37
34
  });
38
35
 
39
- const code = mergeShebang(shebang, printed);
40
-
41
36
  return {
42
37
  code,
43
38
  places,
@@ -55,16 +50,14 @@ export const putoutAsync = async (source, opts) => {
55
50
  printer,
56
51
  } = opts;
57
52
 
58
- const [clearSource, shebang] = cutShebang(source);
59
-
60
- const ast = parse(clearSource, {
53
+ const ast = parse(source, {
61
54
  parser,
62
55
  isTS,
63
56
  isJSX,
64
57
  printer,
65
58
  });
66
59
 
67
- const places = await transformAsync(ast, source, opts);
60
+ const places = await transformAsync(ast, opts);
68
61
 
69
62
  if (!opts.fix)
70
63
  return {
@@ -72,12 +65,10 @@ export const putoutAsync = async (source, opts) => {
72
65
  places,
73
66
  };
74
67
 
75
- const printed = print(ast, {
68
+ const code = print(ast, {
76
69
  printer,
77
70
  });
78
71
 
79
- const code = mergeShebang(shebang, printed);
80
-
81
72
  return {
82
73
  code,
83
74
  places,
package/lib/transform.js CHANGED
@@ -1,21 +1,11 @@
1
1
  import {tryCatch} from 'try-catch';
2
2
  import {validateRulesRelations} from '@putout/engine-loader';
3
3
  import {defaultOptions} from './default-options.js';
4
- import {cutShebang} from './shebang.js';
5
4
  import {parseError} from './parse-error.js';
6
5
 
7
6
  const maybeParseError = (a) => !a ? [] : parseError(a, 'loader');
8
7
 
9
- // why we pass 'source' to 'transform()'?
10
- // because we need to calculate position in a right way
11
- // and determine is shebang is existing
12
- //
13
- // 25 return {¬
14
- // 26 line: shebang ? line + 1 : line,¬
15
- // 27 column,¬
16
- // 28 };¬
17
- //
18
- export const transform = (ast, source, opts) => {
8
+ export const transform = (ast, opts) => {
19
9
  opts = defaultOptions(opts);
20
10
 
21
11
  const {
@@ -28,8 +18,6 @@ export const transform = (ast, source, opts) => {
28
18
  progress,
29
19
  } = opts;
30
20
 
31
- const [, shebang] = cutShebang(source);
32
-
33
21
  const [validationError] = tryCatch(validateRulesRelations, {
34
22
  rules,
35
23
  pluginNames,
@@ -42,7 +30,6 @@ export const transform = (ast, source, opts) => {
42
30
 
43
31
  const places = runPlugins({
44
32
  ast,
45
- shebang,
46
33
  fix,
47
34
  fixCount,
48
35
  plugins,
@@ -55,7 +42,7 @@ export const transform = (ast, source, opts) => {
55
42
  ];
56
43
  };
57
44
 
58
- export const transformAsync = async (ast, source, opts) => {
45
+ export const transformAsync = async (ast, opts) => {
59
46
  opts = defaultOptions(opts);
60
47
 
61
48
  const {
@@ -68,8 +55,6 @@ export const transformAsync = async (ast, source, opts) => {
68
55
  progress,
69
56
  } = opts;
70
57
 
71
- const [, shebang] = cutShebang(source);
72
-
73
58
  const [validationError] = tryCatch(validateRulesRelations, {
74
59
  rules,
75
60
  pluginNames,
@@ -82,7 +67,6 @@ export const transformAsync = async (ast, source, opts) => {
82
67
 
83
68
  const places = runPlugins({
84
69
  ast,
85
- shebang,
86
70
  fix,
87
71
  fixCount,
88
72
  plugins,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "42.0.9",
3
+ "version": "42.0.11",
4
4
  "type": "module",
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",
@@ -74,7 +74,7 @@
74
74
  "@putout/formatter-stream": "^6.0.0",
75
75
  "@putout/formatter-time": "^4.0.0",
76
76
  "@putout/operate": "^15.0.0",
77
- "@putout/operator-add-args": "^14.0.0",
77
+ "@putout/operator-add-args": "^15.0.0",
78
78
  "@putout/operator-declare": "^16.0.0",
79
79
  "@putout/operator-filesystem": "^11.0.0",
80
80
  "@putout/operator-find-file-up": "^2.0.0",
@@ -82,7 +82,7 @@
82
82
  "@putout/operator-json": "^3.0.0",
83
83
  "@putout/operator-jsx": "^3.0.0",
84
84
  "@putout/operator-keyword": "^5.0.0",
85
- "@putout/operator-match-files": "^11.0.0",
85
+ "@putout/operator-match-files": "^12.0.0",
86
86
  "@putout/operator-parens": "^4.0.0",
87
87
  "@putout/operator-regexp": "^4.0.0",
88
88
  "@putout/operator-remove-files": "^1.0.0",
@@ -130,10 +130,10 @@
130
130
  "@putout/plugin-merge-duplicate-functions": "^4.0.0",
131
131
  "@putout/plugin-montag": "^4.0.0",
132
132
  "@putout/plugin-new": "^5.0.0",
133
- "@putout/plugin-nodejs": "^20.0.0",
133
+ "@putout/plugin-nodejs": "^21.0.0",
134
134
  "@putout/plugin-npmignore": "^7.0.0",
135
135
  "@putout/plugin-optional-chaining": "^2.0.0",
136
- "@putout/plugin-package-json": "^10.0.0",
136
+ "@putout/plugin-package-json": "^11.0.0",
137
137
  "@putout/plugin-parens": "^5.0.0",
138
138
  "@putout/plugin-promises": "^19.0.0",
139
139
  "@putout/plugin-putout": "^29.0.0",
package/lib/shebang.js DELETED
@@ -1,24 +0,0 @@
1
- export const mergeShebang = (shebang, source) => {
2
- if (!shebang)
3
- return source;
4
-
5
- return `${shebang}\n${source}`;
6
- };
7
-
8
- export const cutShebang = (source) => {
9
- if (source.indexOf('#'))
10
- return [source, ''];
11
-
12
- const lines = source.split('\n');
13
-
14
- const result = lines
15
- .slice(1)
16
- .join('\n');
17
-
18
- const [shebang] = lines;
19
-
20
- return [
21
- result,
22
- `${shebang}\n`,
23
- ];
24
- };