putout 42.7.5 → 42.7.6

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,8 @@
1
+ 2026.06.22, v42.7.6
2
+
3
+ feature:
4
+ - d94d1b5a8 @putout/engine-parser: TS
5
+
1
6
  2026.06.21, v42.7.5
2
7
 
3
8
  feature:
package/README.md CHANGED
@@ -306,7 +306,6 @@ const source = `
306
306
  putout(source, {
307
307
  plugins: ['remove-unused-variables'],
308
308
  });
309
-
310
309
  // returns
311
310
  `
312
311
  const t = 'hello';
@@ -328,7 +327,6 @@ const source = `
328
327
  await putoutAsync(source, {
329
328
  plugins: ['remove-unused-variables'],
330
329
  });
331
-
332
330
  // returns
333
331
  `
334
332
  const t = 'hello';
package/lib/index.d.ts CHANGED
@@ -1,35 +1,34 @@
1
- import {
2
- File,
3
- Program,
4
- Node,
5
- } from '@putout/babel';
1
+ import {Program, Node} from '@putout/babel';
2
+ import {PrinterOptions, ParseOptions} from '@putout/engine-parser';
6
3
  import {PutoutPlugin} from '../types/plugins.ts';
7
-
8
4
  export type * from '../types/plugins.ts';
9
5
  export * as operator from '../types/operator.ts';
10
6
 
11
- export declare function parse(source: string): Program;
7
+ export type {
8
+ PrinterOptions,
9
+ ParseOptions,
10
+ };
12
11
  export {traverse, types} from '@putout/babel';
13
12
 
14
- export declare function template(source: string, options?: Record<string, unknown>): (...args: unknown[]) => Node;
13
+ export function parse(source: string, options?: ParseOptions): Program;
14
+
15
+ export function template(source: string, options?: Record<string, unknown>): (...args: unknown[]) => Node;
15
16
  export declare namespace template {
16
17
  export function ast(source: string, options?: Record<string, unknown>): Node;
17
18
  export function program(source: string, options?: Record<string, unknown>): (...args: unknown[]) => Node;
18
19
  export function extractExpression(node: Node): Node;
19
- } export declare function generate(node: Node, options?: Record<string, unknown>, sourceMaps?: Record<string, unknown>): string;
20
+ }
21
+ export function generate(node: Node, options?: Record<string, unknown>, sourceMaps?: Record<string, unknown>): string;
20
22
 
21
23
  type PutoutReturn = {
22
24
  code: string;
23
25
  places: Place[];
24
26
  };
25
-
26
- export interface ParseOptions {
27
- parser?: 'babel' | 'acorn' | 'espree' | 'esprima' | 'tenko';
28
- printer?: 'putout' | 'babel';
29
- isTS?: boolean;
30
- isJSX?: boolean;
31
- }
32
-
27
+ type PrinterConfig =
28
+ | 'putout'
29
+ | 'babel'
30
+ | ['putout', PrinterOptions?]
31
+ | ['babel', Record<string, unknown>?];
33
32
  type RuleState = 'on' | 'off' | boolean;
34
33
  type RuleOptions = Record<string, unknown>;
35
34
  type RuleTuple = [
@@ -48,7 +47,7 @@ export type TransformOptions = {
48
47
  fix?: boolean;
49
48
  fixCount?: number;
50
49
  parser?: string;
51
- printer?: string;
50
+ printer?: PrinterConfig;
52
51
  };
53
52
 
54
53
  type Options = ParseOptions & TransformOptions;
@@ -57,11 +56,7 @@ export default function putout(source: string, options: Options): PutoutReturn;
57
56
 
58
57
  export function putoutAsync(source: string, options: Options): Promise<PutoutReturn>;
59
58
 
60
- export interface PrintOptions {
61
- printer?: 'putout' | 'babel' | [string, Record<string, unknown>];
62
- }
63
-
64
- export function print(ast: File, options?: PrintOptions): string;
59
+ export function print(ast: Node, options?: PrinterOptions): string;
65
60
 
66
61
  export interface Place {
67
62
  rule: string;
@@ -72,10 +67,10 @@ export interface Place {
72
67
  };
73
68
  }
74
69
 
75
- export function transform(ast: File, options?: TransformOptions): Place[];
76
- export function transformAsync(ast: File, options?: TransformOptions): Promise<Place[]>;
77
- export function findPlaces(ast: File, options?: TransformOptions): Place[];
78
- export function findPlacesAsync(ast: File, options?: TransformOptions): Promise<Place[]>;
70
+ export function transform(ast: Node, options?: TransformOptions): Place[];
71
+ export function transformAsync(ast: Node, options?: TransformOptions): Promise<Place[]>;
72
+ export function findPlaces(ast: Node, options?: TransformOptions): Place[];
73
+ export function findPlacesAsync(ast: Node, options?: TransformOptions): Promise<Place[]>;
79
74
 
80
75
  export function codeframe(args: {
81
76
  source: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "42.7.5",
3
+ "version": "42.7.6",
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",