Skip to content

Commit f37bccc

Browse files
authoredNov 16, 2022
chore!: Drop support for ordered globs (#115)
1 parent 156f801 commit f37bccc

File tree

2 files changed

+6
-46
lines changed

2 files changed

+6
-46
lines changed
 

‎index.js

+3-19
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ function globStream(globs, opt) {
5454
var glob = isNegatedGlob(globString);
5555
var globArray = glob.negated ? negatives : positives;
5656

57-
globArray.push({
58-
index: index,
59-
glob: glob.pattern,
60-
});
57+
globArray.push(glob.pattern);
6158
}
6259

6360
if (positives.length === 0) {
@@ -74,22 +71,9 @@ function globStream(globs, opt) {
7471
return pumpify.obj(aggregate, uniqueStream);
7572

7673
function streamFromPositive(positive) {
77-
var negativeGlobs = negatives
78-
.filter(indexGreaterThan(positive.index))
79-
.map(toGlob)
80-
.concat(ignore);
81-
return new GlobStream(positive.glob, negativeGlobs, ourOpt);
74+
var negativeGlobs = negatives.concat(ignore);
75+
return new GlobStream(positive, negativeGlobs, ourOpt);
8276
}
8377
}
8478

85-
function indexGreaterThan(index) {
86-
return function (obj) {
87-
return obj.index > index;
88-
};
89-
}
90-
91-
function toGlob(obj) {
92-
return obj.glob;
93-
}
94-
9579
module.exports = globStream;

‎test/index.js

+3-27
Original file line numberDiff line numberDiff line change
@@ -548,39 +548,15 @@ describe('glob-stream', function () {
548548
);
549549
});
550550

551-
it('respects order of negative globs', function (done) {
552-
var expected = {
553-
cwd: dir,
554-
base: dir + '/fixtures/stuff',
555-
path: dir + '/fixtures/stuff/run.dmc',
556-
};
557-
551+
it('applies all negative globs to each positive glob', function (done) {
558552
var globs = [
559553
'./fixtures/stuff/*',
560554
'!./fixtures/stuff/*.dmc',
561-
'./fixtures/stuff/run.dmc',
555+
'./fixtures/stuff/*.dmc',
562556
];
563557

564558
function assert(pathObjs) {
565-
expect(pathObjs.length).toEqual(1);
566-
expect(pathObjs[0]).toEqual(expected);
567-
}
568-
569-
pipe([globStream(globs, { cwd: dir }), concat(assert)], done);
570-
});
571-
572-
it('ignores leading negative globs', function (done) {
573-
var expected = {
574-
cwd: dir,
575-
base: dir + '/fixtures/stuff',
576-
path: dir + '/fixtures/stuff/run.dmc',
577-
};
578-
579-
var globs = ['!./fixtures/stuff/*.dmc', './fixtures/stuff/run.dmc'];
580-
581-
function assert(pathObjs) {
582-
expect(pathObjs.length).toEqual(1);
583-
expect(pathObjs[0]).toEqual(expected);
559+
expect(pathObjs.length).toEqual(0);
584560
}
585561

586562
pipe([globStream(globs, { cwd: dir }), concat(assert)], done);

0 commit comments

Comments
 (0)
Please sign in to comment.