From: Dan Allen Date: Fri, 6 Nov 2020 21:50:11 +0000 (-0700) Subject: drop through2 dependency X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8e09c1d17f3eac5957f913d691a777b52ff73cc3;p=working%2Feg-antora.git drop through2 dependency use native stream.Transform instead --- diff --git a/gulp.d/lib/gulp-prettier-eslint.js b/gulp.d/lib/gulp-prettier-eslint.js index 552df28..fe674da 100644 --- a/gulp.d/lib/gulp-prettier-eslint.js +++ b/gulp.d/lib/gulp-prettier-eslint.js @@ -1,9 +1,10 @@ 'use strict' const log = require('fancy-log') -const { obj: map } = require('through2') const PluginError = require('plugin-error') const prettierEslint = require('prettier-eslint') +const { Transform } = require('stream') +const map = (transform) => new Transform({ objectMode: true, transform }) module.exports = () => { const report = { changed: 0, unchanged: 0 } diff --git a/gulp.d/tasks/build-preview-pages.js b/gulp.d/tasks/build-preview-pages.js index add0836..e0604c8 100644 --- a/gulp.d/tasks/build-preview-pages.js +++ b/gulp.d/tasks/build-preview-pages.js @@ -9,11 +9,12 @@ Error.call = (self, ...args) => { const asciidoctor = require('asciidoctor.js')() const fs = require('fs-extra') const handlebars = require('handlebars') -const { obj: map } = require('through2') const merge = require('merge-stream') const ospath = require('path') const path = ospath.posix const requireFromString = require('require-from-string') +const { Transform } = require('stream') +const map = (transform = () => {}, flush = undefined) => new Transform({ objectMode: true, transform, flush }) const vfs = require('vinyl-fs') const yaml = require('js-yaml') @@ -62,7 +63,7 @@ module.exports = (src, previewSrc, previewDest, sink = () => map()) => (done) => }) ) .pipe(vfs.dest(previewDest)) - .on('error', (e) => done) + //.on('error', done) .pipe(sink()) ) diff --git a/gulp.d/tasks/build.js b/gulp.d/tasks/build.js index d6ff379..d6eabb7 100644 --- a/gulp.d/tasks/build.js +++ b/gulp.d/tasks/build.js @@ -7,7 +7,6 @@ const concat = require('gulp-concat') const cssnano = require('cssnano') const fs = require('fs-extra') const imagemin = require('gulp-imagemin') -const { obj: map } = require('through2') const merge = require('merge-stream') const ospath = require('path') const path = ospath.posix @@ -16,6 +15,8 @@ const postcssCalc = require('postcss-calc') const postcssImport = require('postcss-import') const postcssUrl = require('postcss-url') const postcssVar = require('postcss-custom-properties') +const { Transform } = require('stream') +const map = (transform) => new Transform({ objectMode: true, transform }) const uglify = require('gulp-uglify') const vfs = require('vinyl-fs') diff --git a/gulp.d/tasks/remove.js b/gulp.d/tasks/remove.js index 3f71eec..71a8dac 100644 --- a/gulp.d/tasks/remove.js +++ b/gulp.d/tasks/remove.js @@ -1,7 +1,8 @@ 'use strict' const fs = require('fs-extra') -const { obj: map } = require('through2') +const { Transform } = require('stream') +const map = (transform) => new Transform({ objectMode: true, transform }) const vfs = require('vinyl-fs') module.exports = (files) => () => diff --git a/package.json b/package.json index 03a3967..f83e043 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "require-from-string": "~2.0", "stylelint": "~13.3", "stylelint-config-standard": "~20.0", - "through2": "~3.0", "typeface-roboto": "0.0.75", "typeface-roboto-mono": "0.0.75", "vinyl-buffer": "~1.0",