@putout/printer 11.7.0 → 11.8.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 CHANGED
@@ -1,3 +1,8 @@
1
+ 2024.12.17, v11.8.0
2
+
3
+ feature:
4
+ - 0ed288d @putout/printer: LabeledStatement: nexted
5
+
1
6
  2024.12.17, v11.7.0
2
7
 
3
8
  feature:
@@ -12,6 +12,7 @@ const {
12
12
  isMemberExpression,
13
13
  isArrayExpression,
14
14
  isObjectExpression,
15
+ isLabeledStatement,
15
16
  } = types;
16
17
 
17
18
  const isParentProgram = (path) => path.parentPath?.isProgram();
@@ -124,6 +125,8 @@ module.exports.isNewlineBetweenSiblings = (path) => {
124
125
  return startNext - endCurrent > 1;
125
126
  };
126
127
 
128
+ module.exports.isInsideLabel = ({parentPath}) => isLabeledStatement(parentPath);
129
+
127
130
  module.exports.satisfy = (conditions) => (path) => {
128
131
  for (const condition of conditions)
129
132
  if (condition(path))
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const {isLabeledStatement} = require('@putout/babel').types;
4
3
  const {
5
4
  isNext,
6
5
  isLast,
@@ -11,6 +10,7 @@ const {
11
10
  noTrailingComment,
12
11
  hasTrailingComment,
13
12
  isCoupleLines,
13
+ isInsideLabel,
14
14
  } = require('../is');
15
15
 
16
16
  const isBeforeElse = (path) => {
@@ -36,8 +36,6 @@ const shouldBreakline = satisfy([
36
36
  isStrictMode,
37
37
  ]);
38
38
 
39
- const isInsideLabel = ({parentPath}) => isLabeledStatement(parentPath);
40
-
41
39
  module.exports.ExpressionStatement = {
42
40
  print(path, {print, maybe, store}) {
43
41
  maybe.indent(!isInsideLabel(path));
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const {isInsideLabel} = require('../../is');
4
+
5
+ module.exports.LabeledStatement = (path, {print, maybe}) => {
6
+ maybe.indent(!isInsideLabel(path));
7
+ print('__label');
8
+ print(':');
9
+ print.space();
10
+ print('__body');
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "11.7.0",
3
+ "version": "11.8.0",
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 for 🐊Putout",
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports.LabeledStatement = (path, {print, indent}) => {
4
- indent();
5
- print('__label');
6
- print(':');
7
- print.space();
8
- print('__body');
9
- };