putout 29.1.13 β 29.2.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 +14 -0
- package/README.md +1 -1
- package/lib/cli/index.js +10 -9
- package/lib/cli/process-file.js +2 -2
- package/lib/parse-options/validate-options/schema.json +4 -0
- package/lib/putout.js +3 -4
- package/package.json +3 -3
package/ChangeLog
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
2023.04.04, v29.2.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 94717fe16 package: @putout/engine-parser v6.0.0
|
|
5
|
+
- 875c96303 @putout/egine-parser: add ability to override printer and use: babel or putout instead of recast
|
|
6
|
+
|
|
7
|
+
2023.04.03, v29.1.14
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- 7338e39e3 package: @putout/plugin-simplify-ternary v5.0.1
|
|
11
|
+
- 0cb227d0a @putout/plugin-simplify-ternary: exclude fixture
|
|
12
|
+
- 36d691997 @putout/plugin-simplify-ternary: drop support of π < 29
|
|
13
|
+
- d87230d33 @putout/plugin-simplify-ternary: value: exclude jsx
|
|
14
|
+
|
|
1
15
|
2023.04.01, v29.1.13
|
|
2
16
|
|
|
3
17
|
feature:
|
package/README.md
CHANGED
|
@@ -212,7 +212,7 @@ putout lib --plugins remove-debugger,remove-unused-variables
|
|
|
212
212
|
- `ESLINT_CONFIG_FILE` - path to **ESLint** config file;
|
|
213
213
|
- `NO_ESLINT` - do not run **ESLint** after π**Putout**;
|
|
214
214
|
- `NO_ESLINT_WARNINGS` - do not show **ESLint** warnings;
|
|
215
|
-
- `
|
|
215
|
+
- `PUTOUT_PRINTER` - force π**Putout** to use printers like `babel`, `putout` and `recast` to `parse()` and `print()`, useful for Babel Plugins to make locations output more accurate.
|
|
216
216
|
|
|
217
217
|
```sh
|
|
218
218
|
PUTOUT_FILES=lib,test putout --fix
|
package/lib/cli/index.js
CHANGED
|
@@ -9,22 +9,23 @@ const tryCatch = require('try-catch');
|
|
|
9
9
|
const wraptile = require('wraptile');
|
|
10
10
|
const fullstore = require('fullstore');
|
|
11
11
|
|
|
12
|
-
const keyPress = require('@putout/cli-keypress');
|
|
13
|
-
const {version} = require('../../package.json');
|
|
14
|
-
const {simpleImport} = require('./simple-import');
|
|
15
|
-
const {run} = require('./runner/runner.js');
|
|
16
|
-
|
|
17
12
|
const {
|
|
18
13
|
getFilePatterns,
|
|
19
14
|
getProcessorRunners,
|
|
20
15
|
defaultProcessors,
|
|
21
16
|
} = require('@putout/engine-processor');
|
|
22
17
|
|
|
23
|
-
const
|
|
18
|
+
const validateArgs = require('@putout/cli-validate-args');
|
|
24
19
|
const {createCache} = require('@putout/cli-cache');
|
|
20
|
+
const keyPress = require('@putout/cli-keypress');
|
|
21
|
+
|
|
25
22
|
const supportedFiles = require('./supported-files');
|
|
26
23
|
const getOptions = require('./get-options');
|
|
27
|
-
|
|
24
|
+
|
|
25
|
+
const getFiles = require('./get-files');
|
|
26
|
+
const {version} = require('../../package.json');
|
|
27
|
+
const {simpleImport} = require('./simple-import');
|
|
28
|
+
const {run} = require('./runner/runner.js');
|
|
28
29
|
|
|
29
30
|
const {
|
|
30
31
|
OK,
|
|
@@ -45,7 +46,7 @@ const getFormatter = memo(require('./formatter').getFormatter);
|
|
|
45
46
|
const cwd = process.cwd();
|
|
46
47
|
const {
|
|
47
48
|
PUTOUT_FILES = '',
|
|
48
|
-
|
|
49
|
+
PUTOUT_PRINTER,
|
|
49
50
|
} = process.env;
|
|
50
51
|
|
|
51
52
|
const envNames = !PUTOUT_FILES ? [] : PUTOUT_FILES.split(',');
|
|
@@ -278,7 +279,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
278
279
|
write,
|
|
279
280
|
transform,
|
|
280
281
|
plugins,
|
|
281
|
-
|
|
282
|
+
printer: PUTOUT_PRINTER,
|
|
282
283
|
};
|
|
283
284
|
|
|
284
285
|
const {places, exited} = await run({
|
package/lib/cli/process-file.js
CHANGED
|
@@ -16,7 +16,7 @@ const getMatchedOptions = (name, options) => {
|
|
|
16
16
|
return merge(options, parseMatch(name, options.match));
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
module.exports = ({fix, fixCount, isFlow, logError, raw,
|
|
19
|
+
module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({name, source, startLine, options}) => {
|
|
20
20
|
const isTS = /\.tsx?$/.test(name) || /{tsx?}$/.test(name);
|
|
21
21
|
const matchedOptions = getMatchedOptions(name, options);
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, recast}) => async ({nam
|
|
|
25
25
|
fixCount,
|
|
26
26
|
isTS,
|
|
27
27
|
isFlow,
|
|
28
|
-
|
|
28
|
+
printer,
|
|
29
29
|
...matchedOptions,
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -71,6 +71,10 @@
|
|
|
71
71
|
"description": "Tell πPutout which parser to use",
|
|
72
72
|
"type": "string"
|
|
73
73
|
},
|
|
74
|
+
"printer": {
|
|
75
|
+
"description": "Tell πPutout which printer to use",
|
|
76
|
+
"type": "string"
|
|
77
|
+
},
|
|
74
78
|
"formatter": {
|
|
75
79
|
"description": "Choose the way to show information about errors found",
|
|
76
80
|
"type": ["string", "array"]
|
package/lib/putout.js
CHANGED
|
@@ -45,10 +45,9 @@ module.exports = (source, opts) => {
|
|
|
45
45
|
isJSX,
|
|
46
46
|
sourceFileName,
|
|
47
47
|
sourceMapName,
|
|
48
|
+
printer,
|
|
48
49
|
} = opts;
|
|
49
50
|
|
|
50
|
-
const recast = opts.recast ?? opts.fix;
|
|
51
|
-
|
|
52
51
|
const [clearSource, shebang] = cutShebang(source);
|
|
53
52
|
const ast = parse(clearSource, {
|
|
54
53
|
sourceFileName,
|
|
@@ -56,7 +55,7 @@ module.exports = (source, opts) => {
|
|
|
56
55
|
isTS,
|
|
57
56
|
isFlow,
|
|
58
57
|
isJSX,
|
|
59
|
-
|
|
58
|
+
printer,
|
|
60
59
|
});
|
|
61
60
|
|
|
62
61
|
const places = transform(ast, source, opts);
|
|
@@ -69,7 +68,7 @@ module.exports = (source, opts) => {
|
|
|
69
68
|
|
|
70
69
|
const printed = print(ast, {
|
|
71
70
|
sourceMapName,
|
|
72
|
-
|
|
71
|
+
printer,
|
|
73
72
|
});
|
|
74
73
|
const code = `${shebang}${printed}`;
|
|
75
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.2.0",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@putout/cli-validate-args": "^1.0.0",
|
|
54
54
|
"@putout/compare": "^9.0.0",
|
|
55
55
|
"@putout/engine-loader": "^8.0.0",
|
|
56
|
-
"@putout/engine-parser": "^
|
|
56
|
+
"@putout/engine-parser": "^6.0.0",
|
|
57
57
|
"@putout/engine-processor": "^6.0.0",
|
|
58
58
|
"@putout/engine-runner": "^15.0.0",
|
|
59
59
|
"@putout/eslint": "^2.0.0",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"@putout/plugin-remove-useless-variables": "^8.0.0",
|
|
153
153
|
"@putout/plugin-reuse-duplicate-init": "^4.0.0",
|
|
154
154
|
"@putout/plugin-simplify-assignment": "^3.0.0",
|
|
155
|
-
"@putout/plugin-simplify-ternary": "^
|
|
155
|
+
"@putout/plugin-simplify-ternary": "^5.0.1",
|
|
156
156
|
"@putout/plugin-split-nested-destructuring": "^2.0.0",
|
|
157
157
|
"@putout/plugin-split-variable-declarations": "^2.0.0",
|
|
158
158
|
"@putout/plugin-strict-mode": "^5.0.0",
|