putout 42.7.0 → 42.7.1
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 +8 -0
- package/lib/index.d.ts +36 -10
- package/package.json +1 -1
- package/types/operator.ts +2 -0
- package/types/plugins.ts +3 -5
package/ChangeLog
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
2026.06.19, v42.7.1
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 50f2d6089 @putout/operate: types
|
|
5
|
+
- 01b034621 putout: types: improve
|
|
6
|
+
- 26232a0f0 @putout/plugin-variables: remove-unused: TSImportEqualsDeclaration
|
|
7
|
+
- acbfed8bf @putout/engine-loader: add additional validate of state
|
|
8
|
+
|
|
1
9
|
2026.06.18, v42.7.0
|
|
2
10
|
|
|
3
11
|
fix:
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
File,
|
|
3
|
+
Program,
|
|
4
|
+
Node,
|
|
5
|
+
} from '@putout/babel';
|
|
2
6
|
import {PutoutPlugin} from '../types/plugins.ts';
|
|
3
7
|
|
|
8
|
+
export * as operator from '../types/operator.ts';
|
|
9
|
+
|
|
4
10
|
export declare function parse(source: string): Program;
|
|
5
|
-
export {traverse} from '@putout/babel';
|
|
11
|
+
export {traverse, types} from '@putout/babel';
|
|
12
|
+
|
|
13
|
+
export declare function template(source: string, options?: Record<string, unknown>): (...args: unknown[]) => Node;
|
|
14
|
+
export declare namespace template {
|
|
15
|
+
export function ast(source: string, options?: Record<string, unknown>): Node;
|
|
16
|
+
export function program(source: string, options?: Record<string, unknown>): (...args: unknown[]) => Node;
|
|
17
|
+
export function extractExpression(node: Node): Node;
|
|
18
|
+
} export declare function generate(node: Node, options?: Record<string, unknown>, sourceMaps?: Record<string, unknown>): string;
|
|
6
19
|
|
|
7
20
|
type PutoutReturn = {
|
|
8
21
|
code: string;
|
|
@@ -18,12 +31,12 @@ export interface ParseOptions {
|
|
|
18
31
|
|
|
19
32
|
type RuleState = 'on' | 'off' | boolean;
|
|
20
33
|
type RuleOptions = Record<string, unknown>;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
type RuleTuple = [
|
|
35
|
+
RuleState,
|
|
36
|
+
] | [
|
|
37
|
+
RuleState,
|
|
38
|
+
RuleOptions,
|
|
39
|
+
] | [RuleState, string, RuleOptions];
|
|
27
40
|
type RuleValue = RuleState | RuleTuple;
|
|
28
41
|
|
|
29
42
|
export type Rules = Record<string, RuleValue>;
|
|
@@ -41,6 +54,8 @@ type Options = ParseOptions & TransformOptions;
|
|
|
41
54
|
|
|
42
55
|
export default function putout(source: string, options: Options): PutoutReturn;
|
|
43
56
|
|
|
57
|
+
export function putoutAsync(source: string, options: Options): Promise<PutoutReturn>;
|
|
58
|
+
|
|
44
59
|
export interface PrintOptions {
|
|
45
60
|
printer?: 'putout' | 'babel' | [string, Record<string, unknown>];
|
|
46
61
|
}
|
|
@@ -50,7 +65,10 @@ export function print(ast: File, options?: PrintOptions): string;
|
|
|
50
65
|
export interface Place {
|
|
51
66
|
rule: string;
|
|
52
67
|
message: string;
|
|
53
|
-
position: {
|
|
68
|
+
position: {
|
|
69
|
+
line: number;
|
|
70
|
+
column: number;
|
|
71
|
+
};
|
|
54
72
|
}
|
|
55
73
|
|
|
56
74
|
export function transform(ast: File, options?: TransformOptions): Place[];
|
|
@@ -58,4 +76,12 @@ export function transformAsync(ast: File, options?: TransformOptions): Promise<P
|
|
|
58
76
|
export function findPlaces(ast: File, options?: TransformOptions): Place[];
|
|
59
77
|
export function findPlacesAsync(ast: File, options?: TransformOptions): Promise<Place[]>;
|
|
60
78
|
|
|
61
|
-
export function codeframe(args: {
|
|
79
|
+
export function codeframe(args: {
|
|
80
|
+
source: string;
|
|
81
|
+
error: {
|
|
82
|
+
message: string;
|
|
83
|
+
loc?: unknown;
|
|
84
|
+
};
|
|
85
|
+
highlightCode?: boolean;
|
|
86
|
+
}): string;
|
|
87
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "42.7.
|
|
3
|
+
"version": "42.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json",
|
package/types/plugins.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface PutoutPlugin {
|
|
|
20
20
|
export type Report = () => string;
|
|
21
21
|
|
|
22
22
|
export type Include = () => string[];
|
|
23
|
+
|
|
23
24
|
export type Exclude = () => string[] | (() => boolean);
|
|
24
25
|
|
|
25
26
|
export interface PluginOptions {
|
|
@@ -27,12 +28,9 @@ export interface PluginOptions {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export type Filter = (path: NodePath, options: PluginOptions) => boolean;
|
|
31
|
+
|
|
30
32
|
export type Fix = (path: NodePath, options: PluginOptions) => void;
|
|
31
33
|
|
|
32
|
-
type ReplaceResolver = (
|
|
33
|
-
vars: Record<string, Node>,
|
|
34
|
-
path: NodePath,
|
|
35
|
-
) => string | NodePath | '';
|
|
34
|
+
type ReplaceResolver = (vars: Record<string, Node>, path: NodePath) => string | NodePath | '';
|
|
36
35
|
|
|
37
36
|
export type Replace = () => Record<string, string | ReplaceResolver>;
|
|
38
|
-
|