@wrongstack/tools 0.273.0 → 0.274.0
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/audit.js.map +1 -1
- package/dist/bash.js +193 -14
- package/dist/bash.js.map +1 -1
- package/dist/builtin.js +461 -161
- package/dist/builtin.js.map +1 -1
- package/dist/codebase-index/index.js +24 -16
- package/dist/codebase-index/index.js.map +1 -1
- package/dist/codebase-index/worker.js +24 -16
- package/dist/codebase-index/worker.js.map +1 -1
- package/dist/exec.d.ts +20 -1
- package/dist/exec.js +132 -71
- package/dist/exec.js.map +1 -1
- package/dist/format.js.map +1 -1
- package/dist/glob.js +61 -11
- package/dist/glob.js.map +1 -1
- package/dist/grep.js +92 -39
- package/dist/grep.js.map +1 -1
- package/dist/index.d.ts +111 -2
- package/dist/index.js +532 -191
- package/dist/index.js.map +1 -1
- package/dist/install.js.map +1 -1
- package/dist/lint.js.map +1 -1
- package/dist/outdated.js.map +1 -1
- package/dist/pack.js +461 -161
- package/dist/pack.js.map +1 -1
- package/dist/test.js.map +1 -1
- package/dist/typecheck.js.map +1 -1
- package/package.json +2 -2
|
@@ -362,6 +362,8 @@ var IndexStore = class {
|
|
|
362
362
|
this.db.exec("CREATE INDEX IF NOT EXISTS idx_s_kind ON symbols(kind)");
|
|
363
363
|
this.db.exec("CREATE INDEX IF NOT EXISTS idx_s_lang ON symbols(lang)");
|
|
364
364
|
this.db.exec("CREATE INDEX IF NOT EXISTS idx_s_file ON symbols(file)");
|
|
365
|
+
this.db.exec("CREATE INDEX IF NOT EXISTS idx_s_lang_kind ON symbols(lang, kind)");
|
|
366
|
+
this.db.exec("CREATE INDEX IF NOT EXISTS idx_s_file_fk ON symbols(file_fk)");
|
|
365
367
|
this.db.exec(`
|
|
366
368
|
CREATE TABLE IF NOT EXISTS refs (
|
|
367
369
|
id INTEGER PRIMARY KEY,
|
|
@@ -1274,9 +1276,9 @@ async function syncGoParse(filePath, content, lang) {
|
|
|
1274
1276
|
}
|
|
1275
1277
|
}
|
|
1276
1278
|
async function parseSymbols3(opts) {
|
|
1277
|
-
const { file, lang } = opts;
|
|
1279
|
+
const { file, content, lang } = opts;
|
|
1278
1280
|
try {
|
|
1279
|
-
return await syncPyParse(file, lang);
|
|
1281
|
+
return await syncPyParse(file, content, lang);
|
|
1280
1282
|
} catch {
|
|
1281
1283
|
return { file, lang, symbols: [], mtimeMs: Date.now() };
|
|
1282
1284
|
}
|
|
@@ -1344,8 +1346,7 @@ syms = []
|
|
|
1344
1346
|
errors = []
|
|
1345
1347
|
|
|
1346
1348
|
try:
|
|
1347
|
-
|
|
1348
|
-
source = f.read()
|
|
1349
|
+
source = sys.stdin.read()
|
|
1349
1350
|
tree = ast.parse(source, filename=sys.argv[1])
|
|
1350
1351
|
except Exception as e:
|
|
1351
1352
|
errors.append(str(e))
|
|
@@ -1485,16 +1486,21 @@ visitor.visit(tree)
|
|
|
1485
1486
|
|
|
1486
1487
|
print(json.dumps([s.to_dict() for s in syms]))
|
|
1487
1488
|
`;
|
|
1488
|
-
|
|
1489
|
+
var _cachedScriptPath = null;
|
|
1490
|
+
async function syncPyParse(filePath, content, lang) {
|
|
1489
1491
|
try {
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1492
|
+
if (!_cachedScriptPath) {
|
|
1493
|
+
const tmpDir = path4.join(os.tmpdir(), "ws-py-parse");
|
|
1494
|
+
await fs6.mkdir(tmpDir, { recursive: true });
|
|
1495
|
+
_cachedScriptPath = path4.join(tmpDir, "parse.py");
|
|
1496
|
+
await fs6.writeFile(_cachedScriptPath, PY_PARSE_SCRIPT, "utf8");
|
|
1497
|
+
}
|
|
1498
|
+
const proc = spawn("python", [_cachedScriptPath, filePath], {
|
|
1495
1499
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1496
1500
|
windowsHide: true
|
|
1497
1501
|
});
|
|
1502
|
+
proc.stdin?.write(content);
|
|
1503
|
+
proc.stdin?.end();
|
|
1498
1504
|
let stdout = "";
|
|
1499
1505
|
proc.stdout?.on("data", (chunk) => {
|
|
1500
1506
|
stdout += chunk.toString();
|
|
@@ -2161,7 +2167,7 @@ async function parseFile(file, content, lang) {
|
|
|
2161
2167
|
case "go":
|
|
2162
2168
|
return parseSymbols2({ file, content, lang: "go" });
|
|
2163
2169
|
case "py":
|
|
2164
|
-
return parseSymbols3({ file, lang: "py" });
|
|
2170
|
+
return parseSymbols3({ file, content, lang: "py" });
|
|
2165
2171
|
case "rs":
|
|
2166
2172
|
return parseSymbols4({ file, content, lang: "rs" });
|
|
2167
2173
|
case "json":
|
|
@@ -2192,10 +2198,12 @@ async function runIndexerWithStore(store, opts) {
|
|
|
2192
2198
|
let symbolsIndexed = 0;
|
|
2193
2199
|
const isGitIgnored = await loadGitignoreMatcher(projectRoot);
|
|
2194
2200
|
let files;
|
|
2201
|
+
let discoveredFiles = null;
|
|
2195
2202
|
if (opts.files && opts.files.length > 0) {
|
|
2196
2203
|
files = opts.files.map((f) => path4.resolve(projectRoot, f)).filter((f) => !isGitIgnored(path4.relative(projectRoot, f).replace(/\\/g, "/"), false));
|
|
2197
2204
|
} else {
|
|
2198
2205
|
files = await findSourceFiles(projectRoot, ignore, isGitIgnored, signal);
|
|
2206
|
+
discoveredFiles = new Set(files);
|
|
2199
2207
|
}
|
|
2200
2208
|
if (langs && langs.length > 0) {
|
|
2201
2209
|
const langSet = new Set(langs);
|
|
@@ -2313,11 +2321,11 @@ async function runIndexerWithStore(store, opts) {
|
|
|
2313
2321
|
filesIndexed++;
|
|
2314
2322
|
}
|
|
2315
2323
|
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2324
|
+
if (discoveredFiles) {
|
|
2325
|
+
for (const [file_] of existingMeta) {
|
|
2326
|
+
if (!discoveredFiles.has(file_)) {
|
|
2327
|
+
store.deleteFile(file_);
|
|
2328
|
+
}
|
|
2321
2329
|
}
|
|
2322
2330
|
}
|
|
2323
2331
|
const durationMs = Date.now() - startMs;
|