diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/gulp-rename | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/gulp-rename')
-rw-r--r-- | node_modules/gulp-rename/README.md | 3 | ||||
-rw-r--r-- | node_modules/gulp-rename/index.js | 12 | ||||
-rw-r--r-- | node_modules/gulp-rename/package.json | 28 |
3 files changed, 22 insertions, 21 deletions
diff --git a/node_modules/gulp-rename/README.md b/node_modules/gulp-rename/README.md index b45c3664f..4fdd30bb8 100644 --- a/node_modules/gulp-rename/README.md +++ b/node_modules/gulp-rename/README.md @@ -24,7 +24,7 @@ gulp.src("./src/**/hello.txt") .pipe(rename(function (path) { path.dirname += "/ciao"; path.basename += "-goodbye"; - path.extname = ".md" + path.extname = ".md"; })) .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md @@ -49,6 +49,7 @@ gulp.src("./src/main/text/hello.txt", { base: process.cwd() }) * `gulp.dest()` renames the directories between `process.cwd()` and `dirname` (i.e. the base relative to CWD). Use `dirname` to rename the directories matched by the glob or descendents of the base of option. * `basename` is the filename without the extension like path.basename(filename, path.extname(filename)). * `extname` is the file extension including the '.' like path.extname(filename). +* when using a function, a second `file` argument is provided with the whole context and original file value ## License diff --git a/node_modules/gulp-rename/index.js b/node_modules/gulp-rename/index.js index 77f812d41..c249a71ad 100644 --- a/node_modules/gulp-rename/index.js +++ b/node_modules/gulp-rename/index.js @@ -3,12 +3,14 @@ var Stream = require('stream'); var Path = require('path'); -function gulpRename(obj) { +function gulpRename(obj, options) { + + options = options || {}; var stream = new Stream.Transform({objectMode: true}); function parsePath(path) { - var extname = Path.extname(path); + var extname = options.multiExt ? Path.basename(path).slice(Path.basename(path).indexOf('.')) : Path.extname(path); return { dirname: Path.dirname(path), basename: Path.basename(path, extname), @@ -16,8 +18,10 @@ function gulpRename(obj) { }; } - stream._transform = function(file, unused, callback) { + stream._transform = function (originalFile, unused, callback) { + + var file = originalFile.clone({contents: false}); var parsedPath = parsePath(file.relative); var path; @@ -29,7 +33,7 @@ function gulpRename(obj) { } else if (type === 'function') { - obj(parsedPath); + obj(parsedPath, file); path = Path.join(parsedPath.dirname, parsedPath.basename + parsedPath.extname); } else if (type === 'object' && obj !== undefined && obj !== null) { diff --git a/node_modules/gulp-rename/package.json b/node_modules/gulp-rename/package.json index 44f3b79f7..63bbf928c 100644 --- a/node_modules/gulp-rename/package.json +++ b/node_modules/gulp-rename/package.json @@ -1,6 +1,6 @@ { "name": "gulp-rename", - "version": "1.2.2", + "version": "1.4.0", "description": "Rename files", "keywords": [ "gulpplugin" @@ -21,25 +21,21 @@ "url": "git://github.com/hparra/gulp-rename.git" }, "scripts": { - "pretest": "jshint index.js test/", + "pretest": "jscs index.js test/ && jshint index.js test/", "test": "mocha" }, "devDependencies": { - "gulp": ">=3.0.0", - "gulp-sourcemaps": "^1.5.0", - "gulp-util": "^3.0.4", - "jshint": "^2.6.3", - "map-stream": ">=0.0.4", - "mocha": ">=1.15.0", - "should": ">=2.1.0" + "gulp": "^4.0.0", + "gulp-sourcemaps": "^2.6.4", + "jscs": "^3.0.0", + "jshint": "^2.0.0", + "map-stream": "^0.0.7", + "mocha": "^5.0.0", + "should": "^13.0.0", + "vinyl": "^2.0.0" }, "engines": { - "node": ">=0.10.0", - "npm": ">=1.2.10" + "node": ">=4" }, - "licenses": [ - { - "type": "MIT" - } - ] + "license": "MIT" } |