putout 42.6.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 CHANGED
@@ -1,3 +1,37 @@
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
+
9
+ 2026.06.18, v42.7.0
10
+
11
+ fix:
12
+ - 3b465e12f @putout/plugin-markdown: simplify
13
+ - 4031967e1 @putout/plugin-markdown: npmignore: fixture
14
+ - 7b7fb253b @putout/test: noTransform: extensionFix
15
+
16
+ feature:
17
+ - 94a3fdcc2 putout: add types
18
+ - 0d04bc6d2 @putotu/plugin-printer: add-missing-arrow-to-type-checker
19
+ - 9b55a8a04 @putout/plugin-convert-throw: drop support of 🐊 < 42
20
+ - 0e85d9564 eslint-plugin-putout: @babel/plugin-syntax-typescript v8.0.0
21
+ - 4cba16d5e eslint-plugin-putout: @babel/core v8.0.0
22
+ - 42dffd472 @putout/plugin-github: set-contents-permissions: exists, not write
23
+ - 44d68381e @putout/plugin-github: set-contents-permissions: report
24
+ - 02596465e @putout/plugin-github: set-contents-permissions
25
+ - 5c08b01a2 @putout/plugin-for-of: for-each: return: exclude (putoutjs/minify#31)
26
+ - 428d81d03 @putout/plugin-markdown: h1-6 -> heading
27
+ - 316a1ec0d @putout/plugin-markdown: remove-trailing-whitespaces-from-heading
28
+ - 8f897c666 @putout/plugin-markdown: remove-dependencies-status-badge
29
+ - 8dd6d4f0d @putout/plugin-putout: convert-traverse-to-super-traverse
30
+ - 95e5435f5 @putout/plugin-putout: declare: superTraverse
31
+ - 1cee4ff4b @putout/traverse: superTraverse
32
+ - 20f556566 @putout/plugin-markdown: split-link-with-title
33
+ - 0e9b89571 @putout/test: noTransform: extensionFix
34
+
1
35
  2026.06.13, v42.6.0
2
36
 
3
37
  fix:
package/lib/index.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ import {
2
+ File,
3
+ Program,
4
+ Node,
5
+ } from '@putout/babel';
6
+ import {PutoutPlugin} from '../types/plugins.ts';
7
+
8
+ export * as operator from '../types/operator.ts';
9
+
10
+ export declare function parse(source: string): Program;
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;
19
+
20
+ type PutoutReturn = {
21
+ code: string;
22
+ places: Place[];
23
+ };
24
+
25
+ export interface ParseOptions {
26
+ parser?: 'babel' | 'acorn' | 'espree' | 'esprima' | 'tenko';
27
+ printer?: 'putout' | 'babel';
28
+ isTS?: boolean;
29
+ isJSX?: boolean;
30
+ }
31
+
32
+ type RuleState = 'on' | 'off' | boolean;
33
+ type RuleOptions = Record<string, unknown>;
34
+ type RuleTuple = [
35
+ RuleState,
36
+ ] | [
37
+ RuleState,
38
+ RuleOptions,
39
+ ] | [RuleState, string, RuleOptions];
40
+ type RuleValue = RuleState | RuleTuple;
41
+
42
+ export type Rules = Record<string, RuleValue>;
43
+
44
+ export type TransformOptions = {
45
+ plugins?: (string | [string, Record<string, unknown>] | [string, PutoutPlugin])[];
46
+ rules?: Rules;
47
+ fix?: boolean;
48
+ fixCount?: number;
49
+ parser?: string;
50
+ printer?: string;
51
+ };
52
+
53
+ type Options = ParseOptions & TransformOptions;
54
+
55
+ export default function putout(source: string, options: Options): PutoutReturn;
56
+
57
+ export function putoutAsync(source: string, options: Options): Promise<PutoutReturn>;
58
+
59
+ export interface PrintOptions {
60
+ printer?: 'putout' | 'babel' | [string, Record<string, unknown>];
61
+ }
62
+
63
+ export function print(ast: File, options?: PrintOptions): string;
64
+
65
+ export interface Place {
66
+ rule: string;
67
+ message: string;
68
+ position: {
69
+ line: number;
70
+ column: number;
71
+ };
72
+ }
73
+
74
+ export function transform(ast: File, options?: TransformOptions): Place[];
75
+ export function transformAsync(ast: File, options?: TransformOptions): Promise<Place[]>;
76
+ export function findPlaces(ast: File, options?: TransformOptions): Place[];
77
+ export function findPlacesAsync(ast: File, options?: TransformOptions): Promise<Place[]>;
78
+
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.6.0",
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",
@@ -35,11 +35,10 @@
35
35
  "scripts": {
36
36
  "wisdom": "madrun wisdom",
37
37
  "test": "madrun test",
38
- "test:raw": "madrun test:raw",
38
+ "test:dts": "madrun test:dts",
39
39
  "watch:test": "madrun watch:test",
40
40
  "scheme": "madrun scheme",
41
41
  "lint": "madrun lint",
42
- "oldlint": "madrun oldlint",
43
42
  "fresh:lint": "madrun fresh:lint",
44
43
  "fix:lint": "madrun fix:lint",
45
44
  "fix:lint:fresh": "madrun fix:lint:fresh",
@@ -221,6 +220,7 @@
221
220
  "@putout/eslint-flat": "^4.0.0",
222
221
  "@putout/plugin-apply-entries": "^3.0.0",
223
222
  "@putout/test": "^15.1.0",
223
+ "check-dts": "^1.0.0",
224
224
  "currify": "^4.0.0",
225
225
  "eslint": "^10.0.0",
226
226
  "eslint-plugin-putout": "^31.0.0",
@@ -0,0 +1,2 @@
1
+ export * from '@putout/operate';
2
+
@@ -0,0 +1,36 @@
1
+ import {NodePath} from '@putout/babel';
2
+
3
+ export type Traverse = (helpers: {
4
+ push: (path: NodePath) => void;
5
+ store: (key?: string, value?: unknown) => unknown;
6
+ listStore: (path?: NodePath) => NodePath[];
7
+ pathStore: (path?: NodePath) => NodePath[];
8
+ }) => Record<string, (path: NodePath) => void>;
9
+
10
+ export interface PutoutPlugin {
11
+ report: Report;
12
+ replace?: Replace;
13
+ fix?: Fix;
14
+ include?: Include;
15
+ exclude?: Exclude;
16
+ filter?: Filter;
17
+ traverse?: Traverse;
18
+ }
19
+
20
+ export type Report = () => string;
21
+
22
+ export type Include = () => string[];
23
+
24
+ export type Exclude = () => string[] | (() => boolean);
25
+
26
+ export interface PluginOptions {
27
+ options?: Record<string, unknown>;
28
+ }
29
+
30
+ export type Filter = (path: NodePath, options: PluginOptions) => boolean;
31
+
32
+ export type Fix = (path: NodePath, options: PluginOptions) => void;
33
+
34
+ type ReplaceResolver = (vars: Record<string, Node>, path: NodePath) => string | NodePath | '';
35
+
36
+ export type Replace = () => Record<string, string | ReplaceResolver>;