babel-plugin-putout 7.0.2 → 9.0.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.
Files changed (3) hide show
  1. package/README.md +4 -2
  2. package/lib/index.js +25 -33
  3. package/package.json +7 -8
package/README.md CHANGED
@@ -40,8 +40,10 @@ $ babel --plugins putout script.js
40
40
 
41
41
  ### Via Node API
42
42
 
43
- ```javascript
44
- require('babel-core').transform('code', {
43
+ ```js
44
+ import {transform} from '@babel/core';
45
+
46
+ transform('code', {
45
47
  plugins: ['putout'],
46
48
  });
47
49
  ```
package/lib/index.js CHANGED
@@ -1,39 +1,31 @@
1
- 'use strict';
2
-
3
- const {
1
+ import {
4
2
  parse,
5
3
  print,
6
4
  transform,
7
- } = require('putout');
8
-
9
- const {parseOptions} = require('putout/parse-options');
5
+ } from 'putout';
6
+ import {parseOptions} from 'putout/parse-options';
10
7
 
11
- module.exports = () => {
12
- let code = '';
13
-
14
- return {
15
- visitor: {
16
- Program(path, {filename, opts}) {
17
- const options = parseOptions({
18
- filename,
19
- options: opts,
20
- });
21
-
22
- transform(path.container, code, options);
23
- },
24
- },
25
-
26
- parserOverride(source) {
27
- code = source;
28
- return parse(source);
29
- },
30
-
31
- generatorOverride(ast) {
32
- const code = print(ast, {});
8
+ export default () => ({
9
+ visitor: {
10
+ Program(path, {filename, opts}) {
11
+ const options = parseOptions({
12
+ filename,
13
+ options: opts,
14
+ });
33
15
 
34
- return {
35
- code,
36
- };
16
+ transform(path.container, options);
37
17
  },
38
- };
39
- };
18
+ },
19
+
20
+ parserOverride(source) {
21
+ return parse(source);
22
+ },
23
+
24
+ generatorOverride(ast) {
25
+ const code = print(ast);
26
+
27
+ return {
28
+ code,
29
+ };
30
+ },
31
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "babel-plugin-putout",
3
- "version": "7.0.2",
4
- "type": "commonjs",
3
+ "version": "9.0.0",
4
+ "type": "module",
5
5
  "description": "babel plugin for putout",
6
6
  "author": "Coderaiser <coderaiser@cloudcmd.io>",
7
7
  "main": "lib/index.js",
@@ -15,14 +15,13 @@
15
15
  "devDependencies": {
16
16
  "@babel/core": "^8.0.0-alpha.1",
17
17
  "@babel/eslint-plugin-development": "^8.0.0-alpha.1",
18
- "@putout/eslint-flat": "^3.0.0",
19
18
  "c8": "^10.0.0",
20
- "eslint": "^10.0.0-alpha.0",
19
+ "eslint": "^10.0.0",
21
20
  "eslint-plugin-n": "^17.0.0",
22
- "eslint-plugin-putout": "^29.0.0",
23
- "madrun": "^12.0.0",
21
+ "eslint-plugin-putout": "^31.0.0",
22
+ "madrun": "^13.0.0",
24
23
  "mocha": "^11.1.0",
25
- "supertape": "^11.0.3"
24
+ "supertape": "^12.0.0"
26
25
  },
27
26
  "scripts": {
28
27
  "test": "madrun test",
@@ -43,7 +42,7 @@
43
42
  "babel-plugin"
44
43
  ],
45
44
  "peerDependencies": {
46
- "putout": ">=41"
45
+ "putout": ">=42"
47
46
  },
48
47
  "publishConfig": {
49
48
  "access": "public"