@putout/printer 4.1.0 → 4.2.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 +6 -0
- package/README.md +9 -2
- package/lib/json.js +1 -1
- package/lib/tokenize/comment/parse-leading-comments.js +1 -1
- package/lib/tokenize/debug.js +2 -2
- package/lib/tokenize/expressions/array-expression/array-expression.js +1 -1
- package/lib/tokenize/expressions/array-expression/new-line.js +1 -1
- package/lib/tokenize/expressions/assignment-expression.js +1 -1
- package/lib/tokenize/expressions/binary-expression/concatanate.js +1 -1
- package/lib/tokenize/expressions/member-expression/member-expressions.js +1 -1
- package/lib/tokenize/expressions/object-pattern/object-pattern.js +1 -1
- package/lib/tokenize/is.js +1 -1
- package/lib/tokenize/maybe/index.js +1 -1
- package/lib/tokenize/statements/block-statement/block-statement.js +1 -1
- package/lib/tokenize/statements/export-declaration/export-declaration.js +1 -1
- package/lib/tokenize/statements/variable-declaration/variable-declaration.js +1 -1
- package/lib/tokenize/tokenize.js +1 -1
- package/lib/tokenize/typescript/interface/ts-interface-declaration.js +1 -1
- package/lib/tokenize/typescript/ts-mapped-type.js +1 -1
- package/lib/tokenize/typescript/type/ts-type-literal.js +1 -1
- package/package.json +2 -5
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
# Printer [![NPM version][NPMIMGURL]][NPMURL]
|
|
1
|
+
# Printer [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
|
2
2
|
|
|
3
|
-
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/printer.svg?style=flat&longCache=true
|
|
4
3
|
[NPMURL]: https://npmjs.org/package/@putout/printer "npm"
|
|
4
|
+
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/printer.svg?style=flat&longCache=true
|
|
5
|
+
[BuildStatusURL]: https://github.com/putoutjs/printer/actions/workflows/nodejs.yml "Build Status"
|
|
6
|
+
[BuildStatusIMGURL]: https://github.com/putoutjs/printer/actions/workflows/nodejs.yml/badge.svg
|
|
7
|
+
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
|
|
8
|
+
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
|
|
9
|
+
[CoverageURL]: https://coveralls.io/github/putoutjs/printer?branch=master
|
|
10
|
+
[CoverageIMGURL]: https://coveralls.io/repos/putoutjs/printer/badge.svg?branch=master&service=github
|
|
5
11
|
|
|
6
12
|
Prints [**Babel AST**](https://github.com/coderaiser/estree-to-babel) to readable **JavaScript**. For Babel 7 use `@putout/printer` v2.
|
|
7
13
|
|
|
@@ -15,6 +21,7 @@ Supports:
|
|
|
15
21
|
- ✅ **ES2023**;
|
|
16
22
|
- ✅ **JSX**;
|
|
17
23
|
- ✅ **TypeScript**;
|
|
24
|
+
- ✅ [**JSON**](https://github.com/coderaiser/putout/tree/master/packages/processor-json#readme);
|
|
18
25
|
|
|
19
26
|
## Install
|
|
20
27
|
|
package/lib/json.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {hasTrailingComment} = require('../is');
|
|
4
|
-
const {isVariableDeclarator} = require('@babel
|
|
4
|
+
const {isVariableDeclarator} = require('@putout/babel').types;
|
|
5
5
|
|
|
6
6
|
const {markBefore} = require('../mark');
|
|
7
7
|
const {maybeInsideFn} = require('./maybe-inside-fn');
|
package/lib/tokenize/debug.js
CHANGED
|
@@ -4,6 +4,8 @@ const {stringify} = JSON;
|
|
|
4
4
|
const {TYPES} = require('../types');
|
|
5
5
|
const toSnakeCase = require('just-snake-case');
|
|
6
6
|
|
|
7
|
+
const {codeFrameColumns} = require('@putout/babel');
|
|
8
|
+
|
|
7
9
|
const {
|
|
8
10
|
LOG,
|
|
9
11
|
LOG_ALL,
|
|
@@ -12,8 +14,6 @@ const {
|
|
|
12
14
|
DEBUG,
|
|
13
15
|
} = process.env;
|
|
14
16
|
|
|
15
|
-
const {codeFrameColumns} = require('@babel/code-frame');
|
|
16
|
-
|
|
17
17
|
module.exports.createDebug = (tokens) => (a) => {
|
|
18
18
|
if (!DEBUG)
|
|
19
19
|
return;
|
package/lib/tokenize/is.js
CHANGED
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
isVariableDeclaration,
|
|
10
10
|
isMemberExpression,
|
|
11
11
|
isArrayExpression,
|
|
12
|
-
} = require('@babel
|
|
12
|
+
} = require('@putout/babel').types;
|
|
13
13
|
|
|
14
14
|
const isParentProgram = (path) => path.parentPath?.isProgram();
|
|
15
15
|
const isParentBlock = (path) => path.parentPath.isBlockStatement();
|
|
@@ -8,7 +8,7 @@ const {
|
|
|
8
8
|
} = require('../../is');
|
|
9
9
|
|
|
10
10
|
const {markAfter, isMarkedAfter} = require('../../mark');
|
|
11
|
-
const {isExportNamespaceSpecifier} = require('@babel
|
|
11
|
+
const {isExportNamespaceSpecifier} = require('@putout/babel').types;
|
|
12
12
|
const isDeclarationNewline = (path) => isMarkedAfter(path.get('declaration'));
|
|
13
13
|
const isInsideNamespace = (path) => path.parentPath.isTSModuleBlock();
|
|
14
14
|
|
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
} = require('../../is');
|
|
10
10
|
|
|
11
11
|
const {hasPrevNewline} = require('../../mark');
|
|
12
|
-
const {isExportDeclaration} = require('@babel
|
|
12
|
+
const {isExportDeclaration} = require('@putout/babel').types;
|
|
13
13
|
const {maybeSpaceAfterKeyword} = require('./maybe-space-after-keyword');
|
|
14
14
|
|
|
15
15
|
const {isConcatenation} = require('../../expressions/binary-expression/concatanate');
|
package/lib/tokenize/tokenize.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const {round} = Math;
|
|
4
4
|
const fullstore = require('fullstore');
|
|
5
5
|
const isObject = (a) => a && typeof a === 'object';
|
|
6
|
-
const babelTraverse = require('@babel
|
|
6
|
+
const babelTraverse = require('@putout/babel').traverse;
|
|
7
7
|
const expressions = require('./expressions');
|
|
8
8
|
const statements = require('./statements');
|
|
9
9
|
const literals = require('./literals');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.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",
|
|
@@ -26,10 +26,7 @@
|
|
|
26
26
|
"report": "madrun report"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel
|
|
30
|
-
"@babel/parser": "^7.19.0",
|
|
31
|
-
"@babel/traverse": "^7.21.2",
|
|
32
|
-
"@babel/types": "^7.21.3",
|
|
29
|
+
"@putout/babel": "^1.1.1",
|
|
33
30
|
"@putout/compare": "^12.0.4",
|
|
34
31
|
"@putout/operate": "^10.0.2",
|
|
35
32
|
"@putout/processor-json": "^7.0.0",
|