gulp-revert-path
Advanced tools
+10
-11
@@ -1,11 +0,8 @@ | ||
| 'use strict'; | ||
| const through = require('through2'); | ||
| import {gulpPlugin} from 'gulp-plugin-extras'; | ||
| module.exports = reversions => { | ||
| reversions = typeof reversions === 'number' ? reversions : 1; | ||
| return through.obj((file, enc, cb) => { | ||
| const history = file.history; | ||
| export default function gulpRevertPath(reversionCount = 1) { | ||
| return gulpPlugin('gulp-revert-path', file => { | ||
| const {history} = file; | ||
| const highestIndex = history.length - 1; | ||
| let localReversions = reversions; | ||
| let localReversions = reversionCount; | ||
@@ -17,6 +14,8 @@ if (localReversions > highestIndex) { | ||
| history.splice(-localReversions, localReversions); | ||
| file.path = history[history.length - 1]; | ||
| file.path = history.at(-1); | ||
| cb(null, file); | ||
| return file; | ||
| }, { | ||
| supportsAnyType: true, | ||
| }); | ||
| }; | ||
| } |
+19
-8
| { | ||
| "name": "gulp-revert-path", | ||
| "version": "2.0.0", | ||
| "version": "3.0.0", | ||
| "description": "Revert the previous `file.path` change", | ||
| "license": "MIT", | ||
| "repository": "sindresorhus/gulp-revert-path", | ||
| "funding": "https://github.com/sponsors/sindresorhus", | ||
| "author": { | ||
| "name": "Sindre Sorhus", | ||
| "email": "sindresorhus@gmail.com", | ||
| "url": "sindresorhus.com" | ||
| "url": "https://sindresorhus.com" | ||
| }, | ||
| "type": "module", | ||
| "exports": "./index.js", | ||
| "engines": { | ||
| "node": ">=4" | ||
| "node": ">=18" | ||
| }, | ||
@@ -33,10 +36,18 @@ "scripts": { | ||
| "dependencies": { | ||
| "through2": "^2.0.0" | ||
| "gulp-plugin-extras": "^0.3.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "*", | ||
| "replace-ext": "^1.0.0", | ||
| "vinyl": "^2.1.0", | ||
| "xo": "*" | ||
| "ava": "^5.3.1", | ||
| "easy-transform-stream": "^1.0.1", | ||
| "vinyl": "^3.0.0", | ||
| "xo": "^0.56.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "gulp": ">=4" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "gulp": { | ||
| "optional": true | ||
| } | ||
| } | ||
| } |
+13
-22
@@ -1,2 +0,2 @@ | ||
| # gulp-revert-path [](https://travis-ci.org/sindresorhus/gulp-revert-path) | ||
| # gulp-revert-path | ||
@@ -7,19 +7,17 @@ > Revert the previous `file.path` change | ||
| ## Install | ||
| ```sh | ||
| npm install --save-dev gulp-revert-path | ||
| ``` | ||
| $ npm install --save-dev gulp-revert-path | ||
| ``` | ||
| ## Usage | ||
| ```js | ||
| const gulp = require('gulp'); | ||
| const babel = require('gulp-babel'); | ||
| const revertPath = require('gulp-revert-path'); | ||
| const rename = require('gulp-rename'); | ||
| import gulp from 'gulp'; | ||
| import babel from 'gulp-babel'; | ||
| import revertPath from 'gulp-revert-path'; | ||
| import rename from 'gulp-rename'; | ||
| gulp.task('default', () => | ||
| export default () => ( | ||
| gulp.src('src/app.jsx') | ||
@@ -31,3 +29,3 @@ .pipe(babel()) // file.path => src/app.js | ||
| gulp.task('es2015', () => | ||
| export const es2015 = () => ( | ||
| gulp.src('src/app.txt') | ||
@@ -41,22 +39,15 @@ .pipe(rename('src/app.jsx')) // file.path => src/app.jsx | ||
| ## API | ||
| ### revertPath([reversions]) | ||
| ### revertPath(reversionCount?) | ||
| #### reversions | ||
| #### reversionCount | ||
| Type: `number`<br> | ||
| Type: `number`\ | ||
| Default: `1` | ||
| Number of times to revert the path. | ||
| The number of times to revert the path. | ||
| ## Related | ||
| - [vinyl-paths](https://github.com/sindresorhus/vinyl-paths) - Get the file paths in a vinyl stream | ||
| ## License | ||
| MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
3738
0.48%Yes
NaN2
100%51
-15%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed