Skip to content

Commit

Permalink
add filter option to applyTransforms (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Feb 14, 2023
1 parent b5c56a4 commit 83639bc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 83639bc

Please sign in to comment.