putout 41.4.4 → 41.5.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,32 @@
1
+ 2026.01.04, v41.5.1
2
+
3
+ feature:
4
+ - 84dfaf5fc putout: @putout/operator-parens v4.0.0
5
+ - a912ca593 @putout/operator-parens: migrate to ESM
6
+ - a2f4ba9bd @putout/plugin-nodejs: convert-commonjs-to-esm: exports: value as function
7
+ - e7904d5d9 @putout/plugin-nodejs: convert-commonjs-to-esm: ObjectMethod: improve support
8
+ - f4b0c953d @putout/engine-parser: @putout/printer v17.0.0
9
+ - a9f532346 @putout/plugin-printer: drop support of 🐊 < 41
10
+ - de6a1c375 @putout/plugin-printer: remove-legacy-test-declaration: esm
11
+ - 5769d9b98 @putout/plugin-nodejs: convert-commonjs-to-esm: exports: ObjectMethod: exclude
12
+ - 439a36dee @putout/plugin-nodejs: convert-commonjs-to-esm: exports: exclude spread
13
+ - 394460485 eslint-plugin-putout: globals v17.0.0
14
+ - e0fec513f @putout/eslint-config: globals v17.0.0
15
+ - 3590e41cf @putout/processor-svelte: drop support of 🐊 < 41
16
+ - 1631b0450 eslint-plugin-putout: migrate putout to ESM
17
+ - 665cd60ea putout: migrate to ESM
18
+
19
+ 2026.01.03, v41.5.0
20
+
21
+ feature:
22
+ - bea1d5138 eslint-plugin-putout: migrate putout to ESM
23
+ - 7c4c2adbc putout: migrate to ESM
24
+ - 340a4feba putout: @putout/processor-css v12.0.0
25
+ - 1e529e70d @putout/processor-css: drop support of node < 22
26
+ - 18d6bec9f @putout/plugin-nodejs: convert-commonjs-to-esm: require: export const = require
27
+ - 19a3d1a0a @putout/plugin-esm: merge-export-declarations: improve numbering
28
+ - 451e899de @putout/engine-parser: migrate to ESM
29
+
1
30
  2026.01.03, v41.4.4
2
31
 
3
32
  fix:
package/lib/index.cjs ADDED
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ const {types, traverse} = require('@putout/babel');
4
+ const {
5
+ template,
6
+ generate,
7
+ print,
8
+ parse,
9
+ } = require('@putout/engine-parser');
10
+
11
+ const {putout, putoutAsync} = require('./putout.js');
12
+
13
+ const {
14
+ findPlacesAsync,
15
+ findPlaces,
16
+ } = require('./find-places.js');
17
+
18
+ const {transformAsync, transform} = require('./transform.js');
19
+ const operator = require('./operator.js');
20
+
21
+ const {codeframe} = require('./codeframe.js');
22
+
23
+ module.exports = putout;
24
+ module.exports.putout = putout;
25
+ module.exports.putoutAsync = putoutAsync;
26
+ module.exports.operator = operator;
27
+ module.exports.codeframe = codeframe;
28
+ module.exports.template = template;
29
+ module.exports.generate = generate;
30
+ module.exports.print = print;
31
+ module.exports.parse = parse;
32
+ module.exports.transform = transform;
33
+ module.exports.transformAsync = transformAsync;
34
+ module.exports.types = types;
35
+ module.exports.findPlaces = findPlaces;
36
+ module.exports.findPlacesAsync = findPlacesAsync;
37
+ module.exports.traverse = traverse;
package/lib/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import {putout} from './putout.js';
2
+
3
+ export {putoutAsync} from './putout.js';
4
+ export {types, traverse} from '@putout/babel';
5
+ export {
6
+ template,
7
+ generate,
8
+ print,
9
+ parse,
10
+ } from '@putout/engine-parser';
11
+ export {transformAsync, transform} from './transform.js';
12
+ export * as operator from './operator.js';
13
+ export {findPlacesAsync, findPlaces} from './find-places.js';
14
+ export {codeframe} from './codeframe.js';
15
+
16
+ export default putout;
17
+
18
+ export {
19
+ putout,
20
+ };
package/lib/lint/json.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {branch, merge} from '@putout/processor-json';
2
- import putout from '../putout.js';
2
+ import {putout} from '../putout.js';
3
3
 
