MCPcopy Index your code
hub / github.com/nodejs/node / make

Method make

deps/minimatch/index.js:1265–1311  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1263 debug(..._) {
1264 }
1265 make() {
1266 const pattern = this.pattern;
1267 const options = this.options;
1268 if (!options.nocomment && pattern.charAt(0) === "#") {
1269 this.comment = true;
1270 return;
1271 }
1272 if (!pattern) {
1273 this.empty = true;
1274 return;
1275 }
1276 this.parseNegate();
1277 this.globSet = [...new Set(this.braceExpand())];
1278 if (options.debug) {
1279 this.debug = (...args) => console.error(...args);
1280 }
1281 this.debug(this.pattern, this.globSet);
1282 const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
1283 this.globParts = this.preprocess(rawGlobParts);
1284 this.debug(this.pattern, this.globParts);
1285 let set = this.globParts.map((s, _, __) => {
1286 if (this.isWindows && this.windowsNoMagicRoot) {
1287 const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
1288 const isDrive = /^[a-z]:/i.test(s[0]);
1289 if (isUNC) {
1290 return [
1291 ...s.slice(0, 4),
1292 ...s.slice(4).map((ss) => this.parse(ss))
1293 ];
1294 } else if (isDrive) {
1295 return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
1296 }
1297 }
1298 return s.map((ss) => this.parse(ss));
1299 });
1300 this.debug(this.pattern, set);
1301 this.set = set.filter((s) => s.indexOf(false) === -1);
1302 if (this.isWindows) {
1303 for (let i = 0; i < this.set.length; i++) {
1304 const p = this.set[i];
1305 if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
1306 p[2] = "?";
1307 }
1308 }
1309 }
1310 this.debug(this.pattern, this.set);
1311 }
1312 // various transforms to equivalent pattern sets that are
1313 // faster to process in a filesystem walk. The goal is to
1314 // eliminate what we can, and push all ** patterns as far

Callers 4

constructorMethod · 0.80

Calls 12

parseNegateMethod · 0.80
braceExpandMethod · 0.80
debugMethod · 0.80
slashSplitMethod · 0.80
mapMethod · 0.65
sliceMethod · 0.65
parseMethod · 0.65
filterMethod · 0.65
errorMethod · 0.45
preprocessMethod · 0.45
testMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected