raggrep 0.10.4 → 0.10.5

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/index.js CHANGED
@@ -5106,8 +5106,8 @@ async function Module2(moduleArg = {}) {
5106
5106
  var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined";
5107
5107
  var ENVIRONMENT_IS_NODE = typeof process == "object" && process.versions?.node && process.type != "renderer";
5108
5108
  if (ENVIRONMENT_IS_NODE) {
5109
- const { createRequire: createRequire2 } = await import("module");
5110
- var require = createRequire2(import.meta.url);
5109
+ const { createRequire: createRequire3 } = await import("module");
5110
+ var require = createRequire3(import.meta.url);
5111
5111
  }
5112
5112
  Module.currentQueryProgressCallback = null;
5113
5113
  Module.currentProgressCallback = null;
@@ -5167,13 +5167,13 @@ async function Module2(moduleArg = {}) {
5167
5167
  }
5168
5168
  readAsync = /* @__PURE__ */ __name(async (url) => {
5169
5169
  if (isFileURI(url)) {
5170
- return new Promise((resolve2, reject) => {
5170
+ return new Promise((resolve3, reject) => {
5171
5171
  var xhr = new XMLHttpRequest;
5172
5172
  xhr.open("GET", url, true);
5173
5173
  xhr.responseType = "arraybuffer";
5174
5174
  xhr.onload = () => {
5175
5175
  if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
5176
- resolve2(xhr.response);
5176
+ resolve3(xhr.response);
5177
5177
  return;
5178
5178
  }
5179
5179
  reject(xhr.status);
@@ -5363,9 +5363,9 @@ async function Module2(moduleArg = {}) {
5363
5363
  __name(receiveInstantiationResult, "receiveInstantiationResult");
5364
5364
  var info2 = getWasmImports();
5365
5365
  if (Module["instantiateWasm"]) {
5366
- return new Promise((resolve2, reject) => {
5366
+ return new Promise((resolve3, reject) => {
5367
5367
  Module["instantiateWasm"](info2, (mod, inst) => {
5368
- resolve2(receiveInstance(mod, inst));
5368
+ resolve3(receiveInstance(mod, inst));
5369
5369
  });
5370
5370
  });
5371
5371
  }
@@ -6078,9 +6078,9 @@ async function Module2(moduleArg = {}) {
6078
6078
  Module["monitorRunDependencies"]?.(runDependencies);
6079
6079
  if (runDependencies == 0) {
6080
6080
  if (dependenciesFulfilled) {
6081
- var callback = dependenciesFulfilled;
6081
+ var callback2 = dependenciesFulfilled;
6082
6082
  dependenciesFulfilled = null;
6083
- callback();
6083
+ callback2();
6084
6084
  }
6085
6085
  }
6086
6086
  }, "removeRunDependency");
@@ -6652,8 +6652,8 @@ async function Module2(moduleArg = {}) {
6652
6652
  if (runtimeInitialized) {
6653
6653
  moduleRtn = Module;
6654
6654
  } else {
6655
- moduleRtn = new Promise((resolve2, reject) => {
6656
- readyPromiseResolve = resolve2;
6655
+ moduleRtn = new Promise((resolve3, reject) => {
6656
+ readyPromiseResolve = resolve3;
6657
6657
  readyPromiseReject = reject;
6658
6658
  });
6659
6659
  }
@@ -7769,11 +7769,11 @@ ${JSON.stringify(symbolNames, null, 2)}`);
7769
7769
  C._ts_parser_set_language(this[0], address);
7770
7770
  return this;
7771
7771
  }
7772
- parse(callback, oldTree, options) {
7773
- if (typeof callback === "string") {
7774
- C.currentParseCallback = (index) => callback.slice(index);
7775
- } else if (typeof callback === "function") {
7776
- C.currentParseCallback = callback;
7772
+ parse(callback2, oldTree, options) {
7773
+ if (typeof callback2 === "string") {
7774
+ C.currentParseCallback = (index) => callback2.slice(index);
7775
+ } else if (typeof callback2 === "function") {
7776
+ C.currentParseCallback = callback2;
7777
7777
  } else {
7778
7778
  throw new Error("Argument must be a string or a function");
7779
7779
  }
@@ -7834,13 +7834,13 @@ ${JSON.stringify(symbolNames, null, 2)}`);
7834
7834
  }
7835
7835
  return result;
7836
7836
  }
7837
- setLogger(callback) {
7838
- if (!callback) {
7837
+ setLogger(callback2) {
7838
+ if (!callback2) {
7839
7839
  this.logCallback = null;
7840
- } else if (typeof callback !== "function") {
7840
+ } else if (typeof callback2 !== "function") {
7841
7841
  throw new Error("Logger callback must be a function");
7842
7842
  } else {
7843
- this.logCallback = callback;
7843
+ this.logCallback = callback2;
7844
7844
  }
7845
7845
  return this;
7846
7846
  }
@@ -10994,9 +10994,541 @@ var require_brace_expansion = __commonJS((exports, module2) => {
10994
10994
  }
10995
10995
  });
10996
10996
 
10997
+ // node_modules/fdir/dist/index.mjs
10998
+ import { createRequire as createRequire2 } from "module";
10999
+ import { basename, dirname, normalize, relative, resolve, sep } from "path";
11000
+ import * as nativeFs from "fs";
11001
+ var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
11002
+ function cleanPath(path) {
11003
+ let normalized = normalize(path);
11004
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep)
11005
+ normalized = normalized.substring(0, normalized.length - 1);
11006
+ return normalized;
11007
+ }
11008
+ var SLASHES_REGEX = /[\\/]/g;
11009
+ function convertSlashes(path, separator) {
11010
+ return path.replace(SLASHES_REGEX, separator);
11011
+ }
11012
+ var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
11013
+ function isRootDirectory(path) {
11014
+ return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
11015
+ }
11016
+ function normalizePath(path, options) {
11017
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
11018
+ const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith(".");
11019
+ if (resolvePaths)
11020
+ path = resolve(path);
11021
+ if (normalizePath$1 || pathNeedsCleaning)
11022
+ path = cleanPath(path);
11023
+ if (path === ".")
11024
+ return "";
11025
+ const needsSeperator = path[path.length - 1] !== pathSeparator;
11026
+ return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);
11027
+ }
11028
+ function joinPathWithBasePath(filename, directoryPath) {
11029
+ return directoryPath + filename;
11030
+ }
11031
+ function joinPathWithRelativePath(root, options) {
11032
+ return function(filename, directoryPath) {
11033
+ const sameRoot = directoryPath.startsWith(root);
11034
+ if (sameRoot)
11035
+ return directoryPath.slice(root.length) + filename;
11036
+ else
11037
+ return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
11038
+ };
11039
+ }
11040
+ function joinPath(filename) {
11041
+ return filename;
11042
+ }
11043
+ function joinDirectoryPath(filename, directoryPath, separator) {
11044
+ return directoryPath + filename + separator;
11045
+ }
11046
+ function build$7(root, options) {
11047
+ const { relativePaths, includeBasePath } = options;
11048
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
11049
+ }
11050
+ function pushDirectoryWithRelativePath(root) {
11051
+ return function(directoryPath, paths) {
11052
+ paths.push(directoryPath.substring(root.length) || ".");
11053
+ };
11054
+ }
11055
+ function pushDirectoryFilterWithRelativePath(root) {
11056
+ return function(directoryPath, paths, filters) {
11057
+ const relativePath = directoryPath.substring(root.length) || ".";
11058
+ if (filters.every((filter) => filter(relativePath, true)))
11059
+ paths.push(relativePath);
11060
+ };
11061
+ }
11062
+ var pushDirectory = (directoryPath, paths) => {
11063
+ paths.push(directoryPath || ".");
11064
+ };
11065
+ var pushDirectoryFilter = (directoryPath, paths, filters) => {
11066
+ const path = directoryPath || ".";
11067
+ if (filters.every((filter) => filter(path, true)))
11068
+ paths.push(path);
11069
+ };
11070
+ var empty$2 = () => {};
11071
+ function build$6(root, options) {
11072
+ const { includeDirs, filters, relativePaths } = options;
11073
+ if (!includeDirs)
11074
+ return empty$2;
11075
+ if (relativePaths)
11076
+ return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
11077
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory;
11078
+ }
11079
+ var pushFileFilterAndCount = (filename, _paths, counts, filters) => {
11080
+ if (filters.every((filter) => filter(filename, false)))
11081
+ counts.files++;
11082
+ };
11083
+ var pushFileFilter = (filename, paths, _counts, filters) => {
11084
+ if (filters.every((filter) => filter(filename, false)))
11085
+ paths.push(filename);
11086
+ };
11087
+ var pushFileCount = (_filename, _paths, counts, _filters) => {
11088
+ counts.files++;
11089
+ };
11090
+ var pushFile = (filename, paths) => {
11091
+ paths.push(filename);
11092
+ };
11093
+ var empty$1 = () => {};
11094
+ function build$5(options) {
11095
+ const { excludeFiles, filters, onlyCounts } = options;
11096
+ if (excludeFiles)
11097
+ return empty$1;
11098
+ if (filters && filters.length)
11099
+ return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
11100
+ else if (onlyCounts)
11101
+ return pushFileCount;
11102
+ else
11103
+ return pushFile;
11104
+ }
11105
+ var getArray = (paths) => {
11106
+ return paths;
11107
+ };
11108
+ var getArrayGroup = () => {
11109
+ return [""].slice(0, 0);
11110
+ };
11111
+ function build$4(options) {
11112
+ return options.group ? getArrayGroup : getArray;
11113
+ }
11114
+ var groupFiles = (groups, directory, files) => {
11115
+ groups.push({
11116
+ directory,
11117
+ files,
11118
+ dir: directory
11119
+ });
11120
+ };
11121
+ var empty = () => {};
11122
+ function build$3(options) {
11123
+ return options.group ? groupFiles : empty;
11124
+ }
11125
+ var resolveSymlinksAsync = function(path, state, callback$1) {
11126
+ const { queue, fs: fs2, options: { suppressErrors } } = state;
11127
+ queue.enqueue();
11128
+ fs2.realpath(path, (error, resolvedPath) => {
11129
+ if (error)
11130
+ return queue.dequeue(suppressErrors ? null : error, state);
11131
+ fs2.stat(resolvedPath, (error$1, stat) => {
11132
+ if (error$1)
11133
+ return queue.dequeue(suppressErrors ? null : error$1, state);
11134
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state))
11135
+ return queue.dequeue(null, state);
11136
+ callback$1(stat, resolvedPath);
11137
+ queue.dequeue(null, state);
11138
+ });
11139
+ });
11140
+ };
11141
+ var resolveSymlinks = function(path, state, callback$1) {
11142
+ const { queue, fs: fs2, options: { suppressErrors } } = state;
11143
+ queue.enqueue();
11144
+ try {
11145
+ const resolvedPath = fs2.realpathSync(path);
11146
+ const stat = fs2.statSync(resolvedPath);
11147
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state))
11148
+ return;
11149
+ callback$1(stat, resolvedPath);
11150
+ } catch (e) {
11151
+ if (!suppressErrors)
11152
+ throw e;
11153
+ }
11154
+ };
11155
+ function build$2(options, isSynchronous) {
11156
+ if (!options.resolveSymlinks || options.excludeSymlinks)
11157
+ return null;
11158
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
11159
+ }
11160
+ function isRecursive(path, resolved, state) {
11161
+ if (state.options.useRealPaths)
11162
+ return isRecursiveUsingRealPaths(resolved, state);
11163
+ let parent = dirname(path);
11164
+ let depth = 1;
11165
+ while (parent !== state.root && depth < 2) {
11166
+ const resolvedPath = state.symlinks.get(parent);
11167
+ const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
11168
+ if (isSameRoot)
11169
+ depth++;
11170
+ else
11171
+ parent = dirname(parent);
11172
+ }
11173
+ state.symlinks.set(path, resolved);
11174
+ return depth > 1;
11175
+ }
11176
+ function isRecursiveUsingRealPaths(resolved, state) {
11177
+ return state.visited.includes(resolved + state.options.pathSeparator);
11178
+ }
11179
+ var onlyCountsSync = (state) => {
11180
+ return state.counts;
11181
+ };
11182
+ var groupsSync = (state) => {
11183
+ return state.groups;
11184
+ };
11185
+ var defaultSync = (state) => {
11186
+ return state.paths;
11187
+ };
11188
+ var limitFilesSync = (state) => {
11189
+ return state.paths.slice(0, state.options.maxFiles);
11190
+ };
11191
+ var onlyCountsAsync = (state, error, callback$1) => {
11192
+ report(error, callback$1, state.counts, state.options.suppressErrors);
11193
+ return null;
11194
+ };
11195
+ var defaultAsync = (state, error, callback$1) => {
11196
+ report(error, callback$1, state.paths, state.options.suppressErrors);
11197
+ return null;
11198
+ };
11199
+ var limitFilesAsync = (state, error, callback$1) => {
11200
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
11201
+ return null;
11202
+ };
11203
+ var groupsAsync = (state, error, callback$1) => {
11204
+ report(error, callback$1, state.groups, state.options.suppressErrors);
11205
+ return null;
11206
+ };
11207
+ function report(error, callback$1, output, suppressErrors) {
11208
+ if (error && !suppressErrors)
11209
+ callback$1(error, output);
11210
+ else
11211
+ callback$1(null, output);
11212
+ }
11213
+ function build$1(options, isSynchronous) {
11214
+ const { onlyCounts, group, maxFiles } = options;
11215
+ if (onlyCounts)
11216
+ return isSynchronous ? onlyCountsSync : onlyCountsAsync;
11217
+ else if (group)
11218
+ return isSynchronous ? groupsSync : groupsAsync;
11219
+ else if (maxFiles)
11220
+ return isSynchronous ? limitFilesSync : limitFilesAsync;
11221
+ else
11222
+ return isSynchronous ? defaultSync : defaultAsync;
11223
+ }
11224
+ var readdirOpts = { withFileTypes: true };
11225
+ var walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
11226
+ state.queue.enqueue();
11227
+ if (currentDepth < 0)
11228
+ return state.queue.dequeue(null, state);
11229
+ const { fs: fs2 } = state;
11230
+ state.visited.push(crawlPath);
11231
+ state.counts.directories++;
11232
+ fs2.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
11233
+ callback$1(entries, directoryPath, currentDepth);
11234
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
11235
+ });
11236
+ };
11237
+ var walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
11238
+ const { fs: fs2 } = state;
11239
+ if (currentDepth < 0)
11240
+ return;
11241
+ state.visited.push(crawlPath);
11242
+ state.counts.directories++;
11243
+ let entries = [];
11244
+ try {
11245
+ entries = fs2.readdirSync(crawlPath || ".", readdirOpts);
11246
+ } catch (e) {
11247
+ if (!state.options.suppressErrors)
11248
+ throw e;
11249
+ }
11250
+ callback$1(entries, directoryPath, currentDepth);
11251
+ };
11252
+ function build(isSynchronous) {
11253
+ return isSynchronous ? walkSync : walkAsync;
11254
+ }
11255
+ var Queue = class {
11256
+ count = 0;
11257
+ constructor(onQueueEmpty) {
11258
+ this.onQueueEmpty = onQueueEmpty;
11259
+ }
11260
+ enqueue() {
11261
+ this.count++;
11262
+ return this.count;
11263
+ }
11264
+ dequeue(error, output) {
11265
+ if (this.onQueueEmpty && (--this.count <= 0 || error)) {
11266
+ this.onQueueEmpty(error, output);
11267
+ if (error) {
11268
+ output.controller.abort();
11269
+ this.onQueueEmpty = undefined;
11270
+ }
11271
+ }
11272
+ }
11273
+ };
11274
+ var Counter = class {
11275
+ _files = 0;
11276
+ _directories = 0;
11277
+ set files(num) {
11278
+ this._files = num;
11279
+ }
11280
+ get files() {
11281
+ return this._files;
11282
+ }
11283
+ set directories(num) {
11284
+ this._directories = num;
11285
+ }
11286
+ get directories() {
11287
+ return this._directories;
11288
+ }
11289
+ get dirs() {
11290
+ return this._directories;
11291
+ }
11292
+ };
11293
+ var Aborter = class {
11294
+ aborted = false;
11295
+ abort() {
11296
+ this.aborted = true;
11297
+ }
11298
+ };
11299
+ var Walker = class {
11300
+ root;
11301
+ isSynchronous;
11302
+ state;
11303
+ joinPath;
11304
+ pushDirectory;
11305
+ pushFile;
11306
+ getArray;
11307
+ groupFiles;
11308
+ resolveSymlink;
11309
+ walkDirectory;
11310
+ callbackInvoker;
11311
+ constructor(root, options, callback$1) {
11312
+ this.isSynchronous = !callback$1;
11313
+ this.callbackInvoker = build$1(options, this.isSynchronous);
11314
+ this.root = normalizePath(root, options);
11315
+ this.state = {
11316
+ root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
11317
+ paths: [""].slice(0, 0),
11318
+ groups: [],
11319
+ counts: new Counter,
11320
+ options,
11321
+ queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
11322
+ symlinks: /* @__PURE__ */ new Map,
11323
+ visited: [""].slice(0, 0),
11324
+ controller: new Aborter,
11325
+ fs: options.fs || nativeFs
11326
+ };
11327
+ this.joinPath = build$7(this.root, options);
11328
+ this.pushDirectory = build$6(this.root, options);
11329
+ this.pushFile = build$5(options);
11330
+ this.getArray = build$4(options);
11331
+ this.groupFiles = build$3(options);
11332
+ this.resolveSymlink = build$2(options, this.isSynchronous);
11333
+ this.walkDirectory = build(this.isSynchronous);
11334
+ }
11335
+ start() {
11336
+ this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
11337
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
11338
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
11339
+ }
11340
+ walk = (entries, directoryPath, depth) => {
11341
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
11342
+ if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles)
11343
+ return;
11344
+ const files = this.getArray(this.state.paths);
11345
+ for (let i2 = 0;i2 < entries.length; ++i2) {
11346
+ const entry = entries[i2];
11347
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
11348
+ const filename = this.joinPath(entry.name, directoryPath);
11349
+ this.pushFile(filename, files, this.state.counts, filters);
11350
+ } else if (entry.isDirectory()) {
11351
+ let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
11352
+ if (exclude && exclude(entry.name, path))
11353
+ continue;
11354
+ this.pushDirectory(path, paths, filters);
11355
+ this.walkDirectory(this.state, path, path, depth - 1, this.walk);
11356
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
11357
+ let path = joinPathWithBasePath(entry.name, directoryPath);
11358
+ this.resolveSymlink(path, this.state, (stat, resolvedPath) => {
11359
+ if (stat.isDirectory()) {
11360
+ resolvedPath = normalizePath(resolvedPath, this.state.options);
11361
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator))
11362
+ return;
11363
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
11364
+ } else {
11365
+ resolvedPath = useRealPaths ? resolvedPath : path;
11366
+ const filename = basename(resolvedPath);
11367
+ const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
11368
+ resolvedPath = this.joinPath(filename, directoryPath$1);
11369
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
11370
+ }
11371
+ });
11372
+ }
11373
+ }
11374
+ this.groupFiles(this.state.groups, directoryPath, files);
11375
+ };
11376
+ };
11377
+ function promise(root, options) {
11378
+ return new Promise((resolve$1, reject) => {
11379
+ callback(root, options, (err2, output) => {
11380
+ if (err2)
11381
+ return reject(err2);
11382
+ resolve$1(output);
11383
+ });
11384
+ });
11385
+ }
11386
+ function callback(root, options, callback$1) {
11387
+ let walker = new Walker(root, options, callback$1);
11388
+ walker.start();
11389
+ }
11390
+ function sync(root, options) {
11391
+ const walker = new Walker(root, options);
11392
+ return walker.start();
11393
+ }
11394
+ var APIBuilder = class {
11395
+ constructor(root, options) {
11396
+ this.root = root;
11397
+ this.options = options;
11398
+ }
11399
+ withPromise() {
11400
+ return promise(this.root, this.options);
11401
+ }
11402
+ withCallback(cb) {
11403
+ callback(this.root, this.options, cb);
11404
+ }
11405
+ sync() {
11406
+ return sync(this.root, this.options);
11407
+ }
11408
+ };
11409
+ var pm = null;
11410
+ try {
11411
+ __require2.resolve("picomatch");
11412
+ pm = __require2("picomatch");
11413
+ } catch {}
11414
+ var Builder = class {
11415
+ globCache = {};
11416
+ options = {
11417
+ maxDepth: Infinity,
11418
+ suppressErrors: true,
11419
+ pathSeparator: sep,
11420
+ filters: []
11421
+ };
11422
+ globFunction;
11423
+ constructor(options) {
11424
+ this.options = {
11425
+ ...this.options,
11426
+ ...options
11427
+ };
11428
+ this.globFunction = this.options.globFunction;
11429
+ }
11430
+ group() {
11431
+ this.options.group = true;
11432
+ return this;
11433
+ }
11434
+ withPathSeparator(separator) {
11435
+ this.options.pathSeparator = separator;
11436
+ return this;
11437
+ }
11438
+ withBasePath() {
11439
+ this.options.includeBasePath = true;
11440
+ return this;
11441
+ }
11442
+ withRelativePaths() {
11443
+ this.options.relativePaths = true;
11444
+ return this;
11445
+ }
11446
+ withDirs() {
11447
+ this.options.includeDirs = true;
11448
+ return this;
11449
+ }
11450
+ withMaxDepth(depth) {
11451
+ this.options.maxDepth = depth;
11452
+ return this;
11453
+ }
11454
+ withMaxFiles(limit) {
11455
+ this.options.maxFiles = limit;
11456
+ return this;
11457
+ }
11458
+ withFullPaths() {
11459
+ this.options.resolvePaths = true;
11460
+ this.options.includeBasePath = true;
11461
+ return this;
11462
+ }
11463
+ withErrors() {
11464
+ this.options.suppressErrors = false;
11465
+ return this;
11466
+ }
11467
+ withSymlinks({ resolvePaths = true } = {}) {
11468
+ this.options.resolveSymlinks = true;
11469
+ this.options.useRealPaths = resolvePaths;
11470
+ return this.withFullPaths();
11471
+ }
11472
+ withAbortSignal(signal) {
11473
+ this.options.signal = signal;
11474
+ return this;
11475
+ }
11476
+ normalize() {
11477
+ this.options.normalizePath = true;
11478
+ return this;
11479
+ }
11480
+ filter(predicate) {
11481
+ this.options.filters.push(predicate);
11482
+ return this;
11483
+ }
11484
+ onlyDirs() {
11485
+ this.options.excludeFiles = true;
11486
+ this.options.includeDirs = true;
11487
+ return this;
11488
+ }
11489
+ exclude(predicate) {
11490
+ this.options.exclude = predicate;
11491
+ return this;
11492
+ }
11493
+ onlyCounts() {
11494
+ this.options.onlyCounts = true;
11495
+ return this;
11496
+ }
11497
+ crawl(root) {
11498
+ return new APIBuilder(root || ".", this.options);
11499
+ }
11500
+ withGlobFunction(fn) {
11501
+ this.globFunction = fn;
11502
+ return this;
11503
+ }
11504
+ crawlWithOptions(root, options) {
11505
+ this.options = {
11506
+ ...this.options,
11507
+ ...options
11508
+ };
11509
+ return new APIBuilder(root || ".", this.options);
11510
+ }
11511
+ glob(...patterns) {
11512
+ if (this.globFunction)
11513
+ return this.globWithOptions(patterns);
11514
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
11515
+ }
11516
+ globWithOptions(patterns, ...options) {
11517
+ const globFn = this.globFunction || pm;
11518
+ if (!globFn)
11519
+ throw new Error("Please specify a glob function to use glob matching.");
11520
+ var isMatch = this.globCache[patterns.join("\x00")];
11521
+ if (!isMatch) {
11522
+ isMatch = globFn(patterns, ...options);
11523
+ this.globCache[patterns.join("\x00")] = isMatch;
11524
+ }
11525
+ this.options.filters.push((path) => isMatch(path));
11526
+ return this;
11527
+ }
11528
+ };
11529
+
10997
11530
  // src/app/indexer/index.ts
