@putout/engine-runner 23.5.0 → 24.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.
@@ -39,27 +39,31 @@ const log = (from, path) => {
39
39
  };
40
40
 
41
41
  const {keys, entries} = Object;
42
-
43
42
  const {stringify} = JSON;
44
43
 
45
44
  const stub = () => [];
46
45
  const stubMatch = () => ({});
47
46
  const packKeys = (a) => () => keys(a);
48
- const isObj = (a) => typeof a === 'object';
47
+ const isObject = (a) => typeof a === 'object';
49
48
 
50
49
  module.exports = ({rule, plugin, msg, options}) => {
50
+ const maybeMatch = plugin.match || stubMatch;
51
+ const match = maybeMatch({
52
+ options,
53
+ });
54
+
51
55
  const {
52
56
  report,
53
57
  exclude = stub,
54
58
  replace,
55
- filter = getFilter(plugin.match, options),
59
+ filter = getFilter(match),
56
60
  } = plugin;
57
61
 
58
62
  const replaceItems = replace({
59
63
  options,
60
64
  });
61
65
 
62
- const fix = getFix(replaceItems, plugin.match, options);
66
+ const fix = getFix(replaceItems, match);
63
67
  const include = packKeys(replaceItems);
64
68
 
65
69
  return {
@@ -135,16 +139,12 @@ const fix = (from, to, path) => {
135
139
  log(from, newPath);
136
140
  };
137
141
 
138
- const getFix = (items, match = stubMatch, options) => (path) => {
139
- const initedMatch = match({
140
- options,
141
- });
142
-
142
+ const getFix = (items, match) => (path) => {
143
143
  for (const [from, to] of entries(items)) {
144
144
  const nodeFrom = template.ast(from);
145
145
 
146
146
  if (compare(path, nodeFrom, {findUp: false})) {
147
- const matchFn = initedMatch[from];
147
+ const matchFn = match[from];
148
148
 
149
149
  if (!matchFn || runMatch(path, nodeFrom, matchFn))
150
150
  fix(from, to, path);
@@ -152,10 +152,8 @@ const getFix = (items, match = stubMatch, options) => (path) => {
152
152
  }
153
153
  };
154
154
 
155
- const getFilter = (match = stubMatch, options) => (path) => {
156
- const all = entries(match({
157
- options,
158
- }));
155
+ const getFilter = (match) => (path) => {
156
+ const all = entries(match);
159
157
 
160
158
  for (const [from, matchProperty] of all) {
161
159
  const nodeFrom = template.ast(from);
@@ -189,7 +187,7 @@ function parseTo(to, values, path) {
189
187
  if (!toStr)
190
188
  return null;
191
189
 
192
- if (isObj(toStr) && toStr.type) {
190
+ if (isObject(toStr) && toStr.type) {
193
191
  toStr.__putout_replace_cooked = true;
194
192
  return toStr;
195
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/engine-runner",
3
- "version": "23.5.0",
3
+ "version": "24.0.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Run 🐊Putout plugins",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@putout/babel": "^3.0.0",
32
32
  "@putout/compare": "^16.0.0",
33
- "@putout/engine-parser": "^12.0.0",
33
+ "@putout/engine-parser": "^13.0.0",
34
34
  "@putout/operate": "^13.0.0",
35
35
  "@putout/operator-declare": "^11.0.3",
36
36
  "@putout/operator-filesystem": "^6.0.2",
@@ -50,14 +50,14 @@
50
50
  ],
51
51
  "devDependencies": {
52
52
  "@putout/engine-loader": "*",
53
- "@putout/eslint-flat": "^2.0.0",
53
+ "@putout/eslint-flat": "^3.0.0",
54
54
  "@putout/plugin-minify": "*",
55
55
  "c8": "^10.0.0",
56
56
  "eslint": "^9.0.0",
57
57
  "eslint-plugin-n": "^17.0.0",
58
- "eslint-plugin-putout": "^25.0.1",
58
+ "eslint-plugin-putout": "^26.0.0",
59
59
  "just-camel-case": "^6.2.0",
60
- "madrun": "^10.0.0",
60
+ "madrun": "^11.0.0",
61
61
  "mock-require": "^3.0.3",
62
62
  "montag": "^1.0.0",
63
63
  "nodemon": "^3.0.1",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "license": "MIT",
71
71
  "engines": {
72
- "node": ">=18"
72
+ "node": ">=20"
73
73
  },
74
74
  "publishConfig": {
75
75
  "access": "public"