Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Remove cloneable-readable #155

Merged
merged 3 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var util = require('util');
var Buffer = require('buffer').Buffer;

var clone = require('clone');
var cloneable = require('cloneable-readable');
var teex = require('teex');
var replaceExt = require('replace-ext');
var cloneStats = require('clone-stats');
var removeTrailingSep = require('remove-trailing-separator');
Expand Down Expand Up @@ -122,7 +122,9 @@ File.prototype.clone = function (opt) {
// Clone our file contents
var contents;
if (this.isStream()) {
contents = this.contents.clone();
var streams = teex(this._contents);
this._contents = streams[0];
contents = streams[1];
} else if (this.isBuffer()) {
contents = opt.contents ? Buffer.from(this.contents) : this.contents;
}
Expand Down Expand Up @@ -189,13 +191,6 @@ Object.defineProperty(File.prototype, 'contents', {
throw new Error('File.contents can only be a Buffer, a Stream, or null.');
}

// Ask cloneable if the stream is a already a cloneable
// this avoid piping into many streams
// reducing the overhead of cloning
if (isStream(val) && !cloneable.isCloneable(val)) {
val = cloneable(val);
}

this._contents = val;
},
});
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@
"test": "nyc mocha --async-only"
},
"dependencies": {
"clone": "^2.1.1",
"clone": "^2.1.2",
"clone-stats": "^1.0.0",
"cloneable-readable": "^2.1.0",
"remove-trailing-separator": "^1.0.1",
"replace-ext": "^2.0.0"
"remove-trailing-separator": "^1.1.0",
"replace-ext": "^2.0.0",
"teex": "^1.0.1"
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-gulp": "^5.0.1",
"eslint-plugin-node": "^11.1.0",
"expect": "^27.4.6",
"mississippi": "^4.0.0",
"mocha": "^8.4.0",
"nyc": "^15.1.0"
"nyc": "^15.1.0",
"readable-stream": "^3.6.0",
"streamx": "^2.12.5"
},
"nyc": {
"reporter": [
Expand Down
Loading