putout 42.5.2 → 42.7.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,3 +1,68 @@
1
+ 2026.06.18, v42.7.0
2
+
3
+ fix:
4
+ - 3b465e12f @putout/plugin-markdown: simplify
5
+ - 4031967e1 @putout/plugin-markdown: npmignore: fixture
6
+ - 7b7fb253b @putout/test: noTransform: extensionFix
7
+
8
+ feature:
9
+ - 94a3fdcc2 putout: add types
10
+ - 0d04bc6d2 @putotu/plugin-printer: add-missing-arrow-to-type-checker
11
+ - 9b55a8a04 @putout/plugin-convert-throw: drop support of 🐊 < 42
12
+ - 0e85d9564 eslint-plugin-putout: @babel/plugin-syntax-typescript v8.0.0
13
+ - 4cba16d5e eslint-plugin-putout: @babel/core v8.0.0
14
+ - 42dffd472 @putout/plugin-github: set-contents-permissions: exists, not write
15
+ - 44d68381e @putout/plugin-github: set-contents-permissions: report
16
+ - 02596465e @putout/plugin-github: set-contents-permissions
17
+ - 5c08b01a2 @putout/plugin-for-of: for-each: return: exclude (putoutjs/minify#31)
18
+ - 428d81d03 @putout/plugin-markdown: h1-6 -> heading
19
+ - 316a1ec0d @putout/plugin-markdown: remove-trailing-whitespaces-from-heading
20
+ - 8f897c666 @putout/plugin-markdown: remove-dependencies-status-badge
21
+ - 8dd6d4f0d @putout/plugin-putout: convert-traverse-to-super-traverse
22
+ - 95e5435f5 @putout/plugin-putout: declare: superTraverse
23
+ - 1cee4ff4b @putout/traverse: superTraverse
24
+ - 20f556566 @putout/plugin-markdown: split-link-with-title
25
+ - 0e9b89571 @putout/test: noTransform: extensionFix
26
+
27
+ 2026.06.13, v42.6.0
28
+
29
+ fix:
30
+ - 1abfa724d @putout/plugin-markdown: main
31
+ - e74d08c91 @putout/plugin-github: add-madrun-init: madrun init -> madrun --init
32
+ - 9024f3779 @putout/plugin-github: add-madrun-init
33
+ - 9ae73318b @putout/operator-match-files: operator- > operator-json
34
+ - 4ae6ec3c8 @putout/operator-match-files: magic-print: rm beautify
35
+ - 1daa95f8c @putout/plugin-destructuring: remove-useless-rename: exclude same
36
+
37
+ feature:
38
+ - 1fb288acf @putout/plugin-markdown: merge-heading-spaces: not string
39
+ - 783c6d962 @putout/plugin-markdown: add
40
+ - e31b4357b putout: @putout/processor-markdown v14.0.0
41
+ - ff08aa120 @putout/plugin-markdown: add
42
+ - 7243a8a1c @putout/plugin-putout: declare: __markdown
43
+ - 1deeb22a4 @putout/processor-markdown: add ability to write 🐊Plugins to transform markdown
44
+ - 3cde73957 @putout/operator-json: __markdown
45
+ - 8cf53a90c @putout/plugin-printer: remove-args: ImportSpecifier: exclude
46
+ - bcd307098 @putout/plugin-github: add-madrun-init
47
+ - da41a1335 @putout/test: extensionFix
48
+ - 47a02bc78 @putout/test: UPDATE_EXTENSION
49
+ - 7ef878fd9 @putout/plugin-destructuring: remove-useless-rename
50
+ - 9891a8bc2 @putout/plugin-filesystem: convert-yaml-to-toml
51
+ - 68e9587ee @putout/plugin-convert-toml-to-yaml
52
+ - 236480ddd @putout/plugin-filesystem: convert-toml-to-json
53
+ - 6489ec337 @putout/plugin-filesystem: convert-json-to-toml
54
+ - 48c2c32a2 @putout/processor-toml: smol-toml -> @decimalturn/toml-patch
55
+ - a5b979703 @putout/plugin-putout: check-replace-code: __toml
56
+ - e0c225e54 @putout/processor-toml: beautify
57
+ - b23243234 @putout/operator-match-files: toml
58
+ - 2dff587da @putout/plugin-declare: wrap: callWith: add
59
+ - 54b1a9b51 @putout/plugin-filesystem: convert-json-to-yaml: add
60
+ - 8f9481e59 @putout/operator-match-files: json to yaml
61
+ - bc2df02c0 @putout/plugin-filesystem: private imports
62
+ - c057a209c @putout/plugin-putout: check-replace-code: __yaml
63
+ - da1ad34bf @putout/plugin-filesystem: convert-yaml-to-json: add
64
+ - 92fbc982d @putout/operator-match-files: add support of yaml
65
+
1
66
  2026.06.05, v42.5.2
2
67
 
3
68
  feature:
package/lib/index.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ import {File, Program} from '@putout/babel';
2
+ import {PutoutPlugin} from '../types/plugins.ts';
3
+
4
+ export declare function parse(source: string): Program;
5
+ export {traverse} from '@putout/babel';
6
+
7
+ type PutoutReturn = {
8
+ code: string;
9
+ places: Place[];
10
+ };
11
+
12
+ export interface ParseOptions {
13
+ parser?: 'babel' | 'acorn' | 'espree' | 'esprima' | 'tenko';
14
+ printer?: 'putout' | 'babel';
15
+ isTS?: boolean;
16
+ isJSX?: boolean;
17
+ }
18
+
19
+ type RuleState = 'on' | 'off' | boolean;
20
+ type RuleOptions = Record<string, unknown>;
21
+
22
+ type RuleTuple =
23
+ | [RuleState]
24
+ | [RuleState, RuleOptions]
25
+ | [RuleState, string, RuleOptions]; // [state, message, options] — кастомный текст сообщения
26
+
27
+ type RuleValue = RuleState | RuleTuple;
28
+
29
+ export type Rules = Record<string, RuleValue>;
30
+
31
+ export type TransformOptions = {
32
+ plugins?: (string | [string, Record<string, unknown>] | [string, PutoutPlugin])[];
33
+ rules?: Rules;
34
+ fix?: boolean;
35
+ fixCount?: number;
36
+ parser?: string;
37
+ printer?: string;
38
+ };
39
+
40
+ type Options = ParseOptions & TransformOptions;
41
+
42
+ export default function putout(source: string, options: Options): PutoutReturn;
43
+
44
+ export interface PrintOptions {
45
+ printer?: 'putout' | 'babel' | [string, Record<string, unknown>];
46
+ }
47
+
48
+ export function print(ast: File, options?: PrintOptions): string;
49
+
50
+ export interface Place {
51
+ rule: string;
52
+ message: string;
53
+ position: {line: number; column: number};
54
+ }
55
+
56
+ export function transform(ast: File, options?: TransformOptions): Place[];
57
+ export function transformAsync(ast: File, options?: TransformOptions): Promise<Place[]>;
58
+ export function findPlaces(ast: File, options?: TransformOptions): Place[];
59
+ export function findPlacesAsync(ast: File, options?: TransformOptions): Promise<Place[]>;
60
+
61
+ export function codeframe(args: {source: string; error: {message: string; loc?: unknown}; highlightCode?: boolean}): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "42.5.2",
3
+ "version": "42.7.0",
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",
@@ -128,6 +127,7 @@
128
127
  "@putout/plugin-labels": "^3.0.0",
129
128
  "@putout/plugin-logical-expressions": "^8.0.0",
130
129
  "@putout/plugin-madrun": "^23.0.0",
130
+ "@putout/plugin-markdown": "^1.0.0",
131
131
  "@putout/plugin-math": "^5.0.0",
132
132
  "@putout/plugin-maybe": "^5.0.0",
133
133
  "@putout/plugin-merge-duplicate-functions": "^4.0.0",
@@ -183,7 +183,7 @@
183
183
  "@putout/processor-ignore": "^7.0.0",
184
184
  "@putout/processor-javascript": "^5.0.0",
185
185
  "@putout/processor-json": "^10.0.0",
186
- "@putout/processor-markdown": "^13.0.0",
186
+ "@putout/processor-markdown": "^14.0.0",
187
187
  "@putout/processor-toml": "^1.0.0",
188
188
  "@putout/processor-yaml": "^10.0.0",
189
189
  "@putout/traverse": "^16.0.0",
@@ -220,6 +220,7 @@
220
220
  "@putout/eslint-flat": "^4.0.0",
221
221
  "@putout/plugin-apply-entries": "^3.0.0",
222
222
  "@putout/test": "^15.1.0",
223
+ "check-dts": "^1.0.0",
223
224
  "currify": "^4.0.0",
224
225
  "eslint": "^10.0.0",
225
226
  "eslint-plugin-putout": "^31.0.0",
package/putout.json CHANGED
@@ -58,6 +58,7 @@
58
58
  "esm/shorten-imported-file": "on"
59
59
  },
