raggrep 0.10.4 → 0.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/indexer/index.d.ts +6 -4
- package/dist/cli/main.js +624 -82
- package/dist/cli/main.js.map +6 -5
- package/dist/domain/entities/fileIndex.d.ts +5 -0
- package/dist/index.js +636 -68
- package/dist/index.js.map +5 -4
- package/package.json +2 -1
package/dist/cli/main.js
CHANGED
|
@@ -327,6 +327,511 @@ function createSilentLogger() {
|
|
|
327
327
|
|
|
328
328
|
// src/infrastructure/logger/index.ts
|
|
329
329
|
var init_logger = () => {};
|
|
330
|
+
|
|
331
|
+
// node_modules/fdir/dist/index.mjs
|
|
332
|
+
import { createRequire as createRequire2 } from "module";
|
|
333
|
+
import { basename, dirname, normalize, relative, resolve, sep } from "path";
|
|
334
|
+
import * as nativeFs from "fs";
|
|
335
|
+
function cleanPath(path2) {
|
|
336
|
+
let normalized = normalize(path2);
|
|
337
|
+
if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
|
|
338
|
+
normalized = normalized.substring(0, normalized.length - 1);
|
|
339
|
+
return normalized;
|
|
340
|
+
}
|
|
341
|
+
function convertSlashes(path2, separator) {
|
|
342
|
+
return path2.replace(SLASHES_REGEX, separator);
|
|
343
|
+
}
|
|
344
|
+
function isRootDirectory(path2) {
|
|
345
|
+
return path2 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path2);
|
|
346
|
+
}
|
|
347
|
+
function normalizePath(path2, options) {
|
|
348
|
+
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
349
|
+
const pathNeedsCleaning = process.platform === "win32" && path2.includes("/") || path2.startsWith(".");
|
|
350
|
+
if (resolvePaths)
|
|
351
|
+
path2 = resolve(path2);
|
|
352
|
+
if (normalizePath$1 || pathNeedsCleaning)
|
|
353
|
+
path2 = cleanPath(path2);
|
|
354
|
+
if (path2 === ".")
|
|
355
|
+
return "";
|
|
356
|
+
const needsSeperator = path2[path2.length - 1] !== pathSeparator;
|
|
357
|
+
return convertSlashes(needsSeperator ? path2 + pathSeparator : path2, pathSeparator);
|
|
358
|
+
}
|
|
359
|
+
function joinPathWithBasePath(filename, directoryPath) {
|
|
360
|
+
return directoryPath + filename;
|
|
361
|
+
}
|
|
362
|
+
function joinPathWithRelativePath(root, options) {
|
|
363
|
+
return function(filename, directoryPath) {
|
|
364
|
+
const sameRoot = directoryPath.startsWith(root);
|
|
365
|
+
if (sameRoot)
|
|
366
|
+
return directoryPath.slice(root.length) + filename;
|
|
367
|
+
else
|
|
368
|
+
return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
function joinPath(filename) {
|
|
372
|
+
return filename;
|
|
373
|
+
}
|
|
374
|
+
function joinDirectoryPath(filename, directoryPath, separator) {
|
|
375
|
+
return directoryPath + filename + separator;
|
|
376
|
+
}
|
|
377
|
+
function build$7(root, options) {
|
|
378
|
+
const { relativePaths, includeBasePath } = options;
|
|
379
|
+
return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
|
|
380
|
+
}
|
|
381
|
+
function pushDirectoryWithRelativePath(root) {
|
|
382
|
+
return function(directoryPath, paths) {
|
|
383
|
+
paths.push(directoryPath.substring(root.length) || ".");
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function pushDirectoryFilterWithRelativePath(root) {
|
|
387
|
+
return function(directoryPath, paths, filters) {
|
|
388
|
+
const relativePath = directoryPath.substring(root.length) || ".";
|
|
389
|
+
if (filters.every((filter) => filter(relativePath, true)))
|
|
390
|
+
paths.push(relativePath);
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function build$6(root, options) {
|
|
394
|
+
const { includeDirs, filters, relativePaths } = options;
|
|
395
|
+
if (!includeDirs)
|
|
396
|
+
return empty$2;
|
|
397
|
+
if (relativePaths)
|
|
398
|
+
return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
|
|
399
|
+
return filters && filters.length ? pushDirectoryFilter : pushDirectory;
|
|
400
|
+
}
|
|
401
|
+
function build$5(options) {
|
|
402
|
+
const { excludeFiles, filters, onlyCounts } = options;
|
|
403
|
+
if (excludeFiles)
|
|
404
|
+
return empty$1;
|
|
405
|
+
if (filters && filters.length)
|
|
406
|
+
return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
|
|
407
|
+
else if (onlyCounts)
|
|
408
|
+
return pushFileCount;
|
|
409
|
+
else
|
|
410
|
+
return pushFile;
|
|
411
|
+
}
|
|
412
|
+
function build$4(options) {
|
|
413
|
+
return options.group ? getArrayGroup : getArray;
|
|
414
|
+
}
|
|
415
|
+
function build$3(options) {
|
|
416
|
+
return options.group ? groupFiles : empty;
|
|
417
|
+
}
|
|
418
|
+
function build$2(options, isSynchronous) {
|
|
419
|
+
if (!options.resolveSymlinks || options.excludeSymlinks)
|
|
420
|
+
return null;
|
|
421
|
+
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
422
|
+
}
|
|
423
|
+
function isRecursive(path2, resolved, state) {
|
|
424
|
+
if (state.options.useRealPaths)
|
|
425
|
+
return isRecursiveUsingRealPaths(resolved, state);
|
|
426
|
+
let parent = dirname(path2);
|
|
427
|
+
let depth = 1;
|
|
428
|
+
while (parent !== state.root && depth < 2) {
|
|
429
|
+
const resolvedPath = state.symlinks.get(parent);
|
|
430
|
+
const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
|
|
431
|
+
if (isSameRoot)
|
|
432
|
+
depth++;
|
|
433
|
+
else
|
|
434
|
+
parent = dirname(parent);
|
|
435
|
+
}
|
|
436
|
+
state.symlinks.set(path2, resolved);
|
|
437
|
+
return depth > 1;
|
|
438
|
+
}
|
|
439
|
+
function isRecursiveUsingRealPaths(resolved, state) {
|
|
440
|
+
return state.visited.includes(resolved + state.options.pathSeparator);
|
|
441
|
+
}
|
|
442
|
+
function report(error, callback$1, output, suppressErrors) {
|
|
443
|
+
if (error && !suppressErrors)
|
|
444
|
+
callback$1(error, output);
|
|
445
|
+
else
|
|
446
|
+
callback$1(null, output);
|
|
447
|
+
}
|
|
448
|
+
function build$1(options, isSynchronous) {
|
|
449
|
+
const { onlyCounts, group, maxFiles } = options;
|
|
450
|
+
if (onlyCounts)
|
|
451
|
+
return isSynchronous ? onlyCountsSync : onlyCountsAsync;
|
|
452
|
+
else if (group)
|
|
453
|
+
return isSynchronous ? groupsSync : groupsAsync;
|
|
454
|
+
else if (maxFiles)
|
|
455
|
+
return isSynchronous ? limitFilesSync : limitFilesAsync;
|
|
456
|
+
else
|
|
457
|
+
return isSynchronous ? defaultSync : defaultAsync;
|
|
458
|
+
}
|
|
459
|
+
function build(isSynchronous) {
|
|
460
|
+
return isSynchronous ? walkSync : walkAsync;
|
|
461
|
+
}
|
|
462
|
+
function promise(root, options) {
|
|
463
|
+
return new Promise((resolve$1, reject) => {
|
|
464
|
+
callback(root, options, (err2, output) => {
|
|
465
|
+
if (err2)
|
|
466
|
+
return reject(err2);
|
|
467
|
+
resolve$1(output);
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function callback(root, options, callback$1) {
|
|
472
|
+
let walker = new Walker(root, options, callback$1);
|
|
473
|
+
walker.start();
|
|
474
|
+
}
|
|
475
|
+
function sync(root, options) {
|
|
476
|
+
const walker = new Walker(root, options);
|
|
477
|
+
return walker.start();
|
|
478
|
+
}
|
|
479
|
+
var __require2, SLASHES_REGEX, WINDOWS_ROOT_DIR_REGEX, pushDirectory = (directoryPath, paths) => {
|
|
480
|
+
paths.push(directoryPath || ".");
|
|
481
|
+
}, pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
482
|
+
const path2 = directoryPath || ".";
|
|
483
|
+
if (filters.every((filter) => filter(path2, true)))
|
|
484
|
+
paths.push(path2);
|
|
485
|
+
}, empty$2 = () => {}, pushFileFilterAndCount = (filename, _paths, counts, filters) => {
|
|
486
|
+
if (filters.every((filter) => filter(filename, false)))
|
|
487
|
+
counts.files++;
|
|
488
|
+
}, pushFileFilter = (filename, paths, _counts, filters) => {
|
|
489
|
+
if (filters.every((filter) => filter(filename, false)))
|
|
490
|
+
paths.push(filename);
|
|
491
|
+
}, pushFileCount = (_filename, _paths, counts, _filters) => {
|
|
492
|
+
counts.files++;
|
|
493
|
+
}, pushFile = (filename, paths) => {
|
|
494
|
+
paths.push(filename);
|
|
495
|
+
}, empty$1 = () => {}, getArray = (paths) => {
|
|
496
|
+
return paths;
|
|
497
|
+
}, getArrayGroup = () => {
|
|
498
|
+
return [""].slice(0, 0);
|
|
499
|
+
}, groupFiles = (groups, directory, files) => {
|
|
500
|
+
groups.push({
|
|
501
|
+
directory,
|
|
502
|
+
files,
|
|
503
|
+
dir: directory
|
|
504
|
+
});
|
|
505
|
+
}, empty = () => {}, resolveSymlinksAsync = function(path2, state, callback$1) {
|
|
506
|
+
const { queue, fs: fs2, options: { suppressErrors } } = state;
|
|
507
|
+
queue.enqueue();
|
|
508
|
+
fs2.realpath(path2, (error, resolvedPath) => {
|
|
509
|
+
if (error)
|
|
510
|
+
return queue.dequeue(suppressErrors ? null : error, state);
|
|
511
|
+
fs2.stat(resolvedPath, (error$1, stat) => {
|
|
512
|
+
if (error$1)
|
|
513
|
+
return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
514
|
+
if (stat.isDirectory() && isRecursive(path2, resolvedPath, state))
|
|
515
|
+
return queue.dequeue(null, state);
|
|
516
|
+
callback$1(stat, resolvedPath);
|
|
517
|
+
queue.dequeue(null, state);
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
}, resolveSymlinks = function(path2, state, callback$1) {
|
|
521
|
+
const { queue, fs: fs2, options: { suppressErrors } } = state;
|
|
522
|
+
queue.enqueue();
|
|
523
|
+
try {
|
|
524
|
+
const resolvedPath = fs2.realpathSync(path2);
|
|
525
|
+
const stat = fs2.statSync(resolvedPath);
|
|
526
|
+
if (stat.isDirectory() && isRecursive(path2, resolvedPath, state))
|
|
527
|
+
return;
|
|
528
|
+
callback$1(stat, resolvedPath);
|
|
529
|
+
} catch (e) {
|
|
530
|
+
if (!suppressErrors)
|
|
531
|
+
throw e;
|
|
532
|
+
}
|
|
533
|
+
}, onlyCountsSync = (state) => {
|
|
534
|
+
return state.counts;
|
|
535
|
+
}, groupsSync = (state) => {
|
|
536
|
+
return state.groups;
|
|
537
|
+
}, defaultSync = (state) => {
|
|
538
|
+
return state.paths;
|
|
539
|
+
}, limitFilesSync = (state) => {
|
|
540
|
+
return state.paths.slice(0, state.options.maxFiles);
|
|
541
|
+
}, onlyCountsAsync = (state, error, callback$1) => {
|
|
542
|
+
report(error, callback$1, state.counts, state.options.suppressErrors);
|
|
543
|
+
return null;
|
|
544
|
+
}, defaultAsync = (state, error, callback$1) => {
|
|
545
|
+
report(error, callback$1, state.paths, state.options.suppressErrors);
|
|
546
|
+
return null;
|
|
547
|
+
}, limitFilesAsync = (state, error, callback$1) => {
|
|
548
|
+
report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
|
|
549
|
+
return null;
|
|
550
|
+
}, groupsAsync = (state, error, callback$1) => {
|
|
551
|
+
report(error, callback$1, state.groups, state.options.suppressErrors);
|
|
552
|
+
return null;
|
|
553
|
+
}, readdirOpts, walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
554
|
+
state.queue.enqueue();
|
|
555
|
+
if (currentDepth < 0)
|
|
556
|
+
return state.queue.dequeue(null, state);
|
|
557
|
+
const { fs: fs2 } = state;
|
|
558
|
+
state.visited.push(crawlPath);
|
|
559
|
+
state.counts.directories++;
|
|
560
|
+
fs2.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
|
|
561
|
+
callback$1(entries, directoryPath, currentDepth);
|
|
562
|
+
state.queue.dequeue(state.options.suppressErrors ? null : error, state);
|
|
563
|
+
});
|
|
564
|
+
}, walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
|
|
565
|
+
const { fs: fs2 } = state;
|
|
566
|
+
if (currentDepth < 0)
|
|
567
|
+
return;
|
|
568
|
+
state.visited.push(crawlPath);
|
|
569
|
+
state.counts.directories++;
|
|
570
|
+
let entries = [];
|
|
571
|
+
try {
|
|
572
|
+
entries = fs2.readdirSync(crawlPath || ".", readdirOpts);
|
|
573
|
+
} catch (e) {
|
|
574
|
+
if (!state.options.suppressErrors)
|
|
575
|
+
throw e;
|
|
576
|
+
}
|
|
577
|
+
callback$1(entries, directoryPath, currentDepth);
|
|
578
|
+
}, Queue = class {
|
|
579
|
+
count = 0;
|
|
580
|
+
constructor(onQueueEmpty) {
|
|
581
|
+
this.onQueueEmpty = onQueueEmpty;
|
|
582
|
+
}
|
|
583
|
+
enqueue() {
|
|
584
|
+
this.count++;
|
|
585
|
+
return this.count;
|
|
586
|
+
}
|
|
587
|
+
dequeue(error, output) {
|
|
588
|
+
if (this.onQueueEmpty && (--this.count <= 0 || error)) {
|
|
589
|
+
this.onQueueEmpty(error, output);
|
|
590
|
+
if (error) {
|
|
591
|
+
output.controller.abort();
|
|
592
|
+
this.onQueueEmpty = undefined;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}, Counter = class {
|
|
597
|
+
_files = 0;
|
|
598
|
+
_directories = 0;
|
|
599
|
+
set files(num) {
|
|
600
|
+
this._files = num;
|
|
601
|
+
}
|
|
602
|
+
get files() {
|
|
603
|
+
return this._files;
|
|
604
|
+
}
|
|
605
|
+
set directories(num) {
|
|
606
|
+
this._directories = num;
|
|
607
|
+
}
|
|
608
|
+
get directories() {
|
|
609
|
+
return this._directories;
|
|
610
|
+
}
|
|
611
|
+
get dirs() {
|
|
612
|
+
return this._directories;
|
|
613
|
+
}
|
|
614
|
+
}, Aborter = class {
|
|
615
|
+
aborted = false;
|
|
616
|
+
abort() {
|
|
617
|
+
this.aborted = true;
|
|
618
|
+
}
|
|
619
|
+
}, Walker = class {
|
|
620
|
+
root;
|
|
621
|
+
isSynchronous;
|
|
622
|
+
state;
|
|
623
|
+
joinPath;
|
|
624
|
+
pushDirectory;
|
|
625
|
+
pushFile;
|
|
626
|
+
getArray;
|
|
627
|
+
groupFiles;
|
|
628
|
+
resolveSymlink;
|
|
629
|
+
walkDirectory;
|
|
630
|
+
callbackInvoker;
|
|
631
|
+
constructor(root, options, callback$1) {
|
|
632
|
+
this.isSynchronous = !callback$1;
|
|
633
|
+
this.callbackInvoker = build$1(options, this.isSynchronous);
|
|
634
|
+
this.root = normalizePath(root, options);
|
|
635
|
+
this.state = {
|
|
636
|
+
root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
|
|
637
|
+
paths: [""].slice(0, 0),
|
|
638
|
+
groups: [],
|
|
639
|
+
counts: new Counter,
|
|
640
|
+
options,
|
|
641
|
+
queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
|
|
642
|
+
symlinks: /* @__PURE__ */ new Map,
|
|
643
|
+
visited: [""].slice(0, 0),
|
|
644
|
+
controller: new Aborter,
|
|
645
|
+
fs: options.fs || nativeFs
|
|
646
|
+
};
|
|
647
|
+
this.joinPath = build$7(this.root, options);
|
|
648
|
+
this.pushDirectory = build$6(this.root, options);
|
|
649
|
+
this.pushFile = build$5(options);
|
|
650
|
+
this.getArray = build$4(options);
|
|
651
|
+
this.groupFiles = build$3(options);
|
|
652
|
+
this.resolveSymlink = build$2(options, this.isSynchronous);
|
|
653
|
+
this.walkDirectory = build(this.isSynchronous);
|
|
654
|
+
}
|
|
655
|
+
start() {
|
|
656
|
+
this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
|
|
657
|
+
this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
|
|
658
|
+
return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
|
|
659
|
+
}
|
|
660
|
+
walk = (entries, directoryPath, depth) => {
|
|
661
|
+
const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
|
|
662
|
+
if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles)
|
|
663
|
+
return;
|
|
664
|
+
const files = this.getArray(this.state.paths);
|
|
665
|
+
for (let i2 = 0;i2 < entries.length; ++i2) {
|
|
666
|
+
const entry = entries[i2];
|
|
667
|
+
if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
|
|
668
|
+
const filename = this.joinPath(entry.name, directoryPath);
|
|
669
|
+
this.pushFile(filename, files, this.state.counts, filters);
|
|
670
|
+
} else if (entry.isDirectory()) {
|
|
671
|
+
let path2 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
672
|
+
if (exclude && exclude(entry.name, path2))
|
|
673
|
+
continue;
|
|
674
|
+
this.pushDirectory(path2, paths, filters);
|
|
675
|
+
this.walkDirectory(this.state, path2, path2, depth - 1, this.walk);
|
|
676
|
+
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
677
|
+
let path2 = joinPathWithBasePath(entry.name, directoryPath);
|
|
678
|
+
this.resolveSymlink(path2, this.state, (stat, resolvedPath) => {
|
|
679
|
+
if (stat.isDirectory()) {
|
|
680
|
+
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
681
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path2 + pathSeparator))
|
|
682
|
+
return;
|
|
683
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path2 + pathSeparator, depth - 1, this.walk);
|
|
684
|
+
} else {
|
|
685
|
+
resolvedPath = useRealPaths ? resolvedPath : path2;
|
|
686
|
+
const filename = basename(resolvedPath);
|
|
687
|
+
const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
|
|
688
|
+
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
689
|
+
this.pushFile(resolvedPath, files, this.state.counts, filters);
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
this.groupFiles(this.state.groups, directoryPath, files);
|
|
695
|
+
};
|
|
696
|
+
}, APIBuilder = class {
|
|
697
|
+
constructor(root, options) {
|
|
698
|
+
this.root = root;
|
|
699
|
+
this.options = options;
|
|
700
|
+
}
|
|
701
|
+
withPromise() {
|
|
702
|
+
return promise(this.root, this.options);
|
|
703
|
+
}
|
|
704
|
+
withCallback(cb) {
|
|
705
|
+
callback(this.root, this.options, cb);
|
|
706
|
+
}
|
|
707
|
+
sync() {
|
|
708
|
+
return sync(this.root, this.options);
|
|
709
|
+
}
|
|
710
|
+
}, pm = null, Builder = class {
|
|
711
|
+
globCache = {};
|
|
712
|
+
options = {
|
|
713
|
+
maxDepth: Infinity,
|
|
714
|
+
suppressErrors: true,
|
|
715
|
+
pathSeparator: sep,
|
|
716
|
+
filters: []
|
|
717
|
+
};
|
|
718
|
+
globFunction;
|
|
719
|
+
constructor(options) {
|
|
720
|
+
this.options = {
|
|
721
|
+
...this.options,
|
|
722
|
+
...options
|
|
723
|
+
};
|
|
724
|
+
this.globFunction = this.options.globFunction;
|
|
725
|
+
}
|
|
726
|
+
group() {
|
|
727
|
+
this.options.group = true;
|
|
728
|
+
return this;
|
|
729
|
+
}
|
|
730
|
+
withPathSeparator(separator) {
|
|
731
|
+
this.options.pathSeparator = separator;
|
|
732
|
+
return this;
|
|
733
|
+
}
|
|
734
|
+
withBasePath() {
|
|
735
|
+
this.options.includeBasePath = true;
|
|
736
|
+
return this;
|
|
737
|
+
}
|
|
738
|
+
withRelativePaths() {
|
|
739
|
+
this.options.relativePaths = true;
|
|
740
|
+
return this;
|
|
741
|
+
}
|
|
742
|
+
withDirs() {
|
|
743
|
+
this.options.includeDirs = true;
|
|
744
|
+
return this;
|
|
745
|
+
}
|
|
746
|
+
withMaxDepth(depth) {
|
|
747
|
+
this.options.maxDepth = depth;
|
|
748
|
+
return this;
|
|
749
|
+
}
|
|
750
|
+
withMaxFiles(limit) {
|
|
751
|
+
this.options.maxFiles = limit;
|
|
752
|
+
return this;
|
|
753
|
+
}
|
|
754
|
+
withFullPaths() {
|
|
755
|
+
this.options.resolvePaths = true;
|
|
756
|
+
this.options.includeBasePath = true;
|
|
757
|
+
return this;
|
|
758
|
+
}
|
|
759
|
+
withErrors() {
|
|
760
|
+
this.options.suppressErrors = false;
|
|
761
|
+
return this;
|
|
762
|
+
}
|
|
763
|
+
withSymlinks({ resolvePaths = true } = {}) {
|
|
764
|
+
this.options.resolveSymlinks = true;
|
|
765
|
+
this.options.useRealPaths = resolvePaths;
|
|
766
|
+
return this.withFullPaths();
|
|
767
|
+
}
|
|
768
|
+
withAbortSignal(signal) {
|
|
769
|
+
this.options.signal = signal;
|
|
770
|
+
return this;
|
|
771
|
+
}
|
|
772
|
+
normalize() {
|
|
773
|
+
this.options.normalizePath = true;
|
|
774
|
+
return this;
|
|
775
|
+
}
|
|
776
|
+
filter(predicate) {
|
|
777
|
+
this.options.filters.push(predicate);
|
|
778
|
+
return this;
|
|
779
|
+
}
|
|
780
|
+
onlyDirs() {
|
|
781
|
+
this.options.excludeFiles = true;
|
|
782
|
+
this.options.includeDirs = true;
|
|
783
|
+
return this;
|
|
784
|
+
}
|
|
785
|
+
exclude(predicate) {
|
|
786
|
+
this.options.exclude = predicate;
|
|
787
|
+
return this;
|
|
788
|
+
}
|
|
789
|
+
onlyCounts() {
|
|
790
|
+
this.options.onlyCounts = true;
|
|
791
|
+
return this;
|
|
792
|
+
}
|
|
793
|
+
crawl(root) {
|
|
794
|
+
return new APIBuilder(root || ".", this.options);
|
|
795
|
+
}
|
|
796
|
+
withGlobFunction(fn) {
|
|
797
|
+
this.globFunction = fn;
|
|
798
|
+
return this;
|
|
799
|
+
}
|
|
800
|
+
crawlWithOptions(root, options) {
|
|
801
|
+
this.options = {
|
|
802
|
+
...this.options,
|
|
803
|
+
...options
|
|
804
|
+
};
|
|
805
|
+
return new APIBuilder(root || ".", this.options);
|
|
806
|
+
}
|
|
807
|
+
glob(...patterns) {
|
|
808
|
+
if (this.globFunction)
|
|
809
|
+
return this.globWithOptions(patterns);
|
|
810
|
+
return this.globWithOptions(patterns, ...[{ dot: true }]);
|
|
811
|
+
}
|
|
812
|
+
globWithOptions(patterns, ...options) {
|
|
813
|
+
const globFn = this.globFunction || pm;
|
|
814
|
+
if (!globFn)
|
|
815
|
+
throw new Error("Please specify a glob function to use glob matching.");
|
|
816
|
+
var isMatch = this.globCache[patterns.join("\x00")];
|
|
817
|
+
if (!isMatch) {
|
|
818
|
+
isMatch = globFn(patterns, ...options);
|
|
819
|
+
this.globCache[patterns.join("\x00")] = isMatch;
|
|
820
|
+
}
|
|
821
|
+
this.options.filters.push((path2) => isMatch(path2));
|
|
822
|
+
return this;
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
var init_dist = __esm(() => {
|
|
826
|
+
__require2 = /* @__PURE__ */ createRequire2(import.meta.url);
|
|
827
|
+
SLASHES_REGEX = /[\\/]/g;
|
|
828
|
+
WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
829
|
+
readdirOpts = { withFileTypes: true };
|
|
830
|
+
try {
|
|
831
|
+
__require2.resolve("picomatch");
|
|
832
|
+
pm = __require2("picomatch");
|
|
833
|
+
} catch {}
|
|
834
|
+
});
|
|
330
835
|
// src/domain/entities/searchResult.ts
|
|
331
836
|
var DEFAULT_SEARCH_OPTIONS;
|
|
332
837
|
var init_searchResult = __esm(() => {
|
|
@@ -5200,8 +5705,8 @@ async function Module2(moduleArg = {}) {
|
|
|
5200
5705
|
var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined";
|
|
5201
5706
|
var ENVIRONMENT_IS_NODE = typeof process == "object" && process.versions?.node && process.type != "renderer";
|
|
5202
5707
|
if (ENVIRONMENT_IS_NODE) {
|
|
5203
|
-
const { createRequire:
|
|
5204
|
-
var require =
|
|
5708
|
+
const { createRequire: createRequire3 } = await import("module");
|
|
5709
|
+
var require = createRequire3(import.meta.url);
|
|
5205
5710
|
}
|
|
5206
5711
|
Module.currentQueryProgressCallback = null;
|
|
5207
5712
|
Module.currentProgressCallback = null;
|
|
@@ -5261,13 +5766,13 @@ async function Module2(moduleArg = {}) {
|
|
|
5261
5766
|
}
|
|
5262
5767
|
readAsync = /* @__PURE__ */ __name(async (url) => {
|
|
5263
5768
|
if (isFileURI(url)) {
|
|
5264
|
-
return new Promise((
|
|
5769
|
+
return new Promise((resolve3, reject) => {
|
|
5265
5770
|
var xhr = new XMLHttpRequest;
|
|
5266
5771
|
xhr.open("GET", url, true);
|
|
5267
5772
|
xhr.responseType = "arraybuffer";
|
|
5268
5773
|
xhr.onload = () => {
|
|
5269
5774
|
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
5270
|
-
|
|
5775
|
+
resolve3(xhr.response);
|
|
5271
5776
|
return;
|
|
5272
5777
|
}
|
|
5273
5778
|
reject(xhr.status);
|
|
@@ -5457,9 +5962,9 @@ async function Module2(moduleArg = {}) {
|
|
|
5457
5962
|
__name(receiveInstantiationResult, "receiveInstantiationResult");
|
|
5458
5963
|
var info2 = getWasmImports();
|
|
5459
5964
|
if (Module["instantiateWasm"]) {
|
|
5460
|
-
return new Promise((
|
|
5965
|
+
return new Promise((resolve3, reject) => {
|
|
5461
5966
|
Module["instantiateWasm"](info2, (mod, inst) => {
|
|
5462
|
-
|
|
5967
|
+
resolve3(receiveInstance(mod, inst));
|
|
5463
5968
|
});
|
|
5464
5969
|
});
|
|
5465
5970
|
}
|
|
@@ -6172,9 +6677,9 @@ async function Module2(moduleArg = {}) {
|
|
|
6172
6677
|
Module["monitorRunDependencies"]?.(runDependencies);
|
|
6173
6678
|
if (runDependencies == 0) {
|
|
6174
6679
|
if (dependenciesFulfilled) {
|
|
6175
|
-
var
|
|
6680
|
+
var callback2 = dependenciesFulfilled;
|
|
6176
6681
|
dependenciesFulfilled = null;
|
|
6177
|
-
|
|
6682
|
+
callback2();
|
|
6178
6683
|
}
|
|
6179
6684
|
}
|
|
6180
6685
|
}, "removeRunDependency");
|
|
@@ -6746,8 +7251,8 @@ async function Module2(moduleArg = {}) {
|
|
|
6746
7251
|
if (runtimeInitialized) {
|
|
6747
7252
|
moduleRtn = Module;
|
|
6748
7253
|
} else {
|
|
6749
|
-
moduleRtn = new Promise((
|
|
6750
|
-
readyPromiseResolve =
|
|
7254
|
+
moduleRtn = new Promise((resolve3, reject) => {
|
|
7255
|
+
readyPromiseResolve = resolve3;
|
|
6751
7256
|
readyPromiseReject = reject;
|
|
6752
7257
|
});
|
|
6753
7258
|
}
|
|
@@ -7863,11 +8368,11 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
7863
8368
|
C._ts_parser_set_language(this[0], address);
|
|
7864
8369
|
return this;
|
|
7865
8370
|
}
|
|
7866
|
-
parse(
|
|
7867
|
-
if (typeof
|
|
7868
|
-
C.currentParseCallback = (index) =>
|
|
7869
|
-
} else if (typeof
|
|
7870
|
-
C.currentParseCallback =
|
|
8371
|
+
parse(callback2, oldTree, options) {
|
|
8372
|
+
if (typeof callback2 === "string") {
|
|
8373
|
+
C.currentParseCallback = (index) => callback2.slice(index);
|
|
8374
|
+
} else if (typeof callback2 === "function") {
|
|
8375
|
+
C.currentParseCallback = callback2;
|
|
7871
8376
|
} else {
|
|
7872
8377
|
throw new Error("Argument must be a string or a function");
|
|
7873
8378
|
}
|
|
@@ -7928,13 +8433,13 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
7928
8433
|
}
|
|
7929
8434
|
return result;
|
|
7930
8435
|
}
|
|
7931
|
-
setLogger(
|
|
7932
|
-
if (!
|
|
8436
|
+
setLogger(callback2) {
|
|
8437
|
+
if (!callback2) {
|
|
7933
8438
|
this.logCallback = null;
|
|
7934
|
-
} else if (typeof
|
|
8439
|
+
} else if (typeof callback2 !== "function") {
|
|
7935
8440
|
throw new Error("Logger callback must be a function");
|
|
7936
8441
|
} else {
|
|
7937
|
-
this.logCallback =
|
|
8442
|
+
this.logCallback = callback2;
|
|
7938
8443
|
}
|
|
7939
8444
|
return this;
|
|
7940
8445
|
}
|
|
@@ -11344,9 +11849,9 @@ async function watchDirectory(rootDir, options = {}) {
|
|
|
11344
11849
|
onError(err2);
|
|
11345
11850
|
}
|
|
11346
11851
|
});
|
|
11347
|
-
await new Promise((
|
|
11852
|
+
await new Promise((resolve4) => {
|
|
11348
11853
|
watcher.on("ready", () => {
|
|
11349
|
-
|
|
11854
|
+
resolve4();
|
|
11350
11855
|
});
|
|
11351
11856
|
});
|
|
11352
11857
|
return {
|
|
@@ -11381,7 +11886,6 @@ __export(exports_indexer, {
|
|
|
11381
11886
|
clearFreshnessCache: () => clearFreshnessCache,
|
|
11382
11887
|
cleanupIndex: () => cleanupIndex
|
|
11383
11888
|
});
|
|
11384
|
-
import { glob } from "glob";
|
|
11385
11889
|
import * as fs8 from "fs/promises";
|
|
11386
11890
|
import * as path22 from "path";
|
|
11387
11891
|
import * as os3 from "os";
|
|
@@ -11553,7 +12057,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11553
12057
|
let cleanupMs = 0;
|
|
11554
12058
|
let filesDiscovered = 0;
|
|
11555
12059
|
let filesStatChecked = 0;
|
|
11556
|
-
let
|
|
12060
|
+
let filesWithChanges = 0;
|
|
12061
|
+
let filesReindexed = 0;
|
|
11557
12062
|
const logger = options.logger ? options.logger : quiet ? createSilentLogger() : createLogger({ verbose });
|
|
11558
12063
|
rootDir = path22.resolve(rootDir);
|
|
11559
12064
|
const status = await getIndexStatus(rootDir);
|
|
@@ -11595,7 +12100,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11595
12100
|
cleanupMs: 0,
|
|
11596
12101
|
filesDiscovered: 0,
|
|
11597
12102
|
filesStatChecked: 0,
|
|
11598
|
-
|
|
12103
|
+
filesWithChanges: 0,
|
|
12104
|
+
filesReindexed: 0,
|
|
11599
12105
|
fromCache: true
|
|
11600
12106
|
};
|
|
11601
12107
|
}
|
|
@@ -11690,14 +12196,18 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11690
12196
|
try {
|
|
11691
12197
|
const stats = await fs8.stat(filepath);
|
|
11692
12198
|
const lastModified = stats.mtime.toISOString();
|
|
12199
|
+
const fileSize = stats.size;
|
|
11693
12200
|
const existingEntry = manifest.files[relativePath];
|
|
11694
12201
|
if (!existingEntry) {
|
|
11695
|
-
return { filepath, relativePath, lastModified, needsCheck: true, isNew: true };
|
|
12202
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: true };
|
|
11696
12203
|
}
|
|
11697
12204
|
if (existingEntry.lastModified === lastModified) {
|
|
11698
|
-
return { filepath, relativePath, lastModified, needsCheck: false, isNew: false };
|
|
12205
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false };
|
|
11699
12206
|
}
|
|
11700
|
-
|
|
12207
|
+
if (existingEntry.fileSize !== undefined && existingEntry.fileSize === fileSize && existingEntry.contentHash) {
|
|
12208
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
12209
|
+
}
|
|
12210
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
11701
12211
|
} catch {
|
|
11702
12212
|
return null;
|
|
11703
12213
|
}
|
|
@@ -11707,6 +12217,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11707
12217
|
statCheckMs += Date.now() - statCheckStart;
|
|
11708
12218
|
filesStatChecked += currentFiles.length;
|
|
11709
12219
|
const filesToProcess = [];
|
|
12220
|
+
const filesWithMtimeOnlyChange = [];
|
|
11710
12221
|
let unchangedCount = 0;
|
|
11711
12222
|
for (const result2 of statResults) {
|
|
11712
12223
|
if (!result2.success || !result2.value)
|
|
@@ -11715,16 +12226,36 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11715
12226
|
filesToProcess.push(result2.value);
|
|
11716
12227
|
} else {
|
|
11717
12228
|
unchangedCount++;
|
|
12229
|
+
const existingEntry = manifest.files[result2.value.relativePath];
|
|
12230
|
+
if (existingEntry && existingEntry.lastModified !== result2.value.lastModified) {
|
|
12231
|
+
filesWithMtimeOnlyChange.push(result2.value);
|
|
12232
|
+
}
|
|
12233
|
+
}
|
|
12234
|
+
}
|
|
12235
|
+
let mtimeOnlyUpdates = 0;
|
|
12236
|
+
for (const file of filesWithMtimeOnlyChange) {
|
|
12237
|
+
const existingEntry = manifest.files[file.relativePath];
|
|
12238
|
+
if (existingEntry) {
|
|
12239
|
+
manifest.files[file.relativePath] = {
|
|
12240
|
+
...existingEntry,
|
|
12241
|
+
lastModified: file.lastModified,
|
|
12242
|
+
fileSize: file.fileSize
|
|
12243
|
+
};
|
|
12244
|
+
mtimeOnlyUpdates++;
|
|
11718
12245
|
}
|
|
11719
12246
|
}
|
|
11720
12247
|
if (filesToProcess.length === 0) {
|
|
11721
12248
|
totalUnchanged += unchangedCount;
|
|
12249
|
+
if (mtimeOnlyUpdates > 0) {
|
|
12250
|
+
manifest.lastUpdated = new Date().toISOString();
|
|
12251
|
+
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
12252
|
+
}
|
|
11722
12253
|
continue;
|
|
11723
12254
|
}
|
|
11724
12255
|
let completedCount = 0;
|
|
11725
12256
|
const totalToProcess = filesToProcess.length;
|
|
11726
12257
|
const processChangedFile = async (statResult) => {
|
|
11727
|
-
const { filepath, relativePath, lastModified, isNew } = statResult;
|
|
12258
|
+
const { filepath, relativePath, lastModified, fileSize, isNew } = statResult;
|
|
11728
12259
|
try {
|
|
11729
12260
|
const content = await fs8.readFile(filepath, "utf-8");
|
|
11730
12261
|
const contentHash = computeContentHash(content);
|
|
@@ -11735,6 +12266,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11735
12266
|
relativePath,
|
|
11736
12267
|
status: "mtime_updated",
|
|
11737
12268
|
lastModified,
|
|
12269
|
+
fileSize,
|
|
11738
12270
|
contentHash
|
|
11739
12271
|
};
|
|
11740
12272
|
}
|
|
@@ -11743,13 +12275,14 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11743
12275
|
introspection.addFile(relativePath, content);
|
|
11744
12276
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
11745
12277
|
if (!fileIndex) {
|
|
11746
|
-
return { relativePath, status: "unchanged" };
|
|
12278
|
+
return { relativePath, status: "unchanged", fileSize };
|
|
11747
12279
|
}
|
|
11748
12280
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
11749
12281
|
return {
|
|
11750
12282
|
relativePath,
|
|
11751
12283
|
status: "indexed",
|
|
11752
12284
|
lastModified,
|
|
12285
|
+
fileSize,
|
|
11753
12286
|
chunkCount: fileIndex.chunks.length,
|
|
11754
12287
|
contentHash
|
|
11755
12288
|
};
|
|
@@ -11762,7 +12295,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11762
12295
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
11763
12296
|
const results = await parallelMap(filesToProcess, processChangedFile, concurrency);
|
|
11764
12297
|
indexingMs += Date.now() - indexingStart;
|
|
11765
|
-
|
|
12298
|
+
filesWithChanges += filesToProcess.length;
|
|
11766
12299
|
totalUnchanged += unchangedCount;
|
|
11767
12300
|
logger.clearProgress();
|
|
11768
12301
|
let mtimeUpdates = 0;
|
|
@@ -11776,7 +12309,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11776
12309
|
manifest.files[fileResult.relativePath] = {
|
|
11777
12310
|
lastModified: fileResult.lastModified,
|
|
11778
12311
|
chunkCount: fileResult.chunkCount,
|
|
11779
|
-
contentHash: fileResult.contentHash
|
|
12312
|
+
contentHash: fileResult.contentHash,
|
|
12313
|
+
fileSize: fileResult.fileSize
|
|
11780
12314
|
};
|
|
11781
12315
|
totalIndexed++;
|
|
11782
12316
|
break;
|
|
@@ -11785,7 +12319,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11785
12319
|
manifest.files[fileResult.relativePath] = {
|
|
11786
12320
|
...manifest.files[fileResult.relativePath],
|
|
11787
12321
|
lastModified: fileResult.lastModified,
|
|
11788
|
-
contentHash: fileResult.contentHash
|
|
12322
|
+
contentHash: fileResult.contentHash,
|
|
12323
|
+
fileSize: fileResult.fileSize
|
|
11789
12324
|
};
|
|
11790
12325
|
mtimeUpdates++;
|
|
11791
12326
|
}
|
|
@@ -11799,7 +12334,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11799
12334
|
break;
|
|
11800
12335
|
}
|
|
11801
12336
|
}
|
|
11802
|
-
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0;
|
|
12337
|
+
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0 || mtimeOnlyUpdates > 0;
|
|
11803
12338
|
if (hasManifestChanges) {
|
|
11804
12339
|
manifest.lastUpdated = new Date().toISOString();
|
|
11805
12340
|
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
@@ -11833,7 +12368,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11833
12368
|
cleanupMs,
|
|
11834
12369
|
filesDiscovered,
|
|
11835
12370
|
filesStatChecked,
|
|
11836
|
-
|
|
12371
|
+
filesWithChanges,
|
|
12372
|
+
filesReindexed: totalIndexed,
|
|
11837
12373
|
fromCache: false
|
|
11838
12374
|
};
|
|
11839
12375
|
}
|
|
@@ -11903,6 +12439,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11903
12439
|
try {
|
|
11904
12440
|
const stats = await fs8.stat(filepath);
|
|
11905
12441
|
const lastModified = stats.mtime.toISOString();
|
|
12442
|
+
const fileSize = stats.size;
|
|
11906
12443
|
const existingEntry = manifest.files[relativePath];
|
|
11907
12444
|
if (existingEntry && existingEntry.lastModified === lastModified) {
|
|
11908
12445
|
completedCount++;
|
|
@@ -11918,6 +12455,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11918
12455
|
relativePath,
|
|
11919
12456
|
status: "skipped",
|
|
11920
12457
|
lastModified,
|
|
12458
|
+
fileSize,
|
|
11921
12459
|
contentHash
|
|
11922
12460
|
};
|
|
11923
12461
|
}
|
|
@@ -11927,13 +12465,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11927
12465
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
11928
12466
|
if (!fileIndex) {
|
|
11929
12467
|
logger.debug(` [${completedCount}/${totalFiles}] Skipped ${relativePath} (no chunks)`);
|
|
11930
|
-
return { relativePath, status: "skipped" };
|
|
12468
|
+
return { relativePath, status: "skipped", fileSize };
|
|
11931
12469
|
}
|
|
11932
12470
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
11933
12471
|
return {
|
|
11934
12472
|
relativePath,
|
|
11935
12473
|
status: "indexed",
|
|
11936
12474
|
lastModified,
|
|
12475
|
+
fileSize,
|
|
11937
12476
|
chunkCount: fileIndex.chunks.length,
|
|
11938
12477
|
contentHash
|
|
11939
12478
|
};
|
|
@@ -11956,7 +12495,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11956
12495
|
manifest.files[fileResult.relativePath] = {
|
|
11957
12496
|
lastModified: fileResult.lastModified,
|
|
11958
12497
|
chunkCount: fileResult.chunkCount,
|
|
11959
|
-
contentHash: fileResult.contentHash
|
|
12498
|
+
contentHash: fileResult.contentHash,
|
|
12499
|
+
fileSize: fileResult.fileSize
|
|
11960
12500
|
};
|
|
11961
12501
|
result.indexed++;
|
|
11962
12502
|
break;
|
|
@@ -11967,7 +12507,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11967
12507
|
manifest.files[fileResult.relativePath] = {
|
|
11968
12508
|
...existingEntry,
|
|
11969
12509
|
lastModified: fileResult.lastModified,
|
|
11970
|
-
contentHash: fileResult.contentHash
|
|
12510
|
+
contentHash: fileResult.contentHash,
|
|
12511
|
+
fileSize: fileResult.fileSize
|
|
11971
12512
|
};
|
|
11972
12513
|
}
|
|
11973
12514
|
}
|
|
@@ -11984,15 +12525,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11984
12525
|
return result;
|
|
11985
12526
|
}
|
|
11986
12527
|
async function findFiles(rootDir, config) {
|
|
11987
|
-
const
|
|
11988
|
-
const
|
|
11989
|
-
const
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
return [...new Set(allFiles)];
|
|
12528
|
+
const validExtensions = new Set(config.extensions);
|
|
12529
|
+
const ignoreDirs = new Set(config.ignorePaths);
|
|
12530
|
+
const crawler = new Builder().withFullPaths().exclude((dirName) => ignoreDirs.has(dirName)).filter((filePath) => {
|
|
12531
|
+
const ext = path22.extname(filePath);
|
|
12532
|
+
return validExtensions.has(ext);
|
|
12533
|
+
}).crawl(rootDir);
|
|
12534
|
+
const files = await crawler.withPromise();
|
|
12535
|
+
return files;
|
|
11996
12536
|
}
|
|
11997
12537
|
async function loadModuleManifest(rootDir, moduleId, config) {
|
|
11998
12538
|
const manifestPath = getModuleManifestPath(rootDir, moduleId, config);
|
|
@@ -12163,6 +12703,7 @@ async function getIndexStatus(rootDir) {
|
|
|
12163
12703
|
}
|
|
12164
12704
|
var FRESHNESS_CACHE_TTL_MS = 5000, freshnessCache = null, INDEX_SCHEMA_VERSION = "2.0.0", DEFAULT_CONCURRENCY, STAT_CONCURRENCY;
|
|
12165
12705
|
var init_indexer = __esm(() => {
|
|
12706
|
+
init_dist();
|
|
12166
12707
|
init_config2();
|
|
12167
12708
|
init_registry();
|
|
12168
12709
|
init_introspection2();
|
|
@@ -12392,9 +12933,9 @@ var init_assert_valid_pattern = __esm(() => {
|
|
|
12392
12933
|
});
|
|
12393
12934
|
|
|
12394
12935
|
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
12395
|
-
var posixClasses, braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&"), regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), rangesToString = (ranges) => ranges.join(""), parseClass = (
|
|
12936
|
+
var posixClasses, braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&"), regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), rangesToString = (ranges) => ranges.join(""), parseClass = (glob, position) => {
|
|
12396
12937
|
const pos = position;
|
|
12397
|
-
if (
|
|
12938
|
+
if (glob.charAt(pos) !== "[") {
|
|
12398
12939
|
throw new Error("not in a brace expression");
|
|
12399
12940
|
}
|
|
12400
12941
|
const ranges = [];
|
|
@@ -12407,8 +12948,8 @@ var posixClasses, braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&"), regexpEsc
|
|
|
12407
12948
|
let endPos = pos;
|
|
12408
12949
|
let rangeStart = "";
|
|
12409
12950
|
WHILE:
|
|
12410
|
-
while (i2 <
|
|
12411
|
-
const c =
|
|
12951
|
+
while (i2 < glob.length) {
|
|
12952
|
+
const c = glob.charAt(i2);
|
|
12412
12953
|
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
12413
12954
|
negate = true;
|
|
12414
12955
|
i2++;
|
|
@@ -12428,9 +12969,9 @@ var posixClasses, braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&"), regexpEsc
|
|
|
12428
12969
|
}
|
|
12429
12970
|
if (c === "[" && !escaping) {
|
|
12430
12971
|
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
12431
|
-
if (
|
|
12972
|
+
if (glob.startsWith(cls, i2)) {
|
|
12432
12973
|
if (rangeStart) {
|
|
12433
|
-
return ["$.", false,
|
|
12974
|
+
return ["$.", false, glob.length - pos, true];
|
|
12434
12975
|
}
|
|
12435
12976
|
i2 += cls.length;
|
|
12436
12977
|
if (neg)
|
|
@@ -12453,12 +12994,12 @@ var posixClasses, braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&"), regexpEsc
|
|
|
12453
12994
|
i2++;
|
|
12454
12995
|
continue;
|
|
12455
12996
|
}
|
|
12456
|
-
if (
|
|
12997
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
12457
12998
|
ranges.push(braceEscape(c + "-"));
|
|
12458
12999
|
i2 += 2;
|
|
12459
13000
|
continue;
|
|
12460
13001
|
}
|
|
12461
|
-
if (
|
|
13002
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
12462
13003
|
rangeStart = c;
|
|
12463
13004
|
i2 += 2;
|
|
12464
13005
|
continue;
|
|
@@ -12470,7 +13011,7 @@ var posixClasses, braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&"), regexpEsc
|
|
|
12470
13011
|
return ["", false, 0, false];
|
|
12471
13012
|
}
|
|
12472
13013
|
if (!ranges.length && !negs.length) {
|
|
12473
|
-
return ["$.", false,
|
|
13014
|
+
return ["$.", false, glob.length - pos, true];
|
|
12474
13015
|
}
|
|
12475
13016
|
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
12476
13017
|
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
@@ -12751,16 +13292,16 @@ class AST {
|
|
|
12751
13292
|
toMMPattern() {
|
|
12752
13293
|
if (this !== this.#root)
|
|
12753
13294
|
return this.#root.toMMPattern();
|
|
12754
|
-
const
|
|
13295
|
+
const glob = this.toString();
|
|
12755
13296
|
const [re, body2, hasMagic, uflag] = this.toRegExpSource();
|
|
12756
|
-
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly &&
|
|
13297
|
+
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
12757
13298
|
if (!anyMagic) {
|
|
12758
13299
|
return body2;
|
|
12759
13300
|
}
|
|
12760
13301
|
const flags2 = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
12761
13302
|
return Object.assign(new RegExp(`^${re}$`, flags2), {
|
|
12762
13303
|
_src: re,
|
|
12763
|
-
_glob:
|
|
13304
|
+
_glob: glob
|
|
12764
13305
|
});
|
|
12765
13306
|
}
|
|
12766
13307
|
get options() {
|
|
@@ -12843,19 +13384,19 @@ class AST {
|
|
|
12843
13384
|
return re;
|
|
12844
13385
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
12845
13386
|
}
|
|
12846
|
-
static #parseGlob(
|
|
13387
|
+
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
12847
13388
|
let escaping = false;
|
|
12848
13389
|
let re = "";
|
|
12849
13390
|
let uflag = false;
|
|
12850
|
-
for (let i2 = 0;i2 <
|
|
12851
|
-
const c =
|
|
13391
|
+
for (let i2 = 0;i2 < glob.length; i2++) {
|
|
13392
|
+
const c = glob.charAt(i2);
|
|
12852
13393
|
if (escaping) {
|
|
12853
13394
|
escaping = false;
|
|
12854
13395
|
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
12855
13396
|
continue;
|
|
12856
13397
|
}
|
|
12857
13398
|
if (c === "\\") {
|
|
12858
|
-
if (i2 ===
|
|
13399
|
+
if (i2 === glob.length - 1) {
|
|
12859
13400
|
re += "\\\\";
|
|
12860
13401
|
} else {
|
|
12861
13402
|
escaping = true;
|
|
@@ -12863,7 +13404,7 @@ class AST {
|
|
|
12863
13404
|
continue;
|
|
12864
13405
|
}
|
|
12865
13406
|
if (c === "[") {
|
|
12866
|
-
const [src, needUflag, consumed, magic] = parseClass(
|
|
13407
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
12867
13408
|
if (consumed) {
|
|
12868
13409
|
re += src;
|
|
12869
13410
|
uflag = uflag || needUflag;
|
|
@@ -12873,7 +13414,7 @@ class AST {
|
|
|
12873
13414
|
}
|
|
12874
13415
|
}
|
|
12875
13416
|
if (c === "*") {
|
|
12876
|
-
if (noEmpty &&
|
|
13417
|
+
if (noEmpty && glob === "*")
|
|
12877
13418
|
re += starNoEmpty;
|
|
12878
13419
|
else
|
|
12879
13420
|
re += star;
|
|
@@ -12887,7 +13428,7 @@ class AST {
|
|
|
12887
13428
|
}
|
|
12888
13429
|
re += regExpEscape(c);
|
|
12889
13430
|
}
|
|
12890
|
-
return [re, unescape(
|
|
13431
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
12891
13432
|
}
|
|
12892
13433
|
}
|
|
12893
13434
|
var types, isExtglobType = (c) => types.has(c), startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))", startNoDot = "(?!\\.)", addPatternStart, justDots, reSpecials, regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), qmark = "[^/]", star, starNoEmpty;
|
|
@@ -13488,7 +14029,7 @@ var import_brace_expansion, minimatch = (p, pattern, options = {}) => {
|
|
|
13488
14029
|
}, qmarksTestNoExtDot = ([$0]) => {
|
|
13489
14030
|
const len = $0.length;
|
|
13490
14031
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
13491
|
-
}, defaultPlatform, path23,
|
|
14032
|
+
}, defaultPlatform, path23, sep2, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options), ext = (a, b = {}) => Object.assign({}, a, b), defaults = (def) => {
|
|
13492
14033
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
13493
14034
|
return minimatch;
|
|
13494
14035
|
}
|
|
@@ -13550,8 +14091,8 @@ var init_esm = __esm(() => {
|
|
|
13550
14091
|
win32: { sep: "\\" },
|
|
13551
14092
|
posix: { sep: "/" }
|
|
13552
14093
|
};
|
|
13553
|
-
|
|
13554
|
-
minimatch.sep =
|
|
14094
|
+
sep2 = defaultPlatform === "win32" ? path23.win32.sep : path23.posix.sep;
|
|
14095
|
+
minimatch.sep = sep2;
|
|
13555
14096
|
GLOBSTAR = Symbol("globstar **");
|
|
13556
14097
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
13557
14098
|
star2 = qmark2 + "*?";
|
|
@@ -13654,8 +14195,8 @@ function createSearchContext(rootDir, moduleId, config) {
|
|
|
13654
14195
|
const files = [];
|
|
13655
14196
|
await traverseDirectory(indexPath, files, indexPath);
|
|
13656
14197
|
return files.filter((f) => f.endsWith(".json") && !f.endsWith("manifest.json")).map((f) => {
|
|
13657
|
-
const
|
|
13658
|
-
return
|
|
14198
|
+
const relative5 = path24.relative(indexPath, f);
|
|
14199
|
+
return relative5.replace(/\.json$/, "");
|
|
13659
14200
|
});
|
|
13660
14201
|
}
|
|
13661
14202
|
};
|
|
@@ -13743,7 +14284,7 @@ init_logger();
|
|
|
13743
14284
|
// package.json
|
|
13744
14285
|
var package_default = {
|
|
13745
14286
|
name: "raggrep",
|
|
13746
|
-
version: "0.10.
|
|
14287
|
+
version: "0.10.7",
|
|
13747
14288
|
description: "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
|
|
13748
14289
|
type: "module",
|
|
13749
14290
|
main: "./dist/index.js",
|
|
@@ -13800,6 +14341,7 @@ var package_default = {
|
|
|
13800
14341
|
dependencies: {
|
|
13801
14342
|
"@xenova/transformers": "^2.17.0",
|
|
13802
14343
|
chokidar: "^5.0.0",
|
|
14344
|
+
fdir: "^6.5.0",
|
|
13803
14345
|
glob: "^10.0.0",
|
|
13804
14346
|
typescript: "^5.0.0",
|
|
13805
14347
|
"web-tree-sitter": "^0.26.3"
|
|
@@ -14087,19 +14629,19 @@ Examples:
|
|
|
14087
14629
|
}
|
|
14088
14630
|
if (flags2.timing && freshStats.timing) {
|
|
14089
14631
|
const t = freshStats.timing;
|
|
14090
|
-
console.log("┌─ Timing
|
|
14632
|
+
console.log("┌─ Timing ───────────────────────────────────────────────┐");
|
|
14091
14633
|
if (t.fromCache) {
|
|
14092
|
-
console.log(`│ Cache hit (TTL-based)
|
|
14093
|
-
console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms
|
|
14634
|
+
console.log(`│ Cache hit (TTL-based) │`);
|
|
14635
|
+
console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms │`);
|
|
14094
14636
|
} else {
|
|
14095
|
-
console.log(`│ File discovery: ${t.fileDiscoveryMs.toFixed(0).padStart(6)}ms
|
|
14096
|
-
console.log(`│ Stat checks: ${t.statCheckMs.toFixed(0).padStart(6)}ms
|
|
14097
|
-
console.log(`│ Indexing: ${t.indexingMs.toFixed(0).padStart(6)}ms
|
|
14098
|
-
console.log(`│ Cleanup: ${t.cleanupMs.toFixed(0).padStart(6)}ms
|
|
14099
|
-
console.log(`│
|
|
14100
|
-
console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms`.padEnd(
|
|
14637
|
+
console.log(`│ File discovery: ${t.fileDiscoveryMs.toFixed(0).padStart(6)}ms │ ${String(t.filesDiscovered).padStart(6)} files found`.padEnd(57) + "│");
|
|
14638
|
+
console.log(`│ Stat checks: ${t.statCheckMs.toFixed(0).padStart(6)}ms │ ${String(t.filesStatChecked).padStart(6)} stats checked`.padEnd(57) + "│");
|
|
14639
|
+
console.log(`│ Indexing: ${t.indexingMs.toFixed(0).padStart(6)}ms │ ${String(t.filesWithChanges).padStart(6)} with changes → ${t.filesReindexed} reindexed`.padEnd(57) + "│");
|
|
14640
|
+
console.log(`│ Cleanup: ${t.cleanupMs.toFixed(0).padStart(6)}ms │`.padEnd(57) + "│");
|
|
14641
|
+
console.log(`│ ───────────────────────────────────────────────────── │`);
|
|
14642
|
+
console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms`.padEnd(57) + "│");
|
|
14101
14643
|
}
|
|
14102
|
-
console.log(
|
|
14644
|
+
console.log(`└────────────────────────────────────────────────────────┘
|
|
14103
14645
|
`);
|
|
14104
14646
|
}
|
|
14105
14647
|
const filePatterns = flags2.fileType ? [`*.${flags2.fileType}`] : undefined;
|
|
@@ -14359,4 +14901,4 @@ Run 'raggrep <command> --help' for more information.
|
|
|
14359
14901
|
}
|
|
14360
14902
|
main();
|
|
14361
14903
|
|
|
14362
|
-
//# debugId=
|
|
14904
|
+
//# debugId=FECC7BE122B3EB1664756E2164756E21
|