Remove the vinyl-fs dependency

In Gulp 4, which we use for years now, the `gulp.src()` function
supports the `removeBOM` option to disable the default BOM stripping,
so this commit uses that to get rid of our `vinyl-fs` dependency.

Note that this actually makes disabling BOM stripping work again. It's
currently broken because in `vinyl-fs` 3, that we already use since 2018
in commit 95de23e, the `stripBOM` option was renamed to `removeBOM`, so
the current code doesn't actually disable BOM stripping which we now
confirmed and sadly broke for years without anyone noticing. Most likely
this is because the BOM is not required for UTF-8 documents, but while
not necessary it also can't hurt to have it for tools that use it to
determine if a document is UTF-8.
This commit is contained in:
Tim van der Meij 2023-07-23 17:54:13 +02:00
parent 8b2380823c
commit b7b3636ec2
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
3 changed files with 9 additions and 10 deletions

View File

@ -34,7 +34,6 @@ import rimraf from "rimraf";
import stream from "stream"; import stream from "stream";
import streamqueue from "streamqueue"; import streamqueue from "streamqueue";
import through from "through2"; import through from "through2";
import vfs from "vinyl-fs";
import Vinyl from "vinyl"; import Vinyl from "vinyl";
import webpack2 from "webpack"; import webpack2 from "webpack";
import webpackStream from "webpack-stream"; import webpackStream from "webpack-stream";
@ -2098,15 +2097,14 @@ function ghPagesPrepare() {
rimraf.sync(GH_PAGES_DIR); rimraf.sync(GH_PAGES_DIR);
// 'vfs' because web/viewer.html needs its BOM.
return merge([ return merge([
vfs gulp
.src(GENERIC_DIR + "**/*", { base: GENERIC_DIR, stripBOM: false }) .src(GENERIC_DIR + "**/*", { base: GENERIC_DIR, removeBOM: false })
.pipe(gulp.dest(GH_PAGES_DIR)), .pipe(gulp.dest(GH_PAGES_DIR)),
vfs gulp
.src(GENERIC_LEGACY_DIR + "**/*", { .src(GENERIC_LEGACY_DIR + "**/*", {
base: GENERIC_LEGACY_DIR, base: GENERIC_LEGACY_DIR,
stripBOM: false, removeBOM: false,
}) })
.pipe(gulp.dest(GH_PAGES_DIR + "legacy/")), .pipe(gulp.dest(GH_PAGES_DIR + "legacy/")),
gulp gulp
@ -2223,8 +2221,11 @@ gulp.task(
return merge([ return merge([
packageJson().pipe(gulp.dest(DIST_DIR)), packageJson().pipe(gulp.dest(DIST_DIR)),
vfs gulp
.src("external/dist/**/*", { base: "external/dist", stripBOM: false }) .src("external/dist/**/*", {
base: "external/dist",
removeBOM: false,
})
.pipe(gulp.dest(DIST_DIR)), .pipe(gulp.dest(DIST_DIR)),
gulp.src(GENERIC_DIR + "LICENSE").pipe(gulp.dest(DIST_DIR)), gulp.src(GENERIC_DIR + "LICENSE").pipe(gulp.dest(DIST_DIR)),
gulp gulp

1
package-lock.json generated
View File

@ -60,7 +60,6 @@
"typescript": "^5.1.6", "typescript": "^5.1.6",
"typogr": "^0.6.8", "typogr": "^0.6.8",
"vinyl": "^3.0.0", "vinyl": "^3.0.0",
"vinyl-fs": "^3.0.3",
"webpack": "^5.88.2", "webpack": "^5.88.2",
"webpack-stream": "^7.0.0", "webpack-stream": "^7.0.0",
"wintersmith": "^2.5.0", "wintersmith": "^2.5.0",

View File

@ -53,7 +53,6 @@
"typescript": "^5.1.6", "typescript": "^5.1.6",
"typogr": "^0.6.8", "typogr": "^0.6.8",
"vinyl": "^3.0.0", "vinyl": "^3.0.0",
"vinyl-fs": "^3.0.3",
"webpack": "^5.88.2", "webpack": "^5.88.2",
"webpack-stream": "^7.0.0", "webpack-stream": "^7.0.0",
"wintersmith": "^2.5.0", "wintersmith": "^2.5.0",