@putout/printer 18.20.2 → 18.21.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/lib/printer.d.ts +19 -19
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/lib/printer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {type Node} from '@putout/babel';
|
|
2
2
|
|
|
3
|
-
interface Format {
|
|
3
|
+
export interface Format {
|
|
4
4
|
indent: string;
|
|
5
5
|
newline: string;
|
|
6
6
|
space: string;
|
|
@@ -8,7 +8,7 @@ interface Format {
|
|
|
8
8
|
quote: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
interface Semantics {
|
|
11
|
+
export interface Semantics {
|
|
12
12
|
roundBraces: boolean;
|
|
13
13
|
comments: boolean;
|
|
14
14
|
maxPropertiesInOneLine: number;
|
|
@@ -18,46 +18,46 @@ interface Semantics {
|
|
|
18
18
|
trailingComma: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
type Print = (input: string |
|
|
22
|
-
type Indent = () => void;
|
|
23
|
-
type Traverse = (input:
|
|
24
|
-
type MaybeCondition = (condition: boolean) => void;
|
|
21
|
+
export type Print = (input: string | Node) => void;
|
|
22
|
+
export type Indent = () => void;
|
|
23
|
+
export type Traverse = (input: Node) => void;
|
|
24
|
+
export type MaybeCondition = (condition: boolean) => void;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
export type MaybeIndent = {
|
|
27
|
+
(condition: boolean): void;
|
|
27
28
|
inc: MaybeCondition;
|
|
28
29
|
dec: MaybeCondition;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
type
|
|
33
|
-
type MaybeTraverse = (condition: boolean, input: types.Node) => void;
|
|
32
|
+
export type MaybePrint = (condition: boolean, input: string | Node) => void;
|
|
33
|
+
export type MaybeTraverse = (condition: boolean, input: Node) => void;
|
|
34
34
|
|
|
35
|
-
interface Maybe {
|
|
35
|
+
export interface Maybe {
|
|
36
36
|
print: MaybePrint;
|
|
37
37
|
traverse: MaybeTraverse;
|
|
38
38
|
indent: typeof MaybeIndent;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
interface Printer {
|
|
41
|
+
export interface Printer {
|
|
42
42
|
print: Print;
|
|
43
43
|
maybe: Maybe;
|
|
44
44
|
indent: Indent;
|
|
45
45
|
traverse: Traverse;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
type Visitor = (path:
|
|
48
|
+
export type Visitor = (path: Node, printer: Printer, semantics?: Semantics) => void;
|
|
49
49
|
|
|
50
|
-
interface Visitors {
|
|
50
|
+
export interface Visitors {
|
|
51
51
|
[name: string]: Visitor;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
interface Options {
|
|
54
|
+
export interface Options {
|
|
55
55
|
format?: Format;
|
|
56
56
|
semantics?: Semantics;
|
|
57
57
|
visitors?: Visitors;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export function print(ast:
|
|
60
|
+
export function print(ast: Node, options?: Options): string;
|
|
61
61
|
|
|
62
|
-
declare function maybeVisitor(plugin: Visitor, path:
|
|
63
|
-
export const visitors
|
|
62
|
+
export declare function maybeVisitor(plugin: Visitor, path: Node, printer: Print, semantics: Semantics): void;
|
|
63
|
+
export const visitors: Visitors;
|
package/package.json
CHANGED