{"name":"gulp-plugin-extras","version":"0.2.1","description":"Useful utilities for creating Gulp plugins","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/gulp-plugin-extras.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts"},"keywords":["gulp","plugin","extras","utilities"],"dependencies":{"@types/vinyl":"^2.0.9","chalk":"^5.3.0","easy-transform-stream":"^1.0.1"},"devDependencies":{"ava":"^5.3.1","p-event":"^6.0.0","typescript":"^5.2.2","vinyl":"^3.0.0","xo":"^0.56.0"},"xo":{"rules":{"@typescript-eslint/no-require-imports":"off"}},"types":"./index.d.ts","gitHead":"dac9a3ea7496d9c79a29032c43a59029e0a50a12","bugs":{"url":"https://github.com/sindresorhus/gulp-plugin-extras/issues"},"homepage":"https://github.com/sindresorhus/gulp-plugin-extras#readme","_id":"gulp-plugin-extras@0.2.1","_nodeVersion":"18.18.2","_npmVersion":"9.2.0","dist":{"integrity":"sha512-b+BV0ZsNTAh37yOhPf7L9XRYKpW8Jc02/zsY8aqJUiePQEWPweZycCWeh9+2ytM3VxeXlt+ejumGPWtcCE1+sA==","shasum":"880a7334ea2d3130640c365e2e2d24c1f1d62f47","tarball":"http://registry-npm.ywwl.com/gulp-plugin-extras/download/gulp-plugin-extras-0.2.1.tgz","fileCount":6,"unpackedSize":9113,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH/JjiBm/DVAd5hla7ZBLF9R3reQ9lnlqJxqXqcpMiPFAiA5Ye90/cw9MXeNQrGEP0h9DKID7S8EIPfBeXsHFu200A=="}],"size":3361,"noattachment":false,"key":"/gulp-plugin-extras/-/gulp-plugin-extras-0.2.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gulp-plugin-extras_0.2.1_1698787444370_0.4404775726447454"},"_hasShrinkwrap":false,"readme":"# gulp-plugin-extras\n\n> Useful utilities for creating [Gulp](https://github.com/gulpjs/gulp) plugins\n\n## Install\n\n```sh\nnpm install gulp-plugin-extras\n```\n\n## Usage\n\n```js\nimport {gulpPlugin} from 'gulp-plugin-extras';\n\nexport default function gulpFoo() {\n\treturn gulpPlugin('gulp-foo', async file => {\n\t\tfile.contents = await someKindOfTransformation(file.contents);\n\t\treturn file;\n\t});\n}\n```\n\n## API\n\n### `gulpPlugin(name, onFile, options?)`\n\nCreate a Gulp plugin.\n\nIf you throw an error with a `.isPresentable = true` property, it will not display the error stack.\n\n*This does not support streaming unless you enable the `supportsAnyType` option.*\n\n#### name\n\nType: `string`\n\nThe plugin name.\n\n#### onFile\n\nType: `async (file) => file`\n\nThe async function called for each [Vinyl file](https://github.com/gulpjs/vinyl) in the stream. Must return a modified or new Vinyl file.\n\n#### options\n\nType: `object`\n\n##### supportsDirectories\n\nType: `boolean`\\\nDefault: `false`\n\nWhether the plugin can handle directories.\n\n##### supportsAnyType\n\nType: `boolean`\\\nDefault: `false`\n\nWhether the plugin can handle any Vinyl file type.\n\nUseful for custom type filtering.\n\nSupersedes `supportsDirectories`.\n\n##### onFinish\n\nType: `async function * (stream: NodeJS.ReadableStream): void`\n\nAn async generator function executed for finalization after all files have been processed.\n\nYou can yield more files from it if needed.\n\n```js\nimport {gulpPlugin} from 'gulp-plugin-extras';\n\nexport default function gulpFoo() {\n\treturn gulpPlugin(\n\t\t'gulp-foo',\n\t\tasync file => { … },\n\t\t{\n\t\t\tasync * onFinish() {\n\t\t\t\tyield someVinylFile;\n\t\t\t\tyield someVinylFile2;\n\t\t\t}\n\t\t}\n\t);\n}\n```\n","publish_time":1698787444638,"_cnpm_publish_time":1698787444638,"dist-tags":{"latest":"1.1.0"}}