diff --git a/index.js b/index.js index b9869cc..23bc4f2 100644 --- a/index.js +++ b/index.js @@ -192,7 +192,7 @@ class Funnel extends Plugin { } } - let inputPathExists = this.input.existsSync(this.srcDir || './'); + let inputPathExists = this.input.at(0).fs.existsSync(this.srcDir || './'); let linkedRoots = false; if (this.shouldLinkRoots()) { @@ -317,9 +317,9 @@ class Funnel extends Plugin { } else { if (this._matchedWalk) { - entries = this.input.entries(this.srcDir || './', { globs: this.include, ignore: this.exclude }); + entries = this.input.at(0).entries(this.srcDir || './', { globs: this.include, ignore: this.exclude }); } else { - entries = this.input.entries(this.srcDir || './'); + entries = this.input.at(0).entries(this.srcDir || './'); } entries = this._processEntries(entries); diff --git a/tests/index.js b/tests/index.js index a4367ed..1336f49 100644 --- a/tests/index.js +++ b/tests/index.js @@ -1167,5 +1167,39 @@ describe('broccoli-funnel', function() { expect(walkSync(outputPath)).to.eql(['lol/', 'lol/foo.js']); }); + + it('providing additional trees does not change matched files', async function() { + class FunnelSubclass extends Funnel.Funnel { + constructor(inputNode, options) { + super([inputNode, input.path('dir1/subdir1/subsubdir2')], options); + + this._hasBuilt = false; + } + + build() { + if (this._hasBuilt === false) { + if (!fs.existsSync(`${this.inputPaths[1]}/some.js`)) { + throw new Error('Could not find file!!!'); + } + // set custom destDir to ensure our custom build code ran + this.destDir = 'lol'; + this._hasBuilt = true; + } + + return super.build(); + } + } + + let inputPath = input.path('lib/utils'); + let node = new FunnelSubclass(inputPath, { + include: ['**/*.js'], + }); + output = createBuilder(node); + + await output.build(); + let outputPath = output.path(); + + expect(walkSync(outputPath)).to.eql(['lol/', 'lol/foo.js']); + }); }); });