@putout/printer 5.9.0 → 5.11.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
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Prints [**Babel AST**](https://github.com/coderaiser/estree-to-babel) to readabl
|
|
|
14
14
|
- ☝️ Similar to **Recast**, but [twice faster](#speed-comparison), also simpler and easier in maintenance, since it supports only **Babel**.
|
|
15
15
|
- ☝️ As opinionated as **Prettier**, but has more user-friendly output and works directly with **AST**.
|
|
16
16
|
- ☝️ Like **ESLint** but works directly with **Babel AST**.
|
|
17
|
-
- ☝️ Easily extendable with help of [Overrides](
|
|
17
|
+
- ☝️ Easily extendable with help of [Overrides](#overrides).
|
|
18
18
|
|
|
19
19
|
Supports:
|
|
20
20
|
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
module.exports.ImportAttribute = ImportAttribute;
|
|
15
15
|
module.exports.ImportDeclaration = {
|
|
16
16
|
print(path, {print, maybe, write, traverse, indent}, options) {
|
|
17
|
+
const {phase} = path.node;
|
|
17
18
|
const isType = path.node.importKind === 'type';
|
|
18
19
|
const specifiers = path.get('specifiers');
|
|
19
20
|
const {maxSpecifiersInOneLine} = options;
|
|
@@ -21,6 +22,7 @@ module.exports.ImportDeclaration = {
|
|
|
21
22
|
indent();
|
|
22
23
|
write('import');
|
|
23
24
|
maybe.write(isType, ' type');
|
|
25
|
+
maybe.write(phase, ` ${phase}`);
|
|
24
26
|
|
|
25
27
|
let wasSpecifier = false;
|
|
26
28
|
const n = specifiers.length - 1;
|
package/lib/tokenize/tokenize.js
CHANGED
|
@@ -171,6 +171,7 @@ module.exports.tokenize = (ast, overrides) => {
|
|
|
171
171
|
dec: maybeIndentDec,
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
+
// should never change to avoid unexpected errors related to printing path, since it hard to debug
|
|
174
175
|
const mainPrinter = freeze({
|
|
175
176
|
indent,
|
|
176
177
|
write,
|
|
@@ -233,7 +234,7 @@ module.exports.tokenize = (ast, overrides) => {
|
|
|
233
234
|
print: maybePrint,
|
|
234
235
|
});
|
|
235
236
|
|
|
236
|
-
maybeThrow(!currentTraverse, path,
|
|
237
|
+
maybeThrow(!currentTraverse, path, `☝️Node type '{{ type }}' is not supported yet by @putout/printer: '{{ path }}'`);
|
|
237
238
|
|
|
238
239
|
const currentIndent = i;
|
|
239
240
|
parseLeadingComments(path, printer, semantics);
|
package/package.json
CHANGED