2
2
Object.defineProperty(exports, "__esModule", { value: true });
3
3
exports.Glob = void 0;
4
4
const minimatch_1 = require("minimatch");
5
-
const path_scurry_1 = require("path-scurry");
6
5
const node_url_1 = require("node:url");
6
+
const path_scurry_1 = require("path-scurry");
7
7
const pattern_js_1 = require("./pattern.js");
8
8
const walker_js_1 = require("./walker.js");
9
9
// if no process global, just call it linux.
10
10
// so we default to case-sensitive, / separators
11
-
const defaultPlatform = typeof process === 'object' &&
11
+
const defaultPlatform = (typeof process === 'object' &&
12
12
process &&
13
-
typeof process.platform === 'string'
14
-
? process.platform
13
+
typeof process.platform === 'string') ?
14
+
process.platform
15
15
: 'linux';
16
16
/**
17
17
* An object that can perform glob pattern traversals.
@@ -41,6 +41,7 @@ class Glob {
41
41
signal;
42
42
windowsPathsNoEscape;
43
43
withFileTypes;
44
+
includeChildMatches;
44
45
/**
45
46
* The options provided to the constructor.
46
47
*/
@@ -86,6 +87,7 @@ class Glob {
86
87
this.noext = !!opts.noext;
87
88
this.realpath = !!opts.realpath;
88
89
this.absolute = opts.absolute;
90
+
this.includeChildMatches = opts.includeChildMatches !== false;
89
91
this.noglobstar = !!opts.noglobstar;
90
92
this.matchBase = !!opts.matchBase;
91
93
this.maxDepth =
@@ -100,7 +102,8 @@ class Glob {
100
102
}
101
103
this.windowsPathsNoEscape =
102
104
!!opts.windowsPathsNoEscape ||
103
-
opts.allowWindowsEscape === false;
105
+
opts.allowWindowsEscape ===
106
+
false;
104
107
if (this.windowsPathsNoEscape) {
105
108
pattern = pattern.map(p => p.replace(/\\/g, '/'));
106
109
}
@@ -121,12 +124,9 @@ class Glob {
121
124
}
122
125
}
123
126
else {
124
-
const Scurry = opts.platform === 'win32'
125
-
? path_scurry_1.PathScurryWin32
126
-
: opts.platform === 'darwin'
127
-
? path_scurry_1.PathScurryDarwin
128
-
: opts.platform
129
-
? path_scurry_1.PathScurryPosix
127
+
const Scurry = opts.platform === 'win32' ? path_scurry_1.PathScurryWin32
128
+
: opts.platform === 'darwin' ? path_scurry_1.PathScurryDarwin
129
+
: opts.platform ? path_scurry_1.PathScurryPosix
130
130
: path_scurry_1.PathScurry;
131
131
this.scurry = new Scurry(this.cwd, {
132
132
nocase: opts.nocase,
@@ -178,44 +178,48 @@ class Glob {
178
178
return [
179
179
...(await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
180
180
...this.opts,
181
-
maxDepth: this.maxDepth !== Infinity
182
-
? this.maxDepth + this.scurry.cwd.depth()
181
+
maxDepth: this.maxDepth !== Infinity ?
182
+
this.maxDepth + this.scurry.cwd.depth()
183
183
: Infinity,
184
184
platform: this.platform,
185
185
nocase: this.nocase,
186
+
includeChildMatches: this.includeChildMatches,
186
187
}).walk()),
187
188
];
188
189
}
189
190
walkSync() {
190
191
return [
191
192
...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
192
193
...this.opts,
193
-
maxDepth: this.maxDepth !== Infinity
194
-
? this.maxDepth + this.scurry.cwd.depth()
194
+
maxDepth: this.maxDepth !== Infinity ?
195
+
this.maxDepth + this.scurry.cwd.depth()
195
196
: Infinity,
196
197
platform: this.platform,
197
198
nocase: this.nocase,
199
+
includeChildMatches: this.includeChildMatches,
198
200
}).walkSync(),
199
201
];
200
202
}
201
203
stream() {
202
204
return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
203
205
...this.opts,
204
-
maxDepth: this.maxDepth !== Infinity
205
-
? this.maxDepth + this.scurry.cwd.depth()
206
+
maxDepth: this.maxDepth !== Infinity ?
207
+
this.maxDepth + this.scurry.cwd.depth()
206
208
: Infinity,
207
209
platform: this.platform,
208
210
nocase: this.nocase,
211
+
includeChildMatches: this.includeChildMatches,
209
212
}).stream();
210
213
}
211
214
streamSync() {
212
215
return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
213
216
...this.opts,
214
-
maxDepth: this.maxDepth !== Infinity
215
-
? this.maxDepth + this.scurry.cwd.depth()
217
+
maxDepth: this.maxDepth !== Infinity ?
218
+
this.maxDepth + this.scurry.cwd.depth()
216
219
: Infinity,
217
220
platform: this.platform,
218
221
nocase: this.nocase,
222
+
includeChildMatches: this.includeChildMatches,
219
223
}).streamSync();
220
224
}
221
225
/**
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4