gulp-resolve-dependencies
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -51,2 +51,10 @@ 'use strict'; | ||
if (!filePath) { | ||
if (config.log) { | ||
Log('[' + AnsiColors.green(PLUGIN_NAME) + '] Ignored', match[1]); | ||
} | ||
continue; | ||
} | ||
// Check for circular dependencies | ||
@@ -53,0 +61,0 @@ try { |
{ | ||
"name": "gulp-resolve-dependencies", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "Resolve dependency directives in assets (e.g. \"@requires\" or \"//= require\" in JavaScript)", | ||
@@ -12,3 +12,2 @@ "license": "MIT", | ||
"scripts": { | ||
"pretest": "npm i", | ||
"test": "./node_modules/mocha/bin/mocha" | ||
@@ -15,0 +14,0 @@ }, |
@@ -53,3 +53,3 @@ # gulp-resolve-dependencies | ||
`gulp.src` will not necessarily return files in a [deterministic way](https://github.com/gulpjs/gulp/issues/687). If this turns out to be an issue, using a plugin like [`gulp-sort`](https://www.npmjs.com/package/gulp-sort) or [`gulp-rder`](https://www.npmjs.com/package/gulp-order) right after `gulp.src` might be an option for you. Thanks to @fabiospampinato for [pointing this out](https://github.com/backflip/gulp-resolve-dependencies/issues/10). | ||
`gulp.src` will not necessarily return files in a [deterministic way](https://github.com/gulpjs/gulp/issues/687). If this turns out to be an issue, using a plugin like [`gulp-sort`](https://www.npmjs.com/package/gulp-sort) or [`gulp-order`](https://www.npmjs.com/package/gulp-order) right after `gulp.src` might be an option for you. Thanks to @fabiospampinato for [pointing this out](https://github.com/backflip/gulp-resolve-dependencies/issues/10). | ||
@@ -81,2 +81,14 @@ ## API | ||
Returning a falsy value will ignore the resolved path: | ||
```javascript | ||
function(match, targetFile) { | ||
// Ignore `/lib.js` | ||
if (match.match(/\/lib\.js$/)) { | ||
return null; | ||
} | ||
return path.join(path.dirname(targetFile.path), match); | ||
} | ||
``` | ||
#### options.log | ||
@@ -83,0 +95,0 @@ Type: `Boolean` |
@@ -92,2 +92,23 @@ var gulp = require('gulp'), | ||
}); | ||
it('should ignore lib2.js', function(done) { | ||
gulp.src(__dirname + '/fixtures/main.js') | ||
.pipe(resolveDependencies({ | ||
resolvePath: function(match, targetFile) { | ||
// Ignore specific matches | ||
if (match.match(/\/lib2\.js$/)) { | ||
return null; | ||
} | ||
return path.join(path.dirname(path.resolve(targetFile.path)), match); | ||
}, | ||
log: true | ||
})) | ||
.pipe(concat('filtered.js')) | ||
.pipe(gulp.dest(__dirname + '/results/')) | ||
.pipe(es.wait(function() { | ||
assertFilesEqual('filtered.js'); | ||
done(); | ||
})); | ||
}); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13988
20
299
109
0