putout 35.35.8 → 35.36.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,9 @@
1
+ 2024.06.25, v35.36.0
2
+
3
+ feature:
4
+ - 3d798f3f7 putout: add ability to import as specifier "putout"
5
+ - 7e813cb26 @putout/plugin-putout: check-replace-code: once: add
6
+
1
7
  2024.06.25, v35.35.8
2
8
 
3
9
  feature:
package/README.md CHANGED
@@ -283,10 +283,24 @@ For example if you need to `remove-something` create 🐊[**Putout**](https://gi
283
283
 
284
284
  ## API
285
285
 
286
- ### putout(source, options)
286
+ All examples works both in **ESM** and **CommonJS**.
287
+
288
+ **CommonJS**:
287
289
 
288
290
  ```js
289
291
  const putout = require('putout');
292
+ ```
293
+
294
+ **ESM**:
295
+
296
+ ```js
297
+ import {putout} from 'putout';
298
+ ```
299
+
300
+ ### putout(source, options)
301
+
302
+ ```js
303
+ import {putout} from 'putout';
290
304
 
291
305
  const source = `
292
306
  const t = 'hello';
@@ -308,7 +322,7 @@ console.log(t);
308
322
  ### putoutAsync(source, options)
309
323
 
310
324
  ```js
311
- const {putoutAsync} = require('putout');
325
+ import {putoutAsync} from 'putout';
312
326
 
313
327
  const source = `
314
328
  const t = 'hello';
package/bin/putout.mjs CHANGED
@@ -11,7 +11,7 @@ import {createCommunication} from './communication.mjs';
11
11
  import cli from '../lib/cli/index.js';
12
12
  import {parseArgs} from '../lib/cli/parse-args.js';
13
13
  import {createExit} from '../lib/cli/exit.mjs';
14
- import {onDebuggerExit} from './debuger-exit.mjs';
14
+ import {onDebuggerExit} from './debugger-exit.mjs';
15
15
 
16
16
  const halt = process.exit;
17
17
  const logError = console.error;
package/lib/putout.js CHANGED
@@ -19,7 +19,10 @@ const {
19
19
 
20
20
  const isString = (a) => typeof a === 'string';
21
21
 
22
- module.exports = (source, opts) => {
22
+ module.exports = putout;
23
+ module.exports.putout = putout;
24
+
25
+ function putout(source, opts) {
23
26
  check(source);
24
27
  opts = defaultOptions(opts);
25
28
 
@@ -63,9 +66,7 @@ module.exports = (source, opts) => {
63
66
  code,
64
67
  places,
65
68
  };
66
- };
67
-
68
- module.exports.putoutAsync = async (source, opts) => {
69
+ }module.exports.putoutAsync = async (source, opts) => {
69
70
  check(source);
70
71
  opts = defaultOptions(opts);
71
72
 
package/lib/putout.mjs CHANGED
@@ -1,13 +1,4 @@
1
1
  import putout from './putout.js';
2
2
 
3
3
  export * from './putout.js';
4
-
5
- const {assign} = Object;
6
-
7
- function esmPutout(...a) {
8
- return putout(...a);
9
- }
10
-
11
- assign(esmPutout, putout);
12
-
13
- export default esmPutout;
4
+ export default putout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "35.35.8",
3
+ "version": "35.36.0",
4
4
  "type": "commonjs",
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",
File without changes