@putout/printer 2.12.0 → 2.13.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
+ 2023.06.13, v2.13.0
2
+
3
+ feature:
4
+ - 1e77dca @putout/printer: ArrayExpression: one string literal
5
+
1
6
  2023.06.13, v2.12.0
2
7
 
3
8
  feature:
package/README.md CHANGED
@@ -35,9 +35,7 @@ And update `.putout.json`:
35
35
  ```json
36
36
  {
37
37
  "printer": "putout",
38
- "plugins": [
39
- "printer"
40
- ]
38
+ "plugins": ["printer"]
41
39
  }
42
40
  ```
43
41
 
@@ -268,9 +266,7 @@ function speed(printer) {
268
266
  for (let i = 0; i < 1000; i++) {
269
267
  putout(code, {
270
268
  printer,
271
- plugins: [
272
- 'remove-unused-variables',
273
- ],
269
+ plugins: ['remove-unused-variables'],
274
270
  });
275
271
  }
276
272
 
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const {isSimple} = require('@putout/operate');
4
+
4
5
  const {
5
6
  isObjectExpression,
6
7
  isArrayExpression,
@@ -10,8 +11,8 @@ const {
10
11
  isBooleanLiteral,
11
12
  isNullLiteral,
12
13
  isStringLiteral,
13
-
14
14
  } = require('@babel/types');
15
+
15
16
  const {
16
17
  isStringAndMember,
17
18
  isStringAndIdentifier,
@@ -19,7 +20,6 @@ const {
19
20
  isCoupleLines,
20
21
  isStringAndArray,
21
22
  isIdentifierAndIdentifier,
22
-
23
23
  } = require('../../is');
24
24
 
25
25
  const {round} = Math;
@@ -129,6 +129,9 @@ function isOneSimple(path) {
129
129
  if (first.isIdentifier() && first.node.name.length < 5)
130
130
  return true;
131
131
 
132
+ if (first.isStringLiteral() && first.node.value.length > 10)
133
+ return false;
134
+
132
135
  if (!first.isIdentifier() && isSimple(first))
133
136
  return true;
134
137
 
@@ -202,6 +205,7 @@ function isLastArg({parentPath}) {
202
205
  function isParentProperty(path) {
203
206
  return path.find(isObjectProperty);
204
207
  }
208
+
205
209
  module.exports.isIncreaseIndent = isIncreaseIndent;
206
210
  function isIncreaseIndent(path) {
207
211
  const elements = path.get('elements');
@@ -9,7 +9,6 @@ const {
9
9
  isVariableDeclaration,
10
10
  isMemberExpression,
11
11
  isArrayExpression,
12
-
13
12
  } = require('@babel/types');
14
13
 
15
14
  const isParentProgram = (path) => path.parentPath?.isProgram();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.12.0",
3
+ "version": "2.13.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",