4
4
  export const lintJSON = (rawSource, options) => {
5
5
  const list = branch(rawSource);
@@ -0,0 +1,15 @@
1
+ export * from '@putout/operate';
2
+ export * from '@putout/compare';
3
+ export * from '@putout/traverse';
4
+ export * from '@putout/operator-json';
5
+ export * from '@putout/operator-jsx';
6
+ export * from '@putout/operator-declare';
7
+ export * from '@putout/operator-regexp';
8
+ export * from '@putout/operator-add-args';
9
+ export * from '@putout/operator-filesystem';
10
+ export * from '@putout/operator-keyword';
11
+ export * from '@putout/operator-match-files';
12
+ export * from '@putout/operator-rename-files';
13
+ export * from '@putout/operator-ignore';
14
+ export * from '@putout/operator-parens';
15
+
package/lib/putout.js CHANGED
@@ -1,4 +1,92 @@
1
- import {putout} from './putout.cjs';
1
+ import {parse, print} from '@putout/engine-parser';
2
+ import {cutShebang, mergeShebang} from './shebang.js';
3
+ import {defaultOptions} from './default-options.js';
4
+ import {transform, transformAsync} from './transform.js';
2
5
 
3
- export * from './putout.cjs';
4
- export default putout;
6
+ export const putout = (source, opts) => {
7
+ check(source);
8
+ opts = defaultOptions(opts);
9
+
10
+ const {
11
+ parser,
12
+ isTS,
13
+ isJSX,
14
+ printer,
15
+ } = opts;
16
+
17
+ const [clearSource, shebang] = cutShebang(source);
18
+
19
+ const ast = parse(clearSource, {
20
+ parser,
21
+ isTS,
22
+ isJSX,
23
+ printer,
24
+ });
25
+
26
+ const places = transform(ast, source, opts);
27
+
28
+ if (!opts.fix)
29
+ return {
30
+ code: source,
31
+ places,
32
+ };
33
+
34
+ const printed = print(ast, {
35
+ printer,
36
+ source,
37
+ });
38
+
39
+ const code = mergeShebang(shebang, printed);
40
+
41
+ return {
42
+ code,
43
+ places,
44
+ };
45
+ };
46
+
47
+ export const putoutAsync = async (source, opts) => {
48
+ check(source);
49
+ opts = defaultOptions(opts);
50
+
51
+ const {
52
+ parser,
53
+ isTS,
54
+ isJSX,
55
+ printer,
56
+ } = opts;
57
+
58
+ const [clearSource, shebang] = cutShebang(source);
59
+
60
+ const ast = parse(clearSource, {
61
+ parser,
62
+ isTS,
63
+ isJSX,
64
+ printer,
65
+ });
66
+
67
+ const places = await transformAsync(ast, source, opts);
68
+
69
+ if (!opts.fix)
70
+ return {
71
+ code: source,
72
+ places,
73
+ };
74
+
75
+ const printed = print(ast, {
76
+ printer,
77
+ });
78
+
79
+ const code = mergeShebang(shebang, printed);
80
+
81
+ return {
82
+ code,
83
+ places,
84
+ };
85
+ };
86
+
87
+ const isString = (a) => typeof a === 'string';
88
+
89
+ function check(source) {
90
+ if (!isString(source))
91
+ throw Error(`☝️ Looks like 'source' has type '${typeof source}', expected: 'string'`);
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "41.4.4",
3
+ "version": "41.5.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",
@@ -8,8 +8,8 @@
8
8
  "main": "./lib/putout.js",
9
9
  "exports": {
10
10
  ".": {
11
- "require": "./lib/putout.cjs",
12
- "import": "./lib/putout.js"
11
+ "require": "./lib/index.cjs",
12
+ "import": "./lib/index.js"
13
13
  },
14
14
  "./parse-error": "./lib/parse-error.js",
15
15
  "./parse-options": "./lib/parse-options/index.js",
@@ -86,7 +86,7 @@
86
86
  "@putout/operator-jsx": "^2.0.0",
87
87
  "@putout/operator-keyword": "^4.0.0",
88
88
  "@putout/operator-match-files": "^10.0.0",
89
- "@putout/operator-parens": "^3.0.0",
89
+ "@putout/operator-parens": "^4.0.0",
90
90
  "@putout/operator-regexp": "^4.0.0",
91
91
  "@putout/operator-rename-files": "^6.0.0",
92
92
  "@putout/plugin-apply-arrow": "^3.0.0",
@@ -172,7 +172,7 @@
172
172
  "@putout/plugin-typescript": "^12.0.0",
173
173
  "@putout/plugin-variables": "^1.0.0",
174
174
  "@putout/plugin-webpack": "^4.0.0",
175
- "@putout/processor-css": "^11.0.0",
175
+ "@putout/processor-css": "^12.0.0",
176
176
  "@putout/processor-filesystem": "^7.0.0",
177
177
  "@putout/processor-ignore": "^6.0.0",
178
178
  "@putout/processor-javascript": "^5.0.0",
package/lib/putout.cjs DELETED
@@ -1,142 +0,0 @@
1
- 'use strict';
2
-
3
- const {traverse, types} = require('@putout/babel');
4
- const {
5
- parse,
6
- print,
7
- generate,
8
- template,
9
- } = require('@putout/engine-parser');
10
-
11
- const {cutShebang, mergeShebang} = require('./shebang');
12
- const {defaultOptions} = require('./default-options');
13
- const {transform, transformAsync} = require('./transform');
14
-
15
- const {
16
- findPlaces,
17
- findPlacesAsync,
18
- } = require('./find-places');
19
-
20
- module.exports = putout;
21
- module.exports.putout = putout;
22
-
23
- function putout(source, opts) {
24
- check(source);
25
- opts = defaultOptions(opts);
26
-
27
- const {
28
- parser,
29
- isTS,
30
- isJSX,
31
- printer,
32
- } = opts;
33
-
34
- const [clearSource, shebang] = cutShebang(source);
35
-
36
- const ast = parse(clearSource, {
37
- parser,
38
- isTS,
39
- isJSX,
40
- printer,
41
- });
42
-
43
- const places = transform(ast, source, opts);
44
-
45
- if (!opts.fix)
46
- return {
47
- code: source,
48
- places,
49
- };
50
-
51
- const printed = print(ast, {
52
- printer,
53
- source,
54
- });
55
-
56
- const code = mergeShebang(shebang, printed);
57
-
58
- return {
59
- code,
60
- places,
61
- };
62
- }
63
-
64
- module.exports.putoutAsync = async (source, opts) => {
65
- check(source);
66
- opts = defaultOptions(opts);
67
-
68
- const {
69
- parser,
70
- isTS,
71
- isJSX,
72
- printer,
73
- } = opts;
74
-
75
- const [clearSource, shebang] = cutShebang(source);
76
-
77
- const ast = parse(clearSource, {
78
- parser,
79
- isTS,
80
- isJSX,
81
- printer,
82
- });
83
-
84
- const places = await transformAsync(ast, source, opts);
85
-
86
- if (!opts.fix)
87
- return {
88
- code: source,
89
- places,
90
- };
91
-
92
- const printed = print(ast, {
93
- printer,
94
- });
95
-
96
- const code = mergeShebang(shebang, printed);
97
-
98
- return {
99
- code,
100
- places,
101
- };
102
- };
103
-
104
- module.exports.transform = transform;
105
- module.exports.transformAsync = transformAsync;
106
-
107
- module.exports.findPlaces = findPlaces;
108
- module.exports.findPlacesAsync = findPlacesAsync;
109
-
110
- module.exports.parse = parse;
111
- module.exports.print = print;
112
- module.exports.traverse = traverse;
113
- module.exports.types = types;
114
- module.exports.template = template;
115
- module.exports.generate = generate;
116
-
117
- module.exports.operator = {
118
- ...require('@putout/operate'),
119
- ...require('@putout/compare'),
120
- ...require('@putout/traverse'),
121
- ...require('@putout/operator-json'),
122
- ...require('@putout/operator-jsx'),
123
- ...require('@putout/operator-declare'),
124
- ...require('@putout/operator-regexp'),
125
- ...require('@putout/operator-add-args'),
126
- ...require('@putout/operator-filesystem'),
127
- ...require('@putout/operator-keyword'),
128
- ...require('@putout/operator-match-files'),
129
- ...require('@putout/operator-rename-files'),
130
- ...require('@putout/operator-ignore'),
131
- ...require('@putout/operator-parens'),
132
- };
133
-
134
- const {codeframe} = require('./codeframe');
135
- const isString = (a) => typeof a === 'string';
136
-
137
- module.exports.codeframe = codeframe;
138
-
139
- function check(source) {
140
- if (!isString(source))
141
- throw Error(`☝️ Looks like 'source' has type '${typeof source}', expected: 'string'`);
142
- }