@putout/printer 1.79.1 → 1.80.1
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 +11 -0
- package/lib/tokenize/expressions/member-expressions/member-expressions.js +0 -1
- package/lib/tokenize/expressions/sequence-expression.js +27 -9
- package/lib/tokenize/literals/index.js +2 -1
- package/lib/tokenize/statements/break-statement.js +1 -4
- package/lib/tokenize/statements/for-in-statement.js +1 -3
- package/lib/tokenize/statements/for-statement.js +5 -5
- package/package.json +2 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2023.05.03, v1.80.1
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 9060489 @putout/printer: improve support of ForStatement
|
|
5
|
+
- 94fce17 @putout/printer: SequenceExpression inside ExportDeclaration
|
|
6
|
+
|
|
7
|
+
2023.05.03, v1.80.0
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- e6111ae @putout/printer: improve support of NumericLiteral, SequenceExpression
|
|
11
|
+
|
|
1
12
|
2023.05.02, v1.79.1
|
|
2
13
|
|
|
3
14
|
fix:
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports.SequenceExpression =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
module.exports.SequenceExpression = {
|
|
4
|
+
condition({parentPath}) {
|
|
5
|
+
if (parentPath.isArrowFunctionExpression())
|
|
6
|
+
return true;
|
|
7
|
+
|
|
8
|
+
if (parentPath.isExportDeclaration())
|
|
9
|
+
return true;
|
|
10
|
+
|
|
11
|
+
return false;
|
|
12
|
+
},
|
|
13
|
+
before(path, {write}) {
|
|
14
|
+
write('(');
|
|
15
|
+
},
|
|
16
|
+
print(path, {maybe, print}) {
|
|
17
|
+
const expressions = path.get('expressions');
|
|
18
|
+
const n = expressions.length - 1;
|
|
19
|
+
|
|
20
|
+
for (const [index, expression] of expressions.entries()) {
|
|
21
|
+
print(expression);
|
|
22
|
+
maybe.print(index < n, ',');
|
|
23
|
+
maybe.print(index < n, ' ');
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
after(path, {write}) {
|
|
27
|
+
write(')');
|
|
28
|
+
},
|
|
12
29
|
};
|
|
30
|
+
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {exists} = require('../is');
|
|
4
|
+
|
|
5
|
+
const {markAfter} = require('../mark');
|
|
4
6
|
|
|
5
7
|
module.exports.ForStatement = {
|
|
6
8
|
print(path, {print, maybe, indent}) {
|
|
@@ -33,12 +35,10 @@ module.exports.ForStatement = {
|
|
|
33
35
|
}
|
|
34
36
|
},
|
|
35
37
|
afterIf(path) {
|
|
36
|
-
|
|
37
|
-
return false;
|
|
38
|
-
|
|
39
|
-
return true;
|
|
38
|
+
return exists(path.getNextSibling());
|
|
40
39
|
},
|
|
41
40
|
after(path, {print}) {
|
|
42
41
|
print.linebreak();
|
|
42
|
+
markAfter(path);
|
|
43
43
|
},
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.80.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Simplest possible opinionated Babel AST printer fro 🐊Putout",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@putout/test": "^6.0.1",
|
|
51
51
|
"acorn": "^8.8.2",
|
|
52
52
|
"c8": "^7.5.0",
|
|
53
|
+
"escover": "^2.5.3",
|
|
53
54
|
"eslint": "^8.0.1",
|
|
54
55
|
"eslint-plugin-n": "^15.2.4",
|
|
55
56
|
"eslint-plugin-putout": "^17.0.0",
|