@putout/operator-match-files 3.1.0 → 3.2.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.
- package/lib/match-files.js +9 -2
- package/package.json +1 -2
package/lib/match-files.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const {
|
|
4
|
+
join,
|
|
5
|
+
basename,
|
|
6
|
+
extname,
|
|
7
|
+
} = require('node:path');
|
|
3
8
|
const {parse, print} = require('@putout/engine-parser');
|
|
4
9
|
const {transform} = require('putout/transform');
|
|
5
10
|
const {findPlaces} = require('putout/find-places');
|
|
@@ -153,7 +158,8 @@ function getOutputFile(path, {dirPath, matchInputFilename, outputFilename, input
|
|
|
153
158
|
if (matchInputFilename === outputFilename)
|
|
154
159
|
return inputFile;
|
|
155
160
|
|
|
156
|
-
const
|
|
161
|
+
const name = join(getFilename(dirPath), outputFilename);
|
|
162
|
+
const [outputFile] = findFile(dirPath, name);
|
|
157
163
|
|
|
158
164
|
if (outputFile)
|
|
159
165
|
return outputFile;
|
|
@@ -164,7 +170,8 @@ function getOutputFile(path, {dirPath, matchInputFilename, outputFilename, input
|
|
|
164
170
|
function parseMatcher(matcher, options) {
|
|
165
171
|
for (const [name, value] of entries(options)) {
|
|
166
172
|
if (name === 'filename') {
|
|
167
|
-
const
|
|
173
|
+
const name = basename(value);
|
|
174
|
+
const ext = extname(value);
|
|
168
175
|
|
|
169
176
|
matcher = matcher.replaceAll(`__name`, name);
|
|
170
177
|
matcher = matcher.replaceAll(`__ext`, ext);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-match-files",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout operator adds ability to match files to plugins",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@putout/test": "^9.0.0",
|
|
41
41
|
"c8": "^9.0.0",
|
|
42
42
|
"eslint": "^9.0.0",
|
|
43
|
-
"eslint-plugin-n": "^17.0.0",
|
|
44
43
|
"eslint-plugin-putout": "^22.0.0",
|
|
45
44
|
"lerna": "^6.0.1",
|
|
46
45
|
"madrun": "^10.0.0",
|