@putout/printer 17.0.2 → 17.0.4

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.
Files changed (28) hide show
  1. package/ChangeLog +11 -0
  2. package/lib/tokenize/expressions/assignment-expression/assignment-expression.js +2 -2
  3. package/lib/tokenize/expressions/assignment-expression/maybe-parens-condition.js +1 -1
  4. package/lib/tokenize/expressions/binary-expression/binary-expression.js +1 -1
  5. package/lib/tokenize/expressions/call-expression/call-expression.js +1 -1
  6. package/lib/tokenize/expressions/conditional-expression.js +1 -1
  7. package/lib/tokenize/expressions/function/arrow-function-expression.js +1 -1
  8. package/lib/tokenize/expressions/function/function-expression.js +1 -1
  9. package/lib/tokenize/expressions/logical-expression/logical-expression.js +1 -1
  10. package/lib/tokenize/expressions/member-expression/member-expressions.js +1 -1
  11. package/lib/tokenize/expressions/sequence-expression/sequence-expression.js +1 -1
  12. package/lib/tokenize/expressions/unary-expression/unary-expressions.js +1 -1
  13. package/lib/tokenize/literals/identifier.js +1 -1
  14. package/lib/tokenize/typescript/function/ts-call-signature-declaration.js +1 -1
  15. package/lib/tokenize/typescript/function/ts-construct-signature-declaration.js +1 -1
  16. package/lib/tokenize/typescript/function/ts-constructor-type.js +1 -1
  17. package/lib/tokenize/typescript/function/ts-declare-function.js +1 -1
  18. package/lib/tokenize/typescript/function/ts-declare-method.js +1 -1
  19. package/lib/tokenize/typescript/function/ts-function-type.js +2 -2
  20. package/lib/tokenize/typescript/function/ts-method-signature.js +1 -1
  21. package/lib/tokenize/typescript/index.js +2 -6
  22. package/lib/tokenize/typescript/ts-as-expression/ts-as-expression.js +1 -1
  23. package/lib/tokenize/typescript/ts-infer-type/ts-infer-type.js +1 -1
  24. package/lib/tokenize/typescript/ts-non-null-expression/ts-non-null-expression.js +6 -0
  25. package/lib/tokenize/typescript/ts-type-parameter-declaration/ts-type-parameter-declaration.js +1 -1
  26. package/lib/tokenize/typescript/ts-type-query/ts-type-query.js +1 -1
  27. package/lib/tokenize/typescript/ts-union-type/ts-union-type.js +1 -1
  28. package/package.json +7 -1
package/ChangeLog CHANGED
@@ -1,3 +1,14 @@
1
+ 2026.01.18, v17.0.4
2
+
3
+ feature:
4
+ - 06823ba @putout/printer: print-params -> #print-params
5
+
6
+ 2026.01.17, v17.0.3
7
+
8
+ feature:
9
+ - 8bbeef9 @putout/printer: maybe-parens -> #maybe-parens
10
+ - c6d5b2d @putout/printer: TSNonNullExpression: improve support
11
+
1
12
  2026.01.11, v17.0.2
2
13
 
3
14
  feature:
@@ -1,12 +1,12 @@
1
+ import {maybeParens} from '#maybe-parens';
1
2
  import {condition} from './maybe-parens-condition.js';
3
+ import {printSeparator} from './print-separator.js';
2
4
  import {
3
5
  printLeadingCommentLine,
4
6
  maybeInsideReturnWithCommentEnd,
5
7
  maybeInsideReturnWithCommentStart,
6
8
  printLeadingCommentBlock,
7
9
  } from './assignment-expression-comments.js';
8
- import {maybeParens} from '../../maybe/maybe-parens.js';
9
- import {printSeparator} from './print-separator.js';
10
10
 
11
11
  const isInsideBlock = ({parentPath}) => /BlockStatement|Program/.test(parentPath.type);
12
12
 
@@ -1,5 +1,5 @@
1
1
  import {hasLeadingComment} from '#is';
2
- import {isParens} from '../../maybe/maybe-parens.js';
2
+ import {isParens} from '#maybe-parens';
3
3
 
