raggrep 0.10.2 → 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/app/indexer/index.d.ts +25 -0
- package/dist/cli/main.js +690 -88
- package/dist/cli/main.js.map +6 -5
- package/dist/index.js +688 -82
- package/dist/index.js.map +5 -4
- package/package.json +2 -1
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:
|
|
5110
|
-
var require =
|
|
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((
|
|
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
|
-
|
|
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((
|
|
5366
|
+
return new Promise((resolve3, reject) => {
|
|
5367
5367
|
Module["instantiateWasm"](info2, (mod, inst) => {
|
|
5368
|
-
|
|
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
|
|
6081
|
+
var callback2 = dependenciesFulfilled;
|
|
6082
6082
|
dependenciesFulfilled = null;
|
|
6083
|
-
|
|
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((
|
|
6656
|
-
readyPromiseResolve =
|
|
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(
|
|
7773
|
-
if (typeof
|
|
7774
|
-
C.currentParseCallback = (index) =>
|
|
7775
|
-
} else if (typeof
|
|
7776
|
-
C.currentParseCallback =
|
|
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(
|
|
7838
|
-
if (!
|
|
7837
|
+
setLogger(callback2) {
|
|
7838
|
+
if (!callback2) {
|
|
7839
7839
|
this.logCallback = null;
|
|
7840
|
-
} else if (typeof
|
|
7840
|
+
} else if (typeof callback2 !== "function") {
|
|
7841
7841
|
throw new Error("Logger callback must be a function");
|
|
7842
7842
|
} else {
|
|
7843
|
-
this.logCallback =
|
|
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";
|
|
@@ -11441,6 +11973,7 @@ function getOptimalConcurrency() {
|
|
|
11441
11973
|
return optimal;
|
|
11442
11974
|
}
|
|
11443
11975
|
var DEFAULT_CONCURRENCY = getOptimalConcurrency();
|
|
11976
|
+
var STAT_CONCURRENCY = Math.max(32, getOptimalConcurrency() * 4);
|
|
11444
11977
|
async function indexDirectory(rootDir, options = {}) {
|
|
11445
11978
|
const verbose = options.verbose ?? false;
|
|
11446
11979
|
const quiet = options.quiet ?? false;
|
|
@@ -11558,6 +12091,15 @@ async function resetIndex(rootDir) {
|
|
|
11558
12091
|
async function ensureIndexFresh(rootDir, options = {}) {
|
|
11559
12092
|
const verbose = options.verbose ?? false;
|
|
11560
12093
|
const quiet = options.quiet ?? false;
|
|
12094
|
+
const showTiming = options.timing ?? false;
|
|
12095
|
+
const startTime = Date.now();
|
|
12096
|
+
let fileDiscoveryMs = 0;
|
|
12097
|
+
let statCheckMs = 0;
|
|
12098
|
+
let indexingMs = 0;
|
|
12099
|
+
let cleanupMs = 0;
|
|
12100
|
+
let filesDiscovered = 0;
|
|
12101
|
+
let filesStatChecked = 0;
|
|
12102
|
+
let filesIndexed = 0;
|
|
11561
12103
|
const logger = options.logger ? options.logger : quiet ? createSilentLogger() : createLogger({ verbose });
|
|
11562
12104
|
rootDir = path21.resolve(rootDir);
|
|
11563
12105
|
const status = await getIndexStatus(rootDir);
|
|
@@ -11589,16 +12131,35 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11589
12131
|
const now = Date.now();
|
|
11590
12132
|
if (freshnessCache && freshnessCache.rootDir === rootDir && now - freshnessCache.timestamp < FRESHNESS_CACHE_TTL_MS && freshnessCache.manifestMtime === currentManifestMtime) {
|
|
11591
12133
|
logger.debug("Using cached freshness check result");
|
|
11592
|
-
|
|
12134
|
+
const cachedResult = { ...freshnessCache.result };
|
|
12135
|
+
if (showTiming) {
|
|
12136
|
+
cachedResult.timing = {
|
|
12137
|
+
totalMs: Date.now() - startTime,
|
|
12138
|
+
fileDiscoveryMs: 0,
|
|
12139
|
+
statCheckMs: 0,
|
|
12140
|
+
indexingMs: 0,
|
|
12141
|
+
cleanupMs: 0,
|
|
12142
|
+
filesDiscovered: 0,
|
|
12143
|
+
filesStatChecked: 0,
|
|
12144
|
+
filesIndexed: 0,
|
|
12145
|
+
fromCache: true
|
|
12146
|
+
};
|
|
12147
|
+
}
|
|
12148
|
+
return cachedResult;
|
|
11593
12149
|
}
|
|
11594
12150
|
await registerBuiltInModules();
|
|
11595
12151
|
const enabledModules = registry.getEnabled(config);
|
|
11596
12152
|
if (enabledModules.length === 0) {
|
|
11597
12153
|
return { indexed: 0, removed: 0, unchanged: 0 };
|
|
11598
12154
|
}
|
|
12155
|
+
const fileDiscoveryStart = Date.now();
|
|
11599
12156
|
const introspection = new IntrospectionIndex(rootDir);
|
|
11600
|
-
await
|
|
11601
|
-
|
|
12157
|
+
const [, currentFiles] = await Promise.all([
|
|
12158
|
+
introspection.initialize(),
|
|
12159
|
+
findFiles(rootDir, config)
|
|
12160
|
+
]);
|
|
12161
|
+
fileDiscoveryMs = Date.now() - fileDiscoveryStart;
|
|
12162
|
+
filesDiscovered = currentFiles.length;
|
|
11602
12163
|
const currentFileSet = new Set(currentFiles.map((f) => path21.relative(rootDir, f)));
|
|
11603
12164
|
let totalIndexed = 0;
|
|
11604
12165
|
let totalRemoved = 0;
|
|
@@ -11627,20 +12188,21 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11627
12188
|
filesToRemove.push(filepath);
|
|
11628
12189
|
}
|
|
11629
12190
|
}
|
|
12191
|
+
const cleanupStart = Date.now();
|
|
11630
12192
|
const removedFilepaths = [];
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
totalRemoved
|
|
12193
|
+
if (filesToRemove.length > 0) {
|
|
12194
|
+
await Promise.all(filesToRemove.map(async (filepath) => {
|
|
12195
|
+
logger.debug(` Removing stale: ${filepath}`);
|
|
12196
|
+
const indexFilePath = path21.join(indexPath, filepath.replace(/\.[^.]+$/, ".json"));
|
|
12197
|
+
const symbolicFilePath = path21.join(indexPath, "symbolic", filepath.replace(/\.[^.]+$/, ".json"));
|
|
12198
|
+
await Promise.all([
|
|
12199
|
+
fs8.unlink(indexFilePath).catch(() => {}),
|
|
12200
|
+
fs8.unlink(symbolicFilePath).catch(() => {})
|
|
12201
|
+
]);
|
|
12202
|
+
delete manifest.files[filepath];
|
|
12203
|
+
removedFilepaths.push(filepath);
|
|
12204
|
+
}));
|
|
12205
|
+
totalRemoved += removedFilepaths.length;
|
|
11644
12206
|
}
|
|
11645
12207
|
if (removedFilepaths.length > 0) {
|
|
11646
12208
|
try {
|
|
@@ -11654,6 +12216,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11654
12216
|
await literalIndex.save();
|
|
11655
12217
|
} catch {}
|
|
11656
12218
|
}
|
|
12219
|
+
cleanupMs += Date.now() - cleanupStart;
|
|
11657
12220
|
const ctx = {
|
|
11658
12221
|
rootDir,
|
|
11659
12222
|
config,
|
|
@@ -11668,21 +12231,51 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11668
12231
|
},
|
|
11669
12232
|
getIntrospection: (filepath) => introspection.getFile(filepath)
|
|
11670
12233
|
};
|
|
11671
|
-
const
|
|
11672
|
-
let completedCount = 0;
|
|
11673
|
-
const processIncrementalFile = async (filepath) => {
|
|
12234
|
+
const statCheck = async (filepath) => {
|
|
11674
12235
|
const relativePath = path21.relative(rootDir, filepath);
|
|
11675
12236
|
try {
|
|
11676
12237
|
const stats = await fs8.stat(filepath);
|
|
11677
12238
|
const lastModified = stats.mtime.toISOString();
|
|
11678
12239
|
const existingEntry = manifest.files[relativePath];
|
|
11679
|
-
if (existingEntry
|
|
11680
|
-
|
|
11681
|
-
|
|
12240
|
+
if (!existingEntry) {
|
|
12241
|
+
return { filepath, relativePath, lastModified, needsCheck: true, isNew: true };
|
|
12242
|
+
}
|
|
12243
|
+
if (existingEntry.lastModified === lastModified) {
|
|
12244
|
+
return { filepath, relativePath, lastModified, needsCheck: false, isNew: false };
|
|
11682
12245
|
}
|
|
12246
|
+
return { filepath, relativePath, lastModified, needsCheck: true, isNew: false };
|
|
12247
|
+
} catch {
|
|
12248
|
+
return null;
|
|
12249
|
+
}
|
|
12250
|
+
};
|
|
12251
|
+
const statCheckStart = Date.now();
|
|
12252
|
+
const statResults = await parallelMap(currentFiles, statCheck, STAT_CONCURRENCY);
|
|
12253
|
+
statCheckMs += Date.now() - statCheckStart;
|
|
12254
|
+
filesStatChecked += currentFiles.length;
|
|
12255
|
+
const filesToProcess = [];
|
|
12256
|
+
let unchangedCount = 0;
|
|
12257
|
+
for (const result2 of statResults) {
|
|
12258
|
+
if (!result2.success || !result2.value)
|
|
12259
|
+
continue;
|
|
12260
|
+
if (result2.value.needsCheck) {
|
|
12261
|
+
filesToProcess.push(result2.value);
|
|
12262
|
+
} else {
|
|
12263
|
+
unchangedCount++;
|
|
12264
|
+
}
|
|
12265
|
+
}
|
|
12266
|
+
if (filesToProcess.length === 0) {
|
|
12267
|
+
totalUnchanged += unchangedCount;
|
|
12268
|
+
continue;
|
|
12269
|
+
}
|
|
12270
|
+
let completedCount = 0;
|
|
12271
|
+
const totalToProcess = filesToProcess.length;
|
|
12272
|
+
const processChangedFile = async (statResult) => {
|
|
12273
|
+
const { filepath, relativePath, lastModified, isNew } = statResult;
|
|
12274
|
+
try {
|
|
11683
12275
|
const content = await fs8.readFile(filepath, "utf-8");
|
|
11684
12276
|
const contentHash = computeContentHash(content);
|
|
11685
|
-
|
|
12277
|
+
const existingEntry = manifest.files[relativePath];
|
|
12278
|
+
if (!isNew && existingEntry?.contentHash && existingEntry.contentHash === contentHash) {
|
|
11686
12279
|
completedCount++;
|
|
11687
12280
|
return {
|
|
11688
12281
|
relativePath,
|
|
@@ -11692,7 +12285,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11692
12285
|
};
|
|
11693
12286
|
}
|
|
11694
12287
|
completedCount++;
|
|
11695
|
-
logger.progress(` [${completedCount}/${
|
|
12288
|
+
logger.progress(` [${completedCount}/${totalToProcess}] Indexing: ${relativePath}`);
|
|
11696
12289
|
introspection.addFile(relativePath, content);
|
|
11697
12290
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
11698
12291
|
if (!fileIndex) {
|
|
@@ -11711,8 +12304,12 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11711
12304
|
return { relativePath, status: "error", error };
|
|
11712
12305
|
}
|
|
11713
12306
|
};
|
|
12307
|
+
const indexingStart = Date.now();
|
|
11714
12308
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
11715
|
-
const results = await parallelMap(
|
|
12309
|
+
const results = await parallelMap(filesToProcess, processChangedFile, concurrency);
|
|
12310
|
+
indexingMs += Date.now() - indexingStart;
|
|
12311
|
+
filesIndexed += filesToProcess.length;
|
|
12312
|
+
totalUnchanged += unchangedCount;
|
|
11716
12313
|
logger.clearProgress();
|
|
11717
12314
|
let mtimeUpdates = 0;
|
|
11718
12315
|
for (const item of results) {
|
|
@@ -11773,6 +12370,19 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11773
12370
|
removed: totalRemoved,
|
|
11774
12371
|
unchanged: totalUnchanged
|
|
11775
12372
|
};
|
|
12373
|
+
if (showTiming) {
|
|
12374
|
+
result.timing = {
|
|
12375
|
+
totalMs: Date.now() - startTime,
|
|
12376
|
+
fileDiscoveryMs,
|
|
12377
|
+
statCheckMs,
|
|
12378
|
+
indexingMs,
|
|
12379
|
+
cleanupMs,
|
|
12380
|
+
filesDiscovered,
|
|
12381
|
+
filesStatChecked,
|
|
12382
|
+
filesIndexed,
|
|
12383
|
+
fromCache: false
|
|
12384
|
+
};
|
|
12385
|
+
}
|
|
11776
12386
|
let finalManifestMtime = currentManifestMtime;
|
|
11777
12387
|
try {
|
|
11778
12388
|
const manifestStats = await fs8.stat(globalManifestPath);
|
|
@@ -11780,7 +12390,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11780
12390
|
} catch {}
|
|
11781
12391
|
freshnessCache = {
|
|
11782
12392
|
rootDir,
|
|
11783
|
-
result,
|
|
12393
|
+
result: { indexed: totalIndexed, removed: totalRemoved, unchanged: totalUnchanged },
|
|
11784
12394
|
timestamp: Date.now(),
|
|
11785
12395
|
manifestMtime: finalManifestMtime
|
|
11786
12396
|
};
|
|
@@ -11920,18 +12530,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11920
12530
|
return result;
|
|
11921
12531
|
}
|
|
11922
12532
|
async function findFiles(rootDir, config) {
|
|
11923
|
-
const
|
|
11924
|
-
const
|
|
11925
|
-
const
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
});
|
|
11932
|
-
files.push(...matches);
|
|
11933
|
-
}
|
|
11934
|
-
return [...new Set(files)];
|
|
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;
|
|
11935
12541
|
}
|
|
11936
12542
|
async function loadModuleManifest(rootDir, moduleId, config) {
|
|
11937
12543
|
const manifestPath = getModuleManifestPath(rootDir, moduleId, config);
|
|
@@ -12139,9 +12745,9 @@ var posixClasses = {
|
|
|
12139
12745
|
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
12140
12746
|
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
12141
12747
|
var rangesToString = (ranges) => ranges.join("");
|
|
12142
|
-
var parseClass = (
|
|
12748
|
+
var parseClass = (glob, position) => {
|
|
12143
12749
|
const pos = position;
|
|
12144
|
-
if (
|
|
12750
|
+
if (glob.charAt(pos) !== "[") {
|
|
12145
12751
|
throw new Error("not in a brace expression");
|
|
12146
12752
|
}
|
|
12147
12753
|
const ranges = [];
|
|
@@ -12154,8 +12760,8 @@ var parseClass = (glob2, position) => {
|
|
|
12154
12760
|
let endPos = pos;
|
|
12155
12761
|
let rangeStart = "";
|
|
12156
12762
|
WHILE:
|
|
12157
|
-
while (i2 <
|
|
12158
|
-
const c =
|
|
12763
|
+
while (i2 < glob.length) {
|
|
12764
|
+
const c = glob.charAt(i2);
|
|
12159
12765
|
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
12160
12766
|
negate = true;
|
|
12161
12767
|
i2++;
|
|
@@ -12175,9 +12781,9 @@ var parseClass = (glob2, position) => {
|
|
|
12175
12781
|
}
|
|
12176
12782
|
if (c === "[" && !escaping) {
|
|
12177
12783
|
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
12178
|
-
if (
|
|
12784
|
+
if (glob.startsWith(cls, i2)) {
|
|
12179
12785
|
if (rangeStart) {
|
|
12180
|
-
return ["$.", false,
|
|
12786
|
+
return ["$.", false, glob.length - pos, true];
|
|
12181
12787
|
}
|
|
12182
12788
|
i2 += cls.length;
|
|
12183
12789
|
if (neg)
|
|
@@ -12200,12 +12806,12 @@ var parseClass = (glob2, position) => {
|
|
|
12200
12806
|
i2++;
|
|
12201
12807
|
continue;
|
|
12202
12808
|
}
|
|
12203
|
-
if (
|
|
12809
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
12204
12810
|
ranges.push(braceEscape(c + "-"));
|
|
12205
12811
|
i2 += 2;
|
|
12206
12812
|
continue;
|
|
12207
12813
|
}
|
|
12208
|
-
if (
|
|
12814
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
12209
12815
|
rangeStart = c;
|
|
12210
12816
|
i2 += 2;
|
|
12211
12817
|
continue;
|
|
@@ -12217,7 +12823,7 @@ var parseClass = (glob2, position) => {
|
|
|
12217
12823
|
return ["", false, 0, false];
|
|
12218
12824
|
}
|
|
12219
12825
|
if (!ranges.length && !negs.length) {
|
|
12220
|
-
return ["$.", false,
|
|
12826
|
+
return ["$.", false, glob.length - pos, true];
|
|
12221
12827
|
}
|
|
12222
12828
|
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
12223
12829
|
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
@@ -12492,16 +13098,16 @@ class AST {
|
|
|
12492
13098
|
toMMPattern() {
|
|
12493
13099
|
if (this !== this.#root)
|
|
12494
13100
|
return this.#root.toMMPattern();
|
|
12495
|
-
const
|
|
13101
|
+
const glob = this.toString();
|
|
12496
13102
|
const [re, body2, hasMagic, uflag] = this.toRegExpSource();
|
|
12497
|
-
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly &&
|
|
13103
|
+
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
12498
13104
|
if (!anyMagic) {
|
|
12499
13105
|
return body2;
|
|
12500
13106
|
}
|
|
12501
13107
|
const flags2 = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
12502
13108
|
return Object.assign(new RegExp(`^${re}$`, flags2), {
|
|
12503
13109
|
_src: re,
|
|
12504
|
-
_glob:
|
|
13110
|
+
_glob: glob
|
|
12505
13111
|
});
|
|
12506
13112
|
}
|
|
12507
13113
|
get options() {
|
|
@@ -12584,19 +13190,19 @@ class AST {
|
|
|
12584
13190
|
return re;
|
|
12585
13191
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
12586
13192
|
}
|
|
12587
|
-
static #parseGlob(
|
|
13193
|
+
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
12588
13194
|
let escaping = false;
|
|
12589
13195
|
let re = "";
|
|
12590
13196
|
let uflag = false;
|
|
12591
|
-
for (let i2 = 0;i2 <
|
|
12592
|
-
const c =
|
|
13197
|
+
for (let i2 = 0;i2 < glob.length; i2++) {
|
|
13198
|
+
const c = glob.charAt(i2);
|
|
12593
13199
|
if (escaping) {
|
|
12594
13200
|
escaping = false;
|
|
12595
13201
|
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
12596
13202
|
continue;
|
|
12597
13203
|
}
|
|
12598
13204
|
if (c === "\\") {
|
|
12599
|
-
if (i2 ===
|
|
13205
|
+
if (i2 === glob.length - 1) {
|
|
12600
13206
|
re += "\\\\";
|
|
12601
13207
|
} else {
|
|
12602
13208
|
escaping = true;
|
|
@@ -12604,7 +13210,7 @@ class AST {
|
|
|
12604
13210
|
continue;
|
|
12605
13211
|
}
|
|
12606
13212
|
if (c === "[") {
|
|
12607
|
-
const [src, needUflag, consumed, magic] = parseClass(
|
|
13213
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
12608
13214
|
if (consumed) {
|
|
12609
13215
|
re += src;
|
|
12610
13216
|
uflag = uflag || needUflag;
|
|
@@ -12614,7 +13220,7 @@ class AST {
|
|
|
12614
13220
|
}
|
|
12615
13221
|
}
|
|
12616
13222
|
if (c === "*") {
|
|
12617
|
-
if (noEmpty &&
|
|
13223
|
+
if (noEmpty && glob === "*")
|
|
12618
13224
|
re += starNoEmpty;
|
|
12619
13225
|
else
|
|
12620
13226
|
re += star;
|
|
@@ -12628,7 +13234,7 @@ class AST {
|
|
|
12628
13234
|
}
|
|
12629
13235
|
re += regExpEscape(c);
|
|
12630
13236
|
}
|
|
12631
|
-
return [re, unescape(
|
|
13237
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
12632
13238
|
}
|
|
12633
13239
|
}
|
|
12634
13240
|
|
|
@@ -12700,8 +13306,8 @@ var path22 = {
|
|
|
12700
13306
|
win32: { sep: "\\" },
|
|
12701
13307
|
posix: { sep: "/" }
|
|
12702
13308
|
};
|
|
12703
|
-
var
|
|
12704
|
-
minimatch.sep =
|
|
13309
|
+
var sep2 = defaultPlatform === "win32" ? path22.win32.sep : path22.posix.sep;
|
|
13310
|
+
minimatch.sep = sep2;
|
|
12705
13311
|
var GLOBSTAR = Symbol("globstar **");
|
|
12706
13312
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
12707
13313
|
var qmark2 = "[^/]";
|
|
@@ -13397,8 +14003,8 @@ function createSearchContext(rootDir, moduleId, config) {
|
|
|
13397
14003
|
const files = [];
|
|
13398
14004
|
await traverseDirectory(indexPath, files, indexPath);
|
|
13399
14005
|
return files.filter((f) => f.endsWith(".json") && !f.endsWith("manifest.json")).map((f) => {
|
|
13400
|
-
const
|
|
13401
|
-
return
|
|
14006
|
+
const relative4 = path23.relative(indexPath, f);
|
|
14007
|
+
return relative4.replace(/\.json$/, "");
|
|
13402
14008
|
});
|
|
13403
14009
|
}
|
|
13404
14010
|
};
|
|
@@ -13509,4 +14115,4 @@ export {
|
|
|
13509
14115
|
ConsoleLogger
|
|
13510
14116
|
};
|
|
13511
14117
|
|
|
13512
|
-
//# debugId=
|
|
14118
|
+
//# debugId=7829AFEE37F24D3164756E2164756E21
|