@wrongstack/tools 0.277.1 → 0.280.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/bash.js +2 -2
- package/dist/bash.js.map +1 -1
- package/dist/builtin.js +314 -15
- package/dist/builtin.js.map +1 -1
- package/dist/codebase-index/index.js +12 -11
- package/dist/codebase-index/index.js.map +1 -1
- package/dist/codebase-index/worker.js +12 -11
- package/dist/codebase-index/worker.js.map +1 -1
- package/dist/exec-Ca3fnpUh.d.ts +121 -0
- package/dist/exec.d.ts +2 -39
- package/dist/exec.js +322 -11
- package/dist/exec.js.map +1 -1
- package/dist/index.d.ts +46 -3
- package/dist/index.js +629 -153
- package/dist/index.js.map +1 -1
- package/dist/install.js.map +1 -1
- package/dist/json.js +0 -1
- package/dist/json.js.map +1 -1
- package/dist/logs.js.map +1 -1
- package/dist/pack.js +314 -15
- package/dist/pack.js.map +1 -1
- package/dist/scaffold.js.map +1 -1
- package/dist/tool-icons.js +6 -6
- package/dist/tool-icons.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ import * as fs from 'node:fs';
|
|
|
5
5
|
import * as path4 from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { Worker } from 'node:worker_threads';
|
|
8
|
-
import * as
|
|
8
|
+
import * as fs2 from 'node:fs/promises';
|
|
9
9
|
import * as ts from 'typescript';
|
|
10
10
|
import { execFileSync, spawn } from 'node:child_process';
|
|
11
11
|
import * as os from 'node:os';
|
|
@@ -1368,11 +1368,10 @@ func formatType(t ast.Expr) string {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
`;
|
|
1370
1370
|
async function syncGoParse(filePath, content, lang) {
|
|
1371
|
-
const tmpDir = path4.join(os.tmpdir(), "ws-go-parse");
|
|
1371
|
+
const tmpDir = await fs2.mkdtemp(path4.join(os.tmpdir(), "ws-go-parse-"));
|
|
1372
1372
|
try {
|
|
1373
|
-
await fs6.mkdir(tmpDir, { recursive: true });
|
|
1374
1373
|
const scriptPath = path4.join(tmpDir, "parse.go");
|
|
1375
|
-
await
|
|
1374
|
+
await fs2.writeFile(scriptPath, GO_PARSE_SCRIPT, "utf8");
|
|
1376
1375
|
const proc = spawn("go", ["run", scriptPath], {
|
|
1377
1376
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1378
1377
|
windowsHide: true
|
|
@@ -1414,6 +1413,8 @@ async function syncGoParse(filePath, content, lang) {
|
|
|
1414
1413
|
return { file: filePath, lang, symbols, mtimeMs: Date.now() };
|
|
1415
1414
|
} catch {
|
|
1416
1415
|
return { file: filePath, lang, symbols: [], mtimeMs: Date.now() };
|
|
1416
|
+
} finally {
|
|
1417
|
+
await fs2.rm(tmpDir, { recursive: true, force: true });
|
|
1417
1418
|
}
|
|
1418
1419
|
}
|
|
1419
1420
|
async function parseSymbols3(opts) {
|
|
@@ -1632,9 +1633,9 @@ async function syncPyParse(filePath, content, lang) {
|
|
|
1632
1633
|
try {
|
|
1633
1634
|
if (!_cachedScriptPath) {
|
|
1634
1635
|
const tmpDir = path4.join(os.tmpdir(), "ws-py-parse");
|
|
1635
|
-
await
|
|
1636
|
+
await fs2.mkdir(tmpDir, { recursive: true });
|
|
1636
1637
|
_cachedScriptPath = path4.join(tmpDir, "parse.py");
|
|
1637
|
-
await
|
|
1638
|
+
await fs2.writeFile(_cachedScriptPath, PY_PARSE_SCRIPT, "utf8");
|
|
1638
1639
|
}
|
|
1639
1640
|
const proc = spawn("python", [_cachedScriptPath, filePath], {
|
|
1640
1641
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -1718,7 +1719,7 @@ async function tryNativeParse(file, content) {
|
|
|
1718
1719
|
const toolsDir = path4.join(process.cwd(), "tools");
|
|
1719
1720
|
const crateDir = path4.join(toolsDir, "syn-parser");
|
|
1720
1721
|
const tmpFile = path4.join(crateDir, "src", "input.rs");
|
|
1721
|
-
await
|
|
1722
|
+
await fs2.writeFile(tmpFile, content, "utf8");
|
|
1722
1723
|
const proc = spawn(
|
|
1723
1724
|
"cargo",
|
|
1724
1725
|
["run", "--manifest-path", path4.join(toolsDir, "Cargo.toml")],
|
|
@@ -2213,7 +2214,7 @@ function compileGitignore(lines) {
|
|
|
2213
2214
|
async function loadGitignoreMatcher(projectRoot) {
|
|
2214
2215
|
let lines = [];
|
|
2215
2216
|
try {
|
|
2216
|
-
const raw = await
|
|
2217
|
+
const raw = await fs2.readFile(path4.join(projectRoot, ".gitignore"), "utf8");
|
|
2217
2218
|
lines = raw.split("\n");
|
|
2218
2219
|
} catch {
|
|
2219
2220
|
}
|
|
@@ -2271,7 +2272,7 @@ async function findSourceFiles(projectRoot, ignore, isGitIgnored, signal) {
|
|
|
2271
2272
|
}
|
|
2272
2273
|
let entries;
|
|
2273
2274
|
try {
|
|
2274
|
-
entries = await
|
|
2275
|
+
entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
2275
2276
|
} catch {
|
|
2276
2277
|
return;
|
|
2277
2278
|
}
|
|
@@ -2371,7 +2372,7 @@ async function runIndexerWithStore(store, opts) {
|
|
|
2371
2372
|
batchFiles.map(async (file) => {
|
|
2372
2373
|
let stat2;
|
|
2373
2374
|
try {
|
|
2374
|
-
stat2 = await
|
|
2375
|
+
stat2 = await fs2.stat(file, statOpts);
|
|
2375
2376
|
} catch (e) {
|
|
2376
2377
|
if (isAbortError(e)) throw e;
|
|
2377
2378
|
return { file, stat: null, lang: "", parsed: null, error: `stat error: ${e instanceof Error ? e.message : String(e)}` };
|
|
@@ -2385,7 +2386,7 @@ async function runIndexerWithStore(store, opts) {
|
|
|
2385
2386
|
}
|
|
2386
2387
|
let content;
|
|
2387
2388
|
try {
|
|
2388
|
-
content = await
|
|
2389
|
+
content = await fs2.readFile(file, { encoding: "utf8", signal });
|
|
2389
2390
|
} catch (e) {
|
|
2390
2391
|
if (isAbortError(e)) throw e;
|
|
2391
2392
|
return { file, stat: stat2, lang, parsed: null, error: `read error: ${e instanceof Error ? e.message : String(e)}` };
|