putout 42.0.8 → 42.0.10
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 +24 -0
- package/lib/find-places.js +4 -4
- package/lib/operator.js +1 -0
- package/lib/putout.js +6 -15
- package/lib/transform.js +2 -18
- package/package.json +5 -4
- package/lib/shebang.js +0 -24
package/ChangeLog
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
2026.02.19, v42.0.10
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- 572465bac @putout/plugin-putout-config: apply-esm: apply-index-to-import -> add-index-to-import
|
|
5
|
+
|
|
6
|
+
feature:
|
|
7
|
+
- 76f6fa08c putout: @putout/plugin-package-json v11.0.0
|
|
8
|
+
- d0765fcc8 @putout/plugin-package-json: drop support of 🐊 < 42
|
|
9
|
+
- 90ae95984 putout: @putout/plugin-nodejs v21.0.0
|
|
10
|
+
- 2953e36e1 @putout/plugin-nodejs: drop support of 🐊 < 42
|
|
11
|
+
- 1cc1b5b5c putout: @putout/operator-match-files v12.0.0
|
|
12
|
+
- 4a07f3532 @putout/operator-match-files: drop support of 🐊 < 42
|
|
13
|
+
- e0cdbb3dc babel-plugin-putout: drop support of 🐊 < 42
|
|
14
|
+
- c54aa78f0 @putout/plugin-putout: remove-useless-source-argument
|
|
15
|
+
- f550defa0 @putout/engine-runner: get rid of shebang
|
|
16
|
+
- 1ceeb58ff @putout/operator-sort-ignore: property not array
|
|
17
|
+
- 6d57e7663 @putout/plugin-putout-config: apply-coverage: add
|
|
18
|
+
|
|
19
|
+
2026.02.19, v42.0.9
|
|
20
|
+
|
|
21
|
+
feature:
|
|
22
|
+
- 6ea9c1d80 @putout/plugin-rename-properties: add
|
|
23
|
+
- c546f4e4a @putout/plugin-putout: declare: renameProperties
|
|
24
|
+
|
|
1
25
|
2026.02.18, v42.0.8
|
|
2
26
|
|
|
3
27
|
feature:
|
package/lib/find-places.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {transform, transformAsync} from './transform.js';
|
|
2
2
|
|
|
3
|
-
export const findPlaces = (ast,
|
|
4
|
-
return transform(ast,
|
|
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,
|
|
11
|
-
return await transformAsync(ast,
|
|
10
|
+
export const findPlacesAsync = async (ast, opts) => {
|
|
11
|
+
return await transformAsync(ast, {
|
|
12
12
|
...opts,
|
|
13
13
|
fix: false,
|
|
14
14
|
});
|
package/lib/operator.js
CHANGED
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
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
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
|
-
|
|
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,
|
|
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.
|
|
3
|
+
"version": "42.0.10",
|
|
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",
|
|
@@ -82,11 +82,12 @@
|
|
|
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": "^
|
|
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",
|
|
89
89
|
"@putout/operator-rename-files": "^6.0.0",
|
|
90
|
+
"@putout/operator-rename-properties": "^1.0.0",
|
|
90
91
|
"@putout/operator-sort-ignore": "^2.0.0",
|
|
91
92
|
"@putout/plugin-apply-arrow": "^3.0.0",
|
|
92
93
|
"@putout/plugin-apply-at": "^3.0.0",
|
|
@@ -129,10 +130,10 @@
|
|
|
129
130
|
"@putout/plugin-merge-duplicate-functions": "^4.0.0",
|
|
130
131
|
"@putout/plugin-montag": "^4.0.0",
|
|
131
132
|
"@putout/plugin-new": "^5.0.0",
|
|
132
|
-
"@putout/plugin-nodejs": "^
|
|
133
|
+
"@putout/plugin-nodejs": "^21.0.0",
|
|
133
134
|
"@putout/plugin-npmignore": "^7.0.0",
|
|
134
135
|
"@putout/plugin-optional-chaining": "^2.0.0",
|
|
135
|
-
"@putout/plugin-package-json": "^
|
|
136
|
+
"@putout/plugin-package-json": "^11.0.0",
|
|
136
137
|
"@putout/plugin-parens": "^5.0.0",
|
|
137
138
|
"@putout/plugin-promises": "^19.0.0",
|
|
138
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
|
-
};
|