@putout/printer 18.36.0 → 18.37.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 CHANGED
@@ -1,3 +1,13 @@
1
+ 2026.07.14, v18.37.1
2
+
3
+ feature:
4
+ - 696133f1 @putout/printer: MemberExpression: chain: __a.__b().__c: newline
5
+
6
+ 2026.07.12, v18.37.0
7
+
8
+ feature:
9
+ - 960728cc @putout/printer: ImportSpecifier: importKind
10
+
1
11
  2026.07.12, v18.36.0
2
12
 
3
13
  feature:
@@ -8,6 +8,13 @@ const {
8
8
 
9
9
  const {assign} = Object;
10
10
 
11
+ const isCallee = (call, member) => {
12
+ if (!isCallExpression(call))
13
+ return false;
14
+
15
+ return call.node.callee === member.node;
16
+ };
17
+
11
18
  export const chain = (path) => {
12
19
  const all = [
13
20
  ...down(path),
@@ -52,9 +59,10 @@ function up(current) {
52
59
  type: 'CommentLine',
53
60
  });
54
61
 
62
+ const member = current;
55
63
  current = current.parentPath;
56
64
 
57
- if (isCallExpression(current)) {
65
+ if (isCallee(current, member)) {
58
66
  properties.push(build(current));
59
67
  current = current.parentPath;
60
68
  }
@@ -71,15 +79,24 @@ function up(current) {
71
79
  }
72
80
 
73
81
  function build(path) {
82
+ const {type} = path;
74
83
  const prop = {
75
- type: path.type,
84
+ type,
76
85
  };
77
86
 
78
- if (isCallExpression(path))
87
+ if (isCallExpression(path)) {
88
+ const {callee} = path.node;
89
+
79
90
  assign(prop, {
80
91
  args: path.node.arguments.length,
81
- name: path.node.callee.property?.name || '',
82
92
  });
93
+
94
+ if (isMemberExpression(callee))
95
+ assign(prop, {
96
+ name: callee.property.name,
97
+ });
98
+ }
83
99
 
84
100
  return prop;
85
101
  }
102
+
@@ -65,6 +65,10 @@ export const ImportDeclaration = {
65
65
  maybe.write.breakline(importsCount >= maxSpecifiersInOneLine);
66
66
 
67
67
  wasSpecifier = true;
68
+
69
+ if (spec.node.importKind === 'type')
70
+ write('type ');
71
+
68
72
  traverse(spec.get('imported'));
69
73
 
70
74
  if (imported.name !== local.name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.36.0",
3
+ "version": "18.37.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",