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/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";
|
|
@@ -11567,7 +12099,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11567
12099
|
let cleanupMs = 0;
|
|
11568
12100
|
let filesDiscovered = 0;
|
|
11569
12101
|
let filesStatChecked = 0;
|
|
11570
|
-
let
|
|
12102
|
+
let filesWithChanges = 0;
|
|
12103
|
+
let filesReindexed = 0;
|
|
11571
12104
|
const logger = options.logger ? options.logger : quiet ? createSilentLogger() : createLogger({ verbose });
|
|
11572
12105
|
rootDir = path21.resolve(rootDir);
|
|
11573
12106
|
const status = await getIndexStatus(rootDir);
|
|
@@ -11609,7 +12142,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11609
12142
|
cleanupMs: 0,
|
|
11610
12143
|
filesDiscovered: 0,
|
|
11611
12144
|
filesStatChecked: 0,
|
|
11612
|
-
|
|
12145
|
+
filesWithChanges: 0,
|
|
12146
|
+
filesReindexed: 0,
|
|
11613
12147
|
fromCache: true
|
|
11614
12148
|
};
|
|
11615
12149
|
}
|
|
@@ -11704,14 +12238,18 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11704
12238
|
try {
|
|
11705
12239
|
const stats = await fs8.stat(filepath);
|
|
11706
12240
|
const lastModified = stats.mtime.toISOString();
|
|
12241
|
+
const fileSize = stats.size;
|
|
11707
12242
|
const existingEntry = manifest.files[relativePath];
|
|
11708
12243
|
if (!existingEntry) {
|
|
11709
|
-
return { filepath, relativePath, lastModified, needsCheck: true, isNew: true };
|
|
12244
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: true };
|
|
11710
12245
|
}
|
|
11711
12246
|
if (existingEntry.lastModified === lastModified) {
|
|
11712
|
-
return { filepath, relativePath, lastModified, needsCheck: false, isNew: false };
|
|
12247
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false };
|
|
12248
|
+
}
|
|
12249
|
+
if (existingEntry.fileSize !== undefined && existingEntry.fileSize === fileSize && existingEntry.contentHash) {
|
|
12250
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
11713
12251
|
}
|
|
11714
|
-
return { filepath, relativePath, lastModified, needsCheck: true, isNew: false };
|
|
12252
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
11715
12253
|
} catch {
|
|
11716
12254
|
return null;
|
|
11717
12255
|
}
|
|
@@ -11721,6 +12259,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11721
12259
|
statCheckMs += Date.now() - statCheckStart;
|
|
11722
12260
|
filesStatChecked += currentFiles.length;
|
|
11723
12261
|
const filesToProcess = [];
|
|
12262
|
+
const filesWithMtimeOnlyChange = [];
|
|
11724
12263
|
let unchangedCount = 0;
|
|
11725
12264
|
for (const result2 of statResults) {
|
|
11726
12265
|
if (!result2.success || !result2.value)
|
|
@@ -11729,16 +12268,36 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11729
12268
|
filesToProcess.push(result2.value);
|
|
11730
12269
|
} else {
|
|
11731
12270
|
unchangedCount++;
|
|
12271
|
+
const existingEntry = manifest.files[result2.value.relativePath];
|
|
12272
|
+
if (existingEntry && existingEntry.lastModified !== result2.value.lastModified) {
|
|
12273
|
+
filesWithMtimeOnlyChange.push(result2.value);
|
|
12274
|
+
}
|
|
12275
|
+
}
|
|
12276
|
+
}
|
|
12277
|
+
let mtimeOnlyUpdates = 0;
|
|
12278
|
+
for (const file of filesWithMtimeOnlyChange) {
|
|
12279
|
+
const existingEntry = manifest.files[file.relativePath];
|
|
12280
|
+
if (existingEntry) {
|
|
12281
|
+
manifest.files[file.relativePath] = {
|
|
12282
|
+
...existingEntry,
|
|
12283
|
+
lastModified: file.lastModified,
|
|
12284
|
+
fileSize: file.fileSize
|
|
12285
|
+
};
|
|
12286
|
+
mtimeOnlyUpdates++;
|
|
11732
12287
|
}
|
|
11733
12288
|
}
|
|
11734
12289
|
if (filesToProcess.length === 0) {
|
|
11735
12290
|
totalUnchanged += unchangedCount;
|
|
12291
|
+
if (mtimeOnlyUpdates > 0) {
|
|
12292
|
+
manifest.lastUpdated = new Date().toISOString();
|
|
12293
|
+
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
12294
|
+
}
|
|
11736
12295
|
continue;
|
|
11737
12296
|
}
|
|
11738
12297
|
let completedCount = 0;
|
|
11739
12298
|
const totalToProcess = filesToProcess.length;
|
|
11740
12299
|
const processChangedFile = async (statResult) => {
|
|
11741
|
-
const { filepath, relativePath, lastModified, isNew } = statResult;
|
|
12300
|
+
const { filepath, relativePath, lastModified, fileSize, isNew } = statResult;
|
|
11742
12301
|
try {
|
|
11743
12302
|
const content = await fs8.readFile(filepath, "utf-8");
|
|
11744
12303
|
const contentHash = computeContentHash(content);
|
|
@@ -11749,6 +12308,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11749
12308
|
relativePath,
|
|
11750
12309
|
status: "mtime_updated",
|
|
11751
12310
|
lastModified,
|
|
12311
|
+
fileSize,
|
|
11752
12312
|
contentHash
|
|
11753
12313
|
};
|
|
11754
12314
|
}
|
|
@@ -11757,13 +12317,14 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11757
12317
|
introspection.addFile(relativePath, content);
|
|
11758
12318
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
11759
12319
|
if (!fileIndex) {
|
|
11760
|
-
return { relativePath, status: "unchanged" };
|
|
12320
|
+
return { relativePath, status: "unchanged", fileSize };
|
|
11761
12321
|
}
|
|
11762
12322
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
11763
12323
|
return {
|
|
11764
12324
|
relativePath,
|
|
11765
12325
|
status: "indexed",
|
|
11766
12326
|
lastModified,
|
|
12327
|
+
fileSize,
|
|
11767
12328
|
chunkCount: fileIndex.chunks.length,
|
|
11768
12329
|
contentHash
|
|
11769
12330
|
};
|
|
@@ -11776,7 +12337,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11776
12337
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
11777
12338
|
const results = await parallelMap(filesToProcess, processChangedFile, concurrency);
|
|
11778
12339
|
indexingMs += Date.now() - indexingStart;
|
|
11779
|
-
|
|
12340
|
+
filesWithChanges += filesToProcess.length;
|
|
11780
12341
|
totalUnchanged += unchangedCount;
|
|
11781
12342
|
logger.clearProgress();
|
|
11782
12343
|
let mtimeUpdates = 0;
|
|
@@ -11790,7 +12351,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11790
12351
|
manifest.files[fileResult.relativePath] = {
|
|
11791
12352
|
lastModified: fileResult.lastModified,
|
|
11792
12353
|
chunkCount: fileResult.chunkCount,
|
|
11793
|
-
contentHash: fileResult.contentHash
|
|
12354
|
+
contentHash: fileResult.contentHash,
|
|
12355
|
+
fileSize: fileResult.fileSize
|
|
11794
12356
|
};
|
|
11795
12357
|
totalIndexed++;
|
|
11796
12358
|
break;
|
|
@@ -11799,7 +12361,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11799
12361
|
manifest.files[fileResult.relativePath] = {
|
|
11800
12362
|
...manifest.files[fileResult.relativePath],
|
|
11801
12363
|
lastModified: fileResult.lastModified,
|
|
11802
|
-
contentHash: fileResult.contentHash
|
|
12364
|
+
contentHash: fileResult.contentHash,
|
|
12365
|
+
fileSize: fileResult.fileSize
|
|
11803
12366
|
};
|
|
11804
12367
|
mtimeUpdates++;
|
|
11805
12368
|
}
|
|
@@ -11813,7 +12376,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11813
12376
|
break;
|
|
11814
12377
|
}
|
|
11815
12378
|
}
|
|
11816
|
-
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0;
|
|
12379
|
+
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0 || mtimeOnlyUpdates > 0;
|
|
11817
12380
|
if (hasManifestChanges) {
|
|
11818
12381
|
manifest.lastUpdated = new Date().toISOString();
|
|
11819
12382
|
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
@@ -11847,7 +12410,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11847
12410
|
cleanupMs,
|
|
11848
12411
|
filesDiscovered,
|
|
11849
12412
|
filesStatChecked,
|
|
11850
|
-
|
|
12413
|
+
filesWithChanges,
|
|
12414
|
+
filesReindexed: totalIndexed,
|
|
11851
12415
|
fromCache: false
|
|
11852
12416
|
};
|
|
11853
12417
|
}
|
|
@@ -11917,6 +12481,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11917
12481
|
try {
|
|
11918
12482
|
const stats = await fs8.stat(filepath);
|
|
11919
12483
|
const lastModified = stats.mtime.toISOString();
|
|
12484
|
+
const fileSize = stats.size;
|
|
11920
12485
|
const existingEntry = manifest.files[relativePath];
|
|
11921
12486
|
if (existingEntry && existingEntry.lastModified === lastModified) {
|
|
11922
12487
|
completedCount++;
|
|
@@ -11932,6 +12497,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11932
12497
|
relativePath,
|
|
11933
12498
|
status: "skipped",
|
|
11934
12499
|
lastModified,
|
|
12500
|
+
fileSize,
|
|
11935
12501
|
contentHash
|
|
11936
12502
|
};
|
|
11937
12503
|
}
|
|
@@ -11941,13 +12507,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11941
12507
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
11942
12508
|
if (!fileIndex) {
|
|
11943
12509
|
logger.debug(` [${completedCount}/${totalFiles}] Skipped ${relativePath} (no chunks)`);
|
|
11944
|
-
return { relativePath, status: "skipped" };
|
|
12510
|
+
return { relativePath, status: "skipped", fileSize };
|
|
11945
12511
|
}
|
|
11946
12512
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
11947
12513
|
return {
|
|
11948
12514
|
relativePath,
|
|
11949
12515
|
status: "indexed",
|
|
11950
12516
|
lastModified,
|
|
12517
|
+
fileSize,
|
|
11951
12518
|
chunkCount: fileIndex.chunks.length,
|
|
11952
12519
|
contentHash
|
|
11953
12520
|
};
|
|
@@ -11970,7 +12537,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11970
12537
|
manifest.files[fileResult.relativePath] = {
|
|
11971
12538
|
lastModified: fileResult.lastModified,
|
|
11972
12539
|
chunkCount: fileResult.chunkCount,
|
|
11973
|
-
contentHash: fileResult.contentHash
|
|
12540
|
+
contentHash: fileResult.contentHash,
|
|
12541
|
+
fileSize: fileResult.fileSize
|
|
11974
12542
|
};
|
|
11975
12543
|
result.indexed++;
|
|
11976
12544
|
break;
|
|
@@ -11981,7 +12549,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11981
12549
|
manifest.files[fileResult.relativePath] = {
|
|
11982
12550
|
...existingEntry,
|
|
11983
12551
|
lastModified: fileResult.lastModified,
|
|
11984
|
-
contentHash: fileResult.contentHash
|
|
12552
|
+
contentHash: fileResult.contentHash,
|
|
12553
|
+
fileSize: fileResult.fileSize
|
|
11985
12554
|
};
|
|
11986
12555
|
}
|
|
11987
12556
|
}
|
|
@@ -11998,15 +12567,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
11998
12567
|
return result;
|
|
11999
12568
|
}
|
|
12000
12569
|
async function findFiles(rootDir, config) {
|
|
12001
|
-
const
|
|
12002
|
-
const
|
|
12003
|
-
const
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
return [...new Set(allFiles)];
|
|
12570
|
+
const validExtensions = new Set(config.extensions);
|
|
12571
|
+
const ignoreDirs = new Set(config.ignorePaths);
|
|
12572
|
+
const crawler = new Builder().withFullPaths().exclude((dirName) => ignoreDirs.has(dirName)).filter((filePath) => {
|
|
12573
|
+
const ext = path21.extname(filePath);
|
|
12574
|
+
return validExtensions.has(ext);
|
|
12575
|
+
}).crawl(rootDir);
|
|
12576
|
+
const files = await crawler.withPromise();
|
|
12577
|
+
return files;
|
|
12010
12578
|
}
|
|
12011
12579
|
async function loadModuleManifest(rootDir, moduleId, config) {
|
|
12012
12580
|
const manifestPath = getModuleManifestPath(rootDir, moduleId, config);
|
|
@@ -12214,9 +12782,9 @@ var posixClasses = {
|
|
|
12214
12782
|
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
12215
12783
|
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
12216
12784
|
var rangesToString = (ranges) => ranges.join("");
|
|
12217
|
-
var parseClass = (
|
|
12785
|
+
var parseClass = (glob, position) => {
|
|
12218
12786
|
const pos = position;
|
|
12219
|
-
if (
|
|
12787
|
+
if (glob.charAt(pos) !== "[") {
|
|
12220
12788
|
throw new Error("not in a brace expression");
|
|
12221
12789
|
}
|
|
12222
12790
|
const ranges = [];
|
|
@@ -12229,8 +12797,8 @@ var parseClass = (glob2, position) => {
|
|
|
12229
12797
|
let endPos = pos;
|
|
12230
12798
|
let rangeStart = "";
|
|
12231
12799
|
WHILE:
|
|
12232
|
-
while (i2 <
|
|
12233
|
-
const c =
|
|
12800
|
+
while (i2 < glob.length) {
|
|
12801
|
+
const c = glob.charAt(i2);
|
|
12234
12802
|
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
12235
12803
|
negate = true;
|
|
12236
12804
|
i2++;
|
|
@@ -12250,9 +12818,9 @@ var parseClass = (glob2, position) => {
|
|
|
12250
12818
|
}
|
|
12251
12819
|
if (c === "[" && !escaping) {
|
|
12252
12820
|
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
12253
|
-
if (
|
|
12821
|
+
if (glob.startsWith(cls, i2)) {
|
|
12254
12822
|
if (rangeStart) {
|
|
12255
|
-
return ["$.", false,
|
|
12823
|
+
return ["$.", false, glob.length - pos, true];
|
|
12256
12824
|
}
|
|
12257
12825
|
i2 += cls.length;
|
|
12258
12826
|
if (neg)
|
|
@@ -12275,12 +12843,12 @@ var parseClass = (glob2, position) => {
|
|
|
12275
12843
|
i2++;
|
|
12276
12844
|
continue;
|
|
12277
12845
|
}
|
|
12278
|
-
if (
|
|
12846
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
12279
12847
|
ranges.push(braceEscape(c + "-"));
|
|
12280
12848
|
i2 += 2;
|
|
12281
12849
|
continue;
|
|
12282
12850
|
}
|
|
12283
|
-
if (
|
|
12851
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
12284
12852
|
rangeStart = c;
|
|
12285
12853
|
i2 += 2;
|
|
12286
12854
|
continue;
|
|
@@ -12292,7 +12860,7 @@ var parseClass = (glob2, position) => {
|
|
|
12292
12860
|
return ["", false, 0, false];
|
|
12293
12861
|
}
|
|
12294
12862
|
if (!ranges.length && !negs.length) {
|
|
12295
|
-
return ["$.", false,
|
|
12863
|
+
return ["$.", false, glob.length - pos, true];
|
|
12296
12864
|
}
|
|
12297
12865
|
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
12298
12866
|
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
@@ -12567,16 +13135,16 @@ class AST {
|
|
|
12567
13135
|
toMMPattern() {
|
|
12568
13136
|
if (this !== this.#root)
|
|
12569
13137
|
return this.#root.toMMPattern();
|
|
12570
|
-
const
|
|
13138
|
+
const glob = this.toString();
|
|
12571
13139
|
const [re, body2, hasMagic, uflag] = this.toRegExpSource();
|
|
12572
|
-
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly &&
|
|
13140
|
+
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
12573
13141
|
if (!anyMagic) {
|
|
12574
13142
|
return body2;
|
|
12575
13143
|
}
|
|
12576
13144
|
const flags2 = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
12577
13145
|
return Object.assign(new RegExp(`^${re}$`, flags2), {
|
|
12578
13146
|
_src: re,
|
|
12579
|
-
_glob:
|
|
13147
|
+
_glob: glob
|
|
12580
13148
|
});
|
|
12581
13149
|
}
|
|
12582
13150
|
get options() {
|
|
@@ -12659,19 +13227,19 @@ class AST {
|
|
|
12659
13227
|
return re;
|
|
12660
13228
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
12661
13229
|
}
|
|
12662
|
-
static #parseGlob(
|
|
13230
|
+
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
12663
13231
|
let escaping = false;
|
|
12664
13232
|
let re = "";
|
|
12665
13233
|
let uflag = false;
|
|
12666
|
-
for (let i2 = 0;i2 <
|
|
12667
|
-
const c =
|
|
13234
|
+
for (let i2 = 0;i2 < glob.length; i2++) {
|
|
13235
|
+
const c = glob.charAt(i2);
|
|
12668
13236
|
if (escaping) {
|
|
12669
13237
|
escaping = false;
|
|
12670
13238
|
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
12671
13239
|
continue;
|
|
12672
13240
|
}
|
|
12673
13241
|
if (c === "\\") {
|
|
12674
|
-
if (i2 ===
|
|
13242
|
+
if (i2 === glob.length - 1) {
|
|
12675
13243
|
re += "\\\\";
|
|
12676
13244
|
} else {
|
|
12677
13245
|
escaping = true;
|
|
@@ -12679,7 +13247,7 @@ class AST {
|
|
|
12679
13247
|
continue;
|
|
12680
13248
|
}
|
|
12681
13249
|
if (c === "[") {
|
|
12682
|
-
const [src, needUflag, consumed, magic] = parseClass(
|
|
13250
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
12683
13251
|
if (consumed) {
|
|
12684
13252
|
re += src;
|
|
12685
13253
|
uflag = uflag || needUflag;
|
|
@@ -12689,7 +13257,7 @@ class AST {
|
|
|
12689
13257
|
}
|
|
12690
13258
|
}
|
|
12691
13259
|
if (c === "*") {
|
|
12692
|
-
if (noEmpty &&
|
|
13260
|
+
if (noEmpty && glob === "*")
|
|
12693
13261
|
re += starNoEmpty;
|
|
12694
13262
|
else
|
|
12695
13263
|
re += star;
|
|
@@ -12703,7 +13271,7 @@ class AST {
|
|
|
12703
13271
|
}
|
|
12704
13272
|
re += regExpEscape(c);
|
|
12705
13273
|
}
|
|
12706
|
-
return [re, unescape(
|
|
13274
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
12707
13275
|
}
|
|
12708
13276
|
}
|
|
12709
13277
|
|
|
@@ -12775,8 +13343,8 @@ var path22 = {
|
|
|
12775
13343
|
win32: { sep: "\\" },
|
|
12776
13344
|
posix: { sep: "/" }
|
|
12777
13345
|
};
|
|
12778
|
-
var
|
|
12779
|
-
minimatch.sep =
|
|
13346
|
+
var sep2 = defaultPlatform === "win32" ? path22.win32.sep : path22.posix.sep;
|
|
13347
|
+
minimatch.sep = sep2;
|
|
12780
13348
|
var GLOBSTAR = Symbol("globstar **");
|
|
12781
13349
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
12782
13350
|
var qmark2 = "[^/]";
|
|
@@ -13472,8 +14040,8 @@ function createSearchContext(rootDir, moduleId, config) {
|
|
|
13472
14040
|
const files = [];
|
|
13473
14041
|
await traverseDirectory(indexPath, files, indexPath);
|
|
13474
14042
|
return files.filter((f) => f.endsWith(".json") && !f.endsWith("manifest.json")).map((f) => {
|
|
13475
|
-
const
|
|
13476
|
-
return
|
|
14043
|
+
const relative4 = path23.relative(indexPath, f);
|
|
14044
|
+
return relative4.replace(/\.json$/, "");
|
|
13477
14045
|
});
|
|
13478
14046
|
}
|
|
13479
14047
|
};
|
|
@@ -13584,4 +14152,4 @@ export {
|
|
|
13584
14152
|
ConsoleLogger
|
|
13585
14153
|
};
|
|
13586
14154
|
|
|
13587
|
-
//# debugId=
|
|
14155
|
+
//# debugId=120D75FB1F633A7A64756E2164756E21
|