10998
11531
  init_config2();
10999
- import { glob } from "glob";
11000
11532
  import * as fs8 from "fs/promises";
11001
11533
  import * as path21 from "path";
11002
11534
  import * as os3 from "os";
@@ -11998,15 +12530,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
11998
12530
  return result;
11999
12531
  }
12000
12532
  async function findFiles(rootDir, config) {
12001
- const patterns = config.extensions.map((ext) => `**/*${ext}`);
12002
- const ignorePatterns = config.ignorePaths.map((p) => `**/${p}/**`);
12003
- const results = await Promise.all(patterns.map((pattern) => glob(pattern, {
12004
- cwd: rootDir,
12005
- absolute: true,
12006
- ignore: ignorePatterns
12007
- })));
12008
- const allFiles = results.flat();
12009
- return [...new Set(allFiles)];
12533
+ const validExtensions = new Set(config.extensions);
12534
+ const ignoreDirs = new Set(config.ignorePaths);
12535
+ const crawler = new Builder().withFullPaths().exclude((dirName) => ignoreDirs.has(dirName)).filter((filePath) => {
12536
+ const ext = path21.extname(filePath);
12537
+ return validExtensions.has(ext);
12538
+ }).crawl(rootDir);
12539
+ const files = await crawler.withPromise();
12540
+ return files;
12010
12541
  }
