{"name":"gulp-plugin-extras","version":"0.2.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"},"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.0"},"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":"48090fbbb9d63816dea6c0cd4df74a0680081eeb","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.0","_nodeVersion":"18.18.2","_npmVersion":"9.2.0","dist":{"integrity":"sha512-jbEZtNaO1pndCz6KXzu2bI5pKcHBOi78qK93mfLXxo6AMKSV3P7YR3oVkX7j2ezxBYjiB0/sN53QIqGQNdC3AQ==","shasum":"d7ed5c4cf9b7adc4b3feda1ef629cec662974d8e","tarball":"http://registry-npm.ywwl.com/gulp-plugin-extras/download/gulp-plugin-extras-0.2.0.tgz","fileCount":6,"unpackedSize":9043,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF5O90EraRWGBQ7RO3rb++lGZoHfpIKX/DkxebSoP65SAiEAzxwXkwlaSIZ4wpJLKXK9eM3MxFvYvxxPAEvhGvj27ek="}],"size":3346,"noattachment":false,"key":"/gulp-plugin-extras/-/gulp-plugin-extras-0.2.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_0.2.0_1698782044143_0.5951123681468515"},"_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":1698782044605,"_cnpm_publish_time":1698782044605,"dist-tags":{"latest":"1.1.0"}}