60
60
  "*.md": {
61
+ "markdown": "on",
61
62
  "apply-arrow": "off",
62
63
  "assignment/convert-to-declaration": "off",
63
64
  "conditions/apply-consistent-blocks": "off",
@@ -195,6 +196,7 @@
195
196
  "eslint": "off",
196
197
  "package-json": "off",
197
198
  "madrun": "off",
199
+ "markdown": "off",
198
200
  "webpack": "off",
199
201
  "gitignore": "off",
200
202
  "npmignore": "off",
@@ -281,6 +283,7 @@
281
283
  "coverage",
282
284
  "gitignore",
283
285
  "npmignore",
286
+ "markdown",
284
287
  "browserlist",
285
288
  "regexp",
286
289
  "github",
@@ -0,0 +1,38 @@
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
+ export type Exclude = () => string[] | (() => boolean);
24
+
25
+ export interface PluginOptions {
26
+ options?: Record<string, unknown>;
27
+ }
28
+
29
+ export type Filter = (path: NodePath, options: PluginOptions) => boolean;
30
+ export type Fix = (path: NodePath, options: PluginOptions) => void;
31
+
32
+ type ReplaceResolver = (
33
+ vars: Record<string, Node>,
34
+ path: NodePath,
35
+ ) => string | NodePath | '';
36
+
37
+ export type Replace = () => Record<string, string | ReplaceResolver>;
38
+