Skip to content

Commit 3b5d2e5

Browse files
slightlyoffdanez
andauthored
feat: Move to fast-glob and expose options for it. (#48)
* Move to `fast-glob` and expose options for it. * update yarn.lock Co-authored-by: Daniel Tschinder <[email protected]>
1 parent cce417e commit 3b5d2e5

File tree

3 files changed

+11
-118
lines changed

3 files changed

+11
-118
lines changed

index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

33
const { EventEmitter } = require('events');
4-
const globStream = require('glob-stream');
4+
const fg = require('fast-glob');
55
const workerFarm = require('worker-farm');
66

77
class FileProcessor extends EventEmitter {
8-
constructor(globPattern, worker, options) {
8+
constructor(globPattern, worker, options = {}, globOptions = {}) {
99
super();
1010
options = options || {};
11-
const glob = (this.glob = globStream(globPattern));
11+
const glob = (this.glob = fg.stream(globPattern, globOptions));
1212
this.invokeWorker = options.invokeWorker || defaultInvokeWorker;
1313
const workers = (this.workers = workerFarm(options.worker || {}, worker));
1414

@@ -26,7 +26,7 @@ class FileProcessor extends EventEmitter {
2626
}
2727
};
2828

29-
glob.on('data', ({ path }) => {
29+
glob.on('data', (path) => {
3030
queuedCount++;
3131
this.emit('queued', path);
3232
this.process(path, (err, result) => {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"index.js"
1919
],
2020
"dependencies": {
21-
"glob-stream": "^6.1.0",
21+
"fast-glob": "^3.2.4",
2222
"worker-farm": "^1.4.1"
2323
},
2424
"devDependencies": {

yarn.lock

+6-113
Original file line numberDiff line numberDiff line change
@@ -3441,7 +3441,7 @@ fast-diff@^1.1.2:
34413441
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
34423442
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
34433443

3444-
fast-glob@^3.1.1:
3444+
fast-glob@^3.1.1, fast-glob@^3.2.4:
34453445
version "3.2.4"
34463446
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3"
34473447
integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==
@@ -3859,37 +3859,13 @@ gitconfiglocal@^2.1.0:
38593859
dependencies:
38603860
ini "^1.3.2"
38613861

3862-
glob-parent@^3.1.0:
3863-
version "3.1.0"
3864-
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"
3865-
integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=
3866-
dependencies:
3867-
is-glob "^3.1.0"
3868-
path-dirname "^1.0.0"
3869-
38703862
glob-parent@^5.0.0, glob-parent@^5.1.0:
38713863
version "5.1.1"
38723864
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
38733865
integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==
38743866
dependencies:
38753867
is-glob "^4.0.1"
38763868

3877-
glob-stream@^6.1.0:
3878-
version "6.1.0"
3879-
resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-6.1.0.tgz#7045c99413b3eb94888d83ab46d0b404cc7bdde4"
3880-
integrity sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=
3881-
dependencies:
3882-
extend "^3.0.0"
3883-
glob "^7.1.1"
3884-
glob-parent "^3.1.0"
3885-
is-negated-glob "^1.0.0"
3886-
ordered-read-streams "^1.0.0"
3887-
pumpify "^1.3.5"
3888-
readable-stream "^2.1.5"
3889-
remove-trailing-separator "^1.0.1"
3890-
to-absolute-glob "^2.0.0"
3891-
unique-stream "^2.0.2"
3892-
38933869
glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
38943870
version "7.1.6"
38953871
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
@@ -4360,14 +4336,6 @@ [email protected]:
43604336
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
43614337
integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=
43624338

4363-
is-absolute@^1.0.0:
4364-
version "1.0.0"
4365-
resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576"
4366-
integrity sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==
4367-
dependencies:
4368-
is-relative "^1.0.0"
4369-
is-windows "^1.0.1"
4370-
43714339
is-accessor-descriptor@^0.1.6:
43724340
version "0.1.6"
43734341
resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6"
@@ -4504,7 +4472,7 @@ is-extendable@^1.0.1:
45044472
dependencies:
45054473
is-plain-object "^2.0.4"
45064474

4507-
is-extglob@^2.1.0, is-extglob@^2.1.1:
4475+
is-extglob@^2.1.1:
45084476
version "2.1.1"
45094477
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
45104478
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
@@ -4531,13 +4499,6 @@ is-generator-fn@^2.0.0:
45314499
resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118"
45324500
integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==
45334501

4534-
is-glob@^3.1.0:
4535-
version "3.1.0"
4536-
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
4537-
integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=
4538-
dependencies:
4539-
is-extglob "^2.1.0"
4540-
45414502
is-glob@^4.0.0, is-glob@^4.0.1:
45424503
version "4.0.1"
45434504
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
@@ -4558,11 +4519,6 @@ is-installed-globally@^0.1.0:
45584519
global-dirs "^0.1.0"
45594520
is-path-inside "^1.0.0"
45604521

4561-
is-negated-glob@^1.0.0:
4562-
version "1.0.0"
4563-
resolved "https://registry.yarnpkg.com/is-negated-glob/-/is-negated-glob-1.0.0.tgz#6910bca5da8c95e784b5751b976cf5a10fee36d2"
4564-
integrity sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=
4565-
45664522
is-negative-zero@^2.0.0:
45674523
version "2.0.1"
45684524
resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24"
@@ -4663,13 +4619,6 @@ is-regexp@^1.0.0:
46634619
resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069"
46644620
integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk=
46654621

4666-
is-relative@^1.0.0:
4667-
version "1.0.0"
4668-
resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d"
4669-
integrity sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==
4670-
dependencies:
4671-
is-unc-path "^1.0.0"
4672-
46734622
is-retry-allowed@^1.0.0:
46744623
version "1.2.0"
46754624
resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4"
@@ -4721,19 +4670,12 @@ is-typedarray@^1.0.0, is-typedarray@~1.0.0:
47214670
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
47224671
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
47234672

4724-
is-unc-path@^1.0.0:
4725-
version "1.0.0"
4726-
resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-1.0.0.tgz#d731e8898ed090a12c352ad2eaed5095ad322c9d"
4727-
integrity sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==
4728-
dependencies:
4729-
unc-path-regex "^0.1.2"
4730-
47314673
is-whitespace-character@^1.0.0:
47324674
version "1.0.4"
47334675
resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz#0858edd94a95594c7c9dd0b5c174ec6e45ee4aa7"
47344676
integrity sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==
47354677

4736-
is-windows@^1.0.1, is-windows@^1.0.2:
4678+
is-windows@^1.0.2:
47374679
version "1.0.2"
47384680
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
47394681
integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==
@@ -6652,7 +6594,6 @@ npm@^6.14.8:
66526594
cmd-shim "^3.0.3"
66536595
columnify "~1.5.4"
66546596
config-chain "^1.1.12"
6655-
debuglog "*"
66566597
detect-indent "~5.0.0"
66576598
detect-newline "^2.1.0"
66586599
dezalgo "~1.0.3"
@@ -6667,7 +6608,6 @@ npm@^6.14.8:
66676608
has-unicode "~2.0.1"
66686609
hosted-git-info "^2.8.8"
66696610
iferr "^1.0.2"
6670-
imurmurhash "*"
66716611
infer-owner "^1.0.4"
66726612
inflight "~1.0.6"
66736613
inherits "^2.0.4"
@@ -6686,14 +6626,8 @@ npm@^6.14.8:
66866626
libnpx "^10.2.4"
66876627
lock-verify "^2.1.0"
66886628
lockfile "^1.0.4"
6689-
lodash._baseindexof "*"
66906629
lodash._baseuniq "~4.6.0"
6691-
lodash._bindcallback "*"
6692-
lodash._cacheindexof "*"
6693-
lodash._createcache "*"
6694-
lodash._getnative "*"
66956630
lodash.clonedeep "~4.5.0"
6696-
lodash.restparam "*"
66976631
lodash.union "~4.6.0"
66986632
lodash.uniq "~4.5.0"
66996633
lodash.without "~4.4.0"
@@ -6928,13 +6862,6 @@ optionator@^0.9.1:
69286862
type-check "^0.4.0"
69296863
word-wrap "^1.2.3"
69306864

6931-
ordered-read-streams@^1.0.0:
6932-
version "1.0.1"
6933-
resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz#77c0cb37c41525d64166d990ffad7ec6a0e1363e"
6934-
integrity sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=
6935-
dependencies:
6936-
readable-stream "^2.0.1"
6937-
69386865
os-homedir@^1.0.0:
69396866
version "1.0.2"
69406867
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
@@ -7202,11 +7129,6 @@ pascalcase@^0.1.1:
72027129
resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14"
72037130
integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=
72047131

7205-
path-dirname@^1.0.0:
7206-
version "1.0.2"
7207-
resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0"
7208-
integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=
7209-
72107132
path-exists@^3.0.0:
72117133
version "3.0.0"
72127134
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
@@ -7468,7 +7390,7 @@ pump@^3.0.0:
74687390
end-of-stream "^1.1.0"
74697391
once "^1.3.1"
74707392

7471-
pumpify@^1.3.3, pumpify@^1.3.5:
7393+
pumpify@^1.3.3:
74727394
version "1.5.1"
74737395
resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce"
74747396
integrity sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==
@@ -7666,7 +7588,7 @@ read@1, read@~1.0.1, read@~1.0.7:
76667588
dependencies:
76677589
mute-stream "~0.0.4"
76687590

7669-
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.6, readable-stream@~2.3.6:
7591+
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.6, readable-stream@~2.3.6:
76707592
version "2.3.7"
76717593
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
76727594
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
@@ -8914,14 +8836,6 @@ throat@^5.0.0:
89148836
resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b"
89158837
integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==
89168838

8917-
through2-filter@^3.0.0:
8918-
version "3.0.0"
8919-
resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-3.0.0.tgz#700e786df2367c2c88cd8aa5be4cf9c1e7831254"
8920-
integrity sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==
8921-
dependencies:
8922-
through2 "~2.0.0"
8923-
xtend "~4.0.0"
8924-
89258839
through2@^2.0.0, through2@^2.0.2, through2@~2.0.0:
89268840
version "2.0.5"
89278841
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
@@ -8957,14 +8871,6 @@ [email protected]:
89578871
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
89588872
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=
89598873

8960-
to-absolute-glob@^2.0.0:
8961-
version "2.0.2"
8962-
resolved "https://registry.yarnpkg.com/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz#1865f43d9e74b0822db9f145b78cff7d0f7c849b"
8963-
integrity sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=
8964-
dependencies:
8965-
is-absolute "^1.0.0"
8966-
is-negated-glob "^1.0.0"
8967-
89688874
to-fast-properties@^2.0.0:
89698875
version "2.0.0"
89708876
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
@@ -9183,11 +9089,6 @@ umask@^1.1.0, umask@~1.1.0:
91839089
resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d"
91849090
integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0=
91859091

9186-
unc-path-regex@^0.1.2:
9187-
version "0.1.2"
9188-
resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa"
9189-
integrity sha1-5z3T17DXxe2G+6xrCufYxqadUPo=
9190-
91919092
underscore@~1.8.3:
91929093
version "1.8.3"
91939094
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022"
@@ -9237,14 +9138,6 @@ unique-slug@^2.0.0:
92379138
dependencies:
92389139
imurmurhash "^0.1.4"
92399140

9240-
unique-stream@^2.0.2:
9241-
version "2.3.1"
9242-
resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.3.1.tgz#c65d110e9a4adf9a6c5948b28053d9a8d04cbeac"
9243-
integrity sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==
9244-
dependencies:
9245-
json-stable-stringify-without-jsonify "^1.0.1"
9246-
through2-filter "^3.0.0"
9247-
92489141
unique-string@^1.0.0:
92499142
version "1.0.0"
92509143
resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a"
@@ -9710,7 +9603,7 @@ xmlchars@^2.2.0:
97109603
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
97119604
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
97129605

9713-
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1:
9606+
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1:
97149607
version "4.0.2"
97159608
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
97169609
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==

0 commit comments

Comments
 (0)