putout 29.14.0 → 30.0.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 +25 -0
- package/lib/cli/build-plugins.js +1 -3
- package/lib/cli/get-options.js +1 -4
- package/lib/cli/index.js +7 -14
- package/lib/cli/parse-error.js +1 -4
- package/lib/cli/runner/runner.js +1 -4
- package/lib/cli/runner/worker.js +1 -4
- package/lib/codeframe.js +1 -4
- package/lib/parse-options/index.js +3 -8
- package/lib/parse-options/parse-match.js +1 -4
- package/lib/putout.js +2 -5
- package/package.json +3 -3
- package/putout.json +1 -0
- package/lib/cli/staged.js +0 -70
package/ChangeLog
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
2023.07.05, v30.0.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 57c5aef40 @putout/test: processor: add ability to pass printer
|
|
5
|
+
- 40fa46cc0 @putout/plugin-promises: enable convert-new-promise-to-async
|
|
6
|
+
- 7875b0233 putout: use @putout/printer by default
|
|
7
|
+
- 8fc9dd688 package: cosmiconfig v8.2.0
|
|
8
|
+
- 9f1749ad3 package: hermes-parser v0.12.1
|
|
9
|
+
- 0ff502529 package: c8 v8.0.0
|
|
10
|
+
- 44f032f72 package: find-cache-dir v4.0.0
|
|
11
|
+
- 9038588c6 @putout/plugin-declare-before-reference: use @putout/printer
|
|
12
|
+
- 6d3f961dd @putout/plugin-npmignore: use @putout/printer
|
|
13
|
+
- 74726fa72 @putout/plugin-declare: use @putout/printer
|
|
14
|
+
- 652ffb21c @putout/test: noTransformWithOptions: UPDATE
|
|
15
|
+
- 23858f1b7 @putout/plugin-minify: convert-array-from-to-spread: add (coderaiser/minify#107)
|
|
16
|
+
- d576f572a @putout/plugin-minify: convert-if-to-logical: improve support of generators (coderaiser/minify#108)
|
|
17
|
+
- a21a45e2a scripts: printer: remove drop
|
|
18
|
+
- bbae438d0 @putout/plugin-remove-empty: pattern: FunctionExpression: async: add
|
|
19
|
+
- e84a46600 @putout/cli-staged: add support of renamed files
|
|
20
|
+
|
|
21
|
+
2023.06.15, v29.15.0
|
|
22
|
+
|
|
23
|
+
feature:
|
|
24
|
+
- 69bee138c @putout/cli-staged: move out from putout
|
|
25
|
+
|
|
1
26
|
2023.06.15, v29.14.0
|
|
2
27
|
|
|
3
28
|
feature:
|
package/lib/cli/build-plugins.js
CHANGED
package/lib/cli/get-options.js
CHANGED
package/lib/cli/index.js
CHANGED
|
@@ -42,14 +42,12 @@ const {
|
|
|
42
42
|
CANNOT_LINT_STAGED,
|
|
43
43
|
} = require('./exit-codes');
|
|
44
44
|
|
|
45
|
+
const {isSupported} = supportedFiles;
|
|
45
46
|
const getFormatter = nanomemoize(require('./formatter').getFormatter);
|
|
46
47
|
|
|
47
48
|
const cwd = process.cwd();
|
|
48
49
|
|
|
49
|
-
const {
|
|
50
|
-
PUTOUT_FILES = '',
|
|
51
|
-
PUTOUT_PRINTER,
|
|
52
|
-
} = process.env;
|
|
50
|
+
const {PUTOUT_FILES = '', PUTOUT_PRINTER} = process.env;
|
|
53
51
|
|
|
54
52
|
const envNames = !PUTOUT_FILES ? [] : PUTOUT_FILES.split(',');
|
|
55
53
|
|
|
@@ -181,10 +179,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
181
179
|
if (isStr(args.match)) {
|
|
182
180
|
const {match} = await simpleImport('@putout/cli-match');
|
|
183
181
|
|
|
184
|
-
const {
|
|
185
|
-
code,
|
|
186
|
-
message,
|
|
187
|
-
} = await match({
|
|
182
|
+
const {code, message} = await match({
|
|
188
183
|
pattern: args.match,
|
|
189
184
|
cwd,
|
|
190
185
|
readFile,
|
|
@@ -240,11 +235,12 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
240
235
|
const stagedNames = [];
|
|
241
236
|
|
|
242
237
|
if (staged) {
|
|
243
|
-
const {get} = require('
|
|
238
|
+
const {get} = require('@putout/cli-staged');
|
|
244
239
|
const {findUp} = await simpleImport('find-up');
|
|
245
240
|
|
|
246
241
|
const [error, names] = await tryToCatch(get, {
|
|
247
242
|
findUp,
|
|
243
|
+
isSupported,
|
|
248
244
|
});
|
|
249
245
|
|
|
250
246
|
if (error)
|
|
@@ -300,10 +296,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
300
296
|
printer: PUTOUT_PRINTER,
|
|
301
297
|
};
|
|
302
298
|
|
|
303
|
-
const {
|
|
304
|
-
places,
|
|
305
|
-
exited,
|
|
306
|
-
} = await run({
|
|
299
|
+
const {places, exited} = await run({
|
|
307
300
|
fix,
|
|
308
301
|
exit,
|
|
309
302
|
readFile,
|
|
@@ -341,7 +334,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
341
334
|
}
|
|
342
335
|
|
|
343
336
|
if (fix && staged) {
|
|
344
|
-
const {set} = require('
|
|
337
|
+
const {set} = require('@putout/cli-staged');
|
|
345
338
|
const {findUp} = await simpleImport('find-up');
|
|
346
339
|
|
|
347
340
|
const stagedNames = await set({
|
package/lib/cli/parse-error.js
CHANGED
package/lib/cli/runner/runner.js
CHANGED
|
@@ -19,10 +19,7 @@ module.exports.run = async ({transform, plugins, noConfig, readFile, writeFile,
|
|
|
19
19
|
const currentIndex = isStop() ? length - 1 : index;
|
|
20
20
|
const name = names[index];
|
|
21
21
|
|
|
22
|
-
const {
|
|
23
|
-
exited,
|
|
24
|
-
places: currentPlaces = [],
|
|
25
|
-
} = await runWorker({
|
|
22
|
+
const {exited, places: currentPlaces = []} = await runWorker({
|
|
26
23
|
readFile,
|
|
27
24
|
writeFile,
|
|
28
25
|
exit,
|
package/lib/cli/runner/worker.js
CHANGED
|
@@ -9,10 +9,7 @@ const {readFileSync} = require('fs');
|
|
|
9
9
|
|
|
10
10
|
const getOptions = require('../get-options.js');
|
|
11
11
|
|
|
12
|
-
const {
|
|
13
|
-
INVALID_CONFIG,
|
|
14
|
-
NO_PROCESSORS,
|
|
15
|
-
} = require('../exit-codes.js');
|
|
12
|
+
const {INVALID_CONFIG, NO_PROCESSORS} = require('../exit-codes.js');
|
|
16
13
|
|
|
17
14
|
const {lint} = require('./lint.js');
|
|
18
15
|
|
package/lib/codeframe.js
CHANGED
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
const {homedir} = require('os');
|
|
4
4
|
const {readdirSync} = require('fs');
|
|
5
5
|
|
|
6
|
-
const {
|
|
7
|
-
dirname,
|
|
8
|
-
join,
|
|
9
|
-
} = require('path');
|
|
6
|
+
const {dirname, join} = require('path');
|
|
10
7
|
|
|
11
8
|
const once = require('once');
|
|
12
9
|
const tryCatch = require('try-catch');
|
|
@@ -90,12 +87,10 @@ function _readOptions(name) {
|
|
|
90
87
|
|
|
91
88
|
if (packagePath)
|
|
92
89
|
return [
|
|
93
|
-
dirname(packagePath),
|
|
94
|
-
{
|
|
90
|
+
dirname(packagePath), {
|
|
95
91
|
...options,
|
|
96
92
|
...require(packagePath).putout,
|
|
97
|
-
}
|
|
98
|
-
];
|
|
93
|
+
}];
|
|
99
94
|
|
|
100
95
|
return ['', {}];
|
|
101
96
|
}
|
package/lib/putout.js
CHANGED
|
@@ -13,17 +13,14 @@ const {
|
|
|
13
13
|
template,
|
|
14
14
|
} = require('@putout/engine-parser');
|
|
15
15
|
|
|
16
|
-
const {
|
|
17
|
-
cutShebang,
|
|
18
|
-
mergeShebang,
|
|
19
|
-
} = require('./shebang');
|
|
16
|
+
const {cutShebang, mergeShebang} = require('./shebang');
|
|
20
17
|
|
|
21
18
|
const isString = (a) => typeof a === 'string';
|
|
22
19
|
|
|
23
20
|
const defaultOpts = (opts = {}) => {
|
|
24
21
|
const {
|
|
25
22
|
parser = 'babel',
|
|
26
|
-
printer = opts.printer || '
|
|
23
|
+
printer = opts.printer || 'putout',
|
|
27
24
|
fix = true,
|
|
28
25
|
fixCount = 2,
|
|
29
26
|
loadPlugins = loader.loadPlugins,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "30.0.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",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@putout/cli-keypress": "^1.0.0",
|
|
51
51
|
"@putout/cli-match": "^2.0.0",
|
|
52
52
|
"@putout/cli-ruler": "^3.0.0",
|
|
53
|
+
"@putout/cli-staged": "^1.0.0",
|
|
53
54
|
"@putout/cli-validate-args": "^1.0.0",
|
|
54
55
|
"@putout/compare": "^10.0.0",
|
|
55
56
|
"@putout/engine-loader": "^9.0.0",
|
|
@@ -66,7 +67,6 @@
|
|
|
66
67
|
"@putout/formatter-progress": "^4.0.0",
|
|
67
68
|
"@putout/formatter-progress-bar": "^3.0.0",
|
|
68
69
|
"@putout/formatter-stream": "^4.0.0",
|
|
69
|
-
"@putout/git-status-porcelain": "^3.0.0",
|
|
70
70
|
"@putout/operate": "^8.0.0",
|
|
71
71
|
"@putout/operator-add-args": "^4.0.0",
|
|
72
72
|
"@putout/operator-declare": "^5.0.0",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"devDependencies": {
|
|
205
205
|
"@babel/plugin-transform-react-jsx": "^7.14.5",
|
|
206
206
|
"babel-plugin-transform-inline-consecutive-adds": "^0.5.0-alpha.9",
|
|
207
|
-
"c8": "^
|
|
207
|
+
"c8": "^8.0.0",
|
|
208
208
|
"currify": "^4.0.0",
|
|
209
209
|
"escover": "^3.2.2",
|
|
210
210
|
"eslint": "^8.0.1",
|
package/putout.json
CHANGED
package/lib/cli/staged.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const {join} = require('path');
|
|
4
|
-
const {spawnSync} = require('child_process');
|
|
5
|
-
|
|
6
|
-
const porcelain = require('@putout/git-status-porcelain');
|
|
7
|
-
const once = require('once');
|
|
8
|
-
const fullstore = require('fullstore');
|
|
9
|
-
const {isSupported} = require('./supported-files');
|
|
10
|
-
|
|
11
|
-
const namesStore = fullstore([]);
|
|
12
|
-
|
|
13
|
-
const findGit = once(async ({findUp}) => {
|
|
14
|
-
const type = 'directory';
|
|
15
|
-
|
|
16
|
-
const gitDir = await findUp('.git', {
|
|
17
|
-
type,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (!gitDir)
|
|
21
|
-
throw Error('not git repository');
|
|
22
|
-
|
|
23
|
-
const dir = gitDir.replace(/\.git$/, '');
|
|
24
|
-
|
|
25
|
-
return dir;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const joinDir = (a) => (b) => join(a, b);
|
|
29
|
-
|
|
30
|
-
module.exports.get = async function get({findUp}) {
|
|
31
|
-
const dir = await findGit({
|
|
32
|
-
findUp,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const names = porcelain({
|
|
36
|
-
modified: true,
|
|
37
|
-
added: true,
|
|
38
|
-
}).filter(isSupported);
|
|
39
|
-
|
|
40
|
-
namesStore(names);
|
|
41
|
-
|
|
42
|
-
return names.map(joinDir(dir));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
module.exports.set = async function set({findUp}) {
|
|
46
|
-
const dir = await findGit({
|
|
47
|
-
findUp,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const names = namesStore();
|
|
51
|
-
|
|
52
|
-
const staged = porcelain({
|
|
53
|
-
unstaged: true,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const namesToAdd = [];
|
|
57
|
-
|
|
58
|
-
for (const filepath of names) {
|
|
59
|
-
if (!staged.includes(filepath))
|
|
60
|
-
namesToAdd.push(filepath);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
add(namesToAdd.map(joinDir(dir)));
|
|
64
|
-
|
|
65
|
-
return staged;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
function add(names) {
|
|
69
|
-
spawnSync('git', ['add', ...names]);
|
|
70
|
-
}
|