Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-plugin-extras

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-plugin-extras - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

17

index.d.ts

@@ -12,2 +12,13 @@ import File = require('vinyl');

/**
Whether the plugin can handle any Vinyl file type.
Useful for custom type filtering.
Supersedes `supportsDirectories`.
@default false
*/
readonly supportsAnyType: boolean;
/**
An async generator function executed for finalization after all files have been processed.

@@ -26,3 +37,3 @@

{
onFinish: async function * () {
async * onFinish() {
yield someVinylFile;

@@ -45,2 +56,6 @@ yield someVinylFile2;

If you throw an error with a `.isPresentable = true` property, it will not display the error stack.
_This does not support streaming unless you enable the `supportsAnyType` option._
@example

@@ -47,0 +62,0 @@ ```

18

index.js
import transformStream from 'easy-transform-stream';
import PluginError from './plugin-error.js';
export function gulpPlugin(name, onFile, {onFinish, supportsDirectories} = {}) {
export function gulpPlugin(name, onFile, {
onFinish,
supportsDirectories = false,
supportsAnyType = false,
} = {}) {
return transformStream(

@@ -10,8 +14,10 @@ {

async file => {
if (file.isNull() && !(supportsDirectories && file.isDirectory())) {
return file;
}
if (!supportsAnyType) {
if (file.isNull() && !(supportsDirectories && file.isDirectory())) {
return file;
}
if (file.isStream()) {
throw new PluginError(name, 'Streaming not supported');
if (file.isStream()) {
throw new PluginError(name, 'Streaming not supported');
}
}

@@ -18,0 +24,0 @@

{
"name": "gulp-plugin-extras",
"version": "0.2.2",
"version": "0.3.0",
"description": "Useful utilities for creating Gulp plugins",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -32,3 +32,3 @@ # gulp-plugin-extras

*This does not support streaming.*
*This does not support streaming unless you enable the `supportsAnyType` option.*

@@ -58,2 +58,13 @@ #### name

##### supportsAnyType
Type: `boolean`\
Default: `false`
Whether the plugin can handle any Vinyl file type.
Useful for custom type filtering.
Supersedes `supportsDirectories`.
##### onFinish

@@ -75,3 +86,3 @@

{
onFinish: async function * () {
async * onFinish() {
yield someVinylFile;

@@ -78,0 +89,0 @@ yield someVinylFile2;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc