{"name":"gulp-plugin-extras","version":"1.0.0","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"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts"},"keywords":["gulp","plugin","extras","utilities"],"dependencies":{"@types/vinyl":"^2.0.12","chalk":"^5.3.0","easy-transform-stream":"^1.0.1"},"devDependencies":{"ava":"^6.1.2","p-event":"^6.0.1","typescript":"^5.4.5","vinyl":"^3.0.0","xo":"^0.58.0"},"xo":{"rules":{"@typescript-eslint/no-require-imports":"off"}},"_id":"gulp-plugin-extras@1.0.0","gitHead":"0cc102e3eb957fba1e508bda93384693a3409f88","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/gulp-plugin-extras/issues"},"homepage":"https://github.com/sindresorhus/gulp-plugin-extras#readme","_nodeVersion":"20.12.2","_npmVersion":"10.6.0","dist":{"integrity":"sha512-YXizWkBgb2030JBuHZ9DQFTkphnKgzwknL+ozSoCKdv8Zt1S8EpVAPo+MwGxqSsd/DtFFM+kThZe6UJvM5DFsw==","shasum":"74c4ddf14dde61100f5fd7b81cab45e87a72ebe3","tarball":"http://registry-npm.ywwl.com/gulp-plugin-extras/download/gulp-plugin-extras-1.0.0.tgz","fileCount":6,"unpackedSize":10067,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFy1oACXELhbTjRM/5UJWi/s9K7dSio8PvwLAJ1ReVngIhAOKvfydsb3gY50az9PstD4CNHLYzOeWl6hmT/IPfHyl9"}],"size":3596,"noattachment":false,"key":"/gulp-plugin-extras/-/gulp-plugin-extras-1.0.0.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_1.0.0_1714661568859_0.012591103329623543"},"_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":1714661569010,"_cnpm_publish_time":1714661569010,"dist-tags":{"latest":"1.1.0"}}