12011
12542
  async function loadModuleManifest(rootDir, moduleId, config) {
12012
12543
  const manifestPath = getModuleManifestPath(rootDir, moduleId, config);
@@ -12214,9 +12745,9 @@ var posixClasses = {
12214
12745
  var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
12215
12746
  var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
12216
12747
  var rangesToString = (ranges) => ranges.join("");
12217
- var parseClass = (glob2, position) => {
12748
+ var parseClass = (glob, position) => {
12218
12749
  const pos = position;
12219
- if (glob2.charAt(pos) !== "[") {
12750
+ if (glob.charAt(pos) !== "[") {
12220
12751
  throw new Error("not in a brace expression");
12221
12752
  }
12222
12753
  const ranges = [];
@@ -12229,8 +12760,8 @@ var parseClass = (glob2, position) => {
12229
12760
  let endPos = pos;
12230
12761
  let rangeStart = "";
12231
12762
  WHILE:
12232
- while (i2 < glob2.length) {
12233
- const c = glob2.charAt(i2);
12763
+ while (i2 < glob.length) {
12764
+ const c = glob.charAt(i2);
12234
12765
  if ((c === "!" || c === "^") && i2 === pos + 1) {
12235
12766
  negate = true;
12236
12767
  i2++;
@@ -12250,9 +12781,9 @@ var parseClass = (glob2, position) => {
12250
12781
  }
12251
12782
  if (c === "[" && !escaping) {
12252
12783
  for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
12253
- if (glob2.startsWith(cls, i2)) {
12784
+ if (glob.startsWith(cls, i2)) {
12254
12785
  if (rangeStart) {
12255
- return ["$.", false, glob2.length - pos, true];
12786
+ return ["$.", false, glob.length - pos, true];
12256
12787
  }
12257
12788
  i2 += cls.length;
12258
12789
  if (neg)
@@ -12275,12 +12806,12 @@ var parseClass = (glob2, position) => {
12275
12806
  i2++;
12276
12807
  continue;
12277
12808
  }
12278
- if (glob2.startsWith("-]", i2 + 1)) {
12809
+ if (glob.startsWith("-]", i2 + 1)) {
12279
12810
  ranges.push(braceEscape(c + "-"));
12280
12811
  i2 += 2;
12281
12812
  continue;
12282
12813
  }
12283
- if (glob2.startsWith("-", i2 + 1)) {
12814
+ if (glob.startsWith("-", i2 + 1)) {
12284
12815
  rangeStart = c;
12285
12816
  i2 += 2;
12286
12817
  continue;
@@ -12292,7 +12823,7 @@ var parseClass = (glob2, position) => {
12292
12823
  return ["", false, 0, false];
12293
12824
  }
12294
12825
  if (!ranges.length && !negs.length) {
12295
- return ["$.", false, glob2.length - pos, true];
12826
+ return ["$.", false, glob.length - pos, true];
12296
12827
  }
12297
12828
  if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
12298
12829
  const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
@@ -12567,16 +13098,16 @@ class AST {
12567
13098
  toMMPattern() {
12568
13099
  if (this !== this.#root)
12569
13100
  return this.#root.toMMPattern();
12570
- const glob2 = this.toString();
13101
+ const glob = this.toString();
12571
13102
  const [re, body2, hasMagic, uflag] = this.toRegExpSource();
12572
- const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob2.toUpperCase() !== glob2.toLowerCase();
13103
+ const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
12573
13104
  if (!anyMagic) {
12574
13105
  return body2;
12575
13106
  }
12576
13107
  const flags2 = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
12577
13108
  return Object.assign(new RegExp(`^${re}$`, flags2), {
12578
13109
  _src: re,
12579
- _glob: glob2
13110
+ _glob: glob
12580
13111
  });
12581
13112
  }
12582
13113
  get options() {
@@ -12659,19 +13190,19 @@ class AST {
12659
13190
  return re;
12660
13191
  }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
12661
13192
  }
12662
- static #parseGlob(glob2, hasMagic, noEmpty = false) {
13193
+ static #parseGlob(glob, hasMagic, noEmpty = false) {
12663
13194
  let escaping = false;
12664
13195
  let re = "";
12665
13196
  let uflag = false;
12666
- for (let i2 = 0;i2 < glob2.length; i2++) {
12667
- const c = glob2.charAt(i2);
13197
+ for (let i2 = 0;i2 < glob.length; i2++) {
13198
+ const c = glob.charAt(i2);
12668
13199
  if (escaping) {
12669
13200
  escaping = false;
12670
13201
  re += (reSpecials.has(c) ? "\\" : "") + c;
12671
13202
  continue;
12672
13203
  }
12673
13204
  if (c === "\\") {
12674
- if (i2 === glob2.length - 1) {
13205
+ if (i2 === glob.length - 1) {
12675
13206
  re += "\\\\";
12676
13207
  } else {
12677
13208
  escaping = true;
@@ -12679,7 +13210,7 @@ class AST {
12679
13210
  continue;
12680
13211
  }
12681
13212
  if (c === "[") {
12682
- const [src, needUflag, consumed, magic] = parseClass(glob2, i2);
13213
+ const [src, needUflag, consumed, magic] = parseClass(glob, i2);
12683
13214
  if (consumed) {
12684
13215
  re += src;
12685
13216
  uflag = uflag || needUflag;
@@ -12689,7 +13220,7 @@ class AST {
12689
13220
  }
12690
13221
  }
12691
13222
  if (c === "*") {
12692
- if (noEmpty && glob2 === "*")
13223
+ if (noEmpty && glob === "*")
12693
13224
  re += starNoEmpty;
12694
13225
  else
12695
13226
  re += star;
@@ -12703,7 +13234,7 @@ class AST {
12703
13234
  }
12704
13235
  re += regExpEscape(c);
12705
13236
  }
12706
- return [re, unescape(glob2), !!hasMagic, uflag];
13237
+ return [re, unescape(glob), !!hasMagic, uflag];
12707
13238
  }
12708
13239
  }
12709
13240
 
@@ -12775,8 +13306,8 @@ var path22 = {
12775
13306
  win32: { sep: "\\" },
12776
13307
  posix: { sep: "/" }
12777
13308
  };
12778
- var sep = defaultPlatform === "win32" ? path22.win32.sep : path22.posix.sep;
12779
- minimatch.sep = sep;
13309
+ var sep2 = defaultPlatform === "win32" ? path22.win32.sep : path22.posix.sep;
13310
+ minimatch.sep = sep2;
12780
13311
  var GLOBSTAR = Symbol("globstar **");
12781
13312
  minimatch.GLOBSTAR = GLOBSTAR;
12782
13313
  var qmark2 = "[^/]";
@@ -13472,8 +14003,8 @@ function createSearchContext(rootDir, moduleId, config) {
13472
14003
  const files = [];
13473
14004
  await traverseDirectory(indexPath, files, indexPath);
13474
14005
  return files.filter((f) => f.endsWith(".json") && !f.endsWith("manifest.json")).map((f) => {
13475
- const relative3 = path23.relative(indexPath, f);
13476
- return relative3.replace(/\.json$/, "");
14006
+ const relative4 = path23.relative(indexPath, f);
14007
+ return relative4.replace(/\.json$/, "");
13477
14008
  });
13478
14009
  }
13479
14010
  };
@@ -13584,4 +14115,4 @@ export {
13584
14115
  ConsoleLogger
13585
14116
  };
13586
14117
 
13587
- //# debugId=EA9D4B791B6DE73764756E2164756E21
14118
+ //# debugId=7829AFEE37F24D3164756E2164756E21