@putout/printer 18.16.0 → 18.18.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 +10 -0
- package/lib/tokenize/expressions/array-expression/newline.js +6 -3
- package/lib/tokenize/expressions/import-expression/import-expression.js +17 -0
- package/lib/tokenize/expressions/index.js +1 -1
- package/lib/tokenize/typescript/ts-import-type/ts-import-type.js +2 -4
- package/package.json +1 -1
- package/lib/tokenize/expressions/import-expression.js +0 -15
package/ChangeLog
CHANGED
|
@@ -254,10 +254,16 @@ const isMixedTuples = (path, {maxElementLengthInOneLine}) => {
|
|
|
254
254
|
return false;
|
|
255
255
|
};
|
|
256
256
|
|
|
257
|
+
function hasCall(path) {
|
|
258
|
+
const [first] = path.node.elements;
|
|
259
|
+
return isCallExpression(first);
|
|
260
|
+
}
|
|
261
|
+
|
|
257
262
|
export const isMultiLine = createTypeChecker([
|
|
258
263
|
['-: node.elements.length -> -'],
|
|
259
264
|
['-', isStringsAndObject],
|
|
260
265
|
['-', isTupleInsideArray],
|
|
266
|
+
['+', hasCall],
|
|
261
267
|
['+', isMixedTuples],
|
|
262
268
|
['+', isBodyWithOneElement],
|
|
263
269
|
['+', isMoreThenMaxElementLengthInOneLine],
|
|
@@ -301,9 +307,6 @@ function isOneSimple(path) {
|
|
|
301
307
|
if (!first.isIdentifier() && isSimple(first))
|
|
302
308
|
return true;
|
|
303
309
|
|
|
304
|
-
if (first.isCallExpression())
|
|
305
|
-
return false;
|
|
306
|
-
|
|
307
310
|
return first.isMemberExpression();
|
|
308
311
|
}
|
|
309
312
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {maybeParens} from '#maybe-parens';
|
|
2
|
+
|
|
3
|
+
export const ImportExpression = maybeParens({
|
|
4
|
+
print: (path, printer) => {
|
|
5
|
+
const {print, maybe} = printer;
|
|
6
|
+
const {options} = path.node;
|
|
7
|
+
|
|
8
|
+
print('import(');
|
|
9
|
+
print('__source');
|
|
10
|
+
|
|
11
|
+
maybe.print(options, ',');
|
|
12
|
+
maybe.print.space(options);
|
|
13
|
+
|
|
14
|
+
print('__options');
|
|
15
|
+
print(')');
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -19,7 +19,7 @@ export {BinaryExpression} from './binary-expression/binary-expression.js';
|
|
|
19
19
|
export {LogicalExpression} from './logical-expression/logical-expression.js';
|
|
20
20
|
export {ConditionalExpression} from './conditional-expression.js';
|
|
21
21
|
export {StaticBlock} from './class/static-block.js';
|
|
22
|
-
export {ImportExpression} from './import-expression.js';
|
|
22
|
+
export {ImportExpression} from './import-expression/import-expression.js';
|
|
23
23
|
export {ParenthesizedExpression} from './parenthesized-expression/parenthesized-expression.js';
|
|
24
24
|
export {
|
|
25
25
|
ClassProperty,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ImportExpression} from '../../expressions/import-expression/import-expression.js';
|
|
2
2
|
|
|
3
|
-
export const TSImportType =
|
|
4
|
-
createImportExpression(path, printer);
|
|
5
|
-
};
|
|
3
|
+
export const TSImportType = ImportExpression;
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const ImportExpression = createImportExpression;
|
|
2
|
-
|
|
3
|
-
export function createImportExpression(path, printer) {
|
|
4
|
-
const {print, maybe} = printer;
|
|
5
|
-
const {options} = path.node;
|
|
6
|
-
|
|
7
|
-
print('import(');
|
|
8
|
-
print('__source');
|
|
9
|
-
|
|
10
|
-
maybe.print(options, ',');
|
|
11
|
-
maybe.print.space(options);
|
|
12
|
-
|
|
13
|
-
print('__options');
|
|
14
|
-
print(')');
|
|
15
|
-
}
|