@putout/engine-runner 27.3.1 → 28.0.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.
@@ -1,6 +1,6 @@
1
1
  export const getPath = (item) => item.path || item[0] || item;
2
2
 
3
- export const getPosition = (path, shebang) => {
3
+ export const getPosition = (path) => {
4
4
  const parsedPath = getPath(path);
5
5
 
6
6
  validatePath(parsedPath);
@@ -10,14 +10,14 @@ export const getPosition = (path, shebang) => {
10
10
 
11
11
  if (!loc)
12
12
  return {
13
- line: 0,
13
+ line: 1,
14
14
  column: 1,
15
15
  };
16
16
 
17
17
  const {line, column} = node.loc.start;
18
18
 
19
19
  return {
20
- line: shebang ? line + 1 : line,
20
+ line,
21
21
  column: column + 1,
22
22
  };
23
23
  };
package/lib/index.js CHANGED
@@ -16,7 +16,7 @@ import {getPath, getPosition} from './get-position.js';
16
16
  const debug = createDebug('putout:runner:find');
17
17
  const isRemoved = (a) => a?.removed;
18
18
 
19
- export const runPlugins = ({ast, shebang, fix, fixCount = 2, plugins, progress = createProgress(), traverse = defaultTraverse}) => {
19
+ export const runPlugins = ({ast, fix, fixCount = 2, plugins, progress = createProgress(), traverse = defaultTraverse}) => {
20
20
  let places = [];
21
21
 
22
22
  const merge = once(mergeVisitors);
@@ -31,7 +31,6 @@ export const runPlugins = ({ast, shebang, fix, fixCount = 2, plugins, progress =
31
31
  places = run({
32
32
  ast,
33
33
  fix,
34
- shebang,
35
34
  pluginsFind,
36
35
  pluginsTraverse,
37
36
  merge,
@@ -54,11 +53,10 @@ export {
54
53
  getPosition,
55
54
  };
56
55
 
57
- const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge, traverse}) => [
56
+ const run = ({ast, fix, pluginsFind, pluginsTraverse, template, merge, traverse}) => [
58
57
  ...runWithoutMerge({
59
58
  ast,
60
59
  fix,
61
- shebang,
62
60
  template,
63
61
  pluginsFind,
64
62
  traverse,
@@ -66,7 +64,6 @@ const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge,
66
64
  ...runWithMerge({
67
65
  ast,
68
66
  fix,
69
- shebang,
70
67
  template,
71
68
  pluginsTraverse,
72
69
  merge,
@@ -74,10 +71,9 @@ const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge,
74
71
  }),
75
72
  ];
76
73
 
77
- function runWithMerge({ast, fix, shebang, template, pluginsTraverse, merge, traverse}) {
74
+ function runWithMerge({ast, fix, template, pluginsTraverse, merge, traverse}) {
78
75
  const {entries, visitor} = merge(pluginsTraverse, {
79
76
  fix,
80
- shebang,
81
77
  template,
82
78
  });
83
79
 
@@ -100,7 +96,7 @@ function runWithMerge({ast, fix, shebang, template, pluginsTraverse, merge, trav
100
96
  return places;
101
97
  }
102
98
 
103
- function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
99
+ function runWithoutMerge({ast, fix, template, pluginsFind, traverse}) {
104
100
  const places = [];
105
101
 
106
102
  for (const {rule, plugin, msg, options} of pluginsFind) {
@@ -114,7 +110,6 @@ function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
114
110
  ast,
115
111
  options,
116
112
  fix,
117
- shebang,
118
113
  template,
119
114
  traverse,
120
115
  });
@@ -125,7 +120,7 @@ function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
125
120
  for (const item of items) {
126
121
  const message = msg || report(item);
127
122
  const {parentPath} = getPath(item);
128
- const position = getPosition(item, shebang);
123
+ const position = getPosition(item);
129
124
 
130
125
  places.push({
131
126
  rule,
@@ -29,7 +29,7 @@ const parse = (name, plugin, options) => {
29
29
  return list;
30
30
  };
31
31
 
32
- export default (pluginsToMerge, {fix, shebang, template}) => {
32
+ export default (pluginsToMerge, {fix, template}) => {
33
33
  const mergeItems = [];
34
34
  const pushed = {};
35
35
 
@@ -45,7 +45,6 @@ export default (pluginsToMerge, {fix, shebang, template}) => {
45
45
  } = getStore(plugin, {
46
46
  fix,
47
47
  rule,
48
- shebang,
49
48
  msg,
50
49
  options,
51
50
  });
@@ -88,7 +87,7 @@ export default (pluginsToMerge, {fix, shebang, template}) => {
88
87
  };
89
88
  };
90
89
 
91
- function getStore(plugin, {fix, rule, shebang, msg, options}) {
90
+ function getStore(plugin, {fix, rule, msg, options}) {
92
91
  const store = mapStore();
93
92
  const list = listStore();
94
93
  const upstore = upStore();
@@ -97,7 +96,7 @@ function getStore(plugin, {fix, rule, shebang, msg, options}) {
97
96
  const paths = pathStore();
98
97
 
99
98
  const push = (path, pathOptions) => {
100
- const position = getPosition(path, shebang);
99
+ const position = getPosition(path);
101
100
  const message = msg || plugin.report(path, pathOptions);
102
101
 
103
102
  placesStore({
@@ -3,14 +3,8 @@ import {compare} from '@putout/compare';
3
3
  import {__filesystem_name} from '@putout/operator-json';
4
4
  import * as fromSimple from '@putout/plugin-filesystem/from-simple';
5
5
  import * as toSimple from '@putout/plugin-filesystem/to-simple';
6
- import {
7
- findFile,
8
- crawlDirectory,
9
- } from '@putout/operator-filesystem';
10
- import {
11
- pause,
12
- start,
13
- } from '@putout/operator-filesystem/maybe';
6
+ import {findFile, crawlDirectory} from '@putout/operator-filesystem';
7
+ import {pause, start} from '@putout/operator-filesystem/maybe';
14
8
  import {createDebug} from '../debug.js';
15
9
 
16
10
  const log = createDebug('putout:runner:scanner');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/engine-runner",
3
- "version": "27.3.1",
3
+ "version": "28.0.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Run 🐊Putout plugins",
@@ -35,7 +35,7 @@
35
35
  "@putout/operator-declare": "^16.0.0",
36
36
  "@putout/operator-filesystem": "^11.0.0",
37
37
  "@putout/operator-json": "^3.0.0",
38
- "@putout/plugin-filesystem": "^12.0.0",
38
+ "@putout/plugin-filesystem": "^13.0.0",
39
39
  "fullstore": "^4.0.0",
40
40
  "obug": "^2.1.1",
41
41
  "once": "^1.4.0",
@@ -51,11 +51,11 @@
51
51
  "@putout/plugin-minify": "*",
52
52
  "@putout/plugin-variables": "*",
53
53
  "c8": "^10.0.0",
54
- "eslint": "^10.0.0-alpha.0",
54
+ "eslint": "^10.0.0",
55
55
  "eslint-plugin-n": "^17.0.0",
56
- "eslint-plugin-putout": "^30.0.0",
56
+ "eslint-plugin-putout": "^31.0.0",
57
57
  "just-camel-case": "^6.2.0",
58
- "madrun": "^12.0.0",
58
+ "madrun": "^13.0.0",
59
59
  "montag": "^1.0.0",
60
60
  "nodemon": "^3.0.1",
61
61
  "putout": "*",