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

Remove the through2 dependency in favor of the built-in Node.js stream.Transform #18113

Merged
merged 1 commit into from
May 21, 2024
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
18 changes: 10 additions & 8 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import replace from "gulp-replace";
import stream from "stream";
import streamqueue from "streamqueue";
import TerserPlugin from "terser-webpack-plugin";
import through from "through2";
import Vinyl from "vinyl";
import webpack2 from "webpack";
import webpackStream from "webpack-stream";
Expand Down Expand Up @@ -119,13 +118,16 @@ const DEFINES = Object.freeze({
});

function transform(charEncoding, transformFunction) {
return through.obj(function (vinylFile, enc, done) {
const transformedFile = vinylFile.clone();
transformedFile.contents = Buffer.from(
transformFunction(transformedFile.contents),
charEncoding
);
done(null, transformedFile);
return new stream.Transform({
objectMode: true,
transform(vinylFile, enc, done) {
const transformedFile = vinylFile.clone();
transformedFile.contents = Buffer.from(
transformFunction(transformedFile.contents),
charEncoding
);
done(null, transformedFile);
},
});
}

Expand Down
24 changes: 0 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"stylelint": "^16.5.0",
"stylelint-prettier": "^5.0.0",
"terser-webpack-plugin": "^5.3.10",
"through2": "^4.0.2",
"tsc-alias": "^1.8.10",
"ttest": "^4.0.0",
"typescript": "^5.4.5",
Expand Down