4
4
  export const condition = (path, printer, semantics) => {
5
5
  const {parentPath} = path;
@@ -1,9 +1,9 @@
1
+ import {maybeParens} from '#maybe-parens';
1
2
  import {
2
3
  concatenate,
3
4
  isConcatenation,
4
5
  } from './concatenate.js';
5
6
  import {maybeSpace} from './maybe-space.js';
6
- import {maybeParens} from '../../maybe/maybe-parens.js';
7
7
 
8
8
  export const BinaryExpression = maybeParens((path, {print, indent, maybe}) => {
9
9
  const {operator} = path.node;
@@ -1,5 +1,5 @@
1
1
  import {exists} from '#is';
2
- import {maybeParens} from '../../maybe/maybe-parens.js';
2
+ import {maybeParens} from '#maybe-parens';
3
3
 
4
4
  const {isArray} = Array;
5
5
 
@@ -1,4 +1,4 @@
1
- import {maybeParens} from '../maybe/maybe-parens.js';
1
+ import {maybeParens} from '#maybe-parens';
2
2
 
3
3
  export const ConditionalExpression = maybeParens((path, {print}) => {
4
4
  print('__test');
@@ -1,6 +1,6 @@
1
1
  import {exists} from '#is';
2
+ import {maybeParens} from '#maybe-parens';
2
3
  import {printParams} from './params.js';
3
- import {maybeParens} from '../../maybe/maybe-parens.js';
4
4
 
5
5
  export const ArrowFunctionExpression = maybeParens((path, printer, semantics) => {
6
6
  const {
@@ -1,6 +1,6 @@
1
1
  import {exists} from '#is';
2
+ import {maybeParens} from '#maybe-parens';
2
3
  import {printParams} from './params.js';
3
- import {maybeParens} from '../../maybe/maybe-parens.js';
4
4
 
5
5
  export const FunctionExpression = maybeParens((path, printer, semantics) => {
6
6
  const {
@@ -1,4 +1,4 @@
1
- import {maybeParens} from '../../maybe/maybe-parens.js';
1
+ import {maybeParens} from '#maybe-parens';
2
2
  import {chain, isRootOk} from './chain.js';
3
3
 
4
4
  export const LogicalExpression = maybeParens({
@@ -1,6 +1,6 @@
1
1
  import {types} from '@putout/babel';
2
+ import {maybeParens} from '#maybe-parens';
2
3
  import {maybePrintComputed} from '../object-expression/maybe-print-computed.js';
3
- import {maybeParens} from '../../maybe/maybe-parens.js';
4
4
  import {isLooksLikeChain} from './is-looks-like-chain.js';
5
5
 
6
6
  const {
@@ -1,5 +1,5 @@
1
1
  import {hasLeadingComment} from '#is';
2
- import {maybeParens} from '../../maybe/maybe-parens.js';
2
+ import {maybeParens} from '#maybe-parens';
3
3
  import {condition} from './maybe-write-brace.js';
4
4
  import {
5
5
  maybePrintComments,
@@ -1,5 +1,5 @@
1
1
  import {isLast, isNext} from '#is';
2
- import {maybeParens} from '../../maybe/maybe-parens.js';
2
+ import {maybeParens} from '#maybe-parens';
3
3
 
4
4
  const isWord = (a) => /^(delete|typeof|void|throw)$/.test(a);
5
5
 
@@ -1,5 +1,5 @@
1
+ import {maybeParens} from '#maybe-parens';
1
2
  import {maybeDecorators} from '../maybe-get.js';
2
- import {maybeParens} from '../maybe/maybe-parens.js';
3
3
  import {maybeTypeAnnotation} from '../maybe/maybe-type-annotation.js';
4
4
 
5
5
  export const Identifier = maybeParens(maybeTypeAnnotation((path, printer) => {
@@ -1,5 +1,5 @@
1
+ import {printParams} from '#print-params';
1
2
  import {printReturnType} from './print-return-type.js';
2
- import {printParams} from '../../expressions/function/params.js';
3
3
 
4
4
  export const TSCallSignatureDeclaration = (path, printer, semantics) => {
5
5
  const {print} = printer;
@@ -1,4 +1,4 @@
1
- import {printParams} from '../../expressions/function/params.js';
1
+ import {printParams} from '#print-params';
2
2
  import {
3
3
  hasReturnType,
4
4
  printReturnType,
@@ -1,4 +1,4 @@
1
- import {printParams} from '../../expressions/function/params.js';
1
+ import {printParams} from '#print-params';
2
2
  import {printReturnType} from './print-return-type.js';
3
3
 
4
4
  export const TSConstructorType = (path, printer, semantics) => {
@@ -1,5 +1,5 @@
1
1
  import {isNext} from '#is';
2
- import {printParams} from '../../expressions/function/params.js';
2
+ import {printParams} from '#print-params';
3
3
  import {maybeDeclare} from '../../maybe/maybe-declare.js';
4
4
 
5
5
  const isInsideDefaultExport = (path) => {
@@ -1,4 +1,4 @@
1
- import {printParams} from '../../expressions/function/params.js';
1
+ import {printParams} from '#print-params';
2
2
 
3
3
  export const TSDeclareMethod = (path, printer, semantics) => {
4
4
  const {print} = printer;
@@ -1,6 +1,6 @@
1
- import {printParams} from '../../expressions/function/params.js';
1
+ import {maybeParens} from '#maybe-parens';
2
+ import {printParams} from '#print-params';
2
3
  import {printReturnType} from './print-return-type.js';
3
- import {maybeParens} from '../../maybe/maybe-parens.js';
4
4
 
5
5
  export const TSFunctionType = maybeParens((path, printer, semantics) => {
6
6
  const {print} = printer;
@@ -1,4 +1,4 @@
1
- import {printParams} from '../../expressions/function/params.js';
1
+ import {printParams} from '#print-params';
2
2
  import {printKind} from '../../expressions/function/kind.js';
3
3
  import {
4
4
  hasReturnType,
@@ -1,7 +1,8 @@
1
1
  import {isNext} from '#is';
2
- import {printParams} from '../expressions/function/params.js';
2
+ import {printParams} from '#print-params';
3
3
  import {maybePrintTypeAnnotation} from '../maybe/maybe-type-annotation.js';
4
4
 
5
+ export {TSNonNullExpression} from './ts-non-null-expression/ts-non-null-expression.js';
5
6
  export {TSTypeLiteral} from './type/ts-type-literal.js';
6
7
  export {TSTypeAliasDeclaration} from './type/ts-type-alias-declaration.js';
7
8
  export {TSMappedType} from './mapped-type/ts-mapped-type.js';
@@ -150,11 +151,6 @@ export const TSTypePredicate = (path, {print}) => {
150
151
  print('__typeAnnotation');
151
152
  };
152
153
 
153
- export const TSNonNullExpression = (path, {print}) => {
154
- print('__expression');
155
- print('!');
156
- };
157
-
158
154
  export const TSImportEqualsDeclaration = (path, {print, maybe}) => {
159
155
  maybe.print(path.node.isExport, 'export ');
160
156
  print('import ');
@@ -1,5 +1,5 @@
1
1
  import {types} from '@putout/babel';
2
- import {maybeParens} from '../../maybe/maybe-parens.js';
2
+ import {maybeParens} from '#maybe-parens';
3
3
 
4
4
  const {
5
5
  isVariableDeclarator,
@@ -1,4 +1,4 @@
1
- import {maybeParens} from '../../maybe/maybe-parens.js';
1
+ import {maybeParens} from '#maybe-parens';
2
2
 
3
3
  export const TSInferType = maybeParens((path, {print}) => {
4
4
  print('infer ');
@@ -0,0 +1,6 @@
1
+ import {maybeParens} from '#maybe-parens';
2
+
3
+ export const TSNonNullExpression = maybeParens((path, {print}) => {
4
+ print('__expression');
5
+ print('!');
6
+ });
@@ -1,6 +1,6 @@
1
1
  import {types} from '@putout/babel';
2
+ import {printParams} from '#print-params';
2
3
  import {createPrintSpace} from '../../expressions/function/print-function-params.js';
3
- import {printParams} from '../../expressions/function/params.js';
4
4
 
5
5
  const {isTSUnionType} = types;
6
6
  const noop = () => {};
@@ -1,4 +1,4 @@
1
- import {maybeParens} from '../../maybe/maybe-parens.js';
1
+ import {maybeParens} from '#maybe-parens';
2
2
 
3
3
  export const TSTypeQuery = maybeParens((path, {print}) => {
4
4
  print('typeof ');
@@ -1,4 +1,4 @@
1
- import {maybeParens} from '../../maybe/maybe-parens.js';
1
+ import {maybeParens} from '#maybe-parens';
2
2
 
3
3
  const insideTypeDeclaration = ({parentPath}) => parentPath.isTSTypeAliasDeclaration();
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "17.0.2",
3
+ "version": "17.0.4",
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",
@@ -66,6 +66,12 @@
66
66
  },
67
67
  "#is": {
68
68
  "default": "./lib/tokenize/is.js"
69
+ },
70
+ "#maybe-parens": {
71
+ "default": "./lib/tokenize/maybe/maybe-parens.js"
72
+ },
73
+ "#print-params": {
74
+ "default": "./lib/tokenize/expressions/function/params.js"
69
75
  }
70
76
  },
71
77
  "devDependencies": {