@putout/printer 17.2.0 → 17.3.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,4 +1,5 @@
|
|
|
1
1
|
import {types} from '@putout/babel';
|
|
2
|
+
import {printAttributes} from '#import-attributes';
|
|
2
3
|
import {
|
|
3
4
|
isParentBlock,
|
|
4
5
|
isNewlineBetweenSiblings,
|
|
@@ -60,7 +61,14 @@ export const ExportNamedDeclaration = {
|
|
|
60
61
|
before(path, {print}) {
|
|
61
62
|
print.linebreak();
|
|
62
63
|
},
|
|
63
|
-
print(path,
|
|
64
|
+
print(path, printer, semantics) {
|
|
65
|
+
const {
|
|
66
|
+
print,
|
|
67
|
+
traverse,
|
|
68
|
+
indent,
|
|
69
|
+
maybe,
|
|
70
|
+
} = printer;
|
|
71
|
+
|
|
64
72
|
const {trailingComma} = semantics;
|
|
65
73
|
const {exportKind} = path.node;
|
|
66
74
|
const specifiers = path.get('specifiers');
|
|
@@ -78,6 +86,7 @@ export const ExportNamedDeclaration = {
|
|
|
78
86
|
print(specifiers[0]);
|
|
79
87
|
print(' from ');
|
|
80
88
|
print('__source');
|
|
89
|
+
printAttributes(path, printer);
|
|
81
90
|
print(';');
|
|
82
91
|
maybe.print.newline(!isLast(path));
|
|
83
92
|
|
|
@@ -138,6 +147,7 @@ export const ExportNamedDeclaration = {
|
|
|
138
147
|
if (exists(source)) {
|
|
139
148
|
print(' from ');
|
|
140
149
|
traverse(source);
|
|
150
|
+
printAttributes(path, printer);
|
|
141
151
|
}
|
|
142
152
|
|
|
143
153
|
print(';');
|
|
@@ -6,13 +6,14 @@ export const ImportAttribute = (path, {print}) => {
|
|
|
6
6
|
print(',');
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const printAttributes = (path,
|
|
9
|
+
export const printAttributes = (path, {write, traverse, indent}) => {
|
|
10
10
|
const attributes = path.get('attributes');
|
|
11
11
|
|
|
12
12
|
if (!attributes.length)
|
|
13
13
|
return;
|
|
14
14
|
|
|
15
|
-
write(
|
|
15
|
+
write.space();
|
|
16
|
+
write('with');
|
|
16
17
|
write.space();
|
|
17
18
|
|
|
18
19
|
write('{');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {parseImportSpecifiers} from 'parse-import-specifiers';
|
|
2
2
|
import {isLast, isNext} from '#is';
|
|
3
|
+
import {printAttributes} from '#import-attributes';
|
|
3
4
|
import {markAfter} from '../../mark.js';
|
|
4
|
-
import {printAttributes} from './import-attribute.js';
|
|
5
5
|
import {
|
|
6
6
|
printTrailingCommentBlock,
|
|
7
7
|
printTrailingCommentLine,
|
|
@@ -95,7 +95,7 @@ export const ImportDeclaration = {
|
|
|
95
95
|
print.space();
|
|
96
96
|
|
|
97
97
|
print('__source');
|
|
98
|
-
printAttributes(path,
|
|
98
|
+
printAttributes(path, printer);
|
|
99
99
|
|
|
100
100
|
print(';');
|
|
101
101
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
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",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"#test": "./test/create-test.js",
|
|
59
59
|
"#is": "./lib/tokenize/is.js",
|
|
60
60
|
"#maybe-parens": "./lib/tokenize/maybe/maybe-parens.js",
|
|
61
|
-
"#print-params": "./lib/tokenize/expressions/function/params.js"
|
|
61
|
+
"#print-params": "./lib/tokenize/expressions/function/params.js",
|
|
62
|
+
"#import-attributes": "./lib/tokenize/statements/import-declaration/import-attribute.js"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
65
|
"@babel/parser": "^7.28.5",
|