@putout/plugin-esm 10.0.0 → 10.0.2

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.
@@ -22,8 +22,8 @@ const getMessage = (a) => a.message;
22
22
  const applyJS = (a) => a.replace(/\.[cm]js$/, '.js');
23
23
 
24
24
  export const report = (file, {from, to}) => `Apply 'js' imported source: '${from}' -> '${to}'`;
25
- export const fix = (file, {content, ast, from, to}) => {
26
- transform(ast, content, {
25
+ export const fix = (file, {ast, from, to}) => {
26
+ transform(ast, {
27
27
  rules: {
28
28
  'change-imports': ['on', {
29
29
  from,
@@ -59,7 +59,7 @@ export const scan = (rootPath, {push, trackFile}) => {
59
59
  if (error)
60
60
  continue;
61
61
 
62
- const places = transform(ast, content, {
62
+ const places = transform(ast, {
63
63
  plugins: [
64
64
  ['get-imports', getImports],
65
65
  ],
@@ -78,7 +78,6 @@ export const scan = (rootPath, {push, trackFile}) => {
78
78
  push(file, {
79
79
  from,
80
80
  to,
81
- content,
82
81
  ast,
83
82
  });
84
83
  continue;
@@ -88,7 +87,6 @@ export const scan = (rootPath, {push, trackFile}) => {
88
87
  push(file, {
89
88
  from,
90
89
  to,
91
- content,
92
90
  ast,
93
91
  });
94
92
  continue;
@@ -6,7 +6,7 @@ const {getFilename} = operator;
6
6
  const getMessage = (a) => a.message;
7
7
 
8
8
  export const getImportsTuples = (file, content, ast) => {
9
- const places = transform(ast, content, {
9
+ const places = transform(ast, {
10
10
  fix: false,
11
11
  plugins: [
12
12
  ['get-imports', getImportsPlugin],
@@ -1,8 +1,8 @@
1
1
  import {transform} from 'putout';
2
2
  import * as applyNamedImportPlugin from './apply-named-import/index.js';
3
3
 
4
- export const transformNamedImport = (ast, {name, source, content}) => {
5
- transform(ast, content, {
4
+ export const transformNamedImport = (ast, {name, source}) => {
5
+ transform(ast, {
6
6
  rules: {
7
7
  'apply-named-import': ['on', {
8
8
  name,
@@ -21,11 +21,10 @@ export const report = (file, {name, source}) => {
21
21
  return `Use \`import * as ${name} from '${source}'\` in '${filename}'`;
22
22
  };
23
23
 
24
- export const fix = (file, {name, source, content, ast}) => {
24
+ export const fix = (file, {name, source, ast}) => {
25
25
  transformNamespaceImport(ast, {
26
26
  name,
27
27
  source,
28
- content,
29
28
  });
30
29
 
31
30
  const newContent = print(ast);
@@ -71,7 +70,6 @@ export const scan = (rootPath, {push, trackFile, crawlFile}) => {
71
70
  name,
72
71
  source,
73
72
  ast,
74
- content,
75
73
  });
76
74
  }
77
75
  }
@@ -1,8 +1,8 @@
1
1
  import {transform} from 'putout';
2
2
  import * as applyNamespaceImportPlugin from './apply-namespace-import/index.js';
3
3
 
4
- export const transformNamespaceImport = (ast, {source, content, name}) => {
5
- transform(ast, content, {
4
+ export const transformNamespaceImport = (ast, {source, name}) => {
5
+ transform(ast, {
6
6
  rules: {
7
7
  'apply-namespace-import': ['on', {
8
8
  name,
@@ -20,8 +20,8 @@ const getMessage = (a) => a.message;
20
20
  export const report = (file, {from, to, filename}) => {
21
21
  return `Apply private import: '${from}' -> '${to}' in '${filename}'`;
22
22
  };
23
- export const fix = (file, {content, ast, from, to}) => {
24
- transform(ast, content, {
23
+ export const fix = (file, {ast, from, to}) => {
24
+ transform(ast, {
25
25
  rules: {
26
26
  'change-imports': ['on', {
27
27
  from,
@@ -59,7 +59,7 @@ export const scan = (rootPath, {push, trackFile}) => {
59
59
 
60
60
  const ast = parse(content);
61
61
 
62
- const places = transform(ast, content, {
62
+ const places = transform(ast, {
63
63
  plugins: [
64
64
  ['get-imports', getImports],
65
65
  ],
@@ -78,7 +78,6 @@ export const scan = (rootPath, {push, trackFile}) => {
78
78
  from,
79
79
  to: privateImports.get(to),
80
80
  filename,
81
- content,
82
81
  ast,
83
82
  });
84
83
  }
@@ -21,8 +21,8 @@ export const report = (file, {from, to, filename}) => {
21
21
  return `Resolve import source: '${from}' -> '${to}' in '${filename}'`;
22
22
  };
23
23
 
24
- export const fix = (file, {content, ast, from, to}) => {
25
- transform(ast, content, {
24
+ export const fix = (file, {ast, from, to}) => {
25
+ transform(ast, {
26
26
  rules: {
27
27
  'change-imports': ['on', {
28
28
  from,
@@ -53,7 +53,7 @@ export const scan = (rootPath, {push, trackFile, crawlFile}) => {
53
53
 
54
54
  const ast = parse(content);
55
55
 
56
- const places = transform(ast, content, {
56
+ const places = transform(ast, {
57
57
  plugins: [
58
58
  ['get-imports-source', getImports],
59
59
  ],
@@ -75,7 +75,6 @@ export const scan = (rootPath, {push, trackFile, crawlFile}) => {
75
75
  filename,
76
76
  from,
77
77
  to,
78
- content,
79
78
  ast,
80
79
  });
81
80
  }
@@ -25,8 +25,8 @@ export const report = (file, {from, to}) => {
25
25
  const name = getFilename(file);
26
26
  return `Shorten import source: '${from}' -> '${to}' in '${name}'`;
27
27
  };
28
- export const fix = (file, {content, ast, from, to}) => {
29
- transform(ast, content, {
28
+ export const fix = (file, {ast, from, to}) => {
29
+ transform(ast, {
30
30
  rules: {
31
31
  'change-imports': ['on', {
32
32
  from,
@@ -60,7 +60,7 @@ export const scan = (rootPath, {push, trackFile}) => {
60
60
  if (error)
61
61
  continue;
62
62
 
63
- const places = transform(ast, content, {
63
+ const places = transform(ast, {
64
64
  plugins: [
65
65
  ['get-imports', getImports],
66
66
  ],
@@ -81,7 +81,6 @@ export const scan = (rootPath, {push, trackFile}) => {
81
81
  push(file, {
82
82
  from,
83
83
  to,
84
- content,
85
84
  ast,
86
85
  });
87
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-esm",
3
- "version": "10.0.0",
3
+ "version": "10.0.2",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin improves ability to transform ESM code",
@@ -62,10 +62,10 @@
62
62
  "eslint": "^10.0.0",
63
63
  "eslint-plugin-n": "^17.0.0",
64
64
  "eslint-plugin-putout": "^31.0.0",
65
- "madrun": "^12.0.0",
65
+ "madrun": "^13.0.0",
66
66
  "montag": "^1.2.1",
67
67
  "nodemon": "^3.0.1",
68
- "redlint": "^5.0.4",
68
+ "redlint": "^6.0.0",
69
69
  "supertape": "^12.0.0"
70
70
  },
71
71
  "peerDependencies": {