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

gulp-changed

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-changed - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

20

index.js
'use strict';
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const gutil = require('gulp-util');

@@ -23,4 +22,2 @@ const through = require('through2');

const sha1 = buf => crypto.createHash('sha1').update(buf).digest('hex');
// Only push through files changed more recently than the destination files

@@ -36,17 +33,9 @@ function compareLastModifiedTime(stream, sourceFile, targetPath) {

// Only push through files with different SHA1 than the destination files
function compareSha1Digest(stream, sourceFile, targetPath) {
// Only push through files with different contents than the destination files
function compareContents(stream, sourceFile, targetPath) {
return readFile(targetPath)
.then(targetData => {
if (sourceFile.isNull()) {
if (sourceFile.isNull() || !sourceFile.contents.equals(targetData)) {
stream.push(sourceFile);
return;
}
const sourceDigest = sha1(sourceFile.contents);
const targetDigest = sha1(targetData);
if (sourceDigest !== targetDigest) {
stream.push(sourceFile);
}
});

@@ -93,2 +82,3 @@ }

module.exports.compareLastModifiedTime = compareLastModifiedTime;
module.exports.compareSha1Digest = compareSha1Digest;
module.exports.compareContents = compareContents;
module.exports.compareSha1Digest = compareContents;
{
"name": "gulp-changed",
"version": "3.0.0",
"version": "3.1.0",
"description": "Only pass through changed files",

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

@@ -95,3 +95,4 @@ # gulp-changed [![Build Status](https://travis-ci.org/sindresorhus/gulp-changed.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-changed)

- `changed.compareLastModifiedTime`
- `changed.compareSha1Digest`
- `changed.compareContents`
- `changed.compareSha1Digest` (Deprecated)

@@ -103,3 +104,3 @@ ###### Example

gulp.src('src/**/*.jade')
.pipe(changed('app', {hasChanged: changed.compareSha1Digest}))
.pipe(changed('app', {hasChanged: changed.compareContent}))
.pipe(jade())

@@ -106,0 +107,0 @@ .pipe(gulp.dest('app'))

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