{"name":"@putout/operator-match-files","version":"7.0.2","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout operator adds ability to match files to plugins","homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-match-files#readme","main":"lib/match-files.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git+https://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","watch:test":"madrun watch:test","lint":"madrun lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","fix:lint":"madrun fix:lint","coverage":"madrun coverage","report":"madrun report"},"dependencies":{"@putout/babel":"^3.0.0","@putout/engine-parser":"^13.0.1","@putout/operator-filesystem":"^7.0.0","@putout/operator-json":"^2.0.0"},"keywords":["putout","putout-operator","operator","match-files"],"devDependencies":{"@putout/eslint-flat":"^3.0.0","@putout/plugin-nodejs":"*","@putout/test":"^12.0.0","c8":"^10.0.0","eslint":"^9.0.0","eslint-plugin-putout":"^26.0.0","madrun":"^11.0.0","montag":"^1.2.1","nodemon":"^3.0.1","supertape":"^10.0.0","try-catch":"^3.0.0"},"peerDependencies":{"putout":">=39"},"license":"MIT","engines":{"node":">=20"},"publishConfig":{"access":"public"},"_id":"@putout/operator-match-files@7.0.2","gitHead":"f3f745ff02d73993ad652a78c31ae17e740a93b1","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"22.14.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-xShU6rf/BsYzvJKPv29eYu+o20ncjHhTGLYtm53+mOykzRjy+W+qmgdHG/H9HgUaJGkiuIQpJ4YonmisLu4MAw==","shasum":"bfcb73a3a37b89e3121f761c36ace6a1e7049038","tarball":"http://registry-npm.ywwl.com/@putout/operator-match-files/download/@putout/operator-match-files-7.0.2.tgz","fileCount":4,"unpackedSize":11320,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD0IWJxDvgYrJReCWhbvJMsrrokwV5lksQcRaU2KtQutwIgSPBJ2wxjaXQid6dvrqbnfcqO9TELQt4LknrP0MqEqlM="}],"size":3740,"noattachment":false,"key":"/@putout/operator-match-files/-/@putout/operator-match-files-7.0.2.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/operator-match-files_7.0.2_1742597022712_0.4896640910352874"},"_hasShrinkwrap":false,"readme":"# @putout/operator-match-files [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/operator-match-files.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/operator-match-files \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) operator adds ability to match files to plugins.\n\n## Install\n\n```\nnpm i putout @putout/operator-match-files\n```\n\n## API\n\nIf you want to create 🐊[**Putout**](https://github.com/coderaiser/putout) `plugin` that will match files according to your needs just:\n\n```js\nconst {operator} = require('putout');\nconst {matchFiles} = operator;\nconst updateTSConfig = require('../update-tsconfig');\n\nmodule.exports = matchFiles({\n    'tsconfig.json': updateTSConfig,\n});\n```\n\nThis will help in case when `update-tsconfig` is disabled by default:\n\n```js\nconst updateTSConfig = require('./update-tsconfig');\n\nmodule.exports.rules = {\n    'update-tsconfig': ['off', updateTSConfig],\n};\n```\n\nAnd you want to help users avoid updating `.putout.json` config with:\n\n```json\n{\n    \"match\": {\n        \"tsconfig.json\": {\n            \"nextjs/update-tsconfig\": \"on\"\n        }\n    },\n    \"plugins\": [\"nextjs\"]\n}\n```\n\nIf you want to pass options use:\n\n```json\n{\n    \"match\": {\n        \"tsconfig.json\": {\n            \"nextjs/update-tsconfig\": [\"on\", {\n                \"ignore\": []\n            }]\n        }\n    },\n    \"plugins\": [\"nextjs\"]\n}\n```\n\nInstead of this, [`redlint`](https://github.com/putoutjs/redlint) can be used, it will generate `.filesystem.json` which can be processed by 🐊**Putout**.\n\n### Rename\n\nIf you want to save with other name use `->`:\n\n```js\nconst {operator} = require('putout');\nconst {matchFiles} = operator;\nconst updateTSConfig = require('../update-tsconfig');\n\nmodule.exports = matchFiles({\n    'tsconfig.json -> hello.json': updateTSConfig,\n});\n```\n\n### Matcher\n\nYou can even use file matchers:\n\n```json\n{\n    \"rules\": {\n        \"filesystem/convert-json-to-js\": [\"on\", {\n            \"filename\": \"package.json\"\n        }]\n    }\n}\n```\n\nMatchers: `__filename = __name.__ext`\n\n```js\nmodule.exports = matchFiles({\n    '__name.json -> __name.js': updateTSConfig,\n});\n```\n\n### `exclude`\n\nIf you want to exclude some files, use:\n\n```js\nconst {operator} = require('putout');\nconst {matchFiles} = operator;\nconst updateTSConfig = require('../update-tsconfig');\n\nmodule.exports = matchFiles({\n    files: {\n        '__name.ts -> __name.js': updateTSConfig,\n    },\n    exclude: ['*.d.ts'],\n});\n```\n\n### Options\n\nYou can also pass `options`:\n\n```js\nmodule.exports = matchFiles({\n    '.eslintrc.json -> eslint.config.js': {\n        rules: {\n            'eslint/declare': {\n                type: 'esm',\n            },\n        },\n        plugins: [\n            ['eslint/convert-rc-to-flat', rcToFlat],\n            ['eslint/declare', declare],\n        ],\n    },\n});\n```\n\n### `filename`\n\nYou can pass default `filename`, so when no options provided it will be used.\n\n```js\nconst {operator} = require('putout');\nconst {matchFiles} = operator;\nconst updateTSConfig = require('../update-tsconfig');\n\nmodule.exports = matchFiles({\n    filename: '*.d.ts',\n    files: {\n        '__name.ts -> __name.js': updateTSConfig,\n    },\n});\n```\n\n## License\n\nMIT\n","publish_time":1742597022875,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1742597022875,"dist-tags":{"latest":"12.12.0"}}