{"name":"gulp-plugin-extras","version":"1.1.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.1.0","gitHead":"6dabe65bcc339fc216276e39d6e15130e76d10de","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/gulp-plugin-extras/issues"},"homepage":"https://github.com/sindresorhus/gulp-plugin-extras#readme","_nodeVersion":"22.6.0","_npmVersion":"10.6.0","dist":{"integrity":"sha512-T0AXOEVoKYzLIBlwEZ7LtAx2w4ExIozIoxVeYEVLFbdxI7i0sWvFDq0F8mm47djixDF3vAqDPoyGwh3Sg/PWtQ==","shasum":"47bb1022bed0ea0216ac6c6a61a35c4fe014318e","tarball":"http://registry-npm.ywwl.com/gulp-plugin-extras/download/gulp-plugin-extras-1.1.0.tgz","fileCount":6,"unpackedSize":11631,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmGrg9MpT6KJ5zB4zfIXBUzbeA+CaIJ02C4HZE3F3QAgIgRs7S8c7L34QNjrNy0MN7raEvHQLaJY8gjhAO3dgfTD4="}],"size":3987,"noattachment":false,"key":"/gulp-plugin-extras/-/gulp-plugin-extras-1.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gulp-plugin-extras_1.1.0_1728886692894_0.3391794124636869"},"_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, PluginError} from 'gulp-plugin-extras';\n\nconst pluginName = 'gulp-foo';\n\nexport default function gulpFoo(requiredArgument) {\n\tif (!requiredArgument) {\n\t\tthrow new PluginError(pluginName, 'Missing argument `requiredArgument`');\n\t}\n\n\treturn gulpPlugin(pluginName, 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: `(file) => file`\n\nThe function called for each [Vinyl file](https://github.com/gulpjs/vinyl) in the stream. Must return a modified or new Vinyl file. May be async.\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): AsyncGenerator<File, never, 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\n### `PluginError`\n\nCreate a Gulp plugin error. See the [types](index.d.ts) for docs.\n","publish_time":1728886693069,"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_cnpm_publish_time":1728886693069,"dist-tags":{"latest":"1.1.0"}}