From 83639bc5598e0a3071fa5e16690257d6f50a4f01 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Tue, 14 Feb 2023 18:29:22 -0300 Subject: [PATCH] add filter option to applyTransforms (#456) --- lib/environment.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/environment.js b/lib/environment.js index 88de7da3..54774985 100644 --- a/lib/environment.js +++ b/lib/environment.js @@ -34,6 +34,8 @@ const { createYoResolveTransform } = require('./util/transform'); +const {isFilePending} = FileEditor.State; + /** * Two-step argument splitting function that first splits arguments in quotes, * and then splits up the remaining arguments if they are not part of a quote. @@ -1230,12 +1232,13 @@ class Environment extends Base { /** * Apply transform streams to file in MemFs. * @param {Transform[]} transformStreams - transform streams to be applied. - * @param {Stream} [stream] - files stream, defaults to this.sharedFs.stream(). + * @param {{ streamOptions: any; stream: Stream; name: string; log: boolean }} [options] - files stream, defaults to this.sharedFs.stream(). * @return {Promise} */ applyTransforms(transformStreams, options = {}) { const { - stream = this.sharedFs.stream(), + streamOptions = {filter: file => isFilePending(file)}, + stream = this.sharedFs.stream(streamOptions), name = 'Transforming' } = options;