Skip to content

Commit dcae5e2

Browse files
author
Robert Jackson
authored
Merge pull request #147 from broccolijs/ensure-additional-trees-dont-leak
2 parents 1ec8bc2 + cfc238e commit dcae5e2

2 files changed

Lines changed: 37 additions & 3 deletions

File tree

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class Funnel extends Plugin {
192192
}
193193
}
194194

195-
let inputPathExists = this.input.existsSync(this.srcDir || './');
195+
let inputPathExists = this.input.at(0).fs.existsSync(this.srcDir || './');
196196

197197
let linkedRoots = false;
198198
if (this.shouldLinkRoots()) {
@@ -317,9 +317,9 @@ class Funnel extends Plugin {
317317
} else {
318318

319319
if (this._matchedWalk) {
320-
entries = this.input.entries(this.srcDir || './', { globs: this.include, ignore: this.exclude });
320+
entries = this.input.at(0).entries(this.srcDir || './', { globs: this.include, ignore: this.exclude });
321321
} else {
322-
entries = this.input.entries(this.srcDir || './');
322+
entries = this.input.at(0).entries(this.srcDir || './');
323323
}
324324

325325
entries = this._processEntries(entries);

tests/index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,5 +1167,39 @@ describe('broccoli-funnel', function() {
11671167

11681168
expect(walkSync(outputPath)).to.eql(['lol/', 'lol/foo.js']);
11691169
});
1170+
1171+
it('providing additional trees does not change matched files', async function() {
1172+
class FunnelSubclass extends Funnel.Funnel {
1173+
constructor(inputNode, options) {
1174+
super([inputNode, input.path('dir1/subdir1/subsubdir2')], options);
1175+
1176+
this._hasBuilt = false;
1177+
}
1178+
1179+
build() {
1180+
if (this._hasBuilt === false) {
1181+
if (!fs.existsSync(`${this.inputPaths[1]}/some.js`)) {
1182+
throw new Error('Could not find file!!!');
1183+
}
1184+
// set custom destDir to ensure our custom build code ran
1185+
this.destDir = 'lol';
1186+
this._hasBuilt = true;
1187+
}
1188+
1189+
return super.build();
1190+
}
1191+
}
1192+
1193+
let inputPath = input.path('lib/utils');
1194+
let node = new FunnelSubclass(inputPath, {
1195+
include: ['**/*.js'],
1196+
});
1197+
output = createBuilder(node);
1198+
1199+
await output.build();
1200+
let outputPath = output.path();
1201+
1202+
expect(walkSync(outputPath)).to.eql(['lol/', 'lol/foo.js']);
1203+
});
11701204
});
11711205
});

0 commit comments

Comments
 (0)