{"name":"@putout/operator-match-files","version":"5.2.0","keywords":["putout","putout-operator","operator","match-files"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/operator-match-files@5.2.0","homepage":"https://github.com/coderaiser/putout/tree/master/packages/operator-match-files#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"0bb9024ba036f90681075f0f48fa6ad64b19bfe3","tarball":"http://registry-npm.ywwl.com/@putout/operator-match-files/download/@putout/operator-match-files-5.2.0.tgz","fileCount":4,"integrity":"sha512-kTRNuYj9egBsHdsoZfSLdZTbb1D0edfe3IMbivAc69Y7I64j7PtO/THtT4/Qkcc5S4WyN0bqMzQAUSk1qHinRg==","signatures":[{"sig":"MEQCIBHDA47mv4U9ozo1RL5Bfdp/eNayDgrrBTgDvT4tf8smAiBXRFSsOflUBDzu5kySyG8+qB97uN6yEL53H/1dw3zzzQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10797,"size":3669,"noattachment":false,"key":"/@putout/operator-match-files/-/@putout/operator-match-files-5.2.0.tgz"},"main":"lib/match-files.js","type":"commonjs","engines":{"node":">=18"},"gitHead":"360f8b6df11cce59249aceddce2a9e970fc2b2bb","release":false,"scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"10.9.0","description":"🐊Putout operator adds ability to match files to plugins","directories":{},"_nodeVersion":"22.12.0","dependencies":{"@putout/babel":"^3.0.0","@putout/engine-parser":"^11.0.1","@putout/operator-json":"^2.0.0","@putout/operator-filesystem":"^5.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","lerna":"^6.0.1","eslint":"^9.0.0","madrun":"^10.0.0","montag":"^1.2.1","nodemon":"^3.0.1","supertape":"^10.0.0","try-catch":"^3.0.0","@putout/test":"^11.0.0","eslint-plugin-putout":"^23.0.0","@putout/plugin-nodejs":"*"},"peerDependencies":{"putout":">=36"},"_npmOperationalInternal":{"tmp":"tmp/operator-match-files_5.2.0_1736633083015_0.44182628780407174","host":"s3://npm-registry-packages-npm-production"},"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":1736633083210,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1736633083210,"dist-tags":{"latest":"12.12.0"}}