{"name":"gulp-plugin-extras","version":"0.2.2","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":"f90be6afdca228eedc06e851ba16055e3b1fde1f","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.2","_nodeVersion":"18.18.2","_npmVersion":"9.2.0","dist":{"integrity":"sha512-0gssXzTNrrOocYBWN4qOZqd03cz3bxhjxVUPZV9iJdBR0ZZbwMQO/OT8hZChYoc9GjKaA5meaqDr6CjkmKA7BA==","shasum":"8f4af2c0acdc95aaac9dcd86e54f200a6e2842c4","tarball":"http://registry-npm.ywwl.com/gulp-plugin-extras/download/gulp-plugin-extras-0.2.2.tgz","fileCount":6,"unpackedSize":9322,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC10tIoO/mbAa3TCAaDryJjcbFv0U2Ek0Hso8D/ZpA+LQIgcqv2p1Onw2fjmVX2QLUfM1NUnzIQps2ekOAisCtapM8="}],"size":3436,"noattachment":false,"key":"/gulp-plugin-extras/-/gulp-plugin-extras-0.2.2.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.2_1698857482477_0.13575331761020926"},"_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":1698857482777,"_cnpm_publish_time":1698857482777,"dist-tags":{"latest":"1.1